mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 02:42:54 +08:00
Remove a lot of customisation from Avatar (and add it in individual usages).
This commit is contained in:
parent
7bc0a1fdfe
commit
1ae4c2dfbb
@ -2,9 +2,13 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
@ -20,7 +24,20 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
Add(new OpaqueBackground { Depth = 1 });
|
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]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
};
|
};
|
||||||
|
|
||||||
private Box background;
|
private Box background;
|
||||||
private Container content, avatarContainer;
|
private Container content, avatar;
|
||||||
private DrawableRank scoreRank;
|
private DrawableRank scoreRank;
|
||||||
private OsuSpriteText nameLabel;
|
private OsuSpriteText nameLabel;
|
||||||
private GlowingSpriteText scoreLabel;
|
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
|
// TODO: This fade to 0.01 is hacky, find a better way
|
||||||
FadeTo(0.01f);
|
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();
|
d.FadeOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
content.MoveToY(75);
|
content.MoveToY(75);
|
||||||
avatarContainer.MoveToX(75);
|
avatar.MoveToX(75);
|
||||||
nameLabel.MoveToX(150);
|
nameLabel.MoveToX(150);
|
||||||
|
|
||||||
Delay(index * 50);
|
Delay(index * 50);
|
||||||
@ -81,10 +81,10 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
Delay(100);
|
Delay(100);
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
avatarContainer.FadeIn(300, EasingTypes.OutQuint);
|
avatar.FadeIn(300, EasingTypes.OutQuint);
|
||||||
nameLabel.FadeIn(350, 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);
|
nameLabel.MoveToX(0, 350, EasingTypes.OutQuint);
|
||||||
|
|
||||||
Delay(250);
|
Delay(250);
|
||||||
@ -165,21 +165,13 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
Padding = new MarginPadding(edge_margin),
|
Padding = new MarginPadding(edge_margin),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
avatarContainer = new Container
|
avatar = new Avatar
|
||||||
{
|
{
|
||||||
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,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
EdgeEffect = imageShadow,
|
EdgeEffect = imageShadow,
|
||||||
Children = new Drawable[]
|
UserId = Score.User?.Id ?? Score.UserID,
|
||||||
{
|
|
||||||
new Avatar
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
UserId = Score.User.Id,
|
|
||||||
Masking = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
|
@ -21,22 +21,11 @@ namespace osu.Game.Users
|
|||||||
private OsuGame game;
|
private OsuGame game;
|
||||||
private Texture guestTexture;
|
private Texture guestTexture;
|
||||||
|
|
||||||
public Avatar()
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
|
private void load(OsuGameBase game, TextureStore textures)
|
||||||
{
|
{
|
||||||
Size = new Vector2(32);
|
this.game = game;
|
||||||
Anchor = Anchor.CentreLeft;
|
guestTexture = textures.Get(@"Online/avatar-guest");
|
||||||
Origin = Anchor.CentreLeft;
|
|
||||||
|
|
||||||
CornerRadius = Size.X / 8;
|
|
||||||
|
|
||||||
EdgeEffect = new EdgeEffect
|
|
||||||
{
|
|
||||||
Type = EdgeEffectType.Shadow,
|
|
||||||
Radius = 4,
|
|
||||||
Colour = Color4.Black.Opacity(0.1f),
|
|
||||||
};
|
|
||||||
|
|
||||||
Masking = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
|
Loading…
Reference in New Issue
Block a user