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 XianSuoIconList extends cc.Component { @property(cc.Node) chaDianItem: cc.Node = null; @property(cc.Node) content: cc.Node = null; start() { this.chaDianItem.active = false; EventMgr.onEvent_custom(ryw_Event.touchChaDianCheck, this.showChaDianIcon, this); } protected onDisable(): void { EventMgr.offEvent_custom(ryw_Event.touchChaDianCheck, this.showChaDianIcon, this); } setChaDianIconList(chaDianIconList: any[]) { for (const info of chaDianIconList) { let chaDianItem = cc.instantiate(this.chaDianItem); chaDianItem.active = true; this.content.addChild(chaDianItem); let icon = chaDianItem.getChildByName("icon"); icon.active = false; Common5.getSpriteFrameFromBundle(Common5.selectGameInfo.bundle, info.url, icon.getComponent(cc.Sprite)); } } showChaDianIcon(data_) { let touchIndex = data_.touchIndex; let chaDianItem = this.content.children[touchIndex]; cc.tween(chaDianItem) .set({ color: cc.Color.YELLOW }) .delay(0.5) .set({ color: cc.Color.WHITE }) .call(() => { chaDianItem.getChildByName("icon").active = true; }) .start(); } // update (dt) {} }