diff --git a/assets/Script/JiaZai.ts b/assets/Script/JiaZai.ts index e03ed97..7d9d8e0 100644 --- a/assets/Script/JiaZai.ts +++ b/assets/Script/JiaZai.ts @@ -97,6 +97,19 @@ export default class JiaZai extends cc.Component { if (cc.fx.GameConfig.GM_INFO.first) { console.log("————————准备注册事件", cc.fx.GameConfig.GM_INFO.openid); const group = cc.fx.GameTool.setWechatGameGroup(2); + if (group == 0) { + cc.fx.GameConfig.GM_INFO.musicOpen = true; + } + else if (group == 1) { + cc.fx.GameConfig.GM_INFO.musicOpen = false; + } + const audioInfo = { + "musicOpen": cc.fx.GameConfig.GM_INFO.musicOpen, //音乐 + "effectOpen": cc.fx.GameConfig.GM_INFO.effectOpen, //音效 + "vibrateOpen": cc.fx.GameConfig.GM_INFO.vibrateOpen, //震动 + } + cc.fx.StorageMessage.setStorage("music", audioInfo); + if (cc.fx.GameConfig.GM_INFO.openid != "") { console.log("————————发送注册事件"); const time = cc.fx.GameTool.formatDate(new Date()); @@ -126,7 +139,7 @@ export default class JiaZai extends cc.Component { // console.log("关卡",cc.fx.GameConfig.GM_INFO.level+1); cc.fx.GameTool.getHealth(null); - // cc.fx.GameConfig.LEVEL_INFO_init(false,0);s + // cc.fx.GameConfig.LEVEL_INFO_init(false,0); setTimeout(() => { NumberToImage.numberToImageNodes((cc.fx.GameConfig.GM_INFO.level + 1), 43, 15, "level_", this.level, true); NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); diff --git a/assets/Script/Map.ts b/assets/Script/Map.ts index 62f1283..58936a1 100644 --- a/assets/Script/Map.ts +++ b/assets/Script/Map.ts @@ -1369,6 +1369,12 @@ export default class MapConroler extends cc.Component { // console.log("即将上报成功________________________:",this.add_Time); // console.log("成功消除一个",this.add_Time); cc.fx.GameTool.changeCoin(40); + const data = { + change_reason: "闯关成功获得金币", + id: (1001 + ""), + num: 40 + } + cc.fx.GameTool.shushu_Track("resource_get", data); let overTime = Date.now(); this.count_Time = overTime - this.count_Time; cc.fx.GameTool.addLevel(this.count_Time, this.add_Time); @@ -1507,6 +1513,12 @@ export default class MapConroler extends cc.Component { runRewive(data) { console.log("复活回调函数内", data); cc.fx.GameTool.changeCoin(data.coin); + const dataTemp = { + change_reason: "游戏内复活消耗金币", + id: (1001 + ""), + num: data.coin + } + cc.fx.GameTool.shushu_Track("resource_cost", dataTemp); MiniGameSdk.API.showToast("继续游戏"); NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); if (data.type == "time") { @@ -1751,6 +1763,7 @@ export default class MapConroler extends cc.Component { cc.fx.GameTool.setUserProp(2001, cc.fx.GameConfig.GM_INFO.freezeAmount, (data) => { }) let data = { + change_reason: "使用道具", id: "2001", num: -1 } @@ -1870,6 +1883,7 @@ export default class MapConroler extends cc.Component { cc.fx.GameTool.setUserProp(2002, cc.fx.GameConfig.GM_INFO.hammerAmount, (data) => { }) let data = { + change_reason: "使用道具", id: "2002", num: -1 } @@ -1983,6 +1997,7 @@ export default class MapConroler extends cc.Component { cc.fx.GameTool.setUserProp(2003, cc.fx.GameConfig.GM_INFO.magicAmount, (data) => { }) let data = { + change_reason: "使用道具", id: "2003", num: -1 } diff --git a/assets/Script/Sdk/MiniGameSdk.ts b/assets/Script/Sdk/MiniGameSdk.ts index bd1e90e..b85c88b 100644 --- a/assets/Script/Sdk/MiniGameSdk.ts +++ b/assets/Script/Sdk/MiniGameSdk.ts @@ -1127,7 +1127,7 @@ export namespace MiniGameSdk { }, // 根据环境变量设置 debug 模式 debug: !isProduction, - enableLog: false + enableLog: true }; // 创建 TA 实例 API._ta = new ThinkingAnalyticsAPI(config); diff --git a/assets/Script/heathnum.ts b/assets/Script/heathnum.ts index e594884..d801508 100644 --- a/assets/Script/heathnum.ts +++ b/assets/Script/heathnum.ts @@ -70,6 +70,12 @@ export default class NewClass extends cc.Component { if (curCoin >= 1000) { this.switchButtons[1].active = false; cc.fx.GameTool.changeCoin(-1000); + const data = { + change_reason: "首页购买体力", + id: (1001 + ""), + num: -1000 + } + cc.fx.GameTool.shushu_Track("resource_cost", data); cc.fx.GameConfig.GM_INFO.hp = 5; const parentNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点 if (parentNode) { @@ -83,6 +89,15 @@ export default class NewClass extends cc.Component { cc.fx.GameTool.setUserHealth(0, (data) => { cc.fx.GameTool.getHealth(null); }) + const buyData = { + item_id: "refill_health", + item_num: 3, + item_price: 1000, + cost_type: "gold" + } + console.log("____________即将上传Shop_buy", buyData); + cc.fx.GameTool.shushu_Track("shop_buy", buyData); + } else { MiniGameSdk.API.showToast("金币不足,无法购买体力"); diff --git a/assets/Script/module/Config/GameConfig.ts b/assets/Script/module/Config/GameConfig.ts index 46e98ff..dcafb75 100644 --- a/assets/Script/module/Config/GameConfig.ts +++ b/assets/Script/module/Config/GameConfig.ts @@ -83,7 +83,7 @@ export class GameConfig { first: boolean; //是否首次进入游戏 score: number; //总得分 scale: number; //玩家总计成功点火数 - iosOutTradeNo: number; //ios订单号 + iosOutTradeNo: string; //ios订单号 min_Time: number; //体力恢复的剩余时间 freezeAmount: number; //冻结道具次数 hammerAmount: number; //锤子道具次数 @@ -220,7 +220,7 @@ export class GameConfig { first: false, //是否首次进入游戏 score: 0, //总得分 scale: 1, //玩家总计成功点火数 - iosOutTradeNo: 0, //ios订单号 + iosOutTradeNo: "", //ios订单号 min_Time: 0, //体力恢复的剩余时间 freezeAmount: 0, //冻结道具次数 hammerAmount: 0, //锤子道具次数 diff --git a/assets/Script/module/Pay/Utils.ts b/assets/Script/module/Pay/Utils.ts index 34ee425..7209c79 100644 --- a/assets/Script/module/Pay/Utils.ts +++ b/assets/Script/module/Pay/Utils.ts @@ -1,60 +1,60 @@ export default class Utils { - static uid:string=""; - static session_key=""; - static appid:string=""; - static openid:string=""; - static outTradeNo:string =""; - static httpip:string=`https://laf.nika4games.com/`; -//#region 安卓支付 + static uid: string = ""; + static session_key = ""; + static appid: string = ""; + static openid: string = ""; + static outTradeNo: string = ""; + static httpip: string = `https://laf.nika4games.com/`; + //#region 安卓支付 /**获取用户信息*/ - static getUserInfo(callBack){ + static getUserInfo(callBack) { wx.login({ - success (res) { + success(res) { console.log("登录成功"); console.log(res); - if (res.code) { - Utils.POST("login",{code:res.code},ret=>{ - console.log("请求结果:",res); - console.log(ret); - Utils.openid=ret.data.openid; - Utils.session_key=ret.data.session_key; - Utils.uid=ret.data._id; - callBack(Utils.uid); - }) - } else { - console.log('登录失败!' + res.errMsg) - } + if (res.code) { + Utils.POST("login", { code: res.code }, ret => { + console.log("请求结果:", res); + console.log(ret); + Utils.openid = ret.data.openid; + Utils.session_key = ret.data.session_key; + Utils.uid = ret.data._id; + callBack(Utils.uid); + }) + } else { + console.log('登录失败!' + res.errMsg) + } } }) } /**道具直购接口*/ - static buyProp(id,count,price,callBack){ - console.log("请求uid:"+Utils.uid,"请求id:"+id,"请求数量:"+count,"请求价格:"+price); + static buyProp(id, count, price, callBack) { + console.log("请求uid:" + Utils.uid, "请求id:" + id, "请求数量:" + count, "请求价格:" + price); - Utils.POST("wx/orderPaySig",{uid:Utils.uid,itemid:id,itemCount:count,itemPrice:price},res=>{ - if(res.code==1){ - Utils.outTradeNo=res.data.outTradeNo; + Utils.POST("wx/orderPaySig", { uid: Utils.uid, itemid: id, itemCount: count, itemPrice: price }, res => { + if (res.code == 1) { + Utils.outTradeNo = res.data.outTradeNo; //@ts-ignore wx.requestMidasPaymentGameItem({ - signData:res.data.signData, + signData: res.data.signData, paySig: res.data.paySig, signature: res.data.signature, success(res, errCode) { console.log('成功', res, errCode); callBack(res); }, - fail({errMsg,errCode}) { + fail({ errMsg, errCode }) { console.error('失败'); console.error(errMsg, errCode) callBack(null); } }) } - + }); - + } static getPayInfo(callBack) { const delays = [1000, 10000, 30000, 60000, 60000]; // 延迟时间数组 @@ -91,7 +91,7 @@ export default class Utils { callBack({ code: 0, message: '请求失败,已达到最大重试次数' }); return; } - Utils.POST("wx/getOrderReward", {outTradeNo: Utils.outTradeNo}, res => { + Utils.POST("wx/getOrderReward", { outTradeNo: Utils.outTradeNo }, res => { console.log("告知服务器发货:", res); if (res.code === 1) { // 请求成功,调用回调并返回结果 @@ -114,15 +114,15 @@ export default class Utils { //#region ios支付 /**跳转客服*/ - static GoKEFu(){ + static GoKEFu() { 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,//价格单位是分 + const data = { + tpye: "ios", + outTradeNo: cc.fx.GameConfig.GM_INFO.iosOutTradeNo, + propName: '金币', + count: 1, + price: 100,//价格单位是分 } //@ts-ignore wx.openCustomerServiceConversation({ @@ -133,158 +133,171 @@ export default class Utils { } }); } - 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("充值取消"); + static getIosPayInfo(callBack) { + const delays = [1000, 10000, 30000, 60000, 60000]; // 延迟时间数组 + let attempt = 0; // 轮询次数 + + const poll = () => { + if (attempt >= delays.length) { + callBack({ code: 0, data: null, message: '轮询超时' }); + return; + } + + console.log("请求uid:" + Utils.uid); + console.log("outTradeNo:" + cc.fx.GameConfig.GM_INFO.iosOutTradeNo); + Utils.POST("wx/iosgetPayInfo", { outTradeNo: cc.fx.GameConfig.GM_INFO.iosOutTradeNo }, res => { + console.log("查询字符结果IOS"); + console.log(res); + if (res.code === 1) { + callBack(res); cc.fx.GameConfig.GM_INFO.iosOutTradeNo = null; - }else{ - callBack("充值成功"); + } else if (res.code === 0) { + callBack(res); cc.fx.GameConfig.GM_INFO.iosOutTradeNo = null; } - } - }); + else { + attempt++; + setTimeout(poll, delays[attempt - 1]); + } + }); + }; + poll(); } - -//#endregion -//#region 微信云 -// static initServer(){ -// if(cc.sys.platform!=cc.sys.WECHAT_GAME)return; -// //@ts-ignore -// wx.cloud.init({ -// env: 'cloudbase-1gl7iex89268f11e' -// }) -// } - -// static getUserCode(){ -// //@ts-ignore -// wx.login({ -// success (res) { -// console.log("登录成功"); -// console.log(res); -// if (res.code) { -// //@ts-ignore -// wx.cloud.callFunction({ -// // 云函数名称 -// name: 'login', -// // 传给云函数的参数 -// data: { -// code:res.code, -// }, -// success: function(ret) { -// console.log("请求成功"); -// console.log("请求结果:"); -// console.log(ret); -// Utils.openid=ret.data.openid; -// Utils.session_key=ret.data.session_key; -// Utils.uid=ret.data._id; -// }, -// fail:function(res){ -// console.log("请求失败"); -// console.log(res); -// } -// }) -// } else { -// console.log('登录失败!' + res.errMsg) -// } -// } -// }) -// } - -// static PayOder(){ -// if(cc.sys.platform!=cc.sys.WECHAT_GAME)return; -// //@ts-ignore -// wx.cloud.callFunction({ -// // 云函数名称 -// name: 'userPayOrder', -// // 传给云函数的参数 -// data: { -// itemid:"10011", -// itemCount:1, -// itemPrice:100 -// }, -// success: function(res) { -// console.log("请求成功"); -// console.log(res) -// if(res.result.code==1){ -// Utils.outTradeNo=res.result.data.outTradeNo; -// console.log("订单号:"+Utils.outTradeNo); -// //@ts-ignore -// wx.requestMidasPaymentGameItem({ -// signData:res.result.data.signData, -// paySig: res.result.data.paySig, -// signature: res.result.data.signature, -// success(res, errCode) { -// console.log('成功', res, errCode); -// }, -// fail({errMsg,errCode}) { -// console.error('失败'); -// console.error(errMsg, errCode) -// } -// }) -// } - -// }, -// fail:function(res){ -// console.log("请求失败"); -// console.log(res); -// } -// }) -// } + //#endregion -// static getPayInfo1(callBack){ -// if(cc.sys.platform!=cc.sys.WECHAT_GAME)return; -// //@ts-ignore -// wx.cloud.callFunction({ -// // 云函数名称 -// name: 'userGetPayState', -// // 传给云函数的参数 -// data: { -// outTradeNo:Utils.outTradeNo -// }, -// success: function(res) { -// console.log("请求成功"); -// console.log(res) -// callBack("成功"); -// }, -// fail:function(res){ -// console.log("请求失败"); -// console.log(res); -// callBack("失败"); -// } -// }) -// } + //#region 微信云 + // static initServer(){ + // if(cc.sys.platform!=cc.sys.WECHAT_GAME)return; + // //@ts-ignore + // wx.cloud.init({ + // env: 'cloudbase-1gl7iex89268f11e' + // }) + // } -// static toke(){ -// if(cc.sys.platform!=cc.sys.WECHAT_GAME)return; -// //@ts-ignore -// wx.cloud.callFunction({ -// // 云函数名称 -// name: 'uerToken', -// // 传给云函数的参数 -// data: { - -// }, -// success: function(res) { -// console.log("请求成功"); -// console.log(res) -// }, -// fail:function(res){ -// console.log("请求失败"); -// console.log(res); -// } -// }) -// } -//#endregion + // static getUserCode(){ + // //@ts-ignore + // wx.login({ + // success (res) { + // console.log("登录成功"); + // console.log(res); + // if (res.code) { + // //@ts-ignore + // wx.cloud.callFunction({ + // // 云函数名称 + // name: 'login', + // // 传给云函数的参数 + // data: { + // code:res.code, + // }, + // success: function(ret) { + // console.log("请求成功"); + // console.log("请求结果:"); + // console.log(ret); + // Utils.openid=ret.data.openid; + // Utils.session_key=ret.data.session_key; + // Utils.uid=ret.data._id; + // }, + // fail:function(res){ + // console.log("请求失败"); + // console.log(res); + // } + // }) + // } else { + // console.log('登录失败!' + res.errMsg) + // } + // } + // }) + // } + + // static PayOder(){ + // if(cc.sys.platform!=cc.sys.WECHAT_GAME)return; + // //@ts-ignore + // wx.cloud.callFunction({ + // // 云函数名称 + // name: 'userPayOrder', + // // 传给云函数的参数 + // data: { + // itemid:"10011", + // itemCount:1, + // itemPrice:100 + // }, + // success: function(res) { + // console.log("请求成功"); + // console.log(res) + // if(res.result.code==1){ + // Utils.outTradeNo=res.result.data.outTradeNo; + // console.log("订单号:"+Utils.outTradeNo); + // //@ts-ignore + // wx.requestMidasPaymentGameItem({ + // signData:res.result.data.signData, + // paySig: res.result.data.paySig, + // signature: res.result.data.signature, + // success(res, errCode) { + // console.log('成功', res, errCode); + // }, + // fail({errMsg,errCode}) { + // console.error('失败'); + // console.error(errMsg, errCode) + // } + // }) + // } + + // }, + // fail:function(res){ + // console.log("请求失败"); + // console.log(res); + // } + // }) + // } + + // static getPayInfo1(callBack){ + // if(cc.sys.platform!=cc.sys.WECHAT_GAME)return; + // //@ts-ignore + // wx.cloud.callFunction({ + // // 云函数名称 + // name: 'userGetPayState', + // // 传给云函数的参数 + // data: { + // outTradeNo:Utils.outTradeNo + // }, + // success: function(res) { + // console.log("请求成功"); + // console.log(res) + // callBack("成功"); + // }, + // fail:function(res){ + // console.log("请求失败"); + // console.log(res); + // callBack("失败"); + // } + // }) + // } + + // static toke(){ + // if(cc.sys.platform!=cc.sys.WECHAT_GAME)return; + // //@ts-ignore + // wx.cloud.callFunction({ + // // 云函数名称 + // name: 'uerToken', + // // 传给云函数的参数 + // data: { + + // }, + // success: function(res) { + // console.log("请求成功"); + // console.log(res) + // }, + // fail:function(res){ + // console.log("请求失败"); + // console.log(res); + // } + // }) + // } + //#endregion /** @@ -296,7 +309,7 @@ export default class Utils { * @param {*} callback * @memberof HttpUtil */ - public static POST(url, param:object|any,callback) { + public static POST(url, param: object | any, callback) { var xhr = cc.loader.getXMLHttpRequest(); let dataStr = ''; Object.keys(param).forEach(key => { @@ -305,123 +318,123 @@ export default class Utils { if (dataStr !== '') { dataStr = dataStr.substr(0, dataStr.lastIndexOf('&')); } - url=this.httpip+url; - console.log("请求地址:"+url); + url = this.httpip + url; + console.log("请求地址:" + url); xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { - let response:any = xhr.responseText; + let response: any = xhr.responseText; if (xhr.status >= 200 && xhr.status < 300) { let httpStatus = xhr.statusText; // callback(true, JSON.parse(response)); - try{ - response=JSON.parse(response); - }catch{ - response={data:"数据有误",code:0}; + try { + response = JSON.parse(response); + } catch { + response = { data: "数据有误", code: 0 }; } callback(response); } else { - callback({data:"网络请求失败,请检查网络连接",code:0}); + callback({ data: "网络请求失败,请检查网络连接", code: 0 }); } } }; xhr.send(dataStr); } - static http_sendRequest(path,data,handler,extraUrl=null){ - let xhr=cc.loader.getXMLHttpRequest(); - xhr.timeout=5000;//超时时间 - if(data==null){ - data={}; + static http_sendRequest(path, data, handler, extraUrl = null) { + let xhr = cc.loader.getXMLHttpRequest(); + xhr.timeout = 5000;//超时时间 + if (data == null) { + data = {}; } // if(exports.token){//数据中加入安全密匙 // data.token=exports.token; // } - if(extraUrl==null){ + if (extraUrl == null) { //@ts-ignore - if(Utils.isDebug){ - extraUrl="http://localhost:9003"; - }else{ - extraUrl=this.httpip; + if (Utils.isDebug) { + extraUrl = "http://localhost:9003"; + } else { + extraUrl = this.httpip; } - + } //解析请求路由以及格式化请求参数 - let sendtext="?"; - for(let k in data){ - if(sendtext !="?"){ - sendtext +="&"; + let sendtext = "?"; + for (let k in data) { + if (sendtext != "?") { + sendtext += "&"; } - sendtext +=(k +'='+data[k]); + sendtext += (k + '=' + data[k]); } //组装完整的URL - let requestURL=extraUrl+"/"+path+encodeURI(sendtext); + let requestURL = extraUrl + "/" + path + encodeURI(sendtext); // console.log("发送请求:"); // console.log(requestURL); //发送请求 Get形式发送请求 - xhr.open("GET",requestURL,true); + xhr.open("GET", requestURL, true); if (cc.sys.isNative) {//如果是手机就设置请求头 xhr.setRequestHeader("Accept-Encoding", "gzip,deflate"); } //计时判断是否超时 - let hasRetried=false; - let timer=setTimeout(function(){ + let hasRetried = false; + let timer = setTimeout(function () { //xhr.hasRetried=true; - hasRetried=true; + hasRetried = true; xhr.abort(); console.log("http timeOut......"); retryFun(); - },5000); + }, 5000); //重新发送请求 - let retryFun=function(){ - Utils.http_sendRequest(path,data,handler,extraUrl); + let retryFun = function () { + Utils.http_sendRequest(path, data, handler, extraUrl); } //监听反馈 - xhr.onreadystatechange=function(){ + xhr.onreadystatechange = function () { clearTimeout(timer); - if(xhr.readyState===4&&(xhr.status >= 200 && xhr.status < 300)){ - let ret=null; - let respText=xhr.responseText; - try{ - ret=JSON.parse(respText); - }catch(e){ - console.log("http error:" +e); - ret={ - code:1, - msg:e + if (xhr.readyState === 4 && (xhr.status >= 200 && xhr.status < 300)) { + let ret = null; + let respText = xhr.responseText; + try { + ret = JSON.parse(respText); + } catch (e) { + console.log("http error:" + e); + ret = { + code: 1, + msg: e } } - if(handler){ + if (handler) { handler(ret); } - handler=null; - }else if(xhr.readyState===4){ + handler = null; + } else if (xhr.readyState === 4) { // if(xhr.hasRetried){ // return; // } - if(hasRetried){ + if (hasRetried) { return; } - console.log('other readystate =='+xhr.readyState + ', status:' + xhr.status); - if(xhr.readyState==4&&xhr.status==0){ + console.log('other readystate ==' + xhr.readyState + ', status:' + xhr.status); + if (xhr.readyState == 4 && xhr.status == 0) { handler({ - err:1, - msg:"网络连接失败,请稍后再试" + err: 1, + msg: "网络连接失败,请稍后再试" }); return; } - setTimeout(function(){ + setTimeout(function () { retryFun(); - },5000); - }else{ + }, 5000); + } else { //console.log('other readystate:' + xhr.readyState + ', status:' + xhr.status); } } - try{ + try { xhr.send(); - }catch(e){ + } catch (e) { retryFun(); } return xhr; diff --git a/assets/Script/module/Tool/GameTool.ts b/assets/Script/module/Tool/GameTool.ts index 686afdf..bbe7c00 100644 --- a/assets/Script/module/Tool/GameTool.ts +++ b/assets/Script/module/Tool/GameTool.ts @@ -644,9 +644,16 @@ var GameTool = { num = 1; } cc.fx.GameTool.changeCoin(-cost); + const dataTemp = { + change_reason: "商城购买道具消耗", + id: (1001 + ""), + num: -cost + } + cc.fx.GameTool.shushu_Track("resource_cost", dataTemp); cc.fx.GameTool.setUserProp(propid, num, (data) => { }) const data = { + change_reason: "商城购买道具", id: (propid + ""), num: 3 } @@ -828,6 +835,7 @@ var GameTool = { shopBuy(productId) { let coin = 0; let price = 0; + let getCoin = 0; switch (productId) { case "gold_1": cc.fx.GameTool.changeCoin(1200); @@ -866,6 +874,13 @@ var GameTool = { MiniGameSdk.API.showToast("充值成功,获得240000金币"); break; } + const dataTemp = { + change_reason: "商城RMB购买金币", + id: (1001 + ""), + num: coin + } + cc.fx.GameTool.shushu_Track("resource_get", dataTemp); + const buyData = { item_id: productId, item_num: coin, @@ -927,14 +942,14 @@ var GameTool = { break; case "resource_get": eventData = { - change_reason: "购买道具", //获得来源 + change_reason: data.change_reason, //获得来源 change_num: data.num, //获得数量 resource_id: data.id //道具id } break; case "resource_cost": eventData = { - change_reason: "使用道具", //获得来源 + change_reason: data.change_reason, //获得来源 change_num: data.num, //获得数量 resource_id: data.id //道具id } diff --git a/assets/TextureBg/pop_Bg/pauseBg.png b/assets/TextureBg/pop_Bg/pauseBg.png index c9b7a62..95c15f1 100644 Binary files a/assets/TextureBg/pop_Bg/pauseBg.png and b/assets/TextureBg/pop_Bg/pauseBg.png differ diff --git a/assets/TextureBg/pop_Bg/result_bg1.png b/assets/TextureBg/pop_Bg/result_bg1.png index 56b3823..6a299be 100644 Binary files a/assets/TextureBg/pop_Bg/result_bg1.png and b/assets/TextureBg/pop_Bg/result_bg1.png differ diff --git a/assets/TextureBg/pop_Bg/tanchuang1.png b/assets/TextureBg/pop_Bg/tanchuang1.png deleted file mode 100644 index 746e9d8..0000000 Binary files a/assets/TextureBg/pop_Bg/tanchuang1.png and /dev/null differ diff --git a/assets/TextureBg/pop_Bg/tanchuang1.png.meta b/assets/TextureBg/pop_Bg/tanchuang1.png.meta deleted file mode 100644 index b99f94f..0000000 --- a/assets/TextureBg/pop_Bg/tanchuang1.png.meta +++ /dev/null @@ -1,38 +0,0 @@ -{ - "ver": "2.3.7", - "uuid": "8ac53103-5eab-4857-b56c-2d055f0be6e3", - "importer": "texture", - "type": "sprite", - "wrapMode": "clamp", - "filterMode": "bilinear", - "premultiplyAlpha": false, - "genMipmaps": false, - "packable": true, - "width": 1071, - "height": 1257, - "platformSettings": {}, - "subMetas": { - "tanchuang1": { - "ver": "1.0.6", - "uuid": "f2dcf5a7-9beb-4773-ad55-45a2f827a912", - "importer": "sprite-frame", - "rawTextureUuid": "8ac53103-5eab-4857-b56c-2d055f0be6e3", - "trimType": "auto", - "trimThreshold": 1, - "rotated": false, - "offsetX": 0, - "offsetY": 0, - "trimX": 0, - "trimY": 0, - "width": 1071, - "height": 1257, - "rawWidth": 1071, - "rawHeight": 1257, - "borderTop": 0, - "borderBottom": 0, - "borderLeft": 0, - "borderRight": 0, - "subMetas": {} - } - } -} \ No newline at end of file diff --git a/assets/UI/UI/pop/20miao.png b/assets/UI/UI/pop/20miao.png index 2083b90..c6db8ce 100644 Binary files a/assets/UI/UI/pop/20miao.png and b/assets/UI/UI/pop/20miao.png differ diff --git a/assets/UI/UI/pop/diban.png b/assets/UI/UI/pop/diban.png index 0c6c5be..28a5160 100644 Binary files a/assets/UI/UI/pop/diban.png and b/assets/UI/UI/pop/diban.png differ diff --git a/assets/UI/UI/pop/gameui.png b/assets/UI/UI/pop/gameui.png index 5f41129..a80afea 100644 Binary files a/assets/UI/UI/pop/gameui.png and b/assets/UI/UI/pop/gameui.png differ diff --git a/assets/UI/UI/pop/gongxi.png b/assets/UI/UI/pop/gongxi.png index 8c18e6e..7b7fd47 100644 Binary files a/assets/UI/UI/pop/gongxi.png and b/assets/UI/UI/pop/gongxi.png differ diff --git a/assets/UI/UI/pop/gongxiguoguan.png b/assets/UI/UI/pop/gongxiguoguan.png index b9fa8b4..711ab82 100644 Binary files a/assets/UI/UI/pop/gongxiguoguan.png and b/assets/UI/UI/pop/gongxiguoguan.png differ diff --git a/assets/UI/UI/pop/guang.png b/assets/UI/UI/pop/guang.png index abb421c..d7e904e 100644 Binary files a/assets/UI/UI/pop/guang.png and b/assets/UI/UI/pop/guang.png differ diff --git a/assets/UI/UI/pop/homeUi.png b/assets/UI/UI/pop/homeUi.png index c6c913c..52499d6 100644 Binary files a/assets/UI/UI/pop/homeUi.png and b/assets/UI/UI/pop/homeUi.png differ diff --git a/assets/UI/UI/pop/kuangt.png b/assets/UI/UI/pop/kuangt.png index a5fe9cb..7c900e2 100644 Binary files a/assets/UI/UI/pop/kuangt.png and b/assets/UI/UI/pop/kuangt.png differ diff --git a/assets/UI/UI/pop/top.png b/assets/UI/UI/pop/top.png index a486667..d582a6b 100644 Binary files a/assets/UI/UI/pop/top.png and b/assets/UI/UI/pop/top.png differ diff --git a/assets/UI/UI/pop/yuandi.png b/assets/UI/UI/pop/yuandi.png index 3b917f7..68dbdf8 100644 Binary files a/assets/UI/UI/pop/yuandi.png and b/assets/UI/UI/pop/yuandi.png differ diff --git a/assets/effect/good/太棒了-.png b/assets/effect/good/太棒了-.png index b3da53f..1daa5c4 100644 Binary files a/assets/effect/good/太棒了-.png and b/assets/effect/good/太棒了-.png differ diff --git a/assets/effect/magic/mofabang_texiao.png b/assets/effect/magic/mofabang_texiao.png index f9be12a..7cc05c8 100644 Binary files a/assets/effect/magic/mofabang_texiao.png and b/assets/effect/magic/mofabang_texiao.png differ diff --git a/assets/effect/nianhe/jiekou_heng.png b/assets/effect/nianhe/jiekou_heng.png index 520eaaf..ae35908 100644 Binary files a/assets/effect/nianhe/jiekou_heng.png and b/assets/effect/nianhe/jiekou_heng.png differ diff --git a/assets/effect/nianhe/skeleton.png b/assets/effect/nianhe/skeleton.png index f6c3ec3..c6f8e15 100644 Binary files a/assets/effect/nianhe/skeleton.png and b/assets/effect/nianhe/skeleton.png differ diff --git a/assets/effect/star/taopao.png b/assets/effect/star/taopao.png index f7159cc..266a2a9 100644 Binary files a/assets/effect/star/taopao.png and b/assets/effect/star/taopao.png differ diff --git a/assets/effect/touch/fankui.png b/assets/effect/touch/fankui.png index 266a2fb..8479c6e 100644 Binary files a/assets/effect/touch/fankui.png and b/assets/effect/touch/fankui.png differ diff --git a/assets/effect/tuowei/bang.png b/assets/effect/tuowei/bang.png index 6f4d9ec..d9598e1 100644 Binary files a/assets/effect/tuowei/bang.png and b/assets/effect/tuowei/bang.png differ diff --git a/assets/prefab/pop/heathpop.prefab b/assets/prefab/pop/heathpop.prefab index 5c2028f..0a3cdbd 100644 --- a/assets/prefab/pop/heathpop.prefab +++ b/assets/prefab/pop/heathpop.prefab @@ -992,8 +992,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 98, - "height": 98 + "width": 94, + "height": 90 }, "_anchorPoint": { "__type__": "cc.Vec2", diff --git a/assets/res/font/font.png b/assets/res/font/font.png index 1b3c98a..a633885 100644 Binary files a/assets/res/font/font.png and b/assets/res/font/font.png differ diff --git a/assets/resources/Window_Prop/ban.png b/assets/resources/Window_Prop/ban.png index ed91360..1b0ae12 100644 Binary files a/assets/resources/Window_Prop/ban.png and b/assets/resources/Window_Prop/ban.png differ diff --git a/assets/resources/Window_Prop/daoju1.png b/assets/resources/Window_Prop/daoju1.png index 622b70d..81584ed 100644 Binary files a/assets/resources/Window_Prop/daoju1.png and b/assets/resources/Window_Prop/daoju1.png differ diff --git a/assets/resources/Window_Prop/daoju2.png b/assets/resources/Window_Prop/daoju2.png index fcf22a8..6b39c67 100644 Binary files a/assets/resources/Window_Prop/daoju2.png and b/assets/resources/Window_Prop/daoju2.png differ diff --git a/assets/resources/Window_Prop/daoju3.png b/assets/resources/Window_Prop/daoju3.png index cf3fe82..c428ada 100644 Binary files a/assets/resources/Window_Prop/daoju3.png and b/assets/resources/Window_Prop/daoju3.png differ diff --git a/assets/resources/Window_Prop/daoju5.png b/assets/resources/Window_Prop/daoju5.png index 7a90838..35abbe9 100644 Binary files a/assets/resources/Window_Prop/daoju5.png and b/assets/resources/Window_Prop/daoju5.png differ diff --git a/assets/resources/Window_Prop/daoju6.png b/assets/resources/Window_Prop/daoju6.png index 9613b7d..87e32ca 100644 Binary files a/assets/resources/Window_Prop/daoju6.png and b/assets/resources/Window_Prop/daoju6.png differ diff --git a/assets/resources/Window_Prop/daoju7.png b/assets/resources/Window_Prop/daoju7.png index 0c80006..3c3ebc5 100644 Binary files a/assets/resources/Window_Prop/daoju7.png and b/assets/resources/Window_Prop/daoju7.png differ diff --git a/assets/resources/Window_Prop/daoju9.png b/assets/resources/Window_Prop/daoju9.png index 9ad3723..0ee6bd3 100644 Binary files a/assets/resources/Window_Prop/daoju9.png and b/assets/resources/Window_Prop/daoju9.png differ diff --git a/assets/resources/Window_Prop/light1.png b/assets/resources/Window_Prop/light1.png index 67fec52..80b51ba 100644 Binary files a/assets/resources/Window_Prop/light1.png and b/assets/resources/Window_Prop/light1.png differ diff --git a/assets/resources/Window_Prop/light2.png b/assets/resources/Window_Prop/light2.png index c883a8a..a7c523f 100644 Binary files a/assets/resources/Window_Prop/light2.png and b/assets/resources/Window_Prop/light2.png differ diff --git a/assets/resources/Window_Prop/light3.png b/assets/resources/Window_Prop/light3.png index be2d52a..487ac6e 100644 Binary files a/assets/resources/Window_Prop/light3.png and b/assets/resources/Window_Prop/light3.png differ diff --git a/assets/shop/img/chuji.png b/assets/shop/img/chuji.png index f12e036..db42d33 100644 Binary files a/assets/shop/img/chuji.png and b/assets/shop/img/chuji.png differ diff --git a/assets/shop/img/gaoji.png b/assets/shop/img/gaoji.png index a488741..6d585b6 100644 Binary files a/assets/shop/img/gaoji.png and b/assets/shop/img/gaoji.png differ diff --git a/assets/shop/img/shop_1.jpg b/assets/shop/img/shop_1.jpg new file mode 100644 index 0000000..37ae761 Binary files /dev/null and b/assets/shop/img/shop_1.jpg differ diff --git a/assets/shop/img/shop_2.png.meta b/assets/shop/img/shop_1.jpg.meta similarity index 78% rename from assets/shop/img/shop_2.png.meta rename to assets/shop/img/shop_1.jpg.meta index 417d1e6..d0b1c79 100644 --- a/assets/shop/img/shop_2.png.meta +++ b/assets/shop/img/shop_1.jpg.meta @@ -1,6 +1,6 @@ { "ver": "2.3.7", - "uuid": "d0d3a854-9f5c-486f-8a9e-ebd1c96b68b5", + "uuid": "9c710aa3-45b5-43fb-b76f-8d6af41a21d5", "importer": "texture", "type": "sprite", "wrapMode": "clamp", @@ -12,11 +12,11 @@ "height": 2340, "platformSettings": {}, "subMetas": { - "shop_2": { + "shop_1": { "ver": "1.0.6", - "uuid": "1880f261-dd18-4e9e-9f49-b2f194d5ef8f", + "uuid": "403aa689-5ef4-4978-978a-74b806e0760f", "importer": "sprite-frame", - "rawTextureUuid": "d0d3a854-9f5c-486f-8a9e-ebd1c96b68b5", + "rawTextureUuid": "9c710aa3-45b5-43fb-b76f-8d6af41a21d5", "trimType": "auto", "trimThreshold": 1, "rotated": false, diff --git a/assets/shop/img/shop_1.png b/assets/shop/img/shop_1.png index 804da7a..f860a09 100644 Binary files a/assets/shop/img/shop_1.png and b/assets/shop/img/shop_1.png differ diff --git a/assets/shop/img/shop_2.jpg b/assets/shop/img/shop_2.jpg deleted file mode 100644 index ac4268d..0000000 Binary files a/assets/shop/img/shop_2.jpg and /dev/null differ diff --git a/assets/shop/img/shop_2.jpg.meta b/assets/shop/img/shop_2.jpg.meta deleted file mode 100644 index 7e63ae8..0000000 --- a/assets/shop/img/shop_2.jpg.meta +++ /dev/null @@ -1,38 +0,0 @@ -{ - "ver": "2.3.7", - "uuid": "39980b3f-ffc1-450f-90bc-4861aa8c81fb", - "importer": "texture", - "type": "sprite", - "wrapMode": "clamp", - "filterMode": "bilinear", - "premultiplyAlpha": false, - "genMipmaps": false, - "packable": true, - "width": 1080, - "height": 2340, - "platformSettings": {}, - "subMetas": { - "shop_2": { - "ver": "1.0.6", - "uuid": "5652a0a0-3753-477b-afbd-e68830208955", - "importer": "sprite-frame", - "rawTextureUuid": "39980b3f-ffc1-450f-90bc-4861aa8c81fb", - "trimType": "auto", - "trimThreshold": 1, - "rotated": false, - "offsetX": 0, - "offsetY": 0, - "trimX": 0, - "trimY": 0, - "width": 1080, - "height": 2340, - "rawWidth": 1080, - "rawHeight": 2340, - "borderTop": 0, - "borderBottom": 0, - "borderLeft": 0, - "borderRight": 0, - "subMetas": {} - } - } -} \ No newline at end of file diff --git a/assets/shop/img/shop_2.png b/assets/shop/img/shop_2.png deleted file mode 100644 index 83b1d64..0000000 Binary files a/assets/shop/img/shop_2.png and /dev/null differ diff --git a/assets/shop/img/shuzi.png b/assets/shop/img/shuzi.png index 004b8e5..9962517 100644 Binary files a/assets/shop/img/shuzi.png and b/assets/shop/img/shuzi.png differ diff --git a/assets/shop/img/texture_atlas-1.png b/assets/shop/img/texture_atlas-1.png index 27bd975..60088c3 100644 Binary files a/assets/shop/img/texture_atlas-1.png and b/assets/shop/img/texture_atlas-1.png differ diff --git a/assets/shop/img/zhongji.png b/assets/shop/img/zhongji.png index 0b33d8f..9781fbe 100644 Binary files a/assets/shop/img/zhongji.png and b/assets/shop/img/zhongji.png differ diff --git a/assets/shop/prefab/shop.prefab b/assets/shop/prefab/shop.prefab index b6c9e65..b54f643 100644 --- a/assets/shop/prefab/shop.prefab +++ b/assets/shop/prefab/shop.prefab @@ -328,7 +328,7 @@ "_srcBlendFactor": 770, "_dstBlendFactor": 771, "_spriteFrame": { - "__uuid__": "1880f261-dd18-4e9e-9f49-b2f194d5ef8f" + "__uuid__": "403aa689-5ef4-4978-978a-74b806e0760f" }, "_type": 0, "_sizeMode": 0, @@ -4002,7 +4002,7 @@ "component": "", "_componentId": "48bfeZuYFZE2qmgxbW2IigB", "handler": "buyProduct", - "customEventData": "gold_pack_5" + "customEventData": "gold_5" }, { "__type__": "de906iE/HVHpI6VO7IMvKaI", diff --git a/assets/shop/prefab/shop.prefab.meta b/assets/shop/prefab/shop.prefab.meta index ff6a118..6115f2e 100644 --- a/assets/shop/prefab/shop.prefab.meta +++ b/assets/shop/prefab/shop.prefab.meta @@ -2,7 +2,7 @@ "ver": "1.3.2", "uuid": "b01ef5c5-2755-455d-acb4-ba3818f5e331", "importer": "prefab", - "optimizationPolicy": "AUTO", + "optimizationPolicy": "MULTI_INSTANCE", "asyncLoadAssets": false, "readonly": false, "subMetas": {} diff --git a/assets/shop/script/shop.ts b/assets/shop/script/shop.ts index 61801bb..18e7938 100644 --- a/assets/shop/script/shop.ts +++ b/assets/shop/script/shop.ts @@ -30,7 +30,7 @@ export default class NewClass extends cc.Component { private coinStart: number = 0; private coinEnd: number = 0; private coinAnimating: boolean = false; - //飞金币动画 + //飞金币动画 @property(cc.Node) coinAnim: cc.Node = null; private buy: boolean = false; @@ -49,18 +49,19 @@ export default class NewClass extends cc.Component { start() { this.btn_Touch = true; this.openShop(); - this.setHealthInfo(); + this.setHealthInfo(); } //打开商店界面 openShop() { + Utils.outTradeNo = null; // 商品数据数组 const products = [ - { product_id: "gold_1", name: "金币包1", price: 600, coin:1200, title: "3x2六档金币" }, - { product_id: "gold_2", name: "金币包2", price: 3600, coin:8000, title: "" }, - { product_id: "gold_3", name: "金币包3", price: 6800, coin:16000, title: "" }, - { product_id: "gold_4", name: "金币包4", price: 12800, coin:32000, title: "" }, - { product_id: "gold_5", name: "金币包5", price: 32800, coin:100000, title: "" }, - { product_id: "gold_6", name: "金币包6", price: 64800, coin:240000, title: "" }, + { product_id: "gold_1", name: "金币包1", price: 600, coin: 1200, title: "3x2六档金币" }, + { product_id: "gold_2", name: "金币包2", price: 3600, coin: 8000, title: "" }, + { product_id: "gold_3", name: "金币包3", price: 6800, coin: 16000, title: "" }, + { product_id: "gold_4", name: "金币包4", price: 12800, coin: 32000, title: "" }, + { product_id: "gold_5", name: "金币包5", price: 32800, coin: 100000, title: "" }, + { product_id: "gold_6", name: "金币包6", price: 64800, coin: 240000, title: "" }, ]; for (let i = 1; i <= 6 && i < this.itemList.children.length; i++) { const spriteComp = this.itemList.children[i].children[0].getComponent(cc.Sprite); @@ -81,35 +82,35 @@ export default class NewClass extends cc.Component { } } NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); - - } - - -startCoinAnim(target: number) { - if (this.coinAnimating && this.coinEnd === target) return; + } + + + + startCoinAnim(target: number) { + if (this.coinAnimating && this.coinEnd === target) return; this.coinStart = this.currentCoin; this.coinEnd = target; this.coinAnimTime = 0; this.coinAnimating = true; -} + } //优化 -protected update(dt: number): void { - if (this.coin && this.coinAnimating) { - this.coinAnimTime += dt; - let t = this.coinAnimTime / this.coinAnimDuration; - if (t >= 1) { - this.currentCoin = this.coinEnd; - this.coinAnimating = false; - NumberToImage.numberToImageNodes(this.currentCoin, 30, 15, "coin_", this.coin, true); - } else { - this.currentCoin = Math.floor(this.coinStart + (this.coinEnd - this.coinStart) * t); - NumberToImage.numberToImageNodes(this.currentCoin, 30, 15, "coin_", this.coin, true); + protected update(dt: number): void { + if (this.coin && this.coinAnimating) { + this.coinAnimTime += dt; + let t = this.coinAnimTime / this.coinAnimDuration; + if (t >= 1) { + this.currentCoin = this.coinEnd; + this.coinAnimating = false; + NumberToImage.numberToImageNodes(this.currentCoin, 30, 15, "coin_", this.coin, true); + } else { + this.currentCoin = Math.floor(this.coinStart + (this.coinEnd - this.coinStart) * t); + NumberToImage.numberToImageNodes(this.currentCoin, 30, 15, "coin_", this.coin, true); + } } } -} - playCoinAnim(target?: number) { + playCoinAnim(target?: number) { this.coinAnim.active = true; this.coinAnim.getComponent(sp.Skeleton).setAnimation(0, "feijinbi", false); // 监听动画完成事件 @@ -117,7 +118,7 @@ protected update(dt: number): void { // 动画播放完成后销毁节点 this.coinAnim.active = false; }); - this.startCoinAnim(5000); + this.startCoinAnim(5000); } //关闭商店界面 closeShop() { @@ -126,21 +127,26 @@ protected update(dt: number): void { //@ts-ignore wx.offShow(this.onShowListener); } + Utils.outTradeNo = null; //销毁预制体 - if(this.node.parent.getComponent("JiaZai")){ + if (this.node.parent.getComponent("JiaZai")) { this.node.parent.getComponent("JiaZai").closeShop(); } - else if(this.node.parent.getComponent("SceneManager")){ - this.node.parent.getComponent("SceneManager").closeShop(); + else if (this.node.parent.getComponent("SceneManager")) { + this.node.parent.getComponent("SceneManager").closeShop(); } // this.shop.destroy(); } - onShow(){ - if(cc.fx.GameConfig.GM_INFO.iosOutTradeNo != null){ + onShow() { + if (cc.fx.GameConfig.GM_INFO.iosOutTradeNo != null) { console.log("有苹果订单号,开始轮训"); - Utils.getIosPayInfo((data) =>{ - console.log("获得轮训结果:",data); + Utils.getIosPayInfo((data) => { + console.log("获得轮训结果:", data); + if (data.code == 1) { + cc.fx.GameConfig.GM_INFO.iosOutTradeNo = null; + MiniGameSdk.API.showToast("购买金币成功"); + } }) } } @@ -166,7 +172,7 @@ protected update(dt: number): void { } } - startTimeCutDown() { + startTimeCutDown() { this.scheduleCallback = function () { if (this.pause) return; if (cc.fx.GameConfig.GM_INFO.min_Time <= 0) { @@ -204,7 +210,7 @@ protected update(dt: number): void { //点击充值购买 buyProduct(event, customData) { - if(!this.btn_Touch){ + if (!this.btn_Touch) { return; } this.btn_Touch = false; @@ -213,7 +219,7 @@ protected update(dt: number): void { let price = 100; let count = 1; id = productId; - switch(productId){ + switch (productId) { case "gold_1": price = 600; break; @@ -231,13 +237,13 @@ protected update(dt: number): void { break; case "gold_6": price = 64800; - break; + break; } - console.log("获得商品id:",id,count,price); + console.log("获得商品id:", id, count, price); // 判断设备系统 let systemType = "Android"; try { - //@ts-ignore + //@ts-ignore const systemInfo = wx.getSystemInfoSync(); if (systemInfo.platform === 'ios') { systemType = "ios"; @@ -247,104 +253,105 @@ protected update(dt: number): void { } // Utils.GoKEFu(); - if(systemType == "ios"){ + if (systemType == "ios") { MiniGameSdk.API.showToast("IOS系统暂不支持支付"); + this.btn_Touch = true; // Utils.GoKEFu(); } - else{ + else { const data = { - outTradeNo:Utils.outTradeNo, - price:price, - payment_name:productId, - payment_num:1, - type:systemType, + outTradeNo: Utils.outTradeNo, + price: price, + payment_name: productId, + payment_num: 1, + type: systemType, } - cc.fx.GameTool.shushu_Track("init_order",data); + cc.fx.GameTool.shushu_Track("init_order", data); - Utils.buyProp(id,count,price,(res)=>{ - console.log("获得充值结果",res); - if(res == null){ + Utils.buyProp(id, count, price, (res) => { + console.log("获得充值结果", res); + if (res == null) { MiniGameSdk.API.showToast("网络异常,充值失败请稍后再试"); this.btn_Touch = true; const dataFail = { - outTradeNo:Utils.outTradeNo, - price:price, - payment_name:productId, - payment_num:1, - type:systemType, - fail_reason:"网络异常,没有拉起支付", + outTradeNo: Utils.outTradeNo, + price: price, + payment_name: productId, + payment_num: 1, + type: systemType, + fail_reason: "网络异常,没有拉起支付", } - cc.fx.GameTool.shushu_Track("payment_fail",dataFail); + cc.fx.GameTool.shushu_Track("payment_fail", dataFail); return; } - else{ - Utils.getPayInfo((data) =>{ - console.log("获得轮训结果:",data); - if(data.data.pay_state == 1){ + else { + Utils.getPayInfo((data) => { + console.log("获得轮训结果:", data); + if (data.data.pay_state == 1) { this.btn_Touch = true; MiniGameSdk.API.showToast("取消充值"); - const dataFail2 = { - outTradeNo:Utils.outTradeNo, - price:price, - payment_name:productId, - payment_num:1, - type:systemType, - fail_reason:"用户取消支付", - } - cc.fx.GameTool.shushu_Track("payment_fail",name); + const dataFail2 = { + outTradeNo: Utils.outTradeNo, + price: price, + payment_name: productId, + payment_num: 1, + type: systemType, + fail_reason: "用户取消支付", + } + 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; Utils.setPayInfo((data) => { - console.log("设置轮训结果:",data); - if(data.code === 1){ + console.log("设置轮训结果:", data); + if (data.code === 1) { MiniGameSdk.API.showToast("充值成功"); cc.fx.GameTool.shopBuy(productId); console.log("充值成功获得金币"); const dataSuccess = { - outTradeNo:Utils.outTradeNo, - price:price, - payment_name:productId, - payment_num:1, - type:systemType, + outTradeNo: Utils.outTradeNo, + price: price, + payment_name: productId, + payment_num: 1, + type: systemType, } - cc.fx.GameTool.shushu_Track("payment",dataSuccess); - let name = "购买金币道具:"+ productId; - MiniGameSdk.API.yinli_Pay(price,Utils.outTradeNo,name) + cc.fx.GameTool.shushu_Track("payment", dataSuccess); + let name = "购买金币道具:" + productId; + MiniGameSdk.API.yinli_Pay(price, Utils.outTradeNo, name) } - else{ + else { MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放"); const dataFail4 = { - outTradeNo:Utils.outTradeNo, - price:price, - payment_name:productId, - payment_num:1, - type:systemType, - fail_reason:"成功付款,但是发货时请求服务器失败,充值成功未发货", + outTradeNo: Utils.outTradeNo, + price: price, + payment_name: productId, + payment_num: 1, + type: systemType, + 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); this.node.parent.getComponent("JiaZai").updateCoin(); }) } - else{ + else { NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); this.node.parent.getComponent("JiaZai").updateCoin(); const dataFail3 = { - outTradeNo:Utils.outTradeNo, - price:price, - payment_name:productId, - payment_num:1, - type:systemType, - fail_reason:"拉起支付后,付款时网络异常付款失败", + outTradeNo: Utils.outTradeNo, + price: price, + payment_name: productId, + payment_num: 1, + type: systemType, + fail_reason: "拉起支付后,付款时网络异常付款失败", } - cc.fx.GameTool.shushu_Track("payment_fail",dataFail3); + cc.fx.GameTool.shushu_Track("payment_fail", dataFail3); } }) } - }); + }); } } diff --git a/assets/shop/spin/feijinbi.png b/assets/shop/spin/feijinbi.png index d2f1383..b26196b 100644 Binary files a/assets/shop/spin/feijinbi.png and b/assets/shop/spin/feijinbi.png differ diff --git a/assets/shop/spin/mofabang_texiao/mofabang_baozha.png b/assets/shop/spin/mofabang_texiao/mofabang_baozha.png index 1a49c4c..17e06ee 100644 Binary files a/assets/shop/spin/mofabang_texiao/mofabang_baozha.png and b/assets/shop/spin/mofabang_texiao/mofabang_baozha.png differ diff --git a/assets/shop/spin/mofabang_texiao/mofabang_texiao.png b/assets/shop/spin/mofabang_texiao/mofabang_texiao.png index e3bfff2..f9be12a 100644 Binary files a/assets/shop/spin/mofabang_texiao/mofabang_texiao.png and b/assets/shop/spin/mofabang_texiao/mofabang_texiao.png differ diff --git a/assets/shop/spin/particle/LiZi1.png b/assets/shop/spin/particle/LiZi1.png index 28f3855..630a981 100644 Binary files a/assets/shop/spin/particle/LiZi1.png and b/assets/shop/spin/particle/LiZi1.png differ diff --git a/assets/shop/spin/particle/bang.png b/assets/shop/spin/particle/bang.png index 6f4d9ec..d9598e1 100644 Binary files a/assets/shop/spin/particle/bang.png and b/assets/shop/spin/particle/bang.png differ diff --git a/assets/shop/spin/particle/flash.png b/assets/shop/spin/particle/flash.png index c261a22..c251194 100644 Binary files a/assets/shop/spin/particle/flash.png and b/assets/shop/spin/particle/flash.png differ diff --git a/settings/builder.json b/settings/builder.json index 7165a3d..e007733 100644 --- a/settings/builder.json +++ b/settings/builder.json @@ -15,7 +15,7 @@ "mainCompressionType": "subpackage", "mainIsRemote": false, "optimizeHotUpdate": false, - "md5Cache": true, + "md5Cache": false, "nativeMd5Cache": true, "encryptJs": true, "xxteaKey": "07ac496c-82b0-4f",