Beispiel #1
0
 public override void OnRoomListUpdate(List <RoomInfo> roomList)
 {
     foreach (RoomInfo info in roomList)
     {
         if (info.RemovedFromList)
         {
             Debug.Log(info.Name);
             int index = listRooms.FindIndex(x => x.RoomInfo.Name == info.Name);
             if (index != -1)
             {
                 Destroy(listRooms[index].gameObject);
                 listRooms.RemoveAt(index);
             }
         }
         else
         {
             int index = listRooms.FindIndex(x => x.RoomInfo.Name == info.Name);
             if (index != -1)
             {
                 listRooms[index].SetRoomInfo(info);
             }
             else
             {
                 RoomListing listing = Instantiate(roomListing, contentList);
                 if (listing != null)
                 {
                     listing.SetRoomInfo(info);
                     listing.GetComponent <Button>().onClick.AddListener(delegate
                     {
                         SelectRoom(listing, info.Name);
                     });
                     listing.RoomInfo = info;
                     listRooms.Add(listing);
                 }
             }
         }
     }
 }
Beispiel #2
0
 void SelectRoom(RoomListing listing, string name)
 {
     roomSelected = name;
     listing.SelectRoom();
     joinButton.interactable = true;
 }