private void onComboChange(ValueChangedEvent <int> combo) { if (combo.NewValue == 0 && combo.OldValue > 20) { comboBreakSample?.Play(); } }
protected override void PopIn() { base.PopIn(); pauseLoop.VolumeTo(1.0f, TRANSITION_DURATION, Easing.InQuint); pauseLoop.Play(); }
protected override void LoadComplete() { base.LoadComplete(); this.ScaleTo(0).Then().ScaleTo(1, APPEAR_DURATION, Easing.OutQuint); using (BeginDelayedSequence(RANK_CIRCLE_TRANSFORM_DELAY, true)) innerMask.FillTo(1f, RANK_CIRCLE_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING); using (BeginDelayedSequence(ACCURACY_TRANSFORM_DELAY, true)) { double targetAccuracy = score.Rank == ScoreRank.X || score.Rank == ScoreRank.XH ? 1 : Math.Min(1 - virtual_ss_percentage, score.Accuracy); accuracyCircle.FillTo(targetAccuracy, ACCURACY_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING); foreach (var badge in badges) { if (badge.Accuracy > score.Accuracy) { continue; } using (BeginDelayedSequence(inverseEasing(ACCURACY_TRANSFORM_EASING, Math.Min(1 - virtual_ss_percentage, badge.Accuracy) / targetAccuracy) * ACCURACY_TRANSFORM_DURATION, true)) { badge.Appear(); } } using (BeginDelayedSequence(TEXT_APPEAR_DELAY, true)) { this.Delay(-1440).Schedule(() => applauseSound?.Play()); rankText.Appear(); } } }
protected override void CheckForResult(bool userTriggered, double timeOffset) { Debug.Assert(HitObject.HitWindows != null); if (!userTriggered) { if (!HitObject.HitWindows.CanBeHit(timeOffset)) { ApplyResult(r => r.Type = HitResult.Miss); } return; } if (HitObject.HitWindows.ResultFor(timeOffset) == HitResult.Miss && Time.Current < HitObject.StartTime) { return; } var result = HitObject.HitWindows.ResultFor(timeOffset); if (result == HitResult.None) { return; } ApplyResult(r => r.Type = result); if (result == HitResult.Perfect) { breakSound?.Play(); } }
private void onComboChange(ValueChangedEvent <int> combo) { // handle the case of rewinding before the first combo break time. if (gameplayClock.CurrentTime < firstBreakTime) { firstBreakTime = null; } if (gameplayClock.ElapsedFrameTime < 0) { return; } if (combo.NewValue == 0 && (combo.OldValue > 20 || (alwaysPlayFirst.Value && firstBreakTime == null))) { firstBreakTime = gameplayClock.CurrentTime; // combo break isn't a pausable sound itself as we want to let it play out. // we still need to disable during seeks, though. if (samplePlaybackDisabler?.SamplePlaybackDisabled.Value == true) { return; } comboBreakSample?.Play(); } }
private void onComboChange(ValueChangedEvent <int> combo) { if (combo.NewValue == 0 && (combo.OldValue > 20 || (alwaysPlay.Value && firstTime))) { comboBreakSample?.Play(); firstTime = false; } }
private void playBeatFor(int beatIndex, TimeSignatures signature) { if (beatIndex == 0) { finishSample?.Play(); } switch (signature) { case TimeSignatures.SimpleTriple: switch (beatIndex % 6) { case 0: kickSample?.Play(); break; case 3: clapSample?.Play(); break; default: hatSample?.Play(); break; } break; case TimeSignatures.SimpleQuadruple: switch (beatIndex % 4) { case 0: kickSample?.Play(); break; case 2: clapSample?.Play(); break; default: hatSample?.Play(); break; } break; } }
public override void PlaySamples() { base.PlaySamples(); if (Result.Type == HitResult.Perfect && breakEnabled.Value) { const float balance_adjust_amount = 0.4f; balanceAdjust.Value = balance_adjust_amount * (userPositionalHitSounds.Value ? SamplePlaybackPosition - 0.5f : 0); breakSound?.Play(); } }
public void TestStoppedSoundDoesntResumeAfterPause() { DrawableSample sample = null; AddStep("start sample with looping", () => { sample = skinnableSound.ChildrenOfType <DrawableSample>().First(); skinnableSound.Looping = true; skinnableSound.Play(); }); AddUntilStep("wait for sample to start playing", () => sample.Playing); AddStep("stop sample", () => skinnableSound.Stop()); AddUntilStep("wait for sample to stop playing", () => !sample.Playing); AddStep("pause gameplay clock", () => gameplayClock.IsPaused.Value = true); AddStep("resume gameplay clock", () => gameplayClock.IsPaused.Value = false); AddWaitStep("wait a bit", 5); AddAssert("sample not playing", () => !sample.Playing); }
private void updateSpinningSample(ValueChangedEvent <bool> tracking) { // note that samples will not start playing if exiting a seek operation in the middle of a spinner. // may be something we want to address at a later point, but not so easy to make happen right now // (SkinnableSound would need to expose whether the sample is already playing and this logic would need to run in Update). if (tracking.NewValue && ShouldPlaySamples) { spinningSample?.Play(); spinningSample?.VolumeTo(1, 200); } else { spinningSample?.VolumeTo(0, 200).Finally(_ => spinningSample.Stop()); } }
public override void OnResuming(IScreen last) { this.FadeIn(300); double fadeOutTime = exit_delay; var track = musicController.CurrentTrack; // ensure the track doesn't change or loop as we are exiting. track.Looping = false; Beatmap.Disabled = true; // we also handle the exit transition. if (MenuVoice.Value) { if (skinnableSeeya != null) { // resuming a screen (i.e. calling OnResume) happens before the screen itself becomes alive, // therefore skinnable samples may not be updated yet with the recently selected skin. // schedule after children to ensure skinnable samples have processed skin changes before playing. ScheduleAfterChildren(() => skinnableSeeya.Play()); } else { seeya.Play(); } // if playing the outro voice, we have more time to have fun with the background track. // initially fade to almost silent then ramp out over the remaining time. const double initial_fade = 200; track .VolumeTo(0.03f, initial_fade).Then() .VolumeTo(0, fadeOutTime - initial_fade, Easing.In); } else { fadeOutTime = 500; // if outro voice is turned off, just do a simple fade out. track.VolumeTo(0, fadeOutTime, Easing.Out); } //don't want to fade out completely else we will stop running updates. Game.FadeTo(0.01f, fadeOutTime).OnComplete(_ => this.Exit()); base.OnResuming(last); }
/// <summary> /// Plays all the hit sounds for this <see cref="DrawableHitObject"/>. /// This is invoked automatically when this <see cref="DrawableHitObject"/> is hit. /// </summary> public void PlaySamples() => Samples?.Play();
public SentakkiResumeOverlay() { Origin = Anchor.Centre; Anchor = Anchor.Centre; RelativeSizeAxes = Axes.Both; Children = new Drawable[] { counterText = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "", Font = OsuFont.Torus.With(size: 50), Colour = Color4.White, Shadow = true, ShadowColour = new Color4(0f, 0f, 0f, 0.25f) }, new FillFlowContainer { Direction = FillDirection.Horizontal, RelativePositionAxes = Axes.Both, Y = -0.4f, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Children = new Drawable[] { new OsuSpriteText { Text = "Sentakki is made with the support of ", Font = OsuFont.Torus.With(size: 20), Colour = Color4.White, Anchor = Anchor.Centre, Origin = Anchor.Centre, Shadow = true, ShadowColour = new Color4(0f, 0f, 0f, 0.25f) }, supporterText = new OsuSpriteText { Text = "Marisa Kirisame", Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold), Colour = Color4Extensions.FromHex("ff0064"), Anchor = Anchor.Centre, Origin = Anchor.Centre, Shadow = true, ShadowColour = new Color4(0f, 0f, 0f, 0.25f) } } }, countSound = new SkinnableSound(new SampleInfo("Gameplay/Taka")) }; tickCount.BindValueChanged( ticks => { counterText.Text = (ticks.NewValue == 4) ? "" : ticks.NewValue.ToString(); if (ticks.NewValue % 4 != 0) { countSound?.Play(); } if (ticks.NewValue <= 0) { Resume(); } } ); }