예제 #1
0
        protected override void OnBeginDrawEditors()
        {
            var selected      = this.MenuTree.Selection.FirstOrDefault();
            var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight;

            // Draws a toolbar with the name of the currently selected menu item.
            SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight);
            {
                if (selected != null)
                {
                    GUILayout.Label(selected.Name);
                }

                if (SirenixEditorGUI.ToolbarButton(new GUIContent("Create Item")))
                {
                    ScriptableObjectCreator.ShowDialog <Item>("Assets/RPG Editor/Items", obj =>
                    {
                        obj.Name = obj.name;
                        base.TrySelectMenuItemWithObject(obj); // Selects the newly created item in the editor
                    });
                }

                if (SirenixEditorGUI.ToolbarButton(new GUIContent("Create Character")))
                {
                    ScriptableObjectCreator.ShowDialog <Character>("Assets/RPG Editor/Character", obj =>
                    {
                        obj.Name = obj.name;
                        base.TrySelectMenuItemWithObject(obj); // Selects the newly created item in the editor
                    });
                }
            }
            SirenixEditorGUI.EndHorizontalToolbar();
        }
예제 #2
0
        protected override void OnBeginDrawEditors()
        {
            var selected      = MenuTree.Selection.FirstOrDefault();
            var toolbarHeight = MenuTree.Config.SearchToolbarHeight;

            SirenixEditorGUI.BeginHorizontalToolbar(toolbarHeight);
            {
                if (selected != null)
                {
                    GUILayout.Label(selected.Name);
                }

                // if (SirenixEditorGUI.ToolbarButton(new GUIContent("Create UnitTypes")))
                // {
                //     AssetDatabase.DeleteAsset(GV.UnitSoPath + GV.UnitTypesAsset);
                //     AssetDatabase.CreateAsset(CreateInstance<UnitTypes>(), GV.UnitSoPath + GV.UnitTypesAsset);
                //
                //     TrySelectMenuItemWithObject(typeof(UnitTypes));
                // }

                if (SirenixEditorGUI.ToolbarButton(new GUIContent("Create Unit")))
                {
                    ScriptableObjectCreator.ShowDialog <UnitData>(GV.UnitSoPath, obj =>
                    {
                        obj.Name = obj.name;
                        TrySelectMenuItemWithObject(obj);
                    });
                }

                if (SirenixEditorGUI.ToolbarButton(new GUIContent("Create Inventory")))
                {
                    AssetDatabase.DeleteAsset(GV.ItemsSoPath + GV.EditorInventoryAsset);
                    AssetDatabase.CreateAsset(CreateInstance <EditorInventory>(), GV.InventorySoPath + GV.EditorInventoryAsset);

                    TrySelectMenuItemWithObject(typeof(EditorInventory));
                }

                if (SirenixEditorGUI.ToolbarButton(new GUIContent("Create Ability")))
                {
                    ScriptableObjectCreator.ShowDialog <Ability>(GV.AbilitiesSoPath, obj =>
                    {
                        obj.Name = obj.name;
                        TrySelectMenuItemWithObject(obj);
                    });
                }

                if (SirenixEditorGUI.ToolbarButton(new GUIContent("Create Item")))
                {
                    ScriptableObjectCreator.ShowDialog <Item>(GV.ItemsSoPath, obj =>
                    {
                        obj.Name = obj.name;
                        TrySelectMenuItemWithObject(obj);
                    });
                }

                if (SirenixEditorGUI.ToolbarButton(new GUIContent("Save")))
                {
                    AssetDatabase.SaveAssets();
                }
            }
            SirenixEditorGUI.EndHorizontalToolbar();
        }