Changed animation to match the one in Comp3 6c(will probably clean later), changed avatar sprite to a toolbar avatar(doesn't load in visual test since there's no OsuGame), removed random test case data, now static

This commit is contained in:
DrabWeb 2017-03-13 12:31:46 -03:00
parent 442a2c97db
commit 8e90e05f23
3 changed files with 240 additions and 49 deletions

View File

@ -5,15 +5,13 @@ using OpenTK;
using System; using System;
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens.Testing; using osu.Framework.Screens.Testing;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Framework.Allocation;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Screens.Select.Leaderboards; using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Modes; using osu.Game.Modes;
using osu.Game.Users; using osu.Game.Users;
using osu.Game.Modes.Osu;
namespace osu.Desktop.VisualTests namespace osu.Desktop.VisualTests
{ {
@ -25,30 +23,181 @@ namespace osu.Desktop.VisualTests
private void newScores() private void newScores()
{ {
var scores = new List<Score>(); var scores = new[]
for (int i = 0; i < 10; i++)
{ {
scores.Add(new Score new Score
{ {
Accuracy = Math.Round(RNG.NextDouble(0, 100), 2), Accuracy = 100,
MaxCombo = RNG.Next(0, 3000), MaxCombo = 244,
TotalScore = RNG.Next(1, 1000000), TotalScore = 1707827,
Mods = Ruleset.GetRuleset(PlayMode.Osu).GetModsFor(ModType.DifficultyIncrease).ToArray(), Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new Game.Users.User User = new User
{ {
Id = 2, Id = 6602580,
Username = @"peppy", Username = @"waaiiru",
Region = new Region Region = new Region
{ {
FullName = @"Australia", FullName = @"Spain",
Acronym = @"AUS", FlagName = @"ES",
FlagName = @"AU",
}, },
}, },
}); },
} new Score
{
Accuracy = 100,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 4608074,
Username = @"Skycries",
Region = new Region
{
FullName = @"Brazil",
FlagName = @"BR",
},
},
},
new Score
{
Accuracy = 100,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 1014222,
Username = @"eLy",
Region = new Region
{
FullName = @"Japan",
FlagName = @"JP",
},
},
},
new Score
{
Accuracy = 100,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 1541390,
Username = @"Toukai",
Region = new Region
{
FullName = @"Canada",
FlagName = @"CA",
},
},
},
new Score
{
Accuracy = 100,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 2243452,
Username = @"Satoruu",
Region = new Region
{
FullName = @"Venezuela",
FlagName = @"VE",
},
},
},
new Score
{
Accuracy = 100,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 2705430,
Username = @"Mooha",
Region = new Region
{
FullName = @"France",
FlagName = @"FR",
},
},
},
new Score
{
Accuracy = 100,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 7151382,
Username = @"Mayuri Hana",
Region = new Region
{
FullName = @"Thailand",
FlagName = @"TH",
},
},
},
new Score
{
Accuracy = 100,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 2051389,
Username = @"FunOrange",
Region = new Region
{
FullName = @"Canada",
FlagName = @"CA",
},
},
},
new Score
{
Accuracy = 100,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 6169483,
Username = @"-Hebel-",
Region = new Region
{
FullName = @"Mexico",
FlagName = @"MX",
},
},
},
new Score
{
Accuracy = 100,
MaxCombo = 244,
TotalScore = 1707827,
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
User = new User
{
Id = 6702666,
Username = @"prhtnsm",
Region = new Region
{
FullName = @"Germany",
FlagName = @"DE",
},
},
},
};
leaderboard.Scores = scores.ToArray(); leaderboard.Scores = scores;
} }
public override void Reset() public override void Reset()

View File

@ -76,7 +76,7 @@ namespace osu.Game.Overlays.Toolbar
Masking = true; Masking = true;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader(permitNulls:true)]
private void load(OsuGame game, TextureStore textures) private void load(OsuGame game, TextureStore textures)
{ {
this.game = game; this.game = game;
@ -98,18 +98,21 @@ namespace osu.Game.Overlays.Toolbar
newSprite.FillMode = FillMode.Fit; newSprite.FillMode = FillMode.Fit;
newSprite.LoadAsync(game, s => if (game != null)
{ {
Sprite?.FadeOut(); newSprite.LoadAsync(game, s =>
Sprite?.Expire(); {
Sprite = s; Sprite?.FadeOut();
Sprite?.Expire();
Sprite = s;
Add(s); Add(s);
//todo: fix this... clock dependencies are a pain //todo: fix this... clock dependencies are a pain
if (s.Clock != null) if (s.Clock != null)
s.FadeInFromZero(200); s.FadeInFromZero(200);
}); });
}
} }
} }

View File

