Inheritance: BasicResponse
    //    Check for exactly 1 match
    public void OnMatchList(ListMatchResponse matchListResponse)
    {
        List<MatchDesc> matches = matchListResponse.matches;

        //	The match name must be exact same as gameCode
        for (int i = 0; i < matches.Count; ++i) {
            MatchDesc match = matches[i];
            if (!match.name.Equals(gameCode)) {
                matches.RemoveAt(i);
                i--;
            }
        }

        if (matches.Count > 1) {
            menuScript.MultipleMatchJoinFailed();
            Debug.LogError("There are multiple matches!");
            for (int i = 0; i < matches.Count; ++i) {
                Debug.LogError("ID: " + matches[i].networkId + "\nName: " + matches[i].name);
            }
        }
        else if (matches.Count == 1) {
            Debug.Log("Joining " + matches[0].name);
            networkMatch.JoinMatch(matches[0].networkId, "", NetworkManager.singleton.OnMatchJoined);
        }
        else {
            menuScript.JoinFailed();
            Debug.LogError("Match not found!!");
        }
    }
Example #2
0
 public override void OnMatchList(ListMatchResponse matchList)
 {
     if (matchList.success)
     {
         m_rooms = matchList.matches.ToArray();
     }
 }
Example #3
0
 public void OnMatchList(ListMatchResponse matchListResponse)
 {
     if (matchListResponse.success && matchListResponse.matches != null)
     {
         networkMatch.JoinMatch(matchListResponse.matches[0].networkId, "", OnMatchJoined);
     }
 }
        public void OnGUIMatchList(ListMatchResponse response)
        {
            if (response.matches.Count == 0)
            {
                if (currentPage == 0)
                {
                    noServerFound.SetActive(true);
                }

                currentPage = previousPage;
               
                return;
            }

            noServerFound.SetActive(false);
            foreach (Transform t in serverListRect)
                Destroy(t.gameObject);

            for (int i = 0; i < response.matches.Count; ++i)
            {
                GameObject o = Instantiate(serverEntryPrefab) as GameObject;

                o.GetComponent<LobbyServerEntry>().Populate(response.matches[i], lobbyManager, (i % 2 == 0) ? OddServerColor : EvenServerColor);

                o.transform.SetParent(serverListRect, false);
            }
        }
        internal void OnMatchList(ListMatchResponse response, NetworkMatch.DataResponseDelegate <List <MatchInfoSnapshot> > userCallback)
        {
            List <MatchInfoSnapshot> list = new List <MatchInfoSnapshot>();

            foreach (MatchDesc current in response.matches)
            {
                list.Add(new MatchInfoSnapshot(current));
            }
            userCallback(response.success, response.extendedInfo, list);
        }
Example #6
0
        internal void OnMatchList(ListMatchResponse response, DataResponseDelegate <List <MatchInfoSnapshot> > userCallback)
        {
            List <MatchInfoSnapshot> responseData = new List <MatchInfoSnapshot>();

            foreach (MatchDesc desc in response.matches)
            {
                responseData.Add(new MatchInfoSnapshot(desc));
            }
            userCallback(response.success, response.extendedInfo, responseData);
        }
 private void UpdateListing(ListMatchResponse matchListResponse)
 {
     if (matchListResponse.success)
     {
         List<MatchDesc> servers = matchListResponse.matches;
         foreach (MatchDesc desc in servers)
         {
             AddServerButton(desc.name, desc.currentSize, desc.maxSize, desc.networkId);
         }
     }
 }
Example #8
0
 public void OnMatchList(ListMatchResponse matchListResponse)
 {
     if (matchListResponse.success && matchListResponse.matches != null
             && matchListResponse.matches.Count > 0) {
         int randomChoice = Mathf.FloorToInt(Random.value * matchListResponse.matches.Count);
         netMatch.JoinMatch(matchListResponse.matches[0].networkId, "", OnMatchJoined);
     } else {
         Debug.LogError ("Unable to join any matches.");
         canPress = true;
     }
 }
Example #9
0
        internal void OnMatchList(ListMatchResponse response, DataResponseDelegate <List <MatchInfoSnapshot> > userCallback)
        {
            List <MatchInfoSnapshot> matchInfoList = new List <MatchInfoSnapshot>();

            foreach (MatchDesc match in response.matches)
            {
                matchInfoList.Add(new MatchInfoSnapshot(match));
            }

            userCallback(response.success, response.extendedInfo, matchInfoList);
        }
