상속: BasicResponse
예제 #1
0
    public override void OnMatchCreate(CreateMatchResponse matchInfo)
    {
        base.OnMatchCreate(matchInfo);
        Debug.Log("Room created!");

        PacketHandler.RegisterServerPacketHandlers();
        ServerGame.Inst.Run();
    }
예제 #2
0
 internal virtual void OnMatchCreate(CreateMatchResponse response, NetworkMatch.DataResponseDelegate <MatchInfo> userCallback)
 {
     if (response.success)
     {
         Utility.SetAccessTokenForNetwork(response.networkId, new NetworkAccessToken(response.accessTokenString));
     }
     userCallback(response.success, response.extendedInfo, new MatchInfo(response));
 }
예제 #3
0
 public MatchInfo(CreateMatchResponse 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;
 }
예제 #4
0
 public MatchInfo(CreateMatchResponse matchResponse)
 {
     address     = matchResponse.address;
     port        = matchResponse.port;
     networkId   = matchResponse.networkId;
     accessToken = new NetworkAccessToken(matchResponse.accessTokenString);
     nodeId      = matchResponse.nodeId;
     usingRelay  = matchResponse.usingRelay;
 }
예제 #5
0
 internal MatchInfo(CreateMatchResponse 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;
 }
예제 #6
0
 internal MatchInfo(CreateMatchResponse 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;
 }
예제 #7
0
	public override void OnMatchCreate (CreateMatchResponse matchInfo ){
		if (matchInfo.success) {
			base.OnMatchCreate(matchInfo );

			GameObject gameManager = (GameObject)Instantiate( spawnPrefabs[0], Vector3.zero, Quaternion.identity);
			DontDestroyOnLoad(gameManager);
			NetworkServer.Spawn(gameManager);
			//Network.Instantiate(playerPrefab, Vector2.zero, Quaternion.identity, 0);
		}
	}
예제 #8
0
    public void OnMatchCreate(CreateMatchResponse matchResponse)
    {
        if (matchResponse.success)
        {
            successObject.SetActive(true);
            Utility.SetAccessTokenForNetwork(matchResponse.networkId, new NetworkAccessToken(matchResponse.accessTokenString));

            NetworkClient nc = nm.StartHost(new MatchInfo(matchResponse));
            nc.RegisterHandler(MsgType.Connect,OnConnected);

        }
        else print("Match create error!");
    }
예제 #9
0
 public void OnMatchCreate(CreateMatchResponse matchResponse)
 {
     if (matchResponse.success)
     {
         Debug.Log("Create match succeeded");
         matchCreated = true;
         Utility.SetAccessTokenForNetwork(matchResponse.networkId, new NetworkAccessToken(matchResponse.accessTokenString));
         NetworkServer.Listen(new MatchInfo(matchResponse), 9000);
     }
     else
     {
         Debug.LogError ("Create match failed");
     }
 }
예제 #10
0
 private void onMatchCreate(CreateMatchResponse matchResponse)
 {
     if (matchResponse.success) {
         Debug.Log("Creates match");
         Utility.SetAccessTokenForNetwork(matchResponse.networkId, new UnityEngine.Networking.Types.NetworkAccessToken(matchResponse.accessTokenString));
         FindObjectOfType<CustomLobbyManager>().StartHost(new MatchInfo(matchResponse));
         _matchCreated = true;
         readyButton.gameObject.SetActive(true);
         playerList.transform.parent.gameObject.SetActive(true);
     } else {
         joinButton.gameObject.SetActive(true);
         hostButton.gameObject.SetActive(true);
         Debug.LogError("Failed to create match");
     }
 }
예제 #11
0
    public void OnMatchCreate(CreateMatchResponse matchResponse)
    {
        if (matchResponse.success)
        {
            Debug.Log("Create match succeeded.");
            _lobby.matchCreated = true;
            MatchInfo matchInfo  = new MatchInfo(matchResponse);
            Utility.SetAccessTokenForNetwork(matchResponse.networkId, new NetworkAccessToken(matchResponse.accessTokenString));

            NetworkManager.singleton.StartHost(matchInfo) ;
            NetworkServer.Listen(new MatchInfo(matchResponse), 9000);
        }
        else
        {
            Debug.LogError ("Create match failed.");
        }
    }
