Beispiel #1
0
        private void applyPitchAdjustment(ValueChangedEvent <bool> adjustPitchSetting)
        {
            // remove existing old adjustment
            track?.RemoveAdjustment(adjustmentForPitchSetting(adjustPitchSetting.OldValue), SpeedChange);

            track?.AddAdjustment(adjustmentForPitchSetting(adjustPitchSetting.NewValue), SpeedChange);
        }
Beispiel #2
0
        public void ApplyToTrack(Track track)
        {
            this.track = track;
            track.AddAdjustment(AdjustableProperty.Frequency, SpeedChange);

            FinalRate.TriggerChange();
        }
Beispiel #3
0
        public GameplayClockContainer(WorkingBeatmap beatmap, IReadOnlyList <Mod> mods, double gameplayStartTime)
        {
            this.beatmap           = beatmap;
            this.mods              = mods;
            this.gameplayStartTime = gameplayStartTime;
            firstHitObjectTime     = beatmap.Beatmap.HitObjects.First().StartTime;

            RelativeSizeAxes = Axes.Both;

            track = beatmap.Track;
            track.AddAdjustment(AdjustableProperty.Frequency, pauseFreqAdjust);

            adjustableClock = new DecoupleableInterpolatingFramedClock {
                IsCoupled = false
            };

            // Lazer's audio timings in general doesn't match stable. This is the result of user testing, albeit limited.
            // This only seems to be required on windows. We need to eventually figure out why, with a bit of luck.
            platformOffsetClock = new FramedOffsetClock(adjustableClock)
            {
                Offset = RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? 22 : 0
            };

            // the final usable gameplay clock with user-set offsets applied.
            userOffsetClock = new FramedOffsetClock(platformOffsetClock);

            // the clock to be exposed via DI to children.
            GameplayClock = new GameplayClock(userOffsetClock);

            GameplayClock.IsPaused.BindTo(IsPaused);
        }
Beispiel #4
0
        /// <summary>
        /// Start the fail animation playing.
        /// </summary>
        /// <exception cref="InvalidOperationException">Thrown if started more than once.</exception>
        public void Start()
        {
            if (started)
            {
                throw new InvalidOperationException("Animation cannot be started more than once.");
            }

            started = true;

            this.TransformBindableTo(trackFreq, 0, duration).OnComplete(_ =>
            {
                // Don't reset frequency as the pause screen may appear post transform, causing a second frequency sweep.
                RemoveFilters(false);
                OnComplete?.Invoke();
            });

            failHighPassFilter.CutoffTo(300);
            failLowPassFilter.CutoffTo(300, duration, Easing.OutCubic);
            failSample.Play();

            track.AddAdjustment(AdjustableProperty.Frequency, trackFreq);
            track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);

            applyToPlayfield(drawableRuleset.Playfield);
            drawableRuleset.Playfield.HitObjectContainer.FadeOut(duration / 2);

            if (config.Get <bool>(OsuSetting.FadePlayfieldWhenHealthLow))
            {
                redFlashLayer.FadeOutFromOne(1000);
            }

            Content.Masking = true;

            Content.Add(new Box
            {
                Colour           = Color4.Black,
                RelativeSizeAxes = Axes.Both,
                Depth            = float.MaxValue
            });

            Content.ScaleTo(0.85f, duration, Easing.OutQuart);
            Content.RotateTo(1, duration, Easing.OutQuart);
            Content.FadeColour(Color4.Gray, duration);

            // Will be restored by `ApplyToBackground` logic in `SongSelect`.
            Background?.FadeColour(OsuColour.Gray(0.3f), 60);
        }
        private void updateRate()
        {
            if (track == null)
            {
                return;
            }

            speedAdjustmentsApplied = true;
            track.ResetSpeedAdjustments();

            track.AddAdjustment(AdjustableProperty.Frequency, pauseFreqAdjust);
            track.AddAdjustment(AdjustableProperty.Tempo, UserPlaybackRate);

            foreach (var mod in mods.OfType <IApplicableToTrack>())
            {
                mod.ApplyToTrack(track);
            }
        }
Beispiel #6
0
        private void addSourceClockAdjustments()
        {
            if (speedAdjustmentsApplied)
            {
                return;
            }

            Track.AddAdjustment(AdjustableProperty.Frequency, pauseFreqAdjust);
            Track.AddAdjustment(AdjustableProperty.Tempo, UserPlaybackRate);

            masterGameplayClock.MutableNonGameplayAdjustments.Add(pauseFreqAdjust);
            masterGameplayClock.MutableNonGameplayAdjustments.Add(UserPlaybackRate);

            speedAdjustmentsApplied = true;
        }