@ -34,19 +34,17 @@ namespace osu.Game.Screens.Select.Leaderboards
}; };
private Box background; private Box background;
private Container content; private Container content, avatarContainer;
private Sprite avatar; private Sprite scoreLetter;
private OsuSpriteText nameLabel;
private GlowingSpriteText scoreLabel;
private ScoreComponentLabel maxCombo, accuracy;
private Container flagBadgeContainer;
private FillFlowContainer<ScoreModIcon> modsContainer; private FillFlowContainer<ScoreModIcon> modsContainer;
private readonly int index; private readonly int index;
public readonly Score Score; public readonly Score Score;
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
avatar.Texture = textures.Get($@"https://a.ppy.sh/{Score.User.Id}") ?? textures.Get(@"Online/avatar-guest");
}
protected override bool OnHover(Framework.Input.InputState state) protected override bool OnHover(Framework.Input.InputState state)
{ {
background.FadeTo(0.5f, 300, EasingTypes.OutQuint); background.FadeTo(0.5f, 300, EasingTypes.OutQuint);
@ -63,14 +61,51 @@ namespace osu.Game.Screens.Select.Leaderboards
{ {
base.LoadComplete(); base.LoadComplete();
// TODO: This is hacky, find a better way // TODO: This fade to 0.01 is hacky, find a better way
FadeTo(0.01f); FadeTo(0.01f);
content.MoveToX(DrawSize.X);
foreach (Drawable d in new Drawable[] { avatarContainer, nameLabel, scoreLabel, scoreLetter, flagBadgeContainer, maxCombo, accuracy, modsContainer, })
{
d.FadeOut();
}
content.MoveToY(75);
avatarContainer.MoveToX(75);
nameLabel.MoveToX(150);
Delay(index * 50); Delay(index * 50);
Schedule(() => Schedule(() =>
{ {
FadeInFromZero(200); FadeIn(200);
content.MoveToX(0, 500, EasingTypes.OutQuint); content.MoveToY(0, 400, EasingTypes.OutQuint);
Delay(100);
Schedule(() =>
{
avatarContainer.FadeIn(300, EasingTypes.OutQuint);
nameLabel.FadeIn(350, EasingTypes.OutQuint);
avatarContainer.MoveToX(0, 300, EasingTypes.OutQuint);
nameLabel.MoveToX(0, 350, EasingTypes.OutQuint);
Delay(250);
Schedule(() =>
{
scoreLabel.FadeIn(200);
scoreLetter.FadeIn(200);
Delay(50);
Schedule(() =>
{
var drawables = new Drawable[] { flagBadgeContainer, maxCombo, accuracy, modsContainer, };
for (int i = 0; i < drawables.Length; i++)
{
drawables[i].FadeIn(200 + (i * 50));
}
});
});
});
}); });
} }
@ -131,7 +166,7 @@ namespace osu.Game.Screens.Select.Leaderboards
Padding = new MarginPadding(edge_margin), Padding = new MarginPadding(edge_margin),
Children = new Drawable[] Children = new Drawable[]
{ {
new Container avatarContainer = new Container
{ {
Size = new Vector2(height - edge_margin * 2, height - edge_margin * 2), Size = new Vector2(height - edge_margin * 2, height - edge_margin * 2),
CornerRadius = corner_radius, CornerRadius = corner_radius,
@ -139,9 +174,11 @@ namespace osu.Game.Screens.Select.Leaderboards
EdgeEffect = imageShadow, EdgeEffect = imageShadow,
Children = new Drawable[] Children = new Drawable[]
{ {
avatar = new Sprite new Overlays.Toolbar.ToolbarUserButton.Avatar
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
UserId = Score.User.Id,
Masking = false,
}, },
}, },
}, },
@ -152,7 +189,7 @@ namespace osu.Game.Screens.Select.Leaderboards
Position = new Vector2(height - edge_margin, 0f), Position = new Vector2(height - edge_margin, 0f),
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuSpriteText nameLabel = new OsuSpriteText
{ {
Text = Score.User?.Username, Text = Score.User?.Username,
Font = @"Exo2.0-BoldItalic", Font = @"Exo2.0-BoldItalic",
@ -167,7 +204,7 @@ namespace osu.Game.Screens.Select.Leaderboards
Spacing = new Vector2(10f, 0f), Spacing = new Vector2(10f, 0f),
Children = new Drawable[] Children = new Drawable[]
{ {
new Container flagBadgeContainer = new Container
{ {
Size = new Vector2(87f, 20f), Size = new Vector2(87f, 20f),
Masking = true, Masking = true,
@ -184,21 +221,21 @@ namespace osu.Game.Screens.Select.Leaderboards
Margin = new MarginPadding { Left = 10, }, Margin = new MarginPadding { Left = 10, },
Children = new Drawable[] Children = new Drawable[]
{ {
new ScoreComponentLabel(FontAwesome.fa_circle_o, Score.MaxCombo.ToString()), maxCombo = new ScoreComponentLabel(FontAwesome.fa_circle_o, Score.MaxCombo.ToString()),
new ScoreComponentLabel(FontAwesome.fa_circle_o, Score.Accuracy.ToString()), accuracy = new ScoreComponentLabel(FontAwesome.fa_circle_o, Score.Accuracy.ToString()),
}, },
}, },
}, },
}, },
}, },
}, },
new Sprite scoreLetter = new Sprite
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Size = new Vector2(score_letter_size), Size = new Vector2(score_letter_size),
}, },
new GlowingSpriteText(string.Format("{0:n0}", Score.TotalScore), @"Venera", 23, Color4.White, OsuColour.FromHex(@"83ccfa")) scoreLabel = new GlowingSpriteText(string.Format("{0:n0}", Score.TotalScore), @"Venera", 23, Color4.White, OsuColour.FromHex(@"83ccfa"))
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
@ -313,6 +350,7 @@ namespace osu.Game.Screens.Select.Leaderboards
{ {
new TextAwesome new TextAwesome
{ {
Origin = Anchor.Centre,
Icon = FontAwesome.fa_square, Icon = FontAwesome.fa_square,
Colour = OsuColour.FromHex(@"3087ac"), Colour = OsuColour.FromHex(@"3087ac"),
Rotation = 45, Rotation = 45,
@ -320,6 +358,7 @@ namespace osu.Game.Screens.Select.Leaderboards
}, },
new TextAwesome new TextAwesome
{ {
Origin = Anchor.Centre,
Icon = icon, Icon = icon,
Colour = OsuColour.FromHex(@"a4edff"), Colour = OsuColour.FromHex(@"a4edff"),
Scale = new Vector2(0.8f), Scale = new Vector2(0.8f),