Inheritance: BasicResponse
示例#1
0
    public void OnMatchJoined(JoinMatchResponse matchJoin)
    {
        if (matchJoin.success)
        {
            Debug.Log("Join match succeeded");
            if (_lobby.matchCreated)
            {
                Debug.LogWarning("Match already set up, aborting...");
                return;
            }

            MatchInfo matchInfo = new MatchInfo(matchJoin);
            Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString));
            _client = new NetworkClient();
            _client.RegisterHandler(MsgType.Connect, OnConnected);
            _client.RegisterHandler(MsgType.Disconnect, OnDisconnect);
            _client.RegisterHandler(MsgType.Error, OnError);
            _client.RegisterHandler(MsgType.AddPlayer, AddPlayerMessage);
            //_client.RegisterHandler(MsgType.Owner, OwnerMes);
            _client.RegisterHandler(100, MesFromServer);

            NetworkManager.singleton.StartClient(matchInfo);
            //_client.Connect(matchInfo);
        }
        else
        {
            Debug.LogError("Join match failed.");

        }
    }
示例#2
0
 public void OnMatchJoined(JoinMatchResponse matchJoin)
 {
     netMgr.OnMatchJoined(matchJoin);
     if (matchJoin.success) {
         Debug.Log("Join match succeeded");
         /*if (matchCreated) {
             Debug.LogWarning("Match already set up, aborting...");
             canPress = true;
             return;
         }*/
         //Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString));
         //NetworkClient netClient = new NetworkClient();
         //netClient.RegisterHandler(MsgType.Connect, OnConnected);
         //netClient.Connect(new MatchInfo(matchJoin));
         if (!alreadyLoaded)  {
             alreadyLoaded = true;
             hudToDeactivate.SetActive(false);
             theCamera.transform.position = redStart.transform.position;
             theCamera.transform.rotation = redStart.transform.rotation;
             redStart.SetActive(false);
             NetworkServer.SpawnObjects();
         } else {
             Debug.LogError("Holy shit already loaded");
         }
     }
     else
     {
         Debug.LogError("Join match failed");
         canPress = true;
     }
 }
示例#3
0
 internal void OnMatchJoined(JoinMatchResponse response, NetworkMatch.DataResponseDelegate <MatchInfo> userCallback)
 {
     if (response.success)
     {
         Utility.SetAccessTokenForNetwork(response.networkId, new NetworkAccessToken(response.accessTokenString));
     }
     userCallback(response.success, response.extendedInfo, new MatchInfo(response));
 }
示例#4
0
 public MatchInfo(JoinMatchResponse matchResponse)
 {
     address     = matchResponse.address;
     port        = matchResponse.port;
     networkId   = matchResponse.networkId;
     accessToken = new NetworkAccessToken(matchResponse.accessTokenString);
     nodeId      = matchResponse.nodeId;
     usingRelay  = matchResponse.usingRelay;
 }
示例#5
0
 public MatchInfo(JoinMatchResponse matchResponse)
 {
     this.address = matchResponse.address;
       this.port = matchResponse.port;
       this.networkId = matchResponse.networkId;
       this.accessToken = new NetworkAccessToken(matchResponse.accessTokenString);
       this.nodeId = matchResponse.nodeId;
       this.usingRelay = matchResponse.usingRelay;
 }
示例#6
0
 internal MatchInfo(JoinMatchResponse matchResponse)
 {
     address     = matchResponse.address;
     port        = matchResponse.port;
     domain      = matchResponse.domain;
     networkId   = (NetworkID)matchResponse.networkId;
     accessToken = new NetworkAccessToken(matchResponse.accessTokenString);
     nodeId      = matchResponse.nodeId;
     usingRelay  = matchResponse.usingRelay;
 }
示例#7
0
 internal MatchInfo(JoinMatchResponse matchResponse)
 {
     this.address     = matchResponse.address;
     this.port        = matchResponse.port;
     this.domain      = matchResponse.domain;
     this.networkId   = matchResponse.networkId;
     this.accessToken = new NetworkAccessToken(matchResponse.accessTokenString);
     this.nodeId      = matchResponse.nodeId;
     this.usingRelay  = matchResponse.usingRelay;
 }
