clearup
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using Network.Defines;
|
||||
|
||||
namespace Network.NetworkApplication
|
||||
{
|
||||
public readonly struct ClientMovementBootstrap
|
||||
{
|
||||
public ClientMovementBootstrap(int authoritativeMoveSpeed, long serverTick)
|
||||
{
|
||||
AuthoritativeMoveSpeed = authoritativeMoveSpeed;
|
||||
ServerTick = serverTick;
|
||||
}
|
||||
|
||||
public int AuthoritativeMoveSpeed { get; }
|
||||
|
||||
public long ServerTick { get; }
|
||||
|
||||
public static ClientMovementBootstrap FromLoginResponse(LoginResponse response)
|
||||
{
|
||||
if (response == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(response));
|
||||
}
|
||||
|
||||
return new ClientMovementBootstrap(response.Speed, response.ServerTick);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f82d57bd033abb439004c7ad1b201b0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -24,6 +24,8 @@ namespace Network.NetworkApplication
|
||||
|
||||
public long? LastAuthoritativeTick { get; private set; }
|
||||
|
||||
public long? LastAcknowledgedMoveTick { get; private set; }
|
||||
|
||||
public IReadOnlyList<PredictedMoveStep> PendingInputs => pendingInputs;
|
||||
|
||||
public void Record(MoveInput input)
|
||||
@@ -66,9 +68,10 @@ namespace Network.NetworkApplication
|
||||
}
|
||||
|
||||
LastAuthoritativeTick = state.Tick;
|
||||
pendingInputs.RemoveAll(input => input.Input.Tick <= state.Tick);
|
||||
LastAcknowledgedMoveTick = state.AcknowledgedMoveTick;
|
||||
pendingInputs.RemoveAll(input => input.Input.Tick <= state.AcknowledgedMoveTick);
|
||||
replayInputs = pendingInputs.ToArray();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user