public void listMatcheMakingMatch() { MenuMangerScript.currentGamesPanel.SetActive(true); MenuMangerScript.multiStage.SetActive(false); if (networkMatch != null) { networkMatch.ListMatches(0, 20, "", true, 0, 1, OnMatchList); showmatches = true; } }
private void Start() { networkMatch.ListMatches(0, 10, "", true, 0, 0, OnMatchList); if (!_matchDoesExists) { networkMatch.CreateMatch(_matchName, 4, true, "", "", "", 0, 0, OnMatchCreate); } networkMatch.ListMatches(0, 10, "", false, 0, 0, OnMatchList); //networkMatch.JoinMatch(matchInfo[index].networkId, "", "", "", 0, 0, OnMatchJoined); }
IEnumerator CheckMatches() { yield return(new WaitForSeconds(0.5f)); networkMatch.ListMatches(0, 20, "", OnMatchList); StartCoroutine("CheckMatches"); }
void OnGUI() { if (GUILayout.Button("Start Match")) { CreateMatchRequest create = new CreateMatchRequest(); create.name = "NewRoom"; create.size = 4; create.advertise = true; create.password = ""; networkMatch.CreateMatch(create, OnMatchCreate); } if (GUILayout.Button("List rooms")) { networkMatch.ListMatches(0, 20, "", OnMatchList); } if (matchList.Count > 0) { GUILayout.Label("Current rooms"); } foreach (var m in matchList) { if (GUILayout.Button(m.name)) { networkMatch.JoinMatch(m.networkId, "", OnMatchJoined); } } }
void OnGUI() { // You would normally not join a match you created yourself but this is possible here for demonstration purposes. if (GUILayout.Button("Create Room")) { CreateMatchRequest create = new CreateMatchRequest(); create.name = "NewRoom"; create.size = 4; create.advertise = true; create.password = ""; networkMatch.CreateMatch(create, OnMatchCreate); } if (GUILayout.Button("List rooms")) { networkMatch.ListMatches(0, 20, "", OnMatchList); } if (matchList.Count > 0) { GUILayout.Label("Current rooms"); } foreach (var match in matchList) { if (GUILayout.Button(match.name)) { networkMatch.JoinMatch(match.networkId, "", OnMatchJoined); } } }
void OnGUI() { // You would normally not join a match you created yourself but this is possible here for demonstration purposes. if (GUILayout.Button("Create Room")) { networkMatch.CreateMatch("NewRoom", 4, true, "", "", "", 0, 0, OnMatchCreate); } if (GUILayout.Button("List rooms")) { networkMatch.ListMatches(0, 20, "", false, 0, 0, OnMatchList); } if (matchList.Count > 0) { GUILayout.Label("Current rooms"); } foreach (var match in matchList) { if (GUILayout.Button(match.name)) { networkMatch.JoinMatch(match.networkId, "", "", "", 0, 0, OnMatchJoined); } } }
private void OnGUI() { if (GUILayout.Button("Create Room")) { string matchName = "room"; uint matchSize = 2; bool matchAdvertise = true; string matchPassword = ""; networkMatch.CreateMatch(matchName, matchSize, matchAdvertise, matchPassword, "", "", 0, 0, OnMatchCreate); } if (GUILayout.Button("Refresh")) { networkMatch.ListMatches(0, 20, "", true, 0, 0, OnMatchList); } if (matchList.Count > 0) { GUILayout.Label("Available rooms"); } foreach (MatchInfoSnapshot mis in matchList) { if (GUILayout.Button(mis.name)) { networkMatch.JoinMatch(mis.networkId, "", "", "", 0, 0, OnMatchJoined); } } }
void OnGUI() { if (GUILayout.Button("Create Room")) { networkMatch.CreateMatch("New Room", 4, true, "", "", "", 0, 0, OnMatchCreate); } if (GUILayout.Button("List Rooms")) { networkMatch.ListMatches(0, 10, "", true, 0, 0, OnMatchList); } if (matchList.Count > 0) { GUILayout.Label("Current Rooms"); foreach (var match in matchList) { if (GUILayout.Button(match.name)) { if (GUILayout.Button(match.name)) { networkMatch.JoinMatch(match.networkId, "", "", "", 0, 0, OnMatchJoined); } } } } }
void OnGUI() { // You would normally not join a match you created yourself but this is possible here for demonstration purposes. if (GUILayout.Button("Create Room")) { string matchName = "room"; uint matchSize = 4; bool matchAdvertise = true; string matchPassword = ""; networkMatch.CreateMatch(matchName, matchSize, matchAdvertise, matchPassword, "", "", 0, 0, OnMatchCreate); } if (GUILayout.Button("List rooms")) { networkMatch.ListMatches(0, 20, "", true, 0, 0, OnMatchList); } if (matchList.Count > 0) { GUILayout.Label("Current rooms"); } foreach (var match in matchList) { if (GUILayout.Button(match.name)) { networkMatch.JoinMatch(match.networkId, "", "", "", 0, 0, OnMatchJoined); } } }
public static void Aceitar_Convinte(string room_name) { string Codigo = GameObject.Find("Convite_Codigo_Text").GetComponent <Text> ().text; PlayerPrefs.SetString("Codigo", Codigo); PlayerPrefs.SetInt("Jogador_Master", 2); m_NetworkMatch.ListMatches(0, 20, room_name, true, 0, 0, OnMatchList_Aceitar_Convite); }
//---------------------------------------------------------------------------------------------------- /// <summary> /// フレームメソッド /// </summary> void Update() { //待機状態 if (m_isStandbyState) { return; } //部屋作成中 if (m_isCreateRoom) { //更新 m_match.ListMatches(0, 20, "", true, 0, 0, OnMatchList); //使用中のネットワークIDを取得 if (matches.Count >= 1 && matchInfo != null) { m_networkIdInUse = (UInt64)matchInfo.networkId; m_isStandbyState = true; } return; } //リストマッチの更新 if (matches == null) { //更新 m_match.ListMatches(0, 20, "", true, 0, 0, OnMatchList); } else if (matches.Count >= 1 && IsMatch()) { //ルームに参加 m_match.JoinMatch((UnityEngine.Networking.Types.NetworkID)m_networkIdInUse, "", "", "", 0, 0, OnMatchJoined); m_isJoinRoom = true; m_isStandbyState = true; } else { //ルームの作成 matchName = ROOM_NAME + DateTime.Now.ToLongTimeString(); m_match.CreateMatch(matchName, matchSize, true, "", "", "", 0, 0, OnMatchCreate); m_isCreateRoom = true; } }
private IEnumerator RunServer(InputField[] iField) { password = iField[2].text; var asyncLoadLevel = SceneManager.LoadSceneAsync("Server", LoadSceneMode.Additive); while (!asyncLoadLevel.isDone) { yield return(null); } GameObject.Find("Server").GetComponent <Server>().StartServer(iField[0].text, iField[2].text, uint.Parse(iField[1].text)); while (GameObject.Find("Server").GetComponent <Server>().GetMatchInfo() == null) { yield return(null); } m_NetworkMatch.ListMatches(0, 20, "", false, 0, 0, OnMatchListServer); iField[0].text = "New game"; iField[1].text = "4"; iField[2].text = ""; }
void Awake() { nm = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent<NetworkManager>(); if (nm.matchMaker == null) nm.StartMatchMaker(); networkMatch = nm.matchMaker.GetComponent<NetworkMatch>(); menuSelector = GetComponent<MenuSelector>(); networkMatch.ListMatches(0, 20, "", OnMatchList); }
public void StartNetworking(GameObject gameObject, string _roomName, int _gameVersion) { roomName = _roomName; gameVersion = _gameVersion; networkMatch = gameObject.AddComponent <NetworkMatch>(); networkManager = gameObject.GetComponent <NetworkManager>(); networkMatch.ListMatches(0, 10, "", true, 0, gameVersion, OnMatchList); }
void Start() { manager = GetComponent <NetworkManager>(); manager.StartMatchMaker(); matcher = manager.matchMaker; matcher.ListMatches(0, ListSize, "", (matches) => { if (matches.success) { if (matches.matches.Count > 0 && !OnlyHost) { matcher.JoinMatch(matches.matches[0].networkId, "", (join) => { if (join.success) { Utility.SetAccessTokenForNetwork(join.networkId, new NetworkAccessToken(join.accessTokenString)); NetworkClient client = new NetworkClient(); client.RegisterHandler(MsgType.Connect, (connected) => { Debug.Log("Connected"); }); client.Connect(new MatchInfo(join)); manager.StartClient(); } else { Debug.LogError("Could not join match"); } }); } else { matcher.CreateMatch(URandom.value.ToString(), PlayerCountPerRoom, Advertise, "", (created) => { if (created.success) { Debug.Log("Create match succeeded"); Utility.SetAccessTokenForNetwork(created.networkId, new NetworkAccessToken(created.accessTokenString)); NetworkServer.Listen(new MatchInfo(created), 9000); manager.StartHost(); isHost = true; } else { Debug.LogError("Could not create match"); } }); } } else { Debug.LogError("Could not recieve list of matchces"); } }); }
void Awake() { nm = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent <NetworkManager>(); if (nm.matchMaker == null) { nm.StartMatchMaker(); } networkMatch = nm.matchMaker.GetComponent <NetworkMatch>(); menuSelector = GetComponent <MenuSelector>(); networkMatch.ListMatches(0, 20, "", OnMatchList); }
public void startConnection() { networkMatcher.ListMatches(0, 1, "", true, 0, 0, ConnectToOrCreateMatch); /*if (!restartMode) * { * networkMatcher.ListMatches(0, 1, "", true, 0, 0, ConnectToOrCreateMatch); * } * else * { * restartMode = false; * createNewMatch(); * }*/ }
public void JoinFirstInternetMatch() { if (IsActive) { return; } networkMatch.ListMatches(0, 1, "", true, 0, 0, (success, info, matches) => { if (success && matches.Count > 0) { networkMatch.JoinMatch(matches[0].networkId, "", "", "", 0, 0, OnMatchJoined); } }); }
public void Awake() { print("NetworkManager awake"); networkMatcher = gameObject.AddComponent <NetworkMatch>(); networkMatcher.ListMatches(0, 1, "", true, 0, 0, ConnectToOrCreateMatch); if (singlePlayerDebug) { try { GetComponent <NetworkManagerHUD>().showGUI = true; } catch (NullReferenceException) { } } }
public void OnJoinButtonClick() { string strBabyName = m_InputField.text; m_NetworkMatch.ListMatches(0, 1, m_InputField.text, true, 0, 0, (success, info, matches) => { if (success && matches.Count > 0) { m_NetworkMatch.JoinMatch(matches[0].networkId, "", "", "", 0, 0, OnMatchJoined); } else { m_StateDisplay.text = "没有找到与宝贝名字相同的连接"; } }); PlayerPrefs.SetString("BabyName", strBabyName); m_StateDisplay.text = "正在连接中"; }
void OnGUI() { if (GUILayout.Button("List rooms")) { networkMatch.ListMatches(0, 20, "", OnMatchList); } if (matchList.Count > 0) { GUILayout.Label("Current rooms"); } foreach (var match in matchList) { if (GUILayout.Button(match.name)) { networkMatch.JoinMatch(match.networkId, "", OnMatchJoined); } } }
public void OnGUI() { GUI.enabled = natHelper.isReady; if (GUI.Button(new Rect(0, 10, 150, 100), "Host")) { // This is how RakNet identifies each peer in the network // Clients will use the guid of the server to punch a hole string guid = natHelper.guid; // The easiest way I've found to get all the connection data to the clients is to just // mash it all together in the match name string name = string.Join(":", new string[] { natHelper.externalIP, Network.player.ipAddress, guid }); networkMatch.CreateMatch(name, 2, true, "", natHelper.externalIP, Network.player.ipAddress, 0, 0, OnMatchCreate); } if (GUI.Button(new Rect(0, 120, 150, 100), "Join server")) { networkMatch.ListMatches(0, 1, "", true, 0, 0, OnMatchList); } }
public void LoadServerList() { matchList.Clear(); foreach (GameObject obj in matchDisplays) { Destroy(obj); } matchDisplays.Clear(); NetworkLobbyManager manager = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent <NetworkLobbyManager>(); if (manager.matchMaker == null) { manager.StartMatchMaker(); } NetworkMatch match = manager.matchMaker; match.ListMatches(0, 20, "", OnMatchList); }
public void Connect() { if (reqMaster) { match.CreateMatch("default", (uint)playGameNum + 1, true, "", "", "", 0, reqDomain, OnMatchCreate); } else { if (client != null) { ClientCommand.identity.catId = GM.configs["貓咪"]; ClientCommand.identity.id = 0; QA.Invoke <int>("Connected", ClientCommand.identity.connectionId); client.Send(ImServices.MSG_COMMAND, ClientCommand.identity); } else { match.ListMatches(0, 10, "", false, 0, reqDomain, OnMatchList); } } }
void Start() { manager = GetComponent<NetworkManager>(); manager.StartMatchMaker(); matcher = manager.matchMaker; matcher.ListMatches(0, ListSize, "", (matches) => { if (matches.success) { if (matches.matches.Count > 0 && !OnlyHost) { matcher.JoinMatch(matches.matches[0].networkId, "", (join) => { if (join.success) { Utility.SetAccessTokenForNetwork(join.networkId, new NetworkAccessToken(join.accessTokenString)); NetworkClient client = new NetworkClient(); client.RegisterHandler(MsgType.Connect, (connected) => { Debug.Log("Connected"); }); client.Connect(new MatchInfo(join)); manager.StartClient(); } else { Debug.LogError("Could not join match"); } }); } else { matcher.CreateMatch(URandom.value.ToString(), PlayerCountPerRoom, Advertise, "", (created) => { if (created.success) { Debug.Log("Create match succeeded"); Utility.SetAccessTokenForNetwork(created.networkId, new NetworkAccessToken(created.accessTokenString)); NetworkServer.Listen(new MatchInfo(created), 9000); manager.StartHost(); isHost = true; } else { Debug.LogError("Could not create match"); } }); } } else { Debug.LogError("Could not recieve list of matchces"); } }); }
private void OnGUI() { if (!showGUI) { return; } int num = 10 + offsetX; int num2 = 40 + offsetY; if (!manager.IsClientConnected() && !NetworkServer.active && manager.matchMaker == null) { if (GUI.Button(new Rect(num, num2, 200f, 20f), "LAN Host(H)")) { manager.StartHost(); } num2 += 24; if (GUI.Button(new Rect(num, num2, 105f, 20f), "LAN Client(C)")) { manager.StartClient(); } manager.networkAddress = GUI.TextField(new Rect(num + 100, num2, 95f, 20f), manager.networkAddress); num2 += 24; if (GUI.Button(new Rect(num, num2, 200f, 20f), "LAN Server Only(S)")) { manager.StartServer(); } num2 += 24; } else { if (NetworkServer.active) { GUI.Label(new Rect(num, num2, 300f, 20f), "Server: port=" + manager.networkPort); num2 += 24; } if (manager.IsClientConnected()) { GUI.Label(new Rect(num, num2, 300f, 20f), "Client: address=" + manager.networkAddress + " port=" + manager.networkPort); num2 += 24; } } if (manager.IsClientConnected() && !ClientScene.ready) { if (GUI.Button(new Rect(num, num2, 200f, 20f), "Client Ready")) { ClientScene.Ready(manager.client.connection); if (ClientScene.localPlayers.Count == 0) { ClientScene.AddPlayer(0); } } num2 += 24; } if (NetworkServer.active || manager.IsClientConnected()) { if (GUI.Button(new Rect(num, num2, 200f, 20f), "Stop (X)")) { manager.StopHost(); } num2 += 24; } if (NetworkServer.active || manager.IsClientConnected()) { return; } num2 += 10; if (manager.matchMaker == null) { if (GUI.Button(new Rect(num, num2, 200f, 20f), "Enable Match Maker (M)")) { manager.StartMatchMaker(); } return; } if (manager.matchInfo == null) { if (manager.matches == null) { if (GUI.Button(new Rect(num, num2, 200f, 20f), "Create Internet Match")) { NetworkMatch matchMaker = manager.matchMaker; string matchName = manager.matchName; uint matchSize = manager.matchSize; string empty = string.Empty; NetworkManager networkManager = manager; matchMaker.CreateMatch(matchName, matchSize, matchAdvertise: true, empty, networkManager.OnMatchCreate); } num2 += 24; GUI.Label(new Rect(num, num2, 100f, 20f), "Room Name:"); manager.matchName = GUI.TextField(new Rect(num + 100, num2, 100f, 20f), manager.matchName); num2 += 24; num2 += 10; if (GUI.Button(new Rect(num, num2, 200f, 20f), "Find Internet Match")) { NetworkMatch matchMaker2 = manager.matchMaker; string empty2 = string.Empty; NetworkManager networkManager2 = manager; matchMaker2.ListMatches(0, 20, empty2, networkManager2.OnMatchList); } num2 += 24; } else { foreach (MatchDesc match in manager.matches) { if (GUI.Button(new Rect(num, num2, 200f, 20f), "Join Match:" + match.name)) { manager.matchName = match.name; manager.matchSize = (uint)match.currentSize; manager.matchMaker.JoinMatch(match.networkId, string.Empty, manager.OnMatchJoined); } num2 += 24; } } } if (GUI.Button(new Rect(num, num2, 200f, 20f), "Change MM server")) { m_ShowServer = !m_ShowServer; } if (m_ShowServer) { num2 += 24; if (GUI.Button(new Rect(num, num2, 100f, 20f), "Local")) { manager.SetMatchHost("localhost", 1337, https: false); m_ShowServer = false; } num2 += 24; if (GUI.Button(new Rect(num, num2, 100f, 20f), "Internet")) { manager.SetMatchHost("mm.unet.unity3d.com", 443, https: true); m_ShowServer = false; } num2 += 24; if (GUI.Button(new Rect(num, num2, 100f, 20f), "Staging")) { manager.SetMatchHost("staging-mm.unet.unity3d.com", 443, https: true); m_ShowServer = false; } } num2 += 24; GUI.Label(new Rect(num, num2, 300f, 20f), "MM Uri: " + manager.matchMaker.baseUri); num2 += 24; if (GUI.Button(new Rect(num, num2, 200f, 20f), "Disable Match Maker")) { manager.StopMatchMaker(); } }
public void Matchlist() { nwMatch.ListMatches(0, 20, "", OnMatchList); }
void OnGUI() { if (string.IsNullOrEmpty(Application.cloudProjectId)) { GUILayout.Label("You must set up the project first. See the Multiplayer tab in the Service Window"); } else { GUILayout.Label("Cloud Project ID: " + Application.cloudProjectId); } if (m_MatchJoined) { GUILayout.Label("Match joined '" + m_MatchName + "' on Matchmaker server"); } else if (m_MatchCreated) { GUILayout.Label("Match '" + m_MatchName + "' created on Matchmaker server"); } GUILayout.Label("Connection Established: " + m_ConnectionEstablished); if (m_MatchCreated || m_MatchJoined) { GUILayout.Label("Relay Server: " + m_MatchInfo.address + ":" + m_MatchInfo.port); GUILayout.Label("NetworkID: " + m_MatchInfo.networkId + " NodeID: " + m_MatchInfo.nodeId); GUILayout.BeginHorizontal(); GUILayout.Label("Outgoing message:"); m_NetworkMessage = GUILayout.TextField(m_NetworkMessage); GUILayout.EndHorizontal(); GUILayout.Label("Last incoming message: " + m_LastReceivedMessage); if (m_ConnectionEstablished && GUILayout.Button("Send message")) { m_Writer.SeekZero(); m_Writer.Write(m_NetworkMessage); byte error; for (int i = 0; i < m_ConnectionIds.Count; ++i) { NetworkTransport.Send(m_HostId, m_ConnectionIds[i], 0, m_Writer.AsArray(), m_Writer.Position, out error); if ((NetworkError)error != NetworkError.Ok) { Debug.LogError("Failed to send message: " + (NetworkError)error); } } } if (GUILayout.Button("Shutdown")) { m_NetworkMatch.DropConnection(m_MatchInfo.networkId, m_MatchInfo.nodeId, 0, OnConnectionDropped); } } else { if (GUILayout.Button("Create Room")) { m_NetworkMatch.CreateMatch(m_MatchName, 4, true, "", "", "", 0, 0, OnMatchCreate); } if (GUILayout.Button("Join first found match")) { m_NetworkMatch.ListMatches(0, 1, "", true, 0, 0, (success, info, matches) => { if (success && matches.Count > 0) { m_NetworkMatch.JoinMatch(matches[0].networkId, "", "", "", 0, 0, OnMatchJoined); } }); } if (GUILayout.Button("List rooms")) { m_NetworkMatch.ListMatches(0, 20, "", true, 0, 0, OnMatchList); } if (m_MatchList.Count > 0) { GUILayout.Label("Current rooms:"); } foreach (var match in m_MatchList) { if (GUILayout.Button(match.name)) { m_NetworkMatch.JoinMatch(match.networkId, "", "", "", 0, 0, OnMatchJoined); } } } }
public void joinMatch() { networkMatch.ListMatches(0, 20, "", OnMatchList); }
public void refresh() { networkMatch.ListMatches(0, 20, "", OnMatchList); }
public void JoinMatchGame() { networkMatch.ListMatches(0, 20, "", OnMatchList); }
public void ListRooms() { networkMatch.ListMatches(0, 20, "", true, 0, 0, OnMatchList); }