mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Give HitRenderer a reference to Ruleset
Used to get correct bindings for a mode (ActionMappingInputManager).
This commit is contained in:
@ -15,12 +15,19 @@ namespace osu.Game.Rulesets
|
||||
{
|
||||
public abstract class Ruleset
|
||||
{
|
||||
public readonly RulesetInfo RulesetInfo;
|
||||
|
||||
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
|
||||
|
||||
public abstract IEnumerable<Mod> GetModsFor(ModType type);
|
||||
|
||||
public abstract Mod GetAutoplayMod();
|
||||
|
||||
protected Ruleset(RulesetInfo rulesetInfo)
|
||||
{
|
||||
RulesetInfo = rulesetInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to create a hit renderer for a beatmap
|
||||
/// </summary>
|
||||
|
@ -20,6 +20,6 @@ namespace osu.Game.Rulesets
|
||||
[Indexed]
|
||||
public bool Available { get; set; }
|
||||
|
||||
public virtual Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo));
|
||||
public virtual Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo), this);
|
||||
}
|
||||
}
|
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets
|
||||
continue;
|
||||
|
||||
foreach (Type rulesetType in rulesets)
|
||||
instances.Add((Ruleset)Activator.CreateInstance(rulesetType));
|
||||
instances.Add((Ruleset)Activator.CreateInstance(rulesetType, new RulesetInfo()));
|
||||
}
|
||||
catch (Exception) { }
|
||||
}
|
||||
|
@ -67,9 +67,16 @@ namespace osu.Game.Rulesets.UI
|
||||
/// </summary>
|
||||
protected abstract bool AllObjectsJudged { get; }
|
||||
|
||||
internal HitRenderer()
|
||||
protected readonly Ruleset Ruleset;
|
||||
|
||||
/// <summary>
|
||||
/// A visual representation of a <see cref="Rulesets.Ruleset"/>.
|
||||
/// </summary>
|
||||
/// <param name="ruleset">The ruleset being repesented.</param>
|
||||
internal HitRenderer(Ruleset ruleset)
|
||||
{
|
||||
KeyConversionInputManager = CreateKeyConversionInputManager();
|
||||
Ruleset = ruleset;
|
||||
KeyConversionInputManager = CreateActionMappingInputManager();
|
||||
KeyConversionInputManager.RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
@ -88,7 +95,7 @@ namespace osu.Game.Rulesets.UI
|
||||
/// Creates a key conversion input manager.
|
||||
/// </summary>
|
||||
/// <returns>The input manager.</returns>
|
||||
protected virtual PassThroughInputManager CreateKeyConversionInputManager() => new PassThroughInputManager();
|
||||
protected virtual PassThroughInputManager CreateActionMappingInputManager() => new PassThroughInputManager();
|
||||
|
||||
protected virtual FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new FramedReplayInputHandler(replay);
|
||||
|
||||
@ -134,9 +141,10 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// Creates a hit renderer for a beatmap.
|
||||
/// </summary>
|
||||
/// <param name="ruleset">The ruleset being repesented.</param>
|
||||
/// <param name="beatmap">The beatmap to create the hit renderer for.</param>
|
||||
/// <param name="isForCurrentRuleset">Whether to assume the beatmap is for the current ruleset.</param>
|
||||
internal HitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||
internal HitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset)
|
||||
{
|
||||
Debug.Assert(beatmap != null, "HitRenderer initialized with a null beatmap.");
|
||||
|
||||
@ -236,10 +244,11 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// Creates a hit renderer for a beatmap.
|
||||
/// </summary>
|
||||
/// <param name="ruleset">The ruleset being repesented.</param>
|
||||
/// <param name="beatmap">The beatmap to create the hit renderer for.</param>
|
||||
/// <param name="isForCurrentRuleset">Whether to assume the beatmap is for the current ruleset.</param>
|
||||
protected HitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||
: base(beatmap, isForCurrentRuleset)
|
||||
protected HitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||
: base(ruleset, beatmap, isForCurrentRuleset)
|
||||
{
|
||||
InputManager.Add(content = new Container
|
||||
{
|
||||
@ -343,10 +352,11 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <summary>
|
||||
/// Creates a hit renderer for a beatmap.
|
||||
/// </summary>
|
||||
/// <param name="ruleset">The ruleset being repesented.</param>
|
||||
/// <param name="beatmap">The beatmap to create the hit renderer for.</param>
|
||||
/// <param name="isForCurrentRuleset">Whether to assume the beatmap is for the current ruleset.</param>
|
||||
protected HitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||
: base(beatmap, isForCurrentRuleset)
|
||||
protected HitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||
: base(ruleset, beatmap, isForCurrentRuleset)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ namespace osu.Game.Rulesets.UI
|
||||
/// <returns></returns>
|
||||
protected readonly SortedList<MultiplierControlPoint> DefaultControlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default);
|
||||
|
||||
protected ScrollingHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||
: base(beatmap, isForCurrentRuleset)
|
||||
protected ScrollingHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||
: base(ruleset, beatmap, isForCurrentRuleset)
|
||||
{
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user