Add dynamic panning fun to score panel sfx

This commit is contained in:
Jamie Taylor
2022-07-22 19:52:42 +09:00
parent 89da21b6de
commit 62d4d4b055
2 changed files with 21 additions and 4 deletions

View File

@ -96,9 +96,9 @@ namespace osu.Game.Screens.Ranking
public readonly ScoreInfo Score;
private bool displayWithFlair;
public DrawableAudioMixer Mixer;
private Container content;
private bool displayWithFlair;
private Container topLayerContainer;
private Drawable topLayerBackground;
@ -127,7 +127,7 @@ namespace osu.Game.Screens.Ranking
// Adding a manual offset here allows the expanded version to take on an "acceptable" vertical centre when at 100% UI scale.
const float vertical_fudge = 20;
InternalChild = content = new Container
InternalChild = Mixer = new DrawableAudioMixer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -265,7 +265,7 @@ namespace osu.Game.Screens.Ranking
break;
}
content.ResizeTo(Size, RESIZE_DURATION, Easing.OutQuint);
Mixer.ResizeTo(Size, RESIZE_DURATION, Easing.OutQuint);
bool topLayerExpanded = topLayerContainer.Y < 0;

View File

@ -344,6 +344,23 @@ namespace osu.Game.Screens.Ranking
private IEnumerable<ScorePanelTrackingContainer> applySorting(IEnumerable<Drawable> drawables) => drawables.OfType<ScorePanelTrackingContainer>()
.OrderByDescending(GetLayoutPosition)
.ThenBy(s => s.Panel.Score.OnlineID);
protected override void Update()
{
foreach (ScorePanelTrackingContainer trackingContainer in FlowingChildren.OfType<ScorePanelTrackingContainer>())
{
var panel = trackingContainer.Panel;
if (panel.State != PanelState.Expanded) continue;
var scrollContainer = Parent.Parent;
float balance = scrollContainer.ToLocalSpace(panel.ToScreenSpace(panel.BoundingBox.Centre)).X / scrollContainer.RelativeToAbsoluteFactor.X;
panel.Mixer.Balance.Value = Math.Clamp(-1 + balance * 2, -1, 1);
}
base.Update();
}
}
private class Scroll : OsuScrollContainer