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

Remove a lot of customisation from Avatar (and add it in individual usages).

This commit is contained in:
Dean Herbert 2017-03-15 15:22:28 +09:00
parent 7bc0a1fdfe
commit 1ae4c2dfbb
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
3 changed files with 29 additions and 31 deletions

View File

@ -2,9 +2,13 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Users;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Overlays.Toolbar
{
@ -20,7 +24,20 @@ namespace osu.Game.Overlays.Toolbar
Add(new OpaqueBackground { Depth = 1 });
Flow.Add(avatar = new Avatar());
Flow.Add(avatar = new Avatar
{
Masking = true,
Size = new Vector2(32),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
CornerRadius = 4,
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Radius = 4,
Colour = Color4.Black.Opacity(0.1f),
}
});
}
[BackgroundDependencyLoader]

View File

@ -33,7 +33,7 @@ namespace osu.Game.Screens.Select.Leaderboards
};
private Box background;
private Container content, avatarContainer;
private Container content, avatar;
private DrawableRank scoreRank;
private OsuSpriteText nameLabel;
private GlowingSpriteText scoreLabel;
@ -63,13 +63,13 @@ namespace osu.Game.Screens.Select.Leaderboards
// TODO: This fade to 0.01 is hacky, find a better way
FadeTo(0.01f);
foreach (Drawable d in new Drawable[] { avatarContainer, nameLabel, scoreLabel, scoreRank, flagBadgeContainer, maxCombo, accuracy, modsContainer, })
foreach (Drawable d in new Drawable[] { avatar, nameLabel, scoreLabel, scoreRank, flagBadgeContainer, maxCombo, accuracy, modsContainer, })
{
d.FadeOut();
}
content.MoveToY(75);
avatarContainer.MoveToX(75);
avatar.MoveToX(75);
nameLabel.MoveToX(150);
Delay(index * 50);
@ -81,10 +81,10 @@ namespace osu.Game.Screens.Select.Leaderboards
Delay(100);
Schedule(() =>
{
avatarContainer.FadeIn(300, EasingTypes.OutQuint);
avatar.FadeIn(300, EasingTypes.OutQuint);
nameLabel.FadeIn(350, EasingTypes.OutQuint);
avatarContainer.MoveToX(0, 300, EasingTypes.OutQuint);
avatar.MoveToX(0, 300, EasingTypes.OutQuint);
nameLabel.MoveToX(0, 350, EasingTypes.OutQuint);
Delay(250);
@ -165,21 +165,13 @@ namespace osu.Game.Screens.Select.Leaderboards
Padding = new MarginPadding(edge_margin),
Children = new Drawable[]
{
avatarContainer = new Container
avatar = new Avatar
{
Size = new Vector2(height - edge_margin * 2, height - edge_margin * 2),
CornerRadius = corner_radius,
Masking = true,
EdgeEffect = imageShadow,
Children = new Drawable[]
{
new Avatar
{
RelativeSizeAxes = Axes.Both,
UserId = Score.User.Id,
Masking = false,
},
},
UserId = Score.User?.Id ?? Score.UserID,
},
new Container
{

View File

@ -21,22 +21,11 @@ namespace osu.Game.Users
private OsuGame game;
private Texture guestTexture;
public Avatar()
[BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuGameBase game, TextureStore textures)
{
Size = new Vector2(32);
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
CornerRadius = Size.X / 8;
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Radius = 4,
Colour = Color4.Black.Opacity(0.1f),
};
Masking = true;
this.game = game;
guestTexture = textures.Get(@"Online/avatar-guest");
}
[BackgroundDependencyLoader(permitNulls: true)]