game: 부대탈퇴지시 ui
This commit is contained in:
@@ -152,9 +152,6 @@ class che_부대탈퇴지시 extends Command\NationCommand
|
|||||||
'generals' => $destRawGenerals,
|
'generals' => $destRawGenerals,
|
||||||
'generalsKey' => ['no', 'name', 'officerLevel', 'npc', 'gold', 'rice', 'leadership', 'strength', 'intel', 'cityID', 'crew', 'train', 'atmos', 'troopID'],
|
'generalsKey' => ['no', 'name', 'officerLevel', 'npc', 'gold', 'rice', 'leadership', 'strength', 'intel', 'cityID', 'crew', 'train', 'atmos', 'troopID'],
|
||||||
'cities' => \sammo\JSOptionsForCities(),
|
'cities' => \sammo\JSOptionsForCities(),
|
||||||
'minAmount' => 100,
|
|
||||||
'maxAmount' => GameConst::$maxResourceActionAmount,
|
|
||||||
'amountGuide' => GameConst::$resourceActionAmountGuide,
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ import { default as che_피장파장 } from "./che_피장파장.vue";
|
|||||||
import { default as cr_인구이동 } from "./cr_인구이동.vue";
|
import { default as cr_인구이동 } from "./cr_인구이동.vue";
|
||||||
|
|
||||||
import { default as ProcessNation } from "../ProcessNation.vue";
|
import { default as ProcessNation } from "../ProcessNation.vue";
|
||||||
|
import { default as ProcessGeneral } from "../ProcessGeneral.vue";
|
||||||
import { default as ProcessGeneralAmount } from "../ProcessGeneralAmount.vue";
|
import { default as ProcessGeneralAmount } from "../ProcessGeneralAmount.vue";
|
||||||
import { default as ProcessGeneralCity } from "./che_발령.vue";
|
import { default as che_발령 } from "./che_발령.vue";
|
||||||
import { default as ProcessCity } from "../ProcessCity.vue";
|
import { default as ProcessCity } from "../ProcessCity.vue";
|
||||||
|
|
||||||
export const commandMap: Record<string, typeof ProcessNation | typeof ProcessCity> = {
|
export const commandMap: Record<string, typeof ProcessNation | typeof ProcessCity> = {
|
||||||
@@ -17,7 +18,8 @@ export const commandMap: Record<string, typeof ProcessNation | typeof ProcessCit
|
|||||||
che_급습: ProcessNation,
|
che_급습: ProcessNation,
|
||||||
che_몰수: ProcessGeneralAmount,
|
che_몰수: ProcessGeneralAmount,
|
||||||
che_물자원조,
|
che_물자원조,
|
||||||
che_발령: ProcessGeneralCity,
|
che_발령: che_발령,
|
||||||
|
che_부대탈퇴지시: ProcessGeneral,
|
||||||
che_백성동원: ProcessCity,
|
che_백성동원: ProcessCity,
|
||||||
che_불가침제의,
|
che_불가침제의,
|
||||||
che_불가침파기제의: ProcessNation,
|
che_불가침파기제의: ProcessNation,
|
||||||
|
|||||||
@@ -0,0 +1,139 @@
|
|||||||
|
<template>
|
||||||
|
<TopBackBar v-model:searchable="searchable" :title="commandName" :type="procEntryMode" />
|
||||||
|
<div v-if="asyncReady" class="bg0">
|
||||||
|
<div v-if="commandName == '부대 탈퇴 지시'">
|
||||||
|
지정한 장수에게 부대 탈퇴를 지시합니다. <br />
|
||||||
|
부대원만 가능합니다.<br />
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-lg-5">
|
||||||
|
장수 :
|
||||||
|
<SelectGeneral
|
||||||
|
v-model="selectedGeneralID"
|
||||||
|
:cities="citiesMap"
|
||||||
|
:generals="generalList"
|
||||||
|
:textHelper="textHelpGeneral"
|
||||||
|
:searchable="searchable"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="col-3 col-lg-2 d-grid">
|
||||||
|
<b-button variant="primary" @click="submit">
|
||||||
|
{{ commandName }}
|
||||||
|
</b-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<BottomBar :title="commandName" :type="procEntryMode" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
declare const procRes: {
|
||||||
|
troops: procTroopList;
|
||||||
|
cities: [number, string][];
|
||||||
|
generals: procGeneralRawItemList;
|
||||||
|
generalsKey: procGeneralKey[];
|
||||||
|
};
|
||||||
|
|
||||||
|
declare const staticValues: {
|
||||||
|
commandName: string;
|
||||||
|
entryInfo: ["General" | "Nation", unknown];
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import SelectGeneral from "@/processing/SelectGeneral.vue";
|
||||||
|
import { ref, watch, provide } from "vue";
|
||||||
|
import { unwrap } from "@/util/unwrap";
|
||||||
|
import type { Args } from "@/processing/args";
|
||||||
|
import TopBackBar from "@/components/TopBackBar.vue";
|
||||||
|
import BottomBar from "@/components/BottomBar.vue";
|
||||||
|
import {
|
||||||
|
convertGeneralList,
|
||||||
|
getProcSearchable,
|
||||||
|
procTroopList,
|
||||||
|
type procGeneralItem,
|
||||||
|
type procGeneralKey,
|
||||||
|
type procGeneralRawItemList,
|
||||||
|
} from "./processingRes";
|
||||||
|
import { getNPCColor } from "@/utilGame";
|
||||||
|
import { getGameConstStore, type GameConstStore } from '@/GameConstStore';
|
||||||
|
|
||||||
|
const asyncReady = ref<boolean>(false);
|
||||||
|
const generalList = convertGeneralList(procRes.generalsKey, procRes.generals);
|
||||||
|
const gameConstStore = ref<GameConstStore>();
|
||||||
|
provide("gameConstStore", gameConstStore);
|
||||||
|
const storeP = getGameConstStore().then((store) => {
|
||||||
|
gameConstStore.value = store;
|
||||||
|
});
|
||||||
|
void Promise.all([storeP]).then(() => {
|
||||||
|
asyncReady.value = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
const selectedGeneralID = ref(generalList[0].no);
|
||||||
|
const citiesMap = ref(
|
||||||
|
new Map<
|
||||||
|
number,
|
||||||
|
{
|
||||||
|
name: string;
|
||||||
|
info?: string;
|
||||||
|
}
|
||||||
|
>()
|
||||||
|
);
|
||||||
|
watch(gameConstStore, (store)=>{
|
||||||
|
if(!store){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const tmpCitiesMap = new Map<
|
||||||
|
number,
|
||||||
|
{
|
||||||
|
name: string;
|
||||||
|
info?: string;
|
||||||
|
}
|
||||||
|
>();
|
||||||
|
|
||||||
|
for(const city of Object.values(store.cityConst)){
|
||||||
|
tmpCitiesMap.set(city.id, {
|
||||||
|
name: city.name,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
citiesMap.value = tmpCitiesMap;
|
||||||
|
})
|
||||||
|
function textHelpGeneral(gen: procGeneralItem): string {
|
||||||
|
const troops = (()=>{
|
||||||
|
if(!gen.troopID){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
const troopInfo = procRes.troops[gen.troopID];
|
||||||
|
if(!troopInfo){
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
const troopName = troopInfo.name;
|
||||||
|
|
||||||
|
if(gen.no !== gen.troopID){
|
||||||
|
return `,${troopName}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `,<span style="text-decoration: underline;">${troopName}</span>`;
|
||||||
|
})();
|
||||||
|
const nameColor = getNPCColor(gen.npc);
|
||||||
|
const name = nameColor ? `<span style="color:${nameColor}">${gen.name}</span>` : gen.name;
|
||||||
|
return `${name} [${citiesMap.value.get(unwrap(gen.cityID))?.name}${troops}] (${gen.leadership}/${gen.strength}/${
|
||||||
|
gen.intel
|
||||||
|
}) <병${unwrap(gen.crew).toLocaleString()}/훈${gen.train}/사${gen.atmos}>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submit(e: Event) {
|
||||||
|
const event = new CustomEvent<Args>("customSubmit", {
|
||||||
|
detail: {
|
||||||
|
destGeneralID: selectedGeneralID.value,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
unwrap(e.target).dispatchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
const { commandName,entryInfo } = staticValues;
|
||||||
|
const searchable = getProcSearchable();
|
||||||
|
|
||||||
|
const procEntryMode: "chief" | "normal" = entryInfo[0] == "Nation" ? "chief" : "normal";
|
||||||
|
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user