Exemple #1
0
        public void OnGUI()
        {
            EditorApplication.update -= Theme.ShowWindow;
            Theme.Step();
            Theme.Update();
            ThemeContent.Monitor();
            this.Repaint();
            bool validTheme   = !Theme.active.IsNull() && Theme.active.name != "Default";
            bool mouseChanged = this.lastMouse != Event.current.mousePosition;

            if (validTheme && mouseChanged)
            {
                this.lastMouse = Event.current.mousePosition;
                float delay = 0;
                if (Theme.hoverResponse == HoverResponse.None)
                {
                    return;
                }
                if (Theme.hoverResponse == HoverResponse.Slow)
                {
                    delay = 0.2f;
                }
                if (Theme.hoverResponse == HoverResponse.Moderate)
                {
                    delay = 0.05f;
                }
                Utility.DelayCall("Redraw", () => {
                    Theme.UpdateColors();
                    Utility.RepaintAll();
                }, delay, false);
            }
        }
        public void OnGUI()
        {
            Theme.disabled = Utility.GetPref <bool>("EditorTheme-Disabled", false);
            this.Repaint();
            if (Theme.disabled || !ThemeWindow.setup || EditorApplication.isCompiling || EditorApplication.isUpdating)
            {
                return;
            }
            Theme.Update();
            ThemeContent.Monitor();
            bool validTheme   = !Theme.active.IsNull() && Theme.active.name != "Default";
            bool mouseChanged = this.lastMouse != UnityEvent.current.mousePosition;

            Utility.DelayCall(RelativeColor.UpdateSystem, 0.2f, false);
            if (validTheme && mouseChanged)
            {
                this.lastMouse = UnityEvent.current.mousePosition;
                float delay = 0;
                if (Theme.hoverResponse == HoverResponse.None)
                {
                    return;
                }
                if (Theme.hoverResponse == HoverResponse.Slow)
                {
                    delay = 0.2f;
                }
                if (Theme.hoverResponse == HoverResponse.Moderate)
                {
                    delay = 0.05f;
                }
                Utility.DelayCall("Redraw", () =>
                {
                    Theme.UpdateColors();
                    var view = Utility.GetUnityType("GUIView").GetVariable("mouseOverView");
                    if (!view.IsNull())
                    {
                        view.CallMethod("Repaint");
                    }
                }, delay, false);
            }
        }