Compare commits

...

2 Commits

Author SHA1 Message Date
YZ\249929363 69f5b2d2db Merge branch 'main' of https://git.sparkus.cn/yangzhao/cb 2025-07-17 20:22:10 +08:00
YZ\249929363 006bd001fc 更新 2025-07-17 20:22:06 +08:00
6 changed files with 265 additions and 135 deletions

View File

@ -168,6 +168,7 @@ export default class GameManager extends cc.Component {
startGame() { startGame() {
console.log("进入场景之前_____________", cc.fx.GameConfig.GM_INFO.first); console.log("进入场景之前_____________", cc.fx.GameConfig.GM_INFO.first);
console.log(cc.fx.GameConfig.GM_INFO.level);
// 加载 music bundle // 加载 music bundle
cc.assetManager.loadBundle('music', (err, bundle) => { cc.assetManager.loadBundle('music', (err, bundle) => {
if (err) { if (err) {
@ -240,6 +241,7 @@ export default class GameManager extends cc.Component {
console.log("体力值完成进入游戏"); console.log("体力值完成进入游戏");
this.load5 = true; this.load5 = true;
}); });
this.load6 = true;
}); });
} }
else { else {
@ -706,7 +708,9 @@ export default class GameManager extends cc.Component {
} }
update(dt) { update(dt) {
//console.log("加载1:", this.load1, "加载2:", this.load2, "加载3:", this.load3, "加载4:", this.load4, "加载5:", this.load5, "加载6:", this.load6, "时间:", this.timeNumber);
if (this.load1 && this.load2 && this.load3 && this.load4 && this.load5 && this.load6 == true && this.timeNumber <= 0) { if (this.load1 && this.load2 && this.load3 && this.load4 && this.load5 && this.load6 == true && this.timeNumber <= 0) {
console.log("进入游戏_______________");
this.load1 = this.load2 = false; this.load1 = this.load2 = false;
MiniGameSdk.API.shushu_Login(); MiniGameSdk.API.shushu_Login();
MiniGameSdk.API.yinli_Init(); MiniGameSdk.API.yinli_Init();

View File

@ -101,16 +101,16 @@ export default class JiaZai extends cc.Component {
return; return;
} }
JiaZai.cachedRewardPrefab = prefab; JiaZai.cachedRewardPrefab = prefab;
let data = [ // let data = [
{ type: "coin", count: 125294 }, // { type: "coin", count: 125294 },
{ type: "coin", count: 7498 }, // { type: "coin", count: 7498 },
{ type: "freeze", count: 2 }, // { type: "freeze", count: 2 },
{ type: "hammer", count: 2 }, // { type: "hammer", count: 2 },
{ type: "magic", count: 2 }, // { type: "magic", count: 2 },
{ type: "infinite_health", count: 1800 * 4 }, // { type: "infinite_health", count: 1800 * 4 },
] // ]
this.openRewardWindow(data); // this.openRewardWindow(data);
this.getOrder(); this.getOrder();
}); });
}); });

View File

