import { ryw_Event } from "../../FrameWork/Event/EventEnum"; import EventMgr from "../../FrameWork/Event/EventMgr"; import Common5 from "../../Platform/th/Common5"; const { ccclass, property } = cc._decorator; @ccclass export default class XianSuoBar extends cc.Component { @property(cc.Node) xiansuoMask: cc.Node = null; @property(cc.Label) iconName: cc.Label = null; // @property(cc.Label) // iconText: cc.Label = null; @property(cc.Sprite) iconSprite: cc.Sprite = null; xiansuoIconArrayConfig = null; xiansuoIndex = 0; start() { this.xiansuoMask.active = false; EventMgr.onEvent_custom(ryw_Event.touchChaDianCheck, this.showXianSuoPopUp, this); } protected onDisable(): void { EventMgr.offEvent_custom(ryw_Event.touchChaDianCheck, this.showXianSuoPopUp, this); } setxianSuoArrayConfig(xiansuoIconArray) { this.xiansuoIconArrayConfig = xiansuoIconArray; } showXianSuoPopUp(data_) { let touchIndex = data_.touchIndex; this.xiansuoIndex = touchIndex; this.xiansuoMask.active = true; this.iconName.string = this.xiansuoIconArrayConfig[touchIndex].name; Common5.getSpriteFrameFromBundle(this.xiansuoIconArrayConfig[touchIndex].bandleName, this.xiansuoIconArrayConfig[touchIndex].url, this.iconSprite); } onClick() { if (this.xiansuoMask.active) { this.xiansuoMask.active = false; EventMgr.emitEvent_custom(ryw_Event.XianSuoPopUpEnd, { touchIndex: this.xiansuoIndex }); } } // update (dt) {} }