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 @@ private void newScores()
{
scores.Add(new LeaderboardScore
{
Name = @"ultralaserxx",
Avatar = ts.Get(@"Online/avatar-guest"),
Flag = ts.Get(@"Flags/__"),
Name = @"ultralaserxx",
MaxCombo = RNG.Next(0, 3000),
Accuracy = Math.Round(RNG.NextDouble(0, 100), 2),
Score = RNG.Next(0, 1000000),
Accuracy = Math.Round(RNG.NextDouble(0, 100), 2),
MaxCombo = RNG.Next(0, 3000),
Mods = new Mod[] { },
});
}

View File

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

View File

@ -10,6 +10,7 @@
using osu.Framework.Graphics.Transforms;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Modes;
namespace osu.Game.Screens.Select.Leaderboards
{
@ -22,7 +23,10 @@ public class LeaderboardScoreDisplay : Container
private const float score_letter_size = 20f;
private Box background;
private Container content;
private FillFlowContainer<ScoreModIcon> modsContainer;
private readonly int index;
public readonly LeaderboardScore Score;
protected override bool OnHover(Framework.Input.InputState state)
@ -37,9 +41,24 @@ protected override void OnHoverLost(Framework.Input.InputState 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;
index = i;
RelativeSizeAxes = Axes.X;
Height = height;
@ -62,7 +81,7 @@ public LeaderboardScoreDisplay(LeaderboardScore score, int index)
},
},
},
new Container
content = new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Left = 40, },
@ -180,7 +199,7 @@ public LeaderboardScoreDisplay(LeaderboardScore score, int index)
Text = Score.Score.ToString(),
TextSize = 23,
},
new FillFlowContainer
modsContainer = new FillFlowContainer<ScoreModIcon>
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
@ -188,19 +207,18 @@ public LeaderboardScoreDisplay(LeaderboardScore score, int index)
// TODO: Probably remove? Seems like others don't like this kind of thing
Position = new Vector2(0f, 4f), //properly align the mod icons
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