活动:弹出礼包添加等级限制
This commit is contained in:
@@ -37,6 +37,7 @@ interface PopUpShopItemInDb {
|
||||
rebate: number; // 折扣用于显示
|
||||
buyCnt: number; // 购买多少次后消失,原来的count字段
|
||||
vipLv: number; // 需要多少级
|
||||
lv: number; // 队伍等级
|
||||
}
|
||||
|
||||
interface PopUpShopKeyItemIbDb {
|
||||
@@ -59,6 +60,7 @@ export class PopUpShopData extends ActivityBase {
|
||||
|
||||
private packageMap: Map<number, number> = new Map();
|
||||
vipLv: number = 0; // 玩家当前等级
|
||||
lv: number = 0; // 玩家等级
|
||||
|
||||
constructor(activityData: ActivityModelType) {
|
||||
super(activityData, 0, 0);
|
||||
@@ -79,10 +81,11 @@ export class PopUpShopData extends ActivityBase {
|
||||
}
|
||||
|
||||
//解析玩家开启的商店记录
|
||||
public setPlayerRecords(datas: ActivityPopUpShopModelType[], latestRecords: ActivityPopUpShopModelType[], totalPay: number) {
|
||||
public setPlayerRecords(datas: ActivityPopUpShopModelType[], latestRecords: ActivityPopUpShopModelType[], totalPay: number, lv: number) {
|
||||
if (!datas) return;
|
||||
|
||||
this.setVipLv(totalPay);
|
||||
this.setLv(lv);
|
||||
for(let data of datas) {
|
||||
let pkg = this.findPackageById(data.id);
|
||||
pkg.addPlayerRecord(data);
|
||||
@@ -102,6 +105,10 @@ export class PopUpShopData extends ActivityBase {
|
||||
}
|
||||
}
|
||||
|
||||
private setLv(lv: number) {
|
||||
if(lv) this.lv = lv;
|
||||
}
|
||||
|
||||
public findPackageById(id: number) {
|
||||
let index = this.packageMap.get(id);
|
||||
return this.packages[index];
|
||||
@@ -186,6 +193,10 @@ export class PopUpShopPackage {
|
||||
return this.parent.vipLv;
|
||||
}
|
||||
|
||||
public getLv() {
|
||||
return this.parent.lv;
|
||||
}
|
||||
|
||||
public findItemByProductID(productID: string) {
|
||||
let index = this.itemByProductID.get(productID);
|
||||
return this.items[index];
|
||||
@@ -335,6 +346,7 @@ export class PopShopItem {
|
||||
pushCnt: number;
|
||||
canLvUp: number;
|
||||
vipLv: number = 0;
|
||||
lv: number = 0;
|
||||
|
||||
rewardInter: RewardInter[] = [];
|
||||
parent: PopUpShopPackage;
|
||||
@@ -360,7 +372,8 @@ export class PopShopItem {
|
||||
this.pushCnt = parent.pushCnt;
|
||||
this.canLvUp = parent.canLvUp;
|
||||
this.parent = parent;
|
||||
this.vipLv = data.vipLv;
|
||||
if(data.vipLv != undefined) this.vipLv = data.vipLv;
|
||||
if(data.lv != undefined) this.lv = data.lv;
|
||||
}
|
||||
|
||||
public setPlayerRecords(data: ActivityPopUpShopModelType, item: ActivityPopUpShopItem) {
|
||||
@@ -379,13 +392,15 @@ export class PopShopItem {
|
||||
console.log('##### xyz?1', this.hasBoughtCnt >= this.buyCnt)
|
||||
if(this.hasBoughtCnt >= this.buyCnt) return false;
|
||||
console.log('##### xyz?2', this.parent.getVipLv(), this.vipLv, this.parent.getVipLv() < this.vipLv)
|
||||
if(this.parent.getVipLv() < this.vipLv) return false;
|
||||
console.log('##### xyz?3', this.checkKeyTime())
|
||||
if(this.parent.getVipLv() < this.vipLv || this.parent.getLv() < this.lv) return false;
|
||||
console.log('##### xyz?3', this.parent.getLv(), this.lv, this.parent.getLv() < this.lv)
|
||||
if(this.parent.getLv() < this.lv) return false;
|
||||
console.log('##### xyz?4', this.checkKeyTime())
|
||||
if(!this.checkKeyTime()) return false
|
||||
console.log('##### xyz?4', this.canLvUp, this.hasPushCnt, this.pushCnt, this.pushCnt != -1, this.hasPushCnt >= this.pushCnt)
|
||||
console.log('##### xyz?5', this.canLvUp, this.hasPushCnt, this.pushCnt, this.pushCnt != -1, this.hasPushCnt >= this.pushCnt)
|
||||
if(this.canLvUp == 0 && this.pushCnt != -1 && this.hasPushCnt >= this.pushCnt) return false
|
||||
|
||||
console.log('##### xyz?5', conditionType, this.conditionParam, param)
|
||||
console.log('##### xyz?6', conditionType, this.conditionParam, param)
|
||||
switch(conditionType) {
|
||||
case POP_UP_SHOP_CONDITION_TYPE.LV_TO:
|
||||
return param.oldLv < this.conditionParam[0] && param.newLv >= this.conditionParam[0];
|
||||
|
||||
Reference in New Issue
Block a user