From 0b3b9dcc4e8896dd64fe032590beea9ed5aef449 Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Fri, 12 Apr 2024 21:37:58 +0200 Subject: [PATCH 1/2] Add back resume overlay Now using the one used by mania and catch --- .../UI/DrawableSentakkiRuleset.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Sentakki/UI/DrawableSentakkiRuleset.cs b/osu.Game.Rulesets.Sentakki/UI/DrawableSentakkiRuleset.cs index c961ef86c..e69cb0562 100644 --- a/osu.Game.Rulesets.Sentakki/UI/DrawableSentakkiRuleset.cs +++ b/osu.Game.Rulesets.Sentakki/UI/DrawableSentakkiRuleset.cs @@ -8,6 +8,7 @@ using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Beatmaps; +using osu.Game.Screens.Play; using osu.Game.Input.Bindings; using osu.Game.Input.Handlers; using osu.Game.Replays; @@ -159,15 +160,8 @@ public void OnReleased(KeyBindingReleaseEvent e) { } public override DrawableHitObject CreateDrawableRepresentation(SentakkiHitObject h) => null!; - // protected override ResumeOverlay CreateResumeOverlay() => new SentakkiResumeOverlay(); + protected override ResumeOverlay CreateResumeOverlay() => new DelayedResumeOverlay(); protected override PassThroughInputManager CreateInputManager() => new SentakkiInputManager(Ruleset.RulesetInfo); - - /* public override void RequestResume(Action continueResume) - { - ResumeOverlay.GameplayCursor = Cursor; - ResumeOverlay.ResumeAction = continueResume; - ResumeOverlay.Show(); - } */ } } From d65c20eb954526bed6c3aca6fee6c728d7c9a5cf Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Fri, 12 Apr 2024 21:39:08 +0200 Subject: [PATCH 2/2] Remove all traces of old resume overlay --- .../UI/TestSceneResumeOverlay.cs | 34 ----- .../UI/SentakkiResumeOverlay.cs | 128 ------------------ 2 files changed, 162 deletions(-) delete mode 100644 osu.Game.Rulesets.Sentakki.Tests/UI/TestSceneResumeOverlay.cs delete mode 100644 osu.Game.Rulesets.Sentakki/UI/SentakkiResumeOverlay.cs diff --git a/osu.Game.Rulesets.Sentakki.Tests/UI/TestSceneResumeOverlay.cs b/osu.Game.Rulesets.Sentakki.Tests/UI/TestSceneResumeOverlay.cs deleted file mode 100644 index d285c84fe..000000000 --- a/osu.Game.Rulesets.Sentakki.Tests/UI/TestSceneResumeOverlay.cs +++ /dev/null @@ -1,34 +0,0 @@ -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; -using osu.Game.Rulesets.Sentakki.UI; -using osu.Game.Rulesets.UI; -using osu.Game.Screens.Play; -using osu.Game.Tests.Visual; - -namespace osu.Game.Rulesets.Sentakki.Tests.UI -{ - public partial class TestSceneResumeOverlay : OsuTestScene - { - protected override Ruleset CreateRuleset() => new SentakkiRuleset(); - - public TestSceneResumeOverlay() - { - GameplayCursorContainer cursor; - ResumeOverlay resume; - - Children = new Drawable[] - { - cursor = new GameplayCursorContainer(), - resume = new SentakkiResumeOverlay - { - GameplayCursor = cursor - } - }; - - AddStep("Show ResumeOverlay", () => resume.Show()); - AddAssert("Is overlay shown?", () => resume.State.Value == Visibility.Visible); - AddUntilStep("Wait for countdown to end", () => resume.State.Value == Visibility.Hidden); - } - } -} diff --git a/osu.Game.Rulesets.Sentakki/UI/SentakkiResumeOverlay.cs b/osu.Game.Rulesets.Sentakki/UI/SentakkiResumeOverlay.cs deleted file mode 100644 index d2eed4bda..000000000 --- a/osu.Game.Rulesets.Sentakki/UI/SentakkiResumeOverlay.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Cursor; -using osu.Framework.Localisation; -using osu.Framework.Utils; -using osu.Game.Audio; -using osu.Game.Beatmaps; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Rulesets.Sentakki.Localisation; -using osu.Game.Screens.Play; -using osu.Game.Skinning; -using osuTK.Graphics; - -namespace osu.Game.Rulesets.Sentakki.UI -{ - public partial class SentakkiResumeOverlay : ResumeOverlay - { - [Resolved] - private IBindable beatmap { get; set; } = null!; - - [Resolved] - private DrawableSentakkiRuleset? drawableSentakkiRuleset { get; set; } - - // We don't want the default message - protected override LocalisableString Message => ""; - - private OsuSpriteText messageText = null!; - - private double beatlength; - - private double remainingTime = 3500; - - private readonly Bindable beatsLeft = new Bindable(4); - private int barLength; - - private SkinnableSound countSound = null!; - - private SentakkiCursorContainer? localCursorContainer; - - public override CursorContainer? LocalCursor => State.Value == Visibility.Visible ? localCursorContainer : null; - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - Origin = Anchor.Centre; - Anchor = Anchor.Centre; - RelativeSizeAxes = Axes.Both; - Children = new Drawable[] - { - messageText = new OsuSpriteText - { - Font = OsuFont.Torus.With(size: 50, weight: FontWeight.SemiBold), - Colour = colours.Yellow, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - ShadowColour = new Color4(0f, 0f, 0f, 0.25f) - }, - countSound = new SkinnableSound(new SampleInfo("Gameplay/Taka")) - }; - - beatsLeft.ValueChanged += onCountUpdated; - } - - protected override void Update() - { - base.Update(); - if (State.Value == Visibility.Hidden) return; - - remainingTime -= Clock.ElapsedFrameTime; - beatsLeft.Value = (int)Math.Ceiling(remainingTime / beatlength); - } - - protected override void PopIn() - { - base.PopIn(); - - messageText.Text = SentakkiResumeOverlayStrings.GetReady; - - var currentTimingPoint = beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(beatmap.Value.Track.CurrentTime); - barLength = currentTimingPoint.TimeSignature.Numerator; - beatlength = currentTimingPoint.BeatLength / (drawableSentakkiRuleset?.GameplaySpeed ?? 1); - - // Reset the countdown, plus a second for preparation - remainingTime = (barLength * beatlength) + 1000; - - if (localCursorContainer == null) - Add(localCursorContainer = new SentakkiCursorContainer()); - - localCursorContainer.State.BindTo(GameplayCursor.State); - GameplayCursor.ActiveCursor.Hide(); - } - - protected override void PopOut() - { - base.PopOut(); - messageText.Text = SentakkiResumeOverlayStrings.LetsGo; - - if (localCursorContainer != null && GameplayCursor?.ActiveCursor != null) - { - GameplayCursor.ActiveCursor.Position = localCursorContainer.ActiveCursor.Position; - } - - localCursorContainer?.Expire(); - localCursorContainer = null; - GameplayCursor?.ActiveCursor?.Show(); - } - - private void onCountUpdated(ValueChangedEvent beatsLeft) - { - if (beatsLeft.NewValue < barLength && beatsLeft.NewValue < beatsLeft.OldValue) - { - countSound?.Play(); - - messageText.Text = beatsLeft.NewValue.ToString(); - messageText.FinishTransforms(); - messageText.ScaleTo(1.1f, 100).Then().ScaleTo(1, 50); - } - - if (beatsLeft.NewValue <= 0) - Resume(); - } - } -}