mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 02:22:57 +08:00
Make direction setting more clear
This commit is contained in:
parent
0a7f3dc19b
commit
3e5322541d
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Game.Input.Handlers;
|
using osu.Game.Input.Handlers;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
@ -112,15 +113,9 @@ namespace osu.Game.Rulesets.Replays
|
|||||||
/// <returns>The usable time value. If null, we should not advance time as we do not have enough data.</returns>
|
/// <returns>The usable time value. If null, we should not advance time as we do not have enough data.</returns>
|
||||||
public override double? SetFrameFromTime(double time)
|
public override double? SetFrameFromTime(double time)
|
||||||
{
|
{
|
||||||
if (!CurrentTime.HasValue)
|
updateDirection(time);
|
||||||
{
|
|
||||||
currentDirection = 1;
|
Debug.Assert(currentDirection != 0);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
currentDirection = time.CompareTo(CurrentTime);
|
|
||||||
if (currentDirection == 0) currentDirection = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (HasFrames)
|
if (HasFrames)
|
||||||
{
|
{
|
||||||
@ -171,5 +166,18 @@ namespace osu.Game.Rulesets.Replays
|
|||||||
|
|
||||||
return CurrentTime = time;
|
return CurrentTime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateDirection(double time)
|
||||||
|
{
|
||||||
|
if (!CurrentTime.HasValue)
|
||||||
|
{
|
||||||
|
currentDirection = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentDirection = time.CompareTo(CurrentTime);
|
||||||
|
if (currentDirection == 0) currentDirection = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user