From 7b3d64996d96e3271f5706a9e1d6a7d52ac52ae4 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Sun, 24 Jul 2022 17:15:06 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B0=90=EC=B0=B0=EB=B6=80=20=EB=8F=84?= =?UTF-8?q?=EC=8B=9C=20=EA=B4=80=EC=A7=81=EB=AA=85=20=EB=88=84=EB=9D=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/ts/components/GeneralBasicCard.vue | 8 ++++++-- hwe/ts/utilGame/formatCityName.ts | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 hwe/ts/utilGame/formatCityName.ts diff --git a/hwe/ts/components/GeneralBasicCard.vue b/hwe/ts/components/GeneralBasicCard.vue index 55a650b8..3567b1c9 100644 --- a/hwe/ts/components/GeneralBasicCard.vue +++ b/hwe/ts/components/GeneralBasicCard.vue @@ -14,7 +14,10 @@ backgroundColor: nation.color, }" > - {{ general.name }} 【{{ general.officerLevelText }} | {{ generalTypeCall }} | + {{ general.name }} 【 + {{ general.officerLevelText }} | {{ generalTypeCall }} | {{ injuryInfo.text }} 】 {{ general.turntime.substring(11, 19) }} @@ -132,7 +135,7 @@ {{ troopInfo.name }} - {{ troopInfo.name }}({{ gameConstStore.cityConst[troopInfo.leader.city].name }}) + {{ troopInfo.name }}({{ formatCityName(troopInfo.leader, gameConstStore) }})
벌점
@@ -157,6 +160,7 @@ import { formatConnectScore } from "@/utilGame/formatConnectScore"; import SammoBar from "@/components/SammoBar.vue"; import { parseTime } from "@/util/parseTime"; import { clamp } from "lodash"; +import { formatCityName } from "@/utilGame/formatCityName"; const imagePath = window.pathConfig.gameImage; const gameConstStore = unwrap(inject>("gameConstStore")); const props = defineProps<{ diff --git a/hwe/ts/utilGame/formatCityName.ts b/hwe/ts/utilGame/formatCityName.ts new file mode 100644 index 00000000..34bb5455 --- /dev/null +++ b/hwe/ts/utilGame/formatCityName.ts @@ -0,0 +1,14 @@ +import type { GameConstStore } from "@/GameConstStore"; + +interface WithCityID { + city: number; +} + +export function formatCityName(target: number | WithCityID, gameConst: GameConstStore): string { + const cityID = typeof target === "number" ? target : target.city; + const city = gameConst.cityConst[cityID]; + if (city === undefined) { + throw `City ${cityID} not found`; + } + return city.name; +}