示例#1
0
        internal static void DrawMiniToolbar()
        {
            GUILayout.BeginVertical("Toolbar", GUILayout.ExpandWidth(true));

            var issueCount = _gameRules.Sum(o => o.ignore == false ? o.issues.Count : 0);

            if (issueCount > 0)
            {
                GUI.color = Color.red;
            }
            else
            {
                GUI.color = Color.green;
            }

            if (GUILayout.Button(issueCount + " issues found in scene.", "toolbarbutton", GUILayout.Width(300)))
            {
                GameRulesWindow.ShowWindow();
            }

            GUI.color = Color.white;

            if (ItemManager.itemDatabaseLookup.hasSelectedDatabase)
            {
                var style = UnityEditor.EditorStyles.centeredGreyMiniLabel;

                var r = new Rect(320, window.position.height - 18, window.position.width - 320, 20);
                GUI.Label(r, "Selected database: " + AssetDatabase.GetAssetPath(ItemManager.database), style);
            }

            GUILayout.EndVertical();
        }
示例#2
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());
        }
示例#3
0
        private void OnEnable()
        {
            minSize       = new Vector2(600.0f, 400.0f);
            _toolbarIndex = 0;

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

            CreateEditors();
        }
        private void DrawStep5()
        {
            // All done
            GUILayout.Label("All done!");
            if (GUILayout.Button("Check issue detector"))
            {
                GameRulesWindow.ShowWindow();
            }

            if (GUILayout.Button("Close window"))
            {
                Close();
            }
        }
示例#5
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);

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

            CreateEditors();
        }
示例#6
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());
        }
示例#7
0
        internal static void DrawMiniToolbar(List <IGameRule> issues)
        {
            GUILayout.BeginVertical("Toolbar", GUILayout.ExpandWidth(true));

            var issueCount = issues.Sum(o => o.ignore == false ? o.issues.Count : 0);

            if (issueCount > 0)
            {
                GUI.color = Color.red;
            }
            else
            {
                GUI.color = Color.green;
            }

            if (GUILayout.Button(issueCount + " issues found in scene.", "toolbarbutton", GUILayout.Width(300)))
            {
                GameRulesWindow.ShowWindow();
            }
            GUI.color = Color.white;

            GUILayout.EndVertical();
        }
        private void menuItemGameRules_Click(object sender, RoutedEventArgs e)
        {
            GameRulesWindow gameRulesWindow = new GameRulesWindow();

            gameRulesWindow.Show();
        }