2017-02-07 13:59:30 +09:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-11-09 19:49:05 +09:00
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
2016-11-14 18:03:20 +09:00
|
|
|
|
using osu.Game.Modes.Objects;
|
2016-11-14 18:54:24 +09:00
|
|
|
|
using osu.Game.Modes.UI;
|
2016-11-14 19:20:27 +09:00
|
|
|
|
using System;
|
2016-11-14 23:13:47 +09:00
|
|
|
|
using System.Collections.Concurrent;
|
2017-02-28 20:14:48 +09:00
|
|
|
|
using osu.Framework.Input;
|
2017-01-30 13:12:30 +09:00
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Graphics;
|
2016-11-09 19:49:05 +09:00
|
|
|
|
|
2016-11-14 18:03:20 +09:00
|
|
|
|
namespace osu.Game.Modes
|
2016-11-09 19:49:05 +09:00
|
|
|
|
{
|
2017-01-30 13:12:30 +09:00
|
|
|
|
public class BeatmapStatistic
|
|
|
|
|
{
|
|
|
|
|
public FontAwesome Icon;
|
|
|
|
|
public string Content;
|
|
|
|
|
public string Name;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-09 19:49:05 +09:00
|
|
|
|
public abstract class Ruleset
|
|
|
|
|
{
|
2016-11-14 23:13:47 +09:00
|
|
|
|
private static ConcurrentDictionary<PlayMode, Type> availableRulesets = new ConcurrentDictionary<PlayMode, Type>();
|
2016-11-14 22:03:39 +09:00
|
|
|
|
|
2016-11-09 19:49:05 +09:00
|
|
|
|
public abstract ScoreOverlay CreateScoreOverlay();
|
|
|
|
|
|
2017-01-30 13:12:30 +09:00
|
|
|
|
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
|
|
|
|
|
|
2017-03-02 01:07:28 -04:00
|
|
|
|
public abstract IEnumerable<Mod> GetModsFor(ModType type);
|
2017-03-01 22:05:52 -04:00
|
|
|
|
|
2017-03-04 15:29:15 +09:00
|
|
|
|
public abstract ScoreProcessor CreateScoreProcessor(int hitObjectCount = 0);
|
2016-11-29 15:41:48 +09:00
|
|
|
|
|
2017-02-28 20:14:48 +09:00
|
|
|
|
public abstract HitRenderer CreateHitRendererWith(Beatmap beatmap, InputManager input = null);
|
2016-11-09 19:49:05 +09:00
|
|
|
|
|
2016-11-14 22:03:39 +09:00
|
|
|
|
public abstract HitObjectParser CreateHitObjectParser();
|
|
|
|
|
|
2017-02-19 17:41:51 +01:00
|
|
|
|
public abstract DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap);
|
|
|
|
|
|
2016-11-14 23:13:47 +09:00
|
|
|
|
public static void Register(Ruleset ruleset) => availableRulesets.TryAdd(ruleset.PlayMode, ruleset.GetType());
|
|
|
|
|
|
2016-11-14 23:18:21 +09:00
|
|
|
|
protected abstract PlayMode PlayMode { get; }
|
2016-11-14 22:03:39 +09:00
|
|
|
|
|
2017-01-30 13:35:40 +09:00
|
|
|
|
public virtual FontAwesome Icon => FontAwesome.fa_question_circle;
|
|
|
|
|
|
2017-03-06 10:06:14 +09:00
|
|
|
|
public virtual Score CreateAutoplayScore(Beatmap beatmap) => null;
|
2017-03-05 17:46:00 +09:00
|
|
|
|
|
2016-11-09 19:49:05 +09:00
|
|
|
|
public static Ruleset GetRuleset(PlayMode mode)
|
|
|
|
|
{
|
2016-11-14 23:13:47 +09:00
|
|
|
|
Type type;
|
2016-11-14 18:54:24 +09:00
|
|
|
|
|
2016-11-14 23:13:47 +09:00
|
|
|
|
if (!availableRulesets.TryGetValue(mode, out type))
|
2016-11-14 19:20:27 +09:00
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
return Activator.CreateInstance(type) as Ruleset;
|
2016-11-09 19:49:05 +09:00
|
|
|
|
}
|
2017-03-05 17:46:00 +09:00
|
|
|
|
|
2016-11-09 19:49:05 +09:00
|
|
|
|
}
|
|
|
|
|
}
|