void RefreshScroll() { HSUnityTools.DestroyChildren(RoleParent_RectTransform); if (m_params.roleList == null || m_params.roleList.Count <= 0) { return; } for (int i = 0; i < m_params.roleList.Count; i++) { var role = m_params.roleList[i]; var item = RoleUIItem.Create(); item.transform.SetParent(RoleParent_RectTransform); item.transform.localScale = Vector3.one; Button btn = item.GetComponent <Button>(); BindListener(btn, () => { OnItemClick(item); }); bool select = m_params.selectList.Contains(role); item.SetSelect(select); item.ShowRole(role); } }
void RefreshScrollView() { HSUnityTools.DestroyChildren(RoleParent_RectTransform); if (m_roleList == null || m_roleList.Count <= 0) { return; } RoleInstance role; for (int i = 0; i < m_roleList.Count; i++) { role = m_roleList[i]; var item = RoleUIItem.Create(); item.transform.SetParent(RoleParent_RectTransform); item.transform.localScale = Vector3.one; Button btn = item.GetComponent <Button>(); BindListener(btn, () => { OnItemClick(item); }); bool isSelect = (m_currentRole == role); if (isSelect) { m_currentShowItem = item; } item.SetSelect(isSelect); item.ShowRole(role); } }