mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:02:55 +08:00
Simplify score panel balance adjustment
This commit is contained in:
parent
e08e4fc426
commit
9f045209b9
@ -96,7 +96,10 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
public readonly ScoreInfo Score;
|
||||
|
||||
public DrawableAudioMixer Mixer;
|
||||
[Resolved]
|
||||
private OsuGame game { get; set; }
|
||||
|
||||
private DrawableAudioMixer mixer;
|
||||
|
||||
private bool displayWithFlair;
|
||||
|
||||
@ -127,7 +130,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 = Mixer = new DrawableAudioMixer
|
||||
InternalChild = mixer = new DrawableAudioMixer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -219,6 +222,12 @@ namespace osu.Game.Screens.Ranking
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
mixer.Balance.Value = (ScreenSpaceDrawQuad.Centre.X / game.ScreenSpaceDrawQuad.Width) * 2 - 1;
|
||||
}
|
||||
|
||||
private void playAppearSample()
|
||||
{
|
||||
var channel = samplePanelFocus?.GetChannel();
|
||||
@ -265,7 +274,7 @@ namespace osu.Game.Screens.Ranking
|
||||
break;
|
||||
}
|
||||
|
||||
Mixer.ResizeTo(Size, RESIZE_DURATION, Easing.OutQuint);
|
||||
mixer.ResizeTo(Size, RESIZE_DURATION, Easing.OutQuint);
|
||||
|
||||
bool topLayerExpanded = topLayerContainer.Y < 0;
|
||||
|
||||
|
@ -344,23 +344,6 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user