예제 #12
0
    //this method is called when your request for creating a match is returned
    private void OnInternetMatchCreate(CreateMatchResponse matchResponse)
    {
        if (matchResponse != null && matchResponse.success)
        {
            //Debug.Log("Create match succeeded");

            Utility.SetAccessTokenForNetwork(matchResponse.networkId, new NetworkAccessToken(matchResponse.accessTokenString));
            MatchInfo hostInfo = new MatchInfo(matchResponse);
            NetworkServer.Listen(hostInfo, 9000);

            NetworkManager.singleton.StartHost(hostInfo);
        }
        else
        {
            Debug.LogError("Create match failed");
        }
    }
예제 #13
0
	public void OnMatchCreate(CreateMatchResponse matchResponse) {
		if (matchResponse.success) {
			connectionStatus = "Match named " + matchName + " created. Waiting for another player to join...";

			joinPanel.FindChild("Image").GetComponent<Image>().color = new Color(0f, 0f, 0f, 0f);
			createMatchButton.gameObject.SetActive(false);
			joinMatchButton.gameObject.SetActive(false);
			backButton.gameObject.SetActive(true);

			matchCreated = true;
			Utility.SetAccessTokenForNetwork(matchResponse.networkId, new NetworkAccessToken(matchResponse.accessTokenString));
			matchInfo = new MatchInfo(matchResponse);
			NetworkServer.Listen(matchInfo, 7777);
			NetworkServer.RegisterHandler(MsgType.Connect, OnPlayerReadyMessage);
		} else {
			Debug.LogError ("Create match failed");
		}
	}
예제 #14
0
    public void OnMatchCreate(CreateMatchResponse matchResponse)
    {
        if (matchResponse.success)
        {
            Debug.Log("Create match succeeded");
            joiningMatchOverlay.SetActive(true);
            matchCreated = true;
            Utility.SetAccessTokenForNetwork(matchResponse.networkId, new NetworkAccessToken(matchResponse.accessTokenString));
            //NetworkServer.Listen(new MatchInfo(matchResponse), 9000);
            GameManager.instance.StartHost (new MatchInfo(matchResponse));

            Debug.Log ("Created Match");

        }
        else
        {
            Debug.LogError ("Create match failed");
        }
    }
예제 #15
0
 public override void OnMatchCreate(CreateMatchResponse response)
 {
     base.OnMatchCreate(response);
     _networkID = response.networkId;
     _nodeID = response.nodeId;
 }
예제 #16
0
 /// <summary>
 /// 创建房间后的回调函数
 /// </summary>
 /// <param name="response">
 /// 包含已创建的房间的信息
 /// </param>
 private void _OnCreateMatch(CreateMatchResponse response)
 {
     MatchUI.instance.StopWait();
     if (response.success)
     {
         //令牌
         Utility.SetAccessTokenForNetwork(response.networkId, new NetworkAccessToken(response.accessTokenString));
         //创建后立即进入房间
         client = StartHost(new MatchInfo(response));
         m_networkState = ConstantDefine.NetworkState.Host;
     }
     else
     {
         //处理错误
     }
 }
예제 #17
0
 public override void OnMatchCreate(CreateMatchResponse matchInfo)
 {
     base.OnMatchCreate(matchInfo);
     _currentMatchID = (ulong)matchInfo.networkId;
 }
예제 #18
0
 void OnMatchCreate(CreateMatchResponse matchResponse)
 {
     if (matchResponse.success)
     {
         Debug.Log("Create match succeeded");
         hostLabel.text = "Hosting as \"" + SystemInfo.deviceName + "\" at " + matchResponse.address;
         netID = (ulong)matchResponse.networkId;
         Utility.SetAccessTokenForNetwork((NetworkID)netID, new NetworkAccessToken(matchResponse.accessTokenString));
         NetworkServer.RegisterHandler(MsgType.Ready, (NetworkMessage netMsg) =>
         {
             print("Ready");
         });
         NetworkServer.RegisterHandler(MsgType.Connect, (NetworkMessage netMsg) =>
         {
             print("Connect");
         });
         NetworkServer.RegisterHandler(MsgType.AddPlayer, (NetworkMessage netMsg) =>
         {
             print("AddPlayer");
         });
         NetworkServer.RegisterHandler(MsgType.Error, (NetworkMessage netMsg) =>
         {
             print("Error");
         });
         /*
             SceneManager.LoadScene("main");
             GameObject.Find("Global").GetComponent<Game>().Networked = true;
             NetworkClient myClient = new NetworkClient();
             //myClient.RegisterHandler(MsgType.Connect, OnConnected);
             myClient.Connect(new MatchInfo(matchResponse));
         });*/
         NetworkServer.Listen(new MatchInfo(matchResponse), 9000);
     }
     else
     {
         Debug.LogError("Create match failed");
         hostLabel.text = "Failed to open room";
     }
 }
