From 7edbc8585b21c38636fdfc64dd2c2ba7d7de844e Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Fri, 15 Oct 2021 21:59:09 +0200 Subject: [PATCH 1/5] Port over mania's hidden implementation --- osu.Game.Rulesets.Rush/Mods/RushModHidden.cs | 15 ++ .../Mods/RushModPlayfieldCover.cs | 49 +++++++ osu.Game.Rulesets.Rush/RushRuleset.cs | 1 + osu.Game.Rulesets.Rush/UI/RushPlayfield.cs | 25 +++- .../UI/RushPlayfieldCoveringWrapper.cs | 128 ++++++++++++++++++ 5 files changed, 212 insertions(+), 6 deletions(-) create mode 100644 osu.Game.Rulesets.Rush/Mods/RushModHidden.cs create mode 100644 osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs create mode 100644 osu.Game.Rulesets.Rush/UI/RushPlayfieldCoveringWrapper.cs diff --git a/osu.Game.Rulesets.Rush/Mods/RushModHidden.cs b/osu.Game.Rulesets.Rush/Mods/RushModHidden.cs new file mode 100644 index 0000000..262d586 --- /dev/null +++ b/osu.Game.Rulesets.Rush/Mods/RushModHidden.cs @@ -0,0 +1,15 @@ +// Copyright (c) Shane Woolcock. Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Rulesets.Rush.UI; + +namespace osu.Game.Rulesets.Rush.Mods +{ + public class RushModHidden : RushModPlayfieldCover + { + public override string Description => @"Keys fade out before you hit them!"; + public override double ScoreMultiplier => 1; + + protected override CoverExpandDirection ExpandDirection => CoverExpandDirection.AgainstScroll; + } +} diff --git a/osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs b/osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs new file mode 100644 index 0000000..d137060 --- /dev/null +++ b/osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs @@ -0,0 +1,49 @@ +// Copyright (c) Shane Woolcock. Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Rush.Objects; +using osu.Game.Rulesets.Rush.UI; +using osu.Game.Rulesets.UI; + +namespace osu.Game.Rulesets.Rush.Mods +{ + public abstract class RushModPlayfieldCover : ModHidden, IApplicableToDrawableRuleset + { + public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) }; + + /// + /// The direction in which the cover should expand. + /// + protected abstract CoverExpandDirection ExpandDirection { get; } + + public virtual void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) + { + RushPlayfield rushPlayfield = (RushPlayfield)drawableRuleset.Playfield; + Container hitObjectArea = rushPlayfield.HitObjectArea; + Container hitObjectAreaParent = (Container)rushPlayfield.HitObjectArea.Parent; + hitObjectAreaParent.Remove(hitObjectArea); + + PlayfieldCoveringWrapper wrapper = new PlayfieldCoveringWrapper(hitObjectArea) + { + RelativeSizeAxes = Axes.Both, + Direction = ExpandDirection, + Coverage = 0.5f, + }; + + hitObjectAreaParent.Add(wrapper); + } + + protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) + { + } + + protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) + { + } + } +} diff --git a/osu.Game.Rulesets.Rush/RushRuleset.cs b/osu.Game.Rulesets.Rush/RushRuleset.cs index bda5108..89eb0d7 100644 --- a/osu.Game.Rulesets.Rush/RushRuleset.cs +++ b/osu.Game.Rulesets.Rush/RushRuleset.cs @@ -70,6 +70,7 @@ public override IEnumerable GetModsFor(ModType type) { new MultiMod(new RushModSuddenDeath(), new RushModPerfect()), new MultiMod(new RushModDoubleTime(), new RushModNightcore()), + new RushModHidden(), new RushModFlashlight() }; diff --git a/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs b/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs index 100b9ba..fca5f69 100644 --- a/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs +++ b/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs @@ -42,6 +42,8 @@ public class RushPlayfield : ScrollingPlayfield, IKeyBindingHandler private readonly LanePlayfield airLane; private readonly LanePlayfield groundLane; + public readonly Container HitObjectArea; + public IEnumerable AllAliveHitObjects { get @@ -77,15 +79,26 @@ public RushPlayfield() Anchor = Origin = Anchor.Centre; InternalChildren = new Drawable[] { - airLane = new LanePlayfield(LanedHitLane.Air), - groundLane = new LanePlayfield(LanedHitLane.Ground), - // Contains miniboss and duals for now new Container { - Name = "Hit Objects", RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, - Child = HitObjectContainer + Child = HitObjectArea = new Container + { + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] + { + airLane = new LanePlayfield(LanedHitLane.Air), + groundLane = new LanePlayfield(LanedHitLane.Ground), + // Contains miniboss and duals for now + new Container + { + Name = "Hit Objects", + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, + Child = HitObjectContainer + }, + } + } }, halfPaddingOverEffectContainer = new Container { diff --git a/osu.Game.Rulesets.Rush/UI/RushPlayfieldCoveringWrapper.cs b/osu.Game.Rulesets.Rush/UI/RushPlayfieldCoveringWrapper.cs new file mode 100644 index 0000000..869d75f --- /dev/null +++ b/osu.Game.Rulesets.Rush/UI/RushPlayfieldCoveringWrapper.cs @@ -0,0 +1,128 @@ +// Copyright (c) Shane Woolcock. Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Rulesets.Rush.UI +{ + /// + /// A that has its contents partially hidden by an adjustable "cover". This is intended to be used in a playfield. + /// + public class PlayfieldCoveringWrapper : CompositeDrawable + { + /// + /// The complete cover, including gradient and fill. + /// + private readonly Drawable cover; + + /// + /// The gradient portion of the cover. + /// + private readonly Box gradient; + + /// + /// The fully-opaque portion of the cover. + /// + private readonly Box filled; + + public PlayfieldCoveringWrapper(Drawable content) + { + InternalChild = new BufferedContainer + { + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Height = 2, + Children = new[] + { + new Container{ + RelativeSizeAxes = Axes.Both, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Height = 0.5f, + Child = content, + }, + cover = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Blending = new BlendingParameters + { + // Don't change the destination colour. + RGBEquation = BlendingEquation.Add, + Source = BlendingType.Zero, + Destination = BlendingType.One, + // Subtract the cover's alpha from the destination (points with alpha 1 should make the destination completely transparent). + AlphaEquation = BlendingEquation.Add, + SourceAlpha = BlendingType.Zero, + DestinationAlpha = BlendingType.OneMinusSrcAlpha + }, + Children = new Drawable[] + { + gradient = new Box + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + RelativeSizeAxes = Axes.Both, + RelativePositionAxes = Axes.Both, + Width = 0.25f, + Colour = ColourInfo.GradientHorizontal( + Color4.White.Opacity(1f), + Color4.White.Opacity(0f) + ) + }, + filled = new Box + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + RelativeSizeAxes = Axes.Both, + Width = 0 + } + } + } + } + }; + } + + + /// + /// The relative area that should be completely covered. This does not include the fade. + /// + public float Coverage + { + set + { + filled.Width = value; + gradient.X = value; + } + } + + /// + /// The direction in which the cover expands. + /// + public CoverExpandDirection Direction + { + set => cover.Scale = value == CoverExpandDirection.AlongScroll ? new Vector2(-1, 1) : Vector2.One; + } + } + + public enum CoverExpandDirection + { + /// + /// The cover expands along the scrolling direction. + /// + AlongScroll, + + /// + /// The cover expands against the scrolling direction. + /// + AgainstScroll + } +} From 75567aeec181e5ca7e895d0b09403642714170d7 Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Sat, 18 Dec 2021 13:46:45 +0100 Subject: [PATCH 2/5] Implement Fade In mod --- osu.Game.Rulesets.Rush/Mods/RushModFadeIn.cs | 18 ++++++++++++++++++ osu.Game.Rulesets.Rush/RushRuleset.cs | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Rush/Mods/RushModFadeIn.cs diff --git a/osu.Game.Rulesets.Rush/Mods/RushModFadeIn.cs b/osu.Game.Rulesets.Rush/Mods/RushModFadeIn.cs new file mode 100644 index 0000000..10f4b45 --- /dev/null +++ b/osu.Game.Rulesets.Rush/Mods/RushModFadeIn.cs @@ -0,0 +1,18 @@ +// Copyright (c) Shane Woolcock. Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Rulesets.Rush.UI; + +namespace osu.Game.Rulesets.Rush.Mods +{ + public class RushModFadeIn : RushModPlayfieldCover + { + public override string Name => "Fade In"; + public override string Acronym => "FI"; + + public override string Description => @"Keys fade in before you hit them!"; + public override double ScoreMultiplier => 1; + + protected override CoverExpandDirection ExpandDirection => CoverExpandDirection.AlongScroll; + } +} diff --git a/osu.Game.Rulesets.Rush/RushRuleset.cs b/osu.Game.Rulesets.Rush/RushRuleset.cs index 2b4b8c8..add283e 100644 --- a/osu.Game.Rulesets.Rush/RushRuleset.cs +++ b/osu.Game.Rulesets.Rush/RushRuleset.cs @@ -70,7 +70,7 @@ public override IEnumerable GetModsFor(ModType type) { new MultiMod(new RushModSuddenDeath(), new RushModPerfect()), new MultiMod(new RushModDoubleTime(), new RushModNightcore()), - new RushModHidden(), + new MultiMod(new RushModHidden(), new RushModFadeIn()), new RushModFlashlight() }; From 77eff9abd7c8dc9f03bea88a45ab855b6c5d1beb Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Sat, 18 Dec 2021 15:09:39 +0100 Subject: [PATCH 3/5] Fix several visual bugs --- .../Mods/RushModPlayfieldCover.cs | 29 +++++++++++----- osu.Game.Rulesets.Rush/UI/LanePlayfield.cs | 33 +++++++++++++++---- osu.Game.Rulesets.Rush/UI/RushPlayfield.cs | 27 ++++++++------- 3 files changed, 62 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs b/osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs index d137060..d1cecc6 100644 --- a/osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs +++ b/osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Mods; @@ -24,18 +25,28 @@ public abstract class RushModPlayfieldCover : ModHidden, IApplicableToDrawableRu public virtual void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { RushPlayfield rushPlayfield = (RushPlayfield)drawableRuleset.Playfield; - Container hitObjectArea = rushPlayfield.HitObjectArea; - Container hitObjectAreaParent = (Container)rushPlayfield.HitObjectArea.Parent; - hitObjectAreaParent.Remove(hitObjectArea); - PlayfieldCoveringWrapper wrapper = new PlayfieldCoveringWrapper(hitObjectArea) - { - RelativeSizeAxes = Axes.Both, - Direction = ExpandDirection, - Coverage = 0.5f, + List hitObjectAreas = new List{ + (Container)rushPlayfield.AirLane.HitObjectContainer.Parent, + (Container)rushPlayfield.GroundLane.HitObjectContainer.Parent, + (Container)rushPlayfield.HitObjectContainer.Parent, }; - hitObjectAreaParent.Add(wrapper); + + foreach (var area in hitObjectAreas) + { + Container hitObjectAreaParent = (Container)area.Parent; + hitObjectAreaParent.Remove(area); + + PlayfieldCoveringWrapper wrapper = new PlayfieldCoveringWrapper(area) + { + RelativeSizeAxes = Axes.Both, + Direction = ExpandDirection, + Coverage = 0.5f, + }; + + hitObjectAreaParent.Add(wrapper); + } } protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) diff --git a/osu.Game.Rulesets.Rush/UI/LanePlayfield.cs b/osu.Game.Rulesets.Rush/UI/LanePlayfield.cs index de3176b..eca69f5 100644 --- a/osu.Game.Rulesets.Rush/UI/LanePlayfield.cs +++ b/osu.Game.Rulesets.Rush/UI/LanePlayfield.cs @@ -30,9 +30,10 @@ public LanePlayfield(LanedHitLane type) Name = $"{(isAirLane ? "Air" : "Ground")} Playfield"; Padding = new MarginPadding { Left = RushPlayfield.HIT_TARGET_OFFSET }; - Anchor = Origin = isAirLane ? Anchor.TopCentre : Anchor.BottomCentre; + Anchor = isAirLane ? Anchor.TopLeft : Anchor.BottomLeft; + Origin = Anchor.CentreLeft; RelativeSizeAxes = Axes.Both; - Size = new Vector2(1, 0); + Size = new Vector2(1, 0.5f); AddRangeInternal(new Drawable[] { @@ -47,10 +48,30 @@ public LanePlayfield(LanedHitLane type) RelativeSizeAxes = Axes.Both, }, confineMode: ConfineMode.ScaleToFit), }, - effectsContainer = new Container(), - judgementContainer = new JudgementContainer(), - HitObjectContainer, - }); + effectsContainer = new Container() + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft + }, + judgementContainer = new JudgementContainer() + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft + }, + new Container{ + Padding = new MarginPadding { Left = -RushPlayfield.HIT_TARGET_OFFSET }, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + RelativeSizeAxes = Axes.Both, + Child = new Container{ + Padding = new MarginPadding { Left = +RushPlayfield.HIT_TARGET_OFFSET }, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + RelativeSizeAxes = Axes.Both, + Child = HitObjectContainer, + } + } + }); } [Resolved] diff --git a/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs b/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs index fca5f69..f405b1d 100644 --- a/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs +++ b/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs @@ -39,10 +39,8 @@ public class RushPlayfield : ScrollingPlayfield, IKeyBindingHandler private readonly Container halfPaddingOverEffectContainer; internal readonly Container OverPlayerEffectsContainer; - private readonly LanePlayfield airLane; - private readonly LanePlayfield groundLane; - - public readonly Container HitObjectArea; + public readonly LanePlayfield AirLane; + public readonly LanePlayfield GroundLane; public IEnumerable AllAliveHitObjects { @@ -82,20 +80,25 @@ public RushPlayfield() new Container { RelativeSizeAxes = Axes.Both, - Child = HitObjectArea = new Container + Child = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - airLane = new LanePlayfield(LanedHitLane.Air), - groundLane = new LanePlayfield(LanedHitLane.Ground), + AirLane = new LanePlayfield(LanedHitLane.Air), + GroundLane = new LanePlayfield(LanedHitLane.Ground), // Contains miniboss and duals for now new Container { Name = "Hit Objects", RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, - Child = HitObjectContainer + Child = new Container + { + Name = "Hit Objects", + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, + Child = HitObjectContainer + }, }, } } @@ -118,8 +121,8 @@ public RushPlayfield() new FeverBar() }; - AddNested(airLane); - AddNested(groundLane); + AddNested(AirLane); + AddNested(GroundLane); NewResult += onNewResult; } @@ -170,7 +173,7 @@ public override void Add(HitObject hitObject) base.Add(hitObject); } - private LanePlayfield playfieldForLane(LanedHitLane lane) => lane == LanedHitLane.Air ? airLane : groundLane; + private LanePlayfield playfieldForLane(LanedHitLane lane) => lane == LanedHitLane.Air ? AirLane : GroundLane; private void onMiniBossAttacked(DrawableMiniBoss drawableMiniBoss, double timeOffset) { From e8108db170628d937300cfb186ed6957b991c429 Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Sat, 18 Dec 2021 23:23:28 +0100 Subject: [PATCH 4/5] Improve performance of visibility reduction mods --- .../Mods/RushModPlayfieldCover.cs | 30 ++++++---------- osu.Game.Rulesets.Rush/UI/LanePlayfield.cs | 34 ++----------------- osu.Game.Rulesets.Rush/UI/RushPlayfield.cs | 34 +++++++++++++++++-- 3 files changed, 43 insertions(+), 55 deletions(-) diff --git a/osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs b/osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs index d1cecc6..cac494c 100644 --- a/osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs +++ b/osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Mods; @@ -26,27 +25,18 @@ public virtual void ApplyToDrawableRuleset(DrawableRuleset drawab { RushPlayfield rushPlayfield = (RushPlayfield)drawableRuleset.Playfield; - List hitObjectAreas = new List{ - (Container)rushPlayfield.AirLane.HitObjectContainer.Parent, - (Container)rushPlayfield.GroundLane.HitObjectContainer.Parent, - (Container)rushPlayfield.HitObjectContainer.Parent, - }; - + Container hitObjectArea = rushPlayfield.HitObjectArea; + Container hocParent = (Container)hitObjectArea.Parent; + hocParent.Remove(hitObjectArea); - foreach (var area in hitObjectAreas) + PlayfieldCoveringWrapper wrapper = new PlayfieldCoveringWrapper(hitObjectArea) { - Container hitObjectAreaParent = (Container)area.Parent; - hitObjectAreaParent.Remove(area); - - PlayfieldCoveringWrapper wrapper = new PlayfieldCoveringWrapper(area) - { - RelativeSizeAxes = Axes.Both, - Direction = ExpandDirection, - Coverage = 0.5f, - }; - - hitObjectAreaParent.Add(wrapper); - } + RelativeSizeAxes = Axes.Both, + Direction = ExpandDirection, + Coverage = 0.5f, + }; + + hocParent.Add(wrapper); } protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state) diff --git a/osu.Game.Rulesets.Rush/UI/LanePlayfield.cs b/osu.Game.Rulesets.Rush/UI/LanePlayfield.cs index eca69f5..317cd06 100644 --- a/osu.Game.Rulesets.Rush/UI/LanePlayfield.cs +++ b/osu.Game.Rulesets.Rush/UI/LanePlayfield.cs @@ -5,11 +5,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Pooling; -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Rush.Objects; using osu.Game.Rulesets.Rush.Objects.Drawables; -using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Skinning; using osuTK; @@ -18,9 +16,6 @@ namespace osu.Game.Rulesets.Rush.UI { public class LanePlayfield : ScrollingPlayfield { - private readonly JudgementContainer judgementContainer; - private readonly Container effectsContainer; - private readonly LanedHitLane lane; public LanePlayfield(LanedHitLane type) @@ -48,30 +43,8 @@ public LanePlayfield(LanedHitLane type) RelativeSizeAxes = Axes.Both, }, confineMode: ConfineMode.ScaleToFit), }, - effectsContainer = new Container() - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft - }, - judgementContainer = new JudgementContainer() - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft - }, - new Container{ - Padding = new MarginPadding { Left = -RushPlayfield.HIT_TARGET_OFFSET }, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - RelativeSizeAxes = Axes.Both, - Child = new Container{ - Padding = new MarginPadding { Left = +RushPlayfield.HIT_TARGET_OFFSET }, - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - RelativeSizeAxes = Axes.Both, - Child = HitObjectContainer, - } - } - }); + HitObjectContainer, + }); } [Resolved] @@ -102,9 +75,6 @@ protected override void OnNewDrawableHitObject(DrawableHitObject drawableHitObje RegisterPool(new DrawableLanedObjectPool(lane, initialSize, maximumSize)); } - public void AddExplosion(Drawable drawable) => effectsContainer.Add(drawable); - public void AddJudgement(DrawableRushJudgement judgement) => judgementContainer.Add(judgement); - // This pool pre-initializes created DrawableLanedObjects with a predefined lane value // The lane value needs to be set beforehand so that the pieces (Minion, etc) can load using the correct information private class DrawableLanedObjectPool : DrawablePool where T : PoolableDrawable, IDrawableLanedHit, new() diff --git a/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs b/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs index f405b1d..59a0975 100644 --- a/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs +++ b/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs @@ -39,8 +39,12 @@ public class RushPlayfield : ScrollingPlayfield, IKeyBindingHandler private readonly Container halfPaddingOverEffectContainer; internal readonly Container OverPlayerEffectsContainer; + public readonly Container HitObjectArea; + public readonly LanePlayfield AirLane; + public readonly Container AirLaneEffectContainer; public readonly LanePlayfield GroundLane; + public readonly Container GroundLaneEffectContainer; public IEnumerable AllAliveHitObjects { @@ -80,7 +84,7 @@ public RushPlayfield() new Container { RelativeSizeAxes = Axes.Both, - Child = new Container + Child = HitObjectArea = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] @@ -103,6 +107,25 @@ public RushPlayfield() } } }, + new Container{ + Name = "Judgement and Effects container", + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, + Children = new Drawable[]{ + AirLaneEffectContainer = new Container() + { + Name = "Top Container", + Anchor = Anchor.TopLeft, + Origin = Anchor.CentreLeft + }, + GroundLaneEffectContainer = new Container() + { + Name = "Bottom Container", + Anchor = Anchor.BottomLeft, + Origin = Anchor.CentreLeft + } + } + }, halfPaddingOverEffectContainer = new Container { Name = "Over Effects (Half Padding)", @@ -200,7 +223,10 @@ private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) }; if (rushJudgedObject is IDrawableLanedHit laned) - playfieldForLane(laned.Lane).AddExplosion(explosion); + { + var effectsContainer = laned.Lane == LanedHitLane.Air ? AirLaneEffectContainer : GroundLaneEffectContainer; + effectsContainer.Add(explosion); + } } // Display health point difference if the judgement result implies it. @@ -231,7 +257,9 @@ private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) break; } - playfieldForLane(judgementLane).AddJudgement(judgementDrawable); + var judgementContainer = judgementLane == LanedHitLane.Air ? AirLaneEffectContainer : GroundLaneEffectContainer; + + judgementContainer.Add(judgementDrawable); } } From 2da3d51d7d2a60bd7f1c162f922b24a8c7f5226c Mon Sep 17 00:00:00 2001 From: Derrick Timmermans Date: Sat, 18 Dec 2021 23:30:27 +0100 Subject: [PATCH 5/5] Reduce accessibility of some components They aren't used publicly anyways. --- osu.Game.Rulesets.Rush/UI/RushPlayfield.cs | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs b/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs index 59a0975..93b2e03 100644 --- a/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs +++ b/osu.Game.Rulesets.Rush/UI/RushPlayfield.cs @@ -39,12 +39,16 @@ public class RushPlayfield : ScrollingPlayfield, IKeyBindingHandler private readonly Container halfPaddingOverEffectContainer; internal readonly Container OverPlayerEffectsContainer; + // The container housing all HitObjectAreas public readonly Container HitObjectArea; - public readonly LanePlayfield AirLane; - public readonly Container AirLaneEffectContainer; - public readonly LanePlayfield GroundLane; - public readonly Container GroundLaneEffectContainer; + // playfield for each lanes + private readonly LanePlayfield airLane; + private readonly LanePlayfield groundLane; + + // These are used to hold onto judgement and effect drawables + private readonly Container airLaneEffectContainer; + private readonly Container groundLaneEffectContainer; public IEnumerable AllAliveHitObjects { @@ -89,8 +93,8 @@ public RushPlayfield() RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - AirLane = new LanePlayfield(LanedHitLane.Air), - GroundLane = new LanePlayfield(LanedHitLane.Ground), + airLane = new LanePlayfield(LanedHitLane.Air), + groundLane = new LanePlayfield(LanedHitLane.Ground), // Contains miniboss and duals for now new Container { @@ -112,13 +116,13 @@ public RushPlayfield() RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }, Children = new Drawable[]{ - AirLaneEffectContainer = new Container() + airLaneEffectContainer = new Container() { Name = "Top Container", Anchor = Anchor.TopLeft, Origin = Anchor.CentreLeft }, - GroundLaneEffectContainer = new Container() + groundLaneEffectContainer = new Container() { Name = "Bottom Container", Anchor = Anchor.BottomLeft, @@ -144,8 +148,8 @@ public RushPlayfield() new FeverBar() }; - AddNested(AirLane); - AddNested(GroundLane); + AddNested(airLane); + AddNested(groundLane); NewResult += onNewResult; } @@ -196,7 +200,7 @@ public override void Add(HitObject hitObject) base.Add(hitObject); } - private LanePlayfield playfieldForLane(LanedHitLane lane) => lane == LanedHitLane.Air ? AirLane : GroundLane; + private LanePlayfield playfieldForLane(LanedHitLane lane) => lane == LanedHitLane.Air ? airLane : groundLane; private void onMiniBossAttacked(DrawableMiniBoss drawableMiniBoss, double timeOffset) { @@ -224,7 +228,7 @@ private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) if (rushJudgedObject is IDrawableLanedHit laned) { - var effectsContainer = laned.Lane == LanedHitLane.Air ? AirLaneEffectContainer : GroundLaneEffectContainer; + var effectsContainer = laned.Lane == LanedHitLane.Air ? airLaneEffectContainer : groundLaneEffectContainer; effectsContainer.Add(explosion); } } @@ -257,7 +261,7 @@ private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) break; } - var judgementContainer = judgementLane == LanedHitLane.Air ? AirLaneEffectContainer : GroundLaneEffectContainer; + var judgementContainer = judgementLane == LanedHitLane.Air ? airLaneEffectContainer : groundLaneEffectContainer; judgementContainer.Add(judgementDrawable); }