public void LoadRoom() { if (roomData.rooms.Count > 0) { SRSXocXocLobbyItem itemSystem = roomData.rooms[0]; uiRoomItems[0].LoadData(itemSystem, 0); // re order int indexRoom = 1; for (int i = 0; i < roomData.rooms.Count; i++) { if (!itemSystem.Equals(roomData.rooms[i])) { if (indexRoom >= uiRoomItems.Count) { GameObject gObj = VKCommon.CreateGameObject(gRoomPrefab, gRoomContent); UIGameXocXocRoomItem item = gObj.GetComponent <UIGameXocXocRoomItem>(); uiRoomItems.Add(item); } uiRoomItems[indexRoom].LoadData(roomData.rooms[i], indexRoom); indexRoom++; } } if (indexRoom < uiRoomItems.Count) { for (int i = indexRoom; i < uiRoomItems.Count; i++) { uiRoomItems[i].gameObject.SetActive(false); } } } }
public void LoadData(SRSXocXocLobbyItem data, int index) { this.data = data; gameObject.SetActive(true); gContent.SetActive(true); imgBackground.color = new Color(imgBackground.color.r, imgBackground.color.g, imgBackground.color.b, index % 2 == 0 ? 0f : 1f); if (data.MaxPlayer > 40) { txtId.text = "Chung"; } else { txtId.text = data.RoomID; } txtBet.text = VKCommon.ConvertStringMoney(data.Bet); txtMinBet.text = VKCommon.ConvertStringMoney(data.Bet); txtStatus.text = strStatus[data.State]; txtStatus.color = cStatus[data.State]; txtUser.text = data.TotalPlayer + "/" + data.MaxPlayer; imgProgress.fillAmount = ((float)data.TotalPlayer / data.MaxPlayer); }