This commit is contained in:
YZ\249929363 2025-07-07 15:13:59 +08:00
parent 7f70727e06
commit 6b3a3d25c4
11 changed files with 559 additions and 696 deletions

View File

@ -75,7 +75,7 @@ export default class Block extends cc.Component {
init(block_Info, posX, posY, node) {
this.block_Info = this.jsonDeepClone(block_Info);
let mapInfo = MapConroler._instance.mapInfo;
console.log("block_Info", this.block_Info);
//console.log("block_Info", this.block_Info);
for (let i = 0; i < mapInfo.length; i++) {
let blockRect = mapInfo[i].getBoundingBox();
// 使用 cc.Intersection.pointInRect 方法判断点是否在矩形范围内

View File

@ -475,8 +475,13 @@ export default class GameManager extends cc.Component {
console.log('读取用户数据成功', res.result)
if (res.result.code == 404 && res.result.message == "未找到用户数据") {
if (res.result.openid) {
console.log("用户从未进入过第一次设置openid:");
console.log(res.result.openid);
cc.fx.GameConfig.GM_INFO.openid = res.result.openid
}
else{
console.log("用户此一次进入游戏为正确获取openid");
}
cc.fx.GameConfig.GM_INFO.first = true;
this.load3 = true;
this.load4 = true;

View File

@ -84,7 +84,6 @@ export default class NewClass extends cc.Component {
cc.fx.GameConfig.GM_INFO.successList = [];
cc.fx.GameConfig.GM_INFO.fen = 0;
cc.fx.GameConfig.GM_INFO.score = 0;
cc.fx.GameConfig.GM_INFO.min_Steps = 0;
cc.fx.GameConfig.GM_INFO.min_Time = 0;
cc.fx.GameConfig.TIME_INFO.totalTime = 120;
cc.director.loadScene("GameScene");

View File

@ -323,7 +323,7 @@ export default class MapConroler extends cc.Component {
blockInit() {
let blockArray = cc.fx.GameConfig.BLOCK_INFO[0];
blockArray = this.sortBlock(blockArray);
console.log("创建方块", blockArray);
//console.log("创建方块", blockArray);
let index = 0; // 当前要创建的方块索引
let BLOCKS_PER_FRAME = 1; // 初始每帧创建的方块数量
const MAX_PER_FRAME = 10; // 每帧最大创建数量
@ -1323,8 +1323,10 @@ export default class MapConroler extends cc.Component {
this.gameWin = true;
this.stopTimeCutDown();
// console.log("成功消除一个");
// console.log("即将上报成功________________________:",this.add_Time);
// console.log("成功消除一个",this.add_Time);
cc.fx.GameTool.changeCoin(40);
cc.fx.GameTool.addLevel(this.count_Time, this.add_Time);
const winCOIN = cc.find("Canvas"); // 假设 Canvas 节点
if (winCOIN) {
@ -1485,9 +1487,14 @@ export default class MapConroler extends cc.Component {
cc.fx.GameConfig.GM_INFO.review += 1;
this.gameOver = false;
this.gameWin = false;
this.timeNumber = 21;
this.add_Time += 20;
this.pause = false;
this.blockNum = this.blocks.length;
if (this.blockNum == 0 )this.nextLevel();
this.node.parent.parent.getChildByName("Lose").active = false;
setTimeout(() => {
this.reviewState = false;

View File

@ -1134,6 +1134,7 @@ export namespace MiniGameSdk {
static shushu_Login() {
if (typeof wx !== 'undefined' && wx !== null) {
console.log("数数登录时获取到的openId:",cc.fx.GameConfig.GM_INFO.openid);
API._ta.login(cc.fx.GameConfig.GM_INFO.openid);
const result = "success";
API.shushu_Track("login", result);

View File

@ -81,7 +81,7 @@ export class GameConfig {
first: boolean; //是否首次进入游戏
score: number; //总得分
scale: number; //玩家总计成功点火数
min_Steps: number; //每次上一把最小步数
iosOutTradeNo: number; //每次上一把最小步数
min_Time: number; //体力恢复的剩余时间
freezeAmount: number; //冻结道具次数
hammerAmount: number; //锤子道具次数
@ -200,7 +200,7 @@ export class GameConfig {
useravatar:"", //用户头像地址
guide: true, //是否有引导
url: "https://api.sparkus.cn",//访问域名
coin: 10000, //用户金币
coin: 0, //用户金币
success: false, //用户游戏成功与否
matchId: null, //用于埋点上传的ID
gameState:false,
@ -212,7 +212,7 @@ export class GameConfig {
first:false, //是否首次进入游戏
score:0, //总得分
scale: 1, //玩家总计成功点火数
min_Steps:0, //每次上一把最小步数
iosOutTradeNo:0, //ios订单号
min_Time:0, //体力恢复的剩余时间
freezeAmount:0, //冻结道具次数
hammerAmount:0, //锤子道具次数
@ -257,7 +257,7 @@ export class GameConfig {
// cc.fx.StorageMessage.setStorage("level",cc.fx.GameConfig.GM_INFO.level.toString());
cc.resources.load(name, (err: any, res: cc.JsonAsset) => {
if (err) {
cc.fx.GameTool.addLevel();
cc.fx.GameTool.addLevel(null,null);
self.LEVEL_INFO_init(type,time);
return;
}

View File

@ -5,7 +5,7 @@ export default class Utils {
static openid:string="";
static outTradeNo:string ="";
static httpip:string=`https://laf.nika4games.com/`;
//#region 支付
//#region 安卓支付
/**获取用户信息*/
static getUserInfo(callBack){
wx.login({
@ -110,21 +110,47 @@ export default class Utils {
sendRequest();
}
//#region ios支付
/**跳转客服*/
static GoKEFu(){
// 打开客服会话
//wx.navigateTo({ url: '/pages/webview?url=https://xxx.com/customer' });
cc.fx.GameConfig.GM_INFO.iosOutTradeNo = null;
cc.fx.GameConfig.GM_INFO.iosOutTradeNo = `wcx_` + Math.round(Math.random() * 10 ** 13) + Date.now();
const data={
tpye:"ios",
outTradeNo:cc.fx.GameConfig.GM_INFO.iosOutTradeNo,
propName:'金币',
count:1,
price:100,//价格单位是分
}
//@ts-ignore
wx.openCustomerServiceConversation({
sessionFrom: '你好这是充值中心', // 会话来源(可选)
showMessageCard: true, // 是否展示消息卡片
sendMessageTitle:"扫描二维码进行充值",
sendMessageImg:"https://img2.huashi6.com/images/resource/thumbnail/2023/07/23/193722_24254930385.jpg?imageMogr2/quality/100/interlace/1/thumbnail/2000x%3E",
sessionFrom: JSON.stringify(data), // 会话来源(可选)
showMessageCard: false, // 是否展示消息卡片
success() {
console.log('客服会话已打开');
}
});
}
static getIosPayInfo(callBack){
console.log("请求uid:"+Utils.uid);
console.log("outTradeNo:"+this.outTradeNo);
Utils.POST("wx/iosgetPayInfo",{outTradeNo:Utils.outTradeNo},res=>{
console.log("查询字符结果");
console.log(res);
if(res.code==1){
if(res.data){
callBack("充值取消");
cc.fx.GameConfig.GM_INFO.iosOutTradeNo = null;
}else{
callBack("充值成功");
cc.fx.GameConfig.GM_INFO.iosOutTradeNo = null;
}
}
});
}

View File

@ -344,9 +344,10 @@ var GameTool = {
level:cc.fx.GameConfig.GM_INFO.level,
timestamp:timestamp,
}
// console.log("55555存储关卡数据:",levelInfo);
console.log("55555存储关卡数据:",time1,time2);
cc.fx.StorageMessage.setStorage("level",levelInfo);
if(time1 && time2){
if(time1!=null && time2!=null){
let data = {
time:time1,
add_Time:time2,
@ -955,6 +956,11 @@ var GameTool = {
}
break;
}
if(name == "finish_stage"){
console.log("准备上报完成");
console.log(eventData);
// MiniGameSdk.API.showToast("准备上报完成游戏");
}
// MiniGameSdk.API.shushu_Track(name,eventData);
MiniGameSdk.API.shushu_Track(name, eventData);
},

View File

@ -39,7 +39,7 @@
"type": 0,
"position": {
"x": 240,
"y": 120,
"y": 0,
"z": 0
},
"id": 210
@ -50,7 +50,7 @@
"type": 0,
"position": {
"x": 240,
"y": 240,
"y": 120,
"z": 0
},
"id": 220
@ -61,7 +61,7 @@
"type": 0,
"position": {
"x": 240,
"y": 360,
"y": 240,
"z": 0
},
"id": 230
@ -72,7 +72,7 @@
"type": 0,
"position": {
"x": 240,
"y": 0,
"y": 360,
"z": 0
},
"id": 240
@ -256,73 +256,16 @@
"id": 400
},
{
"block": 20,
"color": 1,
"type": 9,
"block": 4,
"color": 3,
"type": 0,
"position": {
"x": -240,
"y": 0,
"x": 360,
"y": 120,
"z": 0
},
"adhesiveTime": 2,
"id": 410
},
{
"block": 0,
"color": 2,
"type": 9,
"position": {
"x": -360,
"y": 240,
"z": 0
},
"adhesiveTime": 1,
"id": 420
},
{
"block": 22,
"color": 2,
"type": 0,
"position": {
"x": 480,
"y": -240,
"z": 0
},
"id": 430
},
{
"block": 0,
"color": 8,
"type": 0,
"position": {
"x": 0,
"y": 240,
"z": 0
},
"id": 440
},
{
"block": 0,
"color": 8,
"type": 0,
"position": {
"x": -120,
"y": 0,
"z": 0
},
"id": 450
},
{
"block": 0,
"color": 8,
"type": 0,
"position": {
"x": 0,
"y": -360,
"z": 0
},
"id": 460
},
{
"block": 2,
"color": 8,
@ -332,44 +275,101 @@
"y": 360,
"z": 0
},
"id": 470
"id": 420
},
{
"block": 0,
"color": 6,
"color": 8,
"type": 0,
"position": {
"x": 0,
"y": -360,
"z": 0
},
"id": 430
},
{
"block": 0,
"color": 8,
"type": 0,
"position": {
"x": -120,
"y": 0,
"z": 0
},
"id": 440
},
{
"block": 0,
"color": 8,
"type": 0,
"position": {
"x": 0,
"y": 240,
"z": 0
},
"id": 450
},
{
"block": 20,
"color": 1,
"type": 9,
"position": {
"x": -240,
"y": 0,
"z": 0
},
"adhesiveTime": 2,
"id": 460
},
{
"block": 0,
"color": 9,
"type": 9,
"position": {
"x": -360,
"y": -600,
"y": 240,
"z": 0
},
"adhesiveTime": 1,
"id": 470
},
{
"block": 5,
"color": 9,
"type": 0,
"position": {
"x": -240,
"y": -480,
"z": 0
},
"id": 480
},
{
"block": 4,
"color": 6,
"type": 8,
"block": 22,
"color": 9,
"type": 0,
"position": {
"x": 0,
"y": -120,
"x": 480,
"y": -240,
"z": 0
},
"id": 490
},
{
"block": 4,
"color": 1,
"type": 8,
"block": 0,
"color": 9,
"type": 0,
"position": {
"x": 120,
"y": -120,
"y": -600,
"z": 0
},
"id": 500
},
{
"block": 2,
"color": 9,
"color": 2,
"type": 0,
"position": {
"x": 0,
@ -380,7 +380,7 @@
},
{
"block": 0,
"color": 9,
"color": 2,
"type": 0,
"position": {
"x": 360,
@ -390,34 +390,34 @@
"id": 520
},
{
"block": 5,
"color": 2,
"block": 0,
"color": 6,
"type": 0,
"position": {
"x": -240,
"y": -480,
"x": -360,
"y": -600,
"z": 0
},
"id": 530
},
{
"block": 0,
"color": 2,
"type": 0,
"block": 4,
"color": 6,
"type": 8,
"position": {
"x": 120,
"y": -600,
"x": 0,
"y": -120,
"z": 0
},
"id": 540
},
{
"block": 4,
"color": 3,
"type": 0,
"color": 1,
"type": 8,
"position": {
"x": 360,
"y": 120,
"x": 120,
"y": -120,
"z": 0
},
"id": 550
@ -428,94 +428,115 @@
[
{
"id": 1,
"num": 36,
"color": 4,
"special": 0,
"length": 2
},
{
"id": 2,
"num": 37,
"color": 4,
"special": 0,
"length": 0
},
{
"id": 3,
"num": 4,
"color": 5,
"special": 0,
"length": 3
},
{
"id": 4,
"num": 5,
"color": 5,
"special": 0,
"length": 0
},
{
"id": 5,
"num": 6,
"color": 5,
"special": 0,
"length": 0
},
{
"id": 6,
"num": 25,
"color": 8,
"special": 0,
"length": 1
},
{
"id": 7,
"num": 18,
"color": 6,
"special": 0,
"length": 1
},
{
"id": 8,
"num": 0,
"id": 2,
"num": 11,
"color": 9,
"special": 0,
"length": 2
},
{
"id": 9,
"num": 1,
"id": 3,
"num": 14,
"color": 9,
"special": 0,
"length": 0
},
{
"id": 10,
"id": 4,
"num": 0,
"color": 2,
"special": 0,
"length": 2
},
{
"id": 5,
"num": 1,
"color": 2,
"special": 0,
"length": 0
},
{
"id": 6,
"num": 4,
"color": 5,
"special": 0,
"length": 3
},
{
"id": 7,
"num": 5,
"color": 5,
"special": 0,
"length": 0
},
{
"id": 8,
"num": 6,
"color": 5,
"special": 0,
"length": 0
},
{
"id": 9,
"num": 19,
"color": 1,
"special": 0,
"length": 2
},
{
"id": 11,
"id": 10,
"num": 21,
"color": 1,
"special": 0,
"length": 0
},
{
"id": 12,
"num": 11,
"color": 2,
"id": 11,
"num": 36,
"color": 4,
"special": 0,
"length": 2
},
{
"id": 13,
"num": 14,
"color": 2,
"id": 12,
"num": 37,
"color": 4,
"special": 0,
"length": 0
},
{
"id": 13,
"num": 33,
"color": 3,
"special": 0,
"length": 3
},
{
"id": 14,
"num": 34,
"color": 3,
"special": 0,
"length": 0
},
{
"id": 15,
"num": 35,
"color": 3,
"special": 0,
"length": 0
},
{
"id": 16,
"num": 18,
"color": 6,
"special": 0,
"length": 1
}
]
]

View File

@ -14,80 +14,14 @@
[
{
"block": 2,
"color": 6,
"type": 0,
"position": {
"x": 120,
"y": -480,
"z": 0
},
"id": 210
},
{
"block": 20,
"color": 2,
"color": 5,
"type": 0,
"position": {
"x": 0,
"y": -360,
"y": 240,
"z": 0
},
"id": 220
},
{
"block": 2,
"color": 4,
"type": 0,
"position": {
"x": -240,
"y": -360,
"z": 0
},
"id": 230
},
{
"block": 20,
"color": 7,
"type": 0,
"position": {
"x": -120,
"y": -120,
"z": 0
},
"id": 240
},
{
"block": 2,
"color": 8,
"type": 0,
"position": {
"x": 360,
"y": 120,
"z": 0
},
"id": 250
},
{
"block": 19,
"color": 8,
"type": 0,
"position": {
"x": 360,
"y": -120,
"z": 0
},
"id": 260
},
{
"block": 0,
"color": 7,
"type": 0,
"position": {
"x": 360,
"y": -240,
"z": 0
},
"id": 270
"id": 210
},
{
"block": 22,
@ -98,8 +32,85 @@
"y": 120,
"z": 0
},
"id": 220
},
{
"block": 2,
"color": 8,
"type": 0,
"position": {
"x": 360,
"y": 120,
"z": 0
},
"id": 230
},
{
"block": 19,
"color": 8,
"type": 0,
"position": {
"x": 360,
"y": -120,
"z": 0
},
"id": 240
},
{
"block": 20,
"color": 7,
"type": 0,
"position": {
"x": -120,
"y": -120,
"z": 0
},
"id": 250
},
{
"block": 0,
"color": 7,
"type": 0,
"position": {
"x": 360,
"y": -240,
"z": 0
},
"id": 260
},
{
"block": 20,
"color": 2,
"type": 0,
"position": {
"x": 0,
"y": -360,
"z": 0
},
"id": 270
},
{
"block": 2,
"color": 4,
"type": 0,
"position": {
"x": -240,
"y": -360,
"z": 0
},
"id": 280
},
{
"block": 2,
"color": 6,
"type": 0,
"position": {
"x": 120,
"y": -480,
"z": 0
},
"id": 290
},
{
"block": 1,
"color": 9,
@ -109,41 +120,19 @@
"y": 120,
"z": 0
},
"id": 290
},
{
"block": 0,
"color": 10,
"type": 0,
"position": {
"x": -120,
"y": 0,
"z": 0
},
"id": 300
},
{
"block": 1,
"color": 9,
"block": 0,
"color": 3,
"type": 2,
"position": {
"x": 240,
"y": -240,
"x": 120,
"y": 360,
"z": 0
},
"id": 310
},
{
"block": 0,
"color": 6,
"type": 2,
"position": {
"x": 240,
"y": 0,
"z": 0
},
"id": 320
},
{
"block": 0,
"color": 4,
@ -153,15 +142,26 @@
"y": 120,
"z": 0
},
"id": 330
"id": 320
},
{
"block": 0,
"color": 3,
"color": 6,
"type": 2,
"position": {
"x": 120,
"y": 360,
"x": 240,
"y": 0,
"z": 0
},
"id": 330
},
{
"block": 1,
"color": 9,
"type": 2,
"position": {
"x": 240,
"y": -240,
"z": 0
},
"id": 340
@ -178,12 +178,12 @@
"id": 350
},
{
"block": 2,
"color": 5,
"block": 0,
"color": 10,
"type": 0,
"position": {
"x": 0,
"y": 240,
"x": -120,
"y": 0,
"z": 0
},
"id": 360
@ -230,104 +230,6 @@
[
{
"id": 1,
"num": 15,
"color": 7,
"special": 0,
"length": 2
},
{
"id": 2,
"num": 17,
"color": 7,
"special": 0,
"length": 0
},
{
"id": 3,
"num": 10,
"color": 5,
"special": 0,
"length": 2
},
{
"id": 4,
"num": 12,
"color": 5,
"special": 0,
"length": 0
},
{
"id": 5,
"num": 0,
"color": 9,
"special": 0,
"length": 2
},
{
"id": 6,
"num": 1,
"color": 9,
"special": 0,
"length": 0
},
{
"id": 7,
"num": 2,
"color": 3,
"special": 2,
"length": 2,
"lock": false
},
{
"id": 8,
"num": 3,
"color": 3,
"special": 2,
"length": 0,
"lock": false
},
{
"id": 9,
"num": 22,
"color": 1,
"special": 2,
"length": 2,
"lock": true
},
{
"id": 10,
"num": 23,
"color": 1,
"special": 2,
"length": 0,
"lock": true
},
{
"id": 11,
"num": 25,
"color": 4,
"special": 2,
"length": 3,
"lock": false
},
{
"id": 12,
"num": 26,
"color": 4,
"special": 2,
"length": 0,
"lock": false
},
{
"id": 13,
"num": 27,
"color": 4,
"special": 2,
"length": 0,
"lock": false
},
{
"id": 14,
"num": 14,
"color": 8,
"special": 2,
@ -335,7 +237,7 @@
"lock": true
},
{
"id": 15,
"id": 2,
"num": 16,
"color": 8,
"special": 2,
@ -343,40 +245,138 @@
"lock": true
},
{
"id": 16,
"num": 20,
"color": 2,
"special": 0,
"length": 2
"id": 3,
"num": 22,
"color": 1,
"special": 2,
"length": 2,
"lock": false
},
{
"id": 17,
"num": 21,
"color": 2,
"special": 0,
"length": 0
"id": 4,
"num": 23,
"color": 1,
"special": 2,
"length": 0,
"lock": false
},
{
"id": 18,
"id": 5,
"num": 2,
"color": 3,
"special": 2,
"length": 2,
"lock": false
},
{
"id": 6,
"num": 3,
"color": 3,
"special": 2,
"length": 0,
"lock": false
},
{
"id": 7,
"num": 5,
"color": 10,
"special": 0,
"length": 3
},
{
"id": 19,
"id": 8,
"num": 6,
"color": 10,
"special": 0,
"length": 0
},
{
"id": 20,
"id": 9,
"num": 7,
"color": 10,
"special": 0,
"length": 0
},
{
"id": 10,
"num": 15,
"color": 7,
"special": 0,
"length": 2
},
{
"id": 11,
"num": 17,
"color": 7,
"special": 0,
"length": 0
},
{
"id": 12,
"num": 0,
"color": 9,
"special": 0,
"length": 2
},
{
"id": 13,
"num": 1,
"color": 9,
"special": 0,
"length": 0
},
{
"id": 14,
"num": 20,
"color": 2,
"special": 0,
"length": 2
},
{
"id": 15,
"num": 21,
"color": 2,
"special": 0,
"length": 0
},
{
"id": 16,
"num": 10,
"color": 5,
"special": 0,
"length": 2
},
{
"id": 17,
"num": 12,
"color": 5,
"special": 0,
"length": 0
},
{
"id": 18,
"num": 25,
"color": 4,
"special": 2,
"length": 3,
"lock": true
},
{
"id": 19,
"num": 26,
"color": 4,
"special": 2,
"length": 0,
"lock": true
},
{
"id": 20,
"num": 27,
"color": 4,
"special": 2,
"length": 0,
"lock": true
},
{
"id": 21,
"num": 11,
@ -392,238 +392,6 @@
"special": 2,
"length": 0,
"lock": true
},
{
"id": 23,
"num": 25,
"color": 1,
"special": 2,
"length": 3,
"lock": true
},
{
"id": 24,
"num": 26,
"color": 1,
"special": 2,
"length": 0,
"lock": true
},
{
"id": 25,
"num": 27,
"color": 1,
"special": 2,
"length": 0,
"lock": true
},
{
"id": 26,
"num": 25,
"color": 4,
"special": 2,
"length": 3,
"lock": true
},
{
"id": 27,
"num": 26,
"color": 4,
"special": 2,
"length": 0,
"lock": true
},
{
"id": 28,
"num": 27,
"color": 4,
"special": 2,
"length": 0,
"lock": true
},
{
"id": 29,
"num": 25,
"color": 5,
"special": 2,
"length": 3,
"lock": true
},
{
"id": 30,
"num": 26,
"color": 5,
"special": 2,
"length": 0,
"lock": true
},
{
"id": 31,
"num": 27,
"color": 5,
"special": 2,
"length": 0,
"lock": true
},
{
"id": 32,
"num": 25,
"color": 4,
"special": 2,
"length": 3,
"lock": true
},
{
"id": 33,
"num": 26,
"color": 4,
"special": 2,
"length": 0,
"lock": true
},
{
"id": 34,
"num": 27,
"color": 4,
"special": 2,
"length": 0,
"lock": true
},
{
"id": 35,
"num": 25,
"color": 5,
"special": 0,
"length": 3
},
{
"id": 36,
"num": 26,
"color": 5,
"special": 0,
"length": 0
},
{
"id": 37,
"num": 27,
"color": 5,
"special": 0,
"length": 0
},
{
"id": 38,
"num": 25,
"color": 4,
"special": 2,
"length": 3,
"lock": false
},
{
"id": 39,
"num": 26,
"color": 4,
"special": 2,
"length": 0,
"lock": false
},
{
"id": 40,
"num": 27,
"color": 4,
"special": 2,
"length": 0,
"lock": false
},
{
"id": 41,
"num": 25,
"color": 4,
"special": 0,
"length": 3
},
{
"id": 42,
"num": 26,
"color": 4,
"special": 0,
"length": 0
},
{
"id": 43,
"num": 26,
"color": 4,
"special": 0,
"length": 0
},
{
"id": 44,
"num": 25,
"color": 5,
"special": 0,
"length": 3
},
{
"id": 45,
"num": 26,
"color": 5,
"special": 0,
"length": 0
},
{
"id": 46,
"num": 27,
"color": 5,
"special": 0,
"length": 0
},
{
"id": 47,
"num": 25,
"color": 4,
"special": 0,
"length": 3
},
{
"id": 48,
"num": 26,
"color": 4,
"special": 0,
"length": 0
},
{
"id": 49,
"num": 27,
"color": 4,
"special": 0,
"length": 0
},
{
"id": 50,
"num": 22,
"color": 4,
"special": 0,
"length": 2
},
{
"id": 51,
"num": 23,
"color": 4,
"special": 0,
"length": 0
},
{
"id": 52,
"num": 22,
"color": 1,
"special": 0,
"length": 2
},
{
"id": 53,
"num": 23,
"color": 1,
"special": 0,
"length": 0
}
]
]

View File

@ -20,8 +20,18 @@ export default class NewClass extends cc.Component {
coin: cc.Node = null;
btn_Touch: boolean = true;
private onShowListener: () => void;
onLoad() {
this.btn_Touch = true;
// 检测微信小游戏切到后台
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
// 定义监听函数
this.onShowListener = () => {
this.onShow();
};
//@ts-ignore
wx.onShow(this.onShowListener);
}
}
start() {
this.btn_Touch = true;
@ -62,6 +72,11 @@ export default class NewClass extends cc.Component {
//关闭商店界面
closeShop() {
// 移除 wx.onShow 监听器
if (cc.sys.platform === cc.sys.WECHAT_GAME && this.onShowListener) {
//@ts-ignore
wx.offShow(this.onShowListener);
}
//销毁预制体
if(this.node.parent.getComponent("JiaZai")){
this.node.parent.getComponent("JiaZai").closeShop();
@ -72,6 +87,15 @@ export default class NewClass extends cc.Component {
// this.shop.destroy();
}
onShow(){
if(cc.fx.GameConfig.GM_INFO.iosOutTradeNo != null){
console.log("有苹果订单号,开始轮训");
Utils.getIosPayInfo((data) =>{
console.log("获得轮训结果:",data);
})
}
}
//点击充值购买
buyProduct(event, customData) {
@ -110,12 +134,18 @@ export default class NewClass extends cc.Component {
try {
const systemInfo = wx.getSystemInfoSync();
if (systemInfo.platform === 'ios') {
systemType = "iOS";
systemType = "ios";
}
} catch (e) {
console.error('获取系统信息失败', e);
}
// Utils.GoKEFu();
if(systemType == "ios"){
MiniGameSdk.API.showToast("IOS系统暂不支持支付");
// Utils.GoKEFu();
}
else{
const data = {
outTradeNo:Utils.outTradeNo,
price:price,
@ -205,8 +235,8 @@ export default class NewClass extends cc.Component {
}
})
}
});
}
}
// update (dt) {}