示例#8
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");
     }
 }
 public void CustomOnMatchJoined(JoinMatchResponse matchInfo)
 {
     if (LogFilter.logDebug) {
         Debug.Log ("NetworkManager OnMatchJoined ");
     }
     if (matchInfo.success) {
         Utility.SetAccessTokenForNetwork (matchInfo.networkId, new NetworkAccessToken (matchInfo.accessTokenString));
         hasMatch = true;
         joinMatchResponse = matchInfo;
     } else {
         if (LogFilter.logError) {
             Debug.LogError ("Join Failed:" + matchInfo);
             StartCoroutine (StartRequestMatch ());
         }
     }
 }
示例#10
0
    //this method is called when your request to join a match is returned
    private void OnJoinInternetMatch(JoinMatchResponse matchJoin)
    {
        if (matchJoin.success)
        {
            //Debug.Log("Able to join a match");

            if (Utility.GetAccessTokenForNetwork(matchJoin.networkId) == null)
                Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString));

            MatchInfo hostInfo = new MatchInfo(matchJoin);
            NetworkManager.singleton.StartClient(hostInfo);
        }
        else
        {
            Debug.LogError("Join match failed");
            SetOnShowGui(true);
        }
    }
示例#11
0
 public void OnMatchJoined(JoinMatchResponse matchJoin)
 {
     if (matchJoin.success)
     {
         Debug.Log("Join match succeeded");
         if (matchCreated)
         {
             Debug.LogWarning("Match already set up, aborting...");
             return;
         }
         Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString));
         NetworkClient myClient = new NetworkClient();
         myClient.RegisterHandler(MsgType.Connect, OnConnected);
         myClient.Connect(new MatchInfo(matchJoin));
     }
     else
     {
         Debug.LogError("Join match failed");
     }
 }
示例#12
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");
        }
    }
示例#13
0
    public void OnMatchJoined(JoinMatchResponse matchJoin)
    {
        if (matchJoin.success)
        {

            if (matchCreated)
            {
                Debug.LogWarning("Match already set up, aborting...");
                return;
            }
            joiningMatchOverlay.SetActive(true);
            Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString));
            GameManager.instance.StartClient (new MatchInfo(matchJoin));
        //			GameManager.instance.Con
            //NetworkClient myClient = new NetworkClient();
        //	myClient.RegisterHandler(MsgType.Connect, OnConnected);
            //myClient.Connect(new MatchInfo(matchJoin));
            Debug.Log ("connected to match");
        }
        else
        {
            Debug.LogError("Join match failed");
        }
    }
 /// <summary>
 ///   <para>This is invoked when a match is joined.</para>
 /// </summary>
 /// <param name="matchInfo"></param>
 public void OnMatchJoined(JoinMatchResponse matchInfo)
 {
   if (LogFilter.logDebug)
     Debug.Log((object) "NetworkManager OnMatchJoined ");
   if (matchInfo.success)
   {
     Utility.SetAccessTokenForNetwork(matchInfo.networkId, new NetworkAccessToken(matchInfo.accessTokenString));
     this.StartClient(new MatchInfo(matchInfo));
   }
   else
   {
     if (!LogFilter.logError)
       return;
     Debug.LogError((object) ("Join Failed:" + (object) matchInfo));
   }
 }
 public void CustomOnMatchJoined(JoinMatchResponse response)
 {
     OnMatchJoined(response);
     _networkID = response.networkId;
     _nodeID = response.nodeId;
 }
示例#16
0
		//###################### Mine ###############################
		/**
         *  When this Client joins a Server
         **/
		public void OnMatchJoined(JoinMatchResponse matchInfo){
			//base.OnMatchJoined (matchInfo);
			_currentMatchID = (System.UInt64)matchInfo.networkId;
			_currentNodeID = (System.UInt64)matchInfo.nodeId;
			matchModeInfo.text = "MODE: "+ matchModes[currentMatchValue];

			if (matchInfo.success) { 
				try { 
					UnityEngine.Networking.Utility.SetAccessTokenForNetwork(matchInfo.networkId, new NetworkAccessToken (matchInfo.accessTokenString)); 
				} catch (Exception ex) { 
					//if (LogFilter.logError) { 
					//	Debug.LogError (ex); 
					//} 
				}
				StartClient(new MatchInfo(matchInfo));
			} else if (LogFilter.logError) { 
				Debug.LogError (string.Concat ("Join Failed:", matchInfo)); 
			} 
		}
