Skip to content

Implement visibility reduction mods #210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix several visual bugs
LumpBloom7 committed Dec 18, 2021
commit 77eff9abd7c8dc9f03bea88a45ab855b6c5d1beb
29 changes: 20 additions & 9 deletions osu.Game.Rulesets.Rush/Mods/RushModPlayfieldCover.cs
Original file line number Diff line number Diff line change
@@ -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<RushHitObject> 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<Container> hitObjectAreas = new List<Container>{
(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)
33 changes: 27 additions & 6 deletions osu.Game.Rulesets.Rush/UI/LanePlayfield.cs
Original file line number Diff line number Diff line change
@@ -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<DrawableJudgement>(),
HitObjectContainer,
});
effectsContainer = new Container()
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft
},
judgementContainer = new JudgementContainer<DrawableJudgement>()
{
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]
27 changes: 15 additions & 12 deletions osu.Game.Rulesets.Rush/UI/RushPlayfield.cs
Original file line number Diff line number Diff line change
@@ -39,10 +39,8 @@ public class RushPlayfield : ScrollingPlayfield, IKeyBindingHandler<RushAction>
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<DrawableHitObject> 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)
{