public void Setup(MatchInfoSnapshot _room, JoinRoomDelegate _joinRoomCallback) { room = _room; joinRoomCallback = _joinRoomCallback; roomNameText.text = room.name + " (" + room.currentSize + "/" + room.maxSize + ")"; }
public void JoinRoom(MatchInfoSnapshot match) { networkManager.matchMaker.JoinMatch(match.networkId, "", "", "", 0, 0, networkManager.OnMatchJoined); ClearRoomList(); statusText.text = "Joining..."; StartCoroutine(ConnectionTimeOut()); }
public void JoinRoom(MatchInfoSnapshot _match) { networkManager.matchMaker.JoinMatch(_match.networkId, "", "", "", 0, 0, networkManager.OnMatchJoined); ClearRoomList(); status.text = "Joining..."; networkUI.SetActive(false); }
private void OnInternetMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches) { if (success) { if (matches.Count != 0) { Debug.Log("Maths count = " + matches.Count); for (int i = matches.Count - 1; i >= 0; i++) { MatchInfoSnapshot info = matches[i]; if (info.currentSize > 0 && info.currentSize < info.maxSize) { NetworkManager.singleton.matchMaker.JoinMatch(matches[matches.Count - 1].networkId, "", "", "", 0, 0, OnJoinInternetMatch); return; } } CreateInternetMatch(m_currentRoomeName); } else { CreateInternetMatch(m_currentRoomeName); } } else { EnableButtons(true); Debug.LogError("Couldn't connect to match maker : " + extendedInfo); } }
/// <summary> /// Setup the specified info. /// </summary> /// <param name="info">Info.</param> public void Setup(MatchInfoSnapshot info) { matchInfo = info; matchName.text = info.name; onlinePlayers.text = info.currentSize + "/" + info.maxSize; }
//this method is called when a list of matches is returned private void OnInternetMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches) { if (success) { if (matches.Count != 0) { //Debug.Log("A list of matches was returned"); //join the last server (just in case there are two...) NetworkManager .singleton .matchMaker .JoinMatch(matches[matches.Count - 1] .networkId, "", "", "", 0, 0, OnJoinInternetMatch); matchInfoSnapshot = matches[matches.Count - 1]; } else { Debug.Log("No matches in requested room!"); Debug.Log("Creating new room..."); CreateInternetMatch(matchName); } } else { Debug.LogError("Couldn't connect to match maker"); StartCoroutine("RetryJoinMatch"); } }
public void MatchListItemSelected(bool value) { // This is inconvenient, can't pass WHICH Toggle was selected)... but Toggle Group is set so only one will be active Toggle selectedToggle = null; foreach (Toggle toggle in netScrollViewContent.GetComponent <ToggleGroup>().ActiveToggles()) { selectedToggle = toggle; } if (value) { currentSelectedMatchSnapshot = selectedToggle.GetComponent <NetMatchListItem>().matchInfoSnapshot; netJoinButton.interactable = true; } else { if (selectedToggle == null || EventSystem.current.currentSelectedGameObject != selectedToggle.gameObject) { // Same entry was selected twice (turns it off), so turn off EventSystem UI selection because it looks bad netJoinButton.interactable = false; currentSelectedMatchSnapshot = null; EventSystem.current.SetSelectedGameObject(null); } } }
private void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> response) { networkManager.OnMatchList(success, extendedInfo, response); int largest = Mathf.Max(response.Count, listItems.Count); int activeItems = 0; for (int i = 0; i < largest; i++) { if (response.Count > i) { MatchInfoSnapshot item = response[i]; if (listItems.Count <= i) { listItems.Add(MakeListItem(i)); } SetListItemValues(item, i); activeItems++; } else if (listItems.Count > i) { listItems[i].SetActive(false); } } Vector2 sizeDelta = scrollContent.sizeDelta; sizeDelta.y = 31 * activeItems; scrollContent.sizeDelta = sizeDelta; }
public void Setup(MatchInfoSnapshot matchInfo, JoinRoomDelegate joinCallback) { Debug.Log("Found match " + matchInfo.name); joinRoomCallback = joinCallback; match = matchInfo; roomNameText.text = match.name + " (" + match.currentSize + "/" + match.maxSize + ")"; }
public override void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList) { base.OnMatchList(success, extendedInfo, matchList); if (success) { if (matchList.Count > 0) { MatchInfoSnapshot match = FindMatch(matchList); if (match != null) { JoinGame(match); } else { infoPanel.GetComponentInChildren <Text>().text = "No empty slot found"; StartCoroutine(CloseInfoPanel(2.0f)); } } else { infoPanel.GetComponentInChildren <Text>().text = "No games available"; StartCoroutine(CloseInfoPanel(2.0f)); } } }
private void onMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList) { if (!success) { Debug.Log("Error looking for default Lobby match."); // we are going to refresh it again } else { MatchInfoSnapshot found = null; if (matchList.Count > 0) { // There should be only one match ever - the default one // but we check just in case foreach (MatchInfoSnapshot match in matchList) { if (match.name == GAME_MATCH_NAME) { found = match; break; } } } if (found == null) { // No one has hosted yet. Try to host. lobbyManager.matchMaker.CreateMatch(GAME_MATCH_NAME, (uint)100, true, "", "", "", 0, 0, lobbyManager.OnMatchCreate); } else { lobbyManager.matchMaker.JoinMatch(found.networkId, "", "", "", 0, 0, lobbyManager.OnMatchJoined); } } }
public void JoinRoom(MatchInfoSnapshot _match) { networkManager.matchMaker.JoinMatch(_match.networkId, "", "", "", 0, 0, networkManager.OnMatchJoined); ClearRoomList(); status.text = "Joining..."; GameManager.HideUI(); }
public void Setup(MatchInfoSnapshot match, JoinRoomDelegate joinRoomCallback) { this.match = match; this.joinRoomCallback = joinRoomCallback; roomNameText.text = match.name + " (" + match.currentSize + "/" + match.maxSize + ")"; }
public void Setup(MatchInfoSnapshot matchInfo, JoinRoomDelegate joinRoomDelegate) { this.matchInfo = matchInfo; this.joinRoomDelegate = joinRoomDelegate; roomNameText.text = matchInfo.name + " (" + matchInfo.currentSize + "/" + matchInfo.maxSize + ")"; }
void buttonSetup(Button button, MatchInfoSnapshot match) { var x = match; button.onClick.RemoveAllListeners(); button.onClick.AddListener(() => { JoinMatch(match); }); }
public void Setup(MatchInfoSnapshot _match, JoinRoomDelegate _joinRoomCallback) { match = _match; joinRoomCallback = _joinRoomCallback; roomNameText.text = match.name + " (" + match.currentSize + "/" + match.maxSize + ")"; }
public void JoinRoom(MatchInfoSnapshot _match) { //(netId,password,callback) networkManager.matchMaker.JoinMatch(_match.networkId, "", "", "", 0, 0, networkManager.OnMatchJoined); ClearRoomList(); status.text = "Joining " + _match.name + "..."; }
/// <summary> /// Зайти в комнату /// </summary> /// <param name="match"></param> public void JoinRoom(MatchInfoSnapshot match) { networkManager.matchMaker.JoinMatch(match.networkId, "", "", "", 0, 0, networkManager.OnMatchJoined); ClearRoomList(); status.text = "JOINING..."; }
public void JoinRoom(MatchInfoSnapshot _match) { Debug.Log("Joining " + _match.name); networkManager.matchMaker.JoinMatch(_match.networkId, "", "", "", 0, 0, networkManager.OnMatchJoined); StartCoroutine(WaitForJoin()); }
IEnumerator WaitForSuccessfulJoin() { ClearGameList(); int countdown = 10; while (countdown > 0) { statusText.text = "Joining Game..."; yield return(new WaitForSeconds(1)); countdown--; } // If you're still on the same scene when the countdown is over. AudioManager.instance.PlaySound("connection_error"); statusText.text = "Failed to connect."; yield return(new WaitForSeconds(2.5f)); MatchInfo matchInfo = netMan.matchInfo; if (matchInfo != null) { netMan.matchMaker.DropConnection(matchInfo.networkId, matchInfo.nodeId, 0, netMan.OnDropConnection); netMan.StopHost(); } matchToJoin = null; RefreshGameList(); }
public void JoinRoom(MatchInfoSnapshot match) { // Debug.Log("Joining " + match.name); networkManager.matchMaker.JoinMatch(match.networkId, "", "", "", 0, 0, networkManager.OnMatchJoined); ClearRoomList(); status.text = "Joining..."; }
/// <summary> /// Handles the user intent to join the room associated with the button clicked. /// </summary> /// <param name="match">The information about the match that the user intents to /// join.</param> #pragma warning disable 618 private void OnJoinRoomClicked(MatchInfoSnapshot match) #pragma warning restore 618 { _manager.matchName = match.name; _manager.matchMaker.JoinMatch(match.networkId, string.Empty, string.Empty, string.Empty, 0, 0, OnMatchJoined); }
public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches) { if (success) { int childCount = listOfMatches.transform.childCount; for (int i = 0; i < childCount; ++i) { Destroy(listOfMatches.transform.GetChild(i).gameObject); } for (int i = 0; i < matches.Count; ++i) { MatchInfoSnapshot match = matches[i]; string matchName = match.name; UnityEngine.Networking.Types.NetworkID networkId = match.networkId; GameObject gameObject = Instantiate(matchEntryPrefab, listOfMatches); RectTransform rect = gameObject.GetComponent <RectTransform>(); rect.position = new Vector2(10, listOfMatches.position.y - (float)i * 50.0f); Text text = gameObject.GetComponentInChildren <Text>(); text.text = "Match: " + matchName; Button button = gameObject.GetComponentInChildren <Button>(); button.onClick.AddListener(delegate { OnJoinMatchClicked(networkId); }); } } else { Debug.Log("OnMatchList failed"); } }
public void Setup(MatchInfoSnapshot match, JoinRoomDelgate callback) { desc = match; jRoomCallBack = callback; buttonText.text = desc.name + " (" + desc.currentSize + "/" + desc.maxSize + ")"; }
public void JoinMatch(MatchInfoSnapshot match) { if ((UnityEngine.Object)NetworkManager.singleton.matchMaker == (UnityEngine.Object)null) { NetworkManager.singleton.StartMatchMaker(); } NetworkManager.singleton.matchMaker.JoinMatch(match.networkId, "", "", "", 0, 0, OnMatchJoined); }
public void Populate(MatchInfoSnapshot vMatch, JC_LobbyManager vLobbyManager, Color vColour) { mTX_ServerInfoText.text = vMatch.name; mTX_PlayersInRoom.text = vMatch.currentSize.ToString() + " / " + vMatch.maxSize.ToString(); mBT_JoinButton.onClick.RemoveAllListeners(); mBT_JoinButton.onClick.AddListener(() => JoinMatch(vMatch.networkId, vLobbyManager)); }
public void JoinMatch(MatchInfoSnapshot match) { if (matchMaker == null) { StartMatchMaker(); } matchMaker.JoinMatch(match.networkId, "", "", "", 0, 0, HandleJoinedMatch); }
public void ButtonCancel() { panelCharacters.SetActive(false); selectedMatch = null; RefreshRoomList(); }
public void Init(MatchInfoSnapshot match, Transform parent) { btnText.text = match.name; transform.SetParent(parent); transform.localScale = Vector3.one; transform.localPosition = Vector3.zero; transform.localRotation = Quaternion.identity; }
public void Initialize(MatchInfoSnapshot server, Transform panel) { content.text = server.name; transform.SetParent(panel); transform.localScale = Vector3.one; transform.localRotation = Quaternion.identity; transform.localPosition = Vector3.zero; }
public void Populate(MatchInfoSnapshot match, LobbyManager lobbyManager, Color c) { serverInfoText.text = match.name; slotInfo.text = match.currentSize.ToString() + "/" + match.maxSize.ToString(); ; NetworkID networkID = match.networkId; joinButton.onClick.RemoveAllListeners(); joinButton.onClick.AddListener(() => { JoinMatch(networkID, lobbyManager); }); GetComponent<Image>().color = c; }
public void JoinRoom(MatchInfoSnapshot _match) { networkManager.matchMaker.JoinMatch(_match.networkId, "", "", "", 0, 0, networkManager.OnMatchJoined); StartCoroutine(WaitForJoin()); }