示例#17
0
    //  this method is called when your request to join a match is returned
    private void OnJoinInternetMatch(JoinMatchResponse matchJoin)
    {
        if (matchJoin.success)
        {
            Debug.Log("Able to join a match");

            if (Utility.GetAccessTokenForNetwork(matchJoin.networkId) == null)
                Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString));

            MatchInfo hostInfo = new MatchInfo(matchJoin);
            NetworkManager.singleton.StartClient(hostInfo);

            // myNBP.CmdSendPositionToServer(true);
            //  customNetworkBluePrint.CmdSendPositionToServer(true);

        }
        else
        {
            Debug.LogError("Join match failed");

        }
    }
示例#18
0
 public void OnMatchJoined(JoinMatchResponse joinMatchResponse)
 {
     if (joinMatchResponse.success)
     {
         Debug.Log("> Acessado a partida com sucesso, setando configuracoes da partida e iniciando client... <");
         if (matchCreated)
         {
             Debug.LogWarning("> Partida ja setada, abortando... <");
             return;
         }
         MatchInfo matchInfo = new MatchInfo(joinMatchResponse);
         this.joinedMatchNetworkID = (ulong)joinMatchResponse.networkId;
         this.joinedMatchNodeId = (ulong)joinMatchResponse.nodeId;
         Utility.SetAccessTokenForNetwork(joinMatchResponse.networkId, new NetworkAccessToken(joinMatchResponse.accessTokenString));
         Debug.Log("> Conectando client ... <");
         NetworkManager.singleton.StartClient(matchInfo);
     }
     else
     {
         Debug.LogError("> Falha ao tentar acessar a partida <");
     }
 }
        public void OnJoinMatch(JoinMatchResponse response)
        {
            this.response = response;

            if (this.response.success)
            {
                this.networkManager.OnMatchJoined(response);
                this.nextState = new InGameClientState(this.networkManager, this.networkMatch);
            }
        }
示例#20
0
    /// <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
        {

        }
    }
示例#21
0
        // called when a match is joined
	    public void OnMatchJoined(JoinMatchResponse matchInfo)
	    {
            Debug.Log("OnMatchJoined");
	    }
示例#22
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");
     }
 }
示例#23
0
 public void OnSBMatchJoined(JoinMatchResponse matchJoin)
 {
     if (matchJoin.success)
     {
         Debug.Log("Join match succeeded");
         Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString));
         SceneManager.LoadScene("main");
         GameObject.Find("Global").GetComponent<Game>().Networked = true;
         NetworkClient myClient = new NetworkClient();
         //myClient.RegisterHandler(MsgType.Connect, OnConnected);
         myClient.Connect(new MatchInfo(matchJoin));
     }
     else
     {
         Debug.LogError("Join match failed");
     }
 }
示例#24
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";
		}
	}
示例#25
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");
            }
        }
示例#26
0
	void OnMatchJoined(JoinMatchResponse matchInfo) {
		Debug.Log ("OnMatchJoined()");
		networkLobbyManager.OnMatchJoined (matchInfo);
		this.networkId = (long) matchInfo.networkId;
		this.nodeId = (long) matchInfo.nodeId;
	}
        // called when a match is joined
        public new void OnMatchJoined(JoinMatchResponse matchInfo) {

        }
示例#28
0
    void ConnectThroughRelay(JoinMatchResponse response)
    {
        SetupHost(false);

        byte error;
        NetworkTransport.ConnectToNetworkPeer(hostID,
                                              response.address,
                                              response.port,
                                              0,
                                              0,
                                              response.networkId,
                                              Utility.GetSourceID(),
                                              response.nodeId,
                                              out error);
    }
示例#29
0
 void OnJoiningMatch(JoinMatchResponse response)
 {
     //		Debug.Log ("On Joining Match");
     //		Debug.Log (response);
     //		matchInfo = new MatchInfo (response);
     //		StartClient ();
     OnMatchJoined (response);
     //		if (!response.success) {
     //			retryAt = Time.time + 1;
     //		}
 }
示例#30
0
    private void OnMatchJoined(JoinMatchResponse response)
    {
        if (response.success)
        {
            //gameObject.SetActive(false);

            ConnectThroughRelay(response);
        }
        else
        {
            group.interactable = true;

            popups.Show(string.Format("Couldn't join: \"{0}\"", response.extendedInfo),
                        delegate { });
        }
    }