mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:52:53 +08:00
Highlight own score in BeatmapSetOverlay (#7093)
Highlight own score in BeatmapSetOverlay Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
d2d1c03af5
@ -63,7 +63,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
return;
|
||||
|
||||
for (int i = 0; i < value.Count; i++)
|
||||
backgroundFlow.Add(new ScoreTableRowBackground(i));
|
||||
backgroundFlow.Add(new ScoreTableRowBackground(i, value[i]));
|
||||
|
||||
Columns = createHeaders(value[0]);
|
||||
Content = value.Select((s, i) => createContent(i, s)).ToArray().ToRectangular();
|
||||
|
@ -7,6 +7,8 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
{
|
||||
@ -17,8 +19,14 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
private readonly Box hoveredBackground;
|
||||
private readonly Box background;
|
||||
|
||||
public ScoreTableRowBackground(int index)
|
||||
private readonly int index;
|
||||
private readonly ScoreInfo score;
|
||||
|
||||
public ScoreTableRowBackground(int index, ScoreInfo score)
|
||||
{
|
||||
this.index = index;
|
||||
this.score = score;
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 25;
|
||||
|
||||
@ -37,16 +45,21 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
Alpha = 0,
|
||||
},
|
||||
};
|
||||
|
||||
if (index % 2 != 0)
|
||||
background.Alpha = 0;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OsuColour colours, IAPIProvider api)
|
||||
{
|
||||
hoveredBackground.Colour = colours.Gray4;
|
||||
background.Colour = colours.Gray3;
|
||||
var isOwnScore = api.LocalUser.Value.Id == score.UserID;
|
||||
|
||||
if (isOwnScore)
|
||||
background.Colour = colours.GreenDarker;
|
||||
else if (index % 2 == 0)
|
||||
background.Colour = colours.Gray3;
|
||||
else
|
||||
background.Alpha = 0;
|
||||
|
||||
hoveredBackground.Colour = isOwnScore ? colours.GreenDark : colours.Gray4;
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
|
Loading…
Reference in New Issue
Block a user