| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- let aLib = require("Library");
- cc.Class({
- extends: cc.Component,
- properties: {
- GameStates: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- PlayerControllerNode: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- MapNode: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- TimeLabelNode: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- StartButtonNode: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- TenSecondChallengeBG: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- ReadyGo: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- },
- onLoad () {
- this.GameStatesScp = this.GameStates.getComponent('GameStates');
- this.PlayerControllerScp = this.PlayerControllerNode.getComponent('PlayerController');
- this.MapScp = this.MapNode.getComponent('Map');
- this.TimeLabelScp = this.TimeLabelNode.getComponent('CountDown');
- this.ReadyGoScp = this.ReadyGo.getComponent('ReadyGo');
- },
- start()
- {
- this.TimeLabelScp.InitTime(this.GameStatesScp.totalTime);
- },
- StarGame(target,param)
- {
- if(this.GameStatesScp.progress != this.GameStatesScp.progressTag.default) return;
- this.GameStatesScp.progress = this.GameStatesScp.progressTag.ready; //1 ready to start
- this.PlayerControllerScp.Reset();
- this.MapScp.Reset();
- this.TimeLabelScp.InitTime(this.GameStatesScp.totalTime);
- if(!this.ReadyGo.active)
- {
- this.ReadyGo.active = true;
- }
- this.ReadyGoScp.Play(function(){
- this.GameStatesScp.progress = this.GameStatesScp.progressTag.start;//2 start
- this.TimeLabelScp.CountDown(function(){
- this.GameStatesScp.progress = this.GameStatesScp.progressTag.result;
- this.GameStatesScp.PunchTimes = 0;
- this.StartButtonNode.active = true;
- this.TenSecondChallengeBG.active = true;
- this.scheduleOnce(function(){
- this.GameStatesScp.progress = this.GameStatesScp.progressTag.default;
- }.bind(this),1);
- }.bind(this));
- }.bind(this));
- this.StartButtonNode.active = false;
- this.TenSecondChallengeBG.active = false;
- }
- });
|