public GUIInt(System.Object data, FieldInfo fi) : base(data, fi) { TextInt = new TextInt((int)fi.GetValue(data)); _onGUI = () => { GUILayout.BeginHorizontal(); GUILayout.Label(string.Format("{0} ", fi.Name), GUILayout.ExpandWidth(false)); TextInt.StrValue = GUILayout.TextField(TextInt.StrValue, GUILayout.ExpandWidth(true), GUILayout.MinWidth(30f)); GUILayout.EndHorizontal(); Save (); }; }
public System.Action GenerateGUIInt(FieldInfo fi) { var textInt = new TextInt((int)fi.GetValue(data)); return(() => { GUILayout.BeginHorizontal(); GUILayout.Label(string.Format("{0} ", fi.Name), GUILayout.ExpandWidth(false)); textInt.StrValue = GUILayout.TextField(textInt.StrValue, GUILayout.ExpandWidth(true), GUILayout.MinWidth(30f)); GUILayout.EndHorizontal(); fi.SetValue(data, textInt.Value); }); }
public GUIEnum(System.Object data, FieldInfo fi) : base(data, fi) { var enumType = fi.FieldType; var list = new StringBuilder(); foreach (var selection in System.Enum.GetValues(enumType)) list.AppendFormat("{0}({1}) ", selection, (int)selection); TextInt = new TextInt((int)fi.GetValue(data)); _onGUI = () => { GUILayout.BeginHorizontal(); GUILayout.Label(string.Format("{0} ", fi.Name), GUILayout.ExpandWidth(false)); TextInt.StrValue = GUILayout.TextField(TextInt.StrValue, GUILayout.ExpandWidth(true), GUILayout.MinWidth(30f)); GUILayout.Label(string.Format("{0}({1})", GetEnumValue(), TextInt.Value)); GUILayout.EndHorizontal(); GUILayout.Label(list.ToString()); Save(); }; }
public System.Action GenerateGUIEnum(FieldInfo fi) { var enumType = fi.FieldType; var list = new StringBuilder(); foreach (var selection in System.Enum.GetValues(enumType)) { list.AppendFormat("{0}({1}) ", selection, (int)selection); } var textInt = new TextInt((int)fi.GetValue(data)); return(() => { var enumValue = System.Enum.ToObject(enumType, textInt.Value); GUILayout.BeginHorizontal(); GUILayout.Label(string.Format("{0} ", fi.Name), GUILayout.ExpandWidth(false)); textInt.StrValue = GUILayout.TextField(textInt.StrValue, GUILayout.ExpandWidth(true), GUILayout.MinWidth(30f)); GUILayout.Label(string.Format("{0}({1})", enumValue, textInt.Value)); GUILayout.EndHorizontal(); GUILayout.Label(list.ToString()); fi.SetValue(data, enumValue); }); }