IEnumerator reconnectToPhotonServer() { PhotonNetwork.Reconnect(); if (!PhotonNetwork.IsConnectedAndReady) { yield return(null); } if (ConnLostAlertOnly.activeSelf == false) { ConnLostAlertWithReconnButton.SetActive(false); } else { ConnLostAlertOnly.SetActive(false); } ReconnectAlert.SetActive(true); ReconnectResultText.text = "Sukses terhubung kembali!"; }
void Start() { if (DisconnectedFromScene == "Login" || DisconnectedFromScene == "Mainmenu" || DisconnectedFromScene == "Tutorial" || DisconnectedFromScene == "SelectMode") { if (DisconnectCauses == "Create or Join Room Failed") { ConnLostAlertOnly.SetActive(true); WarningMessageTextAlertOnly.text = "Gagal masuk ke dalam room!\n Silahkan periksa koneksi anda."; ErrorMessageTextAlertOnly.text = "Err Message : " + DisconnectCauses; } else { ConnLostAlertWithReconnButton.SetActive(true); ErrorMessageTextReconAlert.text = "Err Message : " + DisconnectCauses; Debug.Log("Connected status : " + PhotonNetwork.IsConnectedAndReady); } } else { ConnLostAlertOnly.SetActive(true); if (DisconnectCauses == "Other player disconnected") { WarningMessageTextAlertOnly.text = "Jaringan pemain lain terputus\n Permainan dihentikan!"; } else if (DisconnectCauses == "Other player leave the room") { WarningMessageTextAlertOnly.text = "Pemain lain keluar dari room\n Permainan dihentikan!"; } else if (DisconnectCauses == "Connection lost" && DisconnectedFromScene == "Gameplay") { WarningMessageTextAlertOnly.text = "Terjadi Kesalahan Jaringan\n Permainan dihentikan!"; } ErrorMessageTextAlertOnly.text = "Err Message : " + DisconnectCauses; Debug.Log("Connected status : " + PhotonNetwork.IsConnectedAndReady); } }
public void ReconnectButton() { ConnLostAlertWithReconnButton.SetActive(false); StartCoroutine(reconnectToPhotonServer()); }