|
@@ -1,6 +1,6 @@
|
|
|
cc.macro.ENABLE_TRANSPARENT_CANVAS = true;
|
|
|
|
|
|
-import common, { AttributeGame, AttributeUnit } from "../src/common/common";
|
|
|
+import common, { AttributeGame, AttributeUnit, UitlData } from "../src/common/common";
|
|
|
import CConst from "../src/common/CConst";
|
|
|
import NotifierCenter from "../src/webtcp/NotifierCenter";
|
|
|
import Loader from "../src/config/Loader";
|
|
@@ -60,13 +60,13 @@ export default class Scene extends cc.Component {
|
|
|
/** 游戏开始 */
|
|
|
async start() {
|
|
|
common.hideLoading();
|
|
|
- let result = await this.checkUser();
|
|
|
+ let result = common.isDebug ? true : await this.checkUser();
|
|
|
if (result) {
|
|
|
this.enterGame();
|
|
|
}
|
|
|
else {
|
|
|
const options = {
|
|
|
- title: '弹窗',
|
|
|
+ title: '',
|
|
|
content: '请下载应用!'
|
|
|
};
|
|
|
const params = {
|
|
@@ -81,12 +81,10 @@ export default class Scene extends cc.Component {
|
|
|
/** 用户检测 */
|
|
|
async checkUser(): Promise<boolean> {
|
|
|
// 验证token
|
|
|
- let url = 'https://open.api.luojigou.vip/mall/mobile/common/verify/token';
|
|
|
let token = Tools.getLocalStorage('token', null);
|
|
|
- common.log('token验证 url: ', url, '; token: ', token);
|
|
|
return new Promise((resolve) => {
|
|
|
let xhr = new XMLHttpRequest();
|
|
|
- xhr.open("GET", url, true);
|
|
|
+ xhr.open("GET", common.urlToken, true);
|
|
|
xhr.setRequestHeader('token', token);
|
|
|
xhr.onreadystatechange = function () {
|
|
|
if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 300)) {
|
|
@@ -105,10 +103,10 @@ export default class Scene extends cc.Component {
|
|
|
/** 进入游戏 */
|
|
|
async enterGame() {
|
|
|
// 获取网络地址信息
|
|
|
- let json = Tools.getNetLocationInfo();
|
|
|
- common.log("网络数据:", JSON.stringify(json, null, 4));
|
|
|
+ let json: UitlData = Tools.getNetLocationInfo();
|
|
|
let unitNum = json.modelId ? json.modelId : common.unitCur;
|
|
|
common.setUnitNum(unitNum);
|
|
|
+ common.setItemId(json.itemId);
|
|
|
let isHas = await this.initData(unitNum);
|
|
|
if (isHas) {
|
|
|
await AudioCB.instance.init();
|
|
@@ -124,8 +122,8 @@ export default class Scene extends cc.Component {
|
|
|
}
|
|
|
else {
|
|
|
const options = {
|
|
|
- title: '弹窗',
|
|
|
- content: '当前集数不存在!',
|
|
|
+ title: '',
|
|
|
+ content: '当前动画游戏不存在!',
|
|
|
};
|
|
|
const params = {
|
|
|
mode: PopupCacheMode.Once,
|
|
@@ -229,10 +227,15 @@ export default class Scene extends cc.Component {
|
|
|
}
|
|
|
|
|
|
resetBtnNext(show) {
|
|
|
- this.btnNext.active = false;// 显示下一步按钮
|
|
|
- if (!show) return;
|
|
|
- let gameOne = common.getGameFormLocal();
|
|
|
- this.btnNext.active = Number(gameOne) >= 0;
|
|
|
+ if (common.isDebug) {
|
|
|
+ this.btnNext.active = true;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.btnNext.active = false;// 显示下一步按钮
|
|
|
+ if (!show) return;
|
|
|
+ let gameOne = common.getGameFormLocal();
|
|
|
+ this.btnNext.active = Number(gameOne) >= 0;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -275,10 +278,18 @@ export default class Scene extends cc.Component {
|
|
|
let curPage = common.getPageNum();
|
|
|
let attribute: AttributeUnit = common.attributeMap[curUint];
|
|
|
let length = attribute.config.length;
|
|
|
- if (curPage > length - 1) {
|
|
|
- return;
|
|
|
+ console.log('curPage: ', curPage, '; length: ', length);
|
|
|
+ if (curPage < length) {
|
|
|
+ this.addPrefab(curUint, curPage + 1);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ let token = Tools.getLocalStorage('token', null);
|
|
|
+ let xhr = new XMLHttpRequest();
|
|
|
+ xhr.open("GET", common.urlOver, true);
|
|
|
+ xhr.setRequestHeader('itemId', common.getItemId());
|
|
|
+ xhr.setRequestHeader('token', token);
|
|
|
+ xhr.send();
|
|
|
}
|
|
|
- this.addPrefab(curUint, curPage + 1);
|
|
|
}
|
|
|
|
|
|
/**
|