Beispiel #1
0
 public void OnMatchJoined(JoinMatchResponse aMatchResponse)
 {
     if (aMatchResponse.success)
     {
         try
         {
             NetworkManager.singleton.OnMatchJoined(aMatchResponse);
         }
         catch (ArgumentException e)
         {
             m_state = eMatchmakingState.GAME_STATE_SHOW_ROOMS;
             GameObject.Find("Version Text").transform.SetParent(GameObject.Find("Canvas").transform);
             GameObject.Find("FullScreen").transform.SetParent(GameObject.Find("Canvas").transform);
             GameObject.Find("DialogDisplay").GetComponent <DialogDisplay>().DisplayDialog("You just left that room!");
             Debug.Log("caught ArgumentException " + e);
         }
         catch (Exception e)
         {
             m_state = eMatchmakingState.GAME_STATE_SHOW_ROOMS;
             GameObject.Find("Version Text").transform.SetParent(GameObject.Find("Canvas").transform);
             GameObject.Find("FullScreen").transform.SetParent(GameObject.Find("Canvas").transform);
             GameObject.Find("DialogDisplay").GetComponent <DialogDisplay>().DisplayDialog("Error joining room! Try restarting.");
             Debug.Log("caught Exception " + e);
         }
     }
     else
     {
         m_state = eMatchmakingState.GAME_STATE_SHOW_ROOMS;
         GameObject.Find("Version Text").transform.SetParent(GameObject.Find("Canvas").transform);
         GameObject.Find("FullScreen").transform.SetParent(GameObject.Find("Canvas").transform);
         GameObject.Find("DialogDisplay").GetComponent <DialogDisplay>().DisplayDialog("Could not join room!");
         Debug.LogError("Join match failed");
     }
 }
Beispiel #2
0
    public void OnMatchJoined(JoinMatchResponse matchJoin)
    {
        if (matchJoin.success)
        {
            connectionStatus = "Joined Match. Connecting...";

            joiningPanel.gameObject.SetActive(false);

            if (matchCreated)
            {
                connectionStatus = "Error. Cannot connect.";
                return;
            }

            Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString));
            NetworkClient myClient = new NetworkClient();
            myClient.RegisterHandler(MsgType.Connect, OnConnected);
            matchInfo = new MatchInfo(matchJoin);
            myClient.Connect(matchInfo);
        }
        else
        {
            connectionStatus = "Join match failed";
        }
    }
Beispiel #3
0
    public void OnFixedUpdateTick()
    {
        if (findMatchRequest == null || !findMatchRequest.isDone)
        {
            return;
        }

        if (findMatchRequest.isNetworkError || findMatchRequest.isHttpError)
        {
            DIContainer.Logger.Error(findMatchRequest.error);
            matchStateMachine.ChangeMatchState(new IdleMatchState());
        }
        else
        {
            DIContainer.Logger.Debug("WebServer Response " + findMatchRequest.downloadHandler.text);
            JoinMatchResponse joinMatchResponse = DIContainer.Serializer.Deserialize <JoinMatchResponse>(findMatchRequest.downloadHandler.text);

            if (joinMatchResponse == null)
            {
                DIContainer.Logger.Error("JoinMatchResponse is null!");
                return;
            }

            joinMatchResponse.IP = joinMatchResponse.IP == "::1" ? "localhost" : joinMatchResponse.IP;

            matchStateMachine.InitializeUdpClient(joinMatchResponse.IP, joinMatchResponse.Port);
            DIContainer.Logger.Debug(string.Format("Joined match with IP: {0} and Port: {1}", joinMatchResponse.IP, joinMatchResponse.Port));
            matchStateMachine.ChangeMatchState(new TimeSyncMatchState());
        }
    }
Beispiel #4
0
 public JoinedMatchInformation(JoinMatchResponse response) : this(
         response.accessTokenString,
         response.networkId,
         response.nodeId
         )
 {
 }
