static void Open()
        {
            win = GetWindow <EasyAssetBundleWindow>();
            win.titleContent.text = WindowHelper.WIN_TITLE;

            Initialize();
            Undo.undoRedoPerformed -= Initialize;
            Undo.undoRedoPerformed += Initialize;
        }
Beispiel #2
0
        public override void OnGUI(Rect rect)
        {
            GUI.skin.label.richText = true;
            GUILayout.Space(5);

            if (BuilderDataEditorUtility.BuilderDataMenu.Length > 0)
            {
                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    GUILayout.Label(new GUIContent("Create New BuilderData".ToBold(), GUIHelper.Textures.ScriptableObjectIcon), GUILayout.Height(20));

                    Undo.IncrementCurrentGroup();
                    UndoHelper.PopupWindowUndo(editorWindow, "Edit BuilderData name");
                    newBuilderDataName = EditorGUILayout.TextField(newBuilderDataName);

                    var selected = EditorGUILayout.Popup(selectedType, BuilderDataEditorUtility.BuilderDataMenu);
                    if (selectedType != selected)
                    {
                        UndoHelper.PopupWindowUndo(editorWindow, "Change selected script");
                        EditorGUIUtility.keyboardControl = 0;
                        selectedType = selected;
                    }

                    GUILayout.Space(3);

                    if (GUILayout.Button("Create"))
                    {
                        FileHelper.CreateNewAssetBundleBuildConfig(BuilderDataEditorUtility.BuilderDataType[selectedType], BuilderDataEditorUtility.BuilderDataMenu[selectedType], newBuilderDataName);
                        EasyAssetBundleWindow.Initialize();
                        this.editorWindow.Close();
                    }
                }
                EditorGUILayout.EndVertical();
            }
            else
            {
                selectedType = 0;
                EditorGUILayout.HelpBox("There is no BuilderScript.", MessageType.Warning);
            }

            GUILayout.Space(5);

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                GUILayout.Label(new GUIContent("Create New BuilderScript".ToBold(), GUIHelper.Textures.ScriptIcon), GUILayout.Height(20));

                Undo.IncrementCurrentGroup();
                UndoHelper.PopupWindowUndo(editorWindow, "Edit BuilderScript name");
                newBuilderScriptName = EditorGUILayout.TextField(newBuilderScriptName);

                GUILayout.Space(3);

                if (GUILayout.Button("Create"))
                {
                    FileHelper.CreateNewBuilderScript(newBuilderScriptName);
                    this.editorWindow.Close();
                }
            }
            EditorGUILayout.EndVertical();

            GUI.skin.label.richText = false;
        }