void OnClickShop(ButtonScript obj, object args, int param1, int param2) { StoreUI.Instance.Tips.SetActive(true); if (GamePlayer.Instance.isInBattle) { StoreUI.Instance.Tips.GetComponent <StoreTips>().DetermineBtn.gameObject.SetActive(false); } else { StoreUI.Instance.Tips.GetComponent <StoreTips>().DetermineBtn.gameObject.SetActive(true); } StoreTips stips = StoreUI.Instance.Tips.GetComponent <StoreTips>(); PropsCell cCell = obj.GetComponent <PropsCell>(); stips.SpData = cCell.SpData; }
void AddItems(List <ShopData> Datas) { for (int i = 0; i < CellPool.Count; i++) { PropsCell bCell = CellPool[i].GetComponent <PropsCell>(); bCell.SpData = null; grid.transform.DetachChildren(); CellPool[i].SetActive(false); } for (int i = 0; i < Datas.Count; i++) { if (i < CellPool.Count) { CellPool[i].transform.parent = grid.transform; CellPool[i].gameObject.SetActive(true); PropsCell bCell = CellPool[i].GetComponent <PropsCell>(); bCell.SpData = Datas[i]; UIManager.SetButtonEventHandler(CellPool[i].gameObject, EnumButtonEvent.OnClick, OnClickShop, 0, 0); } else { GameObject o = GameObject.Instantiate(Item) as GameObject; o.SetActive(true); PropsCell pCell = o.GetComponent <PropsCell>(); pCell.SpData = Datas[i]; o.transform.parent = grid.transform; o.transform.position = Vector3.zero; o.transform.localScale = Vector3.one; UIManager.SetButtonEventHandler(o, EnumButtonEvent.OnClick, OnClickShop, 0, 0); CellPool.Add(o); } grid.Reposition(); sb.value = 1; // UIManager.SetButtonEventHandler (pCell.iconSp.gameObject, EnumButtonEvent.TouchDown, OnClickDown, Datas[i].Itemid_, 0); // UIManager.SetButtonEventHandler (pCell.iconSp.gameObject, EnumButtonEvent.TouchUp, OnClickUp, Datas[i].Itemid_, 0); } }