1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 20:12:57 +08:00

HitRenderer -> RulesetContainer

This commit is contained in:
Dean Herbert 2017-08-09 13:28:29 +09:00
parent f21b370f4e
commit 723e27353c
32 changed files with 110 additions and 110 deletions

View File

@ -88,25 +88,25 @@ namespace osu.Desktop.Tests.Visual
Clock = new FramedClock(), Clock = new FramedClock(),
Children = new Drawable[] Children = new Drawable[]
{ {
new OsuHitRenderer(new OsuRuleset(new RulesetInfo()), beatmap, false) new OsuRulesetContainer(new OsuRuleset(new RulesetInfo()), beatmap, false)
{ {
Scale = new Vector2(0.5f), Scale = new Vector2(0.5f),
Anchor = Anchor.TopLeft, Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft Origin = Anchor.TopLeft
}, },
new TaikoHitRenderer(new TaikoRuleset(new RulesetInfo()),beatmap, false) new TaikoRulesetContainer(new TaikoRuleset(new RulesetInfo()),beatmap, false)
{ {
Scale = new Vector2(0.5f), Scale = new Vector2(0.5f),
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight Origin = Anchor.TopRight
}, },
new CatchHitRenderer(new CatchRuleset(new RulesetInfo()),beatmap, false) new CatchRulesetContainer(new CatchRuleset(new RulesetInfo()),beatmap, false)
{ {
Scale = new Vector2(0.5f), Scale = new Vector2(0.5f),
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft Origin = Anchor.BottomLeft
}, },
new ManiaHitRenderer(new ManiaRuleset(new RulesetInfo()),beatmap, false) new ManiaRulesetContainer(new ManiaRuleset(new RulesetInfo()),beatmap, false)
{ {
Scale = new Vector2(0.5f), Scale = new Vector2(0.5f),
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,

View File

@ -50,15 +50,15 @@ namespace osu.Desktop.Tests.Visual
WorkingBeatmap beatmap = new TestWorkingBeatmap(b); WorkingBeatmap beatmap = new TestWorkingBeatmap(b);
TestHitRenderer hitRenderer; TestRulesetContainer rulesetContainer;
Add(hitRenderer = new TestHitRenderer(beatmap, true)); Add(rulesetContainer = new TestRulesetContainer(beatmap, true));
AddStep("Reverse direction", () => hitRenderer.Playfield.Reversed.Value = !hitRenderer.Playfield.Reversed); AddStep("Reverse direction", () => rulesetContainer.Playfield.Reversed.Value = !rulesetContainer.Playfield.Reversed);
} }
private class TestHitRenderer : ScrollingHitRenderer<TestPlayfield, TestHitObject, TestJudgement> private class TestRulesetContainer : ScrollingRulesetContainer<TestPlayfield, TestHitObject, TestJudgement>
{ {
public TestHitRenderer(WorkingBeatmap beatmap, bool isForCurrentRuleset) public TestRulesetContainer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(null, beatmap, isForCurrentRuleset) : base(null, beatmap, isForCurrentRuleset)
{ {
} }

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Catch
{ {
public class CatchRuleset : Ruleset public class CatchRuleset : Ruleset
{ {
public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new CatchHitRenderer(this, beatmap, isForCurrentRuleset); public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new CatchRulesetContainer(this, beatmap, isForCurrentRuleset);
public override IEnumerable<Mod> GetModsFor(ModType type) public override IEnumerable<Mod> GetModsFor(ModType type)
{ {

View File

@ -14,8 +14,8 @@ namespace osu.Game.Rulesets.Catch.Scoring
{ {
} }
public CatchScoreProcessor(HitRenderer<CatchBaseHit, CatchJudgement> hitRenderer) public CatchScoreProcessor(RulesetContainer<CatchBaseHit, CatchJudgement> rulesetContainer)
: base(hitRenderer) : base(rulesetContainer)
{ {
} }

View File

@ -15,9 +15,9 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Catch.UI namespace osu.Game.Rulesets.Catch.UI
{ {
public class CatchHitRenderer : ScrollingHitRenderer<CatchPlayfield, CatchBaseHit, CatchJudgement> public class CatchRulesetContainer : ScrollingRulesetContainer<CatchPlayfield, CatchBaseHit, CatchJudgement>
{ {
public CatchHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) public CatchRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(ruleset, beatmap, isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset)
{ {
} }

View File

@ -60,7 +60,7 @@
<Compile Include="Objects\Fruit.cs" /> <Compile Include="Objects\Fruit.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UI\CatcherArea.cs" /> <Compile Include="UI\CatcherArea.cs" />
<Compile Include="UI\CatchHitRenderer.cs" /> <Compile Include="UI\CatchRulesetContainer.cs" />
<Compile Include="UI\CatchPlayfield.cs" /> <Compile Include="UI\CatchPlayfield.cs" />
<Compile Include="CatchRuleset.cs" /> <Compile Include="CatchRuleset.cs" />
<Compile Include="Mods\CatchMod.cs" /> <Compile Include="Mods\CatchMod.cs" />

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mania
{ {
public class ManiaRuleset : Ruleset public class ManiaRuleset : Ruleset
{ {
public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new ManiaHitRenderer(this, beatmap, isForCurrentRuleset); public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new ManiaRulesetContainer(this, beatmap, isForCurrentRuleset);
public override IEnumerable<Mod> GetModsFor(ModType type) public override IEnumerable<Mod> GetModsFor(ModType type)
{ {

View File

@ -15,9 +15,9 @@ namespace osu.Game.Rulesets.Mania.Mods
/// <summary> /// <summary>
/// Applies this mod to a hit renderer. /// Applies this mod to a hit renderer.
/// </summary> /// </summary>
/// <param name="hitRenderer">The hit renderer to apply to.</param> /// <param name="rulesetContainer">The hit renderer to apply to.</param>
/// <param name="hitObjectTimingChanges">The per-column list of speed adjustments for hit objects.</param> /// <param name="hitObjectTimingChanges">The per-column list of speed adjustments for hit objects.</param>
/// <param name="barlineTimingChanges">The list of speed adjustments for bar lines.</param> /// <param name="barlineTimingChanges">The list of speed adjustments for bar lines.</param>
void ApplyToHitRenderer(ManiaHitRenderer hitRenderer, ref List<SpeedAdjustmentContainer>[] hitObjectTimingChanges, ref List<SpeedAdjustmentContainer> barlineTimingChanges); void ApplyToRulesetContainer(ManiaRulesetContainer rulesetContainer, ref List<SpeedAdjustmentContainer>[] hitObjectTimingChanges, ref List<SpeedAdjustmentContainer> barlineTimingChanges);
} }
} }

View File

@ -20,12 +20,12 @@ namespace osu.Game.Rulesets.Mania.Mods
public override FontAwesome Icon => FontAwesome.fa_sort_desc; public override FontAwesome Icon => FontAwesome.fa_sort_desc;
public void ApplyToHitRenderer(ManiaHitRenderer hitRenderer, ref List<SpeedAdjustmentContainer>[] hitObjectTimingChanges, ref List<SpeedAdjustmentContainer> barlineTimingChanges) public void ApplyToRulesetContainer(ManiaRulesetContainer rulesetContainer, ref List<SpeedAdjustmentContainer>[] hitObjectTimingChanges, ref List<SpeedAdjustmentContainer> barlineTimingChanges)
{ {
// We have to generate one speed adjustment per hit object for gravity // We have to generate one speed adjustment per hit object for gravity
foreach (ManiaHitObject obj in hitRenderer.Objects) foreach (ManiaHitObject obj in rulesetContainer.Objects)
{ {
MultiplierControlPoint controlPoint = hitRenderer.CreateControlPointAt(obj.StartTime); MultiplierControlPoint controlPoint = rulesetContainer.CreateControlPointAt(obj.StartTime);
// Beat length has too large of an effect for gravity, so we'll force it to a constant value for now // Beat length has too large of an effect for gravity, so we'll force it to a constant value for now
controlPoint.TimingPoint.BeatLength = 1000; controlPoint.TimingPoint.BeatLength = 1000;
@ -33,9 +33,9 @@ namespace osu.Game.Rulesets.Mania.Mods
} }
// Like with hit objects, we need to generate one speed adjustment per bar line // Like with hit objects, we need to generate one speed adjustment per bar line
foreach (DrawableBarLine barLine in hitRenderer.BarLines) foreach (DrawableBarLine barLine in rulesetContainer.BarLines)
{ {
var controlPoint = hitRenderer.CreateControlPointAt(barLine.HitObject.StartTime); var controlPoint = rulesetContainer.CreateControlPointAt(barLine.HitObject.StartTime);
// Beat length has too large of an effect for gravity, so we'll force it to a constant value for now // Beat length has too large of an effect for gravity, so we'll force it to a constant value for now
controlPoint.TimingPoint.BeatLength = 1000; controlPoint.TimingPoint.BeatLength = 1000;

View File

@ -155,8 +155,8 @@ namespace osu.Game.Rulesets.Mania.Scoring
{ {
} }
public ManiaScoreProcessor(HitRenderer<ManiaHitObject, ManiaJudgement> hitRenderer) public ManiaScoreProcessor(RulesetContainer<ManiaHitObject, ManiaJudgement> rulesetContainer)
: base(hitRenderer) : base(rulesetContainer)
{ {
} }

View File

@ -29,7 +29,7 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mania.UI namespace osu.Game.Rulesets.Mania.UI
{ {
public class ManiaHitRenderer : ScrollingHitRenderer<ManiaPlayfield, ManiaHitObject, ManiaJudgement> public class ManiaRulesetContainer : ScrollingRulesetContainer<ManiaPlayfield, ManiaHitObject, ManiaJudgement>
{ {
/// <summary> /// <summary>
/// Preferred column count. This will only have an effect during the initialization of the play field. /// Preferred column count. This will only have an effect during the initialization of the play field.
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.UI
public IEnumerable<DrawableBarLine> BarLines; public IEnumerable<DrawableBarLine> BarLines;
public ManiaHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) public ManiaRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(ruleset, beatmap, isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset)
{ {
// Generate the bar lines // Generate the bar lines

View File

@ -82,7 +82,7 @@
<Compile Include="Timing\GravityScrollingContainer.cs" /> <Compile Include="Timing\GravityScrollingContainer.cs" />
<Compile Include="Timing\ScrollingAlgorithm.cs" /> <Compile Include="Timing\ScrollingAlgorithm.cs" />
<Compile Include="UI\Column.cs" /> <Compile Include="UI\Column.cs" />
<Compile Include="UI\ManiaHitRenderer.cs" /> <Compile Include="UI\ManiaRulesetContainer.cs" />
<Compile Include="UI\ManiaPlayfield.cs" /> <Compile Include="UI\ManiaPlayfield.cs" />
<Compile Include="ManiaRuleset.cs" /> <Compile Include="ManiaRuleset.cs" />
<Compile Include="Mods\ManiaMod.cs" /> <Compile Include="Mods\ManiaMod.cs" />

View File

@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu
{ {
public class OsuRuleset : Ruleset public class OsuRuleset : Ruleset
{ {
public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new OsuHitRenderer(this, beatmap, isForCurrentRuleset); public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new OsuRulesetContainer(this, beatmap, isForCurrentRuleset);
public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new[] public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new[]
{ {

View File

@ -18,8 +18,8 @@ namespace osu.Game.Rulesets.Osu.Scoring
{ {
} }
public OsuScoreProcessor(HitRenderer<OsuHitObject, OsuJudgement> hitRenderer) public OsuScoreProcessor(RulesetContainer<OsuHitObject, OsuJudgement> rulesetContainer)
: base(hitRenderer) : base(rulesetContainer)
{ {
} }

View File

@ -16,9 +16,9 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Osu.UI namespace osu.Game.Rulesets.Osu.UI
{ {
public class OsuHitRenderer : HitRenderer<OsuHitObject, OsuJudgement> public class OsuRulesetContainer : RulesetContainer<OsuHitObject, OsuJudgement>
{ {
public OsuHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) public OsuRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(ruleset, beatmap, isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset)
{ {
} }

View File

@ -80,7 +80,7 @@
<Compile Include="OsuKeyConversionInputManager.cs" /> <Compile Include="OsuKeyConversionInputManager.cs" />
<Compile Include="UI\OsuSettings.cs" /> <Compile Include="UI\OsuSettings.cs" />
<Compile Include="Scoring\OsuScoreProcessor.cs" /> <Compile Include="Scoring\OsuScoreProcessor.cs" />
<Compile Include="UI\OsuHitRenderer.cs" /> <Compile Include="UI\OsuRulesetContainer.cs" />
<Compile Include="UI\OsuPlayfield.cs" /> <Compile Include="UI\OsuPlayfield.cs" />
<Compile Include="OsuRuleset.cs" /> <Compile Include="OsuRuleset.cs" />
<Compile Include="Objects\HitCircle.cs" /> <Compile Include="Objects\HitCircle.cs" />

View File

@ -113,8 +113,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring
{ {
} }
public TaikoScoreProcessor(HitRenderer<TaikoHitObject, TaikoJudgement> hitRenderer) public TaikoScoreProcessor(RulesetContainer<TaikoHitObject, TaikoJudgement> rulesetContainer)
: base(hitRenderer) : base(rulesetContainer)
{ {
} }

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Taiko
{ {
public class TaikoRuleset : Ruleset public class TaikoRuleset : Ruleset
{ {
public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new TaikoHitRenderer(this, beatmap, isForCurrentRuleset); public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new TaikoRulesetContainer(this, beatmap, isForCurrentRuleset);
public override IEnumerable<Mod> GetModsFor(ModType type) public override IEnumerable<Mod> GetModsFor(ModType type)
{ {

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Taiko.UI
public class TaikoPlayfield : Playfield<TaikoHitObject, TaikoJudgement> public class TaikoPlayfield : Playfield<TaikoHitObject, TaikoJudgement>
{ {
/// <summary> /// <summary>
/// Default height of a <see cref="TaikoPlayfield"/> when inside a <see cref="TaikoHitRenderer"/>. /// Default height of a <see cref="TaikoPlayfield"/> when inside a <see cref="TaikoRulesetContainer"/>.
/// </summary> /// </summary>
public const float DEFAULT_HEIGHT = 178; public const float DEFAULT_HEIGHT = 178;

View File

@ -21,9 +21,9 @@ using System.Linq;
namespace osu.Game.Rulesets.Taiko.UI namespace osu.Game.Rulesets.Taiko.UI
{ {
public class TaikoHitRenderer : HitRenderer<TaikoHitObject, TaikoJudgement> public class TaikoRulesetContainer : RulesetContainer<TaikoHitObject, TaikoJudgement>
{ {
public TaikoHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) public TaikoRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(ruleset, beatmap, isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset)
{ {
} }

View File

@ -91,7 +91,7 @@
<Compile Include="UI\KiaiHitExplosion.cs" /> <Compile Include="UI\KiaiHitExplosion.cs" />
<Compile Include="UI\DrawableTaikoJudgement.cs" /> <Compile Include="UI\DrawableTaikoJudgement.cs" />
<Compile Include="UI\HitExplosion.cs" /> <Compile Include="UI\HitExplosion.cs" />
<Compile Include="UI\TaikoHitRenderer.cs" /> <Compile Include="UI\TaikoRulesetContainer.cs" />
<Compile Include="UI\TaikoPlayfield.cs" /> <Compile Include="UI\TaikoPlayfield.cs" />
<Compile Include="TaikoRuleset.cs" /> <Compile Include="TaikoRuleset.cs" />
<Compile Include="Mods\TaikoMod.cs" /> <Compile Include="Mods\TaikoMod.cs" />

View File

@ -62,7 +62,7 @@ namespace osu.Game.Beatmaps
public override Mod GetAutoplayMod() => new ModAutoplay(); public override Mod GetAutoplayMod() => new ModAutoplay();
public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@ -7,16 +7,16 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Mods namespace osu.Game.Rulesets.Mods
{ {
/// <summary> /// <summary>
/// An interface for mods that are applied to a HitRenderer. /// An interface for mods that are applied to a RulesetContainer.
/// </summary> /// </summary>
/// <typeparam name="TObject">The type of HitObject the HitRenderer contains.</typeparam> /// <typeparam name="TObject">The type of HitObject the RulesetContainer contains.</typeparam>
public interface IApplicableMod<TObject> public interface IApplicableMod<TObject>
where TObject : HitObject where TObject : HitObject
{ {
/// <summary> /// <summary>
/// Applies the mod to a HitRenderer. /// Applies the mod to a RulesetContainer.
/// </summary> /// </summary>
/// <param name="hitRenderer">The HitRenderer to apply the mod to.</param> /// <param name="rulesetContainer">The RulesetContainer to apply the mod to.</param>
void ApplyToHitRenderer(HitRenderer<TObject> hitRenderer); void ApplyToRulesetContainer(RulesetContainer<TObject> rulesetContainer);
} }
} }

View File

@ -15,9 +15,9 @@ namespace osu.Game.Rulesets.Mods
{ {
protected abstract Score CreateReplayScore(Beatmap<T> beatmap); protected abstract Score CreateReplayScore(Beatmap<T> beatmap);
public void ApplyToHitRenderer(HitRenderer<T> hitRenderer) public void ApplyToRulesetContainer(RulesetContainer<T> rulesetContainer)
{ {
hitRenderer.SetReplay(CreateReplayScore(hitRenderer.Beatmap)?.Replay); rulesetContainer.SetReplay(CreateReplayScore(rulesetContainer.Beatmap)?.Replay);
} }
} }

View File

@ -35,7 +35,7 @@ namespace osu.Game.Rulesets
/// <param name="isForCurrentRuleset">Whether the hit renderer should assume the beatmap is for the current ruleset.</param> /// <param name="isForCurrentRuleset">Whether the hit renderer should assume the beatmap is for the current ruleset.</param>
/// <exception cref="BeatmapInvalidForRulesetException">Unable to successfully load the beatmap to be usable with this ruleset.</exception> /// <exception cref="BeatmapInvalidForRulesetException">Unable to successfully load the beatmap to be usable with this ruleset.</exception>
/// <returns></returns> /// <returns></returns>
public abstract HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset); public abstract RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset);
public abstract DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap); public abstract DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap);

View File

@ -150,13 +150,13 @@ namespace osu.Game.Rulesets.Scoring
{ {
} }
protected ScoreProcessor(HitRenderer<TObject, TJudgement> hitRenderer) protected ScoreProcessor(RulesetContainer<TObject, TJudgement> rulesetContainer)
{ {
Judgements.Capacity = hitRenderer.Beatmap.HitObjects.Count; Judgements.Capacity = rulesetContainer.Beatmap.HitObjects.Count;
hitRenderer.OnJudgement += AddJudgement; rulesetContainer.OnJudgement += AddJudgement;
ComputeTargets(hitRenderer.Beatmap); ComputeTargets(rulesetContainer.Beatmap);
Reset(); Reset();
} }

View File

@ -23,12 +23,12 @@ using osu.Game.Rulesets.Beatmaps;
namespace osu.Game.Rulesets.UI namespace osu.Game.Rulesets.UI
{ {
/// <summary> /// <summary>
/// Base HitRenderer. Doesn't hold objects. /// Base RulesetContainer. Doesn't hold objects.
/// <para> /// <para>
/// Should not be derived - derive <see cref="HitRenderer{TObject, TJudgement}"/> instead. /// Should not be derived - derive <see cref="RulesetContainer{TObject,TJudgement}"/> instead.
/// </para> /// </para>
/// </summary> /// </summary>
public abstract class HitRenderer : Container public abstract class RulesetContainer : Container
{ {
/// <summary> /// <summary>
/// Invoked when all the judgeable HitObjects have been judged. /// Invoked when all the judgeable HitObjects have been judged.
@ -41,12 +41,12 @@ namespace osu.Game.Rulesets.UI
public bool AspectAdjust = true; public bool AspectAdjust = true;
/// <summary> /// <summary>
/// The input manager for this HitRenderer. /// The input manager for this RulesetContainer.
/// </summary> /// </summary>
internal readonly PlayerInputManager InputManager = new PlayerInputManager(); internal readonly PlayerInputManager InputManager = new PlayerInputManager();
/// <summary> /// <summary>
/// The key conversion input manager for this HitRenderer. /// The key conversion input manager for this RulesetContainer.
/// </summary> /// </summary>
protected readonly PassThroughInputManager KeyConversionInputManager; protected readonly PassThroughInputManager KeyConversionInputManager;
@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.UI
/// A visual representation of a <see cref="Rulesets.Ruleset"/>. /// A visual representation of a <see cref="Rulesets.Ruleset"/>.
/// </summary> /// </summary>
/// <param name="ruleset">The ruleset being repesented.</param> /// <param name="ruleset">The ruleset being repesented.</param>
internal HitRenderer(Ruleset ruleset) internal RulesetContainer(Ruleset ruleset)
{ {
Ruleset = ruleset; Ruleset = ruleset;
KeyConversionInputManager = CreateActionMappingInputManager(); KeyConversionInputManager = CreateActionMappingInputManager();
@ -113,14 +113,14 @@ namespace osu.Game.Rulesets.UI
} }
/// <summary> /// <summary>
/// HitRenderer that applies conversion to Beatmaps. Does not contain a Playfield /// RulesetContainer that applies conversion to Beatmaps. Does not contain a Playfield
/// and does not load drawable hit objects. /// and does not load drawable hit objects.
/// <para> /// <para>
/// Should not be derived - derive <see cref="HitRenderer{TObject, TJudgement}"/> instead. /// Should not be derived - derive <see cref="RulesetContainer{TObject,TJudgement}"/> instead.
/// </para> /// </para>
/// </summary> /// </summary>
/// <typeparam name="TObject">The type of HitObject contained by this HitRenderer.</typeparam> /// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam>
public abstract class HitRenderer<TObject> : HitRenderer public abstract class RulesetContainer<TObject> : RulesetContainer
where TObject : HitObject where TObject : HitObject
{ {
/// <summary> /// <summary>
@ -144,9 +144,9 @@ namespace osu.Game.Rulesets.UI
/// <param name="ruleset">The ruleset being repesented.</param> /// <param name="ruleset">The ruleset being repesented.</param>
/// <param name="beatmap">The beatmap to create the hit renderer for.</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> /// <param name="isForCurrentRuleset">Whether to assume the beatmap is for the current ruleset.</param>
internal HitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset) internal RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset)
{ {
Debug.Assert(beatmap != null, "HitRenderer initialized with a null beatmap."); Debug.Assert(beatmap != null, "RulesetContainer initialized with a null beatmap.");
Mods = beatmap.Mods.Value; Mods = beatmap.Mods.Value;
@ -180,7 +180,7 @@ namespace osu.Game.Rulesets.UI
} }
/// <summary> /// <summary>
/// Applies the active mods to this HitRenderer. /// Applies the active mods to this RulesetContainer.
/// </summary> /// </summary>
/// <param name="mods"></param> /// <param name="mods"></param>
private void applyMods(IEnumerable<Mod> mods) private void applyMods(IEnumerable<Mod> mods)
@ -189,7 +189,7 @@ namespace osu.Game.Rulesets.UI
return; return;
foreach (var mod in mods.OfType<IApplicableMod<TObject>>()) foreach (var mod in mods.OfType<IApplicableMod<TObject>>())
mod.ApplyToHitRenderer(this); mod.ApplyToRulesetContainer(this);
} }
/// <summary> /// <summary>
@ -212,11 +212,11 @@ namespace osu.Game.Rulesets.UI
} }
/// <summary> /// <summary>
/// A derivable HitRenderer that manages the Playfield and HitObjects. /// A derivable RulesetContainer that manages the Playfield and HitObjects.
/// </summary> /// </summary>
/// <typeparam name="TObject">The type of HitObject contained by this HitRenderer.</typeparam> /// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam>
/// <typeparam name="TJudgement">The type of Judgement of DrawableHitObjects contained by this HitRenderer.</typeparam> /// <typeparam name="TJudgement">The type of Judgement of DrawableHitObjects contained by this RulesetContainer.</typeparam>
public abstract class HitRenderer<TObject, TJudgement> : HitRenderer<TObject> public abstract class RulesetContainer<TObject, TJudgement> : RulesetContainer<TObject>
where TObject : HitObject where TObject : HitObject
where TJudgement : Judgement where TJudgement : Judgement
{ {
@ -247,7 +247,7 @@ namespace osu.Game.Rulesets.UI
/// <param name="ruleset">The ruleset being repesented.</param> /// <param name="ruleset">The ruleset being repesented.</param>
/// <param name="beatmap">The beatmap to create the hit renderer for.</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> /// <param name="isForCurrentRuleset">Whether to assume the beatmap is for the current ruleset.</param>
protected HitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) protected RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(ruleset, beatmap, isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset)
{ {
InputManager.Add(content = new Container InputManager.Add(content = new Container
@ -334,12 +334,12 @@ namespace osu.Game.Rulesets.UI
} }
/// <summary> /// <summary>
/// A derivable HitRenderer that manages the Playfield and HitObjects. /// A derivable RulesetContainer that manages the Playfield and HitObjects.
/// </summary> /// </summary>
/// <typeparam name="TPlayfield">The type of Playfield contained by this HitRenderer.</typeparam> /// <typeparam name="TPlayfield">The type of Playfield contained by this RulesetContainer.</typeparam>
/// <typeparam name="TObject">The type of HitObject contained by this HitRenderer.</typeparam> /// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam>
/// <typeparam name="TJudgement">The type of Judgement of DrawableHitObjects contained by this HitRenderer.</typeparam> /// <typeparam name="TJudgement">The type of Judgement of DrawableHitObjects contained by this RulesetContainer.</typeparam>
public abstract class HitRenderer<TPlayfield, TObject, TJudgement> : HitRenderer<TObject, TJudgement> public abstract class RulesetContainer<TPlayfield, TObject, TJudgement> : RulesetContainer<TObject, TJudgement>
where TObject : HitObject where TObject : HitObject
where TJudgement : Judgement where TJudgement : Judgement
where TPlayfield : Playfield<TObject, TJudgement> where TPlayfield : Playfield<TObject, TJudgement>
@ -355,7 +355,7 @@ namespace osu.Game.Rulesets.UI
/// <param name="ruleset">The ruleset being repesented.</param> /// <param name="ruleset">The ruleset being repesented.</param>
/// <param name="beatmap">The beatmap to create the hit renderer for.</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> /// <param name="isForCurrentRuleset">Whether to assume the beatmap is for the current ruleset.</param>
protected HitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) protected RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(ruleset, beatmap, isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset)
{ {
} }

View File

@ -17,22 +17,22 @@ using osu.Game.Rulesets.Timing;
namespace osu.Game.Rulesets.UI namespace osu.Game.Rulesets.UI
{ {
/// <summary> /// <summary>
/// A type of <see cref="HitRenderer{TPlayfield, TObject, TJudgement}"/> that supports a <see cref="ScrollingPlayfield{TObject, TJudgement}"/>. /// A type of <see cref="RulesetContainer{TPlayfield,TObject,TJudgement}"/> that supports a <see cref="ScrollingPlayfield{TObject, TJudgement}"/>.
/// <see cref="HitObject"/>s inside this <see cref="HitRenderer{TPlayfield, TObject, TJudgement}"/> will scroll within the playfield. /// <see cref="HitObject"/>s inside this <see cref="RulesetContainer{TPlayfield,TObject,TJudgement}"/> will scroll within the playfield.
/// </summary> /// </summary>
public abstract class ScrollingHitRenderer<TPlayfield, TObject, TJudgement> : HitRenderer<TPlayfield, TObject, TJudgement> public abstract class ScrollingRulesetContainer<TPlayfield, TObject, TJudgement> : RulesetContainer<TPlayfield, TObject, TJudgement>
where TObject : HitObject where TObject : HitObject
where TJudgement : Judgement where TJudgement : Judgement
where TPlayfield : ScrollingPlayfield<TObject, TJudgement> where TPlayfield : ScrollingPlayfield<TObject, TJudgement>
{ {
/// <summary> /// <summary>
/// Provides the default <see cref="MultiplierControlPoint"/>s that adjust the scrolling rate of <see cref="HitObject"/>s /// Provides the default <see cref="MultiplierControlPoint"/>s that adjust the scrolling rate of <see cref="HitObject"/>s
/// inside this <see cref="HitRenderer{TPlayfield, TObject, TJudgement}"/>. /// inside this <see cref="RulesetContainer{TPlayfield,TObject,TJudgement}"/>.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected readonly SortedList<MultiplierControlPoint> DefaultControlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default); protected readonly SortedList<MultiplierControlPoint> DefaultControlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default);
protected ScrollingHitRenderer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) protected ScrollingRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
: base(ruleset, beatmap, isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset)
{ {
} }

View File

@ -90,11 +90,11 @@ namespace osu.Game.Screens.Play
} }
} }
public virtual void BindHitRenderer(HitRenderer hitRenderer) public virtual void BindRulesetContainer(RulesetContainer rulesetContainer)
{ {
hitRenderer.InputManager.Add(KeyCounter.GetReceptor()); rulesetContainer.InputManager.Add(KeyCounter.GetReceptor());
replayLoaded = hitRenderer.HasReplayLoaded; replayLoaded = rulesetContainer.HasReplayLoaded;
// in the case a replay isn't loaded, we want some elements to only appear briefly. // in the case a replay isn't loaded, we want some elements to only appear briefly.
if (!replayLoaded) if (!replayLoaded)

View File

@ -32,7 +32,7 @@ namespace osu.Game.Screens.Play
internal override bool ShowOverlays => false; internal override bool ShowOverlays => false;
internal override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && HitRenderer.ProvidingUserCursor; internal override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && RulesetContainer.ProvidingUserCursor;
public Action RestartRequested; public Action RestartRequested;
@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play
private RulesetInfo ruleset; private RulesetInfo ruleset;
private ScoreProcessor scoreProcessor; private ScoreProcessor scoreProcessor;
protected HitRenderer HitRenderer; protected RulesetContainer RulesetContainer;
#region User Settings #region User Settings
@ -66,7 +66,7 @@ namespace osu.Game.Screens.Play
private HUDOverlay hudOverlay; private HUDOverlay hudOverlay;
private FailOverlay failOverlay; private FailOverlay failOverlay;
private bool loadedSuccessfully => HitRenderer?.Objects.Any() == true; private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true;
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(AudioManager audio, OsuConfigManager config, OsuGame osu) private void load(AudioManager audio, OsuConfigManager config, OsuGame osu)
@ -93,18 +93,18 @@ namespace osu.Game.Screens.Play
try try
{ {
HitRenderer = rulesetInstance.CreateHitRendererWith(working, ruleset.ID == beatmap.BeatmapInfo.Ruleset.ID); RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working, ruleset.ID == beatmap.BeatmapInfo.Ruleset.ID);
} }
catch (BeatmapInvalidForRulesetException) catch (BeatmapInvalidForRulesetException)
{ {
// we may fail to create a HitRenderer if the beatmap cannot be loaded with the user's preferred ruleset // we may fail to create a RulesetContainer if the beatmap cannot be loaded with the user's preferred ruleset
// let's try again forcing the beatmap's ruleset. // let's try again forcing the beatmap's ruleset.
ruleset = beatmap.BeatmapInfo.Ruleset; ruleset = beatmap.BeatmapInfo.Ruleset;
rulesetInstance = ruleset.CreateInstance(); rulesetInstance = ruleset.CreateInstance();
HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap, true); RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap, true);
} }
if (!HitRenderer.Objects.Any()) if (!RulesetContainer.Objects.Any())
throw new InvalidOperationException("Beatmap contains no hit objects!"); throw new InvalidOperationException("Beatmap contains no hit objects!");
} }
catch (Exception e) catch (Exception e)
@ -119,7 +119,7 @@ namespace osu.Game.Screens.Play
adjustableSourceClock = (IAdjustableClock)working.Track ?? new StopwatchClock(); adjustableSourceClock = (IAdjustableClock)working.Track ?? new StopwatchClock();
decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
var firstObjectTime = HitRenderer.Objects.First().StartTime; var firstObjectTime = RulesetContainer.Objects.First().StartTime;
decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn))); decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn)));
decoupledClock.ProcessFrame(); decoupledClock.ProcessFrame();
@ -147,7 +147,7 @@ namespace osu.Game.Screens.Play
FramedClock = offsetClock, FramedClock = offsetClock,
OnRetry = Restart, OnRetry = Restart,
OnQuit = Exit, OnQuit = Exit,
CheckCanPause = () => ValidForResume && !HasFailed && !HitRenderer.HasReplayLoaded, CheckCanPause = () => ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
Retries = RestartCount, Retries = RestartCount,
OnPause = () => { OnPause = () => {
hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused; hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused;
@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play
Clock = offsetClock, Clock = offsetClock,
Children = new Drawable[] Children = new Drawable[]
{ {
HitRenderer, RulesetContainer,
} }
}, },
hudOverlay = new HUDOverlay hudOverlay = new HUDOverlay
@ -184,27 +184,27 @@ namespace osu.Game.Screens.Play
Action = () => { Action = () => {
//we want to hide the hitrenderer immediately (looks better). //we want to hide the hitrenderer immediately (looks better).
//we may be able to remove this once the mouse cursor trail is improved. //we may be able to remove this once the mouse cursor trail is improved.
HitRenderer?.Hide(); RulesetContainer?.Hide();
Restart(); Restart();
}, },
} }
}; };
scoreProcessor = HitRenderer.CreateScoreProcessor(); scoreProcessor = RulesetContainer.CreateScoreProcessor();
hudOverlay.KeyCounter.AddRange(rulesetInstance.CreateGameplayKeys()); hudOverlay.KeyCounter.AddRange(rulesetInstance.CreateGameplayKeys());
hudOverlay.BindProcessor(scoreProcessor); hudOverlay.BindProcessor(scoreProcessor);
hudOverlay.BindHitRenderer(HitRenderer); hudOverlay.BindRulesetContainer(RulesetContainer);
hudOverlay.Progress.Objects = HitRenderer.Objects; hudOverlay.Progress.Objects = RulesetContainer.Objects;
hudOverlay.Progress.AudioClock = decoupledClock; hudOverlay.Progress.AudioClock = decoupledClock;
hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded; hudOverlay.Progress.AllowSeeking = RulesetContainer.HasReplayLoaded;
hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos); hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos);
hudOverlay.ModDisplay.Current.BindTo(working.Mods); hudOverlay.ModDisplay.Current.BindTo(working.Mods);
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation) //bind RulesetContainer to ScoreProcessor and ourselves (for a pass situation)
HitRenderer.OnAllJudged += onCompletion; RulesetContainer.OnAllJudged += onCompletion;
//bind ScoreProcessor to ourselves (for a fail situation) //bind ScoreProcessor to ourselves (for a fail situation)
scoreProcessor.Failed += onFail; scoreProcessor.Failed += onFail;
@ -238,7 +238,7 @@ namespace osu.Game.Screens.Play
Ruleset = ruleset Ruleset = ruleset
}; };
scoreProcessor.PopulateScore(score); scoreProcessor.PopulateScore(score);
score.User = HitRenderer.Replay?.User ?? (Game as OsuGame)?.API?.LocalUser?.Value; score.User = RulesetContainer.Replay?.User ?? (Game as OsuGame)?.API?.LocalUser?.Value;
Push(new Results(score)); Push(new Results(score));
}); });
} }
@ -295,7 +295,7 @@ namespace osu.Game.Screens.Play
protected override bool OnExiting(Screen next) protected override bool OnExiting(Screen next)
{ {
if (HasFailed || !ValidForResume || pauseContainer?.AllowExit != false || HitRenderer?.HasReplayLoaded != false) if (HasFailed || !ValidForResume || pauseContainer?.AllowExit != false || RulesetContainer?.HasReplayLoaded != false)
{ {
fadeOut(); fadeOut();
return base.OnExiting(next); return base.OnExiting(next);
@ -313,7 +313,7 @@ namespace osu.Game.Screens.Play
{ {
const float fade_out_duration = 250; const float fade_out_duration = 250;
HitRenderer?.FadeOut(fade_out_duration); RulesetContainer?.FadeOut(fade_out_duration);
Content.FadeOut(fade_out_duration); Content.FadeOut(fade_out_duration);
hudOverlay?.ScaleTo(0.7f, fade_out_duration * 3, Easing.In); hudOverlay?.ScaleTo(0.7f, fade_out_duration * 3, Easing.In);

View File

@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
HitRenderer.SetReplay(Replay); RulesetContainer.SetReplay(Replay);
} }
} }
} }

View File

@ -338,9 +338,9 @@
<Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" /> <Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" />
<Compile Include="Screens\Select\PlaySongSelect.cs" /> <Compile Include="Screens\Select\PlaySongSelect.cs" />
<Compile Include="Screens\Select\SongSelect.cs" /> <Compile Include="Screens\Select\SongSelect.cs" />
<Compile Include="Rulesets\UI\HitRenderer.cs" /> <Compile Include="Rulesets\UI\RulesetContainer.cs" />
<Compile Include="Rulesets\UI\Playfield.cs" /> <Compile Include="Rulesets\UI\Playfield.cs" />
<Compile Include="Rulesets\UI\ScrollingHitRenderer.cs" /> <Compile Include="Rulesets\UI\ScrollingRulesetContainer.cs" />
<Compile Include="Rulesets\UI\ScrollingPlayfield.cs" /> <Compile Include="Rulesets\UI\ScrollingPlayfield.cs" />
<Compile Include="Screens\Select\EditSongSelect.cs" /> <Compile Include="Screens\Select\EditSongSelect.cs" />
<Compile Include="Screens\Play\HUD\ComboCounter.cs" /> <Compile Include="Screens\Play\HUD\ComboCounter.cs" />