mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Refactor everything so I can read the code
This commit is contained in:
@ -13,17 +13,17 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public class ExpandingBar : Circle
|
||||
{
|
||||
private bool isCollapsed;
|
||||
private bool expanded = true;
|
||||
|
||||
public bool IsCollapsed
|
||||
public bool Expanded
|
||||
{
|
||||
get => isCollapsed;
|
||||
get => expanded;
|
||||
set
|
||||
{
|
||||
if (value == isCollapsed)
|
||||
if (value == expanded)
|
||||
return;
|
||||
|
||||
isCollapsed = value;
|
||||
expanded = value;
|
||||
updateState();
|
||||
}
|
||||
}
|
||||
@ -83,19 +83,21 @@ namespace osu.Game.Graphics.UserInterface
|
||||
updateState();
|
||||
}
|
||||
|
||||
public void Collapse() => IsCollapsed = true;
|
||||
public void Collapse() => Expanded = false;
|
||||
|
||||
public void Expand() => IsCollapsed = false;
|
||||
public void Expand() => Expanded = true;
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
float newSize = IsCollapsed ? CollapsedSize : ExpandedSize;
|
||||
Easing easingType = IsCollapsed ? Easing.Out : Easing.OutElastic;
|
||||
float newSize = expanded ? ExpandedSize : CollapsedSize;
|
||||
Easing easingType = expanded ? Easing.OutElastic : Easing.Out;
|
||||
|
||||
if (RelativeSizeAxes == Axes.X)
|
||||
this.ResizeHeightTo(newSize, 400, easingType);
|
||||
else
|
||||
this.ResizeWidthTo(newSize, 400, easingType);
|
||||
|
||||
this.FadeTo(expanded ? 1 : 0.5f, 100, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user