示例#1
0
        public override void Update(bool isTop, bool isCovered)
        {
            base.Update(isTop, isCovered);

            timeSource.Update();
            var time = (float)(pendingSeek ?? timeSource.Current);

            changeMapButton.Disabled = project.MapsetManager.BeatmapCount < 2;
            playPauseButton.Icon     = timeSource.Playing ? IconFont.Pause : IconFont.Play;
            saveButton.Disabled      = !project.Changed;
            exportButton.Disabled    = !project.MapsetPathIsValid;
            audio.Volume             = WidgetManager.Root.Opacity;

            if (timeSource.Playing)
            {
                if (timeline.RepeatStart != timeline.RepeatEnd && (time < timeline.RepeatStart - 0.005 || timeline.RepeatEnd < time))
                {
                    pendingSeek = time = timeline.RepeatStart;
                }
                else if (timeSource.Current > timeline.MaxValue)
                {
                    timeSource.Playing = false;
                    pendingSeek        = timeline.MaxValue;
                }
            }

            timeline.SetValueSilent(time);
            if (Manager.GetContext <Editor>().IsFixedRateUpdate)
            {
                timeButton.Text = Manager.GetContext <Editor>().InputManager.Alt ?
                                  $"{storyboardPosition.X:000}, {storyboardPosition.Y:000}" :
                                  $"{(time < 0 ? "-" : "")}{(int)Math.Abs(time / 60):00}:{(int)Math.Abs(time % 60):00}:{(int)Math.Abs(time * 1000) % 1000:000}";

                warningsLabel.Text      = buildWarningMessage();
                warningsLabel.Displayed = warningsLabel.Text.Length > 0;
                warningsLabel.Pack(width: 600);
                warningsLabel.Pack();
            }

            if (timeSource.Playing && mainStoryboardDrawable.Time < time)
            {
                project.TriggerEvents(mainStoryboardDrawable.Time, time);
            }

            mainStoryboardDrawable.Time = time;
            mainStoryboardDrawable.Clip = !Manager.GetContext <Editor>().InputManager.Alt;
            if (previewContainer.Visible)
            {
                previewDrawable.Time = timeline.GetValueForPosition(Manager.GetContext <Editor>().InputManager.MousePosition);
            }
        }
示例#2
0
        public override void Update(bool isTop, bool isCovered)
        {
            base.Update(isTop, isCovered);

            changeMapButton.Disabled = project.MapsetManager.BeatmapCount < 2;
            playPauseButton.Icon     = audio.Playing ? IconFont.Pause : IconFont.Play;
            saveButton.Disabled      = !project.Changed;
            audio.Volume             = WidgetManager.Root.Opacity;

            var time = (float)audio.Time;

            if (audio.Playing &&
                timeline.RepeatStart != timeline.RepeatEnd &&
                (time < timeline.RepeatStart - 0.005 || timeline.RepeatEnd < time))
            {
                audio.Time = time = timeline.RepeatStart;
            }

            timeline.SetValueSilent(time);
            if (Manager.GetContext <Editor>().IsFixedRateUpdate)
            {
                timeButton.Text = Manager.GetContext <Editor>().InputManager.Alt ?
                                  $"{storyboardPosition.X:000}, {storyboardPosition.Y:000}" :
                                  $"{(int)time / 60:00}:{(int)time % 60:00}:{(int)(time * 1000) % 1000:000}";
            }

            if (audio.Playing && mainStoryboardDrawable.Time < time)
            {
                project.TriggerEvents(mainStoryboardDrawable.Time, time);
            }

            mainStoryboardDrawable.Time = time;
            mainStoryboardDrawable.Clip = !Manager.GetContext <Editor>().InputManager.Alt;
            if (previewContainer.Visible)
            {
                previewDrawable.Time = timeline.GetValueForPosition(Manager.GetContext <Editor>().InputManager.MousePosition);
            }
        }