private IEnumerator DequeueRows() { if (!dequeuing) { dequeuing = true; int rows = 0; while (true) { if (gameQueue.Count > 0) { GameTemplate gt = gameQueue.Dequeue(); GameObject newRow = Instantiate(tableRowPrefab, tableContent); TableRow row = newRow.GetComponent <TableRow>(); row.SetInfo(rows, gt.name, gt.size, gt.currenPlayers, gt.totalPlayers, rows % 2 == 0 ? evenRowColor : oddRowColor, gt.createdByLocalPlayer); UILobbyManager.Instance.AddOnClickLogicsToTableRow(row); rows++; } yield return(null); } } }
public void EnqueueRowItem(string gameName, EMapSize mapSize, int currentPlayers, int totalPlayers, bool createdByLocalPlayer) { GameTemplate gameTemplate = new GameTemplate(); gameTemplate.name = gameName; gameTemplate.size = EMapSize.GIANT;//mapSize; gameTemplate.currenPlayers = currentPlayers; gameTemplate.totalPlayers = totalPlayers; gameTemplate.createdByLocalPlayer = createdByLocalPlayer; gameQueue.Enqueue(gameTemplate); }
public void SetInfo(int id, string gameName, EMapSize mapSize, int currentPlayers, int totalPlayers, Color bgColor, bool createdByLocalPlayer) { if (gameTemplate == null) { gameTemplate = new GameTemplate(); } gameTemplate.name = gameName; gameTemplate.size = mapSize; gameTemplate.currenPlayers = currentPlayers; gameTemplate.totalPlayers = totalPlayers; gameTemplate.createdByLocalPlayer = createdByLocalPlayer; this.id = id; this.bgImage.color = bgColor; UpdateUI(gameTemplate); }
private void UpdateUI(GameTemplate template) { gameName.text = template.name; mapSize.text = template.size.ToString(); totalPlayers.text = template.currenPlayers + " / " + template.totalPlayers; }