Tanoda
pb_FloatInspector.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(float))]
11 public class pb_FloatInspector : pb_TypeInspector
12 {
13 float value;
14
15 public UnityEngine.UI.Text title;
16 public UnityEngine.UI.InputField input;
17
18 void OnGUIChanged()
19 {
20 SetValue(value);
21 }
22
23 public override void InitializeGUI()
24 {
25 title.text = GetName().SplitCamelCase();
26#if UNITY_5_2
27 input.onValueChange.AddListener( OnValueChange );
28#else
29 input.onValueChanged.AddListener( OnValueChange );
30#endif
31 }
32
33
34 protected override void OnUpdateGUI()
35 {
36 value = GetValue<float>();
37 input.text = value.ToString();
38 }
39
40 public void OnValueChange(string val)
41 {
42 value = Macro.StoF(val);
43 OnGUIChanged();
44 }
45 }
46}
UnityEngine.UI.InputField input
Definition: Macro.cs:12
static float StoF(string value)
Definition: Macro.cs:24