✨ feat(战场): 保存战阵连携顺序

This commit is contained in:
luying
2023-08-01 17:20:21 +08:00
parent 07bce370aa
commit f0ab9b0aeb
14 changed files with 102 additions and 33 deletions
+10 -2
View File
@@ -10,6 +10,7 @@ import { DicGVGVestige } from "../../pubUtils/dictionary/DicGVGVestige";
import { DicWarJson } from "../../pubUtils/dictionary/DicWarJson";
import { GVGHeroInfo } from "../dbGeneral";
import { LineupHero } from "../roleField/hero";
import { Combo } from "../battleField/pvp";
export class OppPlayerHeroInfo {
@prop({ required: true })
@@ -100,6 +101,8 @@ export class OppPlayerInfo {
isSuccess: boolean = false; // 是否胜利
@prop({ required: true, default: [], type: OppPlayerHeroInfo, _id: false })
heroes: OppPlayerHeroInfo[] = []; // 武将
@prop({ required: true, default: [], type: () => Combo, _id: false })
combo: Combo[] = []; // 武将
@prop({ required: true })
isRobot: boolean = false; // 原排名
@@ -119,13 +122,14 @@ export class OppPlayerInfo {
this.leagueName = league.name;
}
setPlayerHeroes(heroes: HeroType[], lineup: {actorId: number, dataId: number, order: number, subHid: number}[]) {
setPlayerHeroes(heroes: HeroType[], lineup: {actorId: number, dataId: number, order: number, subHid: number}[], combo: Combo[]) {
for(let hero of heroes) {
let obj = new OppPlayerHeroInfo();
obj.setByDefenseHero(hero, lineup);
this.ce += hero.ce;
this.heroes.push(obj);
}
this.combo = combo;
}
initByRobot(dic: DicGVGVestige, heroes: OppPlayerHeroInfo[], isSuccess: boolean) {
@@ -228,6 +232,7 @@ export class OppDetailData{
status: number;
time: number;
heroes: OppDetailHeroData[] = [];
combo: Combo[] = [];
lineupCe: number = 0;
constructor(rec: GVGVestigeRecType, obj: {status: number, time: number}) {
@@ -240,7 +245,7 @@ export class OppDetailData{
this.time = obj.time;
}
setByPlayer(dicWarJson: DicWarJson[], defenseHeroes: OppPlayerHeroInfo[], heroes: HeroType[], artifacts: ArtifactModelType[]) {
setByPlayer(dicWarJson: DicWarJson[], defenseHeroes: OppPlayerHeroInfo[], heroes: HeroType[], artifacts: ArtifactModelType[], combo: Combo[]) {
for(let warJson of dicWarJson) {
let defenseHero = defenseHeroes.find(cur => cur.dataId == warJson.dataId);
if(!defenseHero) continue;
@@ -250,6 +255,7 @@ export class OppDetailData{
this.heroes.push(hero);
this.lineupCe += curHero.ce;
}
this.combo = combo;
}
setAttribute(hid: number, attribute: string) {
@@ -265,6 +271,7 @@ export interface SaveTeamParam {
frame: number;
spine: number;
lineup?: LineupHero[];
combo: Combo[];
}
export interface SaveTeamUpdateParam {
@@ -273,6 +280,7 @@ export interface SaveTeamUpdateParam {
frame: number;
spine: number;
lineup?: GVGHeroInfo[];
combo: Combo[];
lineupCe?: number;
cityId?: number;
areaId?: number;
+3
View File
@@ -15,6 +15,7 @@ import { GVGCityType } from "../../db/GVGCity";
import { GVGTeamMem } from "../battleField/gvgBattle";
import { GVGTeamType } from "../../db/GVGTeam";
import { GVGRoleDataType } from "../../db/GVGRoleData";
import { Combo } from "../battleField/pvp";
class LeagueLeaderInfo {
name: string; // 盟主名
@@ -777,6 +778,7 @@ export class MyTeamSimpleInfo {
order: number; // 行动
subHid: number;
}[];
combo: Combo[];
hasConfirm: boolean;
constructor(team: GVGTeamType, configId: number) {
@@ -787,6 +789,7 @@ export class MyTeamSimpleInfo {
this.spine = team.spine;
this.lineup = team.lineup.map(({ actorId, dataId, outIndex, subActorId }) => ({ actorId, dataId, order: outIndex, subHid: subActorId }));
this.hasConfirm = team.confirmConfigId == configId;
this.combo = team.combo;
}
}