1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:42:54 +08:00

Implement TaikoModAutoplay.

This commit is contained in:
smoogipooo 2017-03-29 11:04:16 +09:00
parent 589bdde03c
commit 475c865968
3 changed files with 21 additions and 10 deletions

View File

@ -1,7 +1,10 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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.Game.Beatmaps;
using osu.Game.Modes.Mods; using osu.Game.Modes.Mods;
using osu.Game.Modes.Scoring;
using osu.Game.Modes.Taiko.Objects;
namespace osu.Game.Modes.Taiko.Mods namespace osu.Game.Modes.Taiko.Mods
{ {
@ -61,4 +64,12 @@ namespace osu.Game.Modes.Taiko.Mods
{ {
} }
public class TaikoModAutoplay : ModAutoplay<TaikoHitObject>
{
protected override Score CreateReplayScore(Beatmap<TaikoHitObject> beatmap) => new Score
{
Replay = new TaikoAutoReplay(beatmap)
};
}
} }

View File

@ -1,19 +1,19 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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 System.Collections.Generic;
using osu.Game.Modes.Taiko.Objects; using osu.Game.Modes.Taiko.Objects;
using osu.Game.Modes.Objects.Types; using osu.Game.Modes.Objects.Types;
using osu.Game.Beatmaps;
namespace osu.Game.Modes.Taiko namespace osu.Game.Modes.Taiko
{ {
public class TaikoAutoReplay : LegacyTaikoReplay public class TaikoAutoReplay : LegacyTaikoReplay
{ {
private readonly List<TaikoHitObject> hitObjects; private readonly Beatmap<TaikoHitObject> beatmap;
public TaikoAutoReplay(List<TaikoHitObject> hitObjects) public TaikoAutoReplay(Beatmap<TaikoHitObject> beatmap)
{ {
this.hitObjects = hitObjects; this.beatmap = beatmap;
createAutoReplay(); createAutoReplay();
} }
@ -23,11 +23,11 @@ namespace osu.Game.Modes.Taiko
bool hitButton = true; bool hitButton = true;
Frames.Add(new LegacyReplayFrame(-100000, 320, 240, LegacyButtonState.None)); Frames.Add(new LegacyReplayFrame(-100000, 320, 240, LegacyButtonState.None));
Frames.Add(new LegacyReplayFrame(hitObjects[0].StartTime - 1000, 320, 240, LegacyButtonState.None)); Frames.Add(new LegacyReplayFrame(beatmap.HitObjects[0].StartTime - 1000, 320, 240, LegacyButtonState.None));
for (int i = 0; i < hitObjects.Count; i++) for (int i = 0; i < beatmap.HitObjects.Count; i++)
{ {
TaikoHitObject h = hitObjects[i]; TaikoHitObject h = beatmap.HitObjects[i];
LegacyButtonState button; LegacyButtonState button;
@ -104,9 +104,9 @@ namespace osu.Game.Modes.Taiko
Frames.Add(new LegacyReplayFrame(endTime + 1, 0, 0, LegacyButtonState.None)); Frames.Add(new LegacyReplayFrame(endTime + 1, 0, 0, LegacyButtonState.None));
if (i < hitObjects.Count - 1) if (i < beatmap.HitObjects.Count - 1)
{ {
double waitTime = hitObjects[i + 1].StartTime - 1000; double waitTime = beatmap.HitObjects[i + 1].StartTime - 1000;
if (waitTime > endTime) if (waitTime > endTime)
Frames.Add(new LegacyReplayFrame(waitTime, 0, 0, LegacyButtonState.None)); Frames.Add(new LegacyReplayFrame(waitTime, 0, 0, LegacyButtonState.None));
} }

View File

@ -65,7 +65,7 @@ namespace osu.Game.Modes.Taiko
{ {
Mods = new Mod[] Mods = new Mod[]
{ {
new ModAutoplay(), new TaikoModAutoplay(),
new ModCinema(), new ModCinema(),
}, },
}, },