示例#1
0
    static void DynamicGroup()
    {
        //No need to init it double times
        if (moreGroup == null)
        {
            moreGroup = new TouchBar.Group("slidersGroup", 6);

            slider = moreGroup.AddSlider("slider", 0, 10, 3, (double value) => {
                Debug.Log("On Slider change [value:" + value.ToString() + "]");
            });

            //Close group button
            moreGroup.AddImageButton("close", "/Editor/UniTouchBar/Icons/close.png", "", () => {
                if (moreGroup != null) //Shit happens - shouldn't but in case of!.
                {
                    moreGroup.Hide();
                }
            });

            //Let's add and show!
            TouchBar.AddGroup(moreGroup);
            //We can hide buttons
            moreGroup.OnHidden += () => {
                showSliderButton.Show();
            };
            moreGroup.OnShow += () => {
                showSliderButton.Hide();
            };
        }

        moreGroup.Show();
    }
示例#2
0
    static void TouchBar_Manager_OnReady()
    {
        TouchBar.Manager.OnReady -= TouchBar_Manager_OnReady;
        gameGroup = new TouchBar.Group("game", 3);

        pauseButton = gameGroup.AddImageButton("pause", "/Editor/UniTouchBar/Icons/pause.png", "", () => {
            EditorApplication.isPaused = !EditorApplication.isPaused;

            CheckPause();
        });

        TouchBar.Button space = gameGroup.AddTextButton("space", "     ");

        muteButton = gameGroup.AddTextButton("mute", "mute", () => {
            EditorUtility.audioMasterMute = !EditorUtility.audioMasterMute;
            muteButton.Highlight(EditorUtility.audioMasterMute);
        });

        statsButton = gameGroup.AddTextButton("stats", "stats", () => {
            bool val = !EditGameView.GetFlag("m_Stats");
            EditGameView.SetFlag("m_Stats", val);
            statsButton.Highlight(val);
        });

        maximizeButton = gameGroup.AddImageButton("maximize", "/Editor/UniTouchBar/Icons/resize.png", "", () => {
            bool val = !EditGameView.GetMaximized();
            EditGameView.Maximize(val);
            maximizeButton.Highlight(val);
        });

        TouchBar.AddGroup(gameGroup);
        space.Hide();
    }
