feat(WIP): process 국가선택 추가
This commit is contained in:
@@ -16,9 +16,15 @@
|
||||
:maxHeight="400"
|
||||
:searchable="searchMode"
|
||||
>
|
||||
<template v-slot:option="props">
|
||||
{{ props.option.title }}
|
||||
<span v-if="props.option.info">({{ props.option.info }})</span>
|
||||
<template v-slot:option="props"
|
||||
><span
|
||||
:style="{
|
||||
color: props.option.notAvailable ? 'red' : undefined,
|
||||
}"
|
||||
>
|
||||
{{ props.option.title }}
|
||||
<span v-if="props.option.info">({{ props.option.info }})</span></span
|
||||
>
|
||||
</template>
|
||||
<template v-slot:singleLabel="props">
|
||||
{{ props.option.simpleName }}
|
||||
@@ -35,6 +41,7 @@ type SelectedCity = {
|
||||
title: string;
|
||||
simpleName: string;
|
||||
info?: string;
|
||||
notAvailable?: boolean;
|
||||
};
|
||||
|
||||
export default defineComponent({
|
||||
@@ -54,9 +61,9 @@ export default defineComponent({
|
||||
const target = this.targets.get(val);
|
||||
this.selectedCity = target;
|
||||
},
|
||||
selectedCity(val: SelectedCity){
|
||||
this.$emit('update:modelValue', val.value);
|
||||
}
|
||||
selectedCity(val: SelectedCity) {
|
||||
this.$emit("update:modelValue", val.value);
|
||||
},
|
||||
},
|
||||
data() {
|
||||
const citiesForFind = [];
|
||||
@@ -69,7 +76,7 @@ export default defineComponent({
|
||||
title: name,
|
||||
info: info,
|
||||
simpleName: name,
|
||||
searchText: `${name} ${filteredTextH} ${filteredTextA}`
|
||||
searchText: `${name} ${filteredTextH} ${filteredTextA}`,
|
||||
};
|
||||
if (value == this.modelValue) {
|
||||
selectedCity = obj;
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<template>
|
||||
<TopBackBar :title="commandName" type="chief" />
|
||||
<div class="bg0">
|
||||
<div>
|
||||
나라의 이름을 바꿉니다. 황제가 된 후 1회 가능합니다.<br />
|
||||
국명 : <br />
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
<b-form-input v-model="destNationName"/>
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<b-button @click="submit">{{ commandName }}</b-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<BottomBar :title="commandName" />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
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";
|
||||
|
||||
declare const commandName: string;
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
TopBackBar,
|
||||
BottomBar,
|
||||
},
|
||||
setup() {
|
||||
const destNationName = ref("");
|
||||
|
||||
async function submit(e: Event) {
|
||||
const event = new CustomEvent<Args>("customSubmit", {
|
||||
detail: {
|
||||
nationName: destNationName.value,
|
||||
},
|
||||
});
|
||||
unwrap(e.target).dispatchEvent(event);
|
||||
}
|
||||
|
||||
return {
|
||||
destNationName,
|
||||
commandName,
|
||||
submit,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,100 @@
|
||||
<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 />
|
||||
상대 국가를 목록에서 선택하세요.<br />
|
||||
배경색은 현재 급습 불가능 국가는 <span style="color:red;">붉은색</span>으로
|
||||
표시됩니다.<br />
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
<NationSelect :nations="nations" v-model="selectedNationID" />
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<b-button @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 { 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 currentNation: number;
|
||||
declare const commandName: string;
|
||||
|
||||
declare const procRes: {
|
||||
nations: procNationList,
|
||||
};
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
MapLegacyTemplate,
|
||||
NationSelect,
|
||||
TopBackBar,
|
||||
BottomBar,
|
||||
},
|
||||
watch: {
|
||||
selectedCityObj(city: MapCityParsed) {
|
||||
if(!city.nationID){
|
||||
return;
|
||||
}
|
||||
this.selectedNationID = city.nationID;
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
const nations = new Map<number, procNationItem>();
|
||||
for (const nationItem of procRes.nations) {
|
||||
nations.set(nationItem.id, nationItem);
|
||||
}
|
||||
|
||||
const selectedNationID = ref(currentNation);
|
||||
|
||||
function selectedNation(nationID: number) {
|
||||
selectedNationID.value = nationID;
|
||||
}
|
||||
|
||||
async function submit(e: Event) {
|
||||
const event = new CustomEvent<Args>("customSubmit", {
|
||||
detail: {
|
||||
destNationID: selectedNationID.value,
|
||||
},
|
||||
});
|
||||
unwrap(e.target).dispatchEvent(event);
|
||||
}
|
||||
|
||||
return {
|
||||
mapTheme: ref(mapTheme),
|
||||
nations: ref(nations),
|
||||
selectedNationID,
|
||||
commandName,
|
||||
selectedNation,
|
||||
submit,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
@@ -1,3 +1,5 @@
|
||||
export { default as che_국기변경 } from "./che_국기변경.vue";
|
||||
export { default as che_국호변경 } from "./che_국호변경.vue";
|
||||
export { default as che_급습 } from "./che_급습.vue";
|
||||
export { default as che_발령 } from "./che_발령.vue";
|
||||
export { default as che_포상 } from "./che_포상.vue";
|
||||
@@ -0,0 +1,100 @@
|
||||
<template>
|
||||
<v-multiselect
|
||||
v-model="selectedNation"
|
||||
:allow-empty="false"
|
||||
:options="forFind"
|
||||
:group-select="false"
|
||||
label="searchText"
|
||||
track-by="value"
|
||||
:show-labels="false"
|
||||
selectLabel="선택(엔터)"
|
||||
selectGroupLabel=""
|
||||
selectedLabel="선택됨"
|
||||
deselectLabel="해제(엔터)"
|
||||
deselectGroupLabel=""
|
||||
placeholder="국가 선택"
|
||||
:maxHeight="400"
|
||||
:searchable="searchMode"
|
||||
>
|
||||
<template v-slot:option="props">
|
||||
<span
|
||||
:style="{
|
||||
color: props.option.notAvailable ? 'red' : undefined,
|
||||
}"
|
||||
>
|
||||
{{ props.option.title }}
|
||||
<span v-if="props.option.info">({{ props.option.info }})</span>
|
||||
{{ props.option.notAvailable ? "(불가)" : undefined }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-slot:singleLabel="props">
|
||||
{{ props.option.simpleName }}
|
||||
</template>
|
||||
</v-multiselect>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { filter초성withAlphabet } from "@/util/filter초성withAlphabet";
|
||||
import { defineComponent, PropType } from "vue";
|
||||
import { procNationItem } from "./processingRes";
|
||||
|
||||
type SelectedNation = {
|
||||
value: number;
|
||||
searchText: string;
|
||||
title: string;
|
||||
simpleName: string;
|
||||
info?: string;
|
||||
notAvailable?: boolean;
|
||||
};
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
modelValue: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
nations: {
|
||||
type: Map as PropType<Map<number, procNationItem>>,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
emits: ["update:modelValue"],
|
||||
watch: {
|
||||
modelValue(val: number) {
|
||||
const target = this.targets.get(val);
|
||||
this.selectedNation = target;
|
||||
},
|
||||
selectedNation(val: SelectedNation) {
|
||||
this.$emit("update:modelValue", val.value);
|
||||
},
|
||||
},
|
||||
data() {
|
||||
const forFind = [];
|
||||
const targets = new Map<number, SelectedNation>();
|
||||
let selectedNation;
|
||||
for (const nationItem of this.nations.values()) {
|
||||
const [filteredTextH, filteredTextA] = filter초성withAlphabet(
|
||||
nationItem.name
|
||||
);
|
||||
const obj: SelectedNation = {
|
||||
value: nationItem.id,
|
||||
title: nationItem.name,
|
||||
info: nationItem.info,
|
||||
simpleName: nationItem.name,
|
||||
notAvailable: nationItem.notAvailable,
|
||||
searchText: `${nationItem.name} ${filteredTextH} ${filteredTextA}`,
|
||||
};
|
||||
if (nationItem.id == this.modelValue) {
|
||||
selectedNation = obj;
|
||||
}
|
||||
forFind.push(obj);
|
||||
targets.set(nationItem.id, obj);
|
||||
}
|
||||
return {
|
||||
selectedNation,
|
||||
searchMode: true,
|
||||
forFind,
|
||||
targets,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
@@ -51,4 +51,16 @@ export type procGeneralRawItemList = procGeneralRawItem[];
|
||||
|
||||
export function convertGeneralList(keys: procGeneralKeyList, rawList: procGeneralRawItemList): procGeneralList{
|
||||
return combineArray(rawList, keys) as procGeneralList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export type procNationItem = {
|
||||
id: number,
|
||||
name: string,
|
||||
color: string,
|
||||
power: number,
|
||||
info?: string,
|
||||
notAvailable?: boolean,
|
||||
};
|
||||
|
||||
export type procNationList = procNationItem[];
|
||||
Reference in New Issue
Block a user