Implement taiko replays + key conversion.

This commit is contained in:
smoogipooo 2017-03-24 14:09:58 +09:00
parent dcb9d2903b
commit 99b9623671
5 changed files with 68 additions and 1 deletions

View 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
}))
}
};
}
}
}

View File

@ -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));

View 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);
}
}

View File

@ -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" />

View File

@ -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);
}
}