月卡测试

This commit is contained in:
computer\尼卡 2025-07-25 14:53:10 +08:00
parent b3ef494ea9
commit fa699bc8c3
7 changed files with 1343 additions and 65 deletions

View File

@ -508,6 +508,7 @@ export default class JiaZai extends cc.Component {
this.node.addChild(this.RewardNode); this.node.addChild(this.RewardNode);
this.RewardNode.getComponent("Reward").init(data); this.RewardNode.getComponent("Reward").init(data);
} }
this.RewardNode.zIndex = 1001;
this.updatePower(); this.updatePower();
} }
//打开月卡 //打开月卡
@ -525,6 +526,7 @@ export default class JiaZai extends cc.Component {
} else { } else {
// 非第一次使用,直接激活节点 // 非第一次使用,直接激活节点
this.monthlyCardNode.active = true; this.monthlyCardNode.active = true;
this.monthlyCardNode.zIndex = 1000;
this.monthlyCardNode.getComponent("monthlyCard").init(); this.monthlyCardNode.getComponent("monthlyCard").init();
this.monthlyCardNode.getComponent("monthlyCard").juwai = true; this.monthlyCardNode.getComponent("monthlyCard").juwai = true;
} }
@ -735,17 +737,19 @@ export default class JiaZai extends cc.Component {
//月卡 //月卡
//打开界面 //打开界面
openMonthCard() { openMonthCard() {
this.monthCard.active = true; this.openMonthlyCard();
Utils.getMonthlyCard((data) => { this.monthlyCardNode.getComponent("monthlyCard").home = 1;
if (data.msg == "不在有效期") { // this.monthCard.active = true;
this.monthCardBtn.active = true; // Utils.getMonthlyCard((data) => {
this.monthCardBtn2.active = false; // if (data.msg == "不在有效期") {
} else { // this.monthCardBtn.active = true;
this.monthCardBtn.active = false; // this.monthCardBtn2.active = false;
this.monthCardBtn2.active = true; // } else {
NumberToImage.numberToImageNodes(25, 35, 20, "month_", this.monthCardTime, true); // this.monthCardBtn.active = false;
} // this.monthCardBtn2.active = true;
}) // NumberToImage.numberToImageNodes(25, 35, 20, "month_", this.monthCardTime, true);
// }
// })
} }
//关闭界面 //关闭界面
closeMonthCard() { closeMonthCard() {
@ -847,5 +851,18 @@ export default class JiaZai extends cc.Component {
}) })
} }
//获取月卡有效期距离今天的天数
getMonthlyCardValidityDays() {
let nowTime = Math.floor(Date.now() / 1000);
let validityTime = 0;
Utils.getMonthlyCard((data) => {
if (data.code == 1) {
validityTime = data.monthCardTime;
}
})
let days = Math.floor((validityTime - nowTime) / (24 * 60 * 60));
return days;
}
// update (dt) {} // update (dt) {}
} }

View File

