49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import Model from "./Model";
|
|
import {TrackingManager, TrackingType} from "./Tracking/TrackingManager";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
@ccclass
|
|
export default class BottomUI extends cc.Component {
|
|
|
|
@property(cc.Node)
|
|
tipNode: cc.Node = null;
|
|
|
|
@property(cc.Label)
|
|
tipLabel: cc.Label= null;
|
|
|
|
clickShare: boolean = false;
|
|
clickShareTime: number = 0;
|
|
|
|
start() {
|
|
this.tipLabel.string = Model.game.tipCount + ''
|
|
this.tipNode.active = Model.game.tipCount > 0;
|
|
}
|
|
|
|
onReplayClick() {
|
|
TrackingManager.send(TrackingType.Replay);
|
|
if (Model.game.selectedModel == 1)
|
|
cc.director.loadScene('game')
|
|
else if (Model.game.selectedModel == 2)
|
|
cc.director.loadScene('gameDrop')
|
|
else if (Model.game.selectedModel == 3)
|
|
cc.director.loadScene('gameDrag')
|
|
else if (Model.game.selectedModel == 4)
|
|
cc.director.loadScene('gameDraw')
|
|
}
|
|
onTipClick() {
|
|
if (Model.game.tipCount > 0) {
|
|
Model.game.tipCount--;
|
|
this.tipNode.active = Model.game.tipCount > 0;
|
|
this.tipLabel.string = Model.game.tipCount + ''
|
|
this.node.emit('showTip');
|
|
}
|
|
}
|
|
onVideoEvent(v) {
|
|
if (v == 1) {
|
|
Model.game.tipCount++;
|
|
this.tipNode.active = Model.game.tipCount > 0;
|
|
this.tipLabel.string = Model.game.tipCount + ''
|
|
}
|
|
}
|
|
}
|