8月4日最后更新

This commit is contained in:
YZ\249929363 2025-08-04 19:35:56 +08:00
parent d161e193e4
commit 5393ceeeb1
2 changed files with 57 additions and 60 deletions

View File

@ -401,9 +401,6 @@ export default class Utils {
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function () {
console.log("请求readyState结果");
console.log(xhr.readyState);
console.log(xhr.status);
if (xhr.readyState === 4) {
let response: any = xhr.responseText;
if (xhr.status >= 200 && xhr.status < 300) {

View File

@ -48,7 +48,7 @@ var GameTool = {
"data": data
};
// console.log("上传数据:",postData);
// //console.log("上传数据:",postData);
// cc.fx.HttpUtil.uploadUserLogData(postData,function(){})
},
//上传排行榜 type为1
@ -160,7 +160,7 @@ var GameTool = {
node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture);
}
else {
// console.log(err,texture)
// //console.log(err,texture)
}
})
},
@ -209,7 +209,7 @@ var GameTool = {
},
getSeedRandom: function (min, max) {//包含min 不包含max
// console.log("随机数:",cc.fx.GameConfig.GM_INFO.currSeed);
// //console.log("随机数:",cc.fx.GameConfig.GM_INFO.currSeed);
max = max || 1;
min = min || 0;
cc.fx.GameConfig.GM_INFO.currSeed = (cc.fx.GameConfig.GM_INFO.currSeed * 9301 + 49297) % 233280;
@ -259,9 +259,9 @@ var GameTool = {
setFit: function (canvas) {
let flag = cc.fx.GameTool.getSetScreenResolutionFlag();
if (flag) {
// console.log("不是全面屏");
// //console.log("不是全面屏");
} else {
// console.log("是全面屏");
// //console.log("是全面屏");
}
return flag;
},
@ -367,7 +367,7 @@ var GameTool = {
level: cc.fx.GameConfig.GM_INFO.level,
timestamp: timestamp,
}
console.log("55555存储关卡数据:", time1, time2);
//console.log("55555存储关卡数据:", time1, time2);
cc.fx.StorageMessage.setStorage("level", levelInfo);
if (time1 != null && time2 != null) {
@ -381,17 +381,17 @@ var GameTool = {
}
cc.fx.GameTool.setUserLevel((data) => {
// console.log("存储结果:",data);
// console.log("上传",data);
// //console.log("存储结果:",data);
// //console.log("上传",data);
})
},
//改变金币信息
changeCoin(coin) {
console.log("changeCoin", coin);
//console.log("changeCoin", coin);
if (coin == undefined) return;
if (coin < 0 && cc.fx.GameConfig.GM_INFO.coin < -coin) {
// console.log("金币不足",cc.fx.GameConfig.GM_INFO.coin,-coin);
// //console.log("金币不足",cc.fx.GameConfig.GM_INFO.coin,-coin);
return;
}
cc.fx.GameConfig.GM_INFO.coin += coin;
@ -406,8 +406,8 @@ var GameTool = {
if (cc.fx.GameConfig.GM_INFO.coin < 0) {
cc.fx.GameConfig.GM_INFO.coin = 0;
}
// console.log("改变的金币:",coin);
// console.log("自身金币信息:",cc.fx.GameConfig.GM_INFO.coin);
// //console.log("改变的金币:",coin);
// //console.log("自身金币信息:",cc.fx.GameConfig.GM_INFO.coin);
const timestamp = Date.now();
let coinInfo = {
coin: cc.fx.GameConfig.GM_INFO.coin,
@ -415,9 +415,9 @@ var GameTool = {
}
MiniGameSdk.API.shushu_SetSuperProperties(null, null);
cc.fx.StorageMessage.setStorage("coin", coinInfo);
// console.log("存储金币数据:",cc.fx.GameConfig.GM_INFO.coin,coinInfo);
// //console.log("存储金币数据:",cc.fx.GameConfig.GM_INFO.coin,coinInfo);
cc.fx.GameTool.setUserCoin((data) => {
// console.log("上传",data);
// //console.log("上传",data);
})
},
//@ts-ignore
@ -432,7 +432,7 @@ var GameTool = {
action: 'read'
},
success: res => {
// console.log('读取用户金币数据成功', res.result)
// //console.log('读取用户金币数据成功', res.result)
if (callback)
callback(res);
@ -454,11 +454,11 @@ var GameTool = {
//@ts-ignore
if (typeof wx !== 'undefined' && wx !== null) {
if (cc.fx.GameConfig.GM_INFO.coin <= 0 || cc.fx.GameConfig.GM_INFO.coin == undefined) {
console.log("金币上传失败", cc.fx.GameConfig.GM_INFO.coin);
//console.log("金币上传失败", cc.fx.GameConfig.GM_INFO.coin);
// MiniGameSdk.API.showToast(cc.fx.GameConfig.GM_INFO.coin);
cc.fx.GameConfig.GM_INFO.coin = 0;
}
console.log("即将上传的金币数量:", cc.fx.GameConfig.GM_INFO.coin);
//console.log("即将上传的金币数量:", cc.fx.GameConfig.GM_INFO.coin);
//@ts-ignore
wx.cloud.callFunction({
name: 'userCoin',
@ -467,9 +467,9 @@ var GameTool = {
coinAmount: cc.fx.GameConfig.GM_INFO.coin
},
success: res => {
// console.log('云函数返回结果:', res);
// //console.log('云函数返回结果:', res);
if (res.result.code == 200) {
// console.log('存储金币数据成功',cc.fx.GameConfig.GM_INFO.coin);
// //console.log('存储金币数据成功',cc.fx.GameConfig.GM_INFO.coin);
}
if (callback) {
callback(res);
@ -477,7 +477,7 @@ var GameTool = {
},
fail: err => {
// console.log('存储金币数据失败')
// //console.log('存储金币数据失败')
if (callback) {
callback(err);
}
@ -526,10 +526,10 @@ var GameTool = {
cc.fx.GameConfig.GM_INFO.hp = cc.fx.GameConfig.GM_INFO.hp_Max;
//没有存储过体力值
if (health == null || health == undefined || health == "") {
console.log("没存储过体力值,初进");
//console.log("没存储过体力值,初进");
cc.fx.GameConfig.GM_INFO.hp = cc.fx.GameConfig.GM_INFO.hp_Max;
cc.fx.GameTool.getUserHealth((data) => {
console.log("体力接口返回结果", data);
//console.log("体力接口返回结果", data);
if (data.result.code == 200) {
cc.fx.GameConfig.GM_INFO.hp = data.result.data;
cc.fx.GameConfig.GM_INFO.min_Time = data.result.timestamp;
@ -551,12 +551,12 @@ var GameTool = {
})
}
else {
console.log("有存储过体力值:", health);
//console.log("有存储过体力值:", health);
cc.fx.GameConfig.GM_INFO.hp = health.health;
console.log("体力值读取完毕", cc.fx.GameConfig.GM_INFO.hp);
//console.log("体力值读取完毕", cc.fx.GameConfig.GM_INFO.hp);
if (health.health < 0) {
console.log("体力值异常,归零");
//console.log("体力值异常,归零");
cc.fx.GameConfig.GM_INFO.hp = 0;
cc.fx.GameConfig.GM_INFO.min_Time = 0;
cc.fx.GameTool.setUserHealth(0, () => {
@ -577,7 +577,7 @@ var GameTool = {
if (callback) callback();
}, true);
// MiniGameSdk.API.showToast("恢复1点体力值");
console.log(`体力值恢复 ${recoveredHealth} 点,当前体力值: ${cc.fx.GameConfig.GM_INFO.hp}`);
//console.log(`体力值恢复 ${recoveredHealth} 点,当前体力值: ${cc.fx.GameConfig.GM_INFO.hp}`);
// 如果体力增加后仍未满,更新计时
if (cc.fx.GameConfig.GM_INFO.hp < cc.fx.GameConfig.GM_INFO.hp_Max) {
const remainingTime = Math.ceil((thirtyMinutes - ((timestamp - health.timestamp) % thirtyMinutes)) / 1000);
@ -592,13 +592,13 @@ var GameTool = {
} else {
// 计算距离下一次恢复的剩余时间
const remainingTime = Math.ceil((thirtyMinutes - (elapsedTime % thirtyMinutes)) / 1000);
console.log(`体力值未满,待恢复,距离下一次恢复还剩 ${remainingTime}`);
//console.log(`体力值未满,待恢复,距离下一次恢复还剩 ${remainingTime} 秒`);
cc.fx.GameConfig.GM_INFO.min_Time = remainingTime;
if (callback) callback();
}
}
else {
console.log("体力值已满");
//console.log("体力值已满");
if (callback) callback();
}
}
@ -608,7 +608,7 @@ var GameTool = {
getUserHealth(callback: Function) {
//@ts-ignore
if (typeof wx !== 'undefined' && wx !== null) {
console.log("即将进入体力获取接口");
//console.log("即将进入体力获取接口");
//@ts-ignore
wx.cloud.callFunction({
name: 'userHealth',
@ -616,12 +616,12 @@ var GameTool = {
action: 'read'
},
success: res => {
// console.log("体力获取成功",res);
// //console.log("体力获取成功",res);
if (callback)
callback(res);
},
fail: err => {
// console.log("体力获取失败",err);
// //console.log("体力获取失败",err);
callback(err);
}
})
@ -725,7 +725,7 @@ var GameTool = {
buyReview(coin, callback: Function) {
//@ts-ignore
if (typeof wx !== 'undefined' && wx !== null) {
// console.log("实际即将消耗金币:",coin);
// //console.log("实际即将消耗金币:",coin);
// this.changeCoin(coin);
callback();
}
@ -746,7 +746,7 @@ var GameTool = {
else if (propid == 2002) {
num = 1;
}
console.log("_____________新版本", num);
//console.log("_____________新版本", num);
cc.fx.GameTool.changeCoin(-cost);
const dataTemp = {
change_reason: "商城购买道具消耗",
@ -773,7 +773,7 @@ var GameTool = {
propNumber = cc.fx.GameConfig.GM_INFO.magicAmount;
}
console.log("购买道具:", num);
//console.log("购买道具:", num);
cc.fx.GameTool.setUserProp(propid, propNumber, (data) => {
})
@ -791,7 +791,7 @@ var GameTool = {
item_price: cost,
cost_type: "gold"
}
console.log("____________即将上传Shop_buy", buyData);
//console.log("____________即将上传Shop_buy", buyData);
cc.fx.GameTool.shushu_Track("shop_buy", buyData);
callback();
@ -804,10 +804,10 @@ var GameTool = {
//@ts-ignore
if (typeof wx !== 'undefined' && wx !== null) {
// if(cc.fx.GameConfig.GM_INFO.level <= 0 || cc.fx.GameConfig.GM_INFO.level == undefined){
// console.log("等级重置为0");
// //console.log("等级重置为0");
// cc.fx.GameConfig.GM_INFO.level = 0;
// }
// console.log("即将上传的关卡数:",cc.fx.GameConfig.GM_INFO.level);
// //console.log("即将上传的关卡数:",cc.fx.GameConfig.GM_INFO.level);
//@ts-ignore
wx.cloud.callFunction({
name: 'userLevel',
@ -816,15 +816,15 @@ var GameTool = {
levelAmount: cc.fx.GameConfig.GM_INFO.level
},
success: res => {
// console.log('云函数返回结果:', res);
// console.log('存储关卡数据成功',cc.fx.GameConfig.GM_INFO.level);
// //console.log('云函数返回结果:', res);
// //console.log('存储关卡数据成功',cc.fx.GameConfig.GM_INFO.level);
if (callback) {
callback(res);
}
},
fail: err => {
// console.log('存储关卡数据失败')
// //console.log('存储关卡数据失败')
return;
if (callback) {
callback(err);
@ -850,7 +850,7 @@ var GameTool = {
action: 'read'
},
success: res => {
// console.log('读取用户道具数据成功', res.result)
// //console.log('读取用户道具数据成功', res.result)
if (res.result.data) {
// cc.fx.GameConfig.GM_INFO.freezeAmount = res.result.data.freeze;
// cc.fx.GameConfig.GM_INFO.hammerAmount = res.result.data.hammer;
@ -903,14 +903,14 @@ var GameTool = {
propData: newPropData
},
success: res => {
// console.log('云函数返回结果:', res);
// //console.log('云函数返回结果:', res);
if (callback) {
callback(res);
}
// console.log('存储道具数据成功')
// //console.log('存储道具数据成功')
},
fail: err => {
// console.log('存储道具数据失败')
// //console.log('存储道具数据失败')
if (callback) {
callback(err);
}
@ -949,7 +949,7 @@ var GameTool = {
userData: userInfo
},
success: res => {
// console.log('存储用户数据成功')
// //console.log('存储用户数据成功')
if (callback) {
callback(res);
}
@ -974,8 +974,8 @@ var GameTool = {
let getCoin = 0;
var rewardData = null;
console.log(productId);
console.log("发放奖励", productId);
//console.log(productId);
//console.log("发放奖励", productId);
switch (productId) {
case "gold_1":
cc.fx.GameTool.changeCoin(1200);
@ -1115,7 +1115,7 @@ var GameTool = {
if (MapConroler._instance != null) {
console.log("應該下發獎勵:", rewardData);
//console.log("應該下發獎勵:", rewardData);
MapConroler._instance.SceneManager.openRewardWindow(rewardData);
}
@ -1252,8 +1252,8 @@ var GameTool = {
break;
}
if (name == "finish_stage") {
console.log("准备上报完成");
console.log(eventData);
//console.log("准备上报完成");
//console.log(eventData);
// MiniGameSdk.API.showToast("准备上报完成游戏");
}
// MiniGameSdk.API.shushu_Track(name,eventData);
@ -1290,7 +1290,7 @@ var GameTool = {
const lastChar = openid[openid.length - 1];
const charCode = lastChar.charCodeAt(0);
let groupNumber: number;
console.log("openid尾数____________________:", charCode);
//console.log("openid尾数____________________:", charCode);
// 根据 type 参数计算分组编号
switch (type) {
@ -1304,11 +1304,11 @@ var GameTool = {
groupNumber = charCode % 6;
break;
default:
console.log('type 参数值无效,必须为 2、3 或 6');
//console.log('type 参数值无效,必须为 2、3 或 6');
return;
}
console.log("type____________________:", type);
console.log("分组编号____________________:", groupNumber);
//console.log("type____________________:", type);
//console.log("分组编号____________________:", groupNumber);
return groupNumber;
}
}
@ -1321,7 +1321,7 @@ var GameTool = {
//@ts-ignore
if (typeof wx !== 'undefined' && wx !== null) {
const num = propData.freeze;
console.log("_________道具增加的数量为:", num);
//console.log("_________道具增加的数量为:", num);
cc.fx.GameConfig.GM_INFO.freezeAmount += propData.freeze;
cc.fx.GameConfig.GM_INFO.hammerAmount += propData.hammer;
cc.fx.GameConfig.GM_INFO.magicAmount += propData.magic_wand;
@ -1395,7 +1395,7 @@ var GameTool = {
cc.fx.GameConfig.GM_INFO.userPowerTime = powerTime;
cc.fx.StorageMessage.setStorage("userPowerTime", powerTime);
Utils.setUserPowerTime(powerTime, (data) => {
console.log("购买无限体力同步:", data);
//console.log("购买无限体力同步:", data);
})
}
},
@ -1407,7 +1407,7 @@ var GameTool = {
cc.fx.GameConfig.GM_INFO.userPowerTime = 0;
cc.fx.StorageMessage.setStorage("userPowerTime", 0);
Utils.setUserPowerTime(0, (data) => {
console.log("购买无限体力同步:", data);
//console.log("购买无限体力同步:", data);
})
return false;
} else {