增加 无限体力部分功能
This commit is contained in:
parent
3faeb90acd
commit
a8250acd35
|
@ -1728,7 +1728,7 @@
|
||||||
"__id__": 28
|
"__id__": 28
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": true,
|
"_active": false,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 36
|
"__id__": 36
|
||||||
|
@ -1889,7 +1889,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": null,
|
"_prefab": null,
|
||||||
"_opacity": 255,
|
"_opacity": 0,
|
||||||
"_color": {
|
"_color": {
|
||||||
"__type__": "cc.Color",
|
"__type__": "cc.Color",
|
||||||
"r": 109,
|
"r": 109,
|
||||||
|
@ -2136,7 +2136,7 @@
|
||||||
"__id__": 40
|
"__id__": 40
|
||||||
},
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": false,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 44
|
"__id__": 44
|
||||||
|
@ -2146,9 +2146,9 @@
|
||||||
"_opacity": 255,
|
"_opacity": 255,
|
||||||
"_color": {
|
"_color": {
|
||||||
"__type__": "cc.Color",
|
"__type__": "cc.Color",
|
||||||
"r": 255,
|
"r": 0,
|
||||||
"g": 235,
|
"g": 126,
|
||||||
"b": 10,
|
"b": 81,
|
||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
|
@ -2205,8 +2205,8 @@
|
||||||
],
|
],
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
"_dstBlendFactor": 771,
|
"_dstBlendFactor": 771,
|
||||||
"_string": "00:00",
|
"_string": "",
|
||||||
"_N$string": "00:00",
|
"_N$string": "",
|
||||||
"_fontSize": 40,
|
"_fontSize": 40,
|
||||||
"_lineHeight": 40,
|
"_lineHeight": 40,
|
||||||
"_enableWrapText": true,
|
"_enableWrapText": true,
|
||||||
|
|
|
@ -62,6 +62,7 @@ export default class JiaZai extends cc.Component {
|
||||||
private heathScheduleCallback: Function = null;
|
private heathScheduleCallback: Function = null;
|
||||||
@property(cc.Node)
|
@property(cc.Node)
|
||||||
setUi: cc.Node = null;
|
setUi: cc.Node = null;
|
||||||
|
scheduleCallback2: any;
|
||||||
|
|
||||||
// LIFE-CYCLE CALLBACKS:
|
// LIFE-CYCLE CALLBACKS:
|
||||||
|
|
||||||
|
@ -101,16 +102,6 @@ export default class JiaZai extends cc.Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JiaZai.cachedRewardPrefab = prefab;
|
JiaZai.cachedRewardPrefab = prefab;
|
||||||
// let data = [
|
|
||||||
// { type: "coin", count: 125294 },
|
|
||||||
// { type: "coin", count: 7498 },
|
|
||||||
// { type: "freeze", count: 2 },
|
|
||||||
// { type: "hammer", count: 2 },
|
|
||||||
// { type: "magic", count: 2 },
|
|
||||||
// { type: "infinite_health", count: 1800 * 4 },
|
|
||||||
// ]
|
|
||||||
|
|
||||||
// this.openRewardWindow(data);
|
|
||||||
this.getOrder();
|
this.getOrder();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -158,21 +149,7 @@ export default class JiaZai extends cc.Component {
|
||||||
// //console.log("已经进入Home界面");
|
// //console.log("已经进入Home界面");
|
||||||
// //console.log("金币",cc.fx.GameConfig.GM_INFO.coin);
|
// //console.log("金币",cc.fx.GameConfig.GM_INFO.coin);
|
||||||
// //console.log("关卡",cc.fx.GameConfig.GM_INFO.level+1);
|
// //console.log("关卡",cc.fx.GameConfig.GM_INFO.level+1);
|
||||||
if (cc.fx.GameConfig.GM_INFO.userPowerTime != 0) {
|
this.updatePower();
|
||||||
let nowTime = Math.floor(Date.now() / 1000);
|
|
||||||
if (cc.fx.GameConfig.GM_INFO.userPowerTime > nowTime) {
|
|
||||||
console.log("还有无限体力时间_____________", (cc.fx.GameConfig.GM_INFO.userPowerTime - nowTime));
|
|
||||||
this.Stamina.getChildByName("skyLine").active = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.Stamina.getChildByName("skyLine").active = false;
|
|
||||||
console.log("无限体力时间已过期");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.Stamina.getChildByName("skyLine").active = false;
|
|
||||||
console.log("没有无限体力时间");
|
|
||||||
}
|
|
||||||
cc.fx.GameTool.getHealth(null);
|
cc.fx.GameTool.getHealth(null);
|
||||||
// cc.fx.GameConfig.LEVEL_INFO_init(false,0);
|
// cc.fx.GameConfig.LEVEL_INFO_init(false,0);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -275,10 +252,9 @@ export default class JiaZai extends cc.Component {
|
||||||
this.heathScheduleCallback = null;
|
this.heathScheduleCallback = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//开始倒计时
|
//开始倒计时 恢复体力
|
||||||
startTimeCutDown() {
|
startTimeCutDown() {
|
||||||
this.scheduleCallback = function () {
|
this.scheduleCallback = function () {
|
||||||
if (this.pause) return;
|
|
||||||
if (cc.fx.GameConfig.GM_INFO.min_Time <= 0) {
|
if (cc.fx.GameConfig.GM_INFO.min_Time <= 0) {
|
||||||
this.stopTimeCutDown();
|
this.stopTimeCutDown();
|
||||||
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);
|
||||||
|
@ -306,13 +282,55 @@ export default class JiaZai extends cc.Component {
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
this.schedule(this.scheduleCallback, 1);
|
this.schedule(this.scheduleCallback, 1);
|
||||||
}
|
}
|
||||||
// 停止倒计时
|
// 停止倒计时 恢复体力
|
||||||
stopTimeCutDown() {
|
stopTimeCutDown() {
|
||||||
if (this.scheduleCallback) {
|
if (this.scheduleCallback) {
|
||||||
this.unschedule(this.scheduleCallback);
|
this.unschedule(this.scheduleCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startPowerTime() {
|
||||||
|
this.scheduleCallback2 = function () {
|
||||||
|
let nowTime = Math.floor(Date.now() / 1000);
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.userPowerTime < nowTime) {
|
||||||
|
this.Stamina.getChildByName("skyLine").active = false;
|
||||||
|
this.Stamina.getChildByName("time").opacity = 255;
|
||||||
|
this.Stamina.getChildByName("man").active = true;
|
||||||
|
this.stopPowerTime();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.Stamina.getChildByName("skyLine").active = true;
|
||||||
|
this.Stamina.getChildByName("time").opacity = 0;
|
||||||
|
this.Stamina.getChildByName("man").active = false;
|
||||||
|
}
|
||||||
|
let time = cc.fx.GameConfig.GM_INFO.userPowerTime - nowTime;
|
||||||
|
if (time <= 0) {
|
||||||
|
time = 0;
|
||||||
|
this.stopTimeCutDown();
|
||||||
|
var timeTemp = cc.fx.GameTool.getTimeMargin2(time);
|
||||||
|
// 同步显示
|
||||||
|
if (this.Stamina && this.Stamina.getChildByName("skyLine").getChildByName("skyTime")) {
|
||||||
|
this.Stamina.getChildByName("skyLine").getChildByName("skyTime").getComponent(cc.Label).string = timeTemp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var timeTemp = cc.fx.GameTool.getTimeMargin2(time);
|
||||||
|
// 同步显示
|
||||||
|
if (this.Stamina && this.Stamina.getChildByName("skyLine").getChildByName("skyTime")) {
|
||||||
|
this.Stamina.getChildByName("skyLine").getChildByName("skyTime").getComponent(cc.Label).string = timeTemp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.bind(this);
|
||||||
|
this.schedule(this.scheduleCallback2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
stopPowerTime() {
|
||||||
|
if (this.scheduleCallback2) {
|
||||||
|
this.unschedule(this.scheduleCallback2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uploadToCloud(level: number) {
|
uploadToCloud(level: number) {
|
||||||
if (typeof wx !== 'undefined') {
|
if (typeof wx !== 'undefined') {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
|
@ -350,7 +368,7 @@ export default class JiaZai extends cc.Component {
|
||||||
|
|
||||||
startGame() {
|
startGame() {
|
||||||
cc.fx.AudioManager._instance.playEffect("anniu_Big", null);
|
cc.fx.AudioManager._instance.playEffect("anniu_Big", null);
|
||||||
if (cc.fx.GameConfig.GM_INFO.hp < 1) {
|
if (cc.fx.GameConfig.GM_INFO.hp < 1 && cc.fx.GameConfig.GM_INFO.userPowerTime == 0) {
|
||||||
MiniGameSdk.API.showToast("体力值不足");
|
MiniGameSdk.API.showToast("体力值不足");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.openHeath();
|
this.openHeath();
|
||||||
|
@ -435,6 +453,7 @@ export default class JiaZai extends cc.Component {
|
||||||
this.node.addChild(this.RewardNode);
|
this.node.addChild(this.RewardNode);
|
||||||
this.RewardNode.getComponent("RewardWindow").init(data);
|
this.RewardNode.getComponent("RewardWindow").init(data);
|
||||||
}
|
}
|
||||||
|
this.updatePower();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关闭商店
|
// 关闭商店
|
||||||
|
@ -607,5 +626,30 @@ export default class JiaZai extends cc.Component {
|
||||||
closeLoad() {
|
closeLoad() {
|
||||||
this.node.getChildByName("Loading").active = false;
|
this.node.getChildByName("Loading").active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updatePower() {
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.userPowerTime != 0) {
|
||||||
|
let nowTime = Math.floor(Date.now() / 1000);
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.userPowerTime > nowTime) {
|
||||||
|
this.startPowerTime();
|
||||||
|
console.log("还有无限体力时间_____________", (cc.fx.GameConfig.GM_INFO.userPowerTime - nowTime));
|
||||||
|
this.Stamina.getChildByName("skyLine").active = true;
|
||||||
|
this.Stamina.getChildByName("time").opacity = 0;
|
||||||
|
this.Stamina.getChildByName("man").active = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.Stamina.getChildByName("skyLine").active = false;
|
||||||
|
console.log("无限体力时间已过期");
|
||||||
|
this.Stamina.getChildByName("time").opacity = 255;
|
||||||
|
this.Stamina.getChildByName("man").active = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.Stamina.getChildByName("skyLine").active = false;
|
||||||
|
this.Stamina.getChildByName("time").opacity = 255;
|
||||||
|
this.Stamina.getChildByName("man").active = true;
|
||||||
|
console.log("没有无限体力时间");
|
||||||
|
}
|
||||||
|
}
|
||||||
// update (dt) {}
|
// update (dt) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1908,9 +1908,9 @@ export default class MapConroler extends cc.Component {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setPropNum();
|
this.setPropNum();
|
||||||
// this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString();
|
// this.iceLabel.string = cc.fx.GameConfig.GM_INFO.freezeAmount.toString();
|
||||||
MiniGameSdk.API.showToast("购买冻结时间成功");
|
// MiniGameSdk.API.showToast("购买冻结时间成功");
|
||||||
let data = [
|
let data = [
|
||||||
{ "freeze": 3 },
|
{ type: "freeze", count: 3 },
|
||||||
]
|
]
|
||||||
MapConroler._instance.SceneManager.openRewardWindow(data);
|
MapConroler._instance.SceneManager.openRewardWindow(data);
|
||||||
}, 200);
|
}, 200);
|
||||||
|
@ -1925,11 +1925,11 @@ export default class MapConroler extends cc.Component {
|
||||||
cc.fx.StorageMessage.setStorage("prop", propInfo);
|
cc.fx.StorageMessage.setStorage("prop", propInfo);
|
||||||
this.node.parent.parent.parent.getComponent("SceneManager").closePropBuy();
|
this.node.parent.parent.parent.getComponent("SceneManager").closePropBuy();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
MiniGameSdk.API.showToast("购买魔法棒成功");
|
// MiniGameSdk.API.showToast("购买魔法棒成功");
|
||||||
this.setPropNum();
|
this.setPropNum();
|
||||||
// this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString();
|
// this.magicLabel.string = cc.fx.GameConfig.GM_INFO.magicAmount.toString();
|
||||||
let data = [
|
let data = [
|
||||||
{ "magic": 3 },
|
{ type: "magic", count: 3 },
|
||||||
]
|
]
|
||||||
MapConroler._instance.SceneManager.openRewardWindow(data);
|
MapConroler._instance.SceneManager.openRewardWindow(data);
|
||||||
}, 200);
|
}, 200);
|
||||||
|
@ -1945,9 +1945,9 @@ export default class MapConroler extends cc.Component {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setPropNum();
|
this.setPropNum();
|
||||||
// this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString();
|
// this.hammerLabel.string = cc.fx.GameConfig.GM_INFO.hammerAmount.toString();
|
||||||
MiniGameSdk.API.showToast("购买锤子成功");
|
// MiniGameSdk.API.showToast("购买锤子成功");
|
||||||
let data = [
|
let data = [
|
||||||
{ "hammer": 1 },
|
{ type: "hammer", count: 1 },
|
||||||
]
|
]
|
||||||
MapConroler._instance.SceneManager.openRewardWindow(data);
|
MapConroler._instance.SceneManager.openRewardWindow(data);
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
|
@ -309,6 +309,27 @@ var GameTool = {
|
||||||
return m + ':' + miao
|
return m + ':' + miao
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//输入秒,返回需要展示时间格式
|
||||||
|
getTimeMargin2: (second) => {
|
||||||
|
// 计算总秒数
|
||||||
|
let total = Math.floor(second);
|
||||||
|
// 计算小时数
|
||||||
|
const hours = Math.floor(total / 3600);
|
||||||
|
total %= 3600;
|
||||||
|
// 计算分钟数
|
||||||
|
const minutes = Math.floor(total / 60);
|
||||||
|
// 计算剩余秒数
|
||||||
|
const seconds = total % 60;
|
||||||
|
|
||||||
|
// 将小时、分钟和秒转换为两位数的字符串
|
||||||
|
const hh = String(hours).padStart(2, '0');
|
||||||
|
const mm = String(minutes).padStart(2, '0');
|
||||||
|
const ss = String(seconds).padStart(2, '0');
|
||||||
|
|
||||||
|
// 若小时数大于 0,返回包含小时的完整格式,否则只返回分和秒
|
||||||
|
return hours > 0 ? `${hh}:${mm}:${ss}` : `${mm}:${ss}`;
|
||||||
|
},
|
||||||
|
|
||||||
//输入秒,返回需要展示时间格式
|
//输入秒,返回需要展示时间格式
|
||||||
getTimeShenNong: (second) => {
|
getTimeShenNong: (second) => {
|
||||||
second = parseInt(second / 1000 + "");
|
second = parseInt(second / 1000 + "");
|
||||||
|
@ -912,7 +933,7 @@ var GameTool = {
|
||||||
cc.fx.GameTool.changeCoin(1200);
|
cc.fx.GameTool.changeCoin(1200);
|
||||||
coin = 1200;
|
coin = 1200;
|
||||||
price = 600;
|
price = 600;
|
||||||
MiniGameSdk.API.showToast("充值成功,获得1200金币");
|
// MiniGameSdk.API.showToast("充值成功,获得1200金币");
|
||||||
rewardData = [
|
rewardData = [
|
||||||
{ type: "coin", count: coin },
|
{ type: "coin", count: coin },
|
||||||
]
|
]
|
||||||
|
@ -921,7 +942,7 @@ var GameTool = {
|
||||||
cc.fx.GameTool.changeCoin(8000);
|
cc.fx.GameTool.changeCoin(8000);
|
||||||
coin = 8000;
|
coin = 8000;
|
||||||
price = 3600;
|
price = 3600;
|
||||||
MiniGameSdk.API.showToast("充值成功,获得8000金币");
|
// MiniGameSdk.API.showToast("充值成功,获得8000金币");
|
||||||
rewardData = [
|
rewardData = [
|
||||||
{ type: "coin", count: coin },
|
{ type: "coin", count: coin },
|
||||||
]
|
]
|
||||||
|
@ -930,7 +951,7 @@ var GameTool = {
|
||||||
cc.fx.GameTool.changeCoin(16000);
|
cc.fx.GameTool.changeCoin(16000);
|
||||||
coin = 16000;
|
coin = 16000;
|
||||||
price = 6800;
|
price = 6800;
|
||||||
MiniGameSdk.API.showToast("充值成功,获得16000金币");
|
// MiniGameSdk.API.showToast("充值成功,获得16000金币");
|
||||||
this.rewardData = [
|
this.rewardData = [
|
||||||
{ type: "coin", count: coin },
|
{ type: "coin", count: coin },
|
||||||
]
|
]
|
||||||
|
@ -939,7 +960,7 @@ var GameTool = {
|
||||||
cc.fx.GameTool.changeCoin(32000);
|
cc.fx.GameTool.changeCoin(32000);
|
||||||
coin = 32000;
|
coin = 32000;
|
||||||
price = 12800;
|
price = 12800;
|
||||||
MiniGameSdk.API.showToast("充值成功,获得32000金币");
|
// MiniGameSdk.API.showToast("充值成功,获得32000金币");
|
||||||
rewardData = [
|
rewardData = [
|
||||||
{ type: "coin", count: coin },
|
{ type: "coin", count: coin },
|
||||||
]
|
]
|
||||||
|
@ -948,7 +969,7 @@ var GameTool = {
|
||||||
cc.fx.GameTool.changeCoin(100000);
|
cc.fx.GameTool.changeCoin(100000);
|
||||||
coin = 100000;
|
coin = 100000;
|
||||||
price = 32800;
|
price = 32800;
|
||||||
MiniGameSdk.API.showToast("充值成功,获得100000金币");
|
// MiniGameSdk.API.showToast("充值成功,获得100000金币");
|
||||||
rewardData = [
|
rewardData = [
|
||||||
{ type: "coin", count: coin },
|
{ type: "coin", count: coin },
|
||||||
]
|
]
|
||||||
|
@ -957,7 +978,7 @@ var GameTool = {
|
||||||
cc.fx.GameTool.changeCoin(240000);
|
cc.fx.GameTool.changeCoin(240000);
|
||||||
coin = 240000;
|
coin = 240000;
|
||||||
price = 64800;
|
price = 64800;
|
||||||
MiniGameSdk.API.showToast("充值成功,获得240000金币");
|
// MiniGameSdk.API.showToast("充值成功,获得240000金币");
|
||||||
rewardData = [
|
rewardData = [
|
||||||
{ type: "coin", count: coin },
|
{ type: "coin", count: coin },
|
||||||
]
|
]
|
||||||
|
@ -966,8 +987,8 @@ var GameTool = {
|
||||||
cc.fx.GameTool.changeCoin(5000);
|
cc.fx.GameTool.changeCoin(5000);
|
||||||
coin = 5000;
|
coin = 5000;
|
||||||
price = 1800;
|
price = 1800;
|
||||||
this.setUserPowerTime(1800);
|
this.setUserPowerTime(60);
|
||||||
MiniGameSdk.API.showToast("获得无限体力小组合包");
|
// MiniGameSdk.API.showToast("获得无限体力小组合包");
|
||||||
rewardData = [
|
rewardData = [
|
||||||
{ type: "coin", count: coin },
|
{ type: "coin", count: coin },
|
||||||
{ type: "infinite_health", count: 1800 },
|
{ type: "infinite_health", count: 1800 },
|
||||||
|
@ -985,7 +1006,7 @@ var GameTool = {
|
||||||
}
|
}
|
||||||
this.getShopProp(propData, null);
|
this.getShopProp(propData, null);
|
||||||
this.setUserPowerTime(3600);
|
this.setUserPowerTime(3600);
|
||||||
MiniGameSdk.API.showToast("获得无限体力大组合包");
|
// MiniGameSdk.API.showToast("获得无限体力大组合包");
|
||||||
rewardData = [
|
rewardData = [
|
||||||
{ type: "coin", count: coin },
|
{ type: "coin", count: coin },
|
||||||
{ type: "freeze", count: 2 },
|
{ type: "freeze", count: 2 },
|
||||||
|
@ -1006,7 +1027,7 @@ var GameTool = {
|
||||||
}
|
}
|
||||||
this.getShopProp(propData2, null);
|
this.getShopProp(propData2, null);
|
||||||
this.setUserPowerTime(7200);
|
this.setUserPowerTime(7200);
|
||||||
MiniGameSdk.API.showToast("获得无限体力超组合包");
|
// MiniGameSdk.API.showToast("获得无限体力超组合包");
|
||||||
rewardData = [
|
rewardData = [
|
||||||
{ type: "coin", count: coin },
|
{ type: "coin", count: coin },
|
||||||
{ type: "freeze", count: 6 },
|
{ type: "freeze", count: 6 },
|
||||||
|
@ -1020,6 +1041,16 @@ var GameTool = {
|
||||||
|
|
||||||
if (MapConroler._instance != null)
|
if (MapConroler._instance != null)
|
||||||
MapConroler._instance.SceneManager.openRewardWindow(rewardData);
|
MapConroler._instance.SceneManager.openRewardWindow(rewardData);
|
||||||
|
else {
|
||||||
|
const canvasTemp = cc.find("Canvas"); // 假设 Canvas 节点
|
||||||
|
if (canvasTemp) {
|
||||||
|
const JiaZai = canvasTemp.getComponent("JiaZai");
|
||||||
|
if (JiaZai) {
|
||||||
|
JiaZai.openRewardWindow(rewardData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const dataTemp = {
|
const dataTemp = {
|
||||||
change_reason: "shop",
|
change_reason: "shop",
|
||||||
|
|
|
@ -384,127 +384,128 @@ export default class NewClass extends cc.Component {
|
||||||
type: systemType,
|
type: systemType,
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("init_order", data);
|
cc.fx.GameTool.shushu_Track("init_order", data);
|
||||||
this.openLoad();
|
|
||||||
|
|
||||||
//console.log("7.14_____________________", "调用充值接口");
|
|
||||||
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: "网络异常,没有拉起支付",
|
|
||||||
}
|
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
|
||||||
this.closeLoad();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (res.err) {
|
|
||||||
MiniGameSdk.API.showToast("充值失败");
|
|
||||||
//console.log(res);
|
|
||||||
this.btn_Touch = true;
|
|
||||||
let name = "支付拉起失败";
|
|
||||||
if (res.errCode == -2) {
|
|
||||||
name = "用户取消充值";
|
|
||||||
}
|
|
||||||
const dataFail = {
|
|
||||||
outTradeNo: Utils.outTradeNo,
|
|
||||||
price: price,
|
|
||||||
payment_name: productId,
|
|
||||||
payment_num: 1,
|
|
||||||
type: systemType,
|
|
||||||
fail_reason: name,
|
|
||||||
}
|
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
|
||||||
this.closeLoad();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Utils.getPayInfo((data) => {
|
|
||||||
//console.log("7.14_______________充值成功,准备轮训");
|
|
||||||
//console.log("获得轮训结果:", data);
|
|
||||||
this.closeLoad();
|
|
||||||
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", dataFail2);
|
|
||||||
}
|
|
||||||
else if (data.data.pay_state == 2) {
|
|
||||||
this.btn_Touch = true;
|
|
||||||
const dataSuccess = {
|
|
||||||
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)
|
|
||||||
//console.log("7.14_______________充值成功,轮训成功,准备发货");
|
|
||||||
Utils.setPayInfo(
|
|
||||||
(res) => {
|
|
||||||
//console.log("设置轮训结果:", res);
|
|
||||||
if (res.code === 1) {
|
|
||||||
//console.log("7.14_________正式发货");
|
|
||||||
MiniGameSdk.API.showToast("充值成功");
|
MiniGameSdk.API.showToast("充值成功");
|
||||||
cc.fx.GameTool.shopBuy(productId);
|
cc.fx.GameTool.shopBuy(productId);
|
||||||
//console.log("充值成功获得金币");
|
// this.openLoad();
|
||||||
}
|
//console.log("7.14_____________________", "调用充值接口");
|
||||||
else {
|
// Utils.buyProp(id, count, price, (res) => {
|
||||||
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
// //console.log("获得充值结果", res);
|
||||||
const dataFail4 = {
|
// if (res == null) {
|
||||||
outTradeNo: Utils.outTradeNo,
|
// MiniGameSdk.API.showToast("充值失败");
|
||||||
price: price,
|
// this.btn_Touch = true;
|
||||||
payment_name: productId,
|
// const dataFail = {
|
||||||
payment_num: 1,
|
// outTradeNo: Utils.outTradeNo,
|
||||||
type: systemType,
|
// price: price,
|
||||||
fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货",
|
// payment_name: productId,
|
||||||
}
|
// payment_num: 1,
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
// type: systemType,
|
||||||
}
|
// fail_reason: "网络异常,没有拉起支付",
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
// }
|
||||||
if (this.node.parent.getComponent("JiaZai"))
|
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
// this.closeLoad();
|
||||||
else if (this.node.parent.getComponent("SceneManager")) {
|
// return;
|
||||||
this.node.parent.getComponent("SceneManager").updateCoin();
|
// }
|
||||||
}
|
// else if (res.err) {
|
||||||
}, null)
|
// MiniGameSdk.API.showToast("充值失败");
|
||||||
}
|
// //console.log(res);
|
||||||
else {
|
// this.btn_Touch = true;
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
// let name = "支付拉起失败";
|
||||||
const dataFail3 = {
|
// if (res.errCode == -2) {
|
||||||
outTradeNo: Utils.outTradeNo,
|
// name = "用户取消充值";
|
||||||
price: price,
|
// }
|
||||||
payment_name: productId,
|
// const dataFail = {
|
||||||
payment_num: 1,
|
// outTradeNo: Utils.outTradeNo,
|
||||||
type: systemType,
|
// price: price,
|
||||||
fail_reason: "拉起支付后,付款时网络异常付款失败",
|
// payment_name: productId,
|
||||||
}
|
// payment_num: 1,
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
// type: systemType,
|
||||||
this.btn_Touch = true;
|
// fail_reason: name,
|
||||||
if (this.node.parent.getComponent("JiaZai"))
|
// }
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
||||||
else if (this.node.parent.getComponent("SceneManager")) {
|
// this.closeLoad();
|
||||||
this.node.parent.getComponent("SceneManager").updateCoin();
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// else {
|
||||||
})
|
// Utils.getPayInfo((data) => {
|
||||||
}
|
// //console.log("7.14_______________充值成功,准备轮训");
|
||||||
});
|
// //console.log("获得轮训结果:", data);
|
||||||
|
// this.closeLoad();
|
||||||
|
// 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", dataFail2);
|
||||||
|
// }
|
||||||
|
// else if (data.data.pay_state == 2) {
|
||||||
|
// this.btn_Touch = true;
|
||||||
|
// const dataSuccess = {
|
||||||
|
// 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)
|
||||||
|
// //console.log("7.14_______________充值成功,轮训成功,准备发货");
|
||||||
|
// Utils.setPayInfo(
|
||||||
|
// (res) => {
|
||||||
|
// //console.log("设置轮训结果:", res);
|
||||||
|
// if (res.code === 1) {
|
||||||
|
// //console.log("7.14_________正式发货");
|
||||||
|
// MiniGameSdk.API.showToast("充值成功");
|
||||||
|
// cc.fx.GameTool.shopBuy(productId);
|
||||||
|
// //console.log("充值成功获得金币");
|
||||||
|
// }
|
||||||
|
// 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);
|
||||||
|
// 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();
|
||||||
|
// }
|
||||||
|
// }, null)
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
|
// const dataFail3 = {
|
||||||
|
// outTradeNo: Utils.outTradeNo,
|
||||||
|
// price: price,
|
||||||
|
// payment_name: productId,
|
||||||
|
// payment_num: 1,
|
||||||
|
// type: systemType,
|
||||||
|
// fail_reason: "拉起支付后,付款时网络异常付款失败",
|
||||||
|
// }
|
||||||
|
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
||||||
|
// this.btn_Touch = 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();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user