1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 10:27:35 +08:00
osu-lazer/osu.Game/GameModes/Play/Player.cs

91 lines
2.9 KiB
C#
Raw Normal View History

2016-09-29 19:13:58 +08:00
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
2016-10-05 19:49:31 +08:00
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Objects;
2016-10-06 22:33:09 +08:00
using osu.Game.GameModes.Backgrounds;
2016-10-05 19:49:31 +08:00
using osu.Game.GameModes.Play.Catch;
using osu.Game.GameModes.Play.Mania;
using osu.Game.GameModes.Play.Osu;
using osu.Game.GameModes.Play.Taiko;
2016-10-10 16:17:26 +08:00
using osu.Framework;
2016-09-29 19:13:58 +08:00
namespace osu.Game.GameModes.Play
{
public class Player : OsuGameMode
2016-09-29 19:13:58 +08:00
{
2016-10-05 19:03:52 +08:00
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
public Beatmap Beatmap;
public PlayMode PlayMode;
2016-10-05 19:49:31 +08:00
2016-10-10 16:17:26 +08:00
public override void Load(BaseGame game)
2016-10-05 19:49:31 +08:00
{
2016-10-10 16:17:26 +08:00
base.Load(game);
2016-10-05 19:49:31 +08:00
Beatmap beatmap = new Beatmap
{
HitObjects = Beatmap?.HitObjects ?? new List<HitObject>()
2016-10-05 19:49:31 +08:00
};
HitRenderer hitRenderer;
ScoreOverlay scoreOverlay;
switch (PlayMode)
2016-10-05 19:49:31 +08:00
{
default:
scoreOverlay = new ScoreOverlayOsu();
hitRenderer = new OsuHitRenderer
2016-10-05 19:49:31 +08:00
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
2016-10-05 19:49:31 +08:00
break;
case PlayMode.Taiko:
scoreOverlay = null;
hitRenderer = new TaikoHitRenderer
2016-10-05 19:49:31 +08:00
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
2016-10-05 19:49:31 +08:00
break;
case PlayMode.Catch:
scoreOverlay = null;
hitRenderer = new CatchHitRenderer
2016-10-05 19:49:31 +08:00
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
2016-10-05 19:49:31 +08:00
break;
case PlayMode.Mania:
scoreOverlay = null;
hitRenderer = new ManiaHitRenderer
2016-10-05 19:49:31 +08:00
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
2016-10-05 19:49:31 +08:00
break;
}
2016-10-06 22:33:09 +08:00
hitRenderer.OnHit += delegate (HitObject h) { scoreOverlay.OnHit(h); };
hitRenderer.OnMiss += delegate (HitObject h) { scoreOverlay.OnMiss(h); };
Children = new Drawable[]
2016-10-06 22:33:09 +08:00
{
hitRenderer,
scoreOverlay,
};
2016-10-05 19:49:31 +08:00
}
2016-09-29 19:13:58 +08:00
}
2016-10-05 19:49:31 +08:00
}