更新
This commit is contained in:
parent
5e2f85d646
commit
499f1bdb19
|
@ -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("登陆成功_____________");
|
// console.log("111登陆成功_____________");
|
||||||
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;
|
||||||
|
|
|
@ -31,14 +31,6 @@ 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() {
|
||||||
|
@ -140,7 +132,15 @@ export default class Revive extends cc.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init() {
|
init() {
|
||||||
console.log()
|
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.revive == 1) {
|
if (cc.fx.GameConfig.GM_INFO.revive == 1) {
|
||||||
this.node.active = false;
|
this.node.active = false;
|
||||||
|
|
|
@ -12,7 +12,7 @@ export default class Utils {
|
||||||
static getUserInfo(callBack) {
|
static getUserInfo(callBack) {
|
||||||
wx.login({
|
wx.login({
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log("登录成功");
|
console.log("微信login成功");
|
||||||
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 => {
|
||||||
|
|
|
@ -37,14 +37,6 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,6 +148,15 @@ 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;
|
||||||
|
|
13
assets/resources/NewLevel.meta
Normal file
13
assets/resources/NewLevel.meta
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"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": 3350
|
"height": 3200
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
|
@ -768,7 +768,7 @@
|
||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
900,
|
55.944,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -824,19 +824,19 @@
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 1080,
|
"width": 1080,
|
||||||
"height": 2000
|
"height": 1700
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
"x": 0.5,
|
"x": 0.5,
|
||||||
"y": 0.5
|
"y": 1
|
||||||
},
|
},
|
||||||
"_trs": {
|
"_trs": {
|
||||||
"__type__": "TypedArray",
|
"__type__": "TypedArray",
|
||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
0,
|
0,
|
||||||
-73.284,
|
885.733,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -52,17 +52,8 @@ 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 = () => {
|
|
||||||
console.log("回到前台");
|
|
||||||
this.onShow();
|
|
||||||
};
|
|
||||||
//@ts-ignore
|
|
||||||
wx.onShow(this.onShowListener);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
start() {
|
start() {
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
this.openShop();
|
this.openShop();
|
||||||
|
@ -70,6 +61,16 @@ 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);
|
||||||
// 同步显示
|
// 同步显示
|
||||||
|
@ -194,7 +195,6 @@ export default class NewClass extends cc.Component {
|
||||||
const systemInfo = wx.getSystemInfoSync();
|
const systemInfo = wx.getSystemInfoSync();
|
||||||
if (systemInfo.platform === 'ios') {
|
if (systemInfo.platform === 'ios') {
|
||||||
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
||||||
console.log("从后台进入获取当前商品名称:", this.iosProductId);
|
|
||||||
console.log("从后台进入前台订单号:", cc.fx.GameConfig.GM_INFO.iosOutTradeNo);
|
console.log("从后台进入前台订单号:", cc.fx.GameConfig.GM_INFO.iosOutTradeNo);
|
||||||
this.closeLoad();
|
this.closeLoad();
|
||||||
if (cc.fx.GameConfig.GM_INFO.iosOutTradeNo != null && cc.fx.GameConfig.GM_INFO.iosOutTradeNo != "") {
|
if (cc.fx.GameConfig.GM_INFO.iosOutTradeNo != null && cc.fx.GameConfig.GM_INFO.iosOutTradeNo != "") {
|
||||||
|
@ -203,99 +203,96 @@ export default class NewClass extends cc.Component {
|
||||||
cc.fx.GameConfig.GM_INFO.iosOutTradeNo = "";
|
cc.fx.GameConfig.GM_INFO.iosOutTradeNo = "";
|
||||||
this.openLoad();
|
this.openLoad();
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
console.log("_________正式发货", "gold_1");
|
Utils.getIosPayInfo(iosOutTradeNo,
|
||||||
|
(data) => {
|
||||||
|
console.log("获得轮训结果:", data);
|
||||||
|
if (data.code == 1) {
|
||||||
|
console.log("购买成功");
|
||||||
|
const iosID = data.data.payment_name;
|
||||||
|
console.log("商品id:", iosID);
|
||||||
|
const dataSuccess = {
|
||||||
|
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("充值成功");
|
MiniGameSdk.API.showToast("充值成功");
|
||||||
cc.fx.GameTool.shopBuy("gold_5", false);
|
cc.fx.GameTool.shopBuy(iosID, false);
|
||||||
// Utils.getIosPayInfo(iosOutTradeNo,
|
if (iosID == "unlimited_health_bundle_1" ||
|
||||||
// (data) => {
|
iosID == "unlimited_health_bundle_2" ||
|
||||||
// console.log("获得轮训结果:", data);
|
iosID == "unlimited_health_bundle_3"
|
||||||
// if (data.code == 1) {
|
) {
|
||||||
// console.log("购买成功");
|
this.updatePower();
|
||||||
// const iosID = data.data.payment_name;
|
}
|
||||||
// console.log("商品id:", iosID);
|
//console.log("充值成功获得金币");
|
||||||
// const dataSuccess = {
|
}
|
||||||
// outTradeNo: iosOutTradeNo,
|
else {
|
||||||
// pay_amount: this.iosPrice,
|
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
||||||
// payment_name: iosID,
|
const dataFail4 = {
|
||||||
// payment_num: this.iosCount,
|
outTradeNo: iosOutTradeNo,
|
||||||
// type: "ios",
|
price: this.iosPrice,
|
||||||
// }
|
payment_name: iosID,
|
||||||
// cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
payment_num: this.iosCount,
|
||||||
// let name = "购买金币道具:" + this.iosProductId;
|
type: "ios",
|
||||||
// let version = cc.fx.GameTool.getWechatGameVersion();
|
fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货",
|
||||||
// if (version == "正式版") {
|
}
|
||||||
// MiniGameSdk.API.yinli_Pay(this.iosPrice, iosOutTradeNo, name)
|
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;
|
||||||
|
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(
|
this.btn_Touch = true;
|
||||||
// (res) => {
|
cc.fx.GameConfig.GM_INFO.iosOutTradeNo = null;
|
||||||
// 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) {
|
|
||||||
// console.log("用户自己取消充值");
|
|
||||||
// MiniGameSdk.API.showToast("充值失败");
|
|
||||||
// this.closeLoad();
|
|
||||||
// this.btn_Touch = true;
|
|
||||||
// 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);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.btn_Touch = true;
|
|
||||||
// cc.fx.GameConfig.GM_INFO.iosOutTradeNo = null;
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.closeLoad();
|
this.closeLoad();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user