活动:大富翁
This commit is contained in:
@@ -13,6 +13,7 @@ export class DailyGKItem {
|
||||
|
||||
constructor(data: any) {
|
||||
this.dayIndex = data.dayIndex;
|
||||
this.gk = data.gk;
|
||||
this.name = data.name;
|
||||
this.reward = data.reward;
|
||||
this.isSuccess = false;
|
||||
|
||||
73
shared/domain/activityField/monopolyField.ts
Normal file
73
shared/domain/activityField/monopolyField.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivityMonopolyModelType } from '../../db/ActivityMonopoly';
|
||||
import { ActivityMonopolyLandModelType } from '../../db/ActivityMonopolyLand';
|
||||
import { ActivityBase } from './activityField';
|
||||
|
||||
|
||||
// 地块数据
|
||||
export class LandItem {
|
||||
position: number; // 位置
|
||||
name: string; // 名字
|
||||
level: number; // 等级
|
||||
rewards: string[]; // 奖励,格式:1&3&1(类型&id&数量) 类型定义:1.英雄,2.物品
|
||||
landType: number //土地性质 LAND_TYPE
|
||||
saveMax: number //银行存钱最大数额
|
||||
takeOutMax: number //银行取钱最大次数
|
||||
shopActivityId: number //商店对应的商店id
|
||||
|
||||
record: any[] = []; //历史操作
|
||||
stopCount: number //停留次数
|
||||
|
||||
constructor(data: any) {
|
||||
this.position = data.position;
|
||||
this.name = data.name;
|
||||
this.level = data.level;
|
||||
this.rewards = data.rewards;
|
||||
this.landType = data.landType;
|
||||
this.saveMax = data.saveMax;
|
||||
this.takeOutMax = data.takeOutMax;
|
||||
this.shopActivityId = data.shopActivityId;
|
||||
this.record = [];
|
||||
this.stopCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 活动数据
|
||||
export class MonopolyData extends ActivityBase {
|
||||
curPosition: number; // 当前位置
|
||||
roundIndex: number; // 回合数
|
||||
list: Array<LandItem> = [];
|
||||
|
||||
public findMonopolyItem(position: number) {
|
||||
let index = this.list.findIndex(obj => { return obj && obj.position == position })
|
||||
return (index != -1) ? this.list[index] : null;
|
||||
}
|
||||
|
||||
//解析玩家领取记录
|
||||
public setPlayerRecords(data: ActivityMonopolyModelType, landDataArray: ActivityMonopolyLandModelType[]) {
|
||||
this.curPosition = (data && data.curPosition) ? data.curPosition : 0;
|
||||
this.roundIndex = (data && data.roundIndex) ? data.roundIndex : 0;
|
||||
|
||||
for (let landData of landDataArray) {
|
||||
let index = this.list.findIndex(item => { return item.position == landData.position })
|
||||
if (index != -1) {
|
||||
this.list[index].level = landData.level;
|
||||
this.list[index].record = landData.record ? landData.record : [];
|
||||
this.list[index].stopCount = landData.stopCount ? landData.stopCount : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public initData(data: string) {
|
||||
let arr = JSON.parse(data);
|
||||
for (let obj of arr) {
|
||||
this.list.push(new LandItem(obj))
|
||||
}
|
||||
}
|
||||
|
||||
constructor(activityData: ActivityModelType) {
|
||||
super(activityData)
|
||||
this.initData(activityData.data)
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,7 @@ export class RefreshShopPage {
|
||||
|
||||
// 商店数据
|
||||
export class RefreshShopData extends ActivityBase {
|
||||
shopType: number = 0;//商店类型,用于客户端显示使用
|
||||
name: string = '';//活动名称
|
||||
interval: number = 0;//周期间隔(秒)
|
||||
list: Array<RefreshShopPage> = [];//商品列表
|
||||
@@ -96,6 +97,7 @@ export class RefreshShopData extends ActivityBase {
|
||||
public initData(data: string) {
|
||||
this.nextRefreshTime = this.endTime;
|
||||
let dataObj = JSON.parse(data);
|
||||
this.shopType = dataObj.shopType;
|
||||
this.name = dataObj.name;
|
||||
this.interval = dataObj.interval;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user