private void Init() { for (int i = 0; i < this.transform.childCount; i++) { if (this.transform.GetChild(i).name.Equals("Sprite")) { mItemImage = transform.GetChild(i).GetComponent <Image>(); } else if (this.transform.GetChild(i).name.Equals("Name")) { mItemName = transform.GetChild(i).GetComponent <Text>(); } else if (this.transform.GetChild(i).name.Equals("Count")) { mItemCount = transform.GetChild(i).GetComponent <Text>(); } } mEffect = GetComponent <ButtonEffectExtension>(); this.GetComponent <Button>().onClick.AddListener(delegate { if (this.Item.ID.Substring(0, 2).Equals("03")) //如果此物品是消耗品 { ItemParentView.ShowUseItemBox(this); } }); mHasInit = true; }
private void Init() { mEffect = this.GetComponent <ButtonEffectExtension>(); for (int i = 0; i < this.transform.childCount; i++) { if (this.transform.GetChild(i).name.Equals("Name")) { mEquipmentName = transform.GetChild(i).GetComponent <Text>(); } } this.GetComponent <Button>().onClick.AddListener(() => { OnClickEquipmentSignal.Dispatch(); }); mHasInit = true; }