summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/CustomNetworkTransform.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-04 08:27:46 +0800
committerchai <chaifix@163.com>2021-01-04 08:27:46 +0800
commitb0f6c6df9e8ae1688646ab8c8934708123e4e979 (patch)
tree3c77641aaf068d50b4d5503c52bb65518d4a1afe /Client/Assembly-CSharp/CustomNetworkTransform.cs
parent89d302af2b9f84befd7497e52f1d72162721cd70 (diff)
*网络
Diffstat (limited to 'Client/Assembly-CSharp/CustomNetworkTransform.cs')
-rw-r--r--Client/Assembly-CSharp/CustomNetworkTransform.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Client/Assembly-CSharp/CustomNetworkTransform.cs b/Client/Assembly-CSharp/CustomNetworkTransform.cs
index 56113b1..5a15a11 100644
--- a/Client/Assembly-CSharp/CustomNetworkTransform.cs
+++ b/Client/Assembly-CSharp/CustomNetworkTransform.cs
@@ -58,13 +58,13 @@ public class CustomNetworkTransform : InnerNetObject
public void Halt()
{
- ushort minSid = this.lastSequenceId + 1;
+ ushort minSid = (ushort)(this.lastSequenceId + 1);
this.SnapTo(base.transform.position, minSid);
}
public void RpcSnapTo(Vector2 position)
{
- ushort minSid = this.lastSequenceId + 5;
+ ushort minSid = (ushort)(this.lastSequenceId + 5);
if (AmongUsClient.Instance.AmClient)
{
this.SnapTo(position, minSid);
@@ -77,7 +77,7 @@ public class CustomNetworkTransform : InnerNetObject
public void SnapTo(Vector2 position)
{
- ushort minSid = this.lastSequenceId + 3;
+ ushort minSid = (ushort)(this.lastSequenceId + 3);
this.SnapTo(position, minSid);
}
@@ -220,6 +220,7 @@ public class CustomNetworkTransform : InnerNetObject
this.targetSyncPosition = this.ReadVector2(reader);
this.targetSyncVelocity = this.ReadVector2(reader);
// 当本地计算的位置数据和网络传输的位置数据差别大于snapThreshold的时候直接用消息里的位置和速度数据
+ // 实际上是一种预测的策略
if (Vector2.Distance(this.body.position, this.targetSyncPosition) > this.snapThreshold)
{
if (this.body)
@@ -240,7 +241,7 @@ public class CustomNetworkTransform : InnerNetObject
private static bool SidGreaterThan(ushort newSid, ushort prevSid)
{
- ushort num = prevSid + 32767;
+ ushort num = (ushort)(prevSid + 32767);
if (prevSid < num)
{
return newSid > prevSid && newSid <= num;