コード例 #1
0
    private Move AddMove()
    {
        Move moveHolder = null;

        ScriptableObjectCreator.ShowDialog <Move>("Assets/[Source]/Prefabs/Moves", obj =>
        {
            moveHolder = obj;
        });

        return(moveHolder);
    }
コード例 #2
0
    private void SaveLevel()
    {
        var clone = ScriptableObject.Instantiate <LevelConfig>(_levelConfig);

        if (_levelConfig.NameKey == null || _levelConfig.NameKey == string.Empty)
        {
            _levelConfig.NameKey = _saveFileName;
        }
        var folder = "Assets/Src/Configs/Levels/";

        ScriptableObjectCreator.SaveAsset(_levelConfig, folder, _saveFileName, true);
        EditorUtility.FocusProjectWindow();

        _levelConfig = clone;
    }
コード例 #3
0
    protected override void OnBeginDrawEditors()
    {
        var selected      = this.MenuTree.Selection.FirstOrDefault();
        var toolbarHeight = this.MenuTree.Config.SearchToolbarHeight;

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

            if (SirenixEditorGUI.ToolbarButton(new GUIContent("创建模组")))
            {
                ScriptableObjectCreator.ShowDialog <ModuleSet>("Assets/Resources/ScriptObject/ModuleSet", obj =>
                {
                    obj.moduleName = obj.name;
                    base.TrySelectMenuItemWithObject(obj); // Selects the newly created item in the editor
                });
            }

            if (SirenixEditorGUI.ToolbarButton(new GUIContent("创建怪物")))
            {
                ScriptableObjectCreator.ShowDialog <MonsterSet>("Assets/Resources/ScriptObject/MonsterSet", obj =>
                {
                    obj.monsterSpecificName = obj.name;
                    base.TrySelectMenuItemWithObject(obj); // Selects the newly created item in the editor
                });
            }
            if (SirenixEditorGUI.ToolbarButton(new GUIContent("创建技能")))
            {
                ScriptableObjectCreator.ShowDialog <SkillSet>("Assets/Resources/ScriptObject/SkillSet", obj =>
                {
                    obj.skillName = obj.name;
                    base.TrySelectMenuItemWithObject(obj); // Selects the newly created item in the editor
                });
            }
        }
        SirenixEditorGUI.EndHorizontalToolbar();
    }
コード例 #4
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 Buff Item")))
            {
                ScriptableObjectCreator.ShowDialog <CSBuff>("Assets/Editor/BuffEditor/Buff",
                                                            obj =>
                {
                    base.TrySelectMenuItemWithObject(obj);     // Selects the newly created item in the editor
                });
            }
        }
        SirenixEditorGUI.EndHorizontalToolbar();
    }
コード例 #5
0
    void OnGUI()
    {
        minSize = new Vector2(410, 350);

        //creador de quests vacias
        EditorGUILayout.LabelField("Create quest", EditorStyles.boldLabel);
        EditorGUILayout.HelpBox("Create an empty quest", MessageType.None);
        _questID = EditorGUILayout.TextField("Quest name", _questID);

        EditorGUILayout.BeginHorizontal();
        GUILayoutUtility.GetRect(1, 1);
        GUILayoutUtility.GetRect(1, 1);
        if (GUILayout.Button("Create empty quest", GUILayout.Height(20), GUILayout.Width(175)))
        {
            if (_questID != null && _questID.Length > 0)
            {
                GetWindow <QuestCreatorWindow>().Close();
                GetWindow <QuestLogWindow>().Close();
                _questNameTrigger = false;
                _focusQuest       = ScriptableObjectCreator.CreateSO <QuestLayout>(_questID);
                GetWindow <QuestCreatorWindow>().currentQuest = (QuestLayout)_focusQuest;
                GetWindow <QuestCreatorWindow>().Show();
                Repaint();
            }
            else
            {
                _questNameTrigger = true;
            }
        }
        GUILayoutUtility.GetRect(1, 1);
        EditorGUILayout.EndHorizontal();
        if (_questNameTrigger)
        {
            EditorGUILayout.HelpBox("Insert quest name/id", MessageType.Error);
        }

        //buscador por drageo de objeto
        var aux = _focusQuest;

        EditorGUILayout.LabelField("Quest search window", EditorStyles.boldLabel);

        EditorGUILayout.HelpBox("Drag and drop the quest", MessageType.None);
        _focusQuest = (ScriptableObject)EditorGUILayout.ObjectField("Quest to search", _focusQuest, typeof(ScriptableObject), false);

        EditorGUILayout.BeginHorizontal();
        GUILayoutUtility.GetRect(1, 1);
        GUILayoutUtility.GetRect(1, 1);
        if (GUILayout.Button("Open selected quest", GUILayout.Height(20), GUILayout.Width(175)))
        {
            if (_focusQuest != null)
            {
                GetWindow <QuestCreatorWindow>().currentQuest = (QuestLayout)_focusQuest;
                GetWindow <QuestCreatorWindow>().Show();
            }
        }
        GUILayoutUtility.GetRect(1, 1);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        //buscador de quest por nombre
        EditorGUILayout.HelpBox("Search the quest by name", MessageType.None);
        QuestSearcher();

        //si cambio el target cierro las ventanas de trabajo, y abro el nuevo target
        if (_focusQuest != aux)
        {
            GetWindow <QuestCreatorWindow>().Close();
            GetWindow <QuestLogWindow>().Close();
            GetWindow <QuestCreatorWindow>().currentQuest = (QuestLayout)_focusQuest;
            GetWindow <QuestCreatorWindow>().Show();
        }
    }
コード例 #6
0
    static void Init()
    {
        ScriptableObjectCreator window = EditorWindow.GetWindow <ScriptableObjectCreator>("Create ScriptableObject", true);

        window.Show();
    }
コード例 #7
0
 private static void CreateScriptableObjectSingletonEnsured()
 {
     ScriptableObjectCreator.Create <Example_ScriptableObjectSingleton_Ensured>();
 }
コード例 #8
0
 private static void CreateScriptableObjectSingleton()
 {
     ScriptableObjectCreator.Create <Example_ScriptableObjectSingleton>();
 }