144 lines
5.2 KiB
JavaScript
144 lines
5.2 KiB
JavaScript
"use strict";
|
||
cc._RF.push(module, 'b0432BA295DjIOcuitdGKO1', 'GameManager');
|
||
// Script/GameManager.ts
|
||
|
||
"use strict";
|
||
var __extends = (this && this.__extends) || (function () {
|
||
var extendStatics = function (d, b) {
|
||
extendStatics = Object.setPrototypeOf ||
|
||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||
return extendStatics(d, b);
|
||
};
|
||
return function (d, b) {
|
||
extendStatics(d, b);
|
||
function __() { this.constructor = d; }
|
||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||
};
|
||
})();
|
||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||
};
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
var GameAppStart_1 = require("./module/GameStart/GameAppStart");
|
||
// 主游戏控制类
|
||
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
|
||
var GameManager = /** @class */ (function (_super) {
|
||
__extends(GameManager, _super);
|
||
function GameManager() {
|
||
return _super !== null && _super.apply(this, arguments) || this;
|
||
}
|
||
GameManager.prototype.onLoad = function () { };
|
||
GameManager.prototype.start = function () {
|
||
this.fit();
|
||
this.init();
|
||
};
|
||
//初始化数据
|
||
GameManager.prototype.init = function () {
|
||
};
|
||
//根据是否全面屏,做独立适配方面
|
||
GameManager.prototype.fit = function () {
|
||
var jg = this.setFit();
|
||
if (!jg) {
|
||
}
|
||
};
|
||
//判断全面屏
|
||
GameManager.prototype.getSetScreenResolutionFlag = function () {
|
||
var size = cc.winSize;
|
||
var width = size.width;
|
||
var height = size.height;
|
||
if ((height / width) > (16.2 / 9))
|
||
return false;
|
||
return true;
|
||
};
|
||
//判断全面屏适配
|
||
GameManager.prototype.setFit = function () {
|
||
var flag = this.getSetScreenResolutionFlag();
|
||
if (flag) {
|
||
}
|
||
else {
|
||
}
|
||
return flag;
|
||
};
|
||
//返回首页
|
||
GameManager.prototype.backScene = function () {
|
||
cc.director.loadScene("LoadScene");
|
||
};
|
||
//下一关,或者重新开始,或者返回上一关,根据level决定
|
||
GameManager.prototype.reStart = function (type) {
|
||
};
|
||
//获取时间戳
|
||
GameManager.prototype.getTime = function () {
|
||
var timestamp = new Date().getTime();
|
||
return timestamp;
|
||
};
|
||
//获胜
|
||
GameManager.prototype.passLevel = function () {
|
||
};
|
||
//失败
|
||
GameManager.prototype.loseLevel = function (type) {
|
||
};
|
||
//开始游戏
|
||
GameManager.prototype.startGame = function () {
|
||
};
|
||
//如果是倒计时 调用此方法
|
||
GameManager.prototype.updateCountDownTime = function () {
|
||
if (this.countTime > 0) {
|
||
this.countTime -= 1;
|
||
// this.time.string = Fx.GameTool.getTimeMargin(this.countTime);
|
||
if (this.countTime < 5) {
|
||
// cc.tween(this.time.node)
|
||
// .to(0.25,{scale:1.5,color:cc.color(255,0,0)})
|
||
// .to(0.25,{scale:1,color:cc.color(255,255,255)})
|
||
// .start()
|
||
var over = this.node.getChildByName("Over");
|
||
cc.tween(over)
|
||
.to(0.2, { opacity: 255 })
|
||
.delay(0.1)
|
||
.to(0.2, { opacity: 0 })
|
||
.start();
|
||
}
|
||
if (this.countTime <= 0) {
|
||
this.unschedule(this.updateCountDownTime);
|
||
var time = 0;
|
||
this.gameOver(time);
|
||
}
|
||
}
|
||
};
|
||
//上传每次操作数据
|
||
GameManager.prototype.setData = function () {
|
||
GameAppStart_1.Fx.GameTool.setGameData();
|
||
};
|
||
//上传排行榜数据
|
||
GameManager.prototype.gameOver = function (time) {
|
||
GameAppStart_1.Fx.GameTool.setRank(time);
|
||
this.node.getChildByName("GameOver").active = true;
|
||
this.node.getChildByName("GameOver").opacity = 0;
|
||
cc.tween(this.node.getChildByName("GameOver"))
|
||
.to(0.4, { opacity: 255 })
|
||
.delay(2)
|
||
.to(0.4, { opacity: 50 })
|
||
.call(function () {
|
||
cc.director.loadScene("OverScene");
|
||
})
|
||
.start();
|
||
};
|
||
GameManager.prototype.onEnable = function () {
|
||
// Fx.Notifications.on("clickSun", this.clickSun, this);
|
||
};
|
||
GameManager.prototype.onDisable = function () {
|
||
// Fx.Notifications.off("clickSun", this.clickSun);
|
||
};
|
||
GameManager.prototype.update = function (dt) {
|
||
};
|
||
GameManager = __decorate([
|
||
ccclass
|
||
], GameManager);
|
||
return GameManager;
|
||
}(cc.Component));
|
||
exports.default = GameManager;
|
||
|
||
cc._RF.pop(); |