import { _decorator, Component, Node, Animation } from 'cc'; import { DataSystem } from '../core/data/DataSystem'; import { UserData } from '../data/UserData'; const { ccclass, property } = _decorator; /** * 切磋气泡 */ @ccclass('FightTips') export class FightTips extends Component { @property({ type: Node, tooltip: "气泡节点" }) tipNode: Node; @property({ type: Animation, tooltip: "气泡节点" }) ani: Animation; @property({ tooltip: "切磋解锁等级" }) opencampLv = 6; @property({ tooltip: "特效播放次数" }) playTimes = 6; private times = 0; start() { this.setData(); } update() { DataSystem.watch(UserData, 'campLv') && this.setData(); if (this.times == this.playTimes) { this.node.destroy(); } } private setData() { if (DataSystem.getData(UserData).campLv >= this.opencampLv) { this.ani && this.ani.play(); } } private playComplete() { this.times++; if (this.times < this.playTimes) { this.ani.play(); } } }