弹出礼包:添加两种条件
This commit is contained in:
@@ -195,6 +195,8 @@ export enum POP_UP_SHOP_CONDITION_TYPE {
|
||||
PVP = 6, // pvp
|
||||
EQUIP_STAR = 7, // 装备精炼
|
||||
AUCTION = 8, // 拍卖行
|
||||
TITLE = 9, // 爵位到达x
|
||||
TOWER = 10, // 镇念塔到达x层
|
||||
}
|
||||
|
||||
export enum POP_UP_SHOP_REFRESH_TIME_TYPE {
|
||||
|
||||
@@ -62,6 +62,7 @@ export class NewHeroGiftData extends ActivityBase {
|
||||
let dataObj: NewHeroGiftDataInDb = JSON.parse(data);
|
||||
this.hid = dataObj.hid;
|
||||
this.position = dataObj.position;
|
||||
this.consumePoint = dataObj.consumePoint;
|
||||
this.explain = dataObj.explain
|
||||
let arr = dataObj.rewards||[];
|
||||
for (let obj of arr) {
|
||||
|
||||
@@ -83,6 +83,10 @@ export class PopUpShopData extends ActivityBase {
|
||||
}
|
||||
}
|
||||
|
||||
public findByConditionType(conditionType: number) {
|
||||
return this.packages.filter(cur => cur.conditionType == conditionType);
|
||||
}
|
||||
|
||||
//解析玩家开启的商店记录
|
||||
public setPlayerRecords(datas: ActivityPopUpShopModelType[], latestRecords: ActivityPopUpShopModelType[], totalPay: number, lv: number) {
|
||||
if (!datas) return;
|
||||
@@ -221,10 +225,9 @@ export class PopUpShopPackage {
|
||||
|
||||
if(data.beginTime <= now && data.endTime > now) { // 正在进行中
|
||||
for(let itemData of data.items) {
|
||||
let item = this.findItemByProductID(itemData.productID);
|
||||
let item = this.findItemById(itemData.id);
|
||||
if(item) {
|
||||
item.setPlayerRecords(data, itemData);
|
||||
console.log('#### item.isPushing', item.isPushing)
|
||||
if(item.isPushing) this.isPushing = true;
|
||||
}
|
||||
}
|
||||
@@ -237,7 +240,7 @@ export class PopUpShopPackage {
|
||||
}
|
||||
|
||||
for(let itemData of data.items) {
|
||||
let item = this.findItemByProductID(itemData.productID);
|
||||
let item = this.findItemById(itemData.id);
|
||||
if(item) {
|
||||
item.addPushCnt();
|
||||
}
|
||||
@@ -332,7 +335,7 @@ export class PopUpShopPackage {
|
||||
this.addPlayerRecord(popUpShopRec);
|
||||
let items: PopUpShopItemShow[] = [];
|
||||
for(let item of popUpShopRec.items) {
|
||||
let itemObj = this.findItemByProductID(item.productID);
|
||||
let itemObj = this.findItemById(item.id);
|
||||
if(itemObj && itemObj.isPushing) {
|
||||
let obj = new PopUpShopItemShow(itemObj);
|
||||
items.push(obj);
|
||||
@@ -432,6 +435,10 @@ export class PopShopItem {
|
||||
return param.equipStar >= this.conditionParam[0];
|
||||
case POP_UP_SHOP_CONDITION_TYPE.AUCTION:
|
||||
return true;
|
||||
case POP_UP_SHOP_CONDITION_TYPE.TITLE:
|
||||
return param.oldLv < this.conditionParam[0] && param.newLv >= this.conditionParam[0];
|
||||
case POP_UP_SHOP_CONDITION_TYPE.TOWER:
|
||||
return param.oldLv < this.conditionParam[0] && param.newLv >= this.conditionParam[0];
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -439,10 +446,10 @@ export class PopShopItem {
|
||||
|
||||
public checkKeyTime() {
|
||||
let keyItem = this.parent.keyItem;
|
||||
console.log('####', keyItem)
|
||||
// console.log('####', keyItem)
|
||||
for(let key of keyItem) {
|
||||
let hasCurKey = this.rewardInter.find(cur => cur.id == key.gid);
|
||||
console.log('#### hasCurKey', hasCurKey, key.hasBoughtCnt, key.max)
|
||||
// console.log('#### hasCurKey', hasCurKey, key.hasBoughtCnt, key.max)
|
||||
if(hasCurKey && key.hasBoughtCnt > key.max) return false;
|
||||
}
|
||||
return true;
|
||||
@@ -469,7 +476,7 @@ export class PopUpShopKeyItem {
|
||||
}
|
||||
|
||||
addHasBoughtCnt(items: ActivityPopUpShopItem[]) {
|
||||
console.log('###### addHasBoughtCnt', items)
|
||||
// console.log('###### addHasBoughtCnt', items)
|
||||
for(let { rewards, hasBoughtCnt } of items) {
|
||||
for(let { id, count } of rewards) {
|
||||
if(id == this.gid) this.hasBoughtCnt += count * hasBoughtCnt;
|
||||
|
||||
Reference in New Issue
Block a user