微信通知消息
This commit is contained in:
parent
865215f65a
commit
a2614fea9a
|
|
@ -828,13 +828,13 @@ export default class JiaZai extends cc.Component {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
startGame() {
|
||||
cc.fx.AudioManager._instance.playEffect("anniu_Big", null);
|
||||
let version = cc.fx.GameTool.getWechatGameVersion();
|
||||
if (cc.fx.GameTool.maxLevel()) {
|
||||
if (version != "开发版" && version != "体验版") {
|
||||
MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
// MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
cc.fx.GameTool.requestSubscribe();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -864,7 +864,8 @@ export default class JiaZai extends cc.Component {
|
|||
cc.fx.GameConfig.GM_INFO.level = parseInt(this.custom.string) - 1;
|
||||
// cc.fx.StorageMessage.setStorage("level",cc.fx.GameConfig.GM_INFO.level.toString());
|
||||
if (cc.fx.GameTool.maxLevel()) {
|
||||
MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
// MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
cc.fx.GameTool.requestSubscribe();
|
||||
return;
|
||||
}
|
||||
cc.fx.GameConfig.LEVEL_INFO_init(true, 0, false);
|
||||
|
|
@ -874,7 +875,8 @@ export default class JiaZai extends cc.Component {
|
|||
this.node.getChildByName("zhuanchang").active = true;
|
||||
this.node.getChildByName("zhuanchang").getComponent(sp.Skeleton).setAnimation(1, "up", false);
|
||||
if (cc.fx.GameTool.maxLevel()) {
|
||||
MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
// MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
cc.fx.GameTool.requestSubscribe();
|
||||
return;
|
||||
}
|
||||
cc.fx.GameConfig.LEVEL_INFO_init(true, 1000, false);
|
||||
|
|
@ -882,7 +884,8 @@ export default class JiaZai extends cc.Component {
|
|||
}
|
||||
else if (version == "正式版") {
|
||||
if (cc.fx.GameTool.maxLevel()) {
|
||||
MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
// MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
cc.fx.GameTool.requestSubscribe();
|
||||
return;
|
||||
}
|
||||
cc.fx.AudioManager._instance.playEffect("zhuan1", null);
|
||||
|
|
@ -896,7 +899,8 @@ export default class JiaZai extends cc.Component {
|
|||
cc.fx.GameConfig.GM_INFO.level = parseInt(this.custom.string) - 1;
|
||||
// cc.fx.StorageMessage.setStorage("level",cc.fx.GameConfig.GM_INFO.level.toString());
|
||||
if (cc.fx.GameTool.maxLevel()) {
|
||||
MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
// MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
cc.fx.GameTool.requestSubscribe();
|
||||
return;
|
||||
}
|
||||
cc.fx.GameConfig.LEVEL_INFO_init(true, 0, false);
|
||||
|
|
@ -906,7 +910,8 @@ export default class JiaZai extends cc.Component {
|
|||
this.node.getChildByName("zhuanchang").active = true;
|
||||
this.node.getChildByName("zhuanchang").getComponent(sp.Skeleton).setAnimation(1, "up", false);
|
||||
if (cc.fx.GameTool.maxLevel()) {
|
||||
MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
// MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
cc.fx.GameTool.requestSubscribe();
|
||||
return;
|
||||
}
|
||||
cc.fx.GameConfig.LEVEL_INFO_init(true, 1000, false);
|
||||
|
|
|
|||
|
|
@ -2138,7 +2138,8 @@ export default class MapConroler extends cc.Component {
|
|||
|
||||
}
|
||||
if (cc.fx.GameTool.maxLevel()) {
|
||||
MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
// MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
cc.fx.GameTool.requestSubscribe();
|
||||
return;
|
||||
}
|
||||
cc.fx.AudioManager._instance.playEffect("zhuan1", null);
|
||||
|
|
|
|||
|
|
@ -352,7 +352,8 @@ export class GameConfig {
|
|||
|
||||
|
||||
if (cc.fx.GameTool.maxLevel() && otherLevel == false) {
|
||||
MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
// MiniGameSdk.API.showToast("关卡每周更新,敬请期待!");
|
||||
cc.fx.GameTool.requestSubscribe();
|
||||
return;
|
||||
}
|
||||
let name = "Json/level" + (cc.fx.GameConfig.GM_INFO.level + 1);
|
||||
|
|
|
|||
|
|
@ -1756,6 +1756,22 @@ var GameTool = {
|
|||
node.children.forEach(child => this.setGray(child, gray));
|
||||
},
|
||||
|
||||
|
||||
requestSubscribe() {
|
||||
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
||||
if (typeof wx === 'undefined') return;
|
||||
wx.requestSubscribeMessage({
|
||||
tmplIds: ['BIsiZH6pcs4T9FLp0IAZ8d07zS0ELi7vX5RX8P38gN0'],
|
||||
success: (res) => {
|
||||
if (res['BIsiZH6pcs4T9FLp0IAZ8d07zS0ELi7vX5RX8P38gN0'] === 'accept') {
|
||||
cc.log('订阅成功');
|
||||
// 可以在这里调用你的服务端接口,记录用户订阅
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
cc.error('订阅失败:', err);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
export { GameTool };
|
||||
Loading…
Reference in New Issue
Block a user