예제 #19
0
 //--------------------------------------------------------------------------------------------------------------------
 //Name:
 //Description:
 //Parameters:
 //Returns:
 //--------------------------------------------------------------------------------------------------------------------
 public override void OnMatchCreate(CreateMatchResponse matchInfo)
 {
     base.OnMatchCreate (matchInfo);
     GameMode = GAME_MODE.Multiplayer;
     GameState = GAME_STATE.VehicleSelection;
 }
예제 #20
0
	void OnMatchCreate(CreateMatchResponse matchInfo) {
		Debug.Log ("OnMatchCreate()");
		networkLobbyManager.OnMatchCreate (matchInfo);
		this.networkId = (long) matchInfo.networkId;
		this.nodeId = (long) matchInfo.nodeId;
	}
예제 #21
0
 //--------------------------------------------------------------------------------------------------------------------
 //Name:
 //Description:
 //Parameters:
 //Returns:
 //--------------------------------------------------------------------------------------------------------------------
 public override void OnMatchCreate(CreateMatchResponse matchInfo)
 {
     base.OnMatchCreate (matchInfo);
 }
예제 #22
0
    public override void OnMatchCreate( CreateMatchResponse matchInfo )
    {
        base.OnMatchCreate( matchInfo );

        _currentMatchID = (System.UInt64)matchInfo.networkId;
    }
        public override void OnMatchCreate(UnityEngine.Networking.Match.CreateMatchResponse matchInfo)
        {
            base.OnMatchCreate(matchInfo);

            _currentMatchID = (System.UInt64)matchInfo.networkId;
        }
예제 #24
0
파일: Test.cs 프로젝트: Ragzouken/smooltool
    private void OnMatchCreate(CreateMatchResponse response)
    {
        if (response.success)
        {
            Utility.SetAccessTokenForNetwork(response.networkId,
                                             new NetworkAccessToken(response.accessTokenString));
            //NetworkServer.Listen(new MatchInfo(response), 9000);

            StartServer(response);
            group.alpha = 0f;
            group.blocksRaycasts = false;
        }
        else
        {
            popups.Show(string.Format("Create match failed: \"{0}\"", response.extendedInfo),
                        delegate { });
        }
    }
예제 #25
0
 public void OnMatchCreate(CreateMatchResponse matchResponse)
 {
     if(matchResponse.success)
     {
         Debug.Log ("> Partida criada com sucesso. <");
         matchCreated = true;
         MatchInfo matchInfo = new MatchInfo(matchResponse);
         this.joinedMatchNetworkID = (ulong)matchResponse.networkId;
         Utility.SetAccessTokenForNetwork(matchResponse.networkId, new NetworkAccessToken(matchResponse.accessTokenString));
         Debug.Log ("> Entrando na partida como Host. <");
         NetworkManager.singleton.StartHost(matchInfo);
     }else
     {
         Debug.LogError("> Erro ao criar partida. < Detalhes: " + matchResponse.extendedInfo);
     }
 }
예제 #26
0
        ///////////////////////////////////////
	    //Functions invoked for the Matchmaker:
        ///////////////////////////////////////
        // called when a match is created
	    public virtual void OnMatchCreate(CreateMatchResponse matchInfo)
	    {
            Debug.Log("OnMatchCreate");
	    }
예제 #27
0
 public void OnMatchCreate(CreateMatchResponse aMatchResponse)
 {
     if (aMatchResponse.success)
     {
         NetworkManager.singleton.OnMatchCreate(aMatchResponse);
     }
     else
     {
         Debug.LogError("Create match failed");
     }
 }
