1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:52:54 +08:00

Fix score table using 300/100/50

This commit is contained in:
smoogipoo 2019-04-03 16:09:19 +09:00
parent d6b15f040a
commit 2c18b6df1c
6 changed files with 41 additions and 49 deletions

View File

@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.SongSelect
}
};
IEnumerable<ScoreInfo> scores = new[]
var scores = new List<ScoreInfo>
{
new ScoreInfo
{

View File

@ -9,6 +9,6 @@ namespace osu.Game.Online.API.Requests.Responses
public class APILegacyScores
{
[JsonProperty(@"scores")]
public IEnumerable<APILegacyScoreInfo> Scores;
public List<APILegacyScoreInfo> Scores;
}
}

View File

@ -48,24 +48,27 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
};
}
public IEnumerable<ScoreInfo> Scores
public IReadOnlyList<ScoreInfo> Scores
{
set
{
if (value == null || !value.Any())
return;
var content = new List<Drawable[]> { new ScoreTableHeaderRow().CreateDrawables().ToArray() };
int index = 0;
foreach (var s in value)
content.Add(new ScoreTableScoreRow(index++, s).CreateDrawables().ToArray());
scoresGrid.Content = content.ToArray();
var content = new List<Drawable[]>
{
new ScoreTableHeaderRow(value.First()).CreateDrawables().ToArray()
};
backgroundFlow.Clear();
for (int i = 0; i < index; i++)
for (int i = 0; i < value.Count; i++)
{
content.Add(new ScoreTableScoreRow(i, value[i]).CreateDrawables().ToArray());
backgroundFlow.Add(new ScoreTableRowBackground(i));
}
scoresGrid.Content = content.ToArray();
}
}

View File

@ -2,15 +2,24 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Scoring;
namespace osu.Game.Overlays.BeatmapSet.Scores
{
public class ScoreTableHeaderRow : ScoreTableRow
{
private readonly ScoreInfo score;
public ScoreTableHeaderRow(ScoreInfo score)
{
this.score = score;
}
protected override Drawable CreateIndexCell() => new CellText("rank");
protected override Drawable CreateRankCell() => new Container();
@ -21,14 +30,13 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
protected override Drawable CreatePlayerCell() => new CellText("player");
protected override IEnumerable<Drawable> CreateStatisticsCells() => new[]
protected override IEnumerable<Drawable> CreateStatisticsCells()
{
new CellText("max combo"),
new CellText("300"),
new CellText("100"),
new CellText("50"),
new CellText("miss"),
};
yield return new CellText("max combo");
foreach (var kvp in score.Statistics)
yield return new CellText(kvp.Key.GetDescription());
}
protected override Drawable CreatePpCell() => new CellText("pp");

View File

@ -10,7 +10,6 @@ using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Leaderboards;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Users;
@ -74,33 +73,15 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Font = OsuFont.GetFont(size: TEXT_SIZE)
};
yield return new OsuSpriteText
foreach (var kvp in score.Statistics)
{
Text = $"{score.Statistics[HitResult.Great]}",
Font = OsuFont.GetFont(size: TEXT_SIZE),
Colour = score.Statistics[HitResult.Great] == 0 ? Color4.Gray : Color4.White
};
yield return new OsuSpriteText
{
Text = $"{score.Statistics[HitResult.Good]}",
Font = OsuFont.GetFont(size: TEXT_SIZE),
Colour = score.Statistics[HitResult.Good] == 0 ? Color4.Gray : Color4.White
};
yield return new OsuSpriteText
{
Text = $"{score.Statistics[HitResult.Meh]}",
Font = OsuFont.GetFont(size: TEXT_SIZE),
Colour = score.Statistics[HitResult.Meh] == 0 ? Color4.Gray : Color4.White
};
yield return new OsuSpriteText
{
Text = $"{score.Statistics[HitResult.Miss]}",
Font = OsuFont.GetFont(size: TEXT_SIZE),
Colour = score.Statistics[HitResult.Miss] == 0 ? Color4.Gray : Color4.White
};
yield return new OsuSpriteText
{
Text = $"{kvp.Value}",
Font = OsuFont.GetFont(size: TEXT_SIZE),
Colour = kvp.Value == 0 ? Color4.Gray : Color4.White
};
}
}
protected override Drawable CreatePpCell() => new OsuSpriteText

View File

@ -83,9 +83,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
}
private GetScoresRequest getScoresRequest;
private IEnumerable<ScoreInfo> scores;
private IReadOnlyList<ScoreInfo> scores;
public IEnumerable<ScoreInfo> Scores
public IReadOnlyList<ScoreInfo> Scores
{
get => scores;
set
@ -121,11 +121,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private void updateDisplay()
{
scoreTable.Scores = Enumerable.Empty<ScoreInfo>();
scoreTable.Scores = new List<ScoreInfo>();
loading = false;
var scoreCount = scores?.Count() ?? 0;
var scoreCount = scores?.Count ?? 0;
if (scoreCount == 0)
{