Exemple #1
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches)
    {
        status.text = "";

        if (success)
        {
            //find the match with the minimum number of players and join that match
            foreach (MatchInfoSnapshot match in matches)
            {
                GameObject roomListItemGO = Instantiate(roomListItemPrefab, roomListParent);

                RoomListItem _roomListItem = roomListItemGO.GetComponent <RoomListItem>();
                if (_roomListItem != null)
                {
                    _roomListItem.SetMatchInfo(match, JoinRoom);
                }
                //have component sit on game object that will set name/amount of users
                //as wel as setting up callback function that will join the game.

                roomList.Add(roomListItemGO);
            }

            Debug.Log(roomList.Count);
            if (roomList.Count == 0)
            {
                status.text = "No Rooms";
            }
        }
        else
        {
            Debug.Log("Couldn't Connect to Matchmaker");
        }
    }