mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 15:53:19 +08:00
Use existing ModNoMod
This commit is contained in:
parent
1218d41b50
commit
2592a0489b
@ -28,7 +28,6 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
LeaderboardModSelector modSelector;
|
||||
FillFlowContainer<SpriteText> selectedMods;
|
||||
Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
Add(selectedMods = new FillFlowContainer<SpriteText>
|
||||
{
|
||||
@ -40,7 +39,6 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Ruleset = { BindTarget = ruleset }
|
||||
});
|
||||
|
||||
modSelector.SelectedMods.ItemsAdded += mods =>
|
||||
@ -66,12 +64,12 @@ namespace osu.Game.Tests.Visual.Online
|
||||
});
|
||||
};
|
||||
|
||||
AddStep("osu ruleset", () => ruleset.Value = new OsuRuleset().RulesetInfo);
|
||||
AddStep("mania ruleset", () => ruleset.Value = new ManiaRuleset().RulesetInfo);
|
||||
AddStep("taiko ruleset", () => ruleset.Value = new TaikoRuleset().RulesetInfo);
|
||||
AddStep("catch ruleset", () => ruleset.Value = new CatchRuleset().RulesetInfo);
|
||||
AddStep("osu ruleset", () => modSelector.Ruleset = new OsuRuleset().RulesetInfo);
|
||||
AddStep("mania ruleset", () => modSelector.Ruleset = new ManiaRuleset().RulesetInfo);
|
||||
AddStep("taiko ruleset", () => modSelector.Ruleset = new TaikoRuleset().RulesetInfo);
|
||||
AddStep("catch ruleset", () => modSelector.Ruleset = new CatchRuleset().RulesetInfo);
|
||||
AddStep("Deselect all", () => modSelector.DeselectAll());
|
||||
AddStep("null ruleset", () => ruleset.Value = null);
|
||||
AddStep("null ruleset", () => modSelector.Ruleset = null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ using osuTK.Graphics;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
@ -43,7 +42,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
if (ruleset == null)
|
||||
return;
|
||||
|
||||
modsContainer.Add(new ModButton(new NoMod()));
|
||||
modsContainer.Add(new ModButton(new ModNoMod()));
|
||||
modsContainer.AddRange(ruleset.CreateInstance().GetAllMods().Where(m => m.Ranked).Select(m => new ModButton(m)));
|
||||
|
||||
modsContainer.ForEach(button => button.OnSelectionChanged = selectionChanged);
|
||||
@ -146,18 +145,5 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
protected override void OnHighlightedChanged(ValueChangedEvent<bool> highlighted) =>
|
||||
this.FadeColour(highlighted.NewValue ? Color4.White : Color4.Gray, duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private class NoMod : Mod
|
||||
{
|
||||
public override string Name => "NoMod";
|
||||
|
||||
public override string Acronym => "NM";
|
||||
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
||||
public override IconUsage Icon => FontAwesome.Solid.Ban;
|
||||
|
||||
public override ModType Type => ModType.System;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
/// <summary>
|
||||
@ -11,5 +13,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override string Name => "No Mod";
|
||||
public override string Acronym => "NM";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override IconUsage Icon => FontAwesome.Solid.Ban;
|
||||
public override ModType Type => ModType.System;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user