public override void OnCreated(ILoading loading)
 {
     base.OnCreated(loading);
     TypeUtil.ClearTypeCache();
     ShaderUtil.ClearShaderCache();
 }
Пример #2
0
        void DoWatchesWindow()
        {
            watchesScroll = GUILayout.BeginScrollView(watchesScroll);

            foreach (var watch in watches.ToArray())
            {
                GUILayout.BeginHorizontal();

                var type = GetWatchType(watch);

                GUI.contentColor = config.typeColor;
                GUILayout.Label(type.ToString());
                GUI.contentColor = config.nameColor;
                GUILayout.Label(watch.ToString());
                GUI.contentColor = Color.white;
                GUILayout.Label(" = ");

                GUI.enabled = false;

                var value = watch.Evaluate();
                GUI.contentColor = config.valueColor;

                if (value == null || !TypeUtil.IsSpecialType(type))
                {
                    GUILayout.Label(value == null ? "null" : value.ToString());
                }
                else
                {
                    try
                    {
                        GUIControls.EditorValueField(watch, "watch." + watch, type, value);
                    }
                    catch (Exception)
                    {
                        GUILayout.Label(value == null ? "null" : value.ToString());
                    }
                }

                GUI.contentColor = Color.white;

                GUI.enabled = true;

                GUILayout.FlexibleSpace();

                if (GUILayout.Button("Find in Scene Explorer"))
                {
                    var sceneExplorer = FindObjectOfType <SceneExplorer>();
                    sceneExplorer.ExpandFromRefChain(watch.Trim(watch.Length - 1));
                    sceneExplorer.visible = true;
                }

                if (GUILayout.Button("Find in Resources Explorer"))
                {
                    var sceneExplorer = FindObjectOfType <ResourcesExplorer>();
                    sceneExplorer.ExpandFromRefChain(watch.Trim(watch.Length - 1));
                    sceneExplorer.visible = true;
                }

                if (GUILayout.Button("x", GUILayout.Width(24)))
                {
                    RemoveWatch(watch);
                }

                GUILayout.EndHorizontal();
            }

            GUILayout.EndScrollView();
        }
