You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Photon.Pun;
|
|
|
|
|
using Photon.Realtime;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class RoomLayoutGroup : MonoBehaviour {
|
|
|
|
|
|
|
|
|
|
public GameObject roomListingPrefab;
|
|
|
|
|
|
|
|
|
|
public void OnReceivedRoomListUpdate(List<RoomInfo> roomList) {
|
|
|
|
|
|
|
|
|
|
RemoveOldListings();
|
|
|
|
|
|
|
|
|
|
foreach (RoomInfo room in roomList)
|
|
|
|
|
AddRoomListing(room);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AddRoomListing(RoomInfo room) {
|
|
|
|
|
Debug.Log("Room Received for display: " + room.ToString());
|
|
|
|
|
|
|
|
|
|
GameObject roomListingObj = Instantiate(roomListingPrefab);
|
|
|
|
|
roomListingObj.GetComponent<RoomListing>().roomName = room.Name;
|
|
|
|
|
roomListingObj.transform.SetParent(transform, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void RemoveOldListings() {
|
|
|
|
|
|
|
|
|
|
foreach (Transform roomListing in transform)
|
|
|
|
|
Destroy(roomListing.gameObject);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|