优化:gm-server创建武将

This commit is contained in:
luying
2021-09-02 20:33:00 +08:00
parent e572cb2fa5
commit 62e32a4eb3
11 changed files with 372 additions and 191 deletions
@@ -6,6 +6,7 @@ import { RoleUpdate } from '../../../db/Role';
import { SkinUpdate } from '../../../db/Skin';
import { getInitRoleInfo } from '../../../pubUtils/roleUtil';
import { DEFAULT_HEROES } from '../../../consts';
import { Figure } from '../../../domain/dbGeneral';
export default function (app: Application) {
new HandlerService(app, {});
return new RoleRemote(app);
@@ -22,10 +23,11 @@ export class RoleRemote {
private initHeroes: Map<number, HeroUpdate> = new Map(); // hid => hero
private initRole: RoleUpdate = {};
private initSkins: Map<number, SkinUpdate> = new Map(); // hid => skin
private figureInfo: {heads: Figure[], frames: Figure[], spines: Figure[]};
public setInitRole() {
let result = getInitRoleInfo();
let { role, heroes, skins } = result;
let { role, heroes, skins, figureInfo } = result;
for(let hero of heroes) {
this.initHeroes.set(hero.hid, hero);
}
@@ -33,13 +35,15 @@ export class RoleRemote {
this.initSkins.set(skin.hid, skin);
}
this.initRole = role;
this.figureInfo = figureInfo;
}
public getInitRoleInfos() {
return {
heroes: this.getInitHeroes(),
skins: this.getInitSkins(),
role: this.initRole
role: this.initRole,
figureInfo: this.figureInfo
};
}
@@ -60,7 +64,10 @@ export class RoleRemote {
}
public getInitHeroById(hid: number) {
return this.initHeroes.get(hid)
return {
heroInfo: this.initHeroes.get(hid),
skinInfo: this.initSkins.get(hid)
}
}