Ejemplo n.º 1
0
        public TaeTransport(TaeEditorScreen mainScreen)
        {
            MainScreen = mainScreen;

            Buttons.Add(new TransportButton()
            {
                GetDebugText = () => "|<<",
                GetIsEnabled = () => PlaybackCursor.IsPlaying || (PlaybackCursor.CurrentTime != 0),
                OnClick      = () =>
                {
                    PlaybackCursor.IsPlaying   = false;
                    PlaybackCursor.CurrentTime = 0;
                    MainScreen.Graph?.ViewportInteractor?.CurrentModel?.AnimContainer?.ResetAll();
                    PlaybackCursor.StartTime = 0;
                    MainScreen.Graph.ViewportInteractor.OnScrubFrameChange(forceCustomTimeDelta: 0);
                    MainScreen.Graph.ViewportInteractor.CurrentModel.AnimContainer.ResetRootMotion();

                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel0?.AnimContainer?.ResetRootMotion();
                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel1?.AnimContainer?.ResetRootMotion();
                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel2?.AnimContainer?.ResetRootMotion();
                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel3?.AnimContainer?.ResetRootMotion();

                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel0?.AnimContainer?.ResetRootMotion();
                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel1?.AnimContainer?.ResetRootMotion();
                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel2?.AnimContainer?.ResetRootMotion();
                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel3?.AnimContainer?.ResetRootMotion();

                    MainScreen.Graph.ViewportInteractor.ResetRootMotion();
                    MainScreen.Graph.ScrollToPlaybackCursor(1);
                    PlaybackCursor.IgnoreCurrentRelativeScrub();
                },
                GetHotkey = b => MainScreen.Input.KeyHeld(Keys.Home),
            });

            Buttons.Add(new TransportButton()
            {
                GetDebugText = () => "[]",
                GetIsEnabled = () => PlaybackCursor.CurrentTime != PlaybackCursor.StartTime,//MainScreen.Graph.PlaybackCursor.IsPlaying,
                OnClick      = () =>
                {
                    var start = PlaybackCursor.StartTime;
                    PlaybackCursor.IsPlaying   = false;
                    PlaybackCursor.CurrentTime = start;
                    //MainScreen.Graph.ViewportInteractor.OnScrubFrameChange(forceCustomTimeDelta: 0);
                    MainScreen.Graph.PlaybackCursor.UpdateScrubbing();
                    //MainScreen.Graph.ViewportInteractor.ResetRootMotion((float)MainScreen.Graph.PlaybackCursor.StartTime);
                    MainScreen.Graph.ScrollToPlaybackCursor(1);
                },
                GetHotkey = b => (MainScreen.Input.ShiftHeld && !MainScreen.Input.AltHeld && !MainScreen.Input.CtrlHeld) && MainScreen.Input.KeyHeld(Keys.Space),
            });

            Buttons.Add(new TransportButton()
            {
                GetDebugText = () => PlaybackCursor.IsPlaying ? "||" : ">",
                GetIsEnabled = () => true,
                OnClick      = () => PlaybackCursor.Transport_PlayPause(),
                GetHotkey    = b => (!MainScreen.Input.ShiftHeld && !MainScreen.Input.AltHeld && !MainScreen.Input.CtrlHeld) && MainScreen.Input.KeyDown(Keys.Space),
            });

            Buttons.Add(new TransportButton()
            {
                GetDebugText = () => ">>|",
                GetIsEnabled = () => PlaybackCursor.IsPlaying || (PlaybackCursor.CurrentTime != PlaybackCursor.MaxTime),
                OnClick      = () =>
                {
                    PlaybackCursor.IsPlaying   = false;
                    PlaybackCursor.CurrentTime = PlaybackCursor.MaxTime;
                    PlaybackCursor.StartTime   = PlaybackCursor.MaxTime;
                    MainScreen.Graph.PlaybackCursor.UpdateScrubbing();
                    //MainScreen.Graph.ViewportInteractor.ResetRootMotion((float)MainScreen.Graph.PlaybackCursor.MaxTime);
                    MainScreen.Graph.ScrollToPlaybackCursor(1);
                },
                GetHotkey = b => MainScreen.Input.KeyHeld(Keys.End),
            });

            Buttons.Add(new TransportButtonSeparator());

            Buttons.Add(new TransportButton()
            {
                GetDebugText        = () => MainScreen.Config.LoopEnabled_BeforeCombo ? "[LOOP]" : "[ONCE]",
                GetIsEnabled        = () => (MainScreen.Graph?.ViewportInteractor?.CurrentComboIndex ?? -1) < 0,
                OnClick             = () => MainScreen.Config.LoopEnabled_BeforeCombo = MainScreen.Config.LoopEnabled = !MainScreen.Config.LoopEnabled,
                GetHotkey           = b => (!MainScreen.Input.ShiftHeld && !MainScreen.Input.AltHeld && MainScreen.Input.CtrlHeld) && MainScreen.Input.KeyDown(Keys.L),
                CustomWidth         = 48,
                GetActiveBackColor  = () => MainScreen.Config.LoopEnabled_BeforeCombo ? new Color(0, 100, 0, 255) : new Color(150, 0, 0, 255),
                GetHoverBackColor   = () => MainScreen.Config.LoopEnabled_BeforeCombo ? new Color(0, 150, 0, 255) : new Color(200, 0, 0, 255),
                GetPressedBackColor = () => MainScreen.Config.LoopEnabled_BeforeCombo ? new Color(175, 210, 175, 255) : new Color(255, 130, 130, 255),
            });

            Buttons.Add(new TransportButtonSeparator());

            Buttons.Add(new TransportButton()
            {
                GetDebugText = () => "<|",
                GetIsEnabled = () => true,
                OnClick      = () => MainScreen.TransportPreviousFrame(),
                GetHotkey    = b =>
                {
                    if (MainScreen.Input.KeyUp(Keys.Left))
                    {
                        b.prevState = b.state = TransportButton.TransportButtonState.Normal;
                    }
                    return(MainScreen.Input.KeyHeld(Keys.Left));
                },
            });

            Buttons.Add(new TransportButton()
            {
                GetDebugText = () => "|>",
                GetIsEnabled = () => true,
                OnClick      = () => MainScreen.TransportNextFrame(),
                GetHotkey    = b =>
                {
                    if (MainScreen.Input.KeyUp(Keys.Right))
                    {
                        b.prevState = b.state = TransportButton.TransportButtonState.Normal;
                    }
                    return(MainScreen.Input.KeyHeld(Keys.Right));
                },
            });
        }
