Tanoda
pb_Vector4Inspector.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(Vector4))]
11 public class pb_Vector4Inspector : pb_TypeInspector
12 {
13 Vector4 vector;
14
15 public UnityEngine.UI.Text title;
16
17 public UnityEngine.UI.InputField
22
23 void OnGUIChanged()
24 {
25 SetValue(vector);
26 }
27
28 public override void InitializeGUI()
29 {
30 title.text = GetName().SplitCamelCase();
31
32#if UNITY_5_2
33 input_x.onValueChange.AddListener( OnValueChange_X );
34 input_y.onValueChange.AddListener( OnValueChange_Y );
35 input_z.onValueChange.AddListener( OnValueChange_Z );
36 input_w.onValueChange.AddListener( OnValueChange_W );
37#else
38 input_x.onValueChanged.AddListener( OnValueChange_X );
39 input_y.onValueChanged.AddListener( OnValueChange_Y );
40 input_z.onValueChanged.AddListener( OnValueChange_Z );
41 input_w.onValueChanged.AddListener( OnValueChange_W );
42#endif
43 }
44
45 protected override void OnUpdateGUI()
46 {
47 vector = GetValue<Vector4>();
48 input_x.text = vector.x.ToString("F4");
49 input_y.text = vector.y.ToString("F4");
50 input_z.text = vector.z.ToString("F4");
51 input_w.text = vector.w.ToString("F4");
52 }
53
54 public void OnValueChange_X(string val)
55 {
56 vector.x = Macro.StoF(val);
57 OnGUIChanged();
58 }
59
60 public void OnValueChange_Y(string val)
61 {
62 vector.y = Macro.StoF(val);
63 OnGUIChanged();
64 }
65
66 public void OnValueChange_Z(string val)
67 {
68 vector.z = Macro.StoF(val);
69 OnGUIChanged();
70 }
71
72 public void OnValueChange_W(string val)
73 {
74 vector.w = Macro.StoF(val);
75 OnGUIChanged();
76 }
77 }
78}
Definition: Macro.cs:12
static float StoF(string value)
Definition: Macro.cs:24