@ -665,12 +665,29 @@ export default class Utils {
if (uid != undefined && uid != "" && uid != null) { if (uid != undefined && uid != "" && uid != null) {
cc.fx.GameConfig.GM_INFO.uid = uid; cc.fx.GameConfig.GM_INFO.uid = uid;
} }
let setData = { let setData = null;
uid: cc.fx.GameConfig.GM_INFO.uid, if (propid == 0) {
action: 'save', setData = {
propType: propid, uid: cc.fx.GameConfig.GM_INFO.uid,
propData: amount, action: 'save',
propType: propid,
propData: {
freeze: cc.fx.GameConfig.GM_INFO.freezeAmount,
hammer: cc.fx.GameConfig.GM_INFO.hammerAmount,
magic_wand: cc.fx.GameConfig.GM_INFO.wandAmount,
},
}
} }
else {
setData = {
uid: cc.fx.GameConfig.GM_INFO.uid,
action: 'save',
propType: propid,
propData: amount,
}
}
console.log("上传道具类型", propid, "上传道具数量:", amount);
Utils.POST("userProp", setData, res => { Utils.POST("userProp", setData, res => {
console.log("获得userProp数据:", res); console.log("获得userProp数据:", res);
if (res.code === 1) { if (res.code === 1) {

View File

@ -1,4 +1,5 @@
import Freeze from "../../prop/Freeze";
import SceneManager from "../../SceneManager"; import SceneManager from "../../SceneManager";
import { MiniGameSdk } from "../../Sdk/MiniGameSdk"; import { MiniGameSdk } from "../../Sdk/MiniGameSdk";
import Utils from "../Pay/Utils"; import Utils from "../Pay/Utils";
@ -706,7 +707,6 @@ var GameTool = {
console.log("____________即将上传Shop_buy", buyData); console.log("____________即将上传Shop_buy", buyData);
cc.fx.GameTool.shushu_Track("shop_buy", buyData); cc.fx.GameTool.shushu_Track("shop_buy", buyData);
callback(); callback();
} }
}, },
@ -885,6 +885,7 @@ var GameTool = {
let coin = 0; let coin = 0;
let price = 0; let price = 0;
let getCoin = 0; let getCoin = 0;
switch (productId) { switch (productId) {
case "gold_1": case "gold_1":
cc.fx.GameTool.changeCoin(1200); cc.fx.GameTool.changeCoin(1200);
@ -922,6 +923,38 @@ var GameTool = {
price = 64800; price = 64800;
MiniGameSdk.API.showToast("充值成功获得240000金币"); MiniGameSdk.API.showToast("充值成功获得240000金币");
break; break;
case "unlimited_health_bundle_1":
cc.fx.GameTool.changeCoin(5000);
coin = 5000;
price = 1800;
MiniGameSdk.API.showToast("获得无限体力小组合包");
break;
case "unlimited_health_bundle_2":
cc.fx.GameTool.changeCoin(12000);
coin = 12000;
price = 6600;
let propData = {
"freeze": 2,
"hammer": 2,
"magic_wand": 2,
"price": price
}
this.getShopProp(propData, null);
MiniGameSdk.API.showToast("获得无限体力大组合包");
break;
case "unlimited_health_bundle_3":
cc.fx.GameTool.changeCoin(30000);
coin = 30000;
price = 10800;
let propData2 = {
"freeze": 6,
"hammer": 6,
"magic_wand": 6,
"price": price
}
this.getShopProp(propData2, null);
MiniGameSdk.API.showToast("获得无限体力超组合包");
break;
} }
const dataTemp = { const dataTemp = {
change_reason: "shop", change_reason: "shop",
@ -1103,7 +1136,68 @@ var GameTool = {
} }
} }
else return 1; else return 1;
} },
//购买行为,获得道具
getShopProp(propData, callback: Function) {
//@ts-ignore
if (typeof wx !== 'undefined' && wx !== null) {
const num = propData.freeze;
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;
cc.fx.GameTool.setUserProp(0, num, (data) => {
})
const data1 = {
change_reason: "shop",
id: 2001,
num: propData.freeze
}
cc.fx.GameTool.shushu_Track("resource_get", data1);
const data2 = {
change_reason: "shop",
id: 2002,
num: propData.hammer
}
cc.fx.GameTool.shushu_Track("resource_get", data2);
const data3 = {
change_reason: "shop",
id: 2003,
num: propData.magic_wand
}
cc.fx.GameTool.shushu_Track("resource_get", data3);
const buyData1 = {
item_id: "freeze_in_game",
item_num: propData.freeze,
item_price: propData.price,
cost_type: "cash"
}
cc.fx.GameTool.shushu_Track("shop_buy", buyData1);
const buyData2 = {
item_id: "hammer_in_game",
item_num: propData.hammer,
item_price: propData.price,
cost_type: "cash"
}
cc.fx.GameTool.shushu_Track("shop_buy", buyData2);
const buyData3 = {
item_id: "wand_in_game",
item_num: propData.magic_wand,
item_price: propData.price,
cost_type: "cash"
}
cc.fx.GameTool.shushu_Track("shop_buy", buyData3);
if (callback) {
callback();
}
}
},
}; };
export { GameTool }; export { GameTool };

View File

@ -335,6 +335,15 @@ export default class NewClass extends cc.Component {
case "gold_6": case "gold_6":
price = 64800; price = 64800;
break; break;
case "unlimited_health_bundle_1":
price = 1800;
break;
case "unlimited_health_bundle_2":
price = 6600;
break;
case "unlimited_health_bundle_3":
price = 10800;
break;
} }
//console.log("获得商品id:", id, count, price); //console.log("获得商品id:", id, count, price);
// 判断设备系统 // 判断设备系统
@ -367,6 +376,9 @@ export default class NewClass extends cc.Component {
}); });
} }
else { else {
console.log("上品ID", productId);
MiniGameSdk.API.showToast(productId);
cc.fx.GameTool.shopBuy(productId);
const data = { const data = {
outTradeNo: Utils.outTradeNo, outTradeNo: Utils.outTradeNo,
price: price, price: price,
@ -376,125 +388,128 @@ export default class NewClass extends cc.Component {
} }
cc.fx.GameTool.shushu_Track("init_order", data); cc.fx.GameTool.shushu_Track("init_order", data);
this.openLoad(); this.openLoad();
//console.log("7.14_____________________", "调用充值接口"); //console.log("7.14_____________________", "调用充值接口");
Utils.buyProp(id, count, price, (res) => { // Utils.buyProp(id, count, price, (res) => {
//console.log("获得充值结果", res); // //console.log("获得充值结果", res);
if (res == null) { // if (res == null) {
MiniGameSdk.API.showToast("充值失败"); // MiniGameSdk.API.showToast("充值失败");
this.btn_Touch = true; // this.btn_Touch = true;
const dataFail = { // const dataFail = {
outTradeNo: Utils.outTradeNo, // outTradeNo: Utils.outTradeNo,
price: price, // price: price,
payment_name: productId, // payment_name: productId,
payment_num: 1, // payment_num: 1,
type: systemType, // type: systemType,
fail_reason: "网络异常,没有拉起支付", // fail_reason: "网络异常,没有拉起支付",
} // }
cc.fx.GameTool.shushu_Track("payment_fail", dataFail); // cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
this.closeLoad(); // this.closeLoad();
return; // return;
} // }
else if (res.err) { // else if (res.err) {
MiniGameSdk.API.showToast("充值失败"); // MiniGameSdk.API.showToast("充值失败");
//console.log(res); // //console.log(res);
this.btn_Touch = true; // this.btn_Touch = true;
let name = "支付拉起失败"; // let name = "支付拉起失败";
if (res.errCode == -2) { // if (res.errCode == -2) {
name = "用户取消充值"; // name = "用户取消充值";
} // }
const dataFail = { // const dataFail = {
outTradeNo: Utils.outTradeNo, // outTradeNo: Utils.outTradeNo,
price: price, // price: price,
payment_name: productId, // payment_name: productId,
payment_num: 1, // payment_num: 1,
type: systemType, // type: systemType,
fail_reason: name, // fail_reason: name,
} // }
cc.fx.GameTool.shushu_Track("payment_fail", dataFail); // cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
this.closeLoad(); // this.closeLoad();
return; // return;
} // }
else { // else {
Utils.getPayInfo((data) => { // Utils.getPayInfo((data) => {
//console.log("7.14_______________充值成功,准备轮训"); // //console.log("7.14_______________充值成功,准备轮训");
//console.log("获得轮训结果:", data); // //console.log("获得轮训结果:", data);
this.closeLoad(); // this.closeLoad();
if (data.data.pay_state == 1) { // if (data.data.pay_state == 1) {
this.btn_Touch = true; // this.btn_Touch = true;
MiniGameSdk.API.showToast("取消充值"); // MiniGameSdk.API.showToast("取消充值");
const dataFail2 = { // const dataFail2 = {
outTradeNo: Utils.outTradeNo, // outTradeNo: Utils.outTradeNo,
price: price, // price: price,
payment_name: productId, // payment_name: productId,
payment_num: 1, // payment_num: 1,
type: systemType, // type: systemType,
fail_reason: "用户取消支付", // fail_reason: "用户取消支付",
} // }
cc.fx.GameTool.shushu_Track("payment_fail", dataFail2); // cc.fx.GameTool.shushu_Track("payment_fail", dataFail2);
} // }
else if (data.data.pay_state == 2) { // else if (data.data.pay_state == 2) {
this.btn_Touch = true; // this.btn_Touch = true;
const dataSuccess = { // const dataSuccess = {
outTradeNo: Utils.outTradeNo, // outTradeNo: Utils.outTradeNo,
price: price, // price: price,
payment_name: productId, // payment_name: productId,
payment_num: 1, // payment_num: 1,
type: systemType, // type: systemType,
} // }
cc.fx.GameTool.shushu_Track("payment", dataSuccess); // cc.fx.GameTool.shushu_Track("payment", dataSuccess);
let name = "购买金币道具:" + productId; // let name = "购买金币道具:" + productId;
MiniGameSdk.API.yinli_Pay(price, Utils.outTradeNo, name) // MiniGameSdk.API.yinli_Pay(price, Utils.outTradeNo, name)
//console.log("7.14_______________充值成功,轮训成功,准备发货"); // //console.log("7.14_______________充值成功,轮训成功,准备发货");
Utils.setPayInfo( // Utils.setPayInfo(
(res) => { // (res) => {
//console.log("设置轮训结果:", res); // //console.log("设置轮训结果:", res);
if (res.code === 1) { // if (res.code === 1) {
//console.log("7.14_________正式发货"); // //console.log("7.14_________正式发货");
MiniGameSdk.API.showToast("充值成功"); // MiniGameSdk.API.showToast("充值成功");
cc.fx.GameTool.shopBuy(productId); // cc.fx.GameTool.shopBuy(productId);
//console.log("充值成功获得金币"); // //console.log("充值成功获得金币");
} // }
else { // else {
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放"); // MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
const dataFail4 = { // const dataFail4 = {
outTradeNo: Utils.outTradeNo, // outTradeNo: Utils.outTradeNo,
price: price, // price: price,
payment_name: productId, // payment_name: productId,
payment_num: 1, // payment_num: 1,
type: systemType, // type: systemType,
fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货", // fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货",
} // }
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4); // cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
} // }
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); // NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
if (this.node.parent.getComponent("JiaZai")) // if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin(); // this.node.parent.getComponent("JiaZai").updateCoin();
else if (this.node.parent.getComponent("SceneManager")) { // else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").updateCoin(); // this.node.parent.getComponent("SceneManager").updateCoin();
} // }
}, null) // }, null)
} // }
else { // else {
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); // NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
const dataFail3 = { // const dataFail3 = {
outTradeNo: Utils.outTradeNo, // outTradeNo: Utils.outTradeNo,
price: price, // price: price,
payment_name: productId, // payment_name: productId,
payment_num: 1, // payment_num: 1,
type: systemType, // type: systemType,
fail_reason: "拉起支付后,付款时网络异常付款失败", // fail_reason: "拉起支付后,付款时网络异常付款失败",
} // }
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3); // cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
this.btn_Touch = true; // this.btn_Touch = true;
if (this.node.parent.getComponent("JiaZai")) // if (this.node.parent.getComponent("JiaZai"))
this.node.parent.getComponent("JiaZai").updateCoin(); // this.node.parent.getComponent("JiaZai").updateCoin();
else if (this.node.parent.getComponent("SceneManager")) { // else if (this.node.parent.getComponent("SceneManager")) {
this.node.parent.getComponent("SceneManager").updateCoin(); // this.node.parent.getComponent("SceneManager").updateCoin();
} // }
} // }
}) // })
} // }
}); // });
} }
} }

View File

@ -15,7 +15,7 @@
"mainCompressionType": "subpackage", "mainCompressionType": "subpackage",
"mainIsRemote": false, "mainIsRemote": false,
"optimizeHotUpdate": false, "optimizeHotUpdate": false,
"md5Cache": false, "md5Cache": true,
"nativeMd5Cache": true, "nativeMd5Cache": true,
"encryptJs": true, "encryptJs": true,
"xxteaKey": "07ac496c-82b0-4f", "xxteaKey": "07ac496c-82b0-4f",