You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.4 KiB
58 lines
1.4 KiB
1 week ago
|
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) {}
|
||
|
}
|