Beispiel #5
0
    public void OnMatchJoined(JoinMatchResponse matchJoin)
    {
        this.networkId = matchJoin.networkId;
        this.nodeId    = matchJoin.nodeId;

        if (matchJoin.success)
        {
            NetManager.singleton.OnMatchJoined(matchJoin);
        }
    }
        public void OnJoinMatch(JoinMatchResponse response)
        {
            this.response = response;

            if (this.response.success)
            {
                this.networkManager.OnMatchJoined(response);
                this.nextState = new InGameClientState(this.networkManager, this.networkMatch);
            }
        }
 public void OnServerMatchJoined(JoinMatchResponse matchJoin)
 {
     if (matchJoin.success)
     {
         _clientConnection = ClientScene.ConnectLocalServer();
     }
     else
     {
         Debug.LogError("Join match failed");
     }
 }
Beispiel #8
0
 public virtual void joinGameCallback(JoinMatchResponse resp)
 {
     Debug.Log("Join response: " + resp.ToString());
     if (resp.success == true)
     {
         Debug.Log("JOIN OK");
         doRefresh = false;
         OnMatchJoined(resp);
         ServerChangeScene(onlineScene);  //is this necessary??
     }
 }
Beispiel #9
0
 public void OnMatchJoined(JoinMatchResponse matchJoin)
 {
     if (matchJoin.success)
     {
         Debug.Log("Join match succeeded");
         Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString));
         NetworkClient nc = nm.StartClient(new MatchInfo(matchJoin));
         nc.RegisterHandler(MsgType.Connect, OnConnected);
     }
     else
     {
         Debug.LogError("Join match failed");
     }
 }
Beispiel #10
0
    //public void UIConfirmJoin()
    //{
    //    matchMaker.JoinMatch(matches[(int)m_matchAttemptIndex].networkId, m_matchPswdEnterIF.text, _OnJoinMatch);
    //    m_matchConfirmPanel.SetActive(false);
    //    StartCoroutine(_Waiting("ENTERING THE ROOM"));
    //}

    //public void UICancelJoin()
    //{
    //    m_matchPswdEnterIF.text = "";
    //    m_matchConfirmPanel.SetActive(false);
    //}

    private void _OnJoinMatch (JoinMatchResponse response)
    {
        if (response.success)
        {
            if (Utility.GetAccessTokenForNetwork(response.networkId) == null)
                Utility.SetAccessTokenForNetwork(response.networkId, new NetworkAccessToken(response.accessTokenString));
            client = StartClient(new MatchInfo(response));
            m_netStt = ConstantDefine.NetworkState.Client;
        }
        else
        {
            m_waitingPanel.SetActive(false);
            _Error("FAILED TO ENTER A ROOM");
        }
    }
Beispiel #11
0
 public void OnMatchJoined(JoinMatchResponse matchInfo)
 {
     if (LogFilter.logDebug)
     {
         Debug.Log("NetworkManager OnMatchJoined ");
     }
     if (matchInfo.success)
     {
         Utility.SetAccessTokenForNetwork(matchInfo.networkId, new NetworkAccessToken(matchInfo.accessTokenString));
         StartClient(new MatchInfo(matchInfo));
     }
     else if (LogFilter.logError)
     {
         Debug.LogError("Join Failed:" + matchInfo);
     }
 }
 public void OnMatchJoined(JoinMatchResponse matchJoin)
 {
     if (matchJoin.success)
     {
         Debug.Log("Join match succeeded");
         if (matchCreated)
         {
             Debug.LogWarning("Match alread set up, abort...");
             return;
         }
         Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString));
         NetworkClient myClient = new NetworkClient();
         myClient.RegisterHandler(MsgType.Connect, OnConnected);
         myClient.Connect(new MatchInfo(matchJoin));
     }
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="response"></param>
 private void _OnJoinMatch(JoinMatchResponse response)
 {
     MatchUI.instance.StopWait();
     if (response.success)
     {
         if (Utility.GetAccessTokenForNetwork(response.networkId) == null)
         {
             Utility.SetAccessTokenForNetwork(response.networkId, new NetworkAccessToken(response.accessTokenString));
         }
         client         = StartClient(new MatchInfo(response));
         m_networkState = ConstantDefine.NetworkState.Client;
     }
     else
     {
     }
 }