Beispiel #7
0
        private void load(OsuColour colours, IBindable <WorkingBeatmap> beatmap)
        {
            Children = new Drawable[]
            {
                new FillFlowContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Children         = new Drawable[]
                    {
                        new SpriteIcon
                        {
                            Colour = colours.Yellow,
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Icon   = FontAwesome.Solid.ExclamationTriangle,
                            Size   = new Vector2(50),
                        },
                        new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(size: 25))
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            TextAnchor       = Anchor.Centre,
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                        }.With(tfc =>
                        {
                            tfc.AddText("This beatmap contains scenes with ");
                            tfc.AddText("rapidly flashing colours", s =>
                            {
                                s.Font   = s.Font.With(weight: FontWeight.Bold);
                                s.Colour = colours.Yellow;
                            });
                            tfc.AddText(".");

                            tfc.NewParagraph();
                            tfc.AddText("Please take caution if you are affected by epilepsy.");
                        }),
                    }
                }
            };

            track = beatmap.Value.Track;
            track.AddAdjustment(AdjustableProperty.Volume, trackVolumeOnEpilepsyWarning);
        }
Beispiel #8
0
        /// <summary>
        /// Start the fail animation playing.
        /// </summary>
        /// <exception cref="InvalidOperationException">Thrown if started more than once.</exception>
        public void Start()
        {
            if (started)
            {
                throw new InvalidOperationException("Animation cannot be started more than once.");
            }

            started = true;

            this.TransformBindableTo(trackFreq, 0, duration).OnComplete(_ =>
            {
                RemoveFilters();
                OnComplete?.Invoke();
            });

            failHighPassFilter.CutoffTo(300);
            failLowPassFilter.CutoffTo(300, duration, Easing.OutCubic);
            failSample.Play();

            track.AddAdjustment(AdjustableProperty.Frequency, trackFreq);

            applyToPlayfield(drawableRuleset.Playfield);
            drawableRuleset.Playfield.HitObjectContainer.FadeOut(duration / 2);

            if (config.Get <bool>(OsuSetting.FadePlayfieldWhenHealthLow))
            {
                redFlashLayer.FadeOutFromOne(1000);
            }

            Content.Masking = true;

            Content.Add(new Box
            {
                Colour           = Color4.Black,
                RelativeSizeAxes = Axes.Both,
                Depth            = float.MaxValue
            });

            Content.ScaleTo(0.85f, duration, Easing.OutQuart);
            Content.RotateTo(1, duration, Easing.OutQuart);
            Content.FadeColour(Color4.Gray, duration);
        }
Beispiel #9
0
        private void load(IAdjustableClock adjustableClock)
        {
            this.adjustableClock = adjustableClock;

            Children = new Drawable[]
            {
                playButton = new IconButton
                {
                    Anchor    = Anchor.CentreLeft,
                    Origin    = Anchor.CentreLeft,
                    Scale     = new Vector2(1.4f),
                    IconScale = new Vector2(1.4f),
                    Icon      = FontAwesome.Regular.PlayCircle,
                    Action    = togglePause,
                },
                new OsuSpriteText
                {
                    Origin = Anchor.BottomLeft,
                    Text   = "Playback speed",
                    RelativePositionAxes = Axes.Y,
                    Y       = 0.5f,
                    Padding = new MarginPadding {
                        Left = 45
                    }
                },
                new Container
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.Both,
                    Height           = 0.5f,
                    Padding          = new MarginPadding {
                        Left = 45
                    },
                    Child = new PlaybackTabControl {
                        Current = tempo
                    },
                }
            };

            Track?.AddAdjustment(AdjustableProperty.Tempo, tempo);
        }
        /// <summary>
        /// Start the fail animation playing.
        /// </summary>
        /// <exception cref="InvalidOperationException">Thrown if started more than once.</exception>
        public void Start()
        {
            if (started)
            {
                throw new InvalidOperationException("Animation cannot be started more than once.");
            }

            started = true;

            failSample.Play();

            this.TransformBindableTo(trackFreq, 0, duration).OnComplete(_ =>
            {
                OnComplete?.Invoke();
                Expire();
            });

            track.AddAdjustment(AdjustableProperty.Frequency, trackFreq);

            applyToPlayfield(drawableRuleset.Playfield);
            drawableRuleset.Playfield.HitObjectContainer.FlashColour(Color4.Red, 500);
            drawableRuleset.Playfield.HitObjectContainer.FadeOut(duration / 2);
        }
Beispiel #11
0
 public override void ApplyToTrack(Track track)
 {
     // base.ApplyToTrack() intentionally not called (different tempo adjustment is applied)
     track.AddAdjustment(AdjustableProperty.Frequency, freqAdjust);
     track.AddAdjustment(AdjustableProperty.Tempo, tempoAdjust);
 }
Beispiel #12
0
 public virtual void ApplyToTrack(Track track)
 {
     track.AddAdjustment(AdjustableProperty.Tempo, SpeedChange);
 }