Example #10
0
 public void OnMatchList(ListMatchResponse matchListResponse)
 {
     if (matchListResponse.success && matchListResponse.matches != null && matchListResponse.matches.Count > 0)
     {
         GGJNetworkManager.singleton.matchMaker.JoinMatch(matchListResponse.matches[0].networkId, "", GGJNetworkManager.singleton.OnMatchJoined);
     }
     else
     {
         var manager = GGJNetworkManager.singleton;
         GGJNetworkManager.singleton.matchMaker.CreateMatch(manager.matchName, manager.matchSize, true, "", GGJNetworkManager.singleton.OnMatchCreate);
     }
 }
Example #11
0
 public void OnMatchList(ListMatchResponse matchList)
 {
     if (matchList == null)
     {
         Debug.Log("部屋数は0です");
         return;
     }
     roomList = new List<MatchDesc>();
     roomList.Clear();
     foreach (MatchDesc match in matchList.matches)
     {
         roomList.Add(match);
     }
 }
Example #12
0
    public void OnMatchList(ListMatchResponse matchListResponse)
    {
        foreach (MatchDesc desc in matchListResponse.matches)
        {
            if (desc.name.Equals(nameText.text))
            {
                networkMatch.JoinMatch(desc.networkId, "", OnMatchJoined);
                matchFound = true;
                break;
            }
        }

        if(!matchFound) print("Match could not be found");
    }
Example #13
0
 public override void OnMatchList(ListMatchResponse matchList)
 {
     base.OnMatchList(matchList);
     if ( matchList.matches.Count <= 0 )
     {
         //create matchs
         matchMaker.CreateMatch("server", 2u, false, "", OnMatchCreate);
     }
     else
     {
         //connect
         MatchDesc match = matchList.matches[0];
         matchMaker.JoinMatch(match.networkId, "", OnMatchJoined);
     }
 }
Example #14
0
        public void ShowGUIMatchList(ListMatchResponse response) {
			if (response.matches.Count == 0) {
				if (currentPage == 0) {
					noServerFound.SetActive (true);
				}

				currentPage = previousPage;
               
				return;
			}

			// Clean up the List for update
			noServerFound.SetActive (false);
			foreach (Transform t in serverListRect)
				Destroy (t.gameObject);
			
			// Display the current servers
			for (int i = 0; i < response.matches.Count; ++i) {
				GameObject _server = Instantiate (serverEntryPrefab) as GameObject;
				_server.GetComponent<LobbyServerEntry> ().Populate (response.matches [i], lobbyManager);
				_server.transform.SetParent (serverListRect, false);
			}
		}
    //this method is called when a list of matches is returned
    private void OnInternetMatchList(ListMatchResponse matchListResponse)
    {
        if (matchListResponse.success)
        {
            if (matchListResponse.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(matchListResponse.matches[matchListResponse.matches.Count - 1].networkId, "", OnJoinInternetMatch);
            }
            else
            {
                Debug.Log("No matches in requested room!");
                SetOnShowGui(true);
            }
        }
        else
        {
            Debug.LogError("Couldn't connect to match maker");
            SetOnShowGui(true);
        }
    }
    private void OnMatchList(ListMatchResponse response)
    {
        LobbyManager.instance.HideInfoPanel();
        ClearMatchList();

        if (response.matches.Count == 0)
        {
            matchListWarning.gameObject.SetActive(true);
            listPanel.gameObject.SetActive(false);
        }
        else
        {
            matchListWarning.gameObject.SetActive(false);
            listPanel.gameObject.SetActive(true);
        }

        foreach (MatchDesc match in response.matches)
        {
            GameObject go = Instantiate(serverInfoPrefab) as GameObject;
            //go.GetComponent<LobbyServerInfo>().PopulateMatchInfo(match);
            go.transform.SetParent(listPanel, false);
        }
    }
Example #17
0
        private void OnInternetMatchList(ListMatchResponse matchListResponse)
        {
            if (matchListResponse.success)
            {
                if (matchListResponse.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(matchListResponse.matches[matchListResponse.matches.Count - 1].networkId, "", manager.OnMatchJoined);

                }
                else
                {
                    Debug.Log("No matches in requested room!");
                    createmymatch();//create room when no other room is been found
                }
            }
            else
            {
                Debug.LogError("Couldn't connect to match maker");
            }
        }
Example #18
0
    public void OnMatchList(ListMatchResponse matchListResponse)
    {
        if (matchListResponse.success && matchListResponse.matches != null)
        {
            if (matchListResponse.matches.Count == 0) {
                CreateMatchRequest create = new CreateMatchRequest();
                create.name = "Room" + UnityEngine.Random.Range(0, 1000);
                create.size = 2;
                create.advertise = true;
                create.password = "";

                Debug.Log("creating room " + create.name);

                networkMatch.CreateMatch(create, nm.OnMatchCreate);
            } else {
                foreach (var match in matchListResponse.matches)
                {
                    Debug.Log (match.name + ";" + match.networkId);
                }

                networkMatch.JoinMatch(matchListResponse.matches[0].networkId, "", nm.OnMatchJoined);
            }
        }
    }
