예제 #1
0
        void DrawExpand(ILHotMonoProxyStruct monoStruct, IrpClassInfo classInfo, string baseName, SerializedProperty serializedProperty, bool draw)
        {
            foreach (var field in classInfo.Fields)
            {
                var fieldKey = string.Concat(baseName, field.FieldName);
                if (field.FieldType == typeof(string).ToString())
                {
                    DrawText(field.FieldName, fieldKey, monoStruct.StringValues, monoStruct.NewStringValues, draw);
                }
                else if (field.FieldType == typeof(float).ToString())
                {
                    DrawFloat(field.FieldName, fieldKey, monoStruct.FloatValues, monoStruct.NewFloatValues, draw);
                }
                else if (field.FieldType == typeof(bool).ToString())
                {
                    DrawBool(field.FieldName, fieldKey, monoStruct.BoolValues, monoStruct.NewBoolValues, draw);
                }
                else if (field.FieldType.Contains(typeof(UnityEngine.Object).ToString()))
                {
                    DrawObject(field.FieldName, fieldKey, field.FieldType, monoStruct.ObjectValues, monoStruct.NewObjectValues, draw);
                }
                else
                {
                    Debug.Log("field.FieldName " + field.FieldName);
                    var info = ILReflectJsonImport.MonoClassInfoList.Find(i => i.ClassName == field.FieldType);
                    if (info.IsObject == true)
                    {
                        DrawILObject(field.FieldName, fieldKey, field.FieldType, monoStruct, field.ClassInfo, draw);
                    }
                    else
                    {
                        var drawClass = field.ClassInfo;

                        var currentValue = true;
                        if (monoStruct.ExpandValues.ContainsKey(fieldKey))
                        {
                            currentValue = monoStruct.ExpandValues[fieldKey];
                        }

                        currentValue = EditorGUILayout.Foldout(currentValue, field.FieldName);
                        if (currentValue)
                        {
                            EditorGUI.indentLevel += 1;
                            DrawExpand(monoStruct, drawClass, string.Concat(fieldKey, "."), serializedProperty, true);
                            EditorGUI.indentLevel -= 1;
                        }
                        else
                        {
                            DrawExpand(monoStruct, drawClass, string.Concat(fieldKey, "."), serializedProperty, false);
                        }
                        monoStruct.NewExpandValues.Add(fieldKey, currentValue);
                    }
                }
            }
        }
예제 #2
0
 void DrawExpand(ILHotFsmProxyStruct fsmStruct, IrpClassInfo classInfo, string baseName, bool draw)
 {
     //  foreach (var field in classInfo.Fields)
     //  {
     //      var fieldKey    = string.Concat(baseName, field.FieldName);
     //      if (field.FieldType == typeof(FsmEvent))
     //      {
     //          DrawEvents(fieldKey, field.FieldName, fsmStruct.PreviousEventValueMapping, fsmStruct.NewEventValueMapping, draw);
     //      }
     //      else if (field.FieldType == typeof(FsmString)
     //          || field.FieldType == typeof(FsmFloat)
     //          || field.FieldType == typeof(FsmBool)
     //          || field.FieldType == typeof(FsmObject))
     //      {
     //          DrawNamedVariable(fieldKey, field.FieldName, field.FieldType, fsmStruct.PreviousVariableValueMapping, fsmStruct.NewVariableValueMapping, draw);
     //      }
     //      else if (field.FieldType.GetCustomAttributes(typeof(ILHotFsmSerilizableAttribute), false).Length != 0)
     //      {
     //          var drawClass = field.ClassInfo;
     //
     //          FsmBool currentValue = true;
     //          if (((FsmBool)(fsmStruct.PreviousExpandValues.ContainsKey(fieldKey))).Value)
     //              currentValue = (FsmBool)(fsmStruct.PreviousExpandValues[fieldKey]);
     //
     //          currentValue.Value = FsmEditorGUILayout.BoldFoldout(currentValue.Value, new GUIContent(field.FieldName));
     //          if (currentValue.Value)
     //          {
     //              EditorGUI.indentLevel += 1;
     //              DrawExpand(fsmStruct, drawClass, string.Concat(fieldKey, "."), true);
     //              EditorGUI.indentLevel -= 1;
     //          }
     //          else
     //          {
     //              DrawExpand(fsmStruct, drawClass, string.Concat(fieldKey, "."), false);
     //          }
     //
     //          fsmStruct.NewExpandValues.Add(fieldKey, currentValue);
     //      }
     //  }
 }
예제 #3
0
        void DrawILObject(string fieldName, string fieldKey, string fieldType, ILHotMonoProxyStruct monoStruct, IrpClassInfo fieldClassInfo, bool draw)
        {
            ILHotMonoProxy currentValue = null;

            if (monoStruct.ComponentValues.ContainsKey(fieldKey))
            {
                currentValue = monoStruct.ComponentValues[fieldKey] as ILHotMonoProxy;
            }

            if (draw)
            {
                currentValue = EditorGUILayout.ObjectField(fieldKey, currentValue, typeof(ILHotMonoProxy), true) as ILHotMonoProxy;
            }

            monoStruct.NewComponentValues.Add(fieldKey, currentValue);
            if (monoStruct.NewComponentValues.ContainsKey(fieldKey))
            {
                PickILHotMonoValues(fieldKey, monoStruct, (ILHotMonoProxy)monoStruct.NewComponentValues[fieldKey]);
            }
        }