private void UpdateMatceshUI() { DestroyContent(); DiscardPositions(); Debug.Log("TBM.Matchmaker.Matches.Count: " + TBM.Matchmaker.Matches.Count); Debug.Log("TBM.Matchmaker.Invitations.Count: " + TBM.Matchmaker.Invitations.Count); int index = 0; foreach (UM_TBM_Invite invite in TBM.Matchmaker.Invitations) { RS_TBM_MatchUI ui = CreateContent(index); ui.SetInvite(invite); index += 1; } foreach (UM_TBM_Match match in TBM.Matchmaker.Matches) { RS_TBM_MatchUI ui = CreateContent(index); ui.SetMatch(match); index += 1; } SetPositionAndResize(); }
//-------------------------------------- // Private Methods //-------------------------------------- private RS_TBM_MatchUI CreateContent(int index) { RS_TBM_MatchUI matchUI = RS_AssetsLoader.LoadGameObject(RS_TBM_MatchUI.AssetName).GetComponent <RS_TBM_MatchUI>(); matchUI.transform.SetParent(MatchesScroll.content.transform); matchUI.transform.localScale = Vector3.one; RectTransform PanelRect = matchUI.GetComponent <RectTransform> (); PanelRect.anchoredPosition = new Vector2(0f, index * (-PanelRect.rect.height)); NodesList.Add(matchUI); return(matchUI); }