mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 19:10:32 +00:00
Fix: Client Broadcast Delta sent on Reliable channel instead of Unreliable
This commit is contained in:
parent
eb352f5485
commit
15ed88779c
@ -2,6 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Mirror
|
||||
{
|
||||
@ -106,13 +108,11 @@ public class HybridNetworkTransformV2 : NetworkBehaviour
|
||||
#region Register Message Handlers
|
||||
public override void OnStartServer()
|
||||
{
|
||||
base.OnStartServer();
|
||||
if (!registeredHandlers) RegisterServerHandlers();
|
||||
}
|
||||
|
||||
public override void OnStartClient()
|
||||
{
|
||||
base.OnStopClient();
|
||||
if (!registeredHandlers) RegisterClientHandlers();
|
||||
|
||||
CmdRegisteredHandler();
|
||||
@ -363,7 +363,7 @@ protected virtual void ServerBroadcastFull()
|
||||
SyncDataFullMsg msg = new SyncDataFullMsg(netId, ComponentIndex, lastSentFullSyncData);
|
||||
SendToReadyObservers(netIdentity, msg, false, Channels.Reliable); // will exclude owner be problematic?
|
||||
|
||||
//RpcServerToClientSyncFull(lastSentFullSyncData);
|
||||
//NetworkServer.SendToReadyObservers(netIdentity, msg, false, Channels.Reliable); // will exclude owner be problematic?
|
||||
}
|
||||
|
||||
private byte NextFullSyncIndex()
|
||||
@ -374,11 +374,6 @@ private byte NextFullSyncIndex()
|
||||
return lastSentFullSyncIndex;
|
||||
}
|
||||
|
||||
/*[ClientRpc]
|
||||
void RpcServerToClientSyncFull(SyncDataFull syncData) =>
|
||||
OnServerToClientSyncFull(syncData);
|
||||
*/
|
||||
|
||||
protected static void ServerToClientSyncFullHandler(SyncDataFullMsg msg)
|
||||
{
|
||||
if (!NetworkClient.spawned.ContainsKey(msg.netId)) return;
|
||||
@ -427,7 +422,9 @@ protected virtual void ServerBroadcastDelta()
|
||||
|
||||
SyncDataDeltaMsg msg = new SyncDataDeltaMsg(netId, ComponentIndex, syncDataDelta);
|
||||
SendToReadyObservers(netIdentity, msg, false, Channels.Unreliable); // will exclude owner be problematic?
|
||||
//RpcServerToClientSyncDelta(syncDataDelta);
|
||||
|
||||
//NetworkServer.SendToReadyObservers(netIdentity, msg, false, Channels.Unreliable); // will exclude owner be problematic?
|
||||
|
||||
}
|
||||
|
||||
/*[ClientRpc (channel = Channels.Unreliable)]
|
||||
@ -479,18 +476,8 @@ protected virtual void ClientBroadcastFull()
|
||||
|
||||
SyncDataFullMsg msg = new SyncDataFullMsg(netId, ComponentIndex, lastSentFullSyncData);
|
||||
NetworkClient.Send(msg, Channels.Reliable);
|
||||
//CmdClientToServerSyncFull(lastSentFullSyncData);
|
||||
}
|
||||
|
||||
/*[Command]
|
||||
void CmdClientToServerSyncFull(SyncDataFull syncData)
|
||||
{
|
||||
OnClientToServerSyncFull(syncData);
|
||||
|
||||
if (syncDirection == SyncDirection.ClientToServer)
|
||||
RpcServerToClientSyncFull(syncData);
|
||||
}*/
|
||||
|
||||
protected static void ClientToServerSyncFullHandler(NetworkConnectionToClient conn, SyncDataFullMsg msg)
|
||||
{
|
||||
|
||||
@ -508,6 +495,7 @@ protected static void ClientToServerSyncFullHandler(NetworkConnectionToClient co
|
||||
|
||||
if (networkIdentity.NetworkBehaviours[msg.componentId].syncDirection == SyncDirection.ClientToServer)
|
||||
nT.SendToReadyObservers(networkIdentity, msg, false, Channels.Reliable); // will exclude owner be problematic?
|
||||
//NetworkServer.SendToReadyObservers(networkIdentity, msg, false, Channels.Reliable); // will exclude owner be problematic?
|
||||
}
|
||||
|
||||
protected virtual void OnClientToServerSyncFull(SyncDataFull syncData)
|
||||
@ -546,18 +534,8 @@ protected virtual void ClientBroadcastDelta()
|
||||
|
||||
SyncDataDeltaMsg msg = new SyncDataDeltaMsg(netId, ComponentIndex, syncDataDelta);
|
||||
NetworkClient.Send(msg, Channels.Unreliable);
|
||||
//CmdClientToServerSyncDelta(syncDataDelta);
|
||||
}
|
||||
|
||||
/*[Command(channel = Channels.Unreliable)]
|
||||
void CmdClientToServerSyncDelta(SyncDataDelta delta)
|
||||
{
|
||||
OnClientToServerSyncDelta(delta);
|
||||
|
||||
if (syncDirection == SyncDirection.ClientToServer)
|
||||
RpcServerToClientSyncDelta(delta);
|
||||
}*/
|
||||
|
||||
protected static void ClientToServerSyncDeltaHandler(NetworkConnectionToClient conn, SyncDataDeltaMsg msg)
|
||||
{
|
||||
if (!NetworkServer.spawned.ContainsKey(msg.netId)) return;
|
||||
@ -574,7 +552,8 @@ protected static void ClientToServerSyncDeltaHandler(NetworkConnectionToClient c
|
||||
nT.OnClientToServerSyncDelta(msg.syncData);
|
||||
|
||||
if (networkIdentity.NetworkBehaviours[msg.componentId].syncDirection == SyncDirection.ClientToServer)
|
||||
nT.SendToReadyObservers(networkIdentity, msg, false, Channels.Reliable); // will exclude owner be problematic?
|
||||
nT.SendToReadyObservers(networkIdentity, msg, false, Channels.Unreliable); // will exclude owner be problematic?
|
||||
//NetworkServer.SendToReadyObservers(networkIdentity, msg, false, Channels.Unreliable); // will exclude owner be problematic?
|
||||
}
|
||||
|
||||
protected virtual void OnClientToServerSyncDelta(SyncDataDelta delta)
|
||||
@ -838,5 +817,13 @@ protected virtual void CleanUpFullSyncDataPositionSync(ref SyncDataFull syncData
|
||||
if ((syncSettings & SyncSettings.SyncPosZ) == 0) syncData.position.z = currentPosition.z;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#if UNITY_EDITOR
|
||||
void OnGUI()
|
||||
{
|
||||
syncSettings = (SyncSettings)EditorGUILayout.EnumFlagsField(syncSettings);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user