public int Show() { int iRet = 0; m_prefScountIcon.SetActive(false); CharaIcon[] arr = m_goContentRoot.GetComponentsInChildren <CharaIcon>(); foreach (CharaIcon c in arr) { if (m_prefScountIcon != c.gameObject) { GameObject.Destroy(c.gameObject); } } icon_list.Clear(); foreach (MasterCharaParam master in DMCamp.Instance.masterChara.list.FindAll(p => p.unit == "chara" && 0 < p.scout)) { if (null == DMCamp.Instance.dataUnitCamp.list.Find(p => p.chara_id == master.chara_id)) { iRet += 1; CharaIcon icon = PrefabManager.Instance.MakeScript <CharaIcon>(m_prefScountIcon, m_goContentRoot); icon.Initialize(master); icon.OnClickIcon.AddListener((CharaIcon _icon) => { OnListCharaId.Invoke(_icon.m_masterChara.chara_id); }); icon_list.Add(icon); } } return(iRet); }
public void ShowList() { m_goCharaListRoot.SetActive(true); CharaIcon[] arr = m_goCharaListContents.GetComponentsInChildren <CharaIcon>(); foreach (CharaIcon c in arr) { if (m_prefCharaIcon != c.gameObject) { GameObject.Destroy(c.gameObject); } } icon_list.Clear(); foreach (MasterCharaParam p in DMCamp.Instance.masterChara.list.FindAll(p => p.unit == "chara")) { DataUnitParam unit = DMCamp.Instance.dataUnitCamp.list.Find(a => a.chara_id == p.chara_id); if (unit != null) { CharaIcon icon = PrefabManager.Instance.MakeScript <CharaIcon>(m_prefCharaIcon, m_goCharaListContents); icon.Initialize(p); icon.OnClickIcon.AddListener((CharaIcon _icon) => { OnListCharaId.Invoke(_icon.m_masterChara.chara_id); }); icon_list.Add(icon); } } }
public void Initialize(MasterCharaParam _left, MasterCharaParam _right, MasterCharaParam _back) { left.Initialize(_left); right.Initialize(_right); back.Initialize(_back); left.OnClickIcon.RemoveAllListeners(); right.OnClickIcon.RemoveAllListeners(); back.OnClickIcon.RemoveAllListeners(); left.OnClickIcon.AddListener((CharaIcon _icon) => { OnClickIcon.Invoke(_icon); }); right.OnClickIcon.AddListener((CharaIcon _icon) => { OnClickIcon.Invoke(_icon); }); back.OnClickIcon.AddListener((CharaIcon _icon) => { OnClickIcon.Invoke(_icon); }); }