void DesignList_SimpleClass()
        {
            if (SelectedJsonElement == null || SelectedJsonElement.jo ["Common"] ["Desc"] == null)
            {
                return;
            }

            JObject jo_common = SelectedJsonElement.jo ["Common"] as JObject;

            if (GUILayout.Button("<<"))
            {
                SelectedJsonElement    = null;
                SimpleClassMembersList = null;
                NeedRefresh            = true;

                AutoSelected.SelectedJsonFileName = string.Empty;
                AutoSelected.Save();

                return;
            }

            GUILayout.Label(string.Format("Workspace:{0}, SimpleClass:{1}", SelectedJsonElement.Workspace, SelectedJsonElement.Name), EditorStyles.boldLabel);

            jo_common ["Desc"] = GUILayout.TextArea(jo_common ["Desc"].Value <string> (), GUIStyleTemplate.GreenDescStyle2());

            if (jo_common ["Type"] == null)
            {
                jo_common.Add("Type", "");
            }

            GUILayout.BeginHorizontal();
            jo_common ["Type"] = EditorGUILayout.TextField("Base", jo_common ["Type"].Value <string> ());
            GUILayout.EndHorizontal();

            DesignList_SimpleClass_Member();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Reset"))
            {
                SelectedJsonElement.Load();
                ResetSimpleClassMembersList();
            }
            if (GUILayout.Button("Save"))
            {
                SaveJson();
            }
            if (GUILayout.Button("Save&Generate"))
            {
                SaveJson();

                Generator.GenerateCode(SelectedJsonElement.jo);

                AssetDatabase.Refresh();

                NeedRefresh = true;

                this.Repaint();
            }
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 2
0
        void DesignList_Element()
        {
            if (SelectedJsonElement == null || SelectedJsonElement.jo ["Common"] ["Desc"] == null)
            {
                return;
            }

            JObject jo_common = SelectedJsonElement.jo ["Common"] as JObject;

            if (GUILayout.Button("<<"))
            {
                SelectedJsonElement = null;
                ElementMembersList  = null;
                NeedRefresh         = true;

                AutoSelected.SelectedJsonFileName = string.Empty;
                AutoSelected.Save();

                return;
            }

            GUILayout.Label(string.Format("Workspace:{0}, Element:{1}", SelectedJsonElement.Workspace, SelectedJsonElement.Name), EditorStyles.boldLabel);

            jo_common ["Desc"] = GUILayout.TextArea(jo_common ["Desc"].Value <string> (), GUIStyleTemplate.GreenDescStyle2());

            if (jo_common ["Type"] == null)
            {
                jo_common.Add("Type", "");
            }

            GUILayout.BeginHorizontal();
            jo_common ["Type"] = EditorGUILayout.TextField("Base", jo_common ["Type"].Value <string> ());
            GUILayout.EndHorizontal();

            toolbar_index = GUILayout.Toolbar(toolbar_index, ToolbarHeaders, new GUILayoutOption[] { GUILayout.Height(25f) });

            switch (toolbar_index)
            {
            case 0:
                DesignList_Element_Member();
                break;

            case 1:
                DesignList_Element_View();
                break;

            default:
                break;
            }

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Reset"))
            {
                SelectedJsonElement.Load();
                ResetElementMembersList();
            }
            if (GUILayout.Button("Save"))
            {
                SaveJson();
            }
            if (GUILayout.Button("Save&Generate"))
            {
                SaveJson();

                Generator.GenerateCode(SelectedJsonElement.jo);

                AssetDatabase.Refresh();

                NeedRefresh = true;

                this.Repaint();
            }
            GUILayout.EndHorizontal();
        }