Exemple #1
0
 public PlayheadMarker(Playhead owner)
     : base(owner)
 {
     _owner               = owner;
     m_Target             = this;
     RestrictToParent     = true;
     IsTabable            = false;
     KeyboardInputEnabled = false;
 }
        private void Setup()
        {
            _bottombar = new Panel(this)
            {
                AutoSizeToContents   = true,
                ShouldDrawBackground = false,
                MouseInputEnabled    = false,
                Dock = Dock.Top
            };
            _topbar = new Panel(this)
            {
                AutoSizeToContents   = true,
                ShouldDrawBackground = false,
                MouseInputEnabled    = false,
                Dock = Dock.Top
            };
            _speedincrease          = CreateButton(_topbar, GameResources.fast_forward, "Increase Speed");
            _speedincrease.Clicked += (o, e) => _editor.PlaybackSpeedUp();
            _speedincrease.Dock     = Dock.Right;

            _speeddecrease          = CreateButton(_topbar, GameResources.rewind, "Decrease Speed");
            _speeddecrease.Clicked += (o, e) => _editor.PlaybackSpeedDown();
            _speeddecrease.Dock     = Dock.Left;

            Playhead      = new Playhead(_topbar, _editor);
            Playhead.Dock = Dock.Fill;
            Panel time = new Panel(_bottombar)
            {
                Dock = Dock.Fill,
                AutoSizeToContents   = true,
                ShouldDrawBackground = false,
                MouseInputEnabled    = false,
            };

            _iterations = new TrackLabel(time)
            {
                Dock        = Dock.Fill,
                TextRequest = (o, e) =>
                {
                    switch (_editor.IterationsOffset)
                    {
                    case 0:
                        return("Physics Iteration: 0 (momentum tick)");

                    case 1:
                        return("Physics Iteration: 1");

                    case 2:
                        return("Physics Iteration: 2");

                    case 3:
                        return("Physics Iteration: 3");

                    case 4:
                        return("Physics Iteration: 4");

                    case 5:
                        return("Physics Iteration: 5");

                    default:
                        return("");
                    }
                },
                Alignment = Pos.Center,
            };
            _timecurrent = new TrackLabel(time)
            {
                Dock        = Dock.Left,
                TextRequest = (o, e) =>
                {
                    string ret = GetTimeString((int)Playhead.Value);
                    return(ret);
                },
                Alignment = Pos.Center,
            };
            _timemax = new TrackLabel(time)
            {
                Dock        = Dock.Right,
                TextRequest = (o, e) =>
                {
                    string ret = GetTimeString((int)Playhead.DisplayMax);
                    return(ret);
                },
                Alignment = Pos.Center,
            };
        }