void Start() { mAllButton = transform.Find("Bg/AllGoods").GetComponent <UIButton>(); mEatButton = transform.Find("Bg/Eat").GetComponent <UIButton>(); mEquipmentButton = transform.Find("Bg/Equipment").GetComponent <UIButton>(); mBSButton = transform.Find("Bg/BSGoods").GetComponent <UIButton>(); mZQButton = transform.Find("Bg/ZQGoods").GetComponent <UIButton>(); showArea = transform.Find("Bg/ShowArea").GetComponent <ShowArea>(); showArea.showEatList = EatList; showArea.showEquipmentList = EquipmentList; UIEventListener.Get(mAllButton.gameObject).onClick = OnAllBtnCllcik; UIEventListener.Get(mEatButton.gameObject).onClick = OnEatButtonClick; UIEventListener.Get(mEquipmentButton.gameObject).onClick = OnEquipmentButtonClick; UIEventListener.Get(mBSButton.gameObject).onClick = OnBsButtonClick; UIEventListener.Get(mZQButton.gameObject).onClick = OnZqButtonClick; }
private void OnGoodBtnClick(GameObject _go) { if (infoCell.transform.childCount > 0) { Destroy(infoCell.transform.GetChild(0).gameObject); } GameObject go = (GameObject)Instantiate(this.gameObject); GoodInfo goinfo = go.GetComponent <GoodInfo>(); goinfo.good = this.good; //goinfo.good.count = 1; goinfo.SetNum(1); go.transform.parent = infoCell.transform; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; ShowArea showAera = infoCell.transform.parent.GetComponent <ShowArea>(); showAera.ShowInfo(good.Describe); showAera.go = this.gameObject; }