Skip to content

Commit

Permalink
Place spinners/sliders always behind circles
Browse files Browse the repository at this point in the history
  • Loading branch information
EVAST9919 committed Aug 29, 2020
1 parent 4748948 commit b32d401
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions osu.Game.Rulesets.Swing/UI/SwingPlayfield.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class SwingPlayfield : Playfield
private Container<HitExplosion> explosions;
private JudgementContainer<DrawableSwingJudgement> judgementContainer;
private JudgementContainer<DrawableSwingJudgement> smallJudgementContainer;
private ProxyContainer spinnerProxies;
private ProxyContainer sliderProxies;

[BackgroundDependencyLoader]
private void load()
Expand Down Expand Up @@ -89,6 +91,8 @@ private void load()
Anchor = Anchor.Centre,
Origin = Anchor.Centre
},
spinnerProxies = new ProxyContainer(),
sliderProxies = new ProxyContainer(),
HitObjectContainer,
judgementContainer = new JudgementContainer<DrawableSwingJudgement>
{
Expand Down Expand Up @@ -127,12 +131,20 @@ public override void Add(DrawableHitObject h)

switch (h)
{
case DrawableSpinner _:
spinnerProxies.Add(h.CreateProxy());
h.OnNewResult += onNewResult;
break;

case DrawableHold hold:
hold.NestedHitObjects.ForEach(n => n.OnNewResult += onNewResult);
return;
}
sliderProxies.Add(h.CreateProxy());
break;

h.OnNewResult += onNewResult;
default:
h.OnNewResult += onNewResult;
break;
}
}

private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
Expand Down Expand Up @@ -346,5 +358,15 @@ public GlowingHalfRing(Color4 colour)
});
}
}

private class ProxyContainer : LifetimeManagementContainer
{
public ProxyContainer()
{
RelativeSizeAxes = Axes.Both;
}

public void Add(Drawable h) => AddInternal(h);
}
}
}

0 comments on commit b32d401

Please sign in to comment.