Make Avatar accept a user.

Add UpdateableAvatar to handle the toolbar use-case.
This commit is contained in:
Dean Herbert
2017-03-28 00:04:51 +09:00
parent 039f4a65dc
commit 13272e6995
5 changed files with 87 additions and 71 deletions

View File

@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Toolbar
{
internal class ToolbarUserButton : ToolbarButton, IOnlineComponent
{
private readonly Avatar avatar;
private readonly UpdateableAvatar avatar;
public ToolbarUserButton()
{
@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Toolbar
Add(new OpaqueBackground { Depth = 1 });
Flow.Add(avatar = new Avatar
Flow.Add(avatar = new UpdateableAvatar
{
Masking = true,
Size = new Vector2(32),
@ -52,11 +52,11 @@ namespace osu.Game.Overlays.Toolbar
{
default:
Text = @"Guest";
avatar.UserId = 1;
avatar.User = new User();
break;
case APIState.Online:
Text = api.Username;
avatar.UserId = api.LocalUser.Value.Id;
avatar.User = api.LocalUser;
break;
}
}