// Learn TypeScript: // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html import UIBaseEv from "../../common/ui/uiEv/UIBaseEv"; import { MSG_Event } from "../DefineMsg/LogicMsg"; import { valueObj } from "../Model/data/baseObject"; import UIFishExhibitionLayer from "../ui/UIFishExhibitionLayer"; const {ccclass, property} = cc._decorator; @ccclass export default class fishListModule extends UIBaseEv { @property(cc.Label) fishNameLabel: cc.Label = null; @property text: string = 'hello'; fishData:valueObj = null; onShow(objData:valueObj) { this.fishData = objData; this.node.getComponentInChildren(cc.Label).string = this.fishData.getName(); this.node.active = true; let callFunc:Function = function (event?) { let customEventData = ""+0; this.onClickEvent(event,customEventData); } this.node.on(cc.Node.EventType.TOUCH_END,callFunc,this); } recycleFish() { this.node.active = false; let callFunc:Function = function (event?) { let customEventData = ""+0; this.onClickEvent(event,customEventData); } this.node.off(cc.Node.EventType.TOUCH_END,callFunc,this); } initEvent() { } updateUI(objData) { } onEnable(){ // let callFunc:Function = function (event?) { // let customEventData = ""+0; // this.onClickEvent(event,customEventData); // } // this.node.on(cc.Node.EventType.TOUCH_END,callFunc,this); } onDisable() { // let callFunc:Function = function (event?) { // let customEventData = ""+0; // this.onClickEvent(event,customEventData); // } // this.node.off(cc.Node.EventType.TOUCH_END,callFunc,this); } onClickEvent(event,customEventData) { switch (+customEventData) { case 0: UIFishExhibitionLayer.openView(this.fishData); break; default: break; } } // LIFE-CYCLE CALLBACKS: // onLoad () {} start () { } // update (dt) {} }