mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 07:02:54 +08:00
Merge branch 'master' into general-fixes
This commit is contained in:
commit
062d99607b
@ -44,7 +44,10 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
|||||||
IHasRepeats repeatsData = original as IHasRepeats;
|
IHasRepeats repeatsData = original as IHasRepeats;
|
||||||
IHasEndTime endTimeData = original as IHasEndTime;
|
IHasEndTime endTimeData = original as IHasEndTime;
|
||||||
|
|
||||||
bool strong = ((original.Sample?.Type ?? SampleType.None) & SampleType.Finish) > 0;
|
// Old osu! used hit sounding to determine various hit type information
|
||||||
|
SampleType sample = original.Sample?.Type ?? SampleType.None;
|
||||||
|
|
||||||
|
bool strong = (sample & SampleType.Finish) > 0;
|
||||||
|
|
||||||
if (distanceData != null)
|
if (distanceData != null)
|
||||||
{
|
{
|
||||||
@ -71,11 +74,23 @@ namespace osu.Game.Modes.Taiko.Beatmaps
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Hit
|
bool isCentre = (sample & ~(SampleType.Finish | SampleType.Normal)) == 0;
|
||||||
|
|
||||||
|
if (isCentre)
|
||||||
|
{
|
||||||
|
return new CentreHit
|
||||||
|
{
|
||||||
|
StartTime = original.StartTime,
|
||||||
|
Sample = original.Sample,
|
||||||
|
IsStrong = strong
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return new RimHit
|
||||||
{
|
{
|
||||||
StartTime = original.StartTime,
|
StartTime = original.StartTime,
|
||||||
Sample = original.Sample,
|
Sample = original.Sample,
|
||||||
IsStrong = strong
|
IsStrong = strong,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
// 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;
|
||||||
|
using osu.Game.Modes.Taiko.Replays;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Taiko.Mods
|
namespace osu.Game.Modes.Taiko.Mods
|
||||||
{
|
{
|
||||||
@ -61,4 +66,13 @@ namespace osu.Game.Modes.Taiko.Mods
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TaikoModAutoplay : ModAutoplay<TaikoHitObject>
|
||||||
|
{
|
||||||
|
protected override Score CreateReplayScore(Beatmap<TaikoHitObject> beatmap) => new Score
|
||||||
|
{
|
||||||
|
User = new User { Username = "mekkadosu!" },
|
||||||
|
Replay = new TaikoAutoReplay(beatmap)
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
9
osu.Game.Modes.Taiko/Objects/CentreHit.cs
Normal file
9
osu.Game.Modes.Taiko/Objects/CentreHit.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Taiko.Objects
|
||||||
|
{
|
||||||
|
public class CentreHit : Hit
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
9
osu.Game.Modes.Taiko/Objects/RimHit.cs
Normal file
9
osu.Game.Modes.Taiko/Objects/RimHit.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
namespace osu.Game.Modes.Taiko.Objects
|
||||||
|
{
|
||||||
|
public class RimHit : Hit
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
121
osu.Game.Modes.Taiko/Replays/TaikoAutoReplay.cs
Normal file
121
osu.Game.Modes.Taiko/Replays/TaikoAutoReplay.cs
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
// 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;
|
||||||
|
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.Replays
|
||||||
|
{
|
||||||
|
public class TaikoAutoReplay : Replay
|
||||||
|
{
|
||||||
|
private readonly Beatmap<TaikoHitObject> beatmap;
|
||||||
|
|
||||||
|
public TaikoAutoReplay(Beatmap<TaikoHitObject> beatmap)
|
||||||
|
{
|
||||||
|
this.beatmap = beatmap;
|
||||||
|
|
||||||
|
createAutoReplay();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createAutoReplay()
|
||||||
|
{
|
||||||
|
bool hitButton = true;
|
||||||
|
|
||||||
|
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];
|
||||||
|
|
||||||
|
ReplayButtonState button;
|
||||||
|
|
||||||
|
IHasEndTime endTimeData = h as IHasEndTime;
|
||||||
|
double endTime = endTimeData?.EndTime ?? h.StartTime;
|
||||||
|
|
||||||
|
Swell swell = h as Swell;
|
||||||
|
DrumRoll drumRoll = h as DrumRoll;
|
||||||
|
Hit hit = h as Hit;
|
||||||
|
|
||||||
|
if (swell != null)
|
||||||
|
{
|
||||||
|
int d = 0;
|
||||||
|
int count = 0;
|
||||||
|
int req = swell.RequiredHits;
|
||||||
|
double hitRate = swell.Duration / req;
|
||||||
|
for (double j = h.StartTime; j < endTime; j += hitRate)
|
||||||
|
{
|
||||||
|
switch (d)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
button = ReplayButtonState.Left1;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
button = ReplayButtonState.Right1;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
button = ReplayButtonState.Left2;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
button = ReplayButtonState.Right2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Frames.Add(new ReplayFrame(j, 0, 0, button));
|
||||||
|
d = (d + 1) % 4;
|
||||||
|
if (++count > req)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (drumRoll != null)
|
||||||
|
{
|
||||||
|
double delay = drumRoll.TickTimeDistance;
|
||||||
|
|
||||||
|
double time = drumRoll.StartTime;
|
||||||
|
|
||||||
|
for (int j = 0; j < drumRoll.TotalTicks; j++)
|
||||||
|
{
|
||||||
|
Frames.Add(new ReplayFrame((int)time, 0, 0, hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2));
|
||||||
|
time += delay;
|
||||||
|
hitButton = !hitButton;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (hit != null)
|
||||||
|
{
|
||||||
|
if (hit is CentreHit)
|
||||||
|
{
|
||||||
|
if (h.IsStrong)
|
||||||
|
button = ReplayButtonState.Right1 | ReplayButtonState.Right2;
|
||||||
|
else
|
||||||
|
button = hitButton ? ReplayButtonState.Right1 : ReplayButtonState.Right2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (h.IsStrong)
|
||||||
|
button = ReplayButtonState.Left1 | ReplayButtonState.Left2;
|
||||||
|
else
|
||||||
|
button = hitButton ? ReplayButtonState.Left1 : ReplayButtonState.Left2;
|
||||||
|
}
|
||||||
|
|
||||||
|
Frames.Add(new ReplayFrame(h.StartTime, 0, 0, button));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw new Exception("Unknown hit object type.");
|
||||||
|
|
||||||
|
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 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) }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -65,7 +65,7 @@ namespace osu.Game.Modes.Taiko
|
|||||||
{
|
{
|
||||||
Mods = new Mod[]
|
Mods = new Mod[]
|
||||||
{
|
{
|
||||||
new ModAutoplay(),
|
new TaikoModAutoplay(),
|
||||||
new ModCinema(),
|
new ModCinema(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -3,10 +3,12 @@
|
|||||||
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
|
using osu.Game.Modes.Replays;
|
||||||
using osu.Game.Modes.Scoring;
|
using osu.Game.Modes.Scoring;
|
||||||
using osu.Game.Modes.Taiko.Beatmaps;
|
using osu.Game.Modes.Taiko.Beatmaps;
|
||||||
using osu.Game.Modes.Taiko.Judgements;
|
using osu.Game.Modes.Taiko.Judgements;
|
||||||
using osu.Game.Modes.Taiko.Objects;
|
using osu.Game.Modes.Taiko.Objects;
|
||||||
|
using osu.Game.Modes.Taiko.Replays;
|
||||||
using osu.Game.Modes.Taiko.Scoring;
|
using osu.Game.Modes.Taiko.Scoring;
|
||||||
using osu.Game.Modes.UI;
|
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 Playfield<TaikoHitObject, TaikoJudgement> CreatePlayfield() => new TaikoPlayfield();
|
||||||
|
|
||||||
protected override DrawableHitObject<TaikoHitObject, TaikoJudgement> GetVisualRepresentation(TaikoHitObject h) => null;
|
protected override DrawableHitObject<TaikoHitObject, TaikoJudgement> GetVisualRepresentation(TaikoHitObject h) => null;
|
||||||
|
|
||||||
|
protected override FramedReplayInputHandler CreateReplayInputHandler(Replay replay) => new TaikoFramedReplayInputHandler(replay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
<Compile Include="Judgements\TaikoStrongHitJudgement.cs" />
|
<Compile Include="Judgements\TaikoStrongHitJudgement.cs" />
|
||||||
<Compile Include="Judgements\TaikoJudgement.cs" />
|
<Compile Include="Judgements\TaikoJudgement.cs" />
|
||||||
<Compile Include="Judgements\TaikoHitResult.cs" />
|
<Compile Include="Judgements\TaikoHitResult.cs" />
|
||||||
|
<Compile Include="Objects\CentreHit.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableRimHit.cs" />
|
<Compile Include="Objects\Drawable\DrawableRimHit.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableStrongRimHit.cs" />
|
<Compile Include="Objects\Drawable\DrawableStrongRimHit.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableCentreHit.cs" />
|
<Compile Include="Objects\Drawable\DrawableCentreHit.cs" />
|
||||||
@ -71,7 +72,10 @@
|
|||||||
<Compile Include="Objects\DrumRoll.cs" />
|
<Compile Include="Objects\DrumRoll.cs" />
|
||||||
<Compile Include="Objects\DrumRollTick.cs" />
|
<Compile Include="Objects\DrumRollTick.cs" />
|
||||||
<Compile Include="Objects\Hit.cs" />
|
<Compile Include="Objects\Hit.cs" />
|
||||||
|
<Compile Include="Objects\RimHit.cs" />
|
||||||
<Compile Include="Objects\Swell.cs" />
|
<Compile Include="Objects\Swell.cs" />
|
||||||
|
<Compile Include="Replays\TaikoFramedReplayInputHandler.cs" />
|
||||||
|
<Compile Include="Replays\TaikoAutoReplay.cs" />
|
||||||
<Compile Include="Objects\TaikoHitObject.cs" />
|
<Compile Include="Objects\TaikoHitObject.cs" />
|
||||||
<Compile Include="TaikoDifficultyCalculator.cs" />
|
<Compile Include="TaikoDifficultyCalculator.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user