[fix time]time service now stopps properly
This commit is contained in:
@@ -177,7 +177,11 @@ namespace StgSharp.Mathematics.Graphic
|
|||||||
InternalYaw();
|
InternalYaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetViewRange(Radius fovRadius, Vec2 size, Vec2 offset, (float front, float back) depthRange)
|
public void SetViewRange(
|
||||||
|
Radius fovRadius,
|
||||||
|
Vec2 size,
|
||||||
|
Vec2 offset,
|
||||||
|
(float front, float back) depthRange)
|
||||||
{
|
{
|
||||||
float
|
float
|
||||||
distance = _target.GetLength(),
|
distance = _target.GetLength(),
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ namespace StgSharp
|
|||||||
{
|
{
|
||||||
if (!_subscribers[i].OnSpanTick(elapsedTicks))
|
if (!_subscribers[i].OnSpanTick(elapsedTicks))
|
||||||
{
|
{
|
||||||
Console.WriteLine("removed");
|
// Console.WriteLine("removed");
|
||||||
_subscribers.RemoveAt(i);
|
_subscribers.RemoveAt(i);
|
||||||
i--; // adjust index after removal
|
i--; // adjust index after removal
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,15 +146,7 @@ namespace StgSharp.Common.Timing
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public override bool EndsAt(long currentTick)
|
public override bool EndsAt(long currentTick) => currentTick >= EndingTick;
|
||||||
{
|
|
||||||
if (currentTick >= EndingTick)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Ended");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public override bool IsNextFrameReady(long currentTick)
|
public override bool IsNextFrameReady(long currentTick)
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace StgSharp.Timing
|
|||||||
// mark provider as ended so external users can observe terminal state
|
// mark provider as ended so external users can observe terminal state
|
||||||
Volatile.Write(ref _endedFlag, 1);
|
Volatile.Write(ref _endedFlag, 1);
|
||||||
s_unusedID.Push(TokenID);
|
s_unusedID.Push(TokenID);
|
||||||
_event.Dispose();
|
_event.Set();
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +111,9 @@ namespace StgSharp.Timing
|
|||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
int cur = Volatile.Read(ref _pendingSpans);
|
int cur = Volatile.Read(ref _pendingSpans);
|
||||||
if (cur == 0) {
|
if (cur == 0)
|
||||||
|
{
|
||||||
|
_event.Dispose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +209,8 @@ namespace StgSharp.Timing
|
|||||||
{
|
{
|
||||||
// mark ended due to sequence timeout, then dispose
|
// mark ended due to sequence timeout, then dispose
|
||||||
Volatile.Write(ref _endedFlag, 1);
|
Volatile.Write(ref _endedFlag, 1);
|
||||||
Console.WriteLine("Time span ended.");
|
|
||||||
|
// Console.WriteLine("Time span ended.");
|
||||||
Dispose();
|
Dispose();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,12 +92,10 @@ namespace StgSharp
|
|||||||
// Configure a simple sequence:
|
// Configure a simple sequence:
|
||||||
// initial slice = 0.5s, total = 5s, growth multiplier = 2, min slice = 0.75s
|
// initial slice = 0.5s, total = 5s, growth multiplier = 2, min slice = 0.75s
|
||||||
TimeSequence seq =
|
TimeSequence seq =
|
||||||
/*
|
|
||||||
TimeSequence.CreateLogarithmic(initialSliceSeconds:0.5,
|
|
||||||
totalSeconds:5.0,
|
|
||||||
growthMultiplier:2.0,
|
|
||||||
minSliceSeconds:0.75);
|
|
||||||
/**/
|
/**/
|
||||||
|
TimeSequence.CreateLogarithmic(initialSliceSeconds:0.5, totalSeconds:5.0,
|
||||||
|
growthMultiplier:2.0, minSliceSeconds:0.75);
|
||||||
|
/*
|
||||||
TimeSequence.CreateLinear(5, 1);
|
TimeSequence.CreateLinear(5, 1);
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user