public void SetGameServerPageUI(List<RetGameServerPageEntity> lst) { if (lst == null || GameServerPageItemPrefab == null) return; for (int i = 0; i < lst.Count; i++) { GameObject obj = Instantiate(GameServerPageItemPrefab) as GameObject; obj.transform.parent = GameServerPageGrid.transform; obj.transform.localScale = Vector3.one; obj.transform.localPosition = Vector3.zero; UIGameServerPageItemView view = obj.GetComponent<UIGameServerPageItemView>(); if (view != null) { view.SetUI(lst[i]); view.OnGameServerPageClick = OnGameServerPageClick; } } }
public void SetGameServerPageUI(IList <RetGameServerPageEntity> list) { if (list == null || list.Count <= 0) { return; } for (int i = 0; i < list.Count; i++) { GameObject @object = Instantiate <GameObject>(m_gameServerPageItemPrefab); @object.transform.parent = m_gameServerPageGrid.transform; @object.transform.localPosition = Vector3.zero; @object.transform.localScale = Vector3.one; UIGameServerPageItemView uIGameServerPageItemView = @object.GetComponent <UIGameServerPageItemView>(); if (uIGameServerPageItemView != null) { uIGameServerPageItemView.SetUI(list[i]); uIGameServerPageItemView.m_OnGameServerPageClick = OnGameServerPageClickCallback; } } }