Ejemplo n.º 2
0
        public TaeTransport(TaeEditorScreen mainScreen)
        {
            MainScreen = mainScreen;

            Buttons.Add(new TransportButton()
            {
                GetDebugText = () => "|<<",
                GetIsEnabled = () => PlaybackCursor.IsPlaying || (PlaybackCursor.CurrentTime != 0),
                OnClick      = () =>
                {
                    PlaybackCursor.IsPlaying   = false;
                    PlaybackCursor.CurrentTime = 0;
                    MainScreen.Graph?.ViewportInteractor?.CurrentModel?.AnimContainer?.ResetAll();
                    PlaybackCursor.StartTime = 0;
                    MainScreen.Graph.ViewportInteractor.OnScrubFrameChange(forceCustomTimeDelta: 0);
                    MainScreen.Graph.ViewportInteractor.CurrentModel.CurrentDirection = 0;

                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel0?.ResetCurrentDirection();
                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel1?.ResetCurrentDirection();
                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel2?.ResetCurrentDirection();
                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel3?.ResetCurrentDirection();

                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel0?.ResetCurrentDirection();
                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel1?.ResetCurrentDirection();
                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel2?.ResetCurrentDirection();
                    MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel3?.ResetCurrentDirection();

                    MainScreen.Graph.ViewportInteractor.ResetRootMotion();
                    MainScreen.Graph.ScrollToPlaybackCursor(1);
                    PlaybackCursor.IgnoreCurrentRelativeScrub();
                },
                GetHotkey = b => MainScreen.Input.KeyHeld(Keys.Home),
            });

            Buttons.Add(new TransportButton()
            {
                GetDebugText = () => "[]",
                GetIsEnabled = () => PlaybackCursor.CurrentTime != PlaybackCursor.StartTime,//MainScreen.Graph.PlaybackCursor.IsPlaying,
                OnClick      = () =>
                {
                    var start = PlaybackCursor.StartTime;
                    PlaybackCursor.IsPlaying   = false;
                    PlaybackCursor.CurrentTime = PlaybackCursor.StartTime;
                    //MainScreen.Graph.ViewportInteractor.OnScrubFrameChange(forceCustomTimeDelta: 0);
                    MainScreen.Graph.PlaybackCursor.UpdateScrubbing();
                    //MainScreen.Graph.ViewportInteractor.ResetRootMotion((float)MainScreen.Graph.PlaybackCursor.StartTime);
                    MainScreen.Graph.ScrollToPlaybackCursor(1);
                },
                GetHotkey = b => (MainScreen.Input.ShiftHeld && !MainScreen.Input.AltHeld && !MainScreen.Input.CtrlHeld) && MainScreen.Input.KeyHeld(Keys.Space),
            });

            Buttons.Add(new TransportButton()
            {
                GetDebugText = () => PlaybackCursor.IsPlaying ? "||" : ">",
                GetIsEnabled = () => true,
                OnClick      = () => PlaybackCursor.Transport_PlayPause(),
                GetHotkey    = b => (!MainScreen.Input.ShiftHeld && !MainScreen.Input.AltHeld && !MainScreen.Input.CtrlHeld) && MainScreen.Input.KeyDown(Keys.Space),
            });


            Buttons.Add(new TransportButton()
            {
                GetDebugText = () => ">>|",
                GetIsEnabled = () => PlaybackCursor.IsPlaying || (PlaybackCursor.CurrentTime != PlaybackCursor.MaxTime),
                OnClick      = () =>
                {
                    PlaybackCursor.IsPlaying   = false;
                    PlaybackCursor.CurrentTime = PlaybackCursor.MaxTime;
                    PlaybackCursor.StartTime   = PlaybackCursor.MaxTime;
                    MainScreen.Graph.PlaybackCursor.UpdateScrubbing();
                    //MainScreen.Graph.ViewportInteractor.ResetRootMotion((float)MainScreen.Graph.PlaybackCursor.MaxTime);
                    MainScreen.Graph.ScrollToPlaybackCursor(1);
                },
                GetHotkey = b => MainScreen.Input.KeyHeld(Keys.End),
            });


            Buttons.Add(new TransportButtonSeparator());

            Buttons.Add(new TransportButton()
            {
                GetDebugText = () => "<|",
                GetIsEnabled = () => true,
                OnClick      = () => MainScreen.TransportPreviousFrame(),
                GetHotkey    = b =>
                {
                    if (MainScreen.Input.KeyUp(Keys.Left))
                    {
                        b.prevState = b.state = TransportButton.TransportButtonState.Normal;
                    }
                    return(MainScreen.Input.KeyHeld(Keys.Left));
                },
            });

            Buttons.Add(new TransportButton()
            {
                GetDebugText = () => "|>",
                GetIsEnabled = () => true,
                OnClick      = () => MainScreen.TransportNextFrame(),
                GetHotkey    = b =>
                {
                    if (MainScreen.Input.KeyUp(Keys.Right))
                    {
                        b.prevState = b.state = TransportButton.TransportButtonState.Normal;
                    }
                    return(MainScreen.Input.KeyHeld(Keys.Right));
                },
            });
        }