diff --git a/osu.Game.Modes.Catch/CatchRuleset.cs b/osu.Game.Modes.Catch/CatchRuleset.cs index 737bd99f94..155d9e9a1e 100644 --- a/osu.Game.Modes.Catch/CatchRuleset.cs +++ b/osu.Game.Modes.Catch/CatchRuleset.cs @@ -79,6 +79,8 @@ namespace osu.Game.Modes.Catch protected override PlayMode PlayMode => PlayMode.Catch; + public override string Description => "osu!catch"; + public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o; public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null; diff --git a/osu.Game.Modes.Mania/ManiaRuleset.cs b/osu.Game.Modes.Mania/ManiaRuleset.cs index 6d5606f796..5487606b26 100644 --- a/osu.Game.Modes.Mania/ManiaRuleset.cs +++ b/osu.Game.Modes.Mania/ManiaRuleset.cs @@ -100,6 +100,8 @@ namespace osu.Game.Modes.Mania protected override PlayMode PlayMode => PlayMode.Mania; + public override string Description => "osu!mania"; + public override FontAwesome Icon => FontAwesome.fa_osu_mania_o; public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null; diff --git a/osu.Game.Modes.Osu/OsuRuleset.cs b/osu.Game.Modes.Osu/OsuRuleset.cs index 68f700cabb..3cfce84448 100644 --- a/osu.Game.Modes.Osu/OsuRuleset.cs +++ b/osu.Game.Modes.Osu/OsuRuleset.cs @@ -111,5 +111,7 @@ namespace osu.Game.Modes.Osu } protected override PlayMode PlayMode => PlayMode.Osu; + + public override string Description => "osu!"; } } diff --git a/osu.Game.Modes.Taiko/TaikoRuleset.cs b/osu.Game.Modes.Taiko/TaikoRuleset.cs index 585b3e97b0..be23045f4d 100644 --- a/osu.Game.Modes.Taiko/TaikoRuleset.cs +++ b/osu.Game.Modes.Taiko/TaikoRuleset.cs @@ -79,6 +79,8 @@ namespace osu.Game.Modes.Taiko protected override PlayMode PlayMode => PlayMode.Taiko; + public override string Description => "osu!taiko"; + public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o; public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null; diff --git a/osu.Game/Modes/PlayMode.cs b/osu.Game/Modes/PlayMode.cs index 8d1e5158b0..fa6d94a650 100644 --- a/osu.Game/Modes/PlayMode.cs +++ b/osu.Game/Modes/PlayMode.cs @@ -1,19 +1,13 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.ComponentModel; - namespace osu.Game.Modes { public enum PlayMode { - [Description(@"osu!")] Osu = 0, - [Description(@"osu!taiko")] Taiko = 1, - [Description(@"osu!catch")] Catch = 2, - [Description(@"osu!mania")] Mania = 3 } } diff --git a/osu.Game/Modes/Ruleset.cs b/osu.Game/Modes/Ruleset.cs index fefba6caf8..c004ae4092 100644 --- a/osu.Game/Modes/Ruleset.cs +++ b/osu.Game/Modes/Ruleset.cs @@ -22,6 +22,8 @@ namespace osu.Game.Modes { private static ConcurrentDictionary availableRulesets = new ConcurrentDictionary(); + public static IEnumerable PlayModes => availableRulesets.Keys; + public abstract ScoreOverlay CreateScoreOverlay(); public virtual IEnumerable GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { }; @@ -42,6 +44,8 @@ namespace osu.Game.Modes public virtual FontAwesome Icon => FontAwesome.fa_question_circle; + public abstract string Description { get; } + public virtual Score CreateAutoplayScore(Beatmap beatmap) => null; public static Ruleset GetRuleset(PlayMode mode) diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs index 1bcc0bf828..62359b05ae 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Extensions; using osu.Framework.Graphics.Containers; using osu.Game.Modes; using OpenTK.Graphics; @@ -17,8 +16,8 @@ namespace osu.Game.Overlays.Toolbar set { mode = value; - TooltipMain = mode.GetDescription(); - TooltipSub = $"Play some {mode.GetDescription()}"; + TooltipMain = Ruleset.GetRuleset(mode).Description; + TooltipSub = $"Play some {Ruleset.GetRuleset(mode).Description}"; Icon = Ruleset.GetRuleset(mode).Icon; } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs index 8b24157381..30474ad796 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs @@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Toolbar } }; - foreach (PlayMode m in Enum.GetValues(typeof(PlayMode))) + foreach (PlayMode m in Ruleset.PlayModes) { var localMode = m; modeButtons.Add(new ToolbarModeButton