import Common5 from "../../Platform/th/Common5"; const { ccclass, property } = cc._decorator; @ccclass export default class JuQingQiPao extends cc.Component { @property(cc.Node) diTu: cc.Node = null; @property(cc.Node) textNode: cc.Node = null; // LIFE-CYCLE CALLBACKS: // onLoad () {} curLog = null callFunc = null start() { } initView(curLog, func?) { this.curLog = curLog this.callFunc = func this.diTu.active = true this.textNode.active = false if (curLog.str.length > 4) { this.diTu.getChildByName('str').getComponent(cc.Label).string = curLog.str.substr(0, 4) + '...' } else { this.diTu.getChildByName('str').getComponent(cc.Label).string = curLog.str } this.textNode.getChildByName('str').getComponent(cc.Label).string = curLog.str } onBtnClick() { this.diTu.active = false this.textNode.stopAllActions() cc.tween(this.textNode) .set({ active: true }) .delay(this.curLog.delay) .set({ active: false }) .start() if (this.curLog.effectUrl && this.curLog.effectUrl.length > 0) { Common5.playRemoteAudioEffect(this.curLog.effectUrl); } this.scheduleOnce(() => { this.callFunc && this.callFunc() }, this.curLog.delay) } // update (dt) {} }