Example #1
0
        public void OnGUI()
        {
            DrawToolbar();

            if (InventoryScriptableObjectUtility.isPrefabsSaveFolderSet == false || InventoryScriptableObjectUtility.isPrefabsSaveFolderValid == false)
            {
                SettingsEditor.DrawSaveFolderPicker();
                return;
            }

            if (_toolbarIndex < 0 || _toolbarIndex >= _editors.Count || _editors.Count == 0)
            {
                _toolbarIndex = 0;
                CreateEditors();
            }

            if (_editors.Count == 0)
            {
                EditorGUILayout.LabelField("No editor pages found");
                if (GUILayout.Button("Force refresh"))
                {
                    _toolbarIndex = 0;
                    CreateEditors();
                }

                return;
            }

            // Draw the editor
            _editors[_toolbarIndex].Draw();

            DrawMiniToolbar(GameRulesWindow.GetAllActiveRules().ToList());
        }
Example #2
0
        private void OnEnable()
        {
            minSize      = new Vector2(600.0f, 400.0f);
            toolbarIndex = 0;

            //if (ItemManager.database == null)
            //    return;

            //            _databasesInProject = AssetDatabase.FindAssets("t:" + typeof(InventoryItemDatabase).Name);

            _gameRules = GameRulesWindow.GetAllActiveRules();
            GameRulesWindow.CheckForIssues();
            GameRulesWindow.OnIssuesUpdated += UpdateMiniToolbar;

            CreateEditors();
        }
Example #3
0
        public void OnGUI()
        {
            DrawToolbar();

//            EditorPrefs.DeleteKey("InventorySystem_ItemPrefabPath");

            if (QuestManager.instance != null)
            {
                Devdog.General.Editors.EditorUtility.ErrorIfEmpty(EditorPrefs.GetString(SettingsEditor.PrefabSaveKey) == string.Empty, "Prefab folder is not set, items cannot be saved.");
                if (EditorPrefs.GetString(SettingsEditor.PrefabSaveKey) == string.Empty)
                {
                    GUI.enabled  = true;
                    toolbarIndex = editors.Count - 1;
                    // Draw the editor
                    editors[toolbarIndex].Draw();

                    if (GUI.changed)
                    {
                        UnityEditor.EditorUtility.SetDirty(QuestManager.instance); // To make sure it gets saved.
                    }

                    GUI.enabled = false;
                    return;
                }

                if (toolbarIndex < 0 || toolbarIndex >= editors.Count || editors.Count == 0)
                {
                    toolbarIndex = 0;
                    CreateEditors();
                }

                // TODO: Error when no manager is present!

                // Draw the editor
                editors[toolbarIndex].Draw();

                if (GUI.changed)
                {
                    UnityEditor.EditorUtility.SetDirty(QuestManager.instance); // To make sure it gets saved.
                }
            }

            DrawMiniToolbar(GameRulesWindow.GetAllActiveRules().ToList());
        }