@ -124,6 +124,7 @@ export default class SceneManager extends cc.Component {
updateWinCoin() { updateWinCoin() {
console.log("更新关卡获得金币"); console.log("更新关卡获得金币");
let winCoin = 40; let winCoin = 40;
winCoin = winCoin * cc.fx.GameConfig.GM_INFO.doubleCoin;
if (winCoin > 0) { if (winCoin > 0) {
NumberToImage.numberToImageNodes(winCoin, 50, 8, "time_", this.winCoin, false); NumberToImage.numberToImageNodes(winCoin, 50, 8, "time_", this.winCoin, false);
} else { } else {
@ -426,6 +427,7 @@ export default class SceneManager extends cc.Component {
this.RewardNode.zIndex = 99; this.RewardNode.zIndex = 99;
this.RewardNode.getComponent("Reward").init(data); this.RewardNode.getComponent("Reward").init(data);
} }
this.RewardNode.zIndex = 1001;
} }
update(dt) { update(dt) {

View File

@ -9,6 +9,7 @@ import JiaZai from "./JiaZai";
import Utils from "./module/Pay/Utils"; import Utils from "./module/Pay/Utils";
import NumberToImage from "./NumberToImage"; import NumberToImage from "./NumberToImage";
import SceneManager from "./SceneManager"; import SceneManager from "./SceneManager";
import { MiniGameSdk } from "./Sdk/MiniGameSdk";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
@ -24,10 +25,121 @@ export default class NewClass extends cc.Component {
@property(cc.Node) @property(cc.Node)
monthCardBtn2: cc.Node = null; monthCardBtn2: cc.Node = null;
public juwai = false; public juwai = false;
btn_Touch: boolean = false;
// LIFE-CYCLE CALLBACKS: // LIFE-CYCLE CALLBACKS:
private onShowListener: () => void;
private iosPrice: number = 0;
private iosProductId: string = "";
private iosCount: number = 1;
public home: number = 0;
// onLoad () {} onLoad() {
this.btn_Touch = true;
// 检测微信小游戏切到后台
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
// 定义监听函数
this.onShowListener = () => {
this.onShow();
};
//@ts-ignore
wx.onShow(this.onShowListener);
}
}
onShow() {
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
console.log("从后台进入前台订单号:", cc.fx.GameConfig.GM_INFO.iosOutTradeNo);
if (cc.fx.GameConfig.GM_INFO.iosOutTradeNo != null && cc.fx.GameConfig.GM_INFO.iosOutTradeNo != "") {
console.log("有苹果订单号,开始轮训");
const iosOutTradeNo = cc.fx.GameConfig.GM_INFO.iosOutTradeNo;
cc.fx.GameConfig.GM_INFO.iosOutTradeNo = "";
this.openLoad();
this.btn_Touch = true;
Utils.getIosPayInfo(iosOutTradeNo,
(data) => {
console.log("获得轮训结果:", data);
if (data.code == 1) {
console.log("购买成功");
const dataSuccess = {
outTradeNo: iosOutTradeNo,
price: this.iosPrice,
payment_name: this.iosProductId,
payment_num: this.iosCount,
type: "ios",
}
cc.fx.GameTool.shushu_Track("payment", dataSuccess);
let name = "购买金币道具:" + this.iosProductId;
MiniGameSdk.API.yinli_Pay(this.iosPrice, iosOutTradeNo, name)
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 == "month_Test") {
this.buyMonthCard();
}
//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);
}
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;
})
}
}
}
start() { start() {
Utils.getMonthlyCard((data) => { Utils.getMonthlyCard((data) => {
@ -42,6 +154,7 @@ export default class NewClass extends cc.Component {
} }
init() { init() {
this.btn_Touch = true;
Utils.getMonthlyCard((data) => { Utils.getMonthlyCard((data) => {
if (data.msg == "不在有效期") { if (data.msg == "不在有效期") {
this.monthCardBtn.active = true; this.monthCardBtn.active = true;
@ -59,12 +172,12 @@ export default class NewClass extends cc.Component {
Utils.setMonthlyCard(0, (data) => { Utils.setMonthlyCard(0, (data) => {
console.log("购买月卡'✅ ", data.code); console.log("购买月卡'✅ ", data.code);
if (data.code == 1) { if (data.code == 1) {
let rewardData = [ // let rewardData = [
{ type: "coin", count: 6000 }, // { type: "coin", count: 6000 },
] // ]
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;
cc.fx.GameTool.changeCoin(6000); // cc.fx.GameTool.changeCoin(6000);
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) {
@ -80,50 +193,57 @@ export default class NewClass extends cc.Component {
this.monthCardBtn.active = false; this.monthCardBtn.active = false;
this.monthCardBtn2.active = true; this.monthCardBtn2.active = true;
this.monthCardTime.active = true; this.monthCardTime.active = true;
cc.fx.GameConfig.GM_INFO.doubleCoin = 2;
if (this.juwai == true) { // if (this.juwai == true) {
if (jiazaiComp) { // if (jiazaiComp) {
setTimeout(() => { // setTimeout(() => {
jiazaiComp.openRewardWindow(rewardData, 1); // jiazaiComp.openRewardWindow(rewardData, 1);
}, 300); // }, 300);
} // }
console.log("月卡奖励juwai"); // console.log("月卡奖励juwai");
} else { // } else {
// 尝试获取SceneManager组件 // // 尝试获取SceneManager组件
const jiazaiComp1 = jiazaiNode.getComponent(SceneManager); // const jiazaiComp1 = jiazaiNode.getComponent(SceneManager);
if (jiazaiComp1) { // if (jiazaiComp1) {
setTimeout(() => { // setTimeout(() => {
jiazaiComp1.updateCoin(); // jiazaiComp1.updateCoin();
// 确保openRewardWindow方法存在 // // 确保openRewardWindow方法存在
if (typeof jiazaiComp1.openRewardWindow === 'function') { // if (typeof jiazaiComp1.openRewardWindow === 'function') {
jiazaiComp1.openRewardWindow(rewardData); // jiazaiComp1.openRewardWindow(rewardData);
} else { // } else {
console.error("SceneManager组件中没有openRewardWindow方法"); // console.error("SceneManager组件中没有openRewardWindow方法");
// 尝试使用JiaZai组件的openRewardWindow方法作为备选 // // 尝试使用JiaZai组件的openRewardWindow方法作为备选
const jiazaiComp2 = jiazaiNode.getComponent(JiaZai); // const jiazaiComp2 = jiazaiNode.getComponent(JiaZai);
if (jiazaiComp2 && typeof jiazaiComp2.openRewardWindow === 'function') { // if (jiazaiComp2 && typeof jiazaiComp2.openRewardWindow === 'function') {
jiazaiComp2.openRewardWindow(rewardData); // jiazaiComp2.openRewardWindow(rewardData);
} // }
} // }
}, 300); // }, 300);
console.log("月卡奖励junei"); // console.log("月卡奖励junei");
} else { // } else {
console.log("无法获取SceneManager组件尝试获取JiaZai组件"); // console.log("无法获取SceneManager组件尝试获取JiaZai组件");
// 尝试获取JiaZai组件作为备选 // // 尝试获取JiaZai组件作为备选
const jiazaiComp2 = jiazaiNode.getComponent(JiaZai); // const jiazaiComp2 = jiazaiNode.getComponent(JiaZai);
if (jiazaiComp2) { // if (jiazaiComp2) {
setTimeout(() => { // setTimeout(() => {
jiazaiComp2.updateCoin(); // jiazaiComp2.updateCoin();
jiazaiComp2.openRewardWindow(rewardData); // jiazaiComp2.openRewardWindow(rewardData);
}, 300); // }, 300);
} else { // } else {
console.error("无法获取JiaZai组件和SceneManager组件"); // console.error("无法获取JiaZai组件和SceneManager组件");
} // }
} // }
} // }
cc.fx.GameTool.setUserHealth(0, (data) => { cc.fx.GameTool.setUserHealth(0, (data) => {
cc.fx.GameTool.getHealth(null); cc.fx.GameTool.getHealth(null);
}) })
let shop = cc.find("Canvas/shop");
if (shop) {
let shopComp = shop.getComponent("shop");
if (shopComp) {
shopComp.openShop();
}
}
} }
}) })
// update (dt) {} // update (dt) {}
@ -135,9 +255,222 @@ export default class NewClass extends cc.Component {
if (shop) { if (shop) {
let shopComp = shop.getComponent("shop"); let shopComp = shop.getComponent("shop");
if (shopComp) { if (shopComp) {
shopComp.updateIcon(); shopComp.openShop();
} }
} }
// 移除 wx.onShow 监听器
if (cc.sys.platform === cc.sys.WECHAT_GAME && this.onShowListener) {
//@ts-ignore
wx.offShow(this.onShowListener);
}
//jiazai
const jiazaiNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点
const jiazaiComp = jiazaiNode.getComponent(JiaZai);
if (jiazaiComp && this.home == 1) {
this.home = 0;
jiazaiComp.rewarded();
}
this.node.active = false; this.node.active = false;
} }
buyProduct(event, customData) {
if (!this.btn_Touch) {
return;
}
this.btn_Touch = false;
const productId = customData;
let id = "10011";
let price = 100;
let count = 1;
id = productId;
switch (productId) {
case "month_Test":
price = 100;
break;
}
console.log("获得商品id:", id, count, price);
// 判断设备系统
let systemType = "Android";
try {
//@ts-ignore
const systemInfo = wx.getSystemInfoSync();
if (systemInfo.platform === 'ios') {
systemType = "ios";
}
} catch (e) {
console.error('获取系统信息失败', e);
}
// Utils.GoKEFu();
if (systemType == "ios") {
// MiniGameSdk.API.showToast("IOS系统暂不支持支付");
// this.btn_Touch = true;
this.openLoad();
this.btn_Touch = true;
let iosPayInfo = {
price: price,
payment_name: productId,
payment_count: 1,
}
this.iosPrice = price;
this.iosProductId = productId;
this.iosCount = 1;
Utils.GoKEFu(iosPayInfo, (res) => {
this.closeLoad();
});
}
else {
// MiniGameSdk.API.showToast("充值成功");
// cc.fx.GameTool.shopBuy(productId, false);
// setTimeout(() => {
// if (productId == "unlimited_health_bundle_1" ||
// productId == "unlimited_health_bundle_2" ||
// productId == "unlimited_health_bundle_3"
// ) {
// console.log("触发————————updatePower");
// this.updatePower();
// }
// }, 500);
this.openLoad();
this.btn_Touch = true;
//console.log("7.14_____________________", "调用充值接口");
Utils.buyProp(id, count, price, systemType, productId, (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("充值成功");
cc.fx.GameTool.shopBuy(productId, false);
if (productId == "month_Test") {
this.buyMonthCard();
}
//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);
}
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();
}
}, Utils.outTradeNo)
}
else {
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();
}
}
})
}
});
}
}
openLoad() {
this.node.getChildByName("Loading").active = true;
this.node.getChildByName("Loading").getChildByName("load").stopAllActions();
this.node.getChildByName("Loading").getChildByName("load").runAction(cc.rotateTo(2, 1080).repeatForever());
}
closeLoad() {
this.node.getChildByName("Loading").active = false;
}
onDestroy() {
}
} }

View File

@ -0,0 +1,459 @@
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "Loading",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 6
},
{
"__id__": 9
}
],
"_active": false,
"_components": [
{
"__id__": 12
}
],
"_prefab": {
"__id__": 13
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1080,
"height": 1920
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "New Sprite(Splash)",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 4
}
],
"_prefab": {
"__id__": 5
},
"_opacity": 120,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 3000,
"height": 3000
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.BlockInputEvents",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "47UiHH16RKK6j+4cK469um",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "load",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 7
}
],
"_prefab": {
"__id__": 8
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 689,
"height": 656
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
0.5,
0.5,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "794efc8c-624c-469f-84c0-24ce84022c54"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "e0njfM7epDhL+otsGYSeCR",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "New Label",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 10
}
],
"_prefab": {
"__id__": 11
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 135,
"height": 56.7
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "请稍后",
"_N$string": "请稍后",
"_fontSize": 45,
"_lineHeight": 45,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "fa+8dDqrdLTrl/Ji8K9LMX",
"sync": false
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "",
"sync": false
}
]

