Show extended statistics in multiplayer spectator automatically

This commit is contained in:
Dean Herbert 2023-08-01 19:00:01 +09:00
parent 52730f7cd6
commit df504e1fc2
2 changed files with 16 additions and 8 deletions

View File

@ -18,6 +18,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
{ {
} }
protected override void LoadComplete()
{
base.LoadComplete();
Scheduler.AddDelayed(() => StatisticsPanel.ToggleVisibility(), 1000);
}
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback) => null; protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback) => null;
protected override APIRequest FetchNextPage(int direction, Action<IEnumerable<ScoreInfo>> scoresCallback) => null; protected override APIRequest FetchNextPage(int direction, Action<IEnumerable<ScoreInfo>> scoresCallback) => null;

View File

@ -55,7 +55,8 @@ namespace osu.Game.Screens.Ranking
[Resolved] [Resolved]
private IAPIProvider api { get; set; } private IAPIProvider api { get; set; }
private StatisticsPanel statisticsPanel; protected StatisticsPanel StatisticsPanel;
private Drawable bottomPanel; private Drawable bottomPanel;
private Container<ScorePanel> detachedPanelContainer; private Container<ScorePanel> detachedPanelContainer;
@ -98,7 +99,7 @@ namespace osu.Game.Screens.Ranking
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
statisticsPanel = CreateStatisticsPanel().With(panel => StatisticsPanel = CreateStatisticsPanel().With(panel =>
{ {
panel.RelativeSizeAxes = Axes.Both; panel.RelativeSizeAxes = Axes.Both;
panel.Score.BindTarget = SelectedScore; panel.Score.BindTarget = SelectedScore;
@ -107,7 +108,7 @@ namespace osu.Game.Screens.Ranking
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
SelectedScore = { BindTarget = SelectedScore }, SelectedScore = { BindTarget = SelectedScore },
PostExpandAction = () => statisticsPanel.ToggleVisibility() PostExpandAction = () => StatisticsPanel.ToggleVisibility()
}, },
detachedPanelContainer = new Container<ScorePanel> detachedPanelContainer = new Container<ScorePanel>
{ {
@ -194,7 +195,7 @@ namespace osu.Game.Screens.Ranking
if (req != null) if (req != null)
api.Queue(req); api.Queue(req);
statisticsPanel.State.BindValueChanged(onStatisticsStateChanged, true); StatisticsPanel.State.BindValueChanged(onStatisticsStateChanged, true);
} }
protected override void Update() protected override void Update()
@ -234,7 +235,7 @@ namespace osu.Game.Screens.Ranking
protected virtual APIRequest FetchNextPage(int direction, Action<IEnumerable<ScoreInfo>> scoresCallback) => null; protected virtual APIRequest FetchNextPage(int direction, Action<IEnumerable<ScoreInfo>> scoresCallback) => null;
/// <summary> /// <summary>
/// Creates the <see cref="StatisticsPanel"/> to be used to display extended information about scores. /// Creates the <see cref="Statistics.StatisticsPanel"/> to be used to display extended information about scores.
/// </summary> /// </summary>
protected virtual StatisticsPanel CreateStatisticsPanel() => new StatisticsPanel(); protected virtual StatisticsPanel CreateStatisticsPanel() => new StatisticsPanel();
@ -272,9 +273,9 @@ namespace osu.Game.Screens.Ranking
public override bool OnBackButton() public override bool OnBackButton()
{ {
if (statisticsPanel.State.Value == Visibility.Visible) if (StatisticsPanel.State.Value == Visibility.Visible)
{ {
statisticsPanel.Hide(); StatisticsPanel.Hide();
return true; return true;
} }
@ -353,7 +354,7 @@ namespace osu.Game.Screens.Ranking
switch (e.Action) switch (e.Action)
{ {
case GlobalAction.Select: case GlobalAction.Select:
statisticsPanel.ToggleVisibility(); StatisticsPanel.ToggleVisibility();
return true; return true;
} }