48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
|
||
// 弹框商店
|
||
export class PopUpShopData {
|
||
|
||
id: number; // 第几个,从1开始
|
||
name: string; //名字
|
||
consume: string; //消耗资源(这里优先rmb的price价格,其次资源消耗)
|
||
price: number; // 商品价格
|
||
productID: string; // 商品id支付时使用
|
||
reward: string; //任务奖励,格式:1&3&1(类型&id&数量) 类型定义:1.英雄,2.物品
|
||
rebate: number; // 折扣用于显示
|
||
duration: number; // 持续时间,单位小时
|
||
taskType: number; // 任务类型
|
||
taskParam: number; // 任务参数
|
||
condition: number; // 任务条件
|
||
isBuy: boolean = false; //购买过
|
||
|
||
// //解析玩家购买记录
|
||
// public setPlayerRecords(data: ActivityPopUpShopModelType) {
|
||
// if (!data) {
|
||
// return;
|
||
// }
|
||
// for (let item of this.list) {
|
||
// let buyRecords = data.records.filter(obj => { return obj && obj.id === item.id });
|
||
// item.buyCount = buyRecords.length;
|
||
// }
|
||
// }
|
||
|
||
|
||
public initData(data: any) {
|
||
this.id = data.id;
|
||
this.reward = data.reward;
|
||
this.consume = data.consume ? data.consume : '';
|
||
this.price = data.price ? data.price : 0;
|
||
this.productID = data.productID ? data.productID : '';
|
||
this.name = data.name;
|
||
this.rebate = data.rebate;
|
||
this.duration = data.duration;
|
||
this.taskType = data.taskType;
|
||
this.taskParam = data.taskParam;
|
||
this.condition = data.condition;
|
||
this.isBuy = false;
|
||
}
|
||
|
||
constructor(activityData: any) {
|
||
this.initData(activityData)
|
||
}
|
||
} |