public void OnGameSelected(PlayerGameInfo gameInfo, GameRow gameRow) { if (isCurSelected) { curSelectedRow.DeselectRow(); } curSelectedGame = gameInfo; curSelectedRow = gameRow; curSelectedRow.SelectRow(); isCurSelected = true; joinGameButton.interactable = true; joinGameButtonText.color = normalTextColor; }
public void PopulateRows(List <PlayerGameInfo> games) { foreach (Transform child in rowParent.transform) { Destroy(child.gameObject); } for (int i = 0; i < games.Count; ++i) { GameRow current = GameObject.Instantiate(sampleRow, rowParent.transform); RectTransform rt = (RectTransform)current.transform; rt.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, i * rowHeight, rowHeight); current.Setup(i % 2 == 0, games[i], this); } RectTransform contentParent = (RectTransform)(rowParent.transform.parent); float contentHeight = Mathf.Max(games.Count * rowHeight, contentParent.rect.height); ((RectTransform)rowParent.transform).SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, contentHeight); scrollRect.verticalNormalizedPosition = 1; Canvas.ForceUpdateCanvases(); }
public void SelectRow(PlayerGameInfo gameInfo, GameRow gameRow) { onGameSelected?.Invoke(gameInfo, gameRow); }