Added Descriptions to Rulesets + PlayModes list

This commit is contained in:
Jorolf
2017-03-09 21:37:03 +01:00
parent a266add670
commit d9a4a677fd
8 changed files with 15 additions and 9 deletions

View File

@ -79,6 +79,8 @@ namespace osu.Game.Modes.Catch
protected override PlayMode PlayMode => PlayMode.Catch; protected override PlayMode PlayMode => PlayMode.Catch;
public override string Description => "osu!catch";
public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o; public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o;
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null; public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;

View File

@ -100,6 +100,8 @@ namespace osu.Game.Modes.Mania
protected override PlayMode PlayMode => PlayMode.Mania; protected override PlayMode PlayMode => PlayMode.Mania;
public override string Description => "osu!mania";
public override FontAwesome Icon => FontAwesome.fa_osu_mania_o; public override FontAwesome Icon => FontAwesome.fa_osu_mania_o;
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null; public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;

View File

@ -111,5 +111,7 @@ namespace osu.Game.Modes.Osu
} }
protected override PlayMode PlayMode => PlayMode.Osu; protected override PlayMode PlayMode => PlayMode.Osu;
public override string Description => "osu!";
} }
} }

View File

@ -79,6 +79,8 @@ namespace osu.Game.Modes.Taiko
protected override PlayMode PlayMode => PlayMode.Taiko; protected override PlayMode PlayMode => PlayMode.Taiko;
public override string Description => "osu!taiko";
public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o; public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o;
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null; public override ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0) => null;

View File

@ -1,19 +1,13 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
namespace osu.Game.Modes namespace osu.Game.Modes
{ {
public enum PlayMode public enum PlayMode
{ {
[Description(@"osu!")]
Osu = 0, Osu = 0,
[Description(@"osu!taiko")]
Taiko = 1, Taiko = 1,
[Description(@"osu!catch")]
Catch = 2, Catch = 2,
[Description(@"osu!mania")]
Mania = 3 Mania = 3
} }
} }

View File

@ -22,6 +22,8 @@ namespace osu.Game.Modes
{ {
private static ConcurrentDictionary<PlayMode, Type> availableRulesets = new ConcurrentDictionary<PlayMode, Type>(); private static ConcurrentDictionary<PlayMode, Type> availableRulesets = new ConcurrentDictionary<PlayMode, Type>();
public static IEnumerable<PlayMode> PlayModes => availableRulesets.Keys;
public abstract ScoreOverlay CreateScoreOverlay(); public abstract ScoreOverlay CreateScoreOverlay();
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { }; public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
@ -42,6 +44,8 @@ namespace osu.Game.Modes
public virtual FontAwesome Icon => FontAwesome.fa_question_circle; public virtual FontAwesome Icon => FontAwesome.fa_question_circle;
public abstract string Description { get; }
public virtual Score CreateAutoplayScore(Beatmap beatmap) => null; public virtual Score CreateAutoplayScore(Beatmap beatmap) => null;
public static Ruleset GetRuleset(PlayMode mode) public static Ruleset GetRuleset(PlayMode mode)

View File

@ -17,8 +17,8 @@ namespace osu.Game.Overlays.Toolbar
set set
{ {
mode = value; mode = value;
TooltipMain = mode.GetDescription(); TooltipMain = Ruleset.GetRuleset(mode).Description;
TooltipSub = $"Play some {mode.GetDescription()}"; TooltipSub = $"Play some {Ruleset.GetRuleset(mode).Description}";
Icon = Ruleset.GetRuleset(mode).Icon; Icon = Ruleset.GetRuleset(mode).Icon;
} }
} }

View File

@ -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; var localMode = m;
modeButtons.Add(new ToolbarModeButton modeButtons.Add(new ToolbarModeButton