View File

@ -0,0 +1,9 @@
{
"ver": "1.3.2",
"uuid": "9fdc6671-8422-410b-b9af-36dab20f1488",
"importer": "prefab",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}

View File

@ -25,19 +25,22 @@
}, },
{ {
"__id__": 11 "__id__": 11
},
{
"__id__": 50
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 50 "__id__": 63
}, },
{ {
"__id__": 51 "__id__": 64
} }
], ],
"_prefab": { "_prefab": {
"__id__": 52 "__id__": 65
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
@ -1077,8 +1080,8 @@
}, },
"component": "", "component": "",
"_componentId": "191edqNaKdPtJiA4/cSsB1N", "_componentId": "191edqNaKdPtJiA4/cSsB1N",
"handler": "buyMonthCard", "handler": "buyProduct",
"customEventData": "" "customEventData": "month_Test"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@ -1112,7 +1115,7 @@
"__id__": 39 "__id__": 39
} }
], ],
"_active": true, "_active": false,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 41 "__id__": 41
@ -1840,6 +1843,453 @@
"fileId": "6egnD5q+NBGbs/MwTRh+vm", "fileId": "6egnD5q+NBGbs/MwTRh+vm",
"sync": false "sync": false
}, },
{
"__type__": "cc.Node",
"_name": "Loading",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 51
},
{
"__id__": 55
},
{
"__id__": 58
}
],
"_active": false,
"_components": [
{
"__id__": 61
}
],
"_prefab": {
"__id__": 62
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1080,
"height": 1920
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "New Sprite(Splash)",
"_objFlags": 0,
"_parent": {
"__id__": 50
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 52
},
{
"__id__": 53
}
],
"_prefab": {
"__id__": 54
},
"_opacity": 120,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 3000,
"height": 3000
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 51
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.BlockInputEvents",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 51
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 50
},
"asset": {
"__uuid__": "9fdc6671-8422-410b-b9af-36dab20f1488"
},
"fileId": "47UiHH16RKK6j+4cK469um",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "load",
"_objFlags": 0,
"_parent": {
"__id__": 50
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 56
}
],
"_prefab": {
"__id__": 57
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 689,
"height": 656
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
0.5,
0.5,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 55
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "794efc8c-624c-469f-84c0-24ce84022c54"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 50
},
"asset": {
"__uuid__": "9fdc6671-8422-410b-b9af-36dab20f1488"
},
"fileId": "e0njfM7epDhL+otsGYSeCR",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "New Label",
"_objFlags": 0,
"_parent": {
"__id__": 50
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 59
}
],
"_prefab": {
"__id__": 60
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 135,
"height": 56.7
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 58
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "请稍后",
"_N$string": "请稍后",
"_fontSize": 45,
"_lineHeight": 45,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 50
},
"asset": {
"__uuid__": "9fdc6671-8422-410b-b9af-36dab20f1488"
},
"fileId": "fa+8dDqrdLTrl/Ji8K9LMX",
"sync": false
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 50
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 50
},
"asset": {
"__uuid__": "9fdc6671-8422-410b-b9af-36dab20f1488"
},
"fileId": "05q/aTGl5Lioy2OJNs5XYl",
"sync": false
},
{ {
"__type__": "cc.Widget", "__type__": "cc.Widget",
"_name": "", "_name": "",

View File

@ -45,10 +45,12 @@ export default class NewClass extends cc.Component {
scheduleCallback3: any; scheduleCallback3: any;
scheduleCallback2: Function; scheduleCallback2: Function;
reward: boolean = false; reward: boolean = false;
private monthCard: boolean = false;
onLoad() { onLoad() {
this.btn_Touch = true; this.btn_Touch = true;
this.monthCard = false;
// 检测微信小游戏切到后台 // 检测微信小游戏切到后台
if (cc.sys.platform === cc.sys.WECHAT_GAME) { if (cc.sys.platform === cc.sys.WECHAT_GAME) {
// 定义监听函数 // 定义监听函数
@ -83,6 +85,7 @@ export default class NewClass extends cc.Component {
Utils.outTradeNo = null; Utils.outTradeNo = null;
// 商品数据数组 // 商品数据数组
const products = [ const products = [
{ product_id: "gold_1", name: "金币包1", price: 600, coin: 1200, title: "3x2六档金币" },
{ product_id: "gold_1", name: "金币包1", price: 600, coin: 1200, title: "3x2六档金币" }, { product_id: "gold_1", name: "金币包1", price: 600, coin: 1200, title: "3x2六档金币" },
{ product_id: "gold_2", name: "金币包2", price: 3600, coin: 8000, title: "" }, { product_id: "gold_2", name: "金币包2", price: 3600, coin: 8000, title: "" },
{ product_id: "gold_3", name: "金币包3", price: 6800, coin: 16000, title: "" }, { product_id: "gold_3", name: "金币包3", price: 6800, coin: 16000, title: "" },
@ -90,7 +93,7 @@ export default class NewClass extends cc.Component {
{ product_id: "gold_5", name: "金币包5", price: 32800, coin: 100000, title: "" }, { product_id: "gold_5", name: "金币包5", price: 32800, coin: 100000, title: "" },
{ product_id: "gold_6", name: "金币包6", price: 64800, coin: 240000, title: "" }, { product_id: "gold_6", name: "金币包6", price: 64800, coin: 240000, title: "" },
]; ];
for (let i = 1; i <= 6 && 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);
const price = this.itemList.children[i].children[1]; const price = this.itemList.children[i].children[1];
const title = this.itemList.children[i].children[2]; const title = this.itemList.children[i].children[2];
@ -178,6 +181,10 @@ export default class NewClass extends cc.Component {
} }
onShow() { onShow() {
//如果月卡打开就return
if (this.monthCard) {
return;
}
if (cc.sys.platform === cc.sys.WECHAT_GAME) { if (cc.sys.platform === cc.sys.WECHAT_GAME) {
console.log("从后台进入前台订单号:", cc.fx.GameConfig.GM_INFO.iosOutTradeNo); console.log("从后台进入前台订单号:", cc.fx.GameConfig.GM_INFO.iosOutTradeNo);
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 != "") {
@ -663,6 +670,7 @@ export default class NewClass extends cc.Component {
} }
} }
} }
this.monthCard = true;
Utils.getMonthlyCard((data) => { Utils.getMonthlyCard((data) => {
if (data.msg == "不在有效期") { if (data.msg == "不在有效期") {
this.monthCardTime.active = false; this.monthCardTime.active = false;