mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Merge pull request #10614 from peppy/results-screen-animate-once
Only play results panel animation once (and only for the local user)
This commit is contained in:
@ -103,7 +103,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
|
|
||||||
private void addPanelStep(ScoreInfo score, PanelState state = PanelState.Expanded) => AddStep("add panel", () =>
|
private void addPanelStep(ScoreInfo score, PanelState state = PanelState.Expanded) => AddStep("add panel", () =>
|
||||||
{
|
{
|
||||||
Child = panel = new ScorePanel(score)
|
Child = panel = new ScorePanel(score, true)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -29,6 +29,8 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
private const float padding = 10;
|
private const float padding = 10;
|
||||||
|
|
||||||
private readonly ScoreInfo score;
|
private readonly ScoreInfo score;
|
||||||
|
private readonly bool withFlair;
|
||||||
|
|
||||||
private readonly List<StatisticDisplay> statisticDisplays = new List<StatisticDisplay>();
|
private readonly List<StatisticDisplay> statisticDisplays = new List<StatisticDisplay>();
|
||||||
|
|
||||||
private FillFlowContainer starAndModDisplay;
|
private FillFlowContainer starAndModDisplay;
|
||||||
@ -41,9 +43,11 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
/// Creates a new <see cref="ExpandedPanelMiddleContent"/>.
|
/// Creates a new <see cref="ExpandedPanelMiddleContent"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="score">The score to display.</param>
|
/// <param name="score">The score to display.</param>
|
||||||
public ExpandedPanelMiddleContent(ScoreInfo score)
|
/// <param name="withFlair">Whether to add flair for a new score being set.</param>
|
||||||
|
public ExpandedPanelMiddleContent(ScoreInfo score, bool withFlair = false)
|
||||||
{
|
{
|
||||||
this.score = score;
|
this.score = score;
|
||||||
|
this.withFlair = withFlair;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
@ -266,6 +270,9 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
delay += 200;
|
delay += 200;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!withFlair)
|
||||||
|
FinishTransforms(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (Score != null)
|
if (Score != null)
|
||||||
ScorePanelList.AddScore(Score);
|
ScorePanelList.AddScore(Score, true);
|
||||||
|
|
||||||
if (player != null && allowRetry)
|
if (player != null && allowRetry)
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,8 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
public readonly ScoreInfo Score;
|
public readonly ScoreInfo Score;
|
||||||
|
|
||||||
|
private bool displayWithFlair;
|
||||||
|
|
||||||
private Container content;
|
private Container content;
|
||||||
|
|
||||||
private Container topLayerContainer;
|
private Container topLayerContainer;
|
||||||
@ -97,9 +99,10 @@ namespace osu.Game.Screens.Ranking
|
|||||||
private Container middleLayerContentContainer;
|
private Container middleLayerContentContainer;
|
||||||
private Drawable middleLayerContent;
|
private Drawable middleLayerContent;
|
||||||
|
|
||||||
public ScorePanel(ScoreInfo score)
|
public ScorePanel(ScoreInfo score, bool isNewLocalScore = false)
|
||||||
{
|
{
|
||||||
Score = score;
|
Score = score;
|
||||||
|
displayWithFlair = isNewLocalScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -188,7 +191,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
state = value;
|
state = value;
|
||||||
|
|
||||||
if (LoadState >= LoadState.Ready)
|
if (IsLoaded)
|
||||||
updateState();
|
updateState();
|
||||||
|
|
||||||
StateChanged?.Invoke(value);
|
StateChanged?.Invoke(value);
|
||||||
@ -209,7 +212,10 @@ namespace osu.Game.Screens.Ranking
|
|||||||
middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint);
|
middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint);
|
||||||
|
|
||||||
topLayerContentContainer.Add(topLayerContent = new ExpandedPanelTopContent(Score.User).With(d => d.Alpha = 0));
|
topLayerContentContainer.Add(topLayerContent = new ExpandedPanelTopContent(Score.User).With(d => d.Alpha = 0));
|
||||||
middleLayerContentContainer.Add(middleLayerContent = new ExpandedPanelMiddleContent(Score).With(d => d.Alpha = 0));
|
middleLayerContentContainer.Add(middleLayerContent = new ExpandedPanelMiddleContent(Score, displayWithFlair).With(d => d.Alpha = 0));
|
||||||
|
|
||||||
|
// only the first expanded display should happen with flair.
|
||||||
|
displayWithFlair = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PanelState.Contracted:
|
case PanelState.Contracted:
|
||||||
|
@ -95,9 +95,10 @@ namespace osu.Game.Screens.Ranking
|
|||||||
/// Adds a <see cref="ScoreInfo"/> to this list.
|
/// Adds a <see cref="ScoreInfo"/> to this list.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="score">The <see cref="ScoreInfo"/> to add.</param>
|
/// <param name="score">The <see cref="ScoreInfo"/> to add.</param>
|
||||||
public ScorePanel AddScore(ScoreInfo score)
|
/// <param name="isNewLocalScore">Whether this is a score that has just been achieved locally. Controls whether flair is added to the display or not.</param>
|
||||||
|
public ScorePanel AddScore(ScoreInfo score, bool isNewLocalScore = false)
|
||||||
{
|
{
|
||||||
var panel = new ScorePanel(score)
|
var panel = new ScorePanel(score, isNewLocalScore)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
@ -117,8 +118,12 @@ namespace osu.Game.Screens.Ranking
|
|||||||
d.Origin = Anchor.Centre;
|
d.Origin = Anchor.Centre;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
if (IsLoaded)
|
||||||
|
{
|
||||||
if (SelectedScore.Value == score)
|
if (SelectedScore.Value == score)
|
||||||
selectedScoreChanged(new ValueChangedEvent<ScoreInfo>(SelectedScore.Value, SelectedScore.Value));
|
{
|
||||||
|
SelectedScore.TriggerChange();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// We want the scroll position to remain relative to the expanded panel. When a new panel is added after the expanded panel, nothing needs to be done.
|
// We want the scroll position to remain relative to the expanded panel. When a new panel is added after the expanded panel, nothing needs to be done.
|
||||||
@ -132,6 +137,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
scroll.InstantScrollTarget = (scroll.InstantScrollTarget ?? scroll.Target) + ScorePanel.CONTRACTED_WIDTH + panel_spacing;
|
scroll.InstantScrollTarget = (scroll.InstantScrollTarget ?? scroll.Target) + ScorePanel.CONTRACTED_WIDTH + panel_spacing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
@ -141,6 +147,9 @@ namespace osu.Game.Screens.Ranking
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="score">The <see cref="ScoreInfo"/> to present.</param>
|
/// <param name="score">The <see cref="ScoreInfo"/> to present.</param>
|
||||||
private void selectedScoreChanged(ValueChangedEvent<ScoreInfo> score)
|
private void selectedScoreChanged(ValueChangedEvent<ScoreInfo> score)
|
||||||
|
{
|
||||||
|
// avoid contracting panels unnecessarily when TriggerChange is fired manually.
|
||||||
|
if (score.OldValue != score.NewValue)
|
||||||
{
|
{
|
||||||
// Contract the old panel.
|
// Contract the old panel.
|
||||||
foreach (var t in flow.Where(t => t.Panel.Score == score.OldValue))
|
foreach (var t in flow.Where(t => t.Panel.Score == score.OldValue))
|
||||||
@ -148,6 +157,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
t.Panel.State = PanelState.Contracted;
|
t.Panel.State = PanelState.Contracted;
|
||||||
t.Margin = new MarginPadding();
|
t.Margin = new MarginPadding();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Find the panel corresponding to the new score.
|
// Find the panel corresponding to the new score.
|
||||||
var expandedTrackingComponent = flow.SingleOrDefault(t => t.Panel.Score == score.NewValue);
|
var expandedTrackingComponent = flow.SingleOrDefault(t => t.Panel.Score == score.NewValue);
|
||||||
@ -162,12 +172,16 @@ namespace osu.Game.Screens.Ranking
|
|||||||
expandedTrackingComponent.Margin = new MarginPadding { Horizontal = expanded_panel_spacing };
|
expandedTrackingComponent.Margin = new MarginPadding { Horizontal = expanded_panel_spacing };
|
||||||
expandedPanel.State = PanelState.Expanded;
|
expandedPanel.State = PanelState.Expanded;
|
||||||
|
|
||||||
|
// requires schedule after children to ensure the flow (and thus ScrollContainer's ScrollableExtent) has been updated.
|
||||||
|
ScheduleAfterChildren(() =>
|
||||||
|
{
|
||||||
// Scroll to the new panel. This is done manually since we need:
|
// Scroll to the new panel. This is done manually since we need:
|
||||||
// 1) To scroll after the scroll container's visible range is updated.
|
// 1) To scroll after the scroll container's visible range is updated.
|
||||||
// 2) To account for the centre anchor/origins of panels.
|
// 2) To account for the centre anchor/origins of panels.
|
||||||
// In the end, it's easier to compute the scroll position manually.
|
// In the end, it's easier to compute the scroll position manually.
|
||||||
float scrollOffset = flow.GetPanelIndex(expandedPanel.Score) * (ScorePanel.CONTRACTED_WIDTH + panel_spacing);
|
float scrollOffset = flow.GetPanelIndex(expandedPanel.Score) * (ScorePanel.CONTRACTED_WIDTH + panel_spacing);
|
||||||
scroll.ScrollTo(scrollOffset);
|
scroll.ScrollTo(scrollOffset);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
Reference in New Issue
Block a user