void Update() { if (IsScreenVisible()) { if (PhotonNetwork.connected) { if (PhotonNetwork.inRoom) { UILobby.HideScreen(); UIRoom.ShowScreen(); } else if (PhotonNetwork.insideLobby) { UpdateRoomList(PhotonNetwork.GetRoomList()); } } else { UIDialog.Show("Disconnected From Photon"); UILobby.HideScreen(); UIConnect.ShowScreen(); } } }
IEnumerator OnLeaveRoutine() { if (QuantumRunner.Current) { // unload current map if (QuantumGame.Running) { var mapData = FindObjectOfType <MapData>(); if (mapData) { Destroy(mapData.gameObject); } } // leave room PhotonNetwork.LeaveRoom(); // shutdown runner QuantumRunner.Current.Shutdown(); // wait one second yield return(new WaitForSeconds(1f)); // hide leave game button UILeaveGame.HideScreen(); // are we still connected? if (PhotonNetwork.connected) { // goto lobby UILobby.ShowScreen(); } else { // goto connect screen UIConnect.ShowScreen(); } } _leaveRoutine = null; }