Esempio n. 1
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        statusText.text = "";
        if (!success || matchList == null)
        {
            statusText.text = "Failed to get rooms.";
            return;
        }

        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject roomListItemGO = Instantiate(roomListItemPrefab);
            roomListItemGO.transform.SetParent(roomListParent);

            RoomListItem roomListItem = roomListItemGO.GetComponent <RoomListItem>();
            if (roomListItem != null)
            {
                roomListItem.SetUp(match, JoinRoom);
            }

            roomList.Add(roomListItemGO);
        }
        if (roomList.Count == 0)
        {
            statusText.text = "No active rooms";
        }
    }
Esempio n. 2
0
 public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matches)
 {
     status.text = "";//set text
     if (matches == null)
     {
         status.text = "couldn't get room list."; // if there are no mathces set text and return
         return;
     }
     ClearRoomList();
     foreach (MatchInfoSnapshot match in matches)                             // for each match in matches list
     {
         GameObject roomListItem = Instantiate(RoomListItemPrefab);           //Instantiate the button for the room
         roomListItem.transform.SetParent(RoomListParent);                    //set the parent for the instanciated object
         RoomListItem _RoomList = roomListItem.GetComponent <RoomListItem>(); //assing the script componect from the Instantiated object
         if (_RoomList != null)
         {
             _RoomList.SetUp(match, JoinRoom); //call the setup function from the room list script and send the currennt match and the join room function
         }
         RoomList.Add(roomListItem);           //add the Instantiated object to a list of rooms
     }
     if (RoomList.Count == 0)
     {
         status.text = "No Rooms Available"; // if no rooms set text
     }
 }
Esempio n. 3
0
    public void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> matchList)
    {
        status.text = "";
        if (matchList == null)
        {
            status.text = "No match found";
            return;
        }

        //pour chaque game trouvé un créer un bouton et on l'assigne
        foreach (MatchInfoSnapshot match in matchList)
        {
            GameObject _roomListItem = Instantiate(roomListItemPrefab);
            _roomListItem.transform.SetParent(roomListParent);

            RoomListItem roomListItem = _roomListItem.GetComponent <RoomListItem>();
            if (roomListItem != null)
            {
                roomListItem.SetUp(match, JoinRoom);
            }

            _roomListItem.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1);
            roomList.Add(_roomListItem);
        }

        if (roomList.Count == 0)
        {
            status.text = "No Rooms online";
        }
    }