public override void OnInspectorGUI() { EditorGUILayout.LabelField("LAN IP", TNet.Tools.localAddress.ToString()); EditorGUILayout.LabelField("WAN IP", TNet.Tools.externalAddress.ToString()); EditorGUILayout.LabelField("Player Name", TNManager.playerName); if (TNManager.isConnected) { EditorGUILayout.LabelField("Ping", TNManager.ping.ToString()); List <Channel> list = TNManager.channels; foreach (Channel ch in list) { GUILayout.Space(6f); EditorGUILayout.LabelField("Channel #" + ch.id, TNManager.GetHost(ch.id).name); EditorGUILayout.LabelField("Players", (TNManager.GetPlayers(ch.id).size + 1).ToString()); EditorGUILayout.LabelField("Host", (TNManager.GetHost(ch.id).name).ToString()); } } serializedObject.Update(); if (Application.isPlaying) { EditorGUI.BeginDisabledGroup(true); serializedObject.DrawProperty("objects", "Referenced Objects"); EditorGUI.EndDisabledGroup(); } else { serializedObject.DrawProperty("objects", "Referenced Objects"); } serializedObject.ApplyModifiedProperties(); }
public void Disconnect() { // find other players var otherplayers = TNManager.GetPlayers(channelID); if (otherplayers.Count > 0) { var newHost = otherplayers.buffer[0]; TNManager.SetHost(channelID, newHost); gameEvents.OnChangeHost.Invoke(newHost.id); } // Debug.Log("Disconnecting"); TNManager.Disconnect(); }