//按键注册 private void RegisterClickEvent() { /*根据商品名称的不同来区分购买了哪一个商品*/ if (goods.Name == GlobalParameter.Item_LittleBulePotion) { EventTrrigerListener.Get(BtnBuy).onClick += BuyLittleBlueBottle; } if (goods.Name == GlobalParameter.Item_LittleRedPotion) { EventTrrigerListener.Get(BtnBuy).onClick += BuyLittleRedBottle; } if (goods.Name == GlobalParameter.Item_BigBulePotion) { EventTrrigerListener.Get(BtnBuy).onClick += BuyBigBlueBottle; } if (goods.Name == GlobalParameter.Item_Cloth) { EventTrrigerListener.Get(BtnBuy).onClick += BuyCloth1; } if (goods.Name == GlobalParameter.Item_Cloth1) { EventTrrigerListener.Get(BtnBuy).onClick += BuyCloth2; } if (goods.Name == GlobalParameter.Item_Weapon) { EventTrrigerListener.Get(BtnBuy).onClick += BuyWeapon1; } if (goods.Name == GlobalParameter.Item_Weapon1) { EventTrrigerListener.Get(BtnBuy).onClick += BuyWeapon2; } if (goods.Name == GlobalParameter.Item_Weapon2) { EventTrrigerListener.Get(BtnBuy).onClick += BuyWeapon3; } if (goods.Name == GlobalParameter.Item_Boot) { EventTrrigerListener.Get(BtnBuy).onClick += BuyShoes1; } if (goods.Name == GlobalParameter.Item_Boot2) { EventTrrigerListener.Get(BtnBuy).onClick += BuyShoes2; } if (goods.Name == GlobalParameter.Item_Boot3) { EventTrrigerListener.Get(BtnBuy).onClick += BuyShoes3; } if (goods.Name == GlobalParameter.Item_FalconRing) { EventTrrigerListener.Get(BtnBuy).onClick += BuyGoldRing; } if (goods.Name == GlobalParameter.Item_DragonGrainRing) { EventTrrigerListener.Get(BtnBuy).onClick += BuyDiamondRing; } if (goods.Name == GlobalParameter.Item_Shild) { EventTrrigerListener.Get(BtnBuy).onClick += BuyShild; } }
/// <summary> /// 注册UI控件被按下的事件 /// </summary> private void RegisterClickEvent() { //当Item的种类属于上衣时,执行点击上衣的相应代码,其余的类似 if (item.Kind == GlobalParameter.Kind_Coat) EventTrrigerListener.Get(this.gameObject).onClick += OnClothClick; if (item.Title == GlobalParameter.Item_Weapon) //装备武器1 EventTrrigerListener.Get(this.gameObject).onClick += OnWeapon1Click; if (item.Title == GlobalParameter.Item_Weapon1) //装备武器2 EventTrrigerListener.Get(this.gameObject).onClick += OnWeapon2Click; if (item.Title == GlobalParameter.Item_Weapon2) //装备雷剑 EventTrrigerListener.Get(this.gameObject).onClick += OnWeapon3Click; if (item.Kind == GlobalParameter.Kind_Ring) EventTrrigerListener.Get(this.gameObject).onClick += OnRingClick; if (item.Kind == GlobalParameter.Kind_Shoes) EventTrrigerListener.Get(this.gameObject).onClick += OnShoesClick; if (item.Kind == GlobalParameter.Kind_Other) EventTrrigerListener.Get(this.gameObject).onClick += OnOtherItemClick; if (item.Title == GlobalParameter.Item_LittleBulePotion) EventTrrigerListener.Get(this.gameObject).onClick += OnLittleBlueBottleClick; if (item.Title == GlobalParameter.Item_LittleRedPotion) EventTrrigerListener.Get(this.gameObject).onClick += OnLittleRedBottleClick; if (item.Title == GlobalParameter.Item_BigBulePotion) EventTrrigerListener.Get(this.gameObject).onClick += OnBigBlueBottleClick; if (item.Title == GlobalParameter.Item_BigRedPotion) EventTrrigerListener.Get(this.gameObject).onClick += OnBigRedBottleClick; }
/// <summary> /// 注册鼠标经过UI控件事件 /// </summary> private void RegisterPointEnterEventAndExit() { if (item != null) { EventTrrigerListener.Get(this.gameObject).onEnter += OnShowItemDescription; EventTrrigerListener.Get(this.gameObject).onExit += OnPointExitItem; } }
/// <summary> /// 给按钮注册点击事件 /// </summary> /// <param name="btnName">按钮名称</param> /// /// <param name="dele">委托事件方法名称</param> protected void RegisterButtonClickEvent(string btnName, EventTrrigerListener.VoidDelegate dele) { Transform traButton = UnityHelper.GetInstance().FindTheChildNode(this.gameObject, btnName); if (traButton != null) { EventTrrigerListener.Get(traButton.gameObject).onClick = dele; } }
public Text textDetailDescript; //详细显示商品文本 void Start() { RegisterClickEvent(); TextBuyFail.SetActive(false); if (goods != null) { EventTrrigerListener.Get(GoIcon).onEnter += OnShowGoodsDetailDescription; EventTrrigerListener.Get(GoIcon).onExit += OnPointExitGoods; } }