protected override void OnStart() { base.OnStart(); for (int i = 0; i < 10; i++) { GameObject go = Instantiate(m_SelectRoleItemPrefab); m_SelectRoleItemlist.Add(go); go.transform.SetParent(m_SelectRoleItemGrid.transform); go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; UISelectRoleItemView itemView = m_SelectRoleItemlist[i].GetComponent <UISelectRoleItemView>(); if (itemView != null) { itemView.OnClickItem = OnClickItem; } go.SetActive(false); } }
public void SetRoleList(List <RoleOperation_LogOnGameServerReturnProto.RoleItem> roleList) { for (int i = 0; i < 10; i++) { m_SelectRoleItemlist[i].SetActive(false); } if (roleList != null && roleList.Count != 0) { for (int i = 0; i < roleList.Count; i++) { m_SelectRoleItemlist[i].SetActive(true); UISelectRoleItemView itemView = m_SelectRoleItemlist[i].GetComponent <UISelectRoleItemView>(); if (itemView != null) { itemView.SetUI(roleList[i]); } } } }