From 2dd907fb28411f4434e9dcbc6cacba35f3a296e6 Mon Sep 17 00:00:00 2001 From: vis2k Date: Fri, 20 Jul 2018 16:37:05 +0200 Subject: [PATCH] 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. --- .../Runtime/ClientScene.cs | 30 +++++++++---------- .../Runtime/Messages.cs | 4 +-- .../Runtime/NetworkServer.cs | 16 +++++----- .../Runtime/UNetwork.cs | 4 +-- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Unity-Technologies-networking/Runtime/ClientScene.cs b/Unity-Technologies-networking/Runtime/ClientScene.cs index aa26b89bc..40ff0db0b 100644 --- a/Unity-Technologies-networking/Runtime/ClientScene.cs +++ b/Unity-Technologies-networking/Runtime/ClientScene.cs @@ -221,7 +221,7 @@ internal static void PrepareToSpawnSceneObjects() { var uv = uvs[i]; // not spawned yet etc.? - if (!uv.gameObject.activeSelf && + if (!uv.gameObject.activeSelf && uv.gameObject.hideFlags != HideFlags.NotEditable && uv.gameObject.hideFlags != HideFlags.HideAndDontSave && !uv.sceneId.IsEmpty()) { @@ -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; diff --git a/Unity-Technologies-networking/Runtime/Messages.cs b/Unity-Technologies-networking/Runtime/Messages.cs index 362549cb0..4ff233f50 100644 --- a/Unity-Technologies-networking/Runtime/Messages.cs +++ b/Unity-Technologies-networking/Runtime/Messages.cs @@ -173,7 +173,7 @@ internal class SyncListMessage 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; diff --git a/Unity-Technologies-networking/Runtime/NetworkServer.cs b/Unity-Technologies-networking/Runtime/NetworkServer.cs index 58c69d0f8..2c6c94c25 100644 --- a/Unity-Technologies-networking/Runtime/NetworkServer.cs +++ b/Unity-Technologies-networking/Runtime/NetworkServer.cs @@ -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 } } diff --git a/Unity-Technologies-networking/Runtime/UNetwork.cs b/Unity-Technologies-networking/Runtime/UNetwork.cs index aa02a6f32..87a69f6e2 100644 --- a/Unity-Technologies-networking/Runtime/UNetwork.cs +++ b/Unity-Technologies-networking/Runtime/UNetwork.cs @@ -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,