1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Make play modes display playfield.

This commit is contained in:
Dean Herbert 2016-10-05 20:49:31 +09:00
parent c0f25a2683
commit b588f28856
2 changed files with 85 additions and 2 deletions

View File

@ -8,6 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Drawables;
using osu.Game.Beatmaps.Objects;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.GameModes.Play
{
@ -24,7 +25,12 @@ namespace osu.Game.GameModes.Play
{
base.Load();
Add(new Box() { RelativeSizeAxes = Axes.Both, Alpha = 0.1f, Scale = new Vector2(0.99f) });
Add(new Box()
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.8f,
Colour = new Color4(5, 5, 5, 255),
});
}
}
}

View File

@ -6,6 +6,17 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Objects;
using osu.Game.Beatmaps.Objects.Osu;
using osu.Game.GameModes.Play.Catch;
using osu.Game.GameModes.Play.Mania;
using osu.Game.GameModes.Play.Osu;
using osu.Game.GameModes.Play.Taiko;
using OpenTK;
namespace osu.Game.GameModes.Play
{
@ -16,5 +27,71 @@ namespace osu.Game.GameModes.Play
protected override IEnumerable<Type> PossibleChildren => new[] {
typeof(Results)
};
public override void Load()
{
base.Load();
List<HitObject> objects = new List<HitObject>();
double time = Time + 1000;
for (int i = 0; i < 100; i++)
{
objects.Add(new Circle()
{
StartTime = time,
Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384))
});
time += RNG.Next(50, 500);
}
Beatmap beatmap = new Beatmap
{
HitObjects = objects
};
OsuGame osu = Game as OsuGame;
switch (osu.PlayMode.Value)
{
case PlayMode.Osu:
Add(new OsuHitRenderer
{
Objects = beatmap.HitObjects,
Scale = new Vector2(0.8f),
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
break;
case PlayMode.Taiko:
Add(new TaikoHitRenderer
{
Objects = beatmap.HitObjects,
Scale = new Vector2(0.8f),
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
break;
case PlayMode.Catch:
Add(new CatchHitRenderer
{
Objects = beatmap.HitObjects,
Scale = new Vector2(0.8f),
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
break;
case PlayMode.Mania:
Add(new ManiaHitRenderer
{
Objects = beatmap.HitObjects,
Scale = new Vector2(0.8f),
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
break;
}
}
}
}
}