| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- 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);
- },
- //页面退出回调
- onQuit(data)
- {
- console.log('onQuit=',data);
- },
- //弹出框回调
- onQuitModal(res)
- {
- if (res.data.confirm) {
- console.log("退出");
- }else if(res.data.cancel){
- console.log("取消退出");
- }
- },
- StarGame(target,param)
- {
- if(this.GameStatesScp.progress != this.GameStatesScp.progressTag.ready) return; //1 ready to start
- 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.ready;
- this.GameStatesScp.PunchTimes = 0;
- this.StartButtonNode.active = true;
- this.TenSecondChallengeBG.active = true;
-
- }.bind(this));
- }.bind(this));
- this.StartButtonNode.active = false;
- this.TenSecondChallengeBG.active = false;
- }
- });
|