osu/osu.Game/GameModes/Play/Player.cs

97 lines
3.1 KiB
C#
Raw Normal View History

2016-09-29 11:13:58 +00: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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2016-10-05 11:49:31 +00:00
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;
2016-10-06 14:33:09 +00:00
using osu.Game.GameModes.Backgrounds;
2016-10-05 11:49:31 +00: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-06 14:33:09 +00:00
using osu.Game.Graphics.UserInterface;
2016-10-05 11:49:31 +00:00
using OpenTK;
2016-10-06 14:33:09 +00:00
using OpenTK.Input;
2016-10-10 08:17:26 +00:00
using osu.Framework;
2016-09-29 11:13:58 +00:00
namespace osu.Game.GameModes.Play
{
public class Player : OsuGameMode
2016-09-29 11:13:58 +00:00
{
2016-10-05 11:03:52 +00:00
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
public Beatmap Beatmap;
public PlayMode PlayMode;
2016-10-05 11:49:31 +00:00
2016-10-10 08:17:26 +00:00
public override void Load(BaseGame game)
2016-10-05 11:49:31 +00:00
{
2016-10-10 08:17:26 +00:00
base.Load(game);
2016-10-05 11:49:31 +00:00
Beatmap beatmap = new Beatmap
{
HitObjects = Beatmap?.HitObjects ?? new List<HitObject>()
2016-10-05 11:49:31 +00:00
};
switch (PlayMode)
2016-10-05 11:49:31 +00:00
{
case PlayMode.Osu:
Add(new OsuHitRenderer
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
break;
case PlayMode.Taiko:
Add(new TaikoHitRenderer
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
break;
case PlayMode.Catch:
Add(new CatchHitRenderer
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
break;
case PlayMode.Mania:
Add(new ManiaHitRenderer
{
Objects = beatmap.HitObjects,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
break;
}
2016-10-06 14:33:09 +00:00
Add(new KeyCounterCollection
{
IsCounting = true,
FadeTime = 50,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Position = new Vector2(10, 50),
Counters = new KeyCounter[]
{
new KeyCounterKeyboard(@"Z", Key.Z),
new KeyCounterKeyboard(@"X", Key.X),
new KeyCounterMouse(@"M1", MouseButton.Left),
new KeyCounterMouse(@"M2", MouseButton.Right),
}
});
2016-10-05 11:49:31 +00:00
}
2016-09-29 11:13:58 +00:00
}
2016-10-05 11:49:31 +00:00
}