Merge remote-tracking branch 'origin/master' into taiko-hitsounds-fix

This commit is contained in:
Dean Herbert
2017-12-23 14:14:42 +09:00
52 changed files with 1059 additions and 297 deletions

View File

@ -23,13 +23,12 @@ namespace osu.Game.Rulesets
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
public IEnumerable<Mod> GetAllMods() => Enum.GetValues(typeof(ModType)).Cast<ModType>()
// Get all mod types as an IEnumerable<ModType>
.SelectMany(GetModsFor)
// Confine all mods of each mod type into a single IEnumerable<Mod>
.Where(mod => mod != null)
// Filter out all null mods
.SelectMany(mod => (mod as MultiMod)?.Mods ?? new[] { mod });
// Resolve MultiMods as their .Mods property
// Confine all mods of each mod type into a single IEnumerable<Mod>
.SelectMany(GetModsFor)
// Filter out all null mods
.Where(mod => mod != null)
// Resolve MultiMods as their .Mods property
.SelectMany(mod => (mod as MultiMod)?.Mods ?? new[] { mod });
public abstract IEnumerable<Mod> GetModsFor(ModType type);
@ -66,6 +65,11 @@ namespace osu.Game.Rulesets
/// </summary>
public virtual int LegacyID => -1;
/// <summary>
/// A unique short name to reference this ruleset in online requests.
/// </summary>
public abstract string ShortName { get; }
/// <summary>
/// A list of available variant ids.
/// </summary>

View File

@ -13,6 +13,8 @@ namespace osu.Game.Rulesets
public string Name { get; set; }
public string ShortName { get; set; }
public string InstantiationInfo { get; set; }
public bool Available { get; set; }

View File

@ -83,7 +83,11 @@ namespace osu.Game.Rulesets
{
try
{
r.CreateInstance();
var instance = r.CreateInstance();
r.Name = instance.Description;
r.ShortName = instance.ShortName;
r.Available = true;
}
catch
@ -117,6 +121,7 @@ namespace osu.Game.Rulesets
private RulesetInfo createRulesetInfo(Ruleset ruleset) => new RulesetInfo
{
Name = ruleset.Description,
ShortName = ruleset.ShortName,
InstantiationInfo = ruleset.GetType().AssemblyQualifiedName,
ID = ruleset.LegacyID
};