增加公共变量
This commit is contained in:
parent
00ec26b4d2
commit
3faeb90acd
|
@ -162,12 +162,15 @@ export default class JiaZai extends cc.Component {
|
||||||
let nowTime = Math.floor(Date.now() / 1000);
|
let nowTime = Math.floor(Date.now() / 1000);
|
||||||
if (cc.fx.GameConfig.GM_INFO.userPowerTime > nowTime) {
|
if (cc.fx.GameConfig.GM_INFO.userPowerTime > nowTime) {
|
||||||
console.log("还有无限体力时间_____________", (cc.fx.GameConfig.GM_INFO.userPowerTime - nowTime));
|
console.log("还有无限体力时间_____________", (cc.fx.GameConfig.GM_INFO.userPowerTime - nowTime));
|
||||||
|
this.Stamina.getChildByName("skyLine").active = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
this.Stamina.getChildByName("skyLine").active = false;
|
||||||
console.log("无限体力时间已过期");
|
console.log("无限体力时间已过期");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
this.Stamina.getChildByName("skyLine").active = false;
|
||||||
console.log("没有无限体力时间");
|
console.log("没有无限体力时间");
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.getHealth(null);
|
cc.fx.GameTool.getHealth(null);
|
||||||
|
@ -558,6 +561,9 @@ export default class JiaZai extends cc.Component {
|
||||||
else if (order.itemid == "gold_4") { coinTemp = 32000; }
|
else if (order.itemid == "gold_4") { coinTemp = 32000; }
|
||||||
else if (order.itemid == "gold_5") { coinTemp = 100000; }
|
else if (order.itemid == "gold_5") { coinTemp = 100000; }
|
||||||
else if (order.itemid == "gold_6") { coinTemp = 240000; }
|
else if (order.itemid == "gold_6") { coinTemp = 240000; }
|
||||||
|
else if (order.itemid == "unlimited_health_bundle_1") { coinTemp = 5000; }
|
||||||
|
else if (order.itemid == "unlimited_health_bundle_2") { coinTemp = 12000; }
|
||||||
|
else if (order.itemid == "unlimited_health_bundle_3") { coinTemp = 30000; }
|
||||||
let title = "充值补发奖励金币:" + coinTemp;
|
let title = "充值补发奖励金币:" + coinTemp;
|
||||||
MiniGameSdk.API.showToast(title);
|
MiniGameSdk.API.showToast(title);
|
||||||
cc.fx.GameTool.shopBuy(productId);
|
cc.fx.GameTool.shopBuy(productId);
|
||||||
|
|
|
@ -125,6 +125,8 @@ export default class MapConroler extends cc.Component {
|
||||||
topDoors: any; //上门
|
topDoors: any; //上门
|
||||||
bottomDoors: any; //下门
|
bottomDoors: any; //下门
|
||||||
leftDoors: any;
|
leftDoors: any;
|
||||||
|
powerState: boolean = false; //
|
||||||
|
SceneManager: any;
|
||||||
|
|
||||||
|
|
||||||
// mapInfo: number[][] = [];
|
// mapInfo: number[][] = [];
|
||||||
|
@ -157,6 +159,7 @@ export default class MapConroler extends cc.Component {
|
||||||
this.reviewState = false;
|
this.reviewState = false;
|
||||||
this.homeCanTouch = true;
|
this.homeCanTouch = true;
|
||||||
this.againCanTouch = true;
|
this.againCanTouch = true;
|
||||||
|
this.powerState = false;
|
||||||
this.new_mode = 0;
|
this.new_mode = 0;
|
||||||
this.count_Time = 0;
|
this.count_Time = 0;
|
||||||
this.add_Time = 0;
|
this.add_Time = 0;
|
||||||
|
@ -168,6 +171,18 @@ export default class MapConroler extends cc.Component {
|
||||||
this.setPropNum();
|
this.setPropNum();
|
||||||
// cc.game.addPersistRootNode(this.node);
|
// cc.game.addPersistRootNode(this.node);
|
||||||
MapConroler._instance = this;
|
MapConroler._instance = this;
|
||||||
|
const canvasTemp = cc.find("Canvas"); // 假设 Canvas 节点
|
||||||
|
if (canvasTemp) {
|
||||||
|
const SceneManager = canvasTemp.getComponent("SceneManager");
|
||||||
|
if (SceneManager) {
|
||||||
|
MapConroler._instance.SceneManager = SceneManager
|
||||||
|
} else {
|
||||||
|
console.log("SceneManager 组件未找到");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log("SceneManager 节点未找到");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
@ -278,8 +293,12 @@ export default class MapConroler extends cc.Component {
|
||||||
startUpdate() {
|
startUpdate() {
|
||||||
if (this.gameStart == false) {
|
if (this.gameStart == false) {
|
||||||
this.gameStart = true;
|
this.gameStart = true;
|
||||||
|
let power = cc.fx.GameTool.getUserPowerTime();
|
||||||
|
if (!power) {
|
||||||
cc.fx.GameTool.setUserHealth(-1, (data) => {
|
cc.fx.GameTool.setUserHealth(-1, (data) => {
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
this.powerState = power;
|
||||||
this.count_Time = Date.now();
|
this.count_Time = Date.now();
|
||||||
//发送数数事件——进入关卡
|
//发送数数事件——进入关卡
|
||||||
console.log("准备进入下一关,发送下一关进入");
|
console.log("准备进入下一关,发送下一关进入");
|
||||||
|
@ -1423,9 +1442,12 @@ export default class MapConroler extends cc.Component {
|
||||||
this.gameWin = true;
|
this.gameWin = true;
|
||||||
if (cc.fx.GameConfig.GM_INFO.hp < 5) {
|
if (cc.fx.GameConfig.GM_INFO.hp < 5) {
|
||||||
console.log("恢复一点体力", cc.fx.GameConfig.GM_INFO.level);
|
console.log("恢复一点体力", cc.fx.GameConfig.GM_INFO.level);
|
||||||
|
if (!this.powerState) {
|
||||||
cc.fx.GameTool.setUserHealth(1, (data) => {
|
cc.fx.GameTool.setUserHealth(1, (data) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
this.powerState = false;
|
||||||
|
}
|
||||||
this.stopTimeCutDown();
|
this.stopTimeCutDown();
|
||||||
// console.log("即将上报成功________________________:",this.add_Time);
|
// console.log("即将上报成功________________________:",this.add_Time);
|
||||||
// console.log("成功消除一个",this.add_Time);
|
// console.log("成功消除一个",this.add_Time);
|
||||||
|
@ -1616,6 +1638,10 @@ export default class MapConroler extends cc.Component {
|
||||||
|
|
||||||
homeBtn() {
|
homeBtn() {
|
||||||
// alert("游戏失败");
|
// alert("游戏失败");
|
||||||
|
if (this.powerState) {
|
||||||
|
this.returnHome();
|
||||||
|
return;
|
||||||
|
}
|
||||||
cc.fx.AudioManager._instance.playEffect("anniu_Big", null);
|
cc.fx.AudioManager._instance.playEffect("anniu_Big", null);
|
||||||
if (!this.homeCanTouch) return;
|
if (!this.homeCanTouch) return;
|
||||||
this.homeCanTouch = false;
|
this.homeCanTouch = false;
|
||||||
|
@ -1632,12 +1658,6 @@ export default class MapConroler extends cc.Component {
|
||||||
result: "fail"
|
result: "fail"
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("finish_stage", data);
|
cc.fx.GameTool.shushu_Track("finish_stage", data);
|
||||||
|
|
||||||
// if (this.gameStart == true) {
|
|
||||||
// cc.fx.GameTool.setUserHealth(-1, (data) => {
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// this.node.parent.parent.parent.destroy();
|
|
||||||
}
|
}
|
||||||
uploadToCloud(level: number) {
|
uploadToCloud(level: number) {
|
||||||
if (typeof wx !== 'undefined') {
|
if (typeof wx !== 'undefined') {
|
||||||
|
@ -1865,6 +1885,7 @@ export default class MapConroler extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBuySuccess(data) {
|
handleBuySuccess(data) {
|
||||||
|
|
||||||
this.node.parent.parent.parent.getComponent("SceneManager").resetBtn();
|
this.node.parent.parent.parent.getComponent("SceneManager").resetBtn();
|
||||||
this.updateCoin();
|
this.updateCoin();
|
||||||
this.pause = false;
|
this.pause = false;
|
||||||
|
@ -1888,6 +1909,10 @@ export default class MapConroler extends cc.Component {
|
||||||
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 = [
|
||||||
|
{ "freeze": 3 },
|
||||||
|
]
|
||||||
|
MapConroler._instance.SceneManager.openRewardWindow(data);
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1903,6 +1928,10 @@ export default class MapConroler extends cc.Component {
|
||||||
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 = [
|
||||||
|
{ "magic": 3 },
|
||||||
|
]
|
||||||
|
MapConroler._instance.SceneManager.openRewardWindow(data);
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1917,6 +1946,10 @@ export default class MapConroler extends cc.Component {
|
||||||
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 = [
|
||||||
|
{ "hammer": 1 },
|
||||||
|
]
|
||||||
|
MapConroler._instance.SceneManager.openRewardWindow(data);
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,17 @@ const { ccclass, property } = cc._decorator;
|
||||||
@ccclass
|
@ccclass
|
||||||
export default class SceneManager extends cc.Component {
|
export default class SceneManager extends cc.Component {
|
||||||
|
|
||||||
|
|
||||||
// 缓存 shop 预制体
|
// 缓存 shop 预制体
|
||||||
private static cachedShopPrefab: cc.Prefab | null = null;
|
private static cachedShopPrefab: cc.Prefab | null = null;
|
||||||
// 缓存 shop 节点
|
// 缓存 shop 节点
|
||||||
private shopNode: cc.Node | null = null;
|
private shopNode: cc.Node | null = null;
|
||||||
|
|
||||||
|
// 缓存 reward 预制体
|
||||||
|
private static cachedRewardPrefab: cc.Prefab | null = null;
|
||||||
|
// 缓存 reward 奖励窗口 节点
|
||||||
|
private RewardNode: cc.Node | null = null;
|
||||||
|
|
||||||
@property(cc.Label)
|
@property(cc.Label)
|
||||||
label: cc.Label = null;
|
label: cc.Label = null;
|
||||||
|
|
||||||
|
@ -83,6 +89,13 @@ export default class SceneManager extends cc.Component {
|
||||||
}
|
}
|
||||||
SceneManager.cachedShopPrefab = prefab;
|
SceneManager.cachedShopPrefab = prefab;
|
||||||
});
|
});
|
||||||
|
bundle.load('prefab/RewardWindow', cc.Prefab, (err: Error, prefab: cc.Prefab) => {
|
||||||
|
if (err) {
|
||||||
|
cc.error(err.message || err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SceneManager.cachedRewardPrefab = prefab;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
@ -192,8 +205,6 @@ export default class SceneManager extends cc.Component {
|
||||||
this.closePause();
|
this.closePause();
|
||||||
if (MapConroler._instance.gameStart == true) {
|
if (MapConroler._instance.gameStart == true) {
|
||||||
MiniGameSdk.API.showToast("体力值减少");
|
MiniGameSdk.API.showToast("体力值减少");
|
||||||
// cc.fx.GameTool.setUserHealth(-1, (data) => {
|
|
||||||
// })
|
|
||||||
if (MapConroler._instance.count_Time) {
|
if (MapConroler._instance.count_Time) {
|
||||||
let overTime = Date.now();
|
let overTime = Date.now();
|
||||||
let count_Time = overTime - MapConroler._instance.count_Time;
|
let count_Time = overTime - MapConroler._instance.count_Time;
|
||||||
|
@ -363,6 +374,29 @@ export default class SceneManager extends cc.Component {
|
||||||
this.node.getChildByName("Game").getChildByName("propWindow").active = false;
|
this.node.getChildByName("Game").getChildByName("propWindow").active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openRewardWindow(data) {
|
||||||
|
console.log("_____________________打開獎勵弹窗");
|
||||||
|
if (!SceneManager.cachedRewardPrefab) {
|
||||||
|
cc.error('Reward prefab is not loaded yet.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.RewardNode) {
|
||||||
|
// 第一次使用,创建节点
|
||||||
|
this.RewardNode = cc.instantiate(SceneManager.cachedRewardPrefab);
|
||||||
|
this.node.addChild(this.RewardNode);
|
||||||
|
this.RewardNode.zIndex = 99;
|
||||||
|
this.RewardNode.getComponent("Reward").init(data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.RewardNode.destroy();
|
||||||
|
this.RewardNode = null;
|
||||||
|
this.RewardNode = cc.instantiate(SceneManager.cachedRewardPrefab);
|
||||||
|
this.node.addChild(this.RewardNode);
|
||||||
|
this.RewardNode.zIndex = 99;
|
||||||
|
this.RewardNode.getComponent("RewardWindow").init(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
update(dt) {
|
update(dt) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,13 +98,15 @@ export class GameConfig {
|
||||||
shushu_DistinctId: string; //数数访客ID
|
shushu_DistinctId: string; //数数访客ID
|
||||||
shushu_AccountId: string; //数数账号ID
|
shushu_AccountId: string; //数数账号ID
|
||||||
uid: string; //用户和后端唯一id
|
uid: string; //用户和后端唯一id
|
||||||
userPowerTime: number;
|
userPowerTime: number; //用户体力恢复时间
|
||||||
|
freezeFirst: boolean; hammerFirst: boolean; magicAFirst: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//游戏内信息
|
//游戏内信息
|
||||||
|
|
||||||
static get Instance() {
|
static get Instance() {
|
||||||
|
@ -242,6 +244,9 @@ export class GameConfig {
|
||||||
shushu_AccountId: "", //数数账号ID
|
shushu_AccountId: "", //数数账号ID
|
||||||
uid: "", //用户和后端唯一id
|
uid: "", //用户和后端唯一id
|
||||||
userPowerTime: 0, //用户体力恢复时间
|
userPowerTime: 0, //用户体力恢复时间
|
||||||
|
freezeFirst: false,
|
||||||
|
hammerFirst: false,
|
||||||
|
magicAFirst: false,
|
||||||
};
|
};
|
||||||
// this.setCode(this.getKey("scode"));
|
// this.setCode(this.getKey("scode"));
|
||||||
// this.GM_INFO.level = 0;
|
// this.GM_INFO.level = 0;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
import MapConroler from "../../Map";
|
||||||
import Freeze from "../../prop/Freeze";
|
import Freeze from "../../prop/Freeze";
|
||||||
import SceneManager from "../../SceneManager";
|
import SceneManager from "../../SceneManager";
|
||||||
import { MiniGameSdk } from "../../Sdk/MiniGameSdk";
|
import { MiniGameSdk } from "../../Sdk/MiniGameSdk";
|
||||||
|
@ -904,49 +905,73 @@ var GameTool = {
|
||||||
let price = 0;
|
let price = 0;
|
||||||
let getCoin = 0;
|
let getCoin = 0;
|
||||||
|
|
||||||
|
var rewardData = null;
|
||||||
|
|
||||||
switch (productId) {
|
switch (productId) {
|
||||||
case "gold_1":
|
case "gold_1":
|
||||||
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 = [
|
||||||
|
{ type: "coin", count: coin },
|
||||||
|
]
|
||||||
break;
|
break;
|
||||||
case "gold_2":
|
case "gold_2":
|
||||||
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 = [
|
||||||
|
{ type: "coin", count: coin },
|
||||||
|
]
|
||||||
break;
|
break;
|
||||||
case "gold_3":
|
case "gold_3":
|
||||||
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 = [
|
||||||
|
{ type: "coin", count: coin },
|
||||||
|
]
|
||||||
break;
|
break;
|
||||||
case "gold_4":
|
case "gold_4":
|
||||||
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 = [
|
||||||
|
{ type: "coin", count: coin },
|
||||||
|
]
|
||||||
break;
|
break;
|
||||||
case "gold_5":
|
case "gold_5":
|
||||||
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 = [
|
||||||
|
{ type: "coin", count: coin },
|
||||||
|
]
|
||||||
break;
|
break;
|
||||||
case "gold_6":
|
case "gold_6":
|
||||||
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 = [
|
||||||
|
{ type: "coin", count: coin },
|
||||||
|
]
|
||||||
break;
|
break;
|
||||||
case "unlimited_health_bundle_1":
|
case "unlimited_health_bundle_1":
|
||||||
cc.fx.GameTool.changeCoin(5000);
|
cc.fx.GameTool.changeCoin(5000);
|
||||||
coin = 5000;
|
coin = 5000;
|
||||||
price = 1800;
|
price = 1800;
|
||||||
this.setUserPowerTime(60);
|
this.setUserPowerTime(1800);
|
||||||
MiniGameSdk.API.showToast("获得无限体力小组合包");
|
MiniGameSdk.API.showToast("获得无限体力小组合包");
|
||||||
|
rewardData = [
|
||||||
|
{ type: "coin", count: coin },
|
||||||
|
{ type: "infinite_health", count: 1800 },
|
||||||
|
]
|
||||||
break;
|
break;
|
||||||
case "unlimited_health_bundle_2":
|
case "unlimited_health_bundle_2":
|
||||||
cc.fx.GameTool.changeCoin(12000);
|
cc.fx.GameTool.changeCoin(12000);
|
||||||
|
@ -959,8 +984,15 @@ var GameTool = {
|
||||||
"price": price
|
"price": price
|
||||||
}
|
}
|
||||||
this.getShopProp(propData, null);
|
this.getShopProp(propData, null);
|
||||||
this.setUserPowerTime(120);
|
this.setUserPowerTime(3600);
|
||||||
MiniGameSdk.API.showToast("获得无限体力大组合包");
|
MiniGameSdk.API.showToast("获得无限体力大组合包");
|
||||||
|
rewardData = [
|
||||||
|
{ type: "coin", count: coin },
|
||||||
|
{ type: "freeze", count: 2 },
|
||||||
|
{ type: "hammer", count: 2 },
|
||||||
|
{ type: "magic", count: 2 },
|
||||||
|
{ type: "infinite_health", count: 3600 },
|
||||||
|
]
|
||||||
break;
|
break;
|
||||||
case "unlimited_health_bundle_3":
|
case "unlimited_health_bundle_3":
|
||||||
cc.fx.GameTool.changeCoin(30000);
|
cc.fx.GameTool.changeCoin(30000);
|
||||||
|
@ -973,10 +1005,22 @@ var GameTool = {
|
||||||
"price": price
|
"price": price
|
||||||
}
|
}
|
||||||
this.getShopProp(propData2, null);
|
this.getShopProp(propData2, null);
|
||||||
this.setUserPowerTime(180);
|
this.setUserPowerTime(7200);
|
||||||
MiniGameSdk.API.showToast("获得无限体力超组合包");
|
MiniGameSdk.API.showToast("获得无限体力超组合包");
|
||||||
|
rewardData = [
|
||||||
|
{ type: "coin", count: coin },
|
||||||
|
{ type: "freeze", count: 6 },
|
||||||
|
{ type: "hammer", count: 6 },
|
||||||
|
{ type: "magic", count: 6 },
|
||||||
|
{ type: "infinite_health", count: 7200 },
|
||||||
|
]
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (MapConroler._instance != null)
|
||||||
|
MapConroler._instance.SceneManager.openRewardWindow(rewardData);
|
||||||
|
|
||||||
const dataTemp = {
|
const dataTemp = {
|
||||||
change_reason: "shop",
|
change_reason: "shop",
|
||||||
id: "1001",
|
id: "1001",
|
||||||
|
@ -1243,7 +1287,25 @@ var GameTool = {
|
||||||
console.log("购买无限体力同步:", data);
|
console.log("购买无限体力同步:", data);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getUserPowerTime() {
|
||||||
|
if (cc.fx.GameConfig.GM_INFO.userPowerTime > 0) {
|
||||||
|
let nowTime = Math.floor(Date.now() / 1000);
|
||||||
|
if (nowTime >= cc.fx.GameConfig.GM_INFO.userPowerTime) {
|
||||||
|
cc.fx.GameConfig.GM_INFO.userPowerTime = 0;
|
||||||
|
cc.fx.StorageMessage.setStorage("userPowerTime", 0);
|
||||||
|
Utils.setUserPowerTime(0, (data) => {
|
||||||
|
console.log("购买无限体力同步:", data);
|
||||||
|
})
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -132,7 +132,7 @@ export default class setUi extends cc.Component {
|
||||||
|
|
||||||
//退出游戏
|
//退出游戏
|
||||||
clickExit() {
|
clickExit() {
|
||||||
if(MapConroler._instance.gameStart == true) {
|
if (MapConroler._instance.gameStart == true && MapConroler._instance.powerState == false) {
|
||||||
this.exit.active = true;
|
this.exit.active = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -934,7 +934,7 @@
|
||||||
"__type__": "TypedArray",
|
"__type__": "TypedArray",
|
||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
-37.185,
|
-31.807,
|
||||||
-125.613,
|
-125.613,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -376,9 +376,6 @@ export default class NewClass extends cc.Component {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("上品ID:", productId);
|
|
||||||
MiniGameSdk.API.showToast(productId);
|
|
||||||
cc.fx.GameTool.shopBuy(productId);
|
|
||||||
const data = {
|
const data = {
|
||||||
outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
price: price,
|
price: price,
|
||||||
|
@ -389,127 +386,125 @@ export default class NewClass extends cc.Component {
|
||||||
cc.fx.GameTool.shushu_Track("init_order", data);
|
cc.fx.GameTool.shushu_Track("init_order", data);
|
||||||
this.openLoad();
|
this.openLoad();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//console.log("7.14_____________________", "调用充值接口");
|
//console.log("7.14_____________________", "调用充值接口");
|
||||||
// Utils.buyProp(id, count, price, (res) => {
|
Utils.buyProp(id, count, price, (res) => {
|
||||||
// //console.log("获得充值结果", res);
|
//console.log("获得充值结果", res);
|
||||||
// if (res == null) {
|
if (res == null) {
|
||||||
// MiniGameSdk.API.showToast("充值失败");
|
MiniGameSdk.API.showToast("充值失败");
|
||||||
// this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
// const dataFail = {
|
const dataFail = {
|
||||||
// outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
// price: price,
|
price: price,
|
||||||
// payment_name: productId,
|
payment_name: productId,
|
||||||
// payment_num: 1,
|
payment_num: 1,
|
||||||
// type: systemType,
|
type: systemType,
|
||||||
// fail_reason: "网络异常,没有拉起支付",
|
fail_reason: "网络异常,没有拉起支付",
|
||||||
// }
|
}
|
||||||
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
||||||
// this.closeLoad();
|
this.closeLoad();
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// else if (res.err) {
|
else if (res.err) {
|
||||||
// MiniGameSdk.API.showToast("充值失败");
|
MiniGameSdk.API.showToast("充值失败");
|
||||||
// //console.log(res);
|
//console.log(res);
|
||||||
// this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
// let name = "支付拉起失败";
|
let name = "支付拉起失败";
|
||||||
// if (res.errCode == -2) {
|
if (res.errCode == -2) {
|
||||||
// name = "用户取消充值";
|
name = "用户取消充值";
|
||||||
// }
|
}
|
||||||
// const dataFail = {
|
const dataFail = {
|
||||||
// outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
// price: price,
|
price: price,
|
||||||
// payment_name: productId,
|
payment_name: productId,
|
||||||
// payment_num: 1,
|
payment_num: 1,
|
||||||
// type: systemType,
|
type: systemType,
|
||||||
// fail_reason: name,
|
fail_reason: name,
|
||||||
// }
|
}
|
||||||
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
||||||
// this.closeLoad();
|
this.closeLoad();
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// else {
|
else {
|
||||||
// Utils.getPayInfo((data) => {
|
Utils.getPayInfo((data) => {
|
||||||
// //console.log("7.14_______________充值成功,准备轮训");
|
//console.log("7.14_______________充值成功,准备轮训");
|
||||||
// //console.log("获得轮训结果:", data);
|
//console.log("获得轮训结果:", data);
|
||||||
// this.closeLoad();
|
this.closeLoad();
|
||||||
// if (data.data.pay_state == 1) {
|
if (data.data.pay_state == 1) {
|
||||||
// this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
// MiniGameSdk.API.showToast("取消充值");
|
MiniGameSdk.API.showToast("取消充值");
|
||||||
// const dataFail2 = {
|
const dataFail2 = {
|
||||||
// outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
// price: price,
|
price: price,
|
||||||
// payment_name: productId,
|
payment_name: productId,
|
||||||
// payment_num: 1,
|
payment_num: 1,
|
||||||
// type: systemType,
|
type: systemType,
|
||||||
// fail_reason: "用户取消支付",
|
fail_reason: "用户取消支付",
|
||||||
// }
|
}
|
||||||
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail2);
|
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;
|
this.btn_Touch = true;
|
||||||
// const dataSuccess = {
|
const dataSuccess = {
|
||||||
// outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
// price: price,
|
price: price,
|
||||||
// payment_name: productId,
|
payment_name: productId,
|
||||||
// payment_num: 1,
|
payment_num: 1,
|
||||||
// type: systemType,
|
type: systemType,
|
||||||
// }
|
}
|
||||||
// cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
||||||
// let name = "购买金币道具:" + productId;
|
let name = "购买金币道具:" + productId;
|
||||||
// MiniGameSdk.API.yinli_Pay(price, Utils.outTradeNo, name)
|
MiniGameSdk.API.yinli_Pay(price, Utils.outTradeNo, name)
|
||||||
// //console.log("7.14_______________充值成功,轮训成功,准备发货");
|
//console.log("7.14_______________充值成功,轮训成功,准备发货");
|
||||||
// Utils.setPayInfo(
|
Utils.setPayInfo(
|
||||||
// (res) => {
|
(res) => {
|
||||||
// //console.log("设置轮训结果:", res);
|
//console.log("设置轮训结果:", res);
|
||||||
// if (res.code === 1) {
|
if (res.code === 1) {
|
||||||
// //console.log("7.14_________正式发货");
|
//console.log("7.14_________正式发货");
|
||||||
// MiniGameSdk.API.showToast("充值成功");
|
MiniGameSdk.API.showToast("充值成功");
|
||||||
// cc.fx.GameTool.shopBuy(productId);
|
cc.fx.GameTool.shopBuy(productId);
|
||||||
// //console.log("充值成功获得金币");
|
//console.log("充值成功获得金币");
|
||||||
// }
|
}
|
||||||
// else {
|
else {
|
||||||
// MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
||||||
// const dataFail4 = {
|
const dataFail4 = {
|
||||||
// outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
// price: price,
|
price: price,
|
||||||
// payment_name: productId,
|
payment_name: productId,
|
||||||
// payment_num: 1,
|
payment_num: 1,
|
||||||
// type: systemType,
|
type: systemType,
|
||||||
// fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货",
|
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);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
// if (this.node.parent.getComponent("JiaZai"))
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
// this.node.parent.getComponent("JiaZai").updateCoin();
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
// else if (this.node.parent.getComponent("SceneManager")) {
|
else if (this.node.parent.getComponent("SceneManager")) {
|
||||||
// this.node.parent.getComponent("SceneManager").updateCoin();
|
this.node.parent.getComponent("SceneManager").updateCoin();
|
||||||
// }
|
}
|
||||||
// }, null)
|
}, null)
|
||||||
// }
|
}
|
||||||
// else {
|
else {
|
||||||
// NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
// const dataFail3 = {
|
const dataFail3 = {
|
||||||
// outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
// price: price,
|
price: price,
|
||||||
// payment_name: productId,
|
payment_name: productId,
|
||||||
// payment_num: 1,
|
payment_num: 1,
|
||||||
// type: systemType,
|
type: systemType,
|
||||||
// fail_reason: "拉起支付后,付款时网络异常付款失败",
|
fail_reason: "拉起支付后,付款时网络异常付款失败",
|
||||||
// }
|
}
|
||||||
// cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
||||||
// this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
// if (this.node.parent.getComponent("JiaZai"))
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
// this.node.parent.getComponent("JiaZai").updateCoin();
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
// else if (this.node.parent.getComponent("SceneManager")) {
|
else if (this.node.parent.getComponent("SceneManager")) {
|
||||||
// this.node.parent.getComponent("SceneManager").updateCoin();
|
this.node.parent.getComponent("SceneManager").updateCoin();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user