mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 14:53:01 +08:00
Cleanup
This commit is contained in:
parent
c173c4b7ee
commit
87b8015e8f
@ -22,22 +22,24 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class OsuTabControlCheckBox : CheckBox
|
public class OsuTabControlCheckBox : CheckBox
|
||||||
{
|
{
|
||||||
private const float transition_length = 500;
|
private Box box;
|
||||||
|
private SpriteText text;
|
||||||
|
private TextAwesome icon;
|
||||||
|
|
||||||
public event EventHandler<CheckBoxState> Action;
|
public event EventHandler<CheckBoxState> Action;
|
||||||
|
|
||||||
private Color4 accentColour;
|
private Color4? accentColour;
|
||||||
public Color4 AccentColour
|
public Color4 AccentColour
|
||||||
{
|
{
|
||||||
get { return accentColour; }
|
get { return accentColour.GetValueOrDefault(); }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
accentColour = value;
|
accentColour = value;
|
||||||
|
|
||||||
if (State == CheckBoxState.Unchecked)
|
if (State != CheckBoxState.Checked)
|
||||||
{
|
{
|
||||||
text.Colour = accentColour;
|
text.Colour = AccentColour;
|
||||||
icon.Colour = accentColour;
|
icon.Colour = AccentColour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,22 +50,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
set { text.Text = value; }
|
set { text.Text = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private Box box;
|
|
||||||
private SpriteText text;
|
|
||||||
private TextAwesome icon;
|
|
||||||
|
|
||||||
private void fadeIn()
|
|
||||||
{
|
|
||||||
box.FadeIn(transition_length, EasingTypes.OutQuint);
|
|
||||||
text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fadeOut()
|
|
||||||
{
|
|
||||||
box.FadeOut(transition_length, EasingTypes.OutQuint);
|
|
||||||
text.FadeColour(accentColour, transition_length, EasingTypes.OutQuint);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnChecked()
|
protected override void OnChecked()
|
||||||
{
|
{
|
||||||
fadeIn();
|
fadeIn();
|
||||||
@ -78,6 +64,20 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Action?.Invoke(this, State);
|
Action?.Invoke(this, State);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const float transition_length = 500;
|
||||||
|
|
||||||
|
private void fadeIn()
|
||||||
|
{
|
||||||
|
box.FadeIn(transition_length, EasingTypes.OutQuint);
|
||||||
|
text.FadeColour(Color4.White, transition_length, EasingTypes.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fadeOut()
|
||||||
|
{
|
||||||
|
box.FadeOut(transition_length, EasingTypes.OutQuint);
|
||||||
|
text.FadeColour(AccentColour, transition_length, EasingTypes.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
protected override bool OnHover(InputState state)
|
||||||
{
|
{
|
||||||
fadeIn();
|
fadeIn();
|
||||||
@ -92,6 +92,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
base.OnHoverLost(state);
|
base.OnHoverLost(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
if (accentColour == null)
|
||||||
|
AccentColour = colours.Blue;
|
||||||
|
}
|
||||||
|
|
||||||
public OsuTabControlCheckBox()
|
public OsuTabControlCheckBox()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
@ -9,19 +9,23 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
public class BeatmapDetailArea : Container
|
public class BeatmapDetailArea : Container
|
||||||
{
|
{
|
||||||
|
private Container content;
|
||||||
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
public BeatmapDetailArea()
|
public BeatmapDetailArea()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
AddInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
new BeatmapDetailAreaTabControl
|
new BeatmapDetailAreaTabControl
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
},
|
},
|
||||||
new Container
|
content = new Container
|
||||||
{
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT },
|
Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT },
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user