Enter animation, remove testing mod icons

This commit is contained in:
DrabWeb
2017-03-04 05:01:55 -04:00
parent d6f53c8b77
commit d1bad34434
3 changed files with 35 additions and 16 deletions

View File

@ -36,12 +36,12 @@ namespace osu.Desktop.VisualTests
{ {
scores.Add(new LeaderboardScore scores.Add(new LeaderboardScore
{ {
Name = @"ultralaserxx",
Avatar = ts.Get(@"Online/avatar-guest"), Avatar = ts.Get(@"Online/avatar-guest"),
Flag = ts.Get(@"Flags/__"), Flag = ts.Get(@"Flags/__"),
Name = @"ultralaserxx",
MaxCombo = RNG.Next(0, 3000),
Accuracy = Math.Round(RNG.NextDouble(0, 100), 2),
Score = RNG.Next(0, 1000000), Score = RNG.Next(0, 1000000),
Accuracy = Math.Round(RNG.NextDouble(0, 100), 2),
MaxCombo = RNG.Next(0, 3000),
Mods = new Mod[] { }, Mods = new Mod[] { },
}); });
} }

View File

@ -20,6 +20,7 @@ namespace osu.Game.Screens.Select.Leaderboards
get { return scores; } get { return scores; }
set set
{ {
if (value == scores) return;
scores = value; scores = value;
var scoreDisplays = new List<LeaderboardScoreDisplay>(); var scoreDisplays = new List<LeaderboardScoreDisplay>();
@ -56,13 +57,13 @@ namespace osu.Game.Screens.Select.Leaderboards
public class LeaderboardScore public class LeaderboardScore
{ {
public string Name;
public Texture Avatar; public Texture Avatar;
public Texture Flag; public Texture Flag;
public Texture Badge; public Texture Badge;
public string Name;
public int MaxCombo;
public double Accuracy;
public int Score; public int Score;
public double Accuracy;
public int MaxCombo;
public IEnumerable<Mod> Mods; public IEnumerable<Mod> Mods;
} }
} }

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms; using osu.Framework.Graphics.Transforms;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Modes;
namespace osu.Game.Screens.Select.Leaderboards namespace osu.Game.Screens.Select.Leaderboards
{ {
@ -22,7 +23,10 @@ namespace osu.Game.Screens.Select.Leaderboards
private const float score_letter_size = 20f; private const float score_letter_size = 20f;
private Box background; private Box background;
private Container content;
private FillFlowContainer<ScoreModIcon> modsContainer;
private readonly int index;
public readonly LeaderboardScore Score; public readonly LeaderboardScore Score;
protected override bool OnHover(Framework.Input.InputState state) protected override bool OnHover(Framework.Input.InputState state)
@ -37,9 +41,24 @@ namespace osu.Game.Screens.Select.Leaderboards
base.OnHoverLost(state); base.OnHoverLost(state);
} }
public LeaderboardScoreDisplay(LeaderboardScore score, int index) protected override void LoadComplete()
{
base.LoadComplete();
FadeTo(0.01f); // TODO: This is hacky, find a better way
Delay(index * 50);
Schedule(() =>
{
FadeInFromZero(200);
content.MoveToX(DrawSize.X);
content.MoveToX(0, 500, EasingTypes.OutQuint);
});
}
public LeaderboardScoreDisplay(LeaderboardScore score, int i)
{ {
Score = score; Score = score;
index = i;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = height; Height = height;
@ -62,7 +81,7 @@ namespace osu.Game.Screens.Select.Leaderboards
}, },
}, },
}, },
new Container content = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = 40, }, Padding = new MarginPadding { Left = 40, },
@ -180,7 +199,7 @@ namespace osu.Game.Screens.Select.Leaderboards
Text = Score.Score.ToString(), Text = Score.Score.ToString(),
TextSize = 23, TextSize = 23,
}, },
new FillFlowContainer modsContainer = new FillFlowContainer<ScoreModIcon>
{ {
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight, Origin = Anchor.BottomRight,
@ -188,19 +207,18 @@ namespace osu.Game.Screens.Select.Leaderboards
// TODO: Probably remove? Seems like others don't like this kind of thing // TODO: Probably remove? Seems like others don't like this kind of thing
Position = new Vector2(0f, 4f), //properly align the mod icons Position = new Vector2(0f, 4f), //properly align the mod icons
Direction = FillDirection.Left, Direction = FillDirection.Left,
Children = new[]
{
new ScoreModIcon(FontAwesome.fa_osu_mod_doubletime, OsuColour.FromHex(@"ffcc22")),
new ScoreModIcon(FontAwesome.fa_osu_mod_flashlight, OsuColour.FromHex(@"ffcc22")),
new ScoreModIcon(FontAwesome.fa_osu_mod_hidden, OsuColour.FromHex(@"ffcc22")),
new ScoreModIcon(FontAwesome.fa_osu_mod_hardrock, OsuColour.FromHex(@"ffcc22")),
},
}, },
}, },
}, },
}, },
}, },
}; };
foreach (Mod mod in Score.Mods)
{
// TODO: Get actual mod colours
modsContainer.Add(new ScoreModIcon(mod.Icon, OsuColour.FromHex(@"ffcc22")));
}
} }
class ScoreModIcon : Container class ScoreModIcon : Container