예제 #1
0
			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 ();
                };
            }
예제 #2
0
        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);
            });
        }
예제 #3
0
			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();
				};
			}
예제 #4
0
        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);
            });
        }
예제 #5
0
 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 ();
     };
 }
예제 #6
0
 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();
     };
 }