mirror of
https://github.com/osukey/osukey.git
synced 2025-06-23 12:18:03 +09:00
Improve results screen behaviour when changing selected score
This commit is contained in:
parent
ad99d85468
commit
47d5974f04
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
@ -13,6 +14,8 @@ namespace osu.Game.Screens.Ranking
|
|||||||
{
|
{
|
||||||
public class ReplayDownloadButton : DownloadTrackingComposite<ScoreInfo, ScoreManager>
|
public class ReplayDownloadButton : DownloadTrackingComposite<ScoreInfo, ScoreManager>
|
||||||
{
|
{
|
||||||
|
public Bindable<ScoreInfo> Score => Model;
|
||||||
|
|
||||||
private DownloadButton button;
|
private DownloadButton button;
|
||||||
private ShakeContainer shakeContainer;
|
private ShakeContainer shakeContainer;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -30,16 +31,17 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||||
|
|
||||||
|
public readonly Bindable<ScoreInfo> SelectedScore = new Bindable<ScoreInfo>();
|
||||||
|
|
||||||
|
public readonly ScoreInfo Score;
|
||||||
|
private readonly bool allowRetry;
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private Player player { get; set; }
|
private Player player { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; }
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
public readonly ScoreInfo Score;
|
|
||||||
|
|
||||||
private readonly bool allowRetry;
|
|
||||||
|
|
||||||
private Drawable bottomPanel;
|
private Drawable bottomPanel;
|
||||||
private ScorePanelList panels;
|
private ScorePanelList panels;
|
||||||
|
|
||||||
@ -47,6 +49,8 @@ namespace osu.Game.Screens.Ranking
|
|||||||
{
|
{
|
||||||
Score = score;
|
Score = score;
|
||||||
this.allowRetry = allowRetry;
|
this.allowRetry = allowRetry;
|
||||||
|
|
||||||
|
SelectedScore.Value = score;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -66,7 +70,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
Child = panels = new ScorePanelList
|
Child = panels = new ScorePanelList
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
SelectedScore = { Value = Score }
|
SelectedScore = { BindTarget = SelectedScore }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -95,7 +99,11 @@ namespace osu.Game.Screens.Ranking
|
|||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new ReplayDownloadButton(Score) { Width = 300 },
|
new ReplayDownloadButton(null)
|
||||||
|
{
|
||||||
|
Score = { BindTarget = SelectedScore },
|
||||||
|
Width = 300
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -109,6 +117,9 @@ namespace osu.Game.Screens.Ranking
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (Score != null)
|
||||||
|
panels.AddScore(Score);
|
||||||
|
|
||||||
if (player != null && allowRetry)
|
if (player != null && allowRetry)
|
||||||
{
|
{
|
||||||
buttons.Add(new RetryButton { Width = 300 });
|
buttons.Add(new RetryButton { Width = 300 });
|
||||||
@ -132,12 +143,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
var req = FetchScores(scores => Schedule(() =>
|
var req = FetchScores(scores => Schedule(() =>
|
||||||
{
|
{
|
||||||
foreach (var s in scores)
|
foreach (var s in scores)
|
||||||
{
|
|
||||||
if (s.OnlineScoreID == Score.OnlineScoreID)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
panels.AddScore(s);
|
panels.AddScore(s);
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (req != null)
|
if (req != null)
|
||||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
|
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
|
||||||
{
|
{
|
||||||
var req = new GetScoresRequest(Score.Beatmap, Score.Ruleset);
|
var req = new GetScoresRequest(Score.Beatmap, Score.Ruleset);
|
||||||
req.Success += r => scoresCallback?.Invoke(r.Scores.Select(s => s.CreateScoreInfo(rulesets)));
|
req.Success += r => scoresCallback?.Invoke(r.Scores.Where(s => s.OnlineScoreID != Score.OnlineScoreID).Select(s => s.CreateScoreInfo(rulesets)));
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user