This commit is contained in:
YZ\249929363 2025-08-01 15:21:41 +08:00
parent 2de1357398
commit 6f1368f836
9 changed files with 1062 additions and 714 deletions

File diff suppressed because it is too large Load Diff

View File

@ -60,6 +60,7 @@ export default class GameManager extends cc.Component {
this.load1 = this.load2 = this.load3 = this.load4 = this.load5 = this.load6 = false;
setTimeout(() => {
this.readUserData();
this.getShareInfo();
}, 200);
@ -169,8 +170,6 @@ export default class GameManager extends cc.Component {
startGame() {
console.log("进入场景之前_____________", cc.fx.GameConfig.GM_INFO.first);
console.log(cc.fx.GameConfig.GM_INFO.level);
// 加载成功后进入 HomeScene
// cc.assetManager.loadBundle('music', (err, bundle) => {
// if (err) {
@ -257,6 +256,11 @@ export default class GameManager extends cc.Component {
cc.fx.GameConfig.GM_INFO.allOutTradeNo = data.data.outTradeNo;
console.log("______________________________有未发放奖励", cc.fx.GameConfig.GM_INFO.allOutTradeNo);
}
if (data.data.shareLvl) {
if (data.data.shareLvl.length > 0) {
cc.fx.GameConfig.GM_INFO.helpLevel = data.data.shareLvl;
}
}
this.setUserPower(data);
this.setmonth(data);
this.setRevive(data)
@ -537,75 +541,84 @@ export default class GameManager extends cc.Component {
else {
console.log("用户此一次进入游戏为正确获取openid");
}
cc.fx.GameConfig.GM_INFO.first = true;
console.log("金币成功时间耗时:", Date.now() - this.nowTime);
this.load3 = true;
this.load4 = true;
console.log("关卡等级成功时间耗时:", Date.now() - this.nowTime);
let levelInfo = { "level": 0, "timestamp": timestamp };
cc.fx.StorageMessage.setStorage("level", levelInfo);
let coinInfo = { "coin": 0, "timestamp": timestamp };
console.log("33333333333");
cc.fx.StorageMessage.setStorage("coin", coinInfo);
let propInfo = {
"freezeAmount": 3,
"hammerAmount": 3,
"magicAmount": 3,
"timestamp": timestamp,
}
console.log("最新上传道具信息——————————:", propInfo);
cc.fx.GameConfig.GM_INFO.freezeAmount = 3;
cc.fx.GameConfig.GM_INFO.hammerAmount = 3;
cc.fx.GameConfig.GM_INFO.magicAmount = 3;
cc.fx.StorageMessage.setStorage("prop", propInfo);
cc.fx.GameTool.getUserLevel((data) => {
if (data.result.code == 404 && data.result.message == "未找到关卡数据") {
console.log("没有等级信息,从用户接口拿到数据");
cc.fx.GameConfig.GM_INFO.first = true;
console.log("金币成功时间耗时:", Date.now() - this.nowTime);
this.load3 = true;
this.load4 = true;
console.log("关卡等级成功时间耗时:", Date.now() - this.nowTime);
let levelInfo = { "level": 0, "timestamp": timestamp };
cc.fx.StorageMessage.setStorage("level", levelInfo);
let coinInfo = { "coin": 0, "timestamp": timestamp };
console.log("33333333333");
cc.fx.StorageMessage.setStorage("coin", coinInfo);
let propInfo = {
"freezeAmount": 3,
"hammerAmount": 3,
"magicAmount": 3,
"timestamp": timestamp,
}
console.log("最新上传道具信息——————————:", propInfo);
cc.fx.GameConfig.GM_INFO.freezeAmount = 3;
cc.fx.GameConfig.GM_INFO.hammerAmount = 3;
cc.fx.GameConfig.GM_INFO.magicAmount = 3;
cc.fx.StorageMessage.setStorage("prop", propInfo);
cc.fx.GameTool.setUserInfo((data) => {
if (data.result.code == 200) {
console.log("上传用户信息成功", data);
//@ts-ignore
wx.cloud.callFunction({
name: 'userData',
data: {
action: 'read'
},
success: res => {
console.log("上传后,读取用户信息,为上报注册时间")
if (res.result.code == 200) {
const time = res.result.data.register_time;
MiniGameSdk.API.shushu_userSet(time);
}
cc.fx.GameTool.setUserInfo((data) => {
if (data.result.code == 200) {
console.log("上传用户信息成功", data);
//@ts-ignore
wx.cloud.callFunction({
name: 'userData',
data: {
action: 'read'
},
success: res => {
console.log("上传后,读取用户信息,为上报注册时间")
if (res.result.code == 200) {
const time = res.result.data.register_time;
MiniGameSdk.API.shushu_userSet(time);
}
}
})
//laf云函数
Utils.getUserData((data) => {
})
}
})
});
console.log("服务器也没有金币信息", cc.fx.GameConfig.GM_INFO.coin);
cc.fx.GameTool.setUserCoin(cc.fx.GameConfig.GM_INFO.coin, (data) => {
//laf云函数
Utils.getUserData((data) => {
})
});
cc.fx.GameTool.setUserLevel((data) => {
});
setTimeout(() => {
cc.fx.GameConfig.GM_INFO.freezeAmount = 3;
cc.fx.GameConfig.GM_INFO.hammerAmount = 3;
cc.fx.GameConfig.GM_INFO.magicAmount = 3;
cc.fx.GameTool.setUserProp(0, 0, (data) => {
if (data.result.code == 200) {
console.log("1111111上传道具信息成功", data);
}
else {
MiniGameSdk.API.showToast("网络异常,正在努力加载");
setTimeout(() => {
this.oldReadData(0);
}, 1000);
}
});
}, 0);
}
});
console.log("服务器也没有金币信息", cc.fx.GameConfig.GM_INFO.coin);
cc.fx.GameTool.setUserCoin(cc.fx.GameConfig.GM_INFO.coin, (data) => {
});
cc.fx.GameTool.setUserLevel((data) => {
});
setTimeout(() => {
cc.fx.GameConfig.GM_INFO.freezeAmount = 3;
cc.fx.GameConfig.GM_INFO.hammerAmount = 3;
cc.fx.GameConfig.GM_INFO.magicAmount = 3;
cc.fx.GameTool.setUserProp(0, 0, (data) => {
if (data.result.code == 200) {
console.log("1111111上传道具信息成功", data);
}
else {
MiniGameSdk.API.showToast("网络异常,正在努力加载");
setTimeout(() => {
this.oldReadData(0);
}, 1000);
}
});
}, 0);
else if (data.result.code == 200) {
console.log("有等级信息,从关卡接口拿到数据", data.result.data);
this.readSever(timestamp);
}
})
}
else if (res.result.code == 200) {
if (res.result.data) {
@ -621,91 +634,7 @@ export default class GameManager extends cc.Component {
const register_time = res.result.data.register_time;
MiniGameSdk.API.shushu_userSet(register_time);
}
setTimeout(() => {
cc.fx.GameTool.getUserCoin((data) => {
if (data.result.code == 404 && data.result.message == "未找到金币数据") {
let coinInfo = { "coin": 0, "timestamp": timestamp };
cc.fx.GameConfig.GM_INFO.coin = 0;
cc.fx.StorageMessage.setStorage("coin", coinInfo);
console.log("没有金币信息,从用户接口拿到数据", cc.fx.GameConfig.GM_INFO.coin);
cc.fx.GameTool.setUserCoin((data) => {
// console.log("上传",data);
this.load3 = true;
console.log("金币成功时间耗时:", Date.now() - this.nowTime);
});
}
else if (data.result.code == 200) {
// console.log("有金币信息,从金币接口拿到数据",data.result.data);
cc.fx.GameConfig.GM_INFO.coin = data.result.data;
let coinInfo = { "coin": cc.fx.GameConfig.GM_INFO.coin, "timestamp": timestamp };
console.log("存储金币信息:", cc.fx.GameConfig.GM_INFO.coin);
console.log("4444444444");
cc.fx.StorageMessage.setStorage("coin", coinInfo);
this.load3 = true;
console.log("金币成功时间耗时:", Date.now() - this.nowTime);
}
})
}, 500);
cc.fx.GameTool.getUserLevel((data) => {
if (data.result.code == 404 && data.result.message == "未找到关卡数据") {
console.log("没有等级信息,从用户接口拿到数据");
let levelInfo = { "level": 0, "timestamp": timestamp };
// console.log("333333存储关卡数据:",levelInfo);
cc.fx.GameConfig.GM_INFO.level = 0;
cc.fx.StorageMessage.setStorage("level", levelInfo);
cc.fx.GameTool.setUserLevel((data) => {
console.log("拿到的数据", data);
this.load4 = true;
console.log("关卡等级成功时间耗时:", Date.now() - this.nowTime);
});
}
else if (data.result.code == 200) {
console.log("有等级信息,从关卡接口拿到数据", data.result.data);
cc.fx.GameConfig.GM_INFO.level = data.result.data;
let levelInfo = { "level": cc.fx.GameConfig.GM_INFO.level, "timestamp": timestamp };
// console.log("444444存储关卡信息:",levelInfo);
cc.fx.StorageMessage.setStorage("level", levelInfo);
this.load4 = true;
console.log("关卡等级成功时间耗时:", Date.now() - this.nowTime);
}
})
setTimeout(() => {
cc.fx.GameTool.getUserProp((data) => {
if (data.result.code == 404 && data.result.message == "未找到道具数据") {
console.log("没有道具信息,从用户接口拿到数据");
cc.fx.GameConfig.GM_INFO.freezeAmount = 3;
cc.fx.GameConfig.GM_INFO.hammerAmount = 3;
cc.fx.GameConfig.GM_INFO.magicAmount = 3;
let propInfo = {
"freezeAmount": 3,
"hammerAmount": 3,
"magicAmount": 3,
"timestamp": timestamp,
}
console.log("上传道具信息44444444:", propInfo);
cc.fx.StorageMessage.setStorage("prop", propInfo);
cc.fx.GameTool.setUserProp(0, 0, (data) => {
});
}
else if (data.result.code == 200) {
console.log("有道具信息,从道具接口拿到数据", data.result.data);
cc.fx.GameConfig.GM_INFO.freezeAmount = data.result.data.freeze || 3;
cc.fx.GameConfig.GM_INFO.hammerAmount = data.result.data.hammer || 3;
cc.fx.GameConfig.GM_INFO.magicAmount = data.result.data.magic_wand || 3;
let propInfo = {
"freezeAmount": cc.fx.GameConfig.GM_INFO.freezeAmount,
"hammerAmount": cc.fx.GameConfig.GM_INFO.hammerAmount,
"magicAmount": cc.fx.GameConfig.GM_INFO.magicAmount,
"timestamp": timestamp,
}
console.log("上传道具信息6666666:", propInfo);
cc.fx.StorageMessage.setStorage("prop", propInfo);
}
})
}, 0);
this.readSever(timestamp);
}
@ -716,7 +645,7 @@ export default class GameManager extends cc.Component {
console.error(`读取用户数据失败,第 ${retryCount + 1} 次重试,错误信息:`, err);
// 延迟 2 秒后重试
setTimeout(() => {
this.readUserData(retryCount + 1);
this.oldReadData(retryCount + 1);
}, 2000);
} else {
console.error('读取用户数据失败,达到最大重试次数,退出游戏', err);
@ -836,10 +765,116 @@ export default class GameManager extends cc.Component {
}
//复活购买次数初始化
setRevive(data) {
cc.fx.GameConfig.GM_INFO.revive = data.data.rebornGiftCount;
cc.fx.GameConfig.GM_INFO.revive = data.data.rebornGiftCount;
console.log(data.data.rebornGiftCount, cc.fx.GameConfig.GM_INFO.revive, "🔥🔥🔥🔥🔥🔥🔥🔥")
}
readSever(timestamp) {
setTimeout(() => {
cc.fx.GameTool.getUserCoin((data) => {
if (data.result.code == 404 && data.result.message == "未找到金币数据") {
let coinInfo = { "coin": 0, "timestamp": timestamp };
cc.fx.GameConfig.GM_INFO.coin = 0;
cc.fx.StorageMessage.setStorage("coin", coinInfo);
console.log("没有金币信息,从用户接口拿到数据", cc.fx.GameConfig.GM_INFO.coin);
cc.fx.GameTool.setUserCoin((data) => {
// console.log("上传",data);
this.load3 = true;
console.log("金币成功时间耗时:", Date.now() - this.nowTime);
});
}
else if (data.result.code == 200) {
// console.log("有金币信息,从金币接口拿到数据",data.result.data);
cc.fx.GameConfig.GM_INFO.coin = data.result.data;
let coinInfo = { "coin": cc.fx.GameConfig.GM_INFO.coin, "timestamp": timestamp };
console.log("存储金币信息:", cc.fx.GameConfig.GM_INFO.coin);
console.log("4444444444");
cc.fx.StorageMessage.setStorage("coin", coinInfo);
this.load3 = true;
console.log("金币成功时间耗时:", Date.now() - this.nowTime);
}
})
}, 500);
cc.fx.GameTool.getUserLevel((data) => {
if (data.result.code == 404 && data.result.message == "未找到关卡数据") {
console.log("没有等级信息,从用户接口拿到数据");
let levelInfo = { "level": 0, "timestamp": timestamp };
// console.log("333333存储关卡数据:",levelInfo);
cc.fx.GameConfig.GM_INFO.level = 0;
cc.fx.StorageMessage.setStorage("level", levelInfo);
cc.fx.GameTool.setUserLevel((data) => {
console.log("拿到的数据", data);
this.load4 = true;
console.log("关卡等级成功时间耗时:", Date.now() - this.nowTime);
});
}
else if (data.result.code == 200) {
console.log("有等级信息,从关卡接口拿到数据", data.result.data);
cc.fx.GameConfig.GM_INFO.level = data.result.data;
let levelInfo = { "level": cc.fx.GameConfig.GM_INFO.level, "timestamp": timestamp };
// console.log("444444存储关卡信息:",levelInfo);
cc.fx.StorageMessage.setStorage("level", levelInfo);
this.load4 = true;
console.log("关卡等级成功时间耗时:", Date.now() - this.nowTime);
}
})
setTimeout(() => {
cc.fx.GameTool.getUserProp((data) => {
if (data.result.code == 404 && data.result.message == "未找到道具数据") {
console.log("没有道具信息,从用户接口拿到数据");
cc.fx.GameConfig.GM_INFO.freezeAmount = 3;
cc.fx.GameConfig.GM_INFO.hammerAmount = 3;
cc.fx.GameConfig.GM_INFO.magicAmount = 3;
let propInfo = {
"freezeAmount": 3,
"hammerAmount": 3,
"magicAmount": 3,
"timestamp": timestamp,
}
console.log("上传道具信息44444444:", propInfo);
cc.fx.StorageMessage.setStorage("prop", propInfo);
cc.fx.GameTool.setUserProp(0, 0, (data) => {
});
}
else if (data.result.code == 200) {
console.log("有道具信息,从道具接口拿到数据", data.result.data);
cc.fx.GameConfig.GM_INFO.freezeAmount = data.result.data.freeze || 3;
cc.fx.GameConfig.GM_INFO.hammerAmount = data.result.data.hammer || 3;
cc.fx.GameConfig.GM_INFO.magicAmount = data.result.data.magic_wand || 3;
let propInfo = {
"freezeAmount": cc.fx.GameConfig.GM_INFO.freezeAmount,
"hammerAmount": cc.fx.GameConfig.GM_INFO.hammerAmount,
"magicAmount": cc.fx.GameConfig.GM_INFO.magicAmount,
"timestamp": timestamp,
}
console.log("上传道具信息6666666:", propInfo);
cc.fx.StorageMessage.setStorage("prop", propInfo);
}
})
}, 0);
}
//获取有没有分享信息
getShareInfo() {
// 检查微信小游戏启动参数
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
//@ts-ignore
const launchOptions = wx.getLaunchOptionsSync();
const query = launchOptions.query;
if (query.level && query.uid) {
const level = parseInt(query.level, 10);
const uid = query.uid;
cc.fx.GameConfig.GM_INFO.otherUid = uid;
cc.fx.GameConfig.GM_INFO.otherLevel = level;
console.log('从分享链接获取到的关卡信息:', level);
console.log('从分享链接获取到的 UID:', uid);
// 可以在这里处理关卡信息和 UID
}
}
}
update(dt) {
//console.log("加载1:", this.load1, "加载2:", this.load2, "加载3:", this.load3, "加载4:", this.load4, "加载5:", this.load5, "加载6:", this.load6, "时间:", this.timeNumber);

View File

@ -75,7 +75,11 @@ export default class JiaZai extends cc.Component {
// LIFE-CYCLE CALLBACKS:
onLoad() {
this.getShareInfo();
console.log("进入首页获取的share", cc.fx.GameConfig.GM_INFO.otherUid, cc.fx.GameConfig.GM_INFO.otherLevel);
if (cc.fx.GameConfig.GM_INFO.otherUid != "") {
this.getShareInfo();
}
cc.game.setFrameRate(63);
LQCollideSystem.is_enable = true;
// //console.log("加载关卡配置2");
@ -934,7 +938,7 @@ export default class JiaZai extends cc.Component {
const level = parseInt(query.level, 10);
const uid = query.uid;
cc.fx.GameConfig.GM_INFO.otherUid = uid;
cc.fx.GameConfig.GM_INFO.otherLevel = level - 1;
cc.fx.GameConfig.GM_INFO.otherLevel = level;
console.log('从分享链接获取到的关卡信息:', level);
console.log('从分享链接获取到的 UID:', uid);
// 可以在这里处理关卡信息和 UID

View File

@ -12,6 +12,7 @@ import SceneManager from "./SceneManager";
import { MiniGameSdk } from "./Sdk/MiniGameSdk";
import Animation = cc.Animation;
import Revive from "./Revive";
import Utils from "./module/Pay/Utils";
const { ccclass, property } = cc._decorator;
@ -365,7 +366,11 @@ export default class MapConroler extends cc.Component {
this.updateCoin();
// var timeTemp = cc.fx.GameTool.getTimeMargin(this.timeNumber);
// this.timeLabel.string = timeTemp.toString();
NumberToImage.numberToImageNodes((cc.fx.GameConfig.GM_INFO.level + 1), 45, 0, "level_", this.levelLabel, true)
let levelName = (cc.fx.GameConfig.GM_INFO.level + 1);
if (cc.fx.GameConfig.GM_INFO.otherLevel) {
levelName = cc.fx.GameConfig.GM_INFO.otherLevel;
}
NumberToImage.numberToImageNodes(levelName, 45, 0, "level_", this.levelLabel, true)
console.log("当前关卡", cc.fx.GameConfig.GM_INFO.level + 1);
//this.startTimeCutDown();
@ -1898,10 +1903,15 @@ export default class MapConroler extends cc.Component {
time = 2000;
}
setTimeout(() => {
this.node.parent.parent.getChildByName("Lose").active = true;
this.node.parent.parent.getChildByName("Lose").getChildByName("Time").active = true;
this.revive.getComponent(Revive).init();
this.node.parent.parent.getChildByName("Lose").getChildByName("Boom").active = false;
if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
this.node.parent.parent.getChildByName("Lose").getChildByName("share").active = false;
}
else this.node.parent.parent.getChildByName("Lose").getChildByName("share").active = true;
if (type) {
if (type == "time") {
this.node.parent.parent.getChildByName("Lose").getChildByName("Time").active = true;
@ -3023,6 +3033,7 @@ export default class MapConroler extends cc.Component {
coins4.active = false;
caidai.active = false;
console.log(this.arr, "this.arr");
// 第一步:播放 title - 果冻弹跳效果
@ -3065,23 +3076,6 @@ export default class MapConroler extends cc.Component {
.to(0.3, { position: cc.v3(this.arr[6][0], this.arr[6][1], this.arr[6][2]) })
.start();
cc.tween(nextBtn)
.delay(0.1)
.to(0, { position: cc.v3(0, -880, 0), scale: 0 })
.call(() => {
nextBtn.active = true;
})
.to(0.15, { scale: 1.25 }, { easing: 'backOut' })
.to(0.08, { scale: 0.9 }, { easing: 'quadIn' })
.to(0.06, { scale: 1.15 }, { easing: 'quadOut' })
.to(0.04, { scale: 1 }, { easing: 'quadIn' })
.call(() => {
this.playDecorationGroup();
})
.to(0.3, { position: cc.v3(this.arr[5][0], this.arr[5][1], this.arr[5][2]) })
.start();
// tiaodik 动画(再延迟一点
cc.tween(tiaodik)
.delay(0.2)
@ -3095,6 +3089,31 @@ export default class MapConroler extends cc.Component {
.to(0.04, { scale: 1 }, { easing: 'quadIn' })
.to(0.3, { position: cc.v3(this.arr[4][0], this.arr[4][1], this.arr[4][2]) })
.start();
cc.tween(nextBtn)
.delay(0.1)
.to(0, { position: cc.v3(0, -880, 0), scale: 0 })
.call(() => {
if (cc.fx.GameConfig.GM_INFO.otherLevel == 0) {
nextBtn.active = true;
}
else {
cc.fx.GameConfig.GM_INFO.otherLevel = 0;
cc.fx.GameConfig.GM_INFO.otherUid = "";
}
})
.to(0.15, { scale: 1.25 }, { easing: 'backOut' })
.to(0.08, { scale: 0.9 }, { easing: 'quadIn' })
.to(0.06, { scale: 1.15 }, { easing: 'quadOut' })
.to(0.04, { scale: 1 }, { easing: 'quadIn' })
.call(() => {
this.playDecorationGroup();
})
.to(0.3, { position: cc.v3(this.arr[5][0], this.arr[5][1], this.arr[5][2]) })
.start();
}
// 播放装饰元素动画
@ -3164,12 +3183,17 @@ export default class MapConroler extends cc.Component {
}
setOtherLevel() {
if (cc.fx.GameConfig.GM_INFO.otherLevel == 1) {
cc.fx.GameConfig.GM_INFO.level = 2;
if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
let level = cc.fx.GameConfig.GM_INFO.otherLevel;
let uid = cc.fx.GameConfig.GM_INFO.otherUid;
Utils.shareLevel(level, uid, (data) => {
});
}
}
update(dt) {
}

View File

@ -431,6 +431,11 @@ export default class SceneManager extends cc.Component {
this.RewardNode.zIndex = 1001;
}
shareFriend() {
console.log("设置分享链接");
MiniGameSdk.API.shareGame();
}
update(dt) {
}

View File

@ -1348,7 +1348,7 @@ export namespace MiniGameSdk {
}
//分享
shareGame() {
static shareGame() {
if (typeof wx !== 'undefined' && wx !== null) {
// 获取关卡信息和 UID
const level = cc.fx.GameConfig.GM_INFO.level + 1;

View File

@ -109,7 +109,8 @@ export class GameConfig {
monthTime: number; //月卡时间
revive: number; //复活礼包购买次数
otherUid: string; //其他被帮助用户id
otherLevel: number;
otherLevel: number; //其他被帮助用户等级
helpLevel: number;
};
@ -120,6 +121,7 @@ export class GameConfig {
//游戏内信息
static get Instance() {
@ -266,6 +268,7 @@ export class GameConfig {
revive: 0, //复活礼包购买次数
otherUid: "", //其他被帮助用户id
otherLevel: 0, //其他被帮助用户等级
helpLevel: 0, //帮助用户等级
};
// this.setCode(this.getKey("scode"));
// this.GM_INFO.level = 0;
@ -308,7 +311,7 @@ export class GameConfig {
let name = "Json/level" + (cc.fx.GameConfig.GM_INFO.level + 1);
if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
console.log("进入特殊帮助关卡,可越过自己关卡等级");
name = "Json/level" + (cc.fx.GameConfig.GM_INFO.otherLevel + 1);
name = "Json/level" + cc.fx.GameConfig.GM_INFO.otherLevel;
}
// //console.log("关卡名称:",name);
// name = "Json/level" + 68;

View File

@ -959,6 +959,46 @@ export default class Utils {
}
}
static shareLevel(otherLevel, uid, callBack) {
let otheruid = uid || "";
let level = otherLevel || 0;
let data = {
uid: otheruid,
otherUid: cc.fx.GameConfig.GM_INFO.uid,
shareLv: level,
};
// 延迟时间数组,按照 1 秒 3 次、2 秒 5 次、5 秒 6 次、15 秒 5 次的规则生成
const delays = [
...Array(3).fill(1000),
...Array(5).fill(2000),
...Array(6).fill(5000),
...Array(5).fill(15000)
];
let attempt = 0; // 轮询次数
const poll = () => {
if (attempt >= delays.length) {
MiniGameSdk.API.showToast("网络异常,分享数据提交失败");
callBack({ code: 0, data: null, message: '轮询超时' });
return;
}
Utils.POST("shareLvSuccess", data, res => {
console.log("获得shareLvSuccess数据:", res);
if (res.code === 1) {
console.log("服务器:分享帮助通过关卡数据成功", res);
callBack(res);
} else {
attempt++;
setTimeout(poll, delays[attempt - 1]);
}
});
};
poll();
}
// const propName={
//   gold_1: "金币包1",
//   gold_2: "金币包2",

View File

@ -1397,7 +1397,7 @@ var GameTool = {
})
}
},
//判断是否有无限体力//返回true有false没有
getUserPowerTime() {
if (cc.fx.GameConfig.GM_INFO.userPowerTime > 0) {
let nowTime = Math.floor(Date.now() / 1000);
@ -1417,5 +1417,14 @@ var GameTool = {
}
}
//判断本地缓存关卡等级是否大于服务器存储
//返回true本地缓存大于服务器存储false本地缓存小于等于服务器存储
// compareLevel() {
// if (cc.fx.GameConfig.GM_INFO.level < cc.fx.StorageMessage.getStorage("level")) {
// }
// }
};
export { GameTool };