1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 12:42:54 +08:00

Few cleanups

This commit is contained in:
Andrei Zavatski 2019-09-19 17:03:52 +03:00
parent efea8be97d
commit 0cf4db899f
3 changed files with 11 additions and 13 deletions

View File

@ -53,11 +53,12 @@ namespace osu.Game.Tests.Visual.Online
}); });
}); });
AddStep("osu mods", () => ruleset.Value = new OsuRuleset().RulesetInfo); AddStep("osu ruleset", () => ruleset.Value = new OsuRuleset().RulesetInfo);
AddStep("mania mods", () => ruleset.Value = new ManiaRuleset().RulesetInfo); AddStep("mania ruleset", () => ruleset.Value = new ManiaRuleset().RulesetInfo);
AddStep("taiko mods", () => ruleset.Value = new TaikoRuleset().RulesetInfo); AddStep("taiko ruleset", () => ruleset.Value = new TaikoRuleset().RulesetInfo);
AddStep("catch mods", () => ruleset.Value = new CatchRuleset().RulesetInfo); AddStep("catch ruleset", () => ruleset.Value = new CatchRuleset().RulesetInfo);
AddStep("Deselect all", () => modSelector.DeselectAll()); AddStep("Deselect all", () => modSelector.DeselectAll());
AddStep("null ruleset", () => ruleset.Value = null);
} }
} }
} }

View File

@ -74,10 +74,10 @@ namespace osu.Game.Overlays.BeatmapSet
else else
mods.Remove(mod); mods.Remove(mod);
SelectedMods.Value = mods;
if (!mods.Any() && !IsHovered) if (!mods.Any() && !IsHovered)
highlightAll(); highlightAll();
SelectedMods.Value = mods;
} }
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
@ -116,6 +116,7 @@ namespace osu.Game.Overlays.BeatmapSet
: base(mod) : base(mod)
{ {
Scale = new Vector2(mod_scale); Scale = new Vector2(mod_scale);
Highlighted.Value = true;
Add(new HoverClickSounds()); Add(new HoverClickSounds());
} }
@ -123,8 +124,6 @@ namespace osu.Game.Overlays.BeatmapSet
{ {
base.LoadComplete(); base.LoadComplete();
Highlighted.Value = true;
Selected.BindValueChanged(selected => Selected.BindValueChanged(selected =>
{ {
updateState(); updateState();
@ -152,10 +151,8 @@ namespace osu.Game.Overlays.BeatmapSet
private void updateState() => Highlighted.Value = IsHovered || Selected.Value; private void updateState() => Highlighted.Value = IsHovered || Selected.Value;
protected override void OnHighlightedChange(ValueChangedEvent<bool> highlighted) protected override void OnHighlightedChanged(ValueChangedEvent<bool> highlighted) =>
{
this.FadeColour(highlighted.NewValue ? Color4.White : Color4.Gray, duration, Easing.OutQuint); this.FadeColour(highlighted.NewValue ? Color4.White : Color4.Gray, duration, Easing.OutQuint);
}
} }
private class NoMod : Mod private class NoMod : Mod

View File

@ -114,10 +114,10 @@ namespace osu.Game.Rulesets.UI
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
Highlighted.BindValueChanged(OnHighlightedChange); Highlighted.BindValueChanged(OnHighlightedChanged, true);
} }
protected virtual void OnHighlightedChange(ValueChangedEvent<bool> highlighted) protected virtual void OnHighlightedChanged(ValueChangedEvent<bool> highlighted)
{ {
background.Colour = highlighted.NewValue ? highlightedColour : backgroundColour; background.Colour = highlighted.NewValue ? highlightedColour : backgroundColour;
} }