fix: 본인이 아닌 수뇌자리에도 부대장 발령 표기

This commit is contained in:
2022-07-10 21:27:34 +09:00
parent 94bb96d208
commit 50b1db75f0
5 changed files with 75 additions and 42 deletions
+6 -4
View File
@@ -1,7 +1,5 @@
<template>
<div
v-for="(officer, _idx) in [chiefList[chiefLevel]]"
:key="_idx"
:class="[`chiefBox${chiefLevel}`, 'subRows']"
:style="style"
@click="$emit('click', this)"
@@ -37,15 +35,19 @@
</template>
<script lang="ts">
import { getNpcColor } from "@/common_legacy";
import type { ChiefResponse } from "@/defs/API/NationCommand";
import { mb_strwidth } from "@/util/mb_strwidth";
import { defineComponent } from "vue";
import { defineComponent, type PropType } from "vue";
import VueTypes from "vue-types";
export default defineComponent({
props: {
chiefLevel: VueTypes.integer.isRequired,
style: VueTypes.object.isRequired,
chiefList: VueTypes.object.isRequired,
officer: {
type: Object as PropType<ChiefResponse['chiefList'][0]>,
default: undefined,
},
isMe: VueTypes.bool.isRequired,
},
emits: ["click"],
+35 -4
View File
@@ -2,7 +2,11 @@
<div id="container" class="pageChiefCenter">
<TopBackBar title="사령부" reloadable @reload="reloadTable" />
<div v-if="asyncReady && chiefList !== undefined" id="mainTable" :class="`${targetIsMe ? 'targetIsMe' : 'targetIsNotMe'}`">
<div
v-if="asyncReady && chiefList !== undefined"
id="mainTable"
:class="`${targetIsMe ? 'targetIsMe' : 'targetIsNotMe'}`"
>
<template v-for="(chiefLevel, vidx) in [12, 10, 8, 6, 11, 9, 7, 5]" :key="chiefLevel">
<div v-if="vidx % 4 == 0" :class="['turnIdx', vidx == 0 && !targetIsMe ? undefined : 'only1000px']">
<div :class="['subRows', 'bg0']" :style="mainTableGridRows">
@@ -20,7 +24,7 @@
<TopItem
v-if="officerLevel != chiefLevel"
:style="mainTableGridRows"
:officer="officer"
:officer="postFilterOfficer(chiefList[chiefLevel])"
:maxTurn="maxChiefTurn"
:turnTerm="turnTerm"
/>
@@ -64,7 +68,7 @@
</div>
<BottomItem
:chiefLevel="chiefLevel"
:chiefList="chiefList"
:officer="postFilterOfficer(chiefList[chiefLevel])"
:style="subTableGridRows"
:isMe="chiefLevel == officerLevel"
@click="viewTarget = chiefLevel"
@@ -103,12 +107,13 @@ import { isString } from "lodash";
import { entriesWithType } from "./util/entriesWithType";
import TopItem from "@/ChiefCenter/TopItem.vue";
import BottomItem from "@/ChiefCenter/BottomItem.vue";
import type { OptionalFull } from "./defs";
import type { OptionalFull, TurnObj } from "./defs";
import { SammoAPI } from "./SammoAPI";
import { unwrap } from "@/util/unwrap";
import { StoredActionsHelper } from "./util/StoredActionsHelper";
import type { ChiefResponse } from "./defs/API/NationCommand";
import { getGameConstStore, type GameConstStore } from "./GameConstStore";
import { postFilterNationCommandGen } from "./utilGame/postFilterNationCommandGen";
const props = defineProps({
maxChiefTurn: VueTypes.number.isRequired,
@@ -143,6 +148,32 @@ const tableObj = reactive<Omit<OptionalFull<ChiefResponse>, "result">>({
const { year, month, turnTerm, date, chiefList, troopList, officerLevel, commandList } = toRefs(tableObj);
let postFilterNationCommand = function (turnObj: TurnObj): TurnObj {
return turnObj;
};
watch([tableObj, gameConstStore], ([tableObj, gameConstStore]) => {
if (tableObj.troopList === undefined) {
return;
}
if (gameConstStore === undefined) {
return;
}
postFilterNationCommand = postFilterNationCommandGen(tableObj.troopList, gameConstStore);
});
type OfficerObj = ChiefResponse["chiefList"][0];
function postFilterOfficer(officer: OfficerObj|undefined): OfficerObj|undefined {
if(officer === undefined) {
return undefined;
}
return {
...officer,
turn: officer.turn.map(postFilterNationCommand),
};
}
const viewTarget = ref<number | undefined>();
const targetIsMe = ref<boolean>(false);
+3 -33
View File
@@ -268,7 +268,7 @@ import DragSelect from "@/components/DragSelect.vue";
import { isString, range, trim } from "lodash";
import { SammoAPI } from "@/SammoAPI";
import type { CommandItem, TurnObj } from "@/defs";
import { QueryActionHelper } from "@/util/QueryActionHelper";
import { QueryActionHelper, type TurnObjWithTime } from "@/util/QueryActionHelper";
import type { Args } from "@/processing/args";
import type { StoredActionsHelper } from "@/util/StoredActionsHelper";
import { getNpcColor } from "@/common_legacy";
@@ -276,18 +276,9 @@ import { BButton, BDropdownItem, BDropdownText, BButtonGroup, BDropdownDivider,
import CommandSelectForm from "@/components/CommandSelectForm.vue";
import SimpleClock from "@/components/SimpleClock.vue";
import type { ChiefResponse } from "@/defs/API/NationCommand";
import { unwrap } from "@/util/unwrap";
import { unwrap_err } from "@/util/unwrap_err";
import type { GameConstStore } from "@/GameConstStore";
import { pick as josaPick } from "@/util/JosaUtil";
type TurnObjWithTime = TurnObj & {
time: string;
year?: number;
month?: number;
tooltip?: string;
style?: Record<string, unknown>;
};
import { postFilterNationCommandGen } from "@/utilGame/postFilterNationCommandGen";
const props = defineProps({
maxTurn: VueTypes.integer.isRequired,
@@ -451,28 +442,7 @@ const gameConstStore = unwrap_err(
"gameConstStore가 주입되지 않았습니다."
);
function postFilterTurnBrief(turnObj: TurnObjWithTime): TurnObjWithTime{
if(turnObj.action != 'che_발령'){
return turnObj;
}
const destGeneralID = unwrap(turnObj.arg.destGeneralID);
if(!(destGeneralID in props.troopList)){
return turnObj;
}
const troopName = props.troopList[destGeneralID];
const destCityID = unwrap(turnObj.arg.destCityID);
const destCityName = gameConstStore.value.cityConst[destCityID].name;
const josaRo = josaPick(destCityName, "로");
const brief = `${troopName}》【${destCityName}${josaRo} 발령`;
const tooltip = `${troopName}${turnObj.brief}`;
return {
...turnObj,
brief,
tooltip,
}
}
const postFilterTurnBrief = postFilterNationCommandGen<TurnObjWithTime>(props.troopList, gameConstStore.value);
const queryActionHelper = new QueryActionHelper(props.maxTurn);
const reservedCommandList = queryActionHelper.reservedCommandList;
+1 -1
View File
@@ -3,7 +3,7 @@ import { clone, isString, range } from "lodash";
import { ref, type Ref } from "vue";
import { unwrap } from "./unwrap";
type TurnObjWithTime = TurnObj & {
export type TurnObjWithTime = TurnObj & {
time: string;
year?: number;
month?: number;
@@ -0,0 +1,30 @@
import type { GameConstStore } from "@/GameConstStore";
import { unwrap } from "@/util/unwrap";
import { pick as josaPick } from "@/util/JosaUtil";
import type { TurnObj } from "@/defs";
export function postFilterNationCommandGen<T extends TurnObj>(troopList: Record<number, string>, gameConst: GameConstStore){
return function(turnObj: T): T{
if(turnObj.action != 'che_발령'){
return turnObj;
}
const destGeneralID = unwrap(turnObj.arg.destGeneralID);
if(!(destGeneralID in troopList)){
return turnObj;
}
const troopName = troopList[destGeneralID];
const destCityID = unwrap(turnObj.arg.destCityID);
const destCityName = gameConst.cityConst[destCityID].name;
const josaRo = josaPick(destCityName, "로");
const brief = `${troopName}》【${destCityName}${josaRo} 발령`;
const tooltip = `${troopName}${turnObj.brief}`;
return {
...turnObj,
brief,
tooltip,
}
}
}