优化:减少初始以及合成武将时返回的数据

This commit is contained in:
luying
2022-04-07 18:36:46 +08:00
parent f20583125d
commit 3cb5c650e2
13 changed files with 63 additions and 56 deletions

View File

@@ -1,25 +0,0 @@
interface QuenchAddParam {
id: number; // 属性id
value: number; // 增加的值
}
export class QuenchLogParam {
times: number; // 第几次
isCriticle: boolean; // 是否暴击
add: QuenchAddParam[];
constructor(isCriticle: boolean, add: Map<number, number>) {
this.isCriticle = isCriticle;
let arr: QuenchAddParam[] = [];
for(let [id, value] of add) {
arr.push({ id, value });
}
this.add = arr;
}
setTimes(times: number) {
this.times = times;
}
}

View File

@@ -1,5 +1,6 @@
import { Connect, EPlace, HeroSkin, HeroType, HeroUpdate, Talent } from '../../db/Hero';
import { JewelType, RandSe } from '../../db/Jewel';
import { gameData } from '../../pubUtils/data';
export interface CreateHeroParam extends HeroUpdate {
hid: number;
@@ -34,7 +35,6 @@ class HeroSKinParam {
// 传给客户端的武将数据
export class HeroParam {
hid: number; // 武将 id
hName: string; // 武将名
seqId: number; // 武将表自增 id
exp: number; // 经验值
@@ -69,7 +69,6 @@ export class HeroParam {
constructor(hero: HeroType) {
this.seqId = hero.seqId;
this.hid = hero.hid;
this.hName = hero.hName;
this.exp = hero.exp;
this.lv = hero.lv;
this.ce = hero.ce;
@@ -99,4 +98,31 @@ export class HeroParam {
}
this.ePlace = hero.ePlace;
}
}
}
export class JewelParam {
seqId: number; // 唯一id
id: number; // 装备id
name: string; // 装备名
hid: number; // 装备此装备的武将
ePlaceId: number; // 装备在哪个位置
randSe: RandSe[];
count: number;
inc: number;
reason: number;
constructor(jewel: JewelType, isPush?: boolean, reason?: number) {
this.seqId = jewel.seqId;
this.id = jewel.id;
this.name = jewel.name;
this.hid = jewel.hid;
this.ePlaceId = jewel.ePlaceId;
this.randSe = jewel.randSe;
if(isPush) {
this.count = 1;
this.inc = 1;
this.reason = reason;
}
}
}