mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Cmd/Rpc/TargetRpc/SyncEvent hashing uses hash(Type:Func) instead of hash(Func), so that Inventory.RpcUse is not called for Equipment.RpcUse etc. Original Weaver did this too, forgot to do it when moving hash calculation to HLAPI.
This commit is contained in:
parent
cbf8a462d0
commit
9fe8872968
@ -94,7 +94,7 @@ protected void SendCommandInternal(string cmdName, NetworkWriter writer, int cha
|
|||||||
CommandMessage message = new CommandMessage();
|
CommandMessage message = new CommandMessage();
|
||||||
message.netId = netId;
|
message.netId = netId;
|
||||||
message.componentIndex = ComponentIndex;
|
message.componentIndex = ComponentIndex;
|
||||||
message.cmdHash = cmdName.GetStableHashCode();
|
message.cmdHash = (GetType() + ":" + cmdName).GetStableHashCode(); // type+func so Inventory.RpcUse != Equipment.RpcUse
|
||||||
message.payload = writer.ToArray();
|
message.payload = writer.ToArray();
|
||||||
|
|
||||||
ClientScene.readyConnection.Send((short)MsgType.Command, message, channelId);
|
ClientScene.readyConnection.Send((short)MsgType.Command, message, channelId);
|
||||||
@ -122,7 +122,7 @@ protected void SendRPCInternal(string rpcName, NetworkWriter writer, int channel
|
|||||||
RpcMessage message = new RpcMessage();
|
RpcMessage message = new RpcMessage();
|
||||||
message.netId = netId;
|
message.netId = netId;
|
||||||
message.componentIndex = ComponentIndex;
|
message.componentIndex = ComponentIndex;
|
||||||
message.rpcHash = rpcName.GetStableHashCode();
|
message.rpcHash = (GetType() + ":" + rpcName).GetStableHashCode(); // type+func so Inventory.RpcUse != Equipment.RpcUse
|
||||||
message.payload = writer.ToArray();
|
message.payload = writer.ToArray();
|
||||||
|
|
||||||
NetworkServer.SendToReady(gameObject, (short)MsgType.Rpc, message, channelId);
|
NetworkServer.SendToReady(gameObject, (short)MsgType.Rpc, message, channelId);
|
||||||
@ -142,7 +142,7 @@ protected void SendTargetRPCInternal(NetworkConnection conn, string rpcName, Net
|
|||||||
RpcMessage message = new RpcMessage();
|
RpcMessage message = new RpcMessage();
|
||||||
message.netId = netId;
|
message.netId = netId;
|
||||||
message.componentIndex = ComponentIndex;
|
message.componentIndex = ComponentIndex;
|
||||||
message.rpcHash = rpcName.GetStableHashCode();
|
message.rpcHash = (GetType() + ":" + rpcName).GetStableHashCode(); // type+func so Inventory.RpcUse != Equipment.RpcUse
|
||||||
message.payload = writer.ToArray();
|
message.payload = writer.ToArray();
|
||||||
|
|
||||||
conn.Send((short)MsgType.Rpc, message, channelId);
|
conn.Send((short)MsgType.Rpc, message, channelId);
|
||||||
@ -169,7 +169,7 @@ protected void SendEventInternal(string eventName, NetworkWriter writer, int cha
|
|||||||
SyncEventMessage message = new SyncEventMessage();
|
SyncEventMessage message = new SyncEventMessage();
|
||||||
message.netId = netId;
|
message.netId = netId;
|
||||||
message.componentIndex = ComponentIndex;
|
message.componentIndex = ComponentIndex;
|
||||||
message.eventHash = eventName.GetStableHashCode();
|
message.eventHash = (GetType() + ":" + eventName).GetStableHashCode(); // type+func so Inventory.RpcUse != Equipment.RpcUse
|
||||||
message.payload = writer.ToArray();
|
message.payload = writer.ToArray();
|
||||||
|
|
||||||
NetworkServer.SendToReady(gameObject, (short)MsgType.SyncEvent, message, channelId);
|
NetworkServer.SendToReady(gameObject, (short)MsgType.SyncEvent, message, channelId);
|
||||||
@ -198,7 +198,7 @@ protected class Invoker
|
|||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
protected static void RegisterDelegate(Type invokeClass, string cmdName, UNetInvokeType invokerType, CmdDelegate func)
|
protected static void RegisterDelegate(Type invokeClass, string cmdName, UNetInvokeType invokerType, CmdDelegate func)
|
||||||
{
|
{
|
||||||
int cmdHash = cmdName.GetStableHashCode();
|
int cmdHash = (invokeClass + ":" + cmdName).GetStableHashCode(); // type+func so Inventory.RpcUse != Equipment.RpcUse
|
||||||
if (s_CmdHandlerDelegates.ContainsKey(cmdHash))
|
if (s_CmdHandlerDelegates.ContainsKey(cmdHash))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user