예제 #28
0
 /// <summary>
 ///   <para>This is invoked when a match has been created.</para>
 /// </summary>
 /// <param name="matchInfo">Info about the match that has been created.</param>
 public virtual void OnMatchCreate(CreateMatchResponse matchInfo)
 {
   if (LogFilter.logDebug)
     Debug.Log((object) ("NetworkManager OnMatchCreate " + (object) matchInfo));
   if (matchInfo.success)
   {
     Utility.SetAccessTokenForNetwork(matchInfo.networkId, new NetworkAccessToken(matchInfo.accessTokenString));
     this.StartHost(new MatchInfo(matchInfo));
   }
   else
   {
     if (!LogFilter.logError)
       return;
     Debug.LogError((object) ("Create Failed:" + (object) matchInfo));
   }
 }
예제 #29
0
 void TestMatchCreateResponse(CreateMatchResponse response)
 {
     throw new NotImplementedException ();
 }
예제 #30
0
 /// <summary>
 /// 创建房间后的回调函数
 /// </summary>
 /// <param name="response">
 /// 包含已创建的房间的信息
 /// </param>
 private void _OnCreateMatch(CreateMatchResponse response)
 {
     if (response.success)
     {
         Utility.SetAccessTokenForNetwork(response.networkId, new NetworkAccessToken(response.accessTokenString));
         client = StartHost(new MatchInfo(response));
         m_netStt = ConstantDefine.NetworkState.Host;
     }
     else
     {
         m_waitingPanel.SetActive(false);
         _Error("FAILED TO CREATE A ROOM");
     }
 }
예제 #31
0
        public void OnCreateMatch(CreateMatchResponse response)
        {
            this.response = response;

            if (this.response.success)
            {
                this.networkManager.OnMatchCreate(response);
                this.nextState = new InGameHostState(this.networkManager, this.networkMatch);
            }
        }
예제 #32
0
        /// <summary>This is invoked when a match has been created.</summary>
        public override void OnMatchCreate(CreateMatchResponse matchInfo)
        {
            Log("OnMatchCreate");

            base.OnMatchCreate(matchInfo);

            //Log("success:{0}", matchInfo.success);
            //Log("address:{0}", matchInfo.address);
            //Log("port:{0}", matchInfo.port);
            //Log("accessTokenString:{0}" + matchInfo.accessTokenString);
            //Log("networkId:{0}", matchInfo.networkId);
            //Log("nodeId:{0}", matchInfo.nodeId);
            //Log("usingRelay:{0}", matchInfo.usingRelay);
            //Log("extendedInfo:{0}", matchInfo.extendedInfo);

            //NetworkID
            _currentMatchID = (System.UInt64)matchInfo.networkId;

            //Debug.Log("_currentMatchID:"+ _currentMatchID);
        }
예제 #33
0
파일: Test.cs 프로젝트: Ragzouken/smooltool
    void StartServer(CreateMatchResponse response)
    {
        SetupHost(true);

        byte error;
        NetworkTransport.ConnectAsNetworkHost(hostID,
                                              response.address,
                                              response.port,
                                              response.networkId,
                                              Utility.GetSourceID(),
                                              response.nodeId,
                                              out error);
    }
예제 #34
0
 public override void OnMatchCreate(CreateMatchResponse matchInfo)
 {
     attemptedMatches.Add (matchInfo.networkId.ToString());
     base.OnMatchCreate (matchInfo);
 }
예제 #35
0
    void OnMatchCreate(CreateMatchResponse cmr)
    {
        netMgr.OnMatchCreate(cmr);

        if (cmr.success) {
            /*Debug.Log("Create match succeeded");
            //matchCreated = true;
            Utility.SetAccessTokenForNetwork(cmr.networkId, new NetworkAccessToken(cmr.accessTokenString));
            NetworkServer.Listen(new MatchInfo(cmr), 9000);

            NetworkClient netClient = new NetworkClient();
            netClient.RegisterHandler(MsgType.Connect, OnConnected);
            netClient.Connect("127.0.0.1",9000);*/

            //netClient = ClientScene.ConnectLocalServer();
            //netClient.RegisterHandler(MsgType.Connect, OnConnected);

            if (!alreadyLoaded) {
                alreadyLoaded = true;
                hudToDeactivate.SetActive(false);
                theCamera.transform.position = greenStart.transform.position;
                theCamera.transform.rotation = greenStart.transform.rotation;
                greenStart.SetActive(false);
            } else {
                Debug.LogError("Level already loaded?");
            }
        } else {
            Debug.LogError ("Create match failed");
            canPress = true;
        }
    }