diff --git a/Mirror/Editor/Mirror.Editor.csproj b/Mirror/Editor/Mirror.Editor.csproj index bf2bb43d2..2c42c8a5d 100644 --- a/Mirror/Editor/Mirror.Editor.csproj +++ b/Mirror/Editor/Mirror.Editor.csproj @@ -59,7 +59,6 @@ - diff --git a/Mirror/Editor/NetworkManagerPreview.cs b/Mirror/Editor/NetworkManagerPreview.cs deleted file mode 100644 index e1224fc4a..000000000 --- a/Mirror/Editor/NetworkManagerPreview.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; -using UnityObject = UnityEngine.Object; - -namespace Mirror -{ - [CustomPreview(typeof(NetworkManager))] - class NetworkManagerPreview : ObjectPreview - { - NetworkManager m_Manager; - GUIContent m_Title; - - protected GUIContent m_ShowServerMessagesLabel; - protected GUIContent m_ShowClientMessagesLabel; - - const int k_Padding = 4; - const int k_ColumnWidth = 120; - const int k_RowHeight = 16; - - public override void Initialize(UnityObject[] targets) - { - base.Initialize(targets); - GetNetworkInformation(target as NetworkManager); - - m_ShowServerMessagesLabel = new GUIContent("Server Message Handlers:", "Registered network message handler functions"); - m_ShowClientMessagesLabel = new GUIContent("Client Message Handlers:", "Registered network message handler functions"); - } - - public override GUIContent GetPreviewTitle() - { - m_Title = m_Title ?? new GUIContent("NetworkManager Message Handlers"); - return m_Title; - } - - public override bool HasPreviewGUI() - { - return m_Manager != null; - } - - public override void OnPreviewGUI(Rect r, GUIStyle background) - { - if (Event.current.type != EventType.Repaint) - return; - - if (m_Manager == null) - return; - - int posY = (int)(r.yMin + k_Padding); - - posY = ShowServerMessageHandlers(r, posY); - ShowClientMessageHandlers(r, posY); - } - - static string FormatHandler(KeyValuePair handler) - { - return string.Format("{0}:{1}()", - handler.Value.Method.DeclaringType.Name, - handler.Value.Method.Name); - } - - int ShowServerMessageHandlers(Rect r, int posY) - { - if (NetworkServer.handlers.Count == 0) - return posY; - - GUI.Label(new Rect(r.xMin + k_Padding, posY, 400, k_RowHeight), m_ShowServerMessagesLabel); - posY += k_RowHeight; - - foreach (var handler in NetworkServer.handlers) - { - GUI.Label(new Rect(r.xMin + k_Padding * 4, posY, 400, k_RowHeight), ((MsgType)handler.Key).ToString()); - GUI.Label(new Rect(r.xMin + k_Padding * 4 + k_ColumnWidth, posY, 400, k_RowHeight), FormatHandler(handler)); - posY += k_RowHeight; - } - return posY; - } - - int ShowClientMessageHandlers(Rect r, int posY) - { - if (NetworkClient.allClients.Count == 0) - return posY; - - NetworkClient client = NetworkClient.allClients[0]; - if (client == null) - return posY; - - GUI.Label(new Rect(r.xMin + k_Padding, posY, 400, k_RowHeight), m_ShowClientMessagesLabel); - posY += k_RowHeight; - - foreach (var handler in client.handlers) - { - GUI.Label(new Rect(r.xMin + k_Padding * 4, posY, 400, k_RowHeight), ((MsgType)handler.Key).ToString()); - GUI.Label(new Rect(r.xMin + k_Padding * 4 + k_ColumnWidth, posY, 400, k_RowHeight), FormatHandler(handler)); - posY += k_RowHeight; - } - return posY; - } - - void GetNetworkInformation(NetworkManager man) - { - m_Manager = man; - } - } -}