This commit is contained in:
YZ\249929363 2025-07-10 18:03:09 +08:00
parent 1431ea689a
commit b617219f5b
7 changed files with 2828 additions and 2518 deletions

File diff suppressed because it is too large Load Diff

View File

@ -259,7 +259,7 @@ export default class GameManager extends cc.Component {
//新用户,有本地缓存读取配置 //新用户,有本地缓存读取配置
newReadData() { newReadData() {
console.log("读取新信息"); console.log("读取新信息2");
let openid = cc.fx.StorageMessage.getStorage("openid"); let openid = cc.fx.StorageMessage.getStorage("openid");
if (openid == null || openid == "" || openid == undefined) { if (openid == null || openid == "" || openid == undefined) {
console.log("没有openid"); console.log("没有openid");
@ -270,7 +270,7 @@ export default class GameManager extends cc.Component {
action: 'read' action: 'read'
}, },
success: res => { success: res => {
console.log('读取用户数据成功', res.result) console.log('读取用户数据成功_____________________', res.result)
if (res.result.code == 404 && res.result.message == "未找到用户数据") { if (res.result.code == 404 && res.result.message == "未找到用户数据") {
} }
else if (res.result.code == 200) { else if (res.result.code == 200) {
@ -687,7 +687,7 @@ export default class GameManager extends cc.Component {
MiniGameSdk.API.shushu_Login(); MiniGameSdk.API.shushu_Login();
MiniGameSdk.API.yinli_Init(); MiniGameSdk.API.yinli_Init();
MiniGameSdk.API.yinli_Login(); MiniGameSdk.API.yinli_Login();
cc.fx.GameTool.setWechatGameGroup(2); const group = cc.fx.GameTool.setWechatGameGroup(2);
this.startGame(); this.startGame();
} }
} }

View File

@ -1509,8 +1509,15 @@ export default class MapConroler extends cc.Component {
cc.fx.GameTool.changeCoin(data.coin); cc.fx.GameTool.changeCoin(data.coin);
MiniGameSdk.API.showToast("继续游戏"); MiniGameSdk.API.showToast("继续游戏");
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 (data.type == "time") {
if (cc.fx.GameConfig.GM_INFO.review < 2) if (cc.fx.GameConfig.GM_INFO.review < 2)
cc.fx.GameConfig.GM_INFO.review += 1; cc.fx.GameConfig.GM_INFO.review += 1;
}
else if (data.type == "boom") {
if (cc.fx.GameConfig.GM_INFO.reviewBoom < 2)
cc.fx.GameConfig.GM_INFO.reviewBoom += 1;
}
this.gameOver = false; this.gameOver = false;
this.gameWin = false; this.gameWin = false;
@ -1793,7 +1800,7 @@ export default class MapConroler extends cc.Component {
this.setPropNum(); this.setPropNum();
// this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString(); // this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString();
MiniGameSdk.API.showToast("购买冻结时间成功"); MiniGameSdk.API.showToast("购买冻结时间成功");
}, 2000); }, 200);
} }
@ -1808,7 +1815,7 @@ export default class MapConroler extends cc.Component {
MiniGameSdk.API.showToast("购买魔法棒成功"); MiniGameSdk.API.showToast("购买魔法棒成功");
this.setPropNum(); this.setPropNum();
// this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString(); // this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString();
}, 2000); }, 200);
} }
else if (data == "hammerAmount") { else if (data == "hammerAmount") {
@ -1822,7 +1829,7 @@ export default class MapConroler extends cc.Component {
this.setPropNum(); this.setPropNum();
// this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString(); // this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString();
MiniGameSdk.API.showToast("购买锤子成功"); MiniGameSdk.API.showToast("购买锤子成功");
}, 2000); }, 200);
} }
@ -1840,15 +1847,6 @@ export default class MapConroler extends cc.Component {
if (hammerBtn.getComponent("btnControl")._touch) { if (hammerBtn.getComponent("btnControl")._touch) {
hammerBtn.getComponent("btnControl").setTouch(false); hammerBtn.getComponent("btnControl").setTouch(false);
if (cc.fx.GameConfig.GM_INFO.hammerAmount < 1) { if (cc.fx.GameConfig.GM_INFO.hammerAmount < 1) {
// if (cc.fx.GameConfig.GM_INFO.coin < 1500) {
// MiniGameSdk.API.showToast("金币不足,无法购买道具");
// setTimeout(() => {
// this.openShop();
// hammerBtn.getComponent("btnControl").setTouch(true);
// }, 500);
// return;
// }
this.node.parent.parent.getChildByName("propWindow").active = true; this.node.parent.parent.getChildByName("propWindow").active = true;
this.node.parent.parent.parent.getComponent("SceneManager").openPropBuy("hammer"); this.node.parent.parent.parent.getComponent("SceneManager").openPropBuy("hammer");
} }

View File

@ -1170,6 +1170,14 @@ export namespace MiniGameSdk {
} }
} }
static updateCoinAndLevel() {
if (typeof wx !== 'undefined' && wx !== null) {
console.log("上传金币和关卡信息给数数")
API._ta.userSet({ current_level: cc.fx.GameConfig.GM_INFO.level });
API._ta.userSet({ current_coin: cc.fx.GameConfig.GM_INFO.coin });
}
}
/* /*
* *
*/ */
@ -1193,6 +1201,7 @@ export namespace MiniGameSdk {
}; };
} }
API._ta.setSuperProperties(superProperties);//设置公共事件属性 API._ta.setSuperProperties(superProperties);//设置公共事件属性
API.updateCoinAndLevel();
} }
} }

View File

@ -101,10 +101,8 @@ export class GameConfig {
//游戏内信息 //游戏内信息
static get Instance() static get Instance() {
{ if (this._instance == null) {
if (this._instance == null)
{
this._instance = new GameConfig(); this._instance = new GameConfig();
} }
return this._instance; return this._instance;
@ -210,7 +208,7 @@ export class GameConfig {
useravatar: "", //用户头像地址 useravatar: "", //用户头像地址
guide: true, //是否有引导 guide: true, //是否有引导
url: "https://api.sparkus.cn",//访问域名 url: "https://api.sparkus.cn",//访问域名
coin: 10000, //用户金币 coin: 0, //用户金币
success: false, //用户游戏成功与否 success: false, //用户游戏成功与否
matchId: null, //用于埋点上传的ID matchId: null, //用于埋点上传的ID
gameState: false, gameState: false,

View File

@ -1034,9 +1034,10 @@ var GameTool = {
} }
console.log("type____________________:", type); console.log("type____________________:", type);
console.log("分组编号____________________:", groupNumber); console.log("分组编号____________________:", groupNumber);
return groupNumber;
} }
} }
else return 1;
} }
}; };

View File

@ -70,6 +70,7 @@ export default class Boom extends cc.Component {
// 触发父节点 Block 的 touchEnd 事件 // 触发父节点 Block 的 touchEnd 事件
this.node.parent.getComponent("Block").touchEnd(mockTouchEvent); this.node.parent.getComponent("Block").touchEnd(mockTouchEvent);
this.unschedule(this.updateTime); this.unschedule(this.updateTime);
this.node.getChildByName("time").active = false;
MapConroler._instance.failLevel("boom"); MapConroler._instance.failLevel("boom");
this.node.getChildByName("zhandan").active = true; this.node.getChildByName("zhandan").active = true;
this.node.getChildByName("bg").active = false; this.node.getChildByName("bg").active = false;