From b0f6c6df9e8ae1688646ab8c8934708123e4e979 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 4 Jan 2021 08:27:46 +0800 Subject: =?UTF-8?q?*=E7=BD=91=E7=BB=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Client/Assembly-CSharp/CustomNetworkTransform.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Client/Assembly-CSharp/CustomNetworkTransform.cs') 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; -- cgit v1.1-26-g67d0