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) { init(block_Info, posX, posY, node) {
this.block_Info = this.jsonDeepClone(block_Info); this.block_Info = this.jsonDeepClone(block_Info);
let mapInfo = MapConroler._instance.mapInfo; 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++) { for (let i = 0; i < mapInfo.length; i++) {
let blockRect = mapInfo[i].getBoundingBox(); let blockRect = mapInfo[i].getBoundingBox();
// 使用 cc.Intersection.pointInRect 方法判断点是否在矩形范围内 // 使用 cc.Intersection.pointInRect 方法判断点是否在矩形范围内

View File

@ -475,8 +475,13 @@ export default class GameManager extends cc.Component {
console.log('读取用户数据成功', res.result) console.log('读取用户数据成功', res.result)
if (res.result.code == 404 && res.result.message == "未找到用户数据") { if (res.result.code == 404 && res.result.message == "未找到用户数据") {
if (res.result.openid) { if (res.result.openid) {
console.log("用户从未进入过第一次设置openid:");
console.log(res.result.openid);
cc.fx.GameConfig.GM_INFO.openid = res.result.openid cc.fx.GameConfig.GM_INFO.openid = res.result.openid
} }
else{
console.log("用户此一次进入游戏为正确获取openid");
}
cc.fx.GameConfig.GM_INFO.first = true; cc.fx.GameConfig.GM_INFO.first = true;
this.load3 = true; this.load3 = true;
this.load4 = 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.successList = [];
cc.fx.GameConfig.GM_INFO.fen = 0; cc.fx.GameConfig.GM_INFO.fen = 0;
cc.fx.GameConfig.GM_INFO.score = 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.GM_INFO.min_Time = 0;
cc.fx.GameConfig.TIME_INFO.totalTime = 120; cc.fx.GameConfig.TIME_INFO.totalTime = 120;
cc.director.loadScene("GameScene"); cc.director.loadScene("GameScene");

View File

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

View File

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

View File

@ -81,7 +81,7 @@ export class GameConfig {
first: boolean; //是否首次进入游戏 first: boolean; //是否首次进入游戏
score: number; //总得分 score: number; //总得分
scale: number; //玩家总计成功点火数 scale: number; //玩家总计成功点火数
min_Steps: number; //每次上一把最小步数 iosOutTradeNo: number; //每次上一把最小步数
min_Time: number; //体力恢复的剩余时间 min_Time: number; //体力恢复的剩余时间
freezeAmount: number; //冻结道具次数 freezeAmount: number; //冻结道具次数
hammerAmount: number; //锤子道具次数 hammerAmount: number; //锤子道具次数
@ -200,7 +200,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,
@ -212,7 +212,7 @@ export class GameConfig {
first:false, //是否首次进入游戏 first:false, //是否首次进入游戏
score:0, //总得分 score:0, //总得分
scale: 1, //玩家总计成功点火数 scale: 1, //玩家总计成功点火数
min_Steps:0, //每次上一把最小步数 iosOutTradeNo:0, //ios订单号
min_Time:0, //体力恢复的剩余时间 min_Time:0, //体力恢复的剩余时间
freezeAmount:0, //冻结道具次数 freezeAmount:0, //冻结道具次数
hammerAmount:0, //锤子道具次数 hammerAmount:0, //锤子道具次数
@ -257,7 +257,7 @@ export class GameConfig {
// cc.fx.StorageMessage.setStorage("level",cc.fx.GameConfig.GM_INFO.level.toString()); // cc.fx.StorageMessage.setStorage("level",cc.fx.GameConfig.GM_INFO.level.toString());
cc.resources.load(name, (err: any, res: cc.JsonAsset) => { cc.resources.load(name, (err: any, res: cc.JsonAsset) => {
if (err) { if (err) {
cc.fx.GameTool.addLevel(); cc.fx.GameTool.addLevel(null,null);
self.LEVEL_INFO_init(type,time); self.LEVEL_INFO_init(type,time);
return; return;
} }

View File

@ -5,7 +5,7 @@ export default class Utils {
static openid:string=""; static openid:string="";
static outTradeNo:string =""; static outTradeNo:string ="";
static httpip:string=`https://laf.nika4games.com/`; static httpip:string=`https://laf.nika4games.com/`;
//#region 支付 //#region 安卓支付
/**获取用户信息*/ /**获取用户信息*/
static getUserInfo(callBack){ static getUserInfo(callBack){
wx.login({ wx.login({
@ -110,21 +110,47 @@ export default class Utils {
sendRequest(); sendRequest();
} }
//#region ios支付
/**跳转客服*/ /**跳转客服*/
static GoKEFu(){ static GoKEFu(){
// 打开客服会话 cc.fx.GameConfig.GM_INFO.iosOutTradeNo = null;
//wx.navigateTo({ url: '/pages/webview?url=https://xxx.com/customer' }); cc.fx.GameConfig.GM_INFO.iosOutTradeNo = `wcx_` + Math.round(Math.random() * 10 ** 13) + Date.now();
//@ts-ignore const data={
tpye:"ios",
outTradeNo:cc.fx.GameConfig.GM_INFO.iosOutTradeNo,
propName:'金币',
count:1,
price:100,//价格单位是分
}
//@ts-ignore
wx.openCustomerServiceConversation({ wx.openCustomerServiceConversation({
sessionFrom: '你好这是充值中心', // 会话来源(可选) sessionFrom: JSON.stringify(data), // 会话来源(可选)
showMessageCard: true, // 是否展示消息卡片 showMessageCard: false, // 是否展示消息卡片
sendMessageTitle:"扫描二维码进行充值",
sendMessageImg:"https://img2.huashi6.com/images/resource/thumbnail/2023/07/23/193722_24254930385.jpg?imageMogr2/quality/100/interlace/1/thumbnail/2000x%3E",
success() { success() {
console.log('客服会话已打开'); 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, level:cc.fx.GameConfig.GM_INFO.level,
timestamp:timestamp, timestamp:timestamp,
} }
// console.log("55555存储关卡数据:",levelInfo); console.log("55555存储关卡数据:",time1,time2);
cc.fx.StorageMessage.setStorage("level",levelInfo); cc.fx.StorageMessage.setStorage("level",levelInfo);
if(time1 && time2){ if(time1!=null && time2!=null){
let data = { let data = {
time:time1, time:time1,
add_Time:time2, add_Time:time2,
@ -955,6 +956,11 @@ var GameTool = {
} }
break; 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);
MiniGameSdk.API.shushu_Track(name, eventData); MiniGameSdk.API.shushu_Track(name, eventData);
}, },

View File

@ -39,7 +39,7 @@
"type": 0, "type": 0,
"position": { "position": {
"x": 240, "x": 240,
"y": 120, "y": 0,
"z": 0 "z": 0
}, },
"id": 210 "id": 210
@ -50,7 +50,7 @@
"type": 0, "type": 0,
"position": { "position": {
"x": 240, "x": 240,
"y": 240, "y": 120,
"z": 0 "z": 0
}, },
"id": 220 "id": 220
@ -61,7 +61,7 @@
"type": 0, "type": 0,
"position": { "position": {
"x": 240, "x": 240,
"y": 360, "y": 240,
"z": 0 "z": 0
}, },
"id": 230 "id": 230
@ -72,7 +72,7 @@
"type": 0, "type": 0,
"position": { "position": {
"x": 240, "x": 240,
"y": 0, "y": 360,
"z": 0 "z": 0
}, },
"id": 240 "id": 240
@ -256,73 +256,16 @@
"id": 400 "id": 400
}, },
{ {
"block": 20, "block": 4,
"color": 1, "color": 3,
"type": 9, "type": 0,
"position": { "position": {
"x": -240, "x": 360,
"y": 0, "y": 120,
"z": 0 "z": 0
}, },
"adhesiveTime": 2,
"id": 410 "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, "block": 2,
"color": 8, "color": 8,
@ -332,44 +275,101 @@
"y": 360, "y": 360,
"z": 0 "z": 0
}, },
"id": 470 "id": 420
}, },
{ {
"block": 0, "block": 0,
"color": 6, "color": 8,
"type": 0, "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": { "position": {
"x": -360, "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 "z": 0
}, },
"id": 480 "id": 480
}, },
{ {
"block": 4, "block": 22,
"color": 6, "color": 9,
"type": 8, "type": 0,
"position": { "position": {
"x": 0, "x": 480,
"y": -120, "y": -240,
"z": 0 "z": 0
}, },
"id": 490 "id": 490
}, },
{ {
"block": 4, "block": 0,
"color": 1, "color": 9,
"type": 8, "type": 0,
"position": { "position": {
"x": 120, "x": 120,
"y": -120, "y": -600,
"z": 0 "z": 0
}, },
"id": 500 "id": 500
}, },
{ {
"block": 2, "block": 2,
"color": 9, "color": 2,
"type": 0, "type": 0,
"position": { "position": {
"x": 0, "x": 0,
@ -380,7 +380,7 @@
}, },
{ {
"block": 0, "block": 0,
"color": 9, "color": 2,
"type": 0, "type": 0,
"position": { "position": {
"x": 360, "x": 360,
@ -390,34 +390,34 @@
"id": 520 "id": 520
}, },
{ {
"block": 5, "block": 0,
"color": 2, "color": 6,
"type": 0, "type": 0,
"position": { "position": {
"x": -240, "x": -360,
"y": -480, "y": -600,
"z": 0 "z": 0
}, },
"id": 530 "id": 530
}, },
{ {
"block": 0, "block": 4,
"color": 2, "color": 6,
"type": 0, "type": 8,
"position": { "position": {
"x": 120, "x": 0,
"y": -600, "y": -120,
"z": 0 "z": 0
}, },
"id": 540 "id": 540
}, },
{ {
"block": 4, "block": 4,
"color": 3, "color": 1,
"type": 0, "type": 8,
"position": { "position": {
"x": 360, "x": 120,
"y": 120, "y": -120,
"z": 0 "z": 0
}, },
"id": 550 "id": 550
@ -428,94 +428,115 @@
[ [
{ {
"id": 1, "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, "num": 25,
"color": 8, "color": 8,
"special": 0, "special": 0,
"length": 1 "length": 1
}, },
{ {
"id": 7, "id": 2,
"num": 18, "num": 11,
"color": 6,
"special": 0,
"length": 1
},
{
"id": 8,
"num": 0,
"color": 9, "color": 9,
"special": 0, "special": 0,
"length": 2 "length": 2
}, },
{ {
"id": 9, "id": 3,
"num": 1, "num": 14,
"color": 9, "color": 9,
"special": 0, "special": 0,
"length": 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, "num": 19,
"color": 1, "color": 1,
"special": 0, "special": 0,
"length": 2 "length": 2
}, },
{ {
"id": 11, "id": 10,
"num": 21, "num": 21,
"color": 1, "color": 1,
"special": 0, "special": 0,
"length": 0 "length": 0
}, },
{ {
"id": 12, "id": 11,
"num": 11, "num": 36,
"color": 2, "color": 4,
"special": 0, "special": 0,
"length": 2 "length": 2
}, },
{ {
"id": 13, "id": 12,
"num": 14, "num": 37,
"color": 2, "color": 4,
"special": 0, "special": 0,
"length": 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, "block": 2,
"color": 6, "color": 5,
"type": 0,
"position": {
"x": 120,
"y": -480,
"z": 0
},
"id": 210
},
{
"block": 20,
"color": 2,
"type": 0, "type": 0,
"position": { "position": {
"x": 0, "x": 0,
"y": -360, "y": 240,
"z": 0 "z": 0
}, },
"id": 220 "id": 210
},
{
"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
}, },
{ {
"block": 22, "block": 22,
@ -98,8 +32,85 @@
"y": 120, "y": 120,
"z": 0 "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 "id": 280
}, },
{
"block": 2,
"color": 6,
"type": 0,
"position": {
"x": 120,
"y": -480,
"z": 0
},
"id": 290
},
{ {
"block": 1, "block": 1,
"color": 9, "color": 9,
@ -109,41 +120,19 @@
"y": 120, "y": 120,
"z": 0 "z": 0
}, },
"id": 290
},
{
"block": 0,
"color": 10,
"type": 0,
"position": {
"x": -120,
"y": 0,
"z": 0
},
"id": 300 "id": 300
}, },
{ {
"block": 1, "block": 0,
"color": 9, "color": 3,
"type": 2, "type": 2,
"position": { "position": {
"x": 240, "x": 120,
"y": -240, "y": 360,
"z": 0 "z": 0
}, },
"id": 310 "id": 310
}, },
{
"block": 0,
"color": 6,
"type": 2,
"position": {
"x": 240,
"y": 0,
"z": 0
},
"id": 320
},
{ {
"block": 0, "block": 0,
"color": 4, "color": 4,
@ -153,15 +142,26 @@
"y": 120, "y": 120,
"z": 0 "z": 0
}, },
"id": 330 "id": 320
}, },
{ {
"block": 0, "block": 0,
"color": 3, "color": 6,
"type": 2, "type": 2,
"position": { "position": {
"x": 120, "x": 240,
"y": 360, "y": 0,
"z": 0
},
"id": 330
},
{
"block": 1,
"color": 9,
"type": 2,
"position": {
"x": 240,
"y": -240,
"z": 0 "z": 0
}, },
"id": 340 "id": 340
@ -178,12 +178,12 @@
"id": 350 "id": 350
}, },
{ {
"block": 2, "block": 0,
"color": 5, "color": 10,
"type": 0, "type": 0,
"position": { "position": {
"x": 0, "x": -120,
"y": 240, "y": 0,
"z": 0 "z": 0
}, },
"id": 360 "id": 360
@ -230,104 +230,6 @@
[ [
{ {
"id": 1, "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, "num": 14,
"color": 8, "color": 8,
"special": 2, "special": 2,
@ -335,7 +237,7 @@
"lock": true "lock": true
}, },
{ {
"id": 15, "id": 2,
"num": 16, "num": 16,
"color": 8, "color": 8,
"special": 2, "special": 2,
@ -343,40 +245,138 @@
"lock": true "lock": true
}, },
{ {
"id": 16, "id": 3,
"num": 20, "num": 22,
"color": 2, "color": 1,
"special": 0, "special": 2,
"length": 2 "length": 2,
"lock": false
}, },
{ {
"id": 17, "id": 4,
"num": 21, "num": 23,
"color": 2, "color": 1,
"special": 0, "special": 2,
"length": 0 "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, "num": 5,
"color": 10, "color": 10,
"special": 0, "special": 0,
"length": 3 "length": 3
}, },
{ {
"id": 19, "id": 8,
"num": 6, "num": 6,
"color": 10, "color": 10,
"special": 0, "special": 0,
"length": 0 "length": 0
}, },
{ {
"id": 20, "id": 9,
"num": 7, "num": 7,
"color": 10, "color": 10,
"special": 0, "special": 0,
"length": 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, "id": 21,
"num": 11, "num": 11,
@ -392,238 +392,6 @@
"special": 2, "special": 2,
"length": 0, "length": 0,
"lock": true "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; coin: cc.Node = null;
btn_Touch: boolean = true; btn_Touch: boolean = true;
private onShowListener: () => void;
onLoad() { onLoad() {
this.btn_Touch = true; this.btn_Touch = true;
// 检测微信小游戏切到后台
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
// 定义监听函数
this.onShowListener = () => {
this.onShow();
};
//@ts-ignore
wx.onShow(this.onShowListener);
}
} }
start() { start() {
this.btn_Touch = true; this.btn_Touch = true;
@ -62,6 +72,11 @@ export default class NewClass extends cc.Component {
//关闭商店界面 //关闭商店界面
closeShop() { 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")){ if(this.node.parent.getComponent("JiaZai")){
this.node.parent.getComponent("JiaZai").closeShop(); this.node.parent.getComponent("JiaZai").closeShop();
@ -72,6 +87,15 @@ export default class NewClass extends cc.Component {
// this.shop.destroy(); // this.shop.destroy();
} }
onShow(){
if(cc.fx.GameConfig.GM_INFO.iosOutTradeNo != null){
console.log("有苹果订单号,开始轮训");
Utils.getIosPayInfo((data) =>{
console.log("获得轮训结果:",data);
})
}
}
//点击充值购买 //点击充值购买
buyProduct(event, customData) { buyProduct(event, customData) {
@ -110,103 +134,109 @@ export default class NewClass extends cc.Component {
try { try {
const systemInfo = wx.getSystemInfoSync(); const systemInfo = wx.getSystemInfoSync();
if (systemInfo.platform === 'ios') { if (systemInfo.platform === 'ios') {
systemType = "iOS"; systemType = "ios";
} }
} catch (e) { } catch (e) {
console.error('获取系统信息失败', e); console.error('获取系统信息失败', e);
} }
const data = { // Utils.GoKEFu();
outTradeNo:Utils.outTradeNo, if(systemType == "ios"){
price:price, MiniGameSdk.API.showToast("IOS系统暂不支持支付");
payment_name:productId, // Utils.GoKEFu();
payment_num:1,
type:systemType,
} }
cc.fx.GameTool.shushu_Track("init_order",data); else{
const data = {
Utils.buyProp(id,count,price,(res)=>{ outTradeNo:Utils.outTradeNo,
console.log("获得充值结果",res); price:price,
if(res == null){ payment_name:productId,
MiniGameSdk.API.showToast("网络异常,充值失败请稍后再试"); payment_num:1,
this.btn_Touch = true; type:systemType,
const dataFail = {
outTradeNo:Utils.outTradeNo,
price:price,
payment_name:productId,
payment_num:1,
type:systemType,
fail_reason:"网络异常,没有拉起支付",
}
cc.fx.GameTool.shushu_Track("payment_fail",dataFail);
return;
} }
else{ cc.fx.GameTool.shushu_Track("init_order",data);
Utils.getPayInfo((data) =>{
console.log("获得轮训结果:",data); Utils.buyProp(id,count,price,(res)=>{
if(data.data.pay_state == 1){ console.log("获得充值结果",res);
this.btn_Touch = true; if(res == null){
MiniGameSdk.API.showToast("取消充值"); MiniGameSdk.API.showToast("网络异常,充值失败请稍后再试");
const dataFail2 = { this.btn_Touch = true;
outTradeNo:Utils.outTradeNo, const dataFail = {
price:price, outTradeNo:Utils.outTradeNo,
payment_name:productId, price:price,
payment_num:1, payment_name:productId,
type:systemType, payment_num:1,
fail_reason:"用户取消支付", type:systemType,
} fail_reason:"网络异常,没有拉起支付",
cc.fx.GameTool.shushu_Track("payment_fail",dataFail2);
} }
else if(data.data.pay_state == 2){ cc.fx.GameTool.shushu_Track("payment_fail",dataFail);
this.btn_Touch = true; return;
Utils.setPayInfo((data) => { }
console.log("设置轮训结果:",data); else{
if(data.code === 1){ Utils.getPayInfo((data) =>{
MiniGameSdk.API.showToast("充值成功"); console.log("获得轮训结果:",data);
cc.fx.GameTool.shopBuy(productId); if(data.data.pay_state == 1){
console.log("充值成功获得金币"); this.btn_Touch = true;
const dataSuccess = { MiniGameSdk.API.showToast("取消充值");
outTradeNo:Utils.outTradeNo, const dataFail2 = {
price:price, outTradeNo:Utils.outTradeNo,
payment_name:productId, price:price,
payment_num:1, payment_name:productId,
type:systemType, payment_num:1,
} type:systemType,
cc.fx.GameTool.shushu_Track("payment",dataSuccess); fail_reason:"用户取消支付",
} }
else{ cc.fx.GameTool.shushu_Track("payment_fail",dataFail2);
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放"); }
const dataFail4 = { else if(data.data.pay_state == 2){
outTradeNo:Utils.outTradeNo, this.btn_Touch = true;
price:price, Utils.setPayInfo((data) => {
payment_name:productId, console.log("设置轮训结果:",data);
payment_num:1, if(data.code === 1){
type:systemType, MiniGameSdk.API.showToast("充值成功");
fail_reason:"成功付款,但是发货时请求服务器失败,充值成功未发货", cc.fx.GameTool.shopBuy(productId);
console.log("充值成功获得金币");
const dataSuccess = {
outTradeNo:Utils.outTradeNo,
price:price,
payment_name:productId,
payment_num:1,
type:systemType,
}
cc.fx.GameTool.shushu_Track("payment",dataSuccess);
} }
cc.fx.GameTool.shushu_Track("payment_fail",dataFail4); else{
} MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
const dataFail4 = {
outTradeNo:Utils.outTradeNo,
price:price,
payment_name:productId,
payment_num:1,
type:systemType,
fail_reason:"成功付款,但是发货时请求服务器失败,充值成功未发货",
}
cc.fx.GameTool.shushu_Track("payment_fail",dataFail4);
}
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
this.node.parent.getComponent("JiaZai").updateCoin();
})
}
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);
this.node.parent.getComponent("JiaZai").updateCoin(); this.node.parent.getComponent("JiaZai").updateCoin();
}) const dataFail3 = {
} outTradeNo:Utils.outTradeNo,
else{ price:price,
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); payment_name:productId,
this.node.parent.getComponent("JiaZai").updateCoin(); payment_num:1,
const dataFail3 = { type:systemType,
outTradeNo:Utils.outTradeNo, fail_reason:"拉起支付后,付款时网络异常付款失败",
price:price, }
payment_name:productId, cc.fx.GameTool.shushu_Track("payment_fail",dataFail3);
payment_num:1,
type:systemType,
fail_reason:"拉起支付后,付款时网络异常付款失败",
} }
cc.fx.GameTool.shushu_Track("payment_fail",dataFail3); })
} }
}) });
} }
});
} }
// update (dt) {} // update (dt) {}