Пример #3
0
        public void DrawExpandedHeader()
        {
            GUILayout.BeginHorizontal();

            GUI.contentColor = Color.green;
            GUILayout.Label("Show:", GUILayout.ExpandWidth(false));
            GUI.contentColor = Color.white;

            GUILayout.Label("Fields");
            var showFields = GUILayout.Toggle(ModTools.Instance.config.sceneExplorerShowFields, "");

            if (ModTools.Instance.config.sceneExplorerShowFields != showFields)
            {
                ModTools.Instance.config.sceneExplorerShowFields = showFields;
                ModTools.Instance.SaveConfig();
            }

            GUILayout.Label("Properties");
            var showProperties = GUILayout.Toggle(ModTools.Instance.config.sceneExplorerShowProperties, "");

            if (ModTools.Instance.config.sceneExplorerShowProperties != showProperties)
            {
                ModTools.Instance.config.sceneExplorerShowProperties = showProperties;
                ModTools.Instance.SaveConfig();
            }

            GUILayout.Label("Methods");
            var showMethods = GUILayout.Toggle(ModTools.Instance.config.sceneExplorerShowMethods, "");

            if (ModTools.Instance.config.sceneExplorerShowMethods != showMethods)
            {
                ModTools.Instance.config.sceneExplorerShowMethods = showMethods;
                ModTools.Instance.SaveConfig();
            }

            GUILayout.FlexibleSpace();

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Configure font & colors", GUILayout.ExpandWidth(false)))
            {
                ModTools.Instance.sceneExplorerColorConfig.visible       = true;
                ModTools.Instance.sceneExplorerColorConfig.rect.position = rect.position + new Vector2(32.0f, 32.0f);
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUI.contentColor = Color.green;
            GUILayout.Label("Show field/ property modifiers:", GUILayout.ExpandWidth(false));
            var showModifiers = GUILayout.Toggle(ModTools.Instance.config.sceneExplorerShowModifiers, "");

            if (showModifiers != ModTools.Instance.config.sceneExplorerShowModifiers)
            {
                ModTools.Instance.config.sceneExplorerShowModifiers = showModifiers;
                ModTools.Instance.SaveConfig();
            }

            GUI.contentColor = Color.white;
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUI.contentColor = Color.green;
            GUILayout.Label("Show inherited members:", GUILayout.ExpandWidth(false));
            var showInheritedMembers = GUILayout.Toggle(ModTools.Instance.config.sceneExplorerShowInheritedMembers, "");

            if (showInheritedMembers != ModTools.Instance.config.sceneExplorerShowInheritedMembers)
            {
                ModTools.Instance.config.sceneExplorerShowInheritedMembers = showInheritedMembers;
                ModTools.Instance.SaveConfig();
                TypeUtil.ClearTypeCache();
            }

            GUI.contentColor = Color.white;
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUI.contentColor = Color.green;
            GUILayout.Label("Evaluate properties automatically:", GUILayout.ExpandWidth(false));
            var evaluatePropertiesAutomatically = GUILayout.Toggle(ModTools.Instance.config.sceneExplorerEvaluatePropertiesAutomatically, "");

            if (evaluatePropertiesAutomatically != ModTools.Instance.config.sceneExplorerEvaluatePropertiesAutomatically)
            {
                ModTools.Instance.config.sceneExplorerEvaluatePropertiesAutomatically = evaluatePropertiesAutomatically;
                ModTools.Instance.SaveConfig();
            }

            GUI.contentColor = Color.white;
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUI.contentColor = Color.green;
            GUILayout.Label("Sort alphabetically:", GUILayout.ExpandWidth(false));
            GUI.contentColor = Color.white;
            var sortAlphabetically = GUILayout.Toggle(ModTools.Instance.config.sceneExplorerSortAlphabetically, "");

            if (sortAlphabetically != ModTools.Instance.config.sceneExplorerSortAlphabetically)
            {
                ModTools.Instance.config.sceneExplorerSortAlphabetically = sortAlphabetically;
                ModTools.Instance.SaveConfig();
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            DrawFindGameObjectPanel();

            GUILayout.BeginHorizontal();

            if (GUILayout.Button("▲", GUILayout.ExpandWidth(false)))
            {
                headerExpanded = false;
                RecalculateAreas();
            }

            if (GUILayout.Button("Refresh", GUILayout.ExpandWidth(false)))
            {
                Refresh();
            }

            if (GUILayout.Button("Fold all/ Clear", GUILayout.ExpandWidth(false)))
            {
                ClearExpanded();
                Refresh();
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }
Пример #4
0
 public void Refresh()
 {
     UpdateObjectsList();
     TypeUtil.ClearTypeCache();
 }
 public void Refresh()
 {
     sceneRoots = GameObjectUtil.FindSceneRoots();
     TypeUtil.ClearTypeCache();
 }
Пример #6
0
        void DoWatchesWindow()
        {
            watchesScroll = GUILayout.BeginScrollView(watchesScroll);

            foreach (var watch in GetWatches())
            {
                GUILayout.BeginHorizontal();

                var type = GetWatchType(watch);

                GUI.contentColor = config.typeColor;
                GUILayout.Label(type.ToString());
                GUI.contentColor = config.nameColor;
                GUILayout.Label(watch.ToString());
                GUI.contentColor = Color.white;
                GUILayout.Label(" = ");

                if (IsConstWatch(watch))
                {
                    GUI.enabled = false;
                }

                var value = ReadWatch(watch);
                GUI.contentColor = config.valueColor;

                if (value == null || !TypeUtil.IsBuiltInType(type))
                {
                    GUILayout.Label(value == null ? "null" : value.ToString());
                }
                else
                {
                    try
                    {
                        var newValue = GUIControls.EditorValueField(watch, "watch." + watch, type, value);
                        if (newValue != value)
                        {
                            WriteWatch(watch, newValue);
                        }
                    }
                    catch (Exception)
                    {
                        GUILayout.Label(value == null ? "null" : value.ToString());
                    }
                }

                GUI.contentColor = Color.white;

                GUI.enabled = true;

                GUILayout.FlexibleSpace();

                if (GUILayout.Button("x", GUILayout.Width(24)))
                {
                    RemoveWatch(watch);
                }

                GUILayout.EndHorizontal();
            }

            GUILayout.EndScrollView();
        }