Example #19
0
        // called when a list of matches is received
	    public virtual void OnMatchList(ListMatchResponse matchList)
	    {
            Debug.Log("OnMatchList");
	    }
 //All network events
 public override void OnMatchList(ListMatchResponse matchList)
 {
     base.OnMatchList (matchList);
     if(OnMatchesRetrieved != null)
         OnMatchesRetrieved();
 }
 /// <summary>
 ///   <para>This is invoked when a list of matches is returned from ListMatches().</para>
 /// </summary>
 /// <param name="matchList">A list of available matches.</param>
 public virtual void OnMatchList(ListMatchResponse matchList)
 {
   if (LogFilter.logDebug)
     Debug.Log((object) "NetworkManager OnMatchList ");
   this.matches = matchList.matches;
 }
    void OnGUIMatchList(ListMatchResponse matchList)
    {
        GuiLobbyManager.s_Singleton.connectingCanvas.Hide();

        if (matchList.success)
        {
            GuiLobbyManager.s_Singleton.joinMatchCanvas.Show(matchList);
        }
        else if (matchList.matches.Count == 0)
        {
            Debug.LogWarning("No Matched found.");
            Show();
        }
        else
        {
            Debug.LogError("Error finding matches");
            Show();
        }
    }
    public void Show(ListMatchResponse matchList)
    {
        base.Show();

        GuiLobbyManager.s_Singleton.matches = matchList.matches;

        var hooks = canvas.GetComponent<JoinMatchHooks>();
        if (hooks == null)
            return;

        hooks.OnReturnToMMHook = OnGUIReturnToMatchMaker;
        hooks.OnGameHook = OnGUIJoin;

        for (int i = 0; i < 6; i++)
        {
            hooks.SetMatchName(i, "");
        }

        for (int i = 0; i < matchList.matches.Count; i++)
        {
            var match = matchList.matches[i];
            hooks.SetMatchName(i, match.name);
        }

        EventSystem.current.SetSelectedGameObject(hooks.firstButton.gameObject);
    }
Example #24
0
	void OnMatchListAndCreate(ListMatchResponse matchList)
	{
		manager.matches = matchList.matches;
		Create ();
	}
Example #25
0
	void OnMatchListAndJoin(ListMatchResponse matchList)
	{
		manager.matches = matchList.matches;
		Join ();
	}
Example #26
0
	public void OnMatchList(ListMatchResponse matchListResponse) {
		if (matchListResponse.success && matchListResponse.matches != null)
		{
			matchList = matchListResponse.matches;

			foreach (Transform child in matchesPanel) {
				Destroy(child.gameObject);
			}

			foreach (var match in matchList) {
				string buttonText = "Join match: " + match.name;

				GameObject goButton = (GameObject)Instantiate(matchButtonPrefab);
				goButton.transform.SetParent(matchesPanel, false);
				goButton.transform.FindChild("Text").GetComponent<Text>().text = buttonText;

				Button tempButton = goButton.GetComponent<Button>();
				tempButton.onClick.AddListener(() => networkMatch.JoinMatch(match.networkId, "", OnMatchJoined));
			}
		}
	}
        private void OnMatchList(ListMatchResponse response)
        {
            if (response.success)
            {
                this.matches = response.matches;
                this.errorMessage = "";
            }
            else
            {
                this.matches = null;
                this.errorMessage = "Error getting match list";
            }

            this.listingMatches = false;
            this.lastMatchListingTime = Time.time;
        }
Example #28
0
    void OnMyMatchList(ListMatchResponse matchList)
    {
        if (!autoMatch)
            return;

        int count = matchList.matches.Count;
        if (matchList.matches.Count > 0) {
            if (matchList.matches [count - 1].currentSize < 2) {

                bool skip = false;
                foreach (string matchID in attemptedMatches) {
                    if (matchList.matches [count - 1].networkId.ToString() == matchID)
                        skip = true;
                }

                if(!skip){
                    attemptedMatches.Add (matchList.matches [count - 1].networkId.ToString());
                    matchMaker.JoinMatch (matchList.matches [count - 1].networkId, "", OnJoiningMatch);
                    return;
                }
            }
        }
        StartMyServer ();
    }
Example #29
0
 //--------------------------------------------------------------------------------------------------------------------
 //Name:
 //Description:
 //Parameters:
 //Returns:
 //--------------------------------------------------------------------------------------------------------------------
 public override void OnMatchList(ListMatchResponse matchList)
 {
     GameObject.Find ("MainMenu").transform.FindChild ("MultiplayerLobby").GetComponent<MultiplayerLobby> ().matchResponse (matchList);
 }
