mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 21:02:55 +08:00
Move hierarchy init to load and remove unnecessary field storage
This commit is contained in:
parent
670d6d8719
commit
4af390a168
@ -102,8 +102,6 @@ namespace osu.Game.Overlays.Dashboard
|
||||
{
|
||||
public readonly User User;
|
||||
|
||||
private readonly PurpleTriangleButton watchButton;
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private OsuGame game { get; set; }
|
||||
|
||||
@ -112,7 +110,11 @@ namespace osu.Game.Overlays.Dashboard
|
||||
User = user;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IAPIProvider api)
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
@ -123,30 +125,25 @@ namespace osu.Game.Overlays.Dashboard
|
||||
Width = 290,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new UserGridPanel(user)
|
||||
new UserGridPanel(User)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
watchButton = new PurpleTriangleButton
|
||||
new PurpleTriangleButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Watch",
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Action = () => game?.PerformFromScreen(s => s.Push(new Spectator(user)))
|
||||
Action = () => game?.PerformFromScreen(s => s.Push(new Spectator(User))),
|
||||
Enabled = { Value = User.Id != api.LocalUser.Value.Id }
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IAPIProvider api)
|
||||
{
|
||||
watchButton.Enabled.Value = User.Id != api.LocalUser.Value.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user