示例#3
0
        public static Color[] GetColors()
        {
            try {
                object picker  = ColorWindow();
                var    library = System.Type.GetType("UnityEditor.ColorPicker, UnityEditor.dll").GetField("m_ColorLibraryEditor", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(picker);
                if (library != null)
                {
                    var presets = library.GetType().GetMethod("GetCurrentLib", BindingFlags.Public | BindingFlags.Instance).Invoke(library, null);

                    int count    = (int)presets.GetType().GetMethod("Count", BindingFlags.Public | BindingFlags.Instance).Invoke(presets, null);
                    var getColor = presets.GetType().GetMethod("GetPreset", BindingFlags.Public | BindingFlags.Instance);

                    Color[] output = new Color[count];

                    for (int i = 0; i < count; i++)
                    {
                        output[i] = (Color)getColor.Invoke(presets, new object[] {
                            i
                        });
                    }

                    return(output);
                }
                return(null);
            } catch (System.Exception ex) {
                TouchBar.Log(ex);
                return(null);
            }
        }
示例#4
0
        public static bool GetFlag(string flag)
        {
            try {
                var gameview = System.Type.GetType("UnityEditor.SceneView, UnityEditor.dll");
                if (gameview != null)
                {
                    var view  = gameview.GetField("s_LastActiveSceneView", BindingFlags.NonPublic | BindingFlags.Static);
                    var stats = gameview.GetProperty(flag, BindingFlags.Instance | BindingFlags.Public);

                    if (stats != null)
                    {
                        if ((view != null) && (view.GetValue(null) != null))
                        {
                            return((bool)stats.GetValue(view.GetValue(null), null));
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(false);
            } catch (System.Exception ex) {
                TouchBar.Log(ex);
                return(false);
            }
        }
示例#5
0
    static void Manager_OnReady()
    {
        //Ready? We don't need it anymore. - keep it fast!
        TouchBar.Manager.OnReady -= Manager_OnReady;

        //--------------------1.GROUP----------------------------
        //--Everything is allways stored in groups.
        settingsGroup = new TouchBar.Group("settingsGroup", 5, () => {
            TouchBar.Log("Settings Touchbar Loaded - Welcome in debug ;)");
        });

        //--------------------2.Items-----------------------------
        //Ok now buttons - all Items are created inside the group ok?
        websiteButton = settingsGroup.AddTextButton("websiteButton", "Website", () => {
            //Button cliked. What now?
            Application.OpenURL("http://imvolute.com/unitouchbar/");
        });

        //--FAQ BUTTON
        faqButton = settingsGroup.AddTextButton("faqButton", "FAQ", () => {
            Application.OpenURL("http://imvolute.com/unitouchbar/faq");
        });


        //--Ok we have buttons. Let's show the group only on Settings Window ;)

        //--------------------------3.SHOW-------------------------
        TouchBar.AddGroup(settingsGroup);
        //--Let's show the touchbar only on window called "Uni.Settings" (basing on what EditorWindow..titleContent.text says)
        settingsGroup.ShowOnWindow("Uni.Settings");

        //--Do you want to keep this group shown all time?
        //mainGroup.ShowOnWindow (TouchBar.Windows.ALL);



        //--------------------That's it!----------------------------
        //LET'S ENCHANCE IT!


        //But we still can make our touchbar more complex.
        //Eq.Set Colors
        websiteButton.UpdateBackgroundColor(new Color(0.352941176F, 0, 1));
        faqButton.UpdateBackgroundColor(new Color(0.352941176F, 0, 1));

        //But nothig happens if you just add dynamic buttons (less efficient)
        TouchBar.Button moreButton = settingsGroup.AddTextButton("moreButton", "more...", () => {
            //Maybe we will link some group to the button?
            DynamicGroup();
        });

        //We can log to check if everything works.
        TouchBar.Log(moreButton);

        //But dynamic items need reloading :( //After adding all items.
        TouchBar.ReloadGroup(settingsGroup);
    }
示例#6
0
    static void TouchBar_Manager_OnReady()
    {
        TouchBar.Manager.OnReady -= TouchBar_Manager_OnReady;
        consoleGroup              = new TouchBar.Group("console", 1);

        clearButton = consoleGroup.AddTextButton("clear", "Clear", () => {
            EditConsole.Clear();
        });

        collapse = consoleGroup.AddTextButton("collapse", "Collapse", () => {
            if (EditConsole.GetFlag(EditConsole.ConsoleFlags.Collapse))
            {
                collapse.UpdateBackgroundColor(new Color(0.26F, 0.26F, 0.26F));
                EditConsole.SetFlag(EditConsole.ConsoleFlags.Collapse, false);
            }
            else
            {
                collapse.UpdateBackgroundColor(new Color(0.5F, 0.5F, 0.5F));

                EditConsole.SetFlag(EditConsole.ConsoleFlags.Collapse, true);
            }
        });
        clearOnPlay = consoleGroup.AddTextButton("clearplay", "ClearOnPlay", () => {
            if (EditConsole.GetFlag(EditConsole.ConsoleFlags.ClearOnPlay))
            {
                clearOnPlay.UpdateBackgroundColor(new Color(0.26F, 0.26F, 0.26F));
                EditConsole.SetFlag(EditConsole.ConsoleFlags.ClearOnPlay, false);
            }
            else
            {
                clearOnPlay.UpdateBackgroundColor(new Color(0.5F, 0.5F, 0.5F));

                EditConsole.SetFlag(EditConsole.ConsoleFlags.ClearOnPlay, true);
            }
        });
        errorPause = consoleGroup.AddTextButton("errorpause", "ErrorPause", () => {
            if (EditConsole.GetFlag(EditConsole.ConsoleFlags.ErrorPause))
            {
                errorPause.UpdateBackgroundColor(new Color(0.26F, 0.26F, 0.26F));
                EditConsole.SetFlag(EditConsole.ConsoleFlags.ErrorPause, false);
            }
            else
            {
                errorPause.UpdateBackgroundColor(new Color(0.5F, 0.5F, 0.5F));

                EditConsole.SetFlag(EditConsole.ConsoleFlags.ErrorPause, true);
            }
        });

        TouchBar.AddGroup(consoleGroup);
        consoleGroup.ShowOnWindow(TouchBar.Windows.Console);
        consoleGroup.OnShow += ConsoleGroup_OnShow;
        //cameras.SetOptionWithText(0, "elo", () => { });
    }
示例#7
0
 public static bool GetFlag(string name)
 {
     try {
         //var stateeditor = System.Type.GetType("UnityEditorInternal.AnimationWindowState, UnityEditor.dll");
         var  flag  = System.Type.GetType("UnityEditorInternal.AnimationWindowState, UnityEditor.dll").GetProperty(name, BindingFlags.Public | BindingFlags.Instance);
         bool value = (bool)flag.GetValue(stateWindow, null);
         return(value);
     } catch (System.Exception ex) {
         TouchBar.Log(ex);
         return(false);
     }
 }
示例#8
0
    static void TouchBar_Manager_OnReady()
    {
        TouchBar.Manager.OnReady -= TouchBar_Manager_OnReady;
        mainGroup  = new TouchBar.Group("main", 0);
        playButton = mainGroup.AddImageButton("play", "/Editor/UniTouchBar/Icons/play.png", "", () => {
            playButton.UpdateBackgroundColor(new Color(0.5F, 0.5F, 0.5F));
            EditorApplication.isPlaying = !EditorApplication.isPlaying;
        });

        mainGroup.ShowOnWindow(TouchBar.Windows.ALL);
        TouchBar.AddGroup(mainGroup);
    }
示例#9
0
    static void TouchBar_Manager_OnReady()
    {
        TouchBar.Manager.OnReady -= TouchBar_Manager_OnReady;
        editorGroup = new TouchBar.Group("editor", 1, () => {
            dbutton.Highlight(SceneView.GetFlag("in2DMode"));
        });
        cameras = editorGroup.AddSegments("cameramodes", 6);
        dbutton = editorGroup.AddTextButton("2d", "2D", () => {
            bool valu = !SceneView.GetFlag("in2DMode");
            SceneView.SetFlag("in2DMode", valu);
            dbutton.Highlight(valu);
        });

        addbutton = editorGroup.AddImageButton("addgameobject", "/Editor/UniTouchBar/Icons/go.png", "", () => {
            GameObject gm = new GameObject("GameObject");
            Selection.activeGameObject = gm;
        });

        TouchBar.AddGroup(editorGroup);

        editorGroup.ShowOnWindow(TouchBar.Windows.Scene);
        editorGroup.ShowOnWindow(TouchBar.Windows.Hierarchy);

        cameras.SetOptionWithImage(0, "/Editor/UniTouchBar/Icons/hand.png", () => {
            TouchBar.Log("Option");

            Tools.current = Tool.View;
        },
                                   35);
        cameras.SetOptionWithImage(1, "/Editor/UniTouchBar/Icons/move.png", () => {
            Tools.current = Tool.Move;
        },
                                   35);
        cameras.SetOptionWithImage(2, "/Editor/UniTouchBar/Icons/rotate.png", () => {
            Tools.current = Tool.Rotate;
        },
                                   35);
        cameras.SetOptionWithImage(3, "/Editor/UniTouchBar/Icons/resize.png", () => {
            Tools.current = Tool.Scale;
        },
                                   35);

        cameras.SetOptionWithImage(4, "/Editor/UniTouchBar/Icons/transform.png", () => {
            Tools.current = Tool.Transform;
        },
                                   35);

        cameras.SetOptionWithImage(5, "/Editor/UniTouchBar/Icons/rect.png", () => {
            Tools.current = Tool.Rect;
        },
                                   35);
    }
示例#10
0
        static object ColorWindow()
        {
            try {
                var gameview = System.Type.GetType("UnityEditor.ColorPicker, UnityEditor.dll");

                var view = gameview.GetProperty(TouchBar.isUnity2018 ? "instance" : "get", BindingFlags.Public | BindingFlags.Static);

                return(view.GetValue(null, null));
            } catch (System.Exception ex) {
                TouchBar.Log(ex);
                return(false);
            }
        }
示例#11
0
 public static void SetColor(Color color)
 {
     try {
         object   picker     = ColorWindow();
         var      gameview   = System.Type.GetType("UnityEditor.ColorPicker, UnityEditor.dll");
         var      view       = gameview.GetMethod("SetColor", BindingFlags.NonPublic | BindingFlags.Instance);
         object[] parameters = new object[] {
             color
         };
         view.Invoke(picker, parameters);
         gameview.GetProperty("colorChanged", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(picker, true, null);
     } catch (System.Exception ex) {
         TouchBar.Log(ex);
     }
 }
示例#12
0
 static void TouchBar_Manager_OnReady()
 {
     TouchBar.Manager.OnReady -= TouchBar_Manager_OnReady;
     EditorApplication.update += EditorApplication_Update;
     gameobjectGroup           = new TouchBar.Group("gameobject", 4);
     enableButton              = gameobjectGroup.AddImageButton("enabled", "/Editor/UniTouchBar/Icons/enabled.png", "", () => {
         if (Selection.activeGameObject != null)
         {
             Selection.activeGameObject.SetActive(!Selection.activeGameObject.activeSelf);
         }
     });
     gameobjectGroup.ShowOnWindow(TouchBar.Windows.None);
     ready = true;
     TouchBar.AddGroup(gameobjectGroup);
 }
示例#13
0
 static void EditorApplication_Update()
 {
     if (group.showing && slider != null)
     {
         if (AnimatorEditor.window != null)
         {
             try {
                 float max  = (float)System.Type.GetType("UnityEditorInternal.AnimationWindowState, UnityEditor.dll").GetProperty("maxTime").GetValue(AnimatorEditor.stateWindow, null);
                 float time = (float)System.Type.GetType("UnityEditorInternal.AnimationWindowState, UnityEditor.dll").GetProperty("currentTime").GetValue(AnimatorEditor.stateWindow, null);
                 slider.UpdateSlider(0, max, time);
             } catch (System.Exception ex) {
                 TouchBar.Log(ex);
             }
         }
     }
 }
示例#14
0
 public static void SetFlag(ConsoleFlags flag, bool value)
 {
     try {
         var      logEntries      = System.Type.GetType("UnityEditor.LogEntries, UnityEditor.dll");
         object[] parametersArray = new object[] {
             (int)flag,
             value
         };
         var clearMethod = logEntries.GetMethod("SetConsoleFlag", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
         if (clearMethod != null)
         {
             clearMethod.Invoke(null, parametersArray);
         }
     } catch (System.Exception ex) {
         TouchBar.Log(ex);
     }
 }
示例#15
0
 public static void Maximize(bool value)
 {
     try {
         var gameview = System.Type.GetType("UnityEditor.GameView, UnityEditor.dll");
         var view     = gameview.GetField("s_LastFocusedGameView", BindingFlags.NonPublic | BindingFlags.Static);
         var stats    = gameview.GetProperty("maximized", BindingFlags.Public | BindingFlags.Instance);
         if (view != null)
         {
             stats.SetValue(view.GetValue(null), value, null);
         }
         else
         {
             TouchBar.Log("null");
         }
     } catch (System.Exception ex) {
         TouchBar.Log(ex);
     }
 }
示例#16
0
        public static void SetFlag(string flag, bool value)
        {
            try {
                var gameview = System.Type.GetType("UnityEditor.SceneView, UnityEditor.dll");
                var view     = gameview.GetField("s_LastActiveSceneView", BindingFlags.NonPublic | BindingFlags.Static);

                if (view != null)
                {
                    var stats = gameview.GetProperty(flag, BindingFlags.Instance | BindingFlags.Public);

                    if (stats != null)
                    {
                        stats.SetValue(view.GetValue(null), value, null);
                    }
                }
            } catch (System.Exception ex) {
                TouchBar.Log(ex);
            }
        }
示例#17
0
    //private static TouchBar.Button closeButton;
    static void DynamicGroup()
    {
        //No need to init it double times
        if (moreGroup == null)
        {
            moreGroup = new TouchBar.Group("moreGroup", 6);

            coolButton = moreGroup.AddTextButton("cool", "made by IMVOLUTE \ud83d\ude0e");

            //You can allways add action to already created items.
            coolButton.onClick = () => {
                Application.OpenURL("https://imvolute.com");
            };

            //Making image button - is also easy ;)
            moreGroup.AddImageButton("close", "/Editor/UniTouchBar/Icons/close.png", "", () => {
                if (moreGroup != null) //Shit happens - shouldn't but in case of!.
                {
                    moreGroup.Hide();
                }
            });

            //Let's add and show!
            TouchBar.AddGroup(moreGroup);
            moreGroup.Show();

            //Wow wow - what if we hide settings? This group has to hide too!
            settingsGroup.OnHidden += () => {
                if (moreGroup != null)
                {
                    moreGroup.Hide();
                }
            };
        }
        else
        {
            //No need to recreate - just show!
            moreGroup.Show();
        }

        //Cool idea! What if we chnage more... to more?
    }
示例#18
0
        public static bool GetFlag(string flag)
        {
            try {
                var gameview = System.Type.GetType("UnityEditor.GameView, UnityEditor.dll");
                var view     = gameview.GetField("s_LastFocusedGameView", BindingFlags.NonPublic | BindingFlags.Static);
                var stats    = gameview.GetField(flag, BindingFlags.NonPublic | BindingFlags.Instance);
                if (view != null)
                {
                    return((bool)stats.GetValue(view.GetValue(null)));
                }
                else
                {
                    TouchBar.Log("null");
                }

                return(false);
            } catch (System.Exception ex) {
                TouchBar.Log(ex);
                return(false);
            }
        }
示例#19
0
        public static bool GetFlag(ConsoleFlags flag)
        {
            try {
                var logEntries = System.Type.GetType("UnityEditor.LogEntries, UnityEditor.dll");
                //object[] parametersArray = new object[] { (int) flag,
                //          true
                //     };
                //var clearMethod = logEntries.GetMethod("SetConsoleFlag", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
                var clearMethod = logEntries.GetProperty("consoleFlags");
                if (clearMethod != null)
                {
                    int          value = (int)clearMethod.GetValue(null, null);
                    ConsoleFlags flags = (ConsoleFlags)value;
                    bool         show  = ((flags & flag) != 0);

                    return(show);
                }
            } catch (System.Exception ex) {
                TouchBar.Log(ex);
                return(false);
            }
            return(false);
        }
示例#20
0
    static void Manager_OnReady()
    {
        //Ready? We don't need it anymore. - keep it fast!
        TouchBar.Manager.OnReady -= Manager_OnReady;

        //--------------------1.GROUP----------------------------
        //--Everything is allways stored in groups.
        sliderGroup = new TouchBar.Group("sliderGroup", 2, () => {
            TouchBar.Log("Sliders Touchbar Loaded - you can remove it)");
        });

        //--------------------2.Items-----------------------------
        showSliderButton = sliderGroup.AddTextButton("slidersButton", "show", () => {
            //Show group of sliders.
            DynamicGroup();
        });

        //--------------------------3.SHOW-------------------------
        TouchBar.AddGroup(sliderGroup);
        //--Let's show the touchbar on all windows! for specyfic check Uni.TouchBar.Windows or string (basing on what EditorWindow..titleContent.text says)
        sliderGroup.ShowOnWindow(Uni.TouchBar.Windows.ALL);
        //--------------------That's it!----------------------------
    }
示例#21
0
        public static void SetFlag(string flag, bool value)
        {
            try {
                TouchBar.Log("Jazda");
                var gameview = System.Type.GetType("UnityEditor.GameView, UnityEditor.dll");
                var view     = gameview.GetField("s_LastFocusedGameView", BindingFlags.NonPublic | BindingFlags.Static);
                var stats    = gameview.GetField(flag, BindingFlags.NonPublic | BindingFlags.Instance);
                if (view != null)
                {
                    stats.SetValue(view.GetValue(null), value);
                }
                else
                {
                    TouchBar.Log("null");
                }

                //return false;
            } catch (System.Exception ex) {
                TouchBar.Log(ex);
                //return false;
            }
            //return false;
        }
示例#22
0
    static void TouchBar_Manager_OnReady()
    {
        TouchBar.Manager.OnReady -= TouchBar_Manager_OnReady;
        projectGroup              = new TouchBar.Group("project", 2);

        foreach (var item in AssetDatabase.FindAssets("t:scene"))
        {
            string     path  = AssetDatabase.GUIDToAssetPath(item);
            SceneAsset scene = AssetDatabase.LoadAssetAtPath <SceneAsset> (path) as SceneAsset;
            if (scene != null)
            {
                projectGroup.AddImageButton("scene" + scene.name, "/Editor/UniTouchBar/Icons/unity.png", scene.name, () => {
                    EditorSceneManager.OpenScene(path, OpenSceneMode.Single);
                });
            }
        }

        projectGroup.AddImageButton("finder", "/Editor/UniTouchBar/Icons/finder.png", "", () => {
            OpenInMac(AssetDatabase.GetAssetPath(Selection.activeObject));
        });

        TouchBar.AddGroup(projectGroup);
        projectGroup.ShowOnWindow(TouchBar.Windows.Project);
    }
示例#23
0
 static void TouchBar_Manager_OnReady()
 {
     TouchBar.Manager.OnReady -= TouchBar_Manager_OnReady;
     colorGroup = new TouchBar.Group("color", 1, () => {
         Color[] colors = Colors.GetColors();
         if (colors != null)
         {
             foreach (Color item in colors)
             {
                 if (colorGroup.items.Find((obj) => obj.identifier == item.ToString()) == null)
                 {
                     TouchBar.Button button = colorGroup.AddTextButton(item.ToString(), " ", () => {
                         //							  TouchBar.Log(item.ToString());
                         Colors.SetColor(item);
                     });
                     button.Add(colorGroup.identifier);
                     button.UpdateBackgroundColor(item);
                 }
             }
         }
     });
     TouchBar.AddGroup(colorGroup);
     colorGroup.ShowOnWindow(TouchBar.Windows.Color);
 }
示例#24
0
    static void TouchBar_Manager_OnReady()
    {
        TouchBar.Manager.OnReady -= TouchBar_Manager_OnReady;
        EditorApplication.update += EditorApplication_Update;
        group = new TouchBar.Group("animation", 4);

        segments = group.AddSegments("segments", 5);

        recordButton = group.AddImageButton("record", "/Editor/UniTouchBar/Icons/record.png", "", () => {
            if (AnimatorEditor.GetFlag("recording"))
            {
                //STOP
                System.Type.GetType("UnityEditorInternal.AnimationWindowState, UnityEditor.dll").GetMethod("StopRecording").Invoke(AnimatorEditor.stateWindow, null);
                recordButton.UpdateImage("/Editor/UniTouchBar/Icons/record.png");
            }
            else
            {
                //START
                System.Type.GetType("UnityEditorInternal.AnimationWindowState, UnityEditor.dll").GetMethod("StartRecording").Invoke(AnimatorEditor.stateWindow, null);
                recordButton.UpdateImage("/Editor/UniTouchBar/Icons/recording.png");
            }
            AnimatorEditor.Repaint();
        });

        slider = group.AddSlider("slider", 0, 100, 1, (double obj) => {
            try {
                object[] parameters = new object[] {
                    (float)obj
                };
                System.Type.GetType("UnityEditorInternal.IAnimationWindowControl, UnityEditor.dll").GetMethod("GoToTime").Invoke(AnimatorEditor.controlInterface, parameters);
                AnimatorEditor.Repaint();
            } catch (System.Exception ex) {
                TouchBar.Log(ex);
            }

            ///TouchBar.Log(System.Type.GetType("UnityEditorInternal.AnimationWindowState, UnityEditor.dll").GetProperty("maxTime").GetValue(AnimatorEditor.stateWindow, null));
        });
        TouchBar.AddGroup(group);
        segments.SetOptionWithImage(0, "/Editor/UniTouchBar/Icons/segment_rewind_back.png", () => {
            System.Type.GetType("UnityEditorInternal.IAnimationWindowControl, UnityEditor.dll").GetMethod("GoToFirstKeyframe").Invoke(AnimatorEditor.controlInterface, null);
            AnimatorEditor.Repaint();
            AnimatorTouchBar.SegmentClick();
        });
        segments.SetOptionWithImage(1, "/Editor/UniTouchBar/Icons/segment_step_back.png", () => {
            System.Type.GetType("UnityEditorInternal.IAnimationWindowControl, UnityEditor.dll").GetMethod("GoToPreviousKeyframe").Invoke(AnimatorEditor.controlInterface, null);
            AnimatorEditor.Repaint();
            AnimatorTouchBar.SegmentClick();
        });
        segments.SetOptionWithImage(2, "/Editor/UniTouchBar/Icons/segment_play.png", () => {
            if (AnimatorEditor.GetFlag("playing"))
            {
                //STOP
                segments.Select(-1);
                System.Type.GetType("UnityEditorInternal.AnimationWindowState, UnityEditor.dll").GetMethod("StopPlayback").Invoke(AnimatorEditor.stateWindow, null);
            }
            else
            {
                //START
                segments.Select(2);
                System.Type.GetType("UnityEditorInternal.AnimationWindowState, UnityEditor.dll").GetMethod("StartPlayback").Invoke(AnimatorEditor.stateWindow, null);
            }
            AnimatorEditor.Repaint();
        });
        segments.SetOptionWithImage(3, "/Editor/UniTouchBar/Icons/segment_step.png", () => {
            System.Type.GetType("UnityEditorInternal.IAnimationWindowControl, UnityEditor.dll").GetMethod("GoToNextKeyframe").Invoke(AnimatorEditor.controlInterface, null);
            AnimatorEditor.Repaint();
            AnimatorTouchBar.SegmentClick();
        });
        segments.SetOptionWithImage(4, "/Editor/UniTouchBar/Icons/segment_rewind.png", () => {
            System.Type.GetType("UnityEditorInternal.IAnimationWindowControl, UnityEditor.dll").GetMethod("GoToLastKeyframe").Invoke(AnimatorEditor.controlInterface, null);
            AnimatorEditor.Repaint();
            AnimatorTouchBar.SegmentClick();
        });

        group.ShowOnWindow(TouchBar.Windows.Animation);
        group.ShowOnWindow(TouchBar.Windows.Scene);
        group.OnShow += () => {
            AnimatorEditor.Clean();
            //            TouchBar.Log("Hello");
            loaded = true;
            if (AnimatorEditor.window == null)
            {
                group.Hide();
                loaded = false;
            }

            if ((EditorWindow.focusedWindow != null) && (EditorWindow.focusedWindow.titleContent.text == "Scene"))
            {
            }
        };
    }