更新活动礼包活动
This commit is contained in:
@@ -97,6 +97,8 @@ export class GameConfig {
|
||||
coin: number; //用户金币
|
||||
film: number; //头像抽卡代币
|
||||
catArr: any[]; //用户猫数组
|
||||
jungleTreasureState?: any; //登录返回的丛林宝藏状态;未触发活动的用户不存在此属性
|
||||
jungleTreasureServerNow?: number; //登录接口返回状态时的服务器时间
|
||||
success: boolean; //用户游戏成功与否
|
||||
matchId: any; //用于埋点上传的ID
|
||||
gameState: boolean; custom: number; //用于测试跳关卡
|
||||
@@ -135,6 +137,7 @@ export class GameConfig {
|
||||
otherLevel: number; //其他被帮助用户等级
|
||||
helpLevel: number; //帮助用户等级
|
||||
iosShopOrder: string; //ios订单号商城
|
||||
iosJungleOrder: string; //iOS 客服旧支付的丛林宝藏订单号
|
||||
iosMonthOrder: string; //ios订单号月卡
|
||||
iosReviveOrder: string; //ios订单号复活
|
||||
iosStarterOrder: string; //ios订单号新手
|
||||
@@ -320,7 +323,7 @@ export class GameConfig {
|
||||
vibrateOpen: true, //震动
|
||||
coinnum: 0, //每局的金币数
|
||||
paid_user: false, //是否是付费用户
|
||||
version: "1.0.21", //版本号
|
||||
version: "1.0.23", //版本号
|
||||
shushu_DistinctId: "", //数数访客ID
|
||||
shushu_AccountId: "", //数数账号ID
|
||||
uid: "", //用户和后端唯一id
|
||||
@@ -338,6 +341,7 @@ export class GameConfig {
|
||||
otherLevel: 0, //其他被帮助用户等级
|
||||
helpLevel: 0, //帮助用户等级
|
||||
iosShopOrder: "", //ios订单号商城
|
||||
iosJungleOrder: "", //iOS 客服旧支付的丛林宝藏订单号
|
||||
iosMonthOrder: "", //ios订单号月卡
|
||||
iosReviveOrder: "", //ios订单号复活
|
||||
iosStarterOrder: "", //ios订单号新手
|
||||
|
||||
@@ -225,6 +225,10 @@ export default class Utils {
|
||||
cc.fx.GameConfig.GM_INFO.iosPassCheckOrder = null;
|
||||
cc.fx.GameConfig.GM_INFO.iosPassCheckOrder = order;
|
||||
}
|
||||
else if (/^jungle_treasure_\d+$/.test(String(iosPayInfo.payment_name || ""))) {
|
||||
cc.fx.GameConfig.GM_INFO.iosJungleOrder = null;
|
||||
cc.fx.GameConfig.GM_INFO.iosJungleOrder = order;
|
||||
}
|
||||
else {
|
||||
cc.fx.GameConfig.GM_INFO.iosShopOrder = null;
|
||||
cc.fx.GameConfig.GM_INFO.iosShopOrder = order;
|
||||
@@ -1029,6 +1033,46 @@ export default class Utils {
|
||||
makeRequest();
|
||||
}
|
||||
|
||||
//#region 丛林宝藏活动
|
||||
/** 获取丛林宝藏配置和玩家档位状态 */
|
||||
static getJungleTreasure(callBack) {
|
||||
//@ts-ignore
|
||||
if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) {
|
||||
let uid = cc.fx.StorageMessage.getStorage("uid");
|
||||
if (uid != undefined && uid != "" && uid != null) {
|
||||
cc.fx.GameConfig.GM_INFO.uid = uid;
|
||||
}
|
||||
let setData = {
|
||||
uid: cc.fx.GameConfig.GM_INFO.uid,
|
||||
action: 'read',
|
||||
}
|
||||
Utils.POST("jungleTreasure", setData, res => {
|
||||
console.log("获得丛林宝藏数据:", res);
|
||||
if (callBack) callBack(res);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** 领取丛林宝藏指定档位,tierId 从 1 开始 */
|
||||
static claimJungleTreasure(tierId, callBack) {
|
||||
//@ts-ignore
|
||||
if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) {
|
||||
let uid = cc.fx.StorageMessage.getStorage("uid");
|
||||
if (uid != undefined && uid != "" && uid != null) {
|
||||
cc.fx.GameConfig.GM_INFO.uid = uid;
|
||||
}
|
||||
let setData = {
|
||||
uid: cc.fx.GameConfig.GM_INFO.uid,
|
||||
action: 'claim',
|
||||
tierId: tierId,
|
||||
}
|
||||
Utils.POST("jungleTreasure", setData, res => {
|
||||
console.log("领取丛林宝藏数据:", res);
|
||||
if (callBack) callBack(res);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//#region 新手礼包相关
|
||||
//获取新手礼包是否能显示
|
||||
static getStarter_pack(callBack) {
|
||||
|
||||
@@ -1071,7 +1071,7 @@ var GameTool = {
|
||||
cc.fx.GameTool.changeCoin(2500);
|
||||
coin = 2500;
|
||||
price = 1000;
|
||||
this.setUserPowerTime(3600);
|
||||
this.setUserPowerTime(3600, "unlimited_health_bundle_10");
|
||||
// MiniGameSdk.API.showToast("获得无限体力小组合包");
|
||||
rewardData = [
|
||||
{ type: "coin", count: coin },
|
||||
@@ -1089,7 +1089,7 @@ var GameTool = {
|
||||
"price": price
|
||||
}
|
||||
this.getShopProp(propData, compensate);
|
||||
this.setUserPowerTime(7200);
|
||||
this.setUserPowerTime(7200, "unlimited_health_bundle_20");
|
||||
// MiniGameSdk.API.showToast("获得无限体力大组合包");
|
||||
rewardData = [
|
||||
{ type: "coin", count: coin },
|
||||
@@ -1110,7 +1110,7 @@ var GameTool = {
|
||||
"price": price
|
||||
}
|
||||
this.getShopProp(propData2, compensate);
|
||||
this.setUserPowerTime(14400);
|
||||
this.setUserPowerTime(14400, "unlimited_health_bundle_30");
|
||||
// MiniGameSdk.API.showToast("获得无限体力超组合包");
|
||||
rewardData = [
|
||||
{ type: "coin", count: coin },
|
||||
@@ -1213,6 +1213,18 @@ var GameTool = {
|
||||
propInfo.freezeAmount = cc.fx.GameConfig.GM_INFO.freezeAmount;
|
||||
propInfo.timestamp = timestamp;
|
||||
|
||||
let isGetType = "battlepass";
|
||||
if (getType === "jungle") {
|
||||
isGetType = "jungle";
|
||||
}
|
||||
else if (getType) {
|
||||
isGetType = "redeem_code";
|
||||
}
|
||||
const isInfiniteHealth = porpId >= 3001 && porpId <= 3005;
|
||||
const getInfiniteHealthSeconds = (defaultSeconds: number) => {
|
||||
return getType === "jungle" ? num : defaultSeconds;
|
||||
};
|
||||
|
||||
switch (porpId) {
|
||||
case 1001:
|
||||
cc.fx.GameTool.changeCoin(num);
|
||||
@@ -1244,28 +1256,34 @@ var GameTool = {
|
||||
break;
|
||||
case 3001:
|
||||
console.log("getPassCheckPorp道具1:", porpId)
|
||||
this.setUserPowerTime(900);
|
||||
this.setUserPowerTime(getInfiniteHealthSeconds(900), isGetType);
|
||||
break;
|
||||
case 3002:
|
||||
this.setUserPowerTime(1800);
|
||||
this.setUserPowerTime(getInfiniteHealthSeconds(1800), isGetType);
|
||||
break;
|
||||
case 3003:
|
||||
this.setUserPowerTime(3600);
|
||||
this.setUserPowerTime(getInfiniteHealthSeconds(3600), isGetType);
|
||||
break;
|
||||
case 3004:
|
||||
this.setUserPowerTime(getInfiniteHealthSeconds(7200), isGetType);
|
||||
break;
|
||||
case 3005:
|
||||
this.setUserPowerTime(getInfiniteHealthSeconds(10800), isGetType);
|
||||
break;
|
||||
|
||||
}
|
||||
let isGetType = "battlepass";
|
||||
if (getType) {
|
||||
isGetType = "redeem_code";
|
||||
|
||||
// 无限体力由 setUserPowerTime 统一发送 id=2005 的 resource_get,避免重复上报。
|
||||
if (!isInfiniteHealth) {
|
||||
const dataTemp = {
|
||||
change_reason: isGetType,
|
||||
id: porpId,
|
||||
num: num,
|
||||
compensate: compensate
|
||||
}
|
||||
console.log("通行证发放奖励", porpId, num)
|
||||
cc.fx.GameTool.shushu_Track("resource_get", dataTemp);
|
||||
}
|
||||
const dataTemp = {
|
||||
change_reason: isGetType,
|
||||
id: porpId,
|
||||
num: num,
|
||||
compensate: compensate
|
||||
}
|
||||
console.log("通行证发放奖励", porpId, num)
|
||||
cc.fx.GameTool.shushu_Track("resource_get", dataTemp);
|
||||
},
|
||||
|
||||
formatDate(date: Date): string {
|
||||
@@ -1472,6 +1490,18 @@ var GameTool = {
|
||||
is_paid_bp_usr: data.is_paid_bp_usr,//是否是战令付费档位, boolean
|
||||
}
|
||||
break;
|
||||
case "enter_jungle":
|
||||
eventData = {
|
||||
source: data.source,
|
||||
}
|
||||
break;
|
||||
case "pay_jungle":
|
||||
case "collect_jungle":
|
||||
eventData = {
|
||||
current_block: data.current_block,
|
||||
source: data.source,
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (name == "stage_help") {
|
||||
console.log("准备上报完成", data);
|
||||
@@ -1605,25 +1635,35 @@ var GameTool = {
|
||||
|
||||
|
||||
//购买无限体力
|
||||
setUserPowerTime(time) {
|
||||
setUserPowerTime(time, reason, compensate = false) {
|
||||
//@ts-ignore
|
||||
if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) {
|
||||
const actualSeconds = Math.max(0, Number(time) || 0);
|
||||
if (actualSeconds <= 0) {
|
||||
return;
|
||||
}
|
||||
let nowTime = Math.floor(Date.now() / 1000);
|
||||
let powerTime = cc.fx.StorageMessage.getStorage("userPowerTime");
|
||||
console.log("现在时间:", nowTime, "无限体力时间:", powerTime, "增加时间:", time);
|
||||
if (powerTime == "undifend" || powerTime == null || powerTime == "" || powerTime == 0) {
|
||||
powerTime = Math.floor(Date.now() / 1000) + time;
|
||||
powerTime = Math.floor(Date.now() / 1000) + actualSeconds;
|
||||
} else {
|
||||
if (nowTime >= powerTime) {
|
||||
powerTime = nowTime + time;
|
||||
powerTime = nowTime + actualSeconds;
|
||||
}
|
||||
else {
|
||||
powerTime = powerTime + time;
|
||||
powerTime = powerTime + actualSeconds;
|
||||
}
|
||||
}
|
||||
cc.fx.GameConfig.GM_INFO.userPowerTime = powerTime;
|
||||
console.log("最终时间:", powerTime);
|
||||
cc.fx.StorageMessage.setStorage("userPowerTime", powerTime);
|
||||
cc.fx.GameTool.shushu_Track("resource_get", {
|
||||
change_reason: reason || "unknown",
|
||||
id: 2005,
|
||||
num: actualSeconds,
|
||||
compensate: compensate || false,
|
||||
});
|
||||
Utils.setUserPowerTime(powerTime, (data) => {
|
||||
//console.log("购买无限体力同步:", data);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user