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 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(); }; }