feat(WIP): processing 물자원조

- nations, nationList를 nationList로 통합
This commit is contained in:
2021-12-22 01:01:06 +09:00
parent 77b78d05ac
commit cde55ab574
9 changed files with 280 additions and 94 deletions
+7 -1
View File
@@ -20,6 +20,7 @@
class="form-control"
:max="maxAmount"
:min="minAmount"
:step="step"
v-model="amount"
placeholder="금액"
/>
@@ -69,8 +70,13 @@ export default defineComponent({
},
amountGuide: {
type: Array as PropType<number[]>,
reqquired: false,
required: false,
},
step: {
type: Number,
required: false,
default: 1,
}
},
emits: ["update:modelValue"],
watch: {
+5 -5
View File
@@ -10,7 +10,7 @@
<div class="row">
<div class="col-6 col-md-3">
국가 :
<NationSelect :nations="nations" v-model="selectedNationID" />
<NationSelect :nations="nationList" v-model="selectedNationID" />
</div>
<div class="col-4 col-md-2 d-grid">
<b-button @click="submit">{{ commandName }}</b-button>
@@ -22,7 +22,7 @@
<div>임관권유문</div>
</div>
<div
v-for="[, nation] in nations"
v-for="[, nation] in nationList"
:key="nation.id"
class="nation-row s-border-b"
@click="selectedNationID = nation.id"
@@ -68,9 +68,9 @@ export default defineComponent({
BottomBar,
},
setup() {
const nations = new Map<number, procNationItem>();
const nationList = new Map<number, procNationItem>();
for (const nationItem of procRes.nationList) {
nations.set(nationItem.id, nationItem);
nationList.set(nationItem.id, nationItem);
}
const selectedNationID = ref(procRes.nationList[0].id);
@@ -89,7 +89,7 @@ export default defineComponent({
}
return {
nations: ref(nations),
nationList: ref(nationList),
selectedNationID,
commandName,
isBrightColor,
@@ -97,9 +97,9 @@ export default defineComponent({
return name;
}
const nations = new Map<number, procNationItem>();
const nationList = new Map<number, procNationItem>();
for (const nationItem of procRes.nationList) {
nations.set(nationItem.id, nationItem);
nationList.set(nationItem.id, nationItem);
}
async function submit(e: Event) {
@@ -111,16 +111,10 @@ export default defineComponent({
unwrap(e.target).dispatchEvent(event);
}
const nationList = new Map<number, procNationItem>();
for (const nationItem of procRes.nationList) {
nationList.set(nationItem.id, nationItem);
}
return {
nations: ref(nations),
nationList: ref(nationList),
selectedGeneralID,
generalList,
nationList,
commandName,
isBrightColor,
textHelpGeneral,
@@ -0,0 +1,129 @@
<template>
<TopBackBar :title="commandName" type="chief" />
<div class="bg0">
<MapLegacyTemplate
:isDetailMap="false"
:clickableAll="true"
:neutralView="true"
:useCachedMap="true"
:mapTheme="mapTheme"
v-model="selectedCityObj"
/>
<div>
타국에게 원조합니다.<br />
작위별로 금액 제한이 있습니다.<br />
</div>
<div class="row">
<div class="col-6 col-md-3">
국가 :
<NationSelect :nations="nationList" v-model="selectedNationID" />
</div>
<div class="col-6 col-md-0"></div>
<div class="col-10 col-md-5">
:
<AmountSelect
:amountGuide="amountGuide"
v-model="goldAmount"
:step="10"
:maxAmount="maxAmount"
:minAmount="minAmount"
/>
</div>
<div class="col-10 col-md-5">
:
<AmountSelect
:amountGuide="amountGuide"
v-model="riceAmount"
:step="10"
:maxAmount="maxAmount"
:minAmount="minAmount"
/>
</div>
<div class="col-4 col-md-2 d-grid">
<b-button variant="primary" @click="submit">{{ commandName }}</b-button>
</div>
</div>
</div>
<BottomBar :title="commandName" />
</template>
<script lang="ts">
import MapLegacyTemplate, {
MapCityParsed,
} from "@/components/MapLegacyTemplate.vue";
import NationSelect from "@/processing/NationSelect.vue";
import AmountSelect from "@/processing/AmountSelect.vue";
import { defineComponent, ref } from "vue";
import { unwrap } from "@/util/unwrap";
import { Args } from "@/processing/args";
import TopBackBar from "@/components/TopBackBar.vue";
import BottomBar from "@/components/BottomBar.vue";
import { procNationItem, procNationList } from "../processingRes";
declare const mapTheme: string;
declare const commandName: string;
declare const procRes: {
nationList: procNationList;
currentNationLevel: number;
nationLevelText: Record<number, string>;
minAmount: number;
maxAmount: number;
amountGuide: number[];
};
export default defineComponent({
components: {
MapLegacyTemplate,
NationSelect,
AmountSelect,
TopBackBar,
BottomBar,
},
watch: {
selectedCityObj(city: MapCityParsed) {
if (!city.nationID) {
return;
}
this.selectedNationID = city.nationID;
},
},
setup() {
const nationList = new Map<number, procNationItem>();
for (const nationItem of procRes.nationList) {
nationList.set(nationItem.id, nationItem);
}
const goldAmount = ref(procRes.minAmount);
const riceAmount = ref(procRes.minAmount);
const selectedNationID = ref(procRes.nationList[0]?.id);
const selectedCityObj = ref(); //mapping용
async function submit(e: Event) {
const event = new CustomEvent<Args>("customSubmit", {
detail: {
amountList: [goldAmount.value, riceAmount.value],
destNationID: selectedNationID.value,
},
});
unwrap(e.target).dispatchEvent(event);
}
return {
mapTheme,
goldAmount,
riceAmount,
nationList,
selectedNationID,
selectedCityObj,
currentNationLevel: procRes.currentNationLevel,
nationLevelText: procRes.nationLevelText,
minAmount: ref(procRes.minAmount),
maxAmount: ref(procRes.maxAmount),
amountGuide: procRes.amountGuide,
commandName,
submit,
};
},
});
</script>
@@ -29,7 +29,7 @@
<div class="row">
<div class="col-6 col-md-3">
국가 :
<NationSelect :nations="nations" v-model="selectedNationID" />
<NationSelect :nations="nationList" v-model="selectedNationID" />
</div>
<div class="col-4 col-md-2 d-grid">
<b-button @click="submit">{{ commandName }}</b-button>
@@ -54,7 +54,7 @@ declare const mapTheme: string;
declare const commandName: string;
declare const procRes: {
nations: procNationList;
nationList: procNationList;
startYear: number,
};
@@ -74,12 +74,12 @@ export default defineComponent({
},
},
setup() {
const nations = new Map<number, procNationItem>();
for (const nationItem of procRes.nations) {
nations.set(nationItem.id, nationItem);
const nationList = new Map<number, procNationItem>();
for (const nationItem of procRes.nationList) {
nationList.set(nationItem.id, nationItem);
}
const selectedNationID = ref(procRes.nations[0].id);
const selectedNationID = ref(procRes.nationList[0].id);
const selectedCityObj = ref();//mapping용
function selectedNation(nationID: number) {
@@ -98,7 +98,7 @@ export default defineComponent({
return {
startYear: procRes.startYear,
mapTheme: ref(mapTheme),
nations: ref(nations),
nationList: ref(nationList),
selectedCityObj,
selectedNationID,
commandName,
+3
View File
@@ -1,5 +1,7 @@
import { default as che_국기변경 } from "./che_국기변경.vue";
import { default as che_국호변경 } from "./che_국호변경.vue";
import { default as che_물자원조 } from "./che_물자원조.vue";
import { default as NationProcess } from "./che_선전포고.vue";
import { default as GeneralAmountProcess } from "./che_몰수.vue";
import { default as GeneralCityProcess } from "./che_발령.vue";
@@ -9,6 +11,7 @@ export const commandMap: Record<string, typeof NationProcess> = {
che_국호변경,
che_급습: NationProcess,
che_몰수: GeneralAmountProcess,
che_물자원조,
che_선전포고: NationProcess,
che_포상: GeneralAmountProcess,
che_발령: GeneralCityProcess,