/// <summary> /// Draw an inspector GUI for this network /// </summary> public void OnInspectorGui() { #if UNITY_EDITOR string mode = "None"; if (Mode == NetworkMode.Host) { mode = "Server & Client"; } else if (Mode == NetworkMode.Client) { mode = "Client"; } else if (Mode == NetworkMode.DedicatedServer) { mode = "Server"; } EditorGUILayout.LabelField("Mode", mode); if (!Mode.IsServerEnabled() && !Mode.IsClientEnabled()) { return; } EditorGUILayout.LabelField("Connection Status", Status.ToString()); EditorGUILayout.LabelField("Received"); EditorGUI.indentLevel++; try { if (Client != null) { EditorGUILayout.LabelField("Client"); EditorGUI.indentLevel++; try { EditorGUILayout.LabelField("Handshake Response", Client.RecvHandshakeResponse.ToString()); EditorGUILayout.LabelField("Handshake P2P", Client.RecvHandshakeP2P.ToString()); EditorGUILayout.LabelField("Client State", Client.RecvClientState.ToString()); EditorGUILayout.LabelField("Join/Leave Channel", Client.RecvDeltaState.ToString()); EditorGUILayout.LabelField("Remove Client", Client.RecvRemoveClient.ToString()); EditorGUILayout.LabelField("Voice Data", Client.RecvVoiceData.ToString()); EditorGUILayout.LabelField("Text Data", Client.RecvTextData.ToString()); uint totalPackets, totalBytes, totalBytesPerSecond; TrafficCounter.Combine( out totalPackets, out totalBytes, out totalBytesPerSecond, Client.RecvHandshakeResponse, Client.RecvHandshakeP2P, Client.RecvClientState, Client.RecvDeltaState, Client.RecvRemoveClient, Client.RecvVoiceData, Client.RecvTextData ); EditorGUILayout.LabelField("TOTAL", TrafficCounter.Format(totalPackets, totalBytes, totalBytesPerSecond)); } finally { EditorGUI.indentLevel--; } } if (Server != null) { EditorGUILayout.LabelField("Server"); EditorGUI.indentLevel++; try { EditorGUILayout.LabelField("Handshake", Server.RecvHandshakeRequest.ToString()); EditorGUILayout.LabelField("Client State", Server.RecvClientState.ToString()); EditorGUILayout.LabelField("P2P Relay", Server.RecvPacketRelay.ToString()); EditorGUILayout.LabelField("Delta Channel State", Server.RecvDeltaChannelState.ToString()); uint totalPackets, totalBytes, totalBytesPerSecond; TrafficCounter.Combine(out totalPackets, out totalBytes, out totalBytesPerSecond, Server.RecvHandshakeRequest, Server.RecvClientState, Server.RecvPacketRelay, Server.RecvDeltaChannelState); EditorGUILayout.LabelField("TOTAL", TrafficCounter.Format(totalPackets, totalBytes, totalBytesPerSecond)); } finally { EditorGUI.indentLevel--; } } } finally { EditorGUI.indentLevel--; } EditorGUILayout.LabelField("Sent"); EditorGUI.indentLevel++; try { if (Server != null) { EditorGUILayout.LabelField("Server To Client", Server.SentTraffic.ToString()); } if (Client != null) { EditorGUILayout.LabelField("Client To Server", Client.SentServerTraffic.ToString()); } } finally { EditorGUI.indentLevel--; } #endif }