mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Hide status bar when Status is null
This commit is contained in:
parent
247d8e9b21
commit
2be1b00a76
@ -51,6 +51,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
AddStep(@"multiplaying", () => { flyte.Status.Value = new UserStatusMultiplayerGame(); });
|
||||
AddStep(@"modding", () => { flyte.Status.Value = new UserStatusModding(); });
|
||||
AddStep(@"offline", () => { flyte.Status.Value = new UserStatusOffline(); });
|
||||
AddStep(@"null status", () => { flyte.Status.Value = null; });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,10 +72,9 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
};
|
||||
break;
|
||||
case APIState.Online:
|
||||
UserPanel p;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
p = new UserPanel(api.LocalUser.Value)
|
||||
new UserPanel(api.LocalUser.Value)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
@ -86,7 +85,6 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
||||
Action = api.Logout
|
||||
}
|
||||
};
|
||||
p.Status.Value = new UserStatusOnline();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ namespace osu.Game.Users
|
||||
|
||||
private OsuColour colours;
|
||||
|
||||
private readonly Container statusBar;
|
||||
private readonly Box statusBg;
|
||||
private readonly OsuSpriteText statusMessage;
|
||||
|
||||
@ -30,7 +31,7 @@ namespace osu.Game.Users
|
||||
|
||||
public UserPanel(User user)
|
||||
{
|
||||
Height = height;
|
||||
Height = height - status_height;
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
EdgeEffect = new EdgeEffect
|
||||
@ -54,8 +55,9 @@ namespace osu.Game.Users
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = content_padding, Bottom = status_height + content_padding, Left = content_padding, Right = content_padding },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Top = content_padding, Left = content_padding, Right = content_padding },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new UpdateableAvatar
|
||||
@ -114,12 +116,12 @@ namespace osu.Game.Users
|
||||
},
|
||||
},
|
||||
},
|
||||
new Container
|
||||
statusBar = new Container
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = status_height,
|
||||
Alpha = 0f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
statusBg = new Box
|
||||
@ -174,6 +176,11 @@ namespace osu.Game.Users
|
||||
|
||||
private void displayStatus(UserStatus status)
|
||||
{
|
||||
statusBar.ResizeHeightTo(status == null ? 0f : status_height, 500, EasingTypes.OutQuint);
|
||||
statusBar.FadeTo(status == null ? 0f : 1f, 500, EasingTypes.OutQuint);
|
||||
ResizeHeightTo(status == null ? height - status_height : height, 500, EasingTypes.OutQuint);
|
||||
if (status == null) return;
|
||||
|
||||
statusBg.FadeColour(status.GetAppropriateColour(colours), 500, EasingTypes.OutQuint);
|
||||
statusMessage.Text = status.Message;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user