private void DrawNetworkChannel(INetworkChannel networkChannel) { EditorGUILayout.BeginVertical("box"); { EditorGUILayout.LabelField(networkChannel.Name, networkChannel.Connected ? "Connected" : "Disconnected"); EditorGUILayout.LabelField("Service Type", networkChannel.ServiceType.ToString()); EditorGUILayout.LabelField("Address Family", networkChannel.AddressFamily.ToString()); EditorGUILayout.LabelField("Local Address", networkChannel.Connected ? networkChannel.Socket.LocalEndPoint.ToString() : "Unavailable"); EditorGUILayout.LabelField("Remote Address", networkChannel.Connected ? networkChannel.Socket.RemoteEndPoint.ToString() : "Unavailable"); EditorGUILayout.LabelField("Send Packet", Utility.Text.Format("{0} / {1}", networkChannel.SendPacketCount.ToString(), networkChannel.SentPacketCount.ToString())); EditorGUILayout.LabelField("Receive Packet", Utility.Text.Format("{0} / {1}", networkChannel.ReceivePacketCount.ToString(), networkChannel.ReceivedPacketCount.ToString())); EditorGUILayout.LabelField("Miss Heart Beat Count", networkChannel.MissHeartBeatCount.ToString()); EditorGUILayout.LabelField("Heart Beat", Utility.Text.Format("{0} / {1}", networkChannel.HeartBeatElapseSeconds.ToString("F2"), networkChannel.HeartBeatInterval.ToString("F2"))); EditorGUI.BeginDisabledGroup(!networkChannel.Connected); { if (GUILayout.Button("Disconnect")) { networkChannel.Close(); } } EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndVertical(); EditorGUILayout.Separator(); }
public void DestroyChannel(string channelName) { INetworkChannel channel = GetChannel(channelName); if (channel == null) { return; } channel.Close(); m_ChannelDic.Remove(channelName); }
private void DrawNetworkChannel(INetworkChannel networkChannel) { EditorGUILayout.BeginVertical("box"); { EditorGUILayout.LabelField(networkChannel.Name, networkChannel.Connected ? "Connected" : "Disconnected"); EditorGUILayout.LabelField("Network Type", networkChannel.NetworkType.ToString()); EditorGUILayout.LabelField("Local Address", networkChannel.Connected ? string.Format("{0}:{1}", networkChannel.LocalIPAddress.ToString(), networkChannel.LocalPort.ToString()) : "Unknown"); EditorGUILayout.LabelField("Remote Address", networkChannel.Connected ? string.Format("{0}:{1}", networkChannel.RemoteIPAddress.ToString(), networkChannel.RemotePort.ToString()) : "Unknown"); EditorGUILayout.LabelField("Heart Beat Interval", networkChannel.HeartBeatInterval.ToString()); EditorGUI.BeginDisabledGroup(!networkChannel.Connected); { if (GUILayout.Button("Disconnect")) { networkChannel.Close(); } } EditorGUI.EndDisabledGroup(); } EditorGUILayout.EndVertical(); EditorGUILayout.Separator(); }
private void DrawNetworkChannel(INetworkChannel networkChannel) { GUILayout.Label(Utility.Text.Format("<b>Network Channel: {0} ({1})</b>", networkChannel.Name, networkChannel.Connected ? "Connected" : "Disconnected")); GUILayout.BeginVertical("box"); { DrawItem("Service Type", networkChannel.ServiceType.ToString()); DrawItem("Address Family", networkChannel.AddressFamily.ToString()); DrawItem("Local Address", networkChannel.Connected ? networkChannel.Socket.LocalEndPoint.ToString() : "Unavailable"); DrawItem("Remote Address", networkChannel.Connected ? networkChannel.Socket.RemoteEndPoint.ToString() : "Unavailable"); DrawItem("Send Packet", Utility.Text.Format("{0} / {1}", networkChannel.SendPacketCount.ToString(), networkChannel.SentPacketCount.ToString())); DrawItem("Receive Packet", Utility.Text.Format("{0} / {1}", networkChannel.ReceivePacketCount.ToString(), networkChannel.ReceivedPacketCount.ToString())); DrawItem("Miss Heart Beat Count", networkChannel.MissHeartBeatCount.ToString()); DrawItem("Heart Beat", Utility.Text.Format("{0} / {1}", networkChannel.HeartBeatElapseSeconds.ToString("F2"), networkChannel.HeartBeatInterval.ToString("F2"))); if (networkChannel.Connected) { if (GUILayout.Button("Disconnect", GUILayout.Height(30f))) { networkChannel.Close(); } } } GUILayout.EndVertical(); }