123456789101112131415161718192021222324 |
- import { _decorator, Component, Label, Node } from 'cc';
- const { ccclass, property } = _decorator;
- @ccclass('count_time_start')
- export class count_time_start extends Component {
- @property(Node) lab_time:Node = null
- private count:number = 0;
- public startGame(num:number,cb:Function){
- this.count = num
- this.lab_time.getComponent(Label).string = this.count + ""
- this.lab_time.active = true
- this.schedule(()=>{
- if(this.count<=0){
- cb()
- this.lab_time.active = false
- this.unscheduleAllCallbacks()
- }
- this.lab_time.getComponent(Label).string = this.count + ""
- this.count--;
- },1)
- }
- }
|