mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:52:55 +08:00
Update to match new replay structure.
This commit is contained in:
parent
fb6f27a439
commit
8f37d1ad91
@ -1,52 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Input.Handlers;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Modes.Taiko
|
||||
{
|
||||
public class LegacyTaikoReplay : LegacyReplay
|
||||
{
|
||||
protected LegacyTaikoReplay()
|
||||
{
|
||||
}
|
||||
|
||||
public LegacyTaikoReplay(StreamReader reader)
|
||||
: base(reader)
|
||||
{
|
||||
}
|
||||
|
||||
public override ReplayInputHandler CreateInputHandler() => new LegacyTaikoReplayInputHandler(Frames);
|
||||
|
||||
private class LegacyTaikoReplayInputHandler : LegacyReplayInputHandler
|
||||
{
|
||||
public LegacyTaikoReplayInputHandler(List<LegacyReplayFrame> replayContent)
|
||||
: base(replayContent)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<InputState> GetPendingStates()
|
||||
{
|
||||
var keys = new List<Key>();
|
||||
|
||||
if (CurrentFrame?.MouseRight1 == true)
|
||||
keys.Add(Key.F);
|
||||
if (CurrentFrame?.MouseRight2 == true)
|
||||
keys.Add(Key.J);
|
||||
if (CurrentFrame?.MouseLeft1 == true)
|
||||
keys.Add(Key.D);
|
||||
if (CurrentFrame?.MouseLeft2 == true)
|
||||
keys.Add(Key.K);
|
||||
|
||||
return new List<InputState>
|
||||
{
|
||||
new InputState { Keyboard = new ReplayKeyboardState(keys) }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Modes.Mods;
|
||||
using osu.Game.Modes.Scoring;
|
||||
using osu.Game.Modes.Taiko.Objects;
|
||||
using osu.Game.Modes.Taiko.Replays;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Mods
|
||||
|
@ -1,14 +1,15 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Modes.Taiko.Objects;
|
||||
using osu.Game.Modes.Objects.Types;
|
||||
using osu.Game.Beatmaps;
|
||||
using System;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Modes.Objects.Types;
|
||||
using osu.Game.Modes.Taiko.Objects;
|
||||
using osu.Game.Modes.Replays;
|
||||
|
||||
namespace osu.Game.Modes.Taiko
|
||||
namespace osu.Game.Modes.Taiko.Replays
|
||||
{
|
||||
public class TaikoAutoReplay : LegacyTaikoReplay
|
||||
public class TaikoAutoReplay : Replay
|
||||
{
|
||||
private readonly Beatmap<TaikoHitObject> beatmap;
|
||||
|
||||
@ -23,14 +24,14 @@ namespace osu.Game.Modes.Taiko
|
||||
{
|
||||
bool hitButton = true;
|
||||
|
||||
Frames.Add(new LegacyReplayFrame(-100000, 320, 240, LegacyButtonState.None));
|
||||
Frames.Add(new LegacyReplayFrame(beatmap.HitObjects[0].StartTime - 1000, 320, 240, LegacyButtonState.None));
|
||||
Frames.Add(new ReplayFrame(-100000, 320, 240, ReplayButtonState.None));
|
||||
Frames.Add(new ReplayFrame(beatmap.HitObjects[0].StartTime - 1000, 320, 240, ReplayButtonState.None));
|
||||
|
||||
for (int i = 0; i < beatmap.HitObjects.Count; i++)
|
||||
{
|
||||
TaikoHitObject h = beatmap.HitObjects[i];
|
||||
|
||||
LegacyButtonState button;
|
||||
ReplayButtonState button;
|
||||
|
||||
IHasEndTime endTimeData = h as IHasEndTime;
|
||||
double endTime = endTimeData?.EndTime ?? h.StartTime;
|
||||
@ -50,20 +51,20 @@ namespace osu.Game.Modes.Taiko
|
||||
switch (d)
|
||||
{
|
||||
default:
|
||||
button = LegacyButtonState.Left1;
|
||||
button = ReplayButtonState.Left1;
|
||||
break;
|
||||
case 1:
|
||||
button = LegacyButtonState.Right1;
|
||||
button = ReplayButtonState.Right1;
|
||||
break;
|
||||
case 2:
|
||||
button = LegacyButtonState.Left2;
|
||||
button = ReplayButtonState.Left2;
|
||||
break;
|
||||
case 3:
|
||||
button = LegacyButtonState.Right2;
|
||||
button = ReplayButtonState.Right2;
|
||||
break;
|
||||
}
|
||||
|
||||
Frames.Add(new LegacyReplayFrame(j, 0, 0, button));
|
||||
Frames.Add(new ReplayFrame(j, 0, 0, button));
|
||||
d = (d + 1) % 4;
|
||||
if (++count > req)
|
||||
break;
|
||||
@ -77,7 +78,7 @@ namespace osu.Game.Modes.Taiko
|
||||
|
||||
for (int j = 0; j < drumRoll.TotalTicks; j++)
|
||||
{
|
||||
Frames.Add(new LegacyReplayFrame((int)time, 0, 0, hitButton ? LegacyButtonState.Left1 : LegacyButtonState.Left2));
|
||||
Frames.Add(new ReplayFrame((int)time, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2));
|
||||
time += delay;
|
||||
hitButton = !hitButton;
|
||||
}
|
||||
@ -87,30 +88,30 @@ namespace osu.Game.Modes.Taiko
|
||||
if (hit is CentreHit)
|
||||
{
|
||||
if (h.IsStrong)
|
||||
button = LegacyButtonState.Right1 | LegacyButtonState.Right2;
|
||||
button = ReplayButtonState.Right1 | ReplayButtonState.Right2;
|
||||
else
|
||||
button = hitButton ? LegacyButtonState.Right1 : LegacyButtonState.Right2;
|
||||
button = hitButton ? ReplayButtonState.Right1 : ReplayButtonState.Right2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (h.IsStrong)
|
||||
button = LegacyButtonState.Left1 | LegacyButtonState.Left2;
|
||||
button = ReplayButtonState.Left1 | ReplayButtonState.Left2;
|
||||
else
|
||||
button = hitButton ? LegacyButtonState.Left1 : LegacyButtonState.Left2;
|
||||
button = hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2;
|
||||
}
|
||||
|
||||
Frames.Add(new LegacyReplayFrame(h.StartTime, 0, 0, button));
|
||||
Frames.Add(new ReplayFrame(h.StartTime, 0, 0, button));
|
||||
}
|
||||
else
|
||||
throw new Exception("Unknown hit object type.");
|
||||
|
||||
Frames.Add(new LegacyReplayFrame(endTime + 1, 0, 0, LegacyButtonState.None));
|
||||
Frames.Add(new ReplayFrame(endTime + 1, 0, 0, ReplayButtonState.None));
|
||||
|
||||
if (i < beatmap.HitObjects.Count - 1)
|
||||
{
|
||||
double waitTime = beatmap.HitObjects[i + 1].StartTime - 1000;
|
||||
if (waitTime > endTime)
|
||||
Frames.Add(new LegacyReplayFrame(waitTime, 0, 0, LegacyButtonState.None));
|
||||
Frames.Add(new ReplayFrame(waitTime, 0, 0, ReplayButtonState.None));
|
||||
}
|
||||
|
||||
hitButton = !hitButton;
|
@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Modes.Replays;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Replays
|
||||
{
|
||||
internal class TaikoFramedReplayInputHandler : FramedReplayInputHandler
|
||||
{
|
||||
public TaikoFramedReplayInputHandler(Replay replay)
|
||||
: base(replay)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<InputState> GetPendingStates()
|
||||
{
|
||||
var keys = new List<Key>();
|
||||
|
||||
if (CurrentFrame?.MouseRight1 == true)
|
||||
keys.Add(Key.F);
|
||||
if (CurrentFrame?.MouseRight2 == true)
|
||||
keys.Add(Key.J);
|
||||
if (CurrentFrame?.MouseLeft1 == true)
|
||||
keys.Add(Key.D);
|
||||
if (CurrentFrame?.MouseLeft2 == true)
|
||||
keys.Add(Key.K);
|
||||
|
||||
return new List<InputState>
|
||||
{
|
||||
new InputState { Keyboard = new ReplayKeyboardState(keys) }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -119,15 +119,6 @@ namespace osu.Game.Modes.Taiko.Scoring
|
||||
{
|
||||
}
|
||||
|
||||
public override Score CreateScore() => new TaikoScore
|
||||
{
|
||||
TotalScore = TotalScore,
|
||||
Combo = Combo,
|
||||
MaxCombo = HighestCombo,
|
||||
Accuracy = Accuracy,
|
||||
Health = Health,
|
||||
};
|
||||
|
||||
protected override void ComputeTargets(Beatmap<TaikoHitObject> beatmap)
|
||||
{
|
||||
double hpMultiplierNormal = 1 / (hp_hit_great * beatmap.HitObjects.FindAll(o => o is Hit).Count * BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.Difficulty.DrainRate, 0.5, 0.75, 0.98));
|
||||
|
@ -1,13 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Modes.Scoring;
|
||||
using System.IO;
|
||||
|
||||
namespace osu.Game.Modes.Taiko
|
||||
{
|
||||
public class TaikoScore : Score
|
||||
{
|
||||
public override Replay CreateLegacyReplayFrom(StreamReader reader) => new LegacyTaikoReplay(reader);
|
||||
}
|
||||
}
|
@ -3,10 +3,12 @@
|
||||
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Replays;
|
||||
using osu.Game.Modes.Scoring;
|
||||
using osu.Game.Modes.Taiko.Beatmaps;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects;
|
||||
using osu.Game.Modes.Taiko.Replays;
|
||||
using osu.Game.Modes.Taiko.Scoring;
|
||||
using osu.Game.Modes.UI;
|
||||
|
||||
@ -28,5 +30,7 @@ namespace osu.Game.Modes.Taiko.UI
|
||||
protected override Playfield<TaikoHitObject, TaikoJudgement> CreatePlayfield() => new TaikoPlayfield();
|
||||
|
||||
protected override DrawableHitObject<TaikoHitObject, TaikoJudgement> GetVisualRepresentation(TaikoHitObject h) => null;
|
||||
|
||||
protected override FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new TaikoFramedReplayInputHandler(replay);
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,6 @@
|
||||
<Compile Include="Judgements\TaikoDrumRollTickJudgement.cs" />
|
||||
<Compile Include="Judgements\TaikoJudgement.cs" />
|
||||
<Compile Include="Judgements\TaikoHitResult.cs" />
|
||||
<Compile Include="LegacyTaikoReplay.cs" />
|
||||
<Compile Include="Objects\CentreHit.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableRimHit.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableStrongRimHit.cs" />
|
||||
@ -74,12 +73,12 @@
|
||||
<Compile Include="Objects\Hit.cs" />
|
||||
<Compile Include="Objects\RimHit.cs" />
|
||||
<Compile Include="Objects\Swell.cs" />
|
||||
<Compile Include="TaikoAutoReplay.cs" />
|
||||
<Compile Include="Replays\TaikoFramedReplayInputHandler.cs" />
|
||||
<Compile Include="Replays\TaikoAutoReplay.cs" />
|
||||
<Compile Include="Objects\TaikoHitObject.cs" />
|
||||
<Compile Include="TaikoDifficultyCalculator.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Scoring\TaikoScoreProcessor.cs" />
|
||||
<Compile Include="TaikoScore.cs" />
|
||||
<Compile Include="UI\HitTarget.cs" />
|
||||
<Compile Include="UI\InputDrum.cs" />
|
||||
<Compile Include="UI\DrawableTaikoJudgement.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user