예제 #1
0
        private IEnumerator CheckConnection(string url)
        {
            m_IsChecking = true;
            using (UnityWebRequest request = UnityWebRequest.Get(url))
            {
                request.timeout = 30;
                yield return(request.SendWebRequest());

                m_IsChecking = false;
                m_Timer      = m_UpdateFrequency;
                if (request.isNetworkError || request.isHttpError || ForceInternetDown)
                {
                    UnityEngine.Debug.LogErrorFormat("Response URL : {0}, Error : {1}, Response Code : {2}", request.url, request.error, request.responseCode);
                    m_RetryCount++;
                    if (m_RetryCount >= MaxRetries)
                    {
                        OnConnectionVerified(false);
                    }
                }
                else
                {
                    XDebug.Log("Response URL : " + request.url + "\nText : " + request.downloadHandler.text + "\nResponse Code : " + request.responseCode, XDebug.Mask.ConnectivityMonitor, XDebug.Color.Yellow);

                    //Call succeeded, now check if the data returned is what we expect.
                    if (request.downloadHandler.text.Equals("true") || request.downloadHandler.text.Equals("true\n"))
                    {
                        OnConnectionVerified(true);
                    }
                    else
                    {
                        //The call was successfull, but content was wrong, this happens in case of ISP login.
                        m_RetryCount++;
                        if (m_RetryCount >= MaxRetries)
                        {
                            OnConnectionVerified(false);
                        }
                    }
                }
            }
        }
예제 #2
0
 public override void OnJoinedLobby()
 {
     XDebug.Log("On Joined Lobby", XDebug.Mask.GameManager, null);
 }
예제 #3
0
 public override void OnLobbyStatisticsUpdate(List <TypedLobbyInfo> lobbyStatistics)
 {
     XDebug.Log("On Lobby Statistics Update\nCount = " + lobbyStatistics[0].RoomCount, XDebug.Mask.GameManager, XDebug.Color.Yellow);
 }
예제 #4
0
 public override void OnRoomListUpdate(List <RoomInfo> roomList)
 {
     XDebug.Log("Updated room list", XDebug.Mask.GameManager, XDebug.Color.Yellow);
     NetworkData.Instance.UpdateRoomList(roomList);
 }
예제 #5
0
 public override void OnPlayerLeftRoom(Player otherPlayer)
 {
     XDebug.Log("On Player Left Room - " + otherPlayer.NickName + "\nTotal Player Count = " + PhotonNetwork.CurrentRoom.PlayerCount, XDebug.Mask.GameManager, XDebug.Color.Red);
     MyEventManager.Instance.OnPlayerLeft.Dispatch();
 }
예제 #6
0
 public void OnCreatedOrJoinedRoom()
 {
     XDebug.Log("Loading finished...Waiting Scene will be loaded now", XDebug.Mask.MainMenu);
     SceneManager.Instance.LoadScene(SceneManager.Scene.WaitScene, UnityEngine.SceneManagement.LoadSceneMode.Single);
 }
예제 #7
0
 public override void OnCreateRoomFailed(short returnCode, string message)
 {
     XDebug.Log("On Create Room Failed - code = " + returnCode + "\nMessage = " + message, XDebug.Mask.GameManager, XDebug.Color.Red);
 }
예제 #8
0
 public override void OnConnected()
 {
     base.OnConnected();
     XDebug.Log("On Connected", XDebug.Mask.GameManager, null);
 }
예제 #9
0
 public void UpdateGameState(GameState gameState)
 {
     XDebug.Log("Updating Game State", XDebug.Mask.GameStateManager, XDebug.Color.Yellow);
     this.CurrentGameState = gameState;
     MyEventManager.Instance.OnGameStateUpdated.Dispatch();
 }