summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-04 15:08:37 +0800
committerchai <chaifix@163.com>2021-01-04 15:08:37 +0800
commitaf50160ef5c9a55506157d7d94e20c17cd28ed42 (patch)
tree95b8c3ee1974b0d5132675473a6cd8382fe99cc6
parent00cfa93034c5b6fad750b395ac14a1c58c9dd93f (diff)
*协议
-rw-r--r--Client/Assembly-CSharp/GameData.cs15
-rw-r--r--Client/Assembly-CSharp/InnerNet/InnerNetClient.cs7
-rw-r--r--Client/Assembly-CSharp/LobbyBehaviour.cs1
-rw-r--r--Client/Assembly-CSharp/MeetingHud.cs29
-rw-r--r--Client/Assembly-CSharp/Msg.cs2
-rw-r--r--Client/Assembly-CSharp/PlayerPhysics.cs26
-rw-r--r--Client/Assembly-CSharp/ShipStatus.cs21
-rw-r--r--Client/Assembly-CSharp/VoteBanSystem.cs18
8 files changed, 64 insertions, 55 deletions
diff --git a/Client/Assembly-CSharp/GameData.cs b/Client/Assembly-CSharp/GameData.cs
index e81e28e..5069a13 100644
--- a/Client/Assembly-CSharp/GameData.cs
+++ b/Client/Assembly-CSharp/GameData.cs
@@ -163,10 +163,6 @@ public class GameData : InnerNetObject, IDisconnectHandler
}
}
- private enum RpcCalls
- {
- SetTasks
- }
public void Awake()
{
@@ -534,9 +530,14 @@ public class GameData : InnerNetObject, IDisconnectHandler
}
}
this.RecomputeTaskCounts();
- }
-
- public void RpcSetTasks(byte playerId, byte[] taskTypeIds)
+ }
+
+ private enum RpcCalls
+ {
+ SetTasks
+ }
+
+ public void RpcSetTasks(byte playerId, byte[] taskTypeIds)
{
if (AmongUsClient.Instance.AmClient)
{
diff --git a/Client/Assembly-CSharp/InnerNet/InnerNetClient.cs b/Client/Assembly-CSharp/InnerNet/InnerNetClient.cs
index 30121eb..e2198e2 100644
--- a/Client/Assembly-CSharp/InnerNet/InnerNetClient.cs
+++ b/Client/Assembly-CSharp/InnerNet/InnerNetClient.cs
@@ -860,7 +860,7 @@ namespace InnerNet
return;
}
goto IL_675;
- case (int)TagAlias.Disconnect:
+ case (int)Tags.RemoveGame: // MsgRead:RemoveGame
{
DisconnectReasons reason3 = DisconnectReasons.ServerRequest;
if (reader.Position < reader.Length)
@@ -1352,8 +1352,9 @@ namespace InnerNet
messageWriter2.EndMessage();
this.SendOrDisconnect(messageWriter2);
messageWriter2.Clear((SendOption)j);
- messageWriter2.StartMessage(5); // 初始化
- messageWriter2.Write(this.GameId);
+ // 写入下一个公用头
+ messageWriter2.StartMessage(5); // GameData
+ messageWriter2.Write(this.GameId); // gameId
}
}
}
diff --git a/Client/Assembly-CSharp/LobbyBehaviour.cs b/Client/Assembly-CSharp/LobbyBehaviour.cs
index de036b7..57b2f63 100644
--- a/Client/Assembly-CSharp/LobbyBehaviour.cs
+++ b/Client/Assembly-CSharp/LobbyBehaviour.cs
@@ -3,6 +3,7 @@ using Hazel;
using InnerNet;
using UnityEngine;
+// 大厅,没有需要同步的数据
public class LobbyBehaviour : InnerNetObject
{
public static LobbyBehaviour Instance;
diff --git a/Client/Assembly-CSharp/MeetingHud.cs b/Client/Assembly-CSharp/MeetingHud.cs
index dbc22cb..891ce29 100644
--- a/Client/Assembly-CSharp/MeetingHud.cs
+++ b/Client/Assembly-CSharp/MeetingHud.cs
@@ -82,14 +82,6 @@ public class MeetingHud : InnerNetObject, IDisconnectHandler
Proceeding
}
- private enum RpcCalls
- {
- Close,
- VotingComplete,
- CastVote,
- ClearVote
- }
-
private void Awake()
{
if (!MeetingHud.Instance)
@@ -654,9 +646,17 @@ public class MeetingHud : InnerNetObject, IDisconnectHandler
result = 0;
}
return result;
- }
-
- public void RpcClose()
+ }
+
+ private enum RpcCalls
+ {
+ Close,
+ VotingComplete,
+ CastVote,
+ ClearVote
+ }
+
+ public void RpcClose()
{
if (AmongUsClient.Instance.AmClient)
{
@@ -676,9 +676,10 @@ public class MeetingHud : InnerNetObject, IDisconnectHandler
messageWriter.Write(playerId);
messageWriter.Write(suspectIdx);
AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
- }
-
- private void RpcVotingComplete(byte[] states, GameData.PlayerInfo exiled, bool tie)
+ }
+
+
+ private void RpcVotingComplete(byte[] states, GameData.PlayerInfo exiled, bool tie)
{
if (AmongUsClient.Instance.AmClient)
{
diff --git a/Client/Assembly-CSharp/Msg.cs b/Client/Assembly-CSharp/Msg.cs
index c47fb63..aa7106c 100644
--- a/Client/Assembly-CSharp/Msg.cs
+++ b/Client/Assembly-CSharp/Msg.cs
@@ -1,7 +1,7 @@
/*
所有网络消息
-////////////////////////////////////////////// 不需要同步的消息 //////////////////////////////////////////////
+////////////////////////////////////////////// C\S结构消息 //////////////////////////////////////////////
HostGame // 作为Host建房间
{
HostGame // 0
diff --git a/Client/Assembly-CSharp/PlayerPhysics.cs b/Client/Assembly-CSharp/PlayerPhysics.cs
index c751f0d..086529b 100644
--- a/Client/Assembly-CSharp/PlayerPhysics.cs
+++ b/Client/Assembly-CSharp/PlayerPhysics.cs
@@ -55,12 +55,6 @@ public class PlayerPhysics : InnerNetObject
public SkinLayer Skin;
- private enum RpcCalls
- {
- EnterVent,
- ExitVent
- }
-
public void Awake()
{
this.body = base.GetComponent<Rigidbody2D>();
@@ -281,6 +275,7 @@ public class PlayerPhysics : InnerNetObject
yield break;
}
+ // 无同步数据
public override bool Serialize(MessageWriter writer, bool initialState)
{
return false;
@@ -288,9 +283,10 @@ public class PlayerPhysics : InnerNetObject
public override void Deserialize(MessageReader reader, bool initialState)
{
- }
-
- public void RpcEnterVent(int id)
+ }
+
+
+ public void RpcEnterVent(int id)
{
if (AmongUsClient.Instance.AmClient)
{
@@ -310,9 +306,15 @@ public class PlayerPhysics : InnerNetObject
MessageWriter messageWriter = AmongUsClient.Instance.StartRpc(this.NetId, 1, SendOption.Reliable);
messageWriter.WritePacked(id);
messageWriter.EndMessage();
- }
-
- public override void HandleRpc(byte callId, MessageReader reader)
+ }
+
+ private enum RpcCalls
+ {
+ EnterVent,
+ ExitVent
+ }
+
+ public override void HandleRpc(byte callId, MessageReader reader)
{
if (callId == 0)
{
diff --git a/Client/Assembly-CSharp/ShipStatus.cs b/Client/Assembly-CSharp/ShipStatus.cs
index 89fd8da..e83100f 100644
--- a/Client/Assembly-CSharp/ShipStatus.cs
+++ b/Client/Assembly-CSharp/ShipStatus.cs
@@ -92,12 +92,6 @@ public class ShipStatus : InnerNetObject
}
}
- private enum RpcCalls
- {
- CloseDoorsOfType,
- RepairSystem
- }
-
public ShipStatus()
{
//c 所有的systems
@@ -694,10 +688,16 @@ public class ShipStatus : InnerNetObject
return true;
}
return false;
- }
-
- // 关门
- public void RpcCloseDoorsOfType(SystemTypes type)
+ }
+
+ private enum RpcCalls
+ {
+ CloseDoorsOfType,
+ RepairSystem
+ }
+
+ // 关门
+ public void RpcCloseDoorsOfType(SystemTypes type)
{
if (AmongUsClient.Instance.AmHost)
{
@@ -709,6 +709,7 @@ public class ShipStatus : InnerNetObject
AmongUsClient.Instance.FinishRpcImmediately(messageWriter);
}
+ // 修复
public void RpcRepairSystem(SystemTypes systemType, int amount)
{
if (AmongUsClient.Instance.AmHost)
diff --git a/Client/Assembly-CSharp/VoteBanSystem.cs b/Client/Assembly-CSharp/VoteBanSystem.cs
index 23d030f..9b8c6bd 100644
--- a/Client/Assembly-CSharp/VoteBanSystem.cs
+++ b/Client/Assembly-CSharp/VoteBanSystem.cs
@@ -3,22 +3,19 @@ using System.Collections.Generic;
using Hazel;
using InnerNet;
+// 投票
public class VoteBanSystem : InnerNetObject
{
public static VoteBanSystem Instance;
public Dictionary<int, int[]> Votes = new Dictionary<int, int[]>();
- public enum RpcCalls
- {
- AddVote
- }
-
public void Awake()
{
VoteBanSystem.Instance = this;
}
+ // RpcVote
public void CmdAddVote(int clientId)
{
this.AddVote(AmongUsClient.Instance.ClientId, clientId);
@@ -64,9 +61,14 @@ public class VoteBanSystem : InnerNetObject
{
int[] array;
return this.Votes.TryGetValue(clientId, out array) && Array.IndexOf<int>(array, AmongUsClient.Instance.ClientId) != -1;
- }
-
- public override void HandleRpc(byte callId, MessageReader reader)
+ }
+
+ public enum RpcCalls
+ {
+ AddVote
+ }
+
+ public override void HandleRpc(byte callId, MessageReader reader)
{
if (callId == 0)
{