private void OnGalaxyIncommingMessage(byte code, byte[] data) { if (code == (byte)CommandType.roomGetList) { MessageRoomInfo messageRoomInfo = MessageRoomInfo.Deserialize <MessageRoomInfo>(data); foreach (var item in items) { Destroy(item); } items.Clear(); contentSize.y = 100; content.sizeDelta = contentSize; foreach (var item in messageRoomInfo.rooms) { RoomManagerItem newItem = Instantiate(prefItem, content); newItem.SetInfo(item.id, item.name, item.clients, item.maxClients); items.Add(newItem.gameObject); contentSize.y += 100; content.sizeDelta = contentSize; } count.text = messageRoomInfo.rooms.Count.ToString(); return; } if (code == (byte)CommandType.roomEnter) { UICreate.SetActive(false); UI.SetActive(false); Active(false); SceneManager.LoadScene("TestLevel"); } }
private void OnGalaxyInstancesList(List <GalaxyCoreCommon.InternalMessages.InstanceInfo> instances) { foreach (var item in items) { Destroy(item); } items.Clear(); contentSize.y = 100; content.sizeDelta = contentSize; foreach (var item in instances) { RoomManagerItem newItem = Instantiate(prefItem, content); newItem.SetInfo(item.id, item.name, item.clients, item.maxClients); items.Add(newItem.gameObject); contentSize.y += 100; content.sizeDelta = contentSize; } count.text = instances.Count.ToString(); }