role:同进程数据共享不再用 rpc

This commit is contained in:
liangtongchuan
2021-09-10 18:04:40 +08:00
parent 2de9cf0c14
commit 5fc63705d3
3 changed files with 31 additions and 16 deletions
+19 -1
View File
@@ -1,7 +1,7 @@
import { ChannelUser } from './../domain/ChannelUser';
import { Channel, pinus } from 'pinus';
import { getRandValueByMinMax, getRandEelm, decodeIdCntArrayStr } from '../pubUtils/util';
import { TERAPH_RANDOM } from "../consts";
import { DEFAULT_HEROES, TERAPH_RANDOM } from "../consts";
import { DicTeraph } from '../pubUtils/dictionary/DicTeraph';
import { Teraph, RoleModel, RoleType } from '../db/Role';
import { ROLE_SELECT } from '../consts';
@@ -10,6 +10,8 @@ import { gameData } from '../pubUtils/data';
import { SchoolModel } from '../db/School';
import { SclResultInter, SclPosInter } from '../pubUtils/interface';
import { CheckMeterial } from './rewardService';
import { HeroUpdate } from '../db/Hero';
import { SkinUpdate } from '../db/Skin';
export async function getTeraphStrengthenResult(role: RoleType, count: number, dicTeraph: DicTeraph, teraph: Teraph) {
let criAttr: number[] = [], times = 0;
@@ -124,4 +126,20 @@ export async function getSchoolList(roleId: string) {
});
});
return school;
}
function getDefaultHeroInfos(heroes: Map<number, HeroUpdate>, skins: Map<number, SkinUpdate>) {
const initInfos = [];
for(let hid of DEFAULT_HEROES) {
initInfos.push({
heroInfo: heroes.get(hid),
skinInfo: skins.get(hid)
});
}
return initInfos;
}
export function getDefaultRoleInfo(heroes: Map<number, HeroUpdate>, skins: Map<number, SkinUpdate>, role, figureInfo) {
const initInfos = getDefaultHeroInfos(heroes, skins);
return { initInfos, role, figureInfo };
}