Tanoda
pb_Vector3Inspector.cs
Go to the documentation of this file.
1using UnityEngine;
2using System.Collections;
3using System.Reflection;
4
5namespace GILES.Interface
6{
10 [pb_TypeInspector(typeof(Vector3))]
11 public class pb_Vector3Inspector : pb_TypeInspector
12 {
13 Vector3 vector;
14
15 public UnityEngine.UI.Text title;
16
17 public UnityEngine.UI.InputField
21
22 void OnGUIChanged()
23 {
24 SetValue(vector);
25 }
26
27 public override void InitializeGUI()
28 {
29 title.text = GetName().SplitCamelCase();
30
31#if UNITY_5_2
32 input_x.onValueChange.AddListener( OnValueChange_X );
33 input_y.onValueChange.AddListener( OnValueChange_Y );
34 input_z.onValueChange.AddListener( OnValueChange_Z );
35#else
36 input_x.onValueChanged.AddListener( OnValueChange_X );
37 input_y.onValueChanged.AddListener( OnValueChange_Y );
38 input_z.onValueChanged.AddListener( OnValueChange_Z );
39#endif
40 }
41
42 protected override void OnUpdateGUI()
43 {
44 vector = GetValue<Vector3>();
45
46 input_x.text = vector.x.ToString("F4");
47 input_y.text = vector.y.ToString("F4");
48 input_z.text = vector.z.ToString("F4");
49 }
50
51 public void OnValueChange_X(string val)
52 {
53 vector.x = Macro.StoF(val);
54 OnGUIChanged();
55 }
56
57 public void OnValueChange_Y(string val)
58 {
59 vector.y = Macro.StoF(val);
60 OnGUIChanged();
61 }
62
63 public void OnValueChange_Z(string val)
64 {
65 vector.z = Macro.StoF(val);
66 OnGUIChanged();
67 }
68 }
69}
Definition: Macro.cs:12
static float StoF(string value)
Definition: Macro.cs:24