mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
MsgType.ObjectSpawn renamed to SpawnPrefab, ObjectSpawnScene renamed to SpawnSceneObject. Messages.ObjectSpawnMessage renamed to SpawnPrefabMessage, etc. to make it perfectly clear what the messages do in order to avoid any confusion.
This commit is contained in:
parent
e0a2a373ed
commit
2dd907fb28
@ -248,15 +248,15 @@ static internal void RegisterSystemHandlers(NetworkClient client, bool localClie
|
||||
{
|
||||
client.RegisterHandler((short)MsgType.ObjectDestroy, OnLocalClientObjectDestroy);
|
||||
client.RegisterHandler((short)MsgType.ObjectHide, OnLocalClientObjectHide);
|
||||
client.RegisterHandler((short)MsgType.ObjectSpawn, OnLocalClientObjectSpawn);
|
||||
client.RegisterHandler((short)MsgType.ObjectSpawnScene, OnLocalClientObjectSpawnScene);
|
||||
client.RegisterHandler((short)MsgType.SpawnPrefab, OnLocalClientSpawnPrefab);
|
||||
client.RegisterHandler((short)MsgType.SpawnSceneObject, OnLocalClientSpawnSceneObject);
|
||||
client.RegisterHandler((short)MsgType.LocalClientAuthority, OnClientAuthority);
|
||||
}
|
||||
else
|
||||
{
|
||||
// LocalClient shares the sim/scene with the server, no need for these events
|
||||
client.RegisterHandler((short)MsgType.ObjectSpawn, OnObjectSpawn);
|
||||
client.RegisterHandler((short)MsgType.ObjectSpawnScene, OnObjectSpawnScene);
|
||||
client.RegisterHandler((short)MsgType.SpawnPrefab, OnSpawnPrefab);
|
||||
client.RegisterHandler((short)MsgType.SpawnSceneObject, OnSpawnSceneObject);
|
||||
client.RegisterHandler((short)MsgType.SpawnFinished, OnObjectSpawnFinished);
|
||||
client.RegisterHandler((short)MsgType.ObjectDestroy, OnObjectDestroy);
|
||||
client.RegisterHandler((short)MsgType.ObjectHide, OnObjectDestroy);
|
||||
@ -373,9 +373,9 @@ static void ApplySpawnPayload(NetworkIdentity uv, Vector3 position, byte[] paylo
|
||||
}
|
||||
}
|
||||
|
||||
static void OnObjectSpawn(NetworkMessage netMsg)
|
||||
static void OnSpawnPrefab(NetworkMessage netMsg)
|
||||
{
|
||||
ObjectSpawnMessage msg = new ObjectSpawnMessage();
|
||||
SpawnPrefabMessage msg = new SpawnPrefabMessage();
|
||||
netMsg.ReadMessage(msg);
|
||||
|
||||
if (!msg.assetId.IsValid())
|
||||
@ -388,7 +388,7 @@ static void OnObjectSpawn(NetworkMessage netMsg)
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.NetworkDetailStats.IncrementStat(
|
||||
UnityEditor.NetworkDetailStats.NetworkDirection.Incoming,
|
||||
(short)MsgType.ObjectSpawn, GetStringForAssetId(msg.assetId), 1);
|
||||
(short)MsgType.SpawnPrefab, GetStringForAssetId(msg.assetId), 1);
|
||||
#endif
|
||||
|
||||
NetworkIdentity localNetworkIdentity;
|
||||
@ -444,9 +444,9 @@ static void OnObjectSpawn(NetworkMessage netMsg)
|
||||
}
|
||||
}
|
||||
|
||||
static void OnObjectSpawnScene(NetworkMessage netMsg)
|
||||
static void OnSpawnSceneObject(NetworkMessage netMsg)
|
||||
{
|
||||
ObjectSpawnSceneMessage msg = new ObjectSpawnSceneMessage();
|
||||
SpawnSceneObjectMessage msg = new SpawnSceneObjectMessage();
|
||||
netMsg.ReadMessage(msg);
|
||||
|
||||
if (LogFilter.logDebug) { Debug.Log("Client spawn scene handler instantiating [netId:" + msg.netId + " sceneId:" + msg.sceneId + " pos:" + msg.position); }
|
||||
@ -455,7 +455,7 @@ static void OnObjectSpawnScene(NetworkMessage netMsg)
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.NetworkDetailStats.IncrementStat(
|
||||
UnityEditor.NetworkDetailStats.NetworkDirection.Incoming,
|
||||
(short)MsgType.ObjectSpawnScene, "sceneId", 1);
|
||||
(short)MsgType.SpawnSceneObject, "sceneId", 1);
|
||||
#endif
|
||||
|
||||
NetworkIdentity localNetworkIdentity;
|
||||
@ -570,9 +570,9 @@ static void OnLocalClientObjectHide(NetworkMessage netMsg)
|
||||
}
|
||||
}
|
||||
|
||||
static void OnLocalClientObjectSpawn(NetworkMessage netMsg)
|
||||
static void OnLocalClientSpawnPrefab(NetworkMessage netMsg)
|
||||
{
|
||||
ObjectSpawnMessage msg = new ObjectSpawnMessage();
|
||||
SpawnPrefabMessage msg = new SpawnPrefabMessage();
|
||||
netMsg.ReadMessage(msg);
|
||||
|
||||
NetworkIdentity localObject;
|
||||
@ -582,9 +582,9 @@ static void OnLocalClientObjectSpawn(NetworkMessage netMsg)
|
||||
}
|
||||
}
|
||||
|
||||
static void OnLocalClientObjectSpawnScene(NetworkMessage netMsg)
|
||||
static void OnLocalClientSpawnSceneObject(NetworkMessage netMsg)
|
||||
{
|
||||
ObjectSpawnSceneMessage msg = new ObjectSpawnSceneMessage();
|
||||
SpawnSceneObjectMessage msg = new SpawnSceneObjectMessage();
|
||||
netMsg.ReadMessage(msg);
|
||||
|
||||
NetworkIdentity localObject;
|
||||
|
@ -173,7 +173,7 @@ internal class SyncListMessage<T> where T: struct
|
||||
|
||||
// ---------- Internal System Messages -------------------
|
||||
|
||||
class ObjectSpawnMessage : MessageBase
|
||||
class SpawnPrefabMessage : MessageBase
|
||||
{
|
||||
public NetworkInstanceId netId;
|
||||
public NetworkHash128 assetId;
|
||||
@ -200,7 +200,7 @@ public override void Serialize(NetworkWriter writer)
|
||||
}
|
||||
}
|
||||
|
||||
class ObjectSpawnSceneMessage : MessageBase
|
||||
class SpawnSceneObjectMessage : MessageBase
|
||||
{
|
||||
public NetworkInstanceId netId;
|
||||
public NetworkSceneId sceneId;
|
||||
|
@ -1151,7 +1151,7 @@ static internal void SendSpawnMessage(NetworkIdentity uv, NetworkConnection conn
|
||||
// 'uv' is a prefab that should be spawned
|
||||
if (uv.sceneId.IsEmpty())
|
||||
{
|
||||
ObjectSpawnMessage msg = new ObjectSpawnMessage();
|
||||
SpawnPrefabMessage msg = new SpawnPrefabMessage();
|
||||
msg.netId = uv.netId;
|
||||
msg.assetId = uv.assetId;
|
||||
msg.position = uv.transform.position;
|
||||
@ -1165,24 +1165,24 @@ static internal void SendSpawnMessage(NetworkIdentity uv, NetworkConnection conn
|
||||
// conn is != null when spawning it for a client
|
||||
if (conn != null)
|
||||
{
|
||||
conn.Send((short)MsgType.ObjectSpawn, msg);
|
||||
conn.Send((short)MsgType.SpawnPrefab, msg);
|
||||
}
|
||||
// conn is == null when spawning it for the local player
|
||||
else
|
||||
{
|
||||
SendToReady(uv.gameObject, (short)MsgType.ObjectSpawn, msg);
|
||||
SendToReady(uv.gameObject, (short)MsgType.SpawnPrefab, msg);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.NetworkDetailStats.IncrementStat(
|
||||
UnityEditor.NetworkDetailStats.NetworkDirection.Outgoing,
|
||||
(short)MsgType.ObjectSpawn, uv.assetId.ToString(), 1);
|
||||
(short)MsgType.SpawnPrefab, uv.assetId.ToString(), 1);
|
||||
#endif
|
||||
}
|
||||
// 'uv' is a scene object that should be spawned again
|
||||
else
|
||||
{
|
||||
ObjectSpawnSceneMessage msg = new ObjectSpawnSceneMessage();
|
||||
SpawnSceneObjectMessage msg = new SpawnSceneObjectMessage();
|
||||
msg.netId = uv.netId;
|
||||
msg.sceneId = uv.sceneId;
|
||||
msg.position = uv.transform.position;
|
||||
@ -1195,18 +1195,18 @@ static internal void SendSpawnMessage(NetworkIdentity uv, NetworkConnection conn
|
||||
// conn is != null when spawning it for a client
|
||||
if (conn != null)
|
||||
{
|
||||
conn.Send((short)MsgType.ObjectSpawnScene, msg);
|
||||
conn.Send((short)MsgType.SpawnSceneObject, msg);
|
||||
}
|
||||
// conn is == null when spawning it for the local player
|
||||
else
|
||||
{
|
||||
SendToReady(uv.gameObject, (short)MsgType.ObjectSpawnScene, msg);
|
||||
SendToReady(uv.gameObject, (short)MsgType.SpawnSceneObject, msg);
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.NetworkDetailStats.IncrementStat(
|
||||
UnityEditor.NetworkDetailStats.NetworkDirection.Outgoing,
|
||||
(short)MsgType.ObjectSpawnScene, "sceneId", 1);
|
||||
(short)MsgType.SpawnSceneObject, "sceneId", 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -22,14 +22,14 @@ public enum MsgType : short
|
||||
// internal system messages - cannot be replaced by user code
|
||||
ObjectDestroy = 1,
|
||||
Rpc = 2,
|
||||
ObjectSpawn = 3,
|
||||
Owner = 4,
|
||||
Command = 5,
|
||||
LocalPlayerTransform = 6,
|
||||
SyncEvent = 7,
|
||||
UpdateVars = 8,
|
||||
SyncList = 9,
|
||||
ObjectSpawnScene = 10,
|
||||
SpawnPrefab = 3,
|
||||
SpawnSceneObject = 10,
|
||||
SpawnFinished = 12,
|
||||
ObjectHide = 13,
|
||||
LocalClientAuthority = 15,
|
||||
|
Loading…
Reference in New Issue
Block a user