fix(game-ui): 증축 감축을 즉시 예약
This commit is contained in:
@@ -250,9 +250,7 @@ const togglePicker = (turnIndex?: number) => {
|
||||
};
|
||||
const selectCommand = (commandKey: string) => {
|
||||
const table = props.commandTable;
|
||||
const command = table?.[props.scope]
|
||||
.flatMap((group) => group.values)
|
||||
.find((entry) => entry.key === commandKey);
|
||||
const command = table?.[props.scope].flatMap((group) => group.values).find((entry) => entry.key === commandKey);
|
||||
if (!table || !command) return;
|
||||
selectedCommand.value = command;
|
||||
// Ref opens argument commands on a separate processing page. Keep the same
|
||||
@@ -266,8 +264,7 @@ const selectCommand = (commandKey: string) => {
|
||||
};
|
||||
commandArgs.value = {};
|
||||
commandArgsValid.value = !command.reqArg;
|
||||
const needsInformationalConfirmation = commandArgumentPresentation(command.key).mapTarget === 'capital';
|
||||
if (!command.reqArg && !needsInformationalConfirmation) submitCommand();
|
||||
if (!command.reqArg) submitCommand();
|
||||
};
|
||||
const submitCommand = () => {
|
||||
const command = selectedCommand.value;
|
||||
@@ -799,11 +796,7 @@ const clickOutsideMenu = (event: Event) => {
|
||||
@submit="submitCommand"
|
||||
/>
|
||||
<CommandArgumentForm
|
||||
v-else-if="
|
||||
commandInputSnapshot &&
|
||||
(selectedCommand.reqArg ||
|
||||
commandArgumentPresentation(selectedCommand.key).mapTarget === 'capital')
|
||||
"
|
||||
v-else-if="commandInputSnapshot && selectedCommand.reqArg"
|
||||
:command-key="selectedCommand.key"
|
||||
:fields="selectedCommand.inputFields"
|
||||
:options="commandInputSnapshot.options"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CommandInputField } from './types';
|
||||
|
||||
export type CommandArgumentMapTarget = 'city' | 'nation' | 'capital';
|
||||
export type CommandArgumentMapTarget = 'city' | 'nation';
|
||||
|
||||
export type CommandArgumentPresentation = {
|
||||
lines: string[];
|
||||
@@ -9,7 +9,6 @@ export type CommandArgumentPresentation = {
|
||||
|
||||
const cityTarget = (lines: string[]): CommandArgumentPresentation => ({ lines, mapTarget: 'city' });
|
||||
const nationTarget = (lines: string[]): CommandArgumentPresentation => ({ lines, mapTarget: 'nation' });
|
||||
const capitalTarget = (lines: string[]): CommandArgumentPresentation => ({ lines, mapTarget: 'capital' });
|
||||
|
||||
// Ref hwe/ts/processing의 명령별 안내를 예약 명령 옵션창에 맞게 옮긴다.
|
||||
// 징병/모병은 별도 이관 범위이므로 이 표에 넣지 않는다.
|
||||
@@ -38,15 +37,6 @@ const PRESENTATIONS: Record<string, CommandArgumentPresentation> = {
|
||||
]),
|
||||
cr_인구이동: cityTarget(['현재 도시의 인구를 선택한 인접 도시로 이동합니다.']),
|
||||
che_발령: cityTarget(['선택한 도시로 아국 장수를 발령합니다.', '아국 도시만 대상이 됩니다.']),
|
||||
che_증축: capitalTarget([
|
||||
'현재 수도를 증축해 인구·내정·성벽의 최대치를 높입니다.',
|
||||
'지도에는 이번 명령의 대상인 현재 수도가 강조됩니다.',
|
||||
]),
|
||||
che_감축: capitalTarget([
|
||||
'현재 수도를 감축해 인구·내정·성벽의 최대치를 낮추고 국고를 회수합니다.',
|
||||
'지도에는 이번 명령의 대상인 현재 수도가 강조됩니다.',
|
||||
]),
|
||||
|
||||
che_선전포고: nationTarget([
|
||||
'선택한 국가에 선전포고합니다.',
|
||||
'고립되지 않은 아국 도시와 인접한 국가에만 가능하며 초반 제한의 영향을 받습니다.',
|
||||
@@ -104,7 +94,6 @@ export const commandArgumentPresentation = (commandKey: string): CommandArgument
|
||||
|
||||
/**
|
||||
* 대상 지도는 명령명 목록이 아니라 API가 내린 실제 인자 계약을 우선한다.
|
||||
* 인자가 없는 증축·감축의 수도 확인 지도만 presentation의 명시적 target을 사용한다.
|
||||
*/
|
||||
export const resolveCommandArgumentMapTarget = (
|
||||
commandKey: string,
|
||||
|
||||
@@ -191,10 +191,6 @@ const mapSelectedCityId = computed<number | null>(() => {
|
||||
null
|
||||
);
|
||||
}
|
||||
if (mapTarget.value === 'capital') {
|
||||
const myNation = props.mapData.myNation;
|
||||
return props.mapData.nationList.find((entry) => entry[0] === myNation)?.[3] ?? null;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
@@ -215,11 +211,6 @@ const selectedMapTargetName = computed(() => {
|
||||
if (typeof nationId !== 'number') return '-';
|
||||
return props.mapData?.nationList.find((nation) => nation[0] === nationId)?.[1] ?? '-';
|
||||
}
|
||||
if (mapTarget.value === 'capital') {
|
||||
const cityId = mapSelectedCityId.value;
|
||||
if (!cityId) return '-';
|
||||
return props.mapLayout?.cityList.find((city) => city.id === cityId)?.name ?? '-';
|
||||
}
|
||||
return '-';
|
||||
});
|
||||
|
||||
@@ -272,14 +263,6 @@ const mapTargetSummary = computed(() => {
|
||||
const cityCount = props.mapData.cityList.filter((entry) => entry[3] === value).length;
|
||||
return `${nation[1]} · 수도 ${capital?.name ?? '-'} · 도시 ${cityCount.toLocaleString()}개`;
|
||||
}
|
||||
if (mapTarget.value === 'capital' && mapSelectedCityId.value) {
|
||||
const city = props.mapLayout.cityList.find((entry) => entry.id === mapSelectedCityId.value);
|
||||
const dynamic = props.mapData.cityList.find((entry) => entry[0] === mapSelectedCityId.value);
|
||||
if (!city) return '';
|
||||
return `${city.name} · ${props.mapLayout.regionMap[dynamic?.[4] ?? city.region]} · ${
|
||||
props.mapLayout.levelMap[dynamic?.[1] ?? city.level]
|
||||
} · 현재 수도`;
|
||||
}
|
||||
return '';
|
||||
});
|
||||
|
||||
@@ -424,21 +407,17 @@ watch(
|
||||
:detail-mode="true"
|
||||
:fit-container="true"
|
||||
:show-current-city-marker="true"
|
||||
:readonly="mapTarget === 'capital'"
|
||||
@select-city="selectMapCity"
|
||||
/>
|
||||
<small v-if="mapTarget === 'capital'">현재 명령이 적용될 수도를 지도에서 확인하세요.</small>
|
||||
<small v-else>지도에서 도시를 클릭하거나 아래 목록에서 대상을 선택하세요.</small>
|
||||
<small>지도에서 도시를 클릭하거나 아래 목록에서 대상을 선택하세요.</small>
|
||||
<div class="map-selection-status" aria-live="polite" data-testid="command-map-selection-status">
|
||||
<span v-if="mapTarget !== 'capital'" class="current-city-status">
|
||||
<span class="current-city-status">
|
||||
<span class="status-key">현재 도시</span>
|
||||
<strong>{{ currentCityName }}</strong>
|
||||
</span>
|
||||
<span v-if="mapTarget !== 'capital'" aria-hidden="true">→</span>
|
||||
<span aria-hidden="true">→</span>
|
||||
<span class="selected-target-status">
|
||||
<span class="status-key">{{
|
||||
mapTarget === 'nation' ? '선택 국가' : mapTarget === 'capital' ? '현재 수도' : '선택 도시'
|
||||
}}</span>
|
||||
<span class="status-key">{{ mapTarget === 'nation' ? '선택 국가' : '선택 도시' }}</span>
|
||||
<strong>{{ selectedMapTargetName }}</strong>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user