mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 07:23:14 +08:00
Add autoplay toggle (const).
This commit is contained in:
parent
f5f5aa9eac
commit
788cba6f4d
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Beatmaps.Objects;
|
using osu.Game.Beatmaps.Objects;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
@ -14,6 +15,10 @@ namespace osu.Game.GameModes.Play
|
|||||||
{
|
{
|
||||||
public Action<HitObject> OnHit;
|
public Action<HitObject> OnHit;
|
||||||
public Action<HitObject> OnMiss;
|
public Action<HitObject> OnMiss;
|
||||||
|
|
||||||
|
protected Playfield Playfield;
|
||||||
|
|
||||||
|
public IEnumerable<DrawableHitObject> DrawableObjects => Playfield.Children.Cast<DrawableHitObject>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class HitRenderer<T> : HitRenderer
|
public abstract class HitRenderer<T> : HitRenderer
|
||||||
@ -31,8 +36,6 @@ namespace osu.Game.GameModes.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Playfield playfield;
|
|
||||||
|
|
||||||
protected abstract Playfield CreatePlayfield();
|
protected abstract Playfield CreatePlayfield();
|
||||||
|
|
||||||
protected abstract HitObjectConverter<T> Converter { get; }
|
protected abstract HitObjectConverter<T> Converter { get; }
|
||||||
@ -47,7 +50,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
playfield = CreatePlayfield()
|
Playfield = CreatePlayfield()
|
||||||
};
|
};
|
||||||
|
|
||||||
loadObjects();
|
loadObjects();
|
||||||
@ -65,7 +68,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
drawableObject.OnHit = onHit;
|
drawableObject.OnHit = onHit;
|
||||||
drawableObject.OnMiss = onMiss;
|
drawableObject.OnMiss = onMiss;
|
||||||
|
|
||||||
playfield.Add(drawableObject);
|
Playfield.Add(drawableObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,19 +12,17 @@ namespace osu.Game.GameModes.Play.Osu
|
|||||||
{
|
{
|
||||||
public class OsuPlayfield : Playfield
|
public class OsuPlayfield : Playfield
|
||||||
{
|
{
|
||||||
|
protected override Container Content => hitObjectContainer;
|
||||||
|
|
||||||
|
private Container hitObjectContainer;
|
||||||
|
|
||||||
public OsuPlayfield()
|
public OsuPlayfield()
|
||||||
{
|
{
|
||||||
Size = new Vector2(512, 384);
|
|
||||||
Scale = new Vector2(1.6f);
|
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
}
|
Size = new Vector2(512, 384);
|
||||||
|
|
||||||
protected override void Load(BaseGame game)
|
AddInternal(new Box
|
||||||
{
|
|
||||||
base.Load(game);
|
|
||||||
|
|
||||||
Add(new Box()
|
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -32,6 +30,11 @@ namespace osu.Game.GameModes.Play.Osu
|
|||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
Alpha = 0.5f
|
Alpha = 0.5f
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddInternal(hitObjectContainer = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,6 @@
|
|||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Beatmaps.Objects;
|
using osu.Game.Beatmaps.Objects;
|
||||||
using osu.Game.GameModes.Backgrounds;
|
using osu.Game.GameModes.Backgrounds;
|
||||||
using osu.Game.GameModes.Play.Catch;
|
using osu.Game.GameModes.Play.Catch;
|
||||||
@ -12,13 +11,15 @@ using osu.Game.GameModes.Play.Taiko;
|
|||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Framework.GameModes;
|
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
public class Player : OsuGameMode
|
public class Player : OsuGameMode
|
||||||
{
|
{
|
||||||
|
const bool autoplay = false;
|
||||||
|
|
||||||
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
||||||
|
|
||||||
public BeatmapInfo BeatmapInfo;
|
public BeatmapInfo BeatmapInfo;
|
||||||
@ -124,6 +125,9 @@ namespace osu.Game.GameModes.Play
|
|||||||
hitRenderer.OnHit += delegate (HitObject h) { scoreOverlay.OnHit(h); };
|
hitRenderer.OnHit += delegate (HitObject h) { scoreOverlay.OnHit(h); };
|
||||||
hitRenderer.OnMiss += delegate (HitObject h) { scoreOverlay.OnMiss(h); };
|
hitRenderer.OnMiss += delegate (HitObject h) { scoreOverlay.OnMiss(h); };
|
||||||
|
|
||||||
|
if (autoplay)
|
||||||
|
hitRenderer.Schedule(() => hitRenderer.DrawableObjects.ForEach(h => h.State = ArmedState.Armed));
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
hitRenderer,
|
hitRenderer,
|
||||||
|
Loading…
Reference in New Issue
Block a user