mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 18:33:20 +08:00
Naming adjustments
This commit is contained in:
parent
c7c8527f5f
commit
0f1a3d97c8
@ -72,7 +72,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
if (SelectedMods.Any())
|
||||
return;
|
||||
|
||||
modsContainer.Children.Where(button => !button.IsHovered).ForEach(button => button.IsActive.Value = !IsHovered);
|
||||
modsContainer.Children.Where(button => !button.IsHovered).ForEach(button => button.Highlighted.Value = !IsHovered);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
@ -87,13 +87,13 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
updateHighlighted();
|
||||
}
|
||||
|
||||
public void DeselectAll() => modsContainer.ForEach(mod => mod.Highlighted.Value = false);
|
||||
public void DeselectAll() => modsContainer.ForEach(mod => mod.Selected.Value = false);
|
||||
|
||||
private class ModButton : ModIcon
|
||||
{
|
||||
private const int duration = 200;
|
||||
|
||||
public readonly BindableBool IsActive = new BindableBool();
|
||||
public readonly BindableBool Highlighted = new BindableBool();
|
||||
public Action<Mod, bool> OnSelectionChanged;
|
||||
|
||||
public ModButton(Mod mod)
|
||||
@ -107,37 +107,37 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
IsActive.BindValueChanged(hovered =>
|
||||
{
|
||||
if (Highlighted.Value)
|
||||
return;
|
||||
|
||||
this.FadeColour(hovered.NewValue ? Color4.White : Color4.DimGray, duration, Easing.OutQuint);
|
||||
}, true);
|
||||
|
||||
Highlighted.BindValueChanged(highlighted =>
|
||||
{
|
||||
OnSelectionChanged?.Invoke(Mod, highlighted.NewValue);
|
||||
IsActive.TriggerChange();
|
||||
if (Selected.Value)
|
||||
return;
|
||||
|
||||
this.FadeColour(highlighted.NewValue ? Color4.White : Color4.DimGray, duration, Easing.OutQuint);
|
||||
}, true);
|
||||
|
||||
Selected.BindValueChanged(selected =>
|
||||
{
|
||||
OnSelectionChanged?.Invoke(Mod, selected.NewValue);
|
||||
Highlighted.TriggerChange();
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
Highlighted.Toggle();
|
||||
Selected.Toggle();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
IsActive.Value = true;
|
||||
Highlighted.Value = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
base.OnHoverLost(e);
|
||||
IsActive.Value = false;
|
||||
Highlighted.Value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ namespace osu.Game.Overlays.Mods
|
||||
}
|
||||
}
|
||||
|
||||
foregroundIcon.Highlighted.Value = Selected;
|
||||
foregroundIcon.Selected.Value = Selected;
|
||||
|
||||
SelectionChanged?.Invoke(SelectedMod);
|
||||
return true;
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
public class ModIcon : Container, IHasTooltip
|
||||
{
|
||||
public readonly BindableBool Highlighted = new BindableBool();
|
||||
public readonly BindableBool Selected = new BindableBool();
|
||||
|
||||
private readonly SpriteIcon modIcon;
|
||||
private readonly SpriteIcon background;
|
||||
@ -112,7 +112,7 @@ namespace osu.Game.Rulesets.UI
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Highlighted.BindValueChanged(highlighted => background.Colour = highlighted.NewValue ? highlightedColour : backgroundColour, true);
|
||||
Selected.BindValueChanged(highlighted => background.Colour = highlighted.NewValue ? highlightedColour : backgroundColour, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user