Example #30
0
	void OnMatchList(ListMatchResponse matchList) {
		Debug.Log ("OnMatchList()");
		onlineFindGameButton.gameObject.SetActive (true);
		networkLobbyManager.OnMatchList (matchList);
		if (matchList.matches.Count > 0) {
			// add matches as buttons
			int j = 0;
			Debug.Log (onlineFindScrollRect.content);
			Debug.Log (onlineFindScrollRect.content.transform);
			foreach (MatchDesc matchDesc in matchList.matches) {
				GameObject matchButton = (GameObject) Instantiate (matchButtonTemplate);
				matchButton.transform.SetParent(onlineFindScrollRect.content.transform, false);
				matchButton.transform.Translate(new Vector3 (0, -j * buttonSpace, 0));
				matchButton.transform.GetChild (0).GetComponent<Text> ().text = matchDesc.name;
				matchButton.GetComponent<Button> ().onClick.AddListener (
					delegate { OnClickSelectGame (matchDesc); });
				j++;
			}
			onlineFindScrollRect.content.sizeDelta =
				new Vector2(onlineFindScrollRect.content.sizeDelta.x, j * buttonSpace);
		}
		Debug.Log("match count: " + matchList.matches.Count);
	}
        public void OnListRoomsCallback(ListMatchResponse aResponse)
        {
            //Debug.Log(aResponse.ToString());
            m_roomList = new List<MatchDesc>();
            m_roomList.Clear();
            foreach (MatchDesc match in aResponse.matches)
            {
                m_roomList.Add(match);
                
            }

            if (m_roomList != null)
            {

                for (int i = 0; i < m_roomList.Count; i++)
                {
                    GameObject roomButton = (GameObject)Instantiate(m_baseButton, m_baseButton.transform.position, m_baseButton.transform.rotation);
                    roomButton.SetActive(true);
                    roomButton.transform.SetParent(m_baseButton.transform.parent);
                    Vector3 position = roomButton.GetComponent<RectTransform>().position;
                    position.y -= i * 30;
                    roomButton.GetComponent<RectTransform>().position = position;
                    MatchDesc roomInfo = m_roomList[i];
                    roomButton.GetComponent<Button>().onClick.AddListener(() => { JoinRoom(roomInfo); });
                    roomButton.transform.GetChild(0).GetComponent<Text>().text = m_roomList[i].name;

                    roomButton.transform.GetChild(1).GetComponent<Text>().text = m_roomList[i].currentSize + "/" + m_roomList[i].maxSize;
                    m_roomButtons.Add(new RoomButton(roomInfo, roomButton.GetComponent<Button>()));
                }

                if (m_roomList.Count > 0)
                {
                    m_refreshLabel.GetComponent<Text>().text = "";
                }
                else
                {
                    m_refreshLabel.GetComponent<Text>().text = "No rooms found...";
                }

                if (m_roomList.Count < 9)
                {
                    m_roomsScrollBar.SetActive(false);
                }
                else
                {
                    m_roomsScrollBar.SetActive(true);
                }
            }
            else
            {
                m_refreshLabel.GetComponent<Text>().text = "No rooms found...";
                m_roomsScrollBar.SetActive(false);
            }
        }
Example #32
0
 private void onMatchList(ListMatchResponse listResponse)
 {
     if (listResponse.success && listResponse.matches != null && listResponse.matches.Count == 1) {
         JoinMatch(listResponse.matches[0].networkId, "", onMatchJoined);
     } else {
         joinButton.gameObject.SetActive(true);
         hostButton.gameObject.SetActive(true);
         Debug.LogError("Failed to join match");
     }
 }
Example #33
0
    private void _OnListMatch(ListMatchResponse response)
    {
        m_waitingPanel.SetActive(false);
        if (response.success)
        {
            m_matchUI.GetComponentInChildren<CanvasGroup>().interactable = true;
            matches = response.matches;

            for (byte i = 0; i < matches.Count; i++)
            {
                Text[] texts = roomButtons[i].GetComponentsInChildren<Text>();
                //房间名称
                texts[0].text = matches[i].name;
                //当前人数
                texts[1].text = matches[i].currentSize + "/" + m_roomSize;

                //是否超出人数
                roomButtons[i].interactable = matches[i].currentSize < m_roomSize;
            }

            for (byte i = (byte)matches.Count; i < m_resultPageSize; i++)
            {
                Text[] texts = roomButtons[i].GetComponentsInChildren<Text>();
                texts[0].text = "";
                texts[1].text = "*/*";
                roomButtons[i].interactable = false;
            }

        }
        else
        {
            m_waitingPanel.SetActive(false);
            _Error("FAILED TO LIST ROOMS");
        }
    }