diff --git a/osu.Game/GameModes/Play/HitRenderer.cs b/osu.Game/GameModes/Play/HitRenderer.cs index d77aaab50f..e693da527d 100644 --- a/osu.Game/GameModes/Play/HitRenderer.cs +++ b/osu.Game/GameModes/Play/HitRenderer.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps.Objects; using osu.Framework; using System; +using System.Linq; namespace osu.Game.GameModes.Play { @@ -14,6 +15,10 @@ namespace osu.Game.GameModes.Play { public Action OnHit; public Action OnMiss; + + protected Playfield Playfield; + + public IEnumerable DrawableObjects => Playfield.Children.Cast(); } public abstract class HitRenderer : HitRenderer @@ -31,8 +36,6 @@ namespace osu.Game.GameModes.Play } } - private Playfield playfield; - protected abstract Playfield CreatePlayfield(); protected abstract HitObjectConverter Converter { get; } @@ -47,7 +50,7 @@ namespace osu.Game.GameModes.Play Children = new Drawable[] { - playfield = CreatePlayfield() + Playfield = CreatePlayfield() }; loadObjects(); @@ -65,7 +68,7 @@ namespace osu.Game.GameModes.Play drawableObject.OnHit = onHit; drawableObject.OnMiss = onMiss; - playfield.Add(drawableObject); + Playfield.Add(drawableObject); } } diff --git a/osu.Game/GameModes/Play/Osu/OsuPlayfield.cs b/osu.Game/GameModes/Play/Osu/OsuPlayfield.cs index 111dd608c1..59ce1699e4 100644 --- a/osu.Game/GameModes/Play/Osu/OsuPlayfield.cs +++ b/osu.Game/GameModes/Play/Osu/OsuPlayfield.cs @@ -12,19 +12,17 @@ namespace osu.Game.GameModes.Play.Osu { public class OsuPlayfield : Playfield { + protected override Container Content => hitObjectContainer; + + private Container hitObjectContainer; + public OsuPlayfield() { - Size = new Vector2(512, 384); - Scale = new Vector2(1.6f); Anchor = Anchor.Centre; Origin = Anchor.Centre; - } + Size = new Vector2(512, 384); - protected override void Load(BaseGame game) - { - base.Load(game); - - Add(new Box() + AddInternal(new Box { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -32,6 +30,11 @@ namespace osu.Game.GameModes.Play.Osu Colour = Color4.Black, Alpha = 0.5f }); + + AddInternal(hitObjectContainer = new Container + { + RelativeSizeAxes = Axes.Both + }); } } } \ No newline at end of file diff --git a/osu.Game/GameModes/Play/Player.cs b/osu.Game/GameModes/Play/Player.cs index 860e077588..d48e252fa5 100644 --- a/osu.Game/GameModes/Play/Player.cs +++ b/osu.Game/GameModes/Play/Player.cs @@ -2,7 +2,6 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Game.Beatmaps; using osu.Game.Beatmaps.Objects; using osu.Game.GameModes.Backgrounds; using osu.Game.GameModes.Play.Catch; @@ -12,13 +11,15 @@ using osu.Game.GameModes.Play.Taiko; using osu.Framework; using osu.Game.Database; using osu.Framework.Timing; -using osu.Framework.GameModes; using osu.Framework.Audio.Track; +using osu.Framework.Extensions.IEnumerableExtensions; namespace osu.Game.GameModes.Play { public class Player : OsuGameMode { + const bool autoplay = false; + protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4"); public BeatmapInfo BeatmapInfo; @@ -124,6 +125,9 @@ namespace osu.Game.GameModes.Play hitRenderer.OnHit += delegate (HitObject h) { scoreOverlay.OnHit(h); }; hitRenderer.OnMiss += delegate (HitObject h) { scoreOverlay.OnMiss(h); }; + if (autoplay) + hitRenderer.Schedule(() => hitRenderer.DrawableObjects.ForEach(h => h.State = ArmedState.Armed)); + Children = new Drawable[] { hitRenderer,