Beispiel #14
0
 public void OnJoinMatch(JoinMatchResponse res)
 {
     if (res.success)
     {
         loading = false;
         if (RoomUI != null)
         {
             RoomUI.SetActive(false);
         }
         MatchInfo hostInfo = new MatchInfo(res);
         NetworkManager.singleton.StartClient(hostInfo);
     }
     else
     {
         Debug.LogError("Join match failed");
     }
 }
Beispiel #15
0
 //this is hack because unity OnMatchJoined not virtual...
 public virtual void MatchJoined(JoinMatchResponse matchInfo)
 {
     if (matchInfo.success)
     {
         try
         {
             Utility.SetAccessTokenForNetwork(matchInfo.networkId, new NetworkAccessToken(matchInfo.accessTokenString));
         }
         catch (System.ArgumentException ex)
         {
             if (LogFilter.logError)
             {
                 Debug.LogError(ex);
             }
         }
         StartClient(new MatchInfo(matchInfo));
     }
     else if (LogFilter.logError)
     {
         Debug.LogError(string.Concat("Join Failed:", matchInfo));
     }
 }
Beispiel #16
0
    public void OnMatchJoined(JoinMatchResponse matchJoin)
    {
        if (matchJoin.success)
        {
            UnityEngine.Debug.Log("Join match succeeded");
            if (matchCreated)
            {
                UnityEngine.Debug.LogWarning("Match already set up, aborting...");
                return;
            }

            NetworkManager.singleton.StartClient(new MatchInfo(matchJoin));
//			Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString));
//			NetworkClient myClient = new NetworkClient();
//			myClient.RegisterHandler(MsgType.Connect, OnConnected);
//			myClient.Connect(new MatchInfo(matchJoin));
        }
        else
        {
            UnityEngine.Debug.LogError("Join match failed");
        }
    }
Beispiel #17
0
    // When we've joined a match we connect to the server/host
    public void OnMatchJoined(JoinMatchResponse matchJoin)
    {
        if (matchJoin.success)
        {
            Debug.Log("Join match succeeded");
            Utility.SetAccessTokenForNetwork(matchJoin.networkId,
                                             new NetworkAccessToken(matchJoin.accessTokenString));

            m_MatchJoined = true;
            m_MatchInfo   = new MatchInfo(matchJoin);

            Debug.Log("Connecting to Address:" + matchJoin.address +
                      " Port:" + matchJoin.port +
                      " NetworKID: " + matchJoin.networkId +
                      " NodeID: " + matchJoin.nodeId);
            ConnectThroughRelay(matchJoin.address, matchJoin.port, matchJoin.networkId,
                                matchJoin.nodeId);
        }
        else
        {
            Debug.LogError("Join match failed");
        }
    }
Beispiel #18
0
    private void onMatchJoined(JoinMatchResponse joinResponse)
    {
        if (joinResponse.success)
        {
            Debug.Log("Joining match...");
            if (_matchCreated)
            {
                Debug.LogWarning("Match already set up.... aborting");
                return;
            }

            Utility.SetAccessTokenForNetwork(joinResponse.networkId, new UnityEngine.Networking.Types.NetworkAccessToken(joinResponse.accessTokenString));
            FindObjectOfType <CustomLobbyManager>().StartClient(new MatchInfo(joinResponse));

            readyButton.gameObject.SetActive(true);
            playerList.transform.parent.gameObject.SetActive(true);
        }
        else
        {
            joinButton.gameObject.SetActive(true);
            hostButton.gameObject.SetActive(true);
            Debug.LogError("Failed to join match");
        }
    }