public void Display(List <DataItem> _itemList, int _iIndex, string _strButton = "") { BannerBaseClear(); foreach (DataItem data in _itemList) { GameObject objBanner = PrefabManager.Instance.MakeObject("prefab/PrefBannerItem", m_Grid.gameObject); BannerItem script = objBanner.GetComponent <BannerItem> (); script.Initialize(data, GameMain.Instance.m_iCostNokori); BannerBaseAdd(objBanner); } setSwitchButton(_strButton, m_goScrollViewParent, m_Grid, _iIndex); }
public void Display(List <DataItemMaster> _itemMasterList, int _iIndex, string _strButton = "") { BannerBaseClear(); foreach (DataItemMaster data in _itemMasterList) { GameObject objBanner = PrefabManager.Instance.MakeObject("prefab/PrefBannerItem", gameObject); BannerItem script = objBanner.GetComponent <BannerItem> (); if (script.Initialize(data, GameMain.Instance.m_iCostNokori)) { BannerBaseAdd(objBanner); objBanner.transform.parent = m_Grid.transform; //Debug.Log ("insert"); } else { //Debug.LogError ( string.Format( "nokemono:{0}" , data.item_id)); Destroy(objBanner); } } setSwitchButton(_strButton, m_goScrollViewParent, m_Grid, _iIndex); m_Grid.enabled = true; }
public IEnumerator ShowList(int _iCategory) { ClearList(); List <DataItemParam> item_param_list; if (_iCategory == 0) { item_param_list = DataManager.Instance.dataItem.list.FindAll(p => 0 < p.num); } else { item_param_list = DataManager.Instance.dataItem.list.FindAll(p => 0 < p.num && p.item_id / MasterItem.LargeCategory == _iCategory); } foreach (DataItemParam param in item_param_list) { BannerItem script = PrefabManager.Instance.MakeScript <BannerItem>(m_prefItemBanner, m_goItemListContents); MasterItemParam master = DataManager.Instance.masterItem.list.Find(p => p.item_id == param.item_id); script.Initialize(param, master); script.HandleBannerEvent.AddListener(OnBannerEvent); yield return(null); } }
public void Show(List <DataItemParam> _data_list, List <MasterItemParam> _master_list) { m_prefBannerItem.SetActive(false); BannerItem[] arr = m_goContentRoot.GetComponentsInChildren <BannerItem>(); foreach (BannerItem c in arr) { if (m_prefBannerItem != c.gameObject) { GameObject.Destroy(c.gameObject); } } foreach (DataItemParam data in _data_list) { BannerItem banner = PrefabManager.Instance.MakeScript <BannerItem>(m_prefBannerItem, m_goContentRoot); banner.Initialize(data, _master_list.Find(p => p.item_id == data.item_id)); banner.OnClickBanner.AddListener((int _iSerial) => { OnSelectItem.Invoke(_iSerial); }); } }