mirror of
https://github.com/osukey/osukey.git
synced 2025-05-09 23:57:18 +09:00
Update the component with an abstract RulesetSelector class
This commit is contained in:
parent
e9f3a1ba63
commit
2e49b4ffcd
@ -12,10 +12,8 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Header.Components
|
namespace osu.Game.Overlays.Profile.Header.Components
|
||||||
{
|
{
|
||||||
public class ProfileRulesetSelector : TabControl<RulesetInfo>
|
public class ProfileRulesetSelector : RulesetSelector
|
||||||
{
|
{
|
||||||
protected override Dropdown<RulesetInfo> CreateDropdown() => null;
|
|
||||||
|
|
||||||
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new RulesetTabItem(value)
|
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new RulesetTabItem(value)
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour
|
AccentColour = AccentColour
|
||||||
@ -48,13 +46,8 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(RulesetStore rulesets, OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
foreach (var r in rulesets.AvailableRulesets)
|
|
||||||
{
|
|
||||||
AddItem(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
AccentColour = colours.Seafoam;
|
AccentColour = colours.Seafoam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,7 +94,8 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
{
|
{
|
||||||
base.OnHover(e);
|
base.OnHover(e);
|
||||||
|
|
||||||
updateState();
|
if (!Active.Value)
|
||||||
|
hoverAction();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -103,29 +104,40 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
|||||||
{
|
{
|
||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
|
|
||||||
updateState();
|
if (!Active.Value)
|
||||||
|
unhoverAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnActivated() => updateState();
|
protected override void OnActivated()
|
||||||
|
{
|
||||||
|
hoverAction();
|
||||||
|
text.Font = text.Font.With(weight: FontWeight.Bold);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnDeactivated() => updateState();
|
protected override void OnDeactivated()
|
||||||
|
{
|
||||||
|
unhoverAction();
|
||||||
|
text.Font = text.Font.With(weight: FontWeight.Medium);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateState()
|
private void updateState()
|
||||||
{
|
{
|
||||||
if (Active.Value || IsHovered)
|
if (Active.Value)
|
||||||
{
|
OnActivated();
|
||||||
text.FadeColour(Color4.White, 120, Easing.InQuad);
|
|
||||||
icon.FadeColour(Color4.White, 120, Easing.InQuad);
|
|
||||||
|
|
||||||
if (Active.Value)
|
|
||||||
text.Font = text.Font.With(weight: FontWeight.Bold);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
OnDeactivated();
|
||||||
text.FadeColour(AccentColour, 120, Easing.InQuad);
|
}
|
||||||
icon.FadeColour(AccentColour, 120, Easing.InQuad);
|
|
||||||
text.Font = text.Font.With(weight: FontWeight.Medium);
|
private void hoverAction()
|
||||||
}
|
{
|
||||||
|
text.FadeColour(Color4.White, 120, Easing.InQuad);
|
||||||
|
icon.FadeColour(Color4.White, 120, Easing.InQuad);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void unhoverAction()
|
||||||
|
{
|
||||||
|
text.FadeColour(AccentColour, 120, Easing.InQuad);
|
||||||
|
icon.FadeColour(AccentColour, 120, Easing.InQuad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user