Compare commits
No commits in common. "499f1bdb19f9b8de765cb1614268f0e891a4c2c7" and "1d409fcae047ac4532e8da6e2ad3ec593de23f9d" have entirely different histories.
499f1bdb19
...
1d409fcae0
|
@ -251,8 +251,8 @@ export default class GameManager extends cc.Component {
|
||||||
Utils.getUserInfo((data) => {
|
Utils.getUserInfo((data) => {
|
||||||
if (data.code == 1) { // 假设返回数据中有 success 字段表示成功
|
if (data.code == 1) { // 假设返回数据中有 success 字段表示成功
|
||||||
//console.log("登录成功时间耗时:", Date.now() - this.nowTime);
|
//console.log("登录成功时间耗时:", Date.now() - this.nowTime);
|
||||||
// console.log("111登陆成功_____________");
|
console.log("登陆成功_____________");
|
||||||
console.log("登錄", data);
|
console.log(data);
|
||||||
//console.log("uid", data.data.onlyId);
|
//console.log("uid", data.data.onlyId);
|
||||||
if (data.data._id) {
|
if (data.data._id) {
|
||||||
cc.fx.GameConfig.GM_INFO.uid = data.data._id;
|
cc.fx.GameConfig.GM_INFO.uid = data.data._id;
|
||||||
|
@ -270,7 +270,7 @@ export default class GameManager extends cc.Component {
|
||||||
//console.log("______________________________有未发放奖励", cc.fx.GameConfig.GM_INFO.allOutTradeNo);
|
//console.log("______________________________有未发放奖励", cc.fx.GameConfig.GM_INFO.allOutTradeNo);
|
||||||
}
|
}
|
||||||
if (data.data.shareLv) {
|
if (data.data.shareLv) {
|
||||||
console.log("有分享信息", data.data.shareLv)
|
console.log("有补发信息", data.data.shareLv)
|
||||||
if (data.data.shareLv.length > 0) {
|
if (data.data.shareLv.length > 0) {
|
||||||
console.log(data.data.shareLv[0]);
|
console.log(data.data.shareLv[0]);
|
||||||
console.log("设置分享等级", data.data.shareLv[0].lv);
|
console.log("设置分享等级", data.data.shareLv[0].lv);
|
||||||
|
|
|
@ -667,6 +667,9 @@ export default class JiaZai extends cc.Component {
|
||||||
console.log("设置轮训结果:", res);
|
console.log("设置轮训结果:", res);
|
||||||
this.closeLoad();
|
this.closeLoad();
|
||||||
if (res.code === 1) {
|
if (res.code === 1) {
|
||||||
|
if (order.itemid == "reborn_Gift") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log("7.14_________正式发货");
|
console.log("7.14_________正式发货");
|
||||||
let coinTemp = 0;
|
let coinTemp = 0;
|
||||||
if (order.itemid == "gold_1") { coinTemp = 1200; }
|
if (order.itemid == "gold_1") { coinTemp = 1200; }
|
||||||
|
@ -684,9 +687,6 @@ export default class JiaZai extends cc.Component {
|
||||||
cc.fx.GameConfig.GM_INFO.hp_Max = 7;
|
cc.fx.GameConfig.GM_INFO.hp_Max = 7;
|
||||||
cc.fx.GameConfig.GM_INFO.hp = 7;
|
cc.fx.GameConfig.GM_INFO.hp = 7;
|
||||||
}
|
}
|
||||||
else if (order.itemid == "reborn_Gift") {
|
|
||||||
coinTemp = 1000;
|
|
||||||
}
|
|
||||||
let title = "充值补发奖励金币:" + coinTemp;
|
let title = "充值补发奖励金币:" + coinTemp;
|
||||||
// MiniGameSdk.API.showToast(title);
|
// MiniGameSdk.API.showToast(title);
|
||||||
cc.fx.GameTool.shopBuy(productId, true);
|
cc.fx.GameTool.shopBuy(productId, true);
|
||||||
|
@ -712,7 +712,7 @@ export default class JiaZai extends cc.Component {
|
||||||
let price = order.price || 0;
|
let price = order.price || 0;
|
||||||
const dataSuccess = {
|
const dataSuccess = {
|
||||||
outTradeNo: order.outTradeNo,
|
outTradeNo: order.outTradeNo,
|
||||||
pay_amount: price,
|
price: price,
|
||||||
payment_name: productId,
|
payment_name: productId,
|
||||||
payment_num: 1,
|
payment_num: 1,
|
||||||
type: systemType,
|
type: systemType,
|
||||||
|
|
|
@ -31,6 +31,14 @@ export default class Revive extends cc.Component {
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
|
@ -49,7 +57,7 @@ export default class Revive extends cc.Component {
|
||||||
console.log("购买成功");
|
console.log("购买成功");
|
||||||
const dataSuccess = {
|
const dataSuccess = {
|
||||||
outTradeNo: iosOutTradeNo,
|
outTradeNo: iosOutTradeNo,
|
||||||
pay_amount: this.iosPrice,
|
price: this.iosPrice,
|
||||||
payment_name: this.iosProductId,
|
payment_name: this.iosProductId,
|
||||||
payment_num: this.iosCount,
|
payment_num: this.iosCount,
|
||||||
type: "ios",
|
type: "ios",
|
||||||
|
@ -132,15 +140,7 @@ export default class Revive extends cc.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init() {
|
init() {
|
||||||
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
console.log()
|
||||||
this.onShowListener = null;
|
|
||||||
// 定义监听函数
|
|
||||||
this.onShowListener = () => {
|
|
||||||
this.onShow();
|
|
||||||
};
|
|
||||||
//@ts-ignore
|
|
||||||
wx.onShow(this.onShowListener);
|
|
||||||
}
|
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
if (cc.fx.GameConfig.GM_INFO.revive == 1) {
|
if (cc.fx.GameConfig.GM_INFO.revive == 1) {
|
||||||
this.node.active = false;
|
this.node.active = false;
|
||||||
|
@ -152,35 +152,35 @@ export default class Revive extends cc.Component {
|
||||||
Utils.rebornGift(1, (data) => {
|
Utils.rebornGift(1, (data) => {
|
||||||
console.log("购买'✅ ", data.code);
|
console.log("购买'✅ ", data.code);
|
||||||
if (data.code == 1) {
|
if (data.code == 1) {
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// update (dt) {}
|
// update (dt) {}
|
||||||
}
|
}
|
||||||
//发奖励
|
//发奖励
|
||||||
revivew() {
|
revivew() {
|
||||||
MapConroler._instance.setPropNum();
|
MapConroler._instance.setPropNum();
|
||||||
const jiazaiNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点
|
const jiazaiNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点
|
||||||
const jiazaiComp = jiazaiNode.getComponent(JiaZai);
|
const jiazaiComp = jiazaiNode.getComponent(JiaZai);
|
||||||
if (jiazaiComp) {
|
if (jiazaiComp) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
jiazaiComp.updateCoin();
|
jiazaiComp.updateCoin();
|
||||||
}, 300);
|
}, 300);
|
||||||
} else {
|
} else {
|
||||||
console.log("无法获取JiaZai组件");
|
console.log("无法获取JiaZai组件");
|
||||||
}
|
}
|
||||||
let shop = cc.find("Canvas/shop");
|
let shop = cc.find("Canvas/shop");
|
||||||
if (shop) {
|
if (shop) {
|
||||||
let shopComp = shop.getComponent("shop");
|
let shopComp = shop.getComponent("shop");
|
||||||
if (shopComp) {
|
if (shopComp) {
|
||||||
shopComp.openShop();
|
shopComp.openShop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cc.fx.GameConfig.GM_INFO.revive = 1;
|
cc.fx.GameConfig.GM_INFO.revive = 1;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.node.active = false;
|
this.node.active = false;
|
||||||
}, 200);
|
}, 200);
|
||||||
MapConroler._instance.runRewiveCopy();
|
MapConroler._instance.runRewiveCopy();
|
||||||
}
|
}
|
||||||
buyProduct(customData) {
|
buyProduct(customData) {
|
||||||
// cc.fx.GameTool.shopBuy("revive", false);
|
// cc.fx.GameTool.shopBuy("revive", false);
|
||||||
|
@ -305,7 +305,7 @@ export default class Revive extends cc.Component {
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
const dataSuccess = {
|
const dataSuccess = {
|
||||||
outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
pay_amount: price,
|
price: price,
|
||||||
payment_name: productId,
|
payment_name: productId,
|
||||||
payment_num: 1,
|
payment_num: 1,
|
||||||
type: systemType,
|
type: systemType,
|
||||||
|
|
|
@ -62,11 +62,6 @@ export default class Reward extends cc.Component {
|
||||||
*/
|
*/
|
||||||
init(data) {
|
init(data) {
|
||||||
this.actionOver = false;
|
this.actionOver = false;
|
||||||
if (!data) {
|
|
||||||
this.actionOver = true;
|
|
||||||
this.node.destroy();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const num = Math.min(data.length, 9); // 确保 num 不超过 9
|
const num = Math.min(data.length, 9); // 确保 num 不超过 9
|
||||||
const spacing = 10; // 间隔,默认 10
|
const spacing = 10; // 间隔,默认 10
|
||||||
if (this.rewardNode && num > 0) {
|
if (this.rewardNode && num > 0) {
|
||||||
|
|
|
@ -420,7 +420,7 @@ export default class SceneManager extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
openRewardWindow(data) {
|
openRewardWindow(data) {
|
||||||
console.log("_____________________打开奖励弹窗", data);
|
console.log("_____________________打開獎勵弹窗");
|
||||||
if (!SceneManager.cachedRewardPrefab) {
|
if (!SceneManager.cachedRewardPrefab) {
|
||||||
cc.error('Reward prefab is not loaded yet.');
|
cc.error('Reward prefab is not loaded yet.');
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default class Utils {
|
||||||
static getUserInfo(callBack) {
|
static getUserInfo(callBack) {
|
||||||
wx.login({
|
wx.login({
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log("微信login成功");
|
console.log("登录成功");
|
||||||
console.log(res);
|
console.log(res);
|
||||||
if (res.code) {
|
if (res.code) {
|
||||||
Utils.POST("login", { code: res.code }, ret => {
|
Utils.POST("login", { code: res.code }, ret => {
|
||||||
|
@ -167,19 +167,17 @@ export default class Utils {
|
||||||
payment_num: iosPayInfo.payment_count,
|
payment_num: iosPayInfo.payment_count,
|
||||||
type: "ios",
|
type: "ios",
|
||||||
}
|
}
|
||||||
console.log("ios创建订单信息:", data);
|
|
||||||
cc.fx.GameTool.shushu_Track("init_order", shushu_data);
|
cc.fx.GameTool.shushu_Track("init_order", shushu_data);
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.openCustomerServiceConversation({
|
wx.openCustomerServiceConversation({
|
||||||
sessionFrom: JSON.stringify(data), // 会话来源(可选)
|
sessionFrom: JSON.stringify(data), // 会话来源(可选)
|
||||||
showMessageCard: false, // 是否展示消息卡片
|
showMessageCard: false, // 是否展示消息卡片
|
||||||
success() {
|
success() {
|
||||||
callBack("success");
|
callBack();
|
||||||
console.log('客服会话已successr');
|
console.log('客服会话已打开');
|
||||||
},
|
},
|
||||||
fail() {
|
fail() {
|
||||||
console.log('客服会话已over');
|
callBack();
|
||||||
callBack("fail");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -218,10 +216,7 @@ export default class Utils {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
setTimeout(() => {
|
poll();
|
||||||
poll();
|
|
||||||
}, 500);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//#endregion
|
//#endregion
|
||||||
|
@ -1023,5 +1018,19 @@ export default class Utils {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// const propName={
|
||||||
|
// gold_1: "金币包1",
|
||||||
|
// gold_2: "金币包2",
|
||||||
|
// gold_3: "金币包3",
|
||||||
|
// gold_4: "金币包4",
|
||||||
|
// gold_5: "金币包5",
|
||||||
|
// gold_6: "金币包6",
|
||||||
|
// unlimited_health_bundle_1:"无限体力组合包1",
|
||||||
|
// unlimited_health_bundle_2:"无限体力组合包2",
|
||||||
|
// unlimited_health_bundle_3:"无限体力组合包3",
|
||||||
|
// freeze_in_game:"局内购买冻结",
|
||||||
|
// hammer_in_game:"局内购买锤子",
|
||||||
|
// wand_in_gamerefill:"局内购买魔棒",
|
||||||
|
// health:"补满体力"
|
||||||
|
// };
|
||||||
}
|
}
|
||||||
|
|
|
@ -974,8 +974,7 @@ var GameTool = {
|
||||||
let getCoin = 0;
|
let getCoin = 0;
|
||||||
|
|
||||||
var rewardData = null;
|
var rewardData = null;
|
||||||
console.log(productId);
|
|
||||||
console.log("发放奖励");
|
|
||||||
switch (productId) {
|
switch (productId) {
|
||||||
case "gold_1":
|
case "gold_1":
|
||||||
cc.fx.GameTool.changeCoin(1200);
|
cc.fx.GameTool.changeCoin(1200);
|
||||||
|
@ -1111,6 +1110,8 @@ var GameTool = {
|
||||||
}
|
}
|
||||||
this.getShopProp(propData3, compensate);
|
this.getShopProp(propData3, compensate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,14 @@ export default class NewClass extends cc.Component {
|
||||||
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);
|
||||||
|
}
|
||||||
this.home = 0;
|
this.home = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +64,7 @@ export default class NewClass extends cc.Component {
|
||||||
console.log("购买成功");
|
console.log("购买成功");
|
||||||
const dataSuccess = {
|
const dataSuccess = {
|
||||||
outTradeNo: iosOutTradeNo,
|
outTradeNo: iosOutTradeNo,
|
||||||
pay_amount: this.iosPrice,
|
price: this.iosPrice,
|
||||||
payment_name: this.iosProductId,
|
payment_name: this.iosProductId,
|
||||||
payment_num: this.iosCount,
|
payment_num: this.iosCount,
|
||||||
type: "ios",
|
type: "ios",
|
||||||
|
@ -148,15 +156,6 @@ export default class NewClass extends cc.Component {
|
||||||
|
|
||||||
}
|
}
|
||||||
init() {
|
init() {
|
||||||
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
|
||||||
this.onShowListener = null;
|
|
||||||
// 定义监听函数
|
|
||||||
this.onShowListener = () => {
|
|
||||||
this.onShow();
|
|
||||||
};
|
|
||||||
//@ts-ignore
|
|
||||||
wx.onShow(this.onShowListener);
|
|
||||||
}
|
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
if (cc.fx.GameConfig.GM_INFO.hp_Max == 7) {
|
if (cc.fx.GameConfig.GM_INFO.hp_Max == 7) {
|
||||||
this.monthCardBtn.active = false;
|
this.monthCardBtn.active = false;
|
||||||
|
@ -406,7 +405,7 @@ export default class NewClass extends cc.Component {
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
const dataSuccess = {
|
const dataSuccess = {
|
||||||
outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
pay_amount: price,
|
price: price,
|
||||||
payment_name: productId,
|
payment_name: productId,
|
||||||
payment_num: 1,
|
payment_num: 1,
|
||||||
type: systemType,
|
type: systemType,
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
"ver": "1.1.3",
|
|
||||||
"uuid": "822b01d9-1503-471f-9590-548862a52e72",
|
|
||||||
"importer": "folder",
|
|
||||||
"isBundle": false,
|
|
||||||
"bundleName": "",
|
|
||||||
"priority": 1,
|
|
||||||
"compressionType": {},
|
|
||||||
"optimizeHotUpdate": {},
|
|
||||||
"inlineSpriteFrames": {},
|
|
||||||
"isRemoteBundle": {},
|
|
||||||
"subMetas": {}
|
|
||||||
}
|
|
|
@ -756,7 +756,7 @@
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 1080,
|
"width": 1080,
|
||||||
"height": 3200
|
"height": 3350
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
|
@ -768,7 +768,7 @@
|
||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
55.944,
|
900,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -824,19 +824,19 @@
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 1080,
|
"width": 1080,
|
||||||
"height": 1700
|
"height": 2000
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
"x": 0.5,
|
"x": 0.5,
|
||||||
"y": 1
|
"y": 0.5
|
||||||
},
|
},
|
||||||
"_trs": {
|
"_trs": {
|
||||||
"__type__": "TypedArray",
|
"__type__": "TypedArray",
|
||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
885.733,
|
-73.284,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -13941,7 +13941,7 @@
|
||||||
"component": "",
|
"component": "",
|
||||||
"_componentId": "48bfeZuYFZE2qmgxbW2IigB",
|
"_componentId": "48bfeZuYFZE2qmgxbW2IigB",
|
||||||
"handler": "closeShop",
|
"handler": "closeShop",
|
||||||
"customEventData": "exit"
|
"customEventData": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.PrefabInfo",
|
"__type__": "cc.PrefabInfo",
|
||||||
|
@ -14892,12 +14892,12 @@
|
||||||
"Stamina": {
|
"Stamina": {
|
||||||
"__id__": 319
|
"__id__": 319
|
||||||
},
|
},
|
||||||
"monthCardTime": {
|
|
||||||
"__id__": 28
|
|
||||||
},
|
|
||||||
"coinAnim": {
|
"coinAnim": {
|
||||||
"__id__": 377
|
"__id__": 377
|
||||||
},
|
},
|
||||||
|
"monthCardTime": {
|
||||||
|
"__id__": 28
|
||||||
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,15 @@ export default class NewClass extends cc.Component {
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
this.monthCard = false;
|
this.monthCard = false;
|
||||||
// 检测微信小游戏切到后台
|
// 检测微信小游戏切到后台
|
||||||
|
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;
|
||||||
|
@ -61,16 +69,6 @@ export default class NewClass extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.onShowListener = null;
|
|
||||||
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
|
||||||
// 定义监听函数
|
|
||||||
this.onShowListener = () => {
|
|
||||||
console.log("回到前台");
|
|
||||||
this.onShow();
|
|
||||||
};
|
|
||||||
//@ts-ignore
|
|
||||||
wx.onShow(this.onShowListener);
|
|
||||||
}
|
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
var timeTemp = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
|
var timeTemp = cc.fx.GameTool.getTimeMargin(cc.fx.GameConfig.GM_INFO.min_Time);
|
||||||
// 同步显示
|
// 同步显示
|
||||||
|
@ -82,20 +80,19 @@ export default class NewClass extends cc.Component {
|
||||||
this.updatePower();
|
this.updatePower();
|
||||||
this.setHealthInfo(true);
|
this.setHealthInfo(true);
|
||||||
this.updateIcon();
|
this.updateIcon();
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
|
||||||
}
|
}
|
||||||
//打开商店界面
|
//打开商店界面
|
||||||
openShop() {
|
openShop() {
|
||||||
Utils.outTradeNo = null;
|
Utils.outTradeNo = null;
|
||||||
// 商品数据数组
|
// 商品数据数组
|
||||||
const products = [
|
const products = [
|
||||||
{ product_id: "gold_1", price: 600, coin: 1200, title: "3x2六档金币" },
|
{ product_id: "gold_1", name: "金币包1", price: 600, coin: 1200, title: "3x2六档金币" },
|
||||||
{ product_id: "gold_1", price: 600, coin: 1200, title: "3x2六档金币" },
|
{ product_id: "gold_1", name: "金币包1", price: 600, coin: 1200, title: "3x2六档金币" },
|
||||||
{ product_id: "gold_2", price: 3600, coin: 8000, title: "" },
|
{ product_id: "gold_2", name: "金币包2", price: 3600, coin: 8000, title: "" },
|
||||||
{ product_id: "gold_3", price: 6800, coin: 16000, title: "" },
|
{ product_id: "gold_3", name: "金币包3", price: 6800, coin: 16000, title: "" },
|
||||||
{ product_id: "gold_4", price: 12800, coin: 32000, title: "" },
|
{ product_id: "gold_4", name: "金币包4", price: 12800, coin: 32000, title: "" },
|
||||||
{ product_id: "gold_5", price: 32800, coin: 100000, title: "" },
|
{ product_id: "gold_5", name: "金币包5", price: 32800, coin: 100000, title: "" },
|
||||||
{ product_id: "gold_6", price: 64800, coin: 240000, title: "" },
|
{ product_id: "gold_6", name: "金币包6", price: 64800, coin: 240000, title: "" },
|
||||||
];
|
];
|
||||||
for (let i = 2; i <= 7 && i < this.itemList.children.length; i++) {
|
for (let i = 2; i <= 7 && i < this.itemList.children.length; i++) {
|
||||||
const spriteComp = this.itemList.children[i].children[0].getComponent(cc.Sprite);
|
const spriteComp = this.itemList.children[i].children[0].getComponent(cc.Sprite);
|
||||||
|
@ -155,11 +152,9 @@ export default class NewClass extends cc.Component {
|
||||||
this.startCoinAnim(5000);
|
this.startCoinAnim(5000);
|
||||||
}
|
}
|
||||||
//关闭商店界面
|
//关闭商店界面
|
||||||
closeShop(data, currentCoin) {
|
closeShop() {
|
||||||
// 移除 wx.onShow 监听器
|
// 移除 wx.onShow 监听器
|
||||||
if (cc.sys.platform === cc.sys.WECHAT_GAME && this.onShowListener) {
|
if (cc.sys.platform === cc.sys.WECHAT_GAME && this.onShowListener) {
|
||||||
console.log("!!!!!!!!!!移除onshow");
|
|
||||||
console.log(currentCoin);
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.offShow(this.onShowListener);
|
wx.offShow(this.onShowListener);
|
||||||
}
|
}
|
||||||
|
@ -187,120 +182,109 @@ export default class NewClass extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
console.log("从后台进入前台 onShow");
|
|
||||||
//如果月卡打开就return
|
//如果月卡打开就return
|
||||||
if (this.monthCard) {
|
if (this.monthCard) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const systemInfo = wx.getSystemInfoSync();
|
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
||||||
if (systemInfo.platform === 'ios') {
|
console.log("从后台进入前台订单号:", cc.fx.GameConfig.GM_INFO.iosOutTradeNo);
|
||||||
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
if (cc.fx.GameConfig.GM_INFO.iosOutTradeNo != null && cc.fx.GameConfig.GM_INFO.iosOutTradeNo != "") {
|
||||||
console.log("从后台进入前台订单号:", cc.fx.GameConfig.GM_INFO.iosOutTradeNo);
|
console.log("有苹果订单号,开始轮训");
|
||||||
this.closeLoad();
|
const iosOutTradeNo = cc.fx.GameConfig.GM_INFO.iosOutTradeNo;
|
||||||
if (cc.fx.GameConfig.GM_INFO.iosOutTradeNo != null && cc.fx.GameConfig.GM_INFO.iosOutTradeNo != "") {
|
cc.fx.GameConfig.GM_INFO.iosOutTradeNo = "";
|
||||||
console.log("有苹果订单号,开始轮训");
|
this.openLoad();
|
||||||
const iosOutTradeNo = cc.fx.GameConfig.GM_INFO.iosOutTradeNo;
|
this.btn_Touch = true;
|
||||||
cc.fx.GameConfig.GM_INFO.iosOutTradeNo = "";
|
Utils.getIosPayInfo(iosOutTradeNo,
|
||||||
this.openLoad();
|
(data) => {
|
||||||
this.btn_Touch = true;
|
console.log("获得轮训结果:", data);
|
||||||
Utils.getIosPayInfo(iosOutTradeNo,
|
if (data.code == 1) {
|
||||||
(data) => {
|
console.log("购买成功");
|
||||||
console.log("获得轮训结果:", data);
|
const dataSuccess = {
|
||||||
if (data.code == 1) {
|
outTradeNo: iosOutTradeNo,
|
||||||
console.log("购买成功");
|
price: this.iosPrice,
|
||||||
const iosID = data.data.payment_name;
|
payment_name: this.iosProductId,
|
||||||
console.log("商品id:", iosID);
|
payment_num: this.iosCount,
|
||||||
const dataSuccess = {
|
type: "ios",
|
||||||
outTradeNo: iosOutTradeNo,
|
|
||||||
pay_amount: this.iosPrice,
|
|
||||||
payment_name: iosID,
|
|
||||||
payment_num: this.iosCount,
|
|
||||||
type: "ios",
|
|
||||||
}
|
|
||||||
cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
|
||||||
let name = "购买金币道具:" + this.iosProductId;
|
|
||||||
let version = cc.fx.GameTool.getWechatGameVersion();
|
|
||||||
if (version == "正式版") {
|
|
||||||
MiniGameSdk.API.yinli_Pay(this.iosPrice, iosOutTradeNo, name)
|
|
||||||
}
|
|
||||||
|
|
||||||
Utils.setPayInfo(
|
|
||||||
(res) => {
|
|
||||||
this.closeLoad();
|
|
||||||
//console.log("设置轮训结果:", res);
|
|
||||||
if (res.code === 1) {
|
|
||||||
console.log("_________正式发货", iosID);
|
|
||||||
MiniGameSdk.API.showToast("充值成功");
|
|
||||||
cc.fx.GameTool.shopBuy(iosID, false);
|
|
||||||
if (iosID == "unlimited_health_bundle_1" ||
|
|
||||||
iosID == "unlimited_health_bundle_2" ||
|
|
||||||
iosID == "unlimited_health_bundle_3"
|
|
||||||
) {
|
|
||||||
this.updatePower();
|
|
||||||
}
|
|
||||||
//console.log("充值成功获得金币");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
|
||||||
const dataFail4 = {
|
|
||||||
outTradeNo: iosOutTradeNo,
|
|
||||||
price: this.iosPrice,
|
|
||||||
payment_name: iosID,
|
|
||||||
payment_num: this.iosCount,
|
|
||||||
type: "ios",
|
|
||||||
fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货",
|
|
||||||
}
|
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
|
||||||
}
|
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
|
||||||
if (this.node.parent.getComponent("JiaZai"))
|
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
|
||||||
else if (this.node.parent.getComponent("SceneManager")) {
|
|
||||||
this.node.parent.getComponent("SceneManager").updateCoin();
|
|
||||||
}
|
|
||||||
}, iosOutTradeNo)
|
|
||||||
}
|
}
|
||||||
else if (data.code == 0) {
|
cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
||||||
console.log("用户自己取消充值");
|
let name = "购买金币道具:" + this.iosProductId;
|
||||||
MiniGameSdk.API.showToast("充值失败");
|
let version = cc.fx.GameTool.getWechatGameVersion();
|
||||||
this.closeLoad();
|
if (version == "正式版") {
|
||||||
this.btn_Touch = true;
|
MiniGameSdk.API.yinli_Pay(this.iosPrice, iosOutTradeNo, name)
|
||||||
const dataFail = {
|
|
||||||
outTradeNo: iosOutTradeNo,
|
|
||||||
price: this.iosPrice,
|
|
||||||
payment_name: this.iosProductId,
|
|
||||||
payment_num: this.iosCount,
|
|
||||||
type: "ios",
|
|
||||||
fail_reason: "用户取消充值",
|
|
||||||
}
|
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
|
||||||
}
|
|
||||||
else if (data.code == 2) {
|
|
||||||
this.closeLoad();
|
|
||||||
console.log("轮训超时");
|
|
||||||
MiniGameSdk.API.showToast("订单已关闭");
|
|
||||||
const dataFail = {
|
|
||||||
outTradeNo: iosOutTradeNo,
|
|
||||||
price: this.iosPrice,
|
|
||||||
payment_name: this.iosProductId,
|
|
||||||
payment_num: this.iosCount,
|
|
||||||
type: "ios",
|
|
||||||
fail_reason: "用户充值后,轮训结果超时",
|
|
||||||
}
|
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Utils.setPayInfo(
|
||||||
|
(res) => {
|
||||||
|
this.closeLoad();
|
||||||
|
//console.log("设置轮训结果:", res);
|
||||||
|
if (res.code === 1) {
|
||||||
|
console.log("_________正式发货");
|
||||||
|
MiniGameSdk.API.showToast("充值成功");
|
||||||
|
cc.fx.GameTool.shopBuy(this.iosProductId, false);
|
||||||
|
if (this.iosProductId == "unlimited_health_bundle_1" ||
|
||||||
|
this.iosProductId == "unlimited_health_bundle_2" ||
|
||||||
|
this.iosProductId == "unlimited_health_bundle_3"
|
||||||
|
) {
|
||||||
|
this.updatePower();
|
||||||
|
}
|
||||||
|
//console.log("充值成功获得金币");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
||||||
|
const dataFail4 = {
|
||||||
|
outTradeNo: iosOutTradeNo,
|
||||||
|
price: this.iosPrice,
|
||||||
|
payment_name: this.iosProductId,
|
||||||
|
payment_num: this.iosCount,
|
||||||
|
type: "ios",
|
||||||
|
fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货",
|
||||||
|
}
|
||||||
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
||||||
|
}
|
||||||
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
|
else if (this.node.parent.getComponent("SceneManager")) {
|
||||||
|
this.node.parent.getComponent("SceneManager").updateCoin();
|
||||||
|
}
|
||||||
|
}, iosOutTradeNo)
|
||||||
|
}
|
||||||
|
else if (data.code == 0) {
|
||||||
|
console.log("用户自己取消充值");
|
||||||
|
MiniGameSdk.API.showToast("充值失败");
|
||||||
|
this.closeLoad();
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
cc.fx.GameConfig.GM_INFO.iosOutTradeNo = null;
|
const dataFail = {
|
||||||
})
|
outTradeNo: iosOutTradeNo,
|
||||||
}
|
price: this.iosPrice,
|
||||||
else {
|
payment_name: this.iosProductId,
|
||||||
this.closeLoad();
|
payment_num: this.iosCount,
|
||||||
}
|
type: "ios",
|
||||||
|
fail_reason: "用户取消充值",
|
||||||
|
}
|
||||||
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
||||||
|
}
|
||||||
|
else if (data.code == 2) {
|
||||||
|
this.closeLoad();
|
||||||
|
console.log("轮训超时");
|
||||||
|
MiniGameSdk.API.showToast("订单已关闭");
|
||||||
|
const dataFail = {
|
||||||
|
outTradeNo: iosOutTradeNo,
|
||||||
|
price: this.iosPrice,
|
||||||
|
payment_name: this.iosProductId,
|
||||||
|
payment_num: this.iosCount,
|
||||||
|
type: "ios",
|
||||||
|
fail_reason: "用户充值后,轮训结果超时",
|
||||||
|
}
|
||||||
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.btn_Touch = true;
|
||||||
|
cc.fx.GameConfig.GM_INFO.iosOutTradeNo = null;
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
openLoad() {
|
openLoad() {
|
||||||
|
@ -394,7 +378,6 @@ export default class NewClass extends cc.Component {
|
||||||
let price = 100;
|
let price = 100;
|
||||||
let count = 1;
|
let count = 1;
|
||||||
id = productId;
|
id = productId;
|
||||||
console.log("购买商品id:", productId);
|
|
||||||
switch (productId) {
|
switch (productId) {
|
||||||
case "gold_1":
|
case "gold_1":
|
||||||
price = 600;
|
price = 600;
|
||||||
|
@ -454,8 +437,6 @@ export default class NewClass extends cc.Component {
|
||||||
this.iosPrice = price;
|
this.iosPrice = price;
|
||||||
this.iosProductId = productId;
|
this.iosProductId = productId;
|
||||||
this.iosCount = 1;
|
this.iosCount = 1;
|
||||||
console.log("准备跳客服回话:");
|
|
||||||
console.log(this.iosProductId);
|
|
||||||
Utils.GoKEFu(iosPayInfo, (res) => {
|
Utils.GoKEFu(iosPayInfo, (res) => {
|
||||||
this.closeLoad();
|
this.closeLoad();
|
||||||
});
|
});
|
||||||
|
@ -536,7 +517,7 @@ export default class NewClass extends cc.Component {
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
const dataSuccess = {
|
const dataSuccess = {
|
||||||
outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
pay_amount: price,
|
price: price,
|
||||||
payment_name: productId,
|
payment_name: productId,
|
||||||
payment_num: 1,
|
payment_num: 1,
|
||||||
type: systemType,
|
type: systemType,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user