mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 09:57:21 +09:00
Clean up selection box construction
This commit is contained in:
parent
1a832a4e6b
commit
c50e3fd317
@ -38,7 +38,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
|
|
||||||
public event Action<SelectionState> StateChanged;
|
public event Action<SelectionState> StateChanged;
|
||||||
|
|
||||||
private readonly Box selectionBox;
|
private Box selectionBox;
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private OnlinePlayScreen parentScreen { get; set; }
|
private OnlinePlayScreen parentScreen { get; set; }
|
||||||
@ -55,14 +55,18 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
get => state;
|
get => state;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == state) return;
|
if (value == state)
|
||||||
|
return;
|
||||||
|
|
||||||
state = value;
|
state = value;
|
||||||
|
|
||||||
if (state == SelectionState.Selected)
|
if (selectionBox != null)
|
||||||
selectionBox.FadeIn(transition_duration);
|
{
|
||||||
else
|
if (state == SelectionState.Selected)
|
||||||
selectionBox.FadeOut(transition_duration);
|
selectionBox.FadeIn(transition_duration);
|
||||||
|
else
|
||||||
|
selectionBox.FadeOut(transition_duration);
|
||||||
|
}
|
||||||
|
|
||||||
StateChanged?.Invoke(State);
|
StateChanged?.Invoke(State);
|
||||||
}
|
}
|
||||||
@ -99,13 +103,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
Height = height + SELECTION_BORDER_WIDTH * 2;
|
Height = height + SELECTION_BORDER_WIDTH * 2;
|
||||||
CornerRadius = corner_radius + SELECTION_BORDER_WIDTH / 2;
|
CornerRadius = corner_radius + SELECTION_BORDER_WIDTH / 2;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
|
|
||||||
// create selectionBox here so State can be set before being loaded
|
|
||||||
selectionBox = new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Alpha = 0f,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -118,7 +115,11 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
new StatusColouredContainer(transition_duration)
|
new StatusColouredContainer(transition_duration)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = selectionBox
|
Child = selectionBox = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Alpha = state == SelectionState.Selected ? 1 : 0,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user