feat(WIP): processing 출병
This commit is contained in:
@@ -186,25 +186,4 @@ class che_이동 extends Command\GeneralCommand
|
|||||||
'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 1),
|
'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 1),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getForm(): string
|
|
||||||
{
|
|
||||||
$currentCityID = $this->generalObj->getCityID();
|
|
||||||
$currentCityName = CityConst::byID($currentCityID)->name;
|
|
||||||
|
|
||||||
ob_start();
|
|
||||||
?>
|
|
||||||
<?= \sammo\getMapHtml() ?><br>
|
|
||||||
선택된 도시로 이동합니다.<br>
|
|
||||||
인접 도시로만 이동이 가능합니다.<br>
|
|
||||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
|
||||||
<?= $currentCityName ?> => <select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'><br>
|
|
||||||
<?= \sammo\optionsForCities() ?><br>
|
|
||||||
</select> <input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<?= printCitiesBasedOnDistance($currentCityID, 1) ?>
|
|
||||||
<?php
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,27 +240,11 @@ class che_출병 extends Command\GeneralCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSPlugins(): array
|
public function exportJSVars(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'defaultSelectCityByMap'
|
'cities' => \sammo\JSOptionsForCities(),
|
||||||
|
'mapTheme' => \sammo\getMapTheme(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getForm(): string
|
|
||||||
{
|
|
||||||
$srcCityName = \sammo\CityConst::byID($this->generalObj->getCityID())->name;
|
|
||||||
ob_start();
|
|
||||||
?>
|
|
||||||
<?= \sammo\getMapHtml() ?><br>
|
|
||||||
선택된 도시를 향해 침공을 합니다.<br>
|
|
||||||
침공 경로에 적군의 도시가 있다면 전투를 벌입니다.<br>
|
|
||||||
목록을 선택하거나 도시를 클릭하세요.<br>
|
|
||||||
<?= $srcCityName ?> =><select class='formInput' name="destCityID" id="destCityID" size='1' style='color:white;background-color:black;'>
|
|
||||||
<?= \sammo\optionsForCities() ?><br>
|
|
||||||
</select> <input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
|
|
||||||
<br>
|
|
||||||
<?php
|
|
||||||
return ob_get_clean();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -660,7 +660,8 @@ export async function reloadWorldMap(option: loadMapOption, drawTarget = '.world
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (selectCallback) {
|
if (selectCallback) {
|
||||||
$cityLink.on('click', function () {
|
$cityLink.on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
return selectCallback(city);
|
return selectCallback(city);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
<template>
|
||||||
|
<TopBackBar :title="commandName" />
|
||||||
|
<div class="bg0">
|
||||||
|
<MapLegacyTemplate
|
||||||
|
:isDetailMap="false"
|
||||||
|
:clickableAll="true"
|
||||||
|
:neutralView="true"
|
||||||
|
:useCachedMap="true"
|
||||||
|
:mapTheme="mapTheme"
|
||||||
|
v-model="selectedCityObj"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
선택된 도시를 향해 침공을 합니다.<br />
|
||||||
|
침공 경로에 적군의 도시가 있다면 전투를 벌입니다.<br />
|
||||||
|
목록을 선택하거나 도시를 클릭하세요.<br />
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col">
|
||||||
|
<CitySelect :cities="citiesMap" :modelValue="selectedCityID" />
|
||||||
|
</div>
|
||||||
|
<div class="col">
|
||||||
|
<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 CitySelect from "@/processing/CitySelect.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";
|
||||||
|
declare const mapTheme: string;
|
||||||
|
declare const cities: [number, string][];
|
||||||
|
declare const currentCity: number;
|
||||||
|
declare const commandName: string;
|
||||||
|
export default defineComponent({
|
||||||
|
components: {
|
||||||
|
MapLegacyTemplate,
|
||||||
|
CitySelect,
|
||||||
|
TopBackBar,
|
||||||
|
BottomBar,
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
selectedCityObj(city: MapCityParsed) {
|
||||||
|
this.selectedCityID = city.id;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
|
const citiesMap = new Map<
|
||||||
|
number,
|
||||||
|
{
|
||||||
|
name: string;
|
||||||
|
info?: string;
|
||||||
|
}
|
||||||
|
>();
|
||||||
|
for (const [id, name] of cities) {
|
||||||
|
citiesMap.set(id, { name });
|
||||||
|
}
|
||||||
|
console.log(citiesMap);
|
||||||
|
|
||||||
|
const selectedCityID = ref(currentCity);
|
||||||
|
|
||||||
|
function selected(cityID: number) {
|
||||||
|
selectedCityID.value = cityID;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submit(e: Event) {
|
||||||
|
const event = new CustomEvent<Args>("customSubmit", {
|
||||||
|
detail: {
|
||||||
|
destCityID: selectedCityID.value,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
unwrap(e.target).dispatchEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
mapTheme: ref(mapTheme),
|
||||||
|
citiesMap: ref(citiesMap),
|
||||||
|
selectedCityID,
|
||||||
|
selectedCityObj: ref(undefined as MapCityParsed | undefined),
|
||||||
|
commandName,
|
||||||
|
selected,
|
||||||
|
submit,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
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";
|
||||||
Reference in New Issue
Block a user