mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 22:22:55 +08:00
Implement taiko replays + key conversion.
This commit is contained in:
parent
dcb9d2903b
commit
99b9623671
43
osu.Game.Modes.Taiko/LegacyTaikoReplay.cs
Normal file
43
osu.Game.Modes.Taiko/LegacyTaikoReplay.cs
Normal file
@ -0,0 +1,43 @@
|
||||
// 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
|
||||
{
|
||||
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() => new List<InputState>
|
||||
{
|
||||
new InputState
|
||||
{
|
||||
Keyboard = new ReplayKeyboardState(new List<Key>(new[]
|
||||
{
|
||||
CurrentFrame?.MouseRight1 == true ? Key.F : Key.Unknown,
|
||||
CurrentFrame?.MouseRight2 == true ? Key.J : Key.Unknown,
|
||||
CurrentFrame?.MouseLeft1 == true ? Key.D : Key.Unknown,
|
||||
CurrentFrame?.MouseLeft2 == true ? Key.K : Key.Unknown
|
||||
}))
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -119,6 +119,15 @@ 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));
|
||||
|
13
osu.Game.Modes.Taiko/TaikoScore.cs
Normal file
13
osu.Game.Modes.Taiko/TaikoScore.cs
Normal file
@ -0,0 +1,13 @@
|
||||
// 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);
|
||||
}
|
||||
}
|
@ -52,6 +52,7 @@
|
||||
<Compile Include="Judgements\TaikoDrumRollTickJudgement.cs" />
|
||||
<Compile Include="Judgements\TaikoJudgement.cs" />
|
||||
<Compile Include="Judgements\TaikoHitResult.cs" />
|
||||
<Compile Include="LegacyTaikoReplay.cs" />
|
||||
<Compile Include="Objects\Drawable\DrawableTaikoHitObject.cs" />
|
||||
<Compile Include="Objects\Bash.cs" />
|
||||
<Compile Include="Objects\DrumRoll.cs" />
|
||||
@ -61,6 +62,7 @@
|
||||
<Compile Include="Objects\TaikoHitObject.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" />
|
||||
|
@ -101,7 +101,7 @@ namespace osu.Game.Database
|
||||
|
||||
using (var lzma = new LzmaStream(properties, replayInStream, compressedSize, outSize))
|
||||
using (var reader = new StreamReader(lzma))
|
||||
score.Replay = new LegacyReplay(reader);
|
||||
score.Replay = score.CreateLegacyReplayFrom(reader);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user