feat(WIP): processing 작업

This commit is contained in:
2021-12-18 05:02:47 +09:00
parent 6c93d2fd85
commit b4b4678e26
15 changed files with 182 additions and 100 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ return [
'hwe/b_myGenInfo.php',
'hwe/b_myKingdomInfo.php',
'hwe/b_myPage.php',
'hwe/b_processing.php',
'hwe/v_processing.php',
'hwe/b_tournament.php',
'hwe/b_troop.php',
'hwe/c_auction.php',
-9
View File
@@ -475,18 +475,9 @@ abstract class BaseCommand{
abstract public function run():bool;
public function getJSPlugins():array {
return [];
}
public function exportJSVars():array {
return [];
}
public function getCSSFiles():array {
return [];
}
public function getForm():string{
throw new \sammo\MustNotBeReachedException();
}
public function getLastTurn():LastTurn{
return $this->generalObj->getLastTurn();
+1 -29
View File
@@ -170,13 +170,6 @@ class che_강행 extends Command\GeneralCommand
return true;
}
public function getJSPlugins(): array
{
return [
'defaultSelectCityByMap'
];
}
public function exportJSVars(): array
{
return [
@@ -185,25 +178,4 @@ class che_강행 extends Command\GeneralCommand
'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 3),
];
}
public function getForm(): string
{
$currentCityID = $this->generalObj->getCityID();
$currentCityName = CityConst::byID($currentCityID)->name;
ob_start();
?>
<?= \sammo\getMapHtml() ?><br>
선택된 도시로 강행합니다.<br>
최대 3칸내 도시로만 강행이 가능합니다.<br>
목록을 선택하거나 도시를 클릭하세요.<br>
<?= $currentCityName ?> => <div id="setDestCityIDForm"></div><br>
<?= \sammo\optionsForCities() ?><br>
</select> <input type=button id="commonSubmit" value="<?= $this->getName() ?>"><br>
<br>
<br>
<?= printCitiesBasedOnDistance($currentCityID, 3) ?>
<?php
return ob_get_clean();
}
}
}
+4 -8
View File
@@ -12,6 +12,7 @@ use \sammo\GameUnitConst;
use \sammo\LastTurn;
use \sammo\Command;
use function sammo\getMapTheme;
use function \sammo\printCitiesBasedOnDistance;
use function sammo\tryUniqueItemLottery;
@@ -177,17 +178,12 @@ class che_이동 extends Command\GeneralCommand
return true;
}
public function getJSPlugins(): array
{
return [
'defaultSelectCityByMap'
];
}
public function exportJSVars(): array
{
return [
'cities' => \sammo\JSOptionsForCities()
'cities' => \sammo\JSOptionsForCities(),
'mapTheme' => getMapTheme(),
'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 1),
];
}
+19 -2
View File
@@ -32,6 +32,23 @@
#container {
width: 500px;
margin: 0 auto;
margin-bottom: 100px;
.world_map {
width: 500px;
height: calc((500px + 20px) * 500 / 700);
}
.map_title {
transform-origin: 0px 0px;
transform: scale(calc(500 / 700));
margin-bottom: calc(-20px * 200 / 700);
}
.map_body {
transform-origin: 0px 0px;
transform: scale(calc(500 / 700));
}
}
}
}
+1 -1
View File
@@ -449,7 +449,7 @@ export default defineComponent({
if (listReqArgCommand.has(commandName)) {
document.location.href = stringifyUrl({
url: "b_processing.php",
url: "v_processing.php",
query: {
command: commandName,
turnList: turnList.join("_"),
+1 -1
View File
@@ -237,7 +237,7 @@ $(function ($) {
const $command = $('#chiefCommandList option:selected');
if ($command.data('reqarg')) {
document.location.href = stringifyUrl({
url: 'b_processing.php',
url: 'v_processing.php',
query: {
command: unwrap_any<string>($command.val()),
turnList: turnList.join('_'),
+6 -11
View File
@@ -1,15 +1,10 @@
<template>
<table style="width: 1000px; margin: auto" class="bg0">
<tr>
<td style="text-align: left">
{{title}}<br /><button
type="button"
class="btn btn-primary"
@click="back"
>돌아가기</button><br />
</td>
</tr>
</table>
<div class="bg0">
<button type="button" class="btn btn-primary back_btn" @click="back">
돌아가기
</button>
<div></div>
</div>
</template>
<script lang="ts">
+1
View File
@@ -44,6 +44,7 @@
</div>
</template>
<script lang="ts">
import "@/../css/map.css";
import { reloadWorldMap, loadMapOption, MapCityParsed } from "@/map";
import { defineComponent, onMounted, PropType, ref } from "vue";
import { v4 as uuidv4 } from "uuid";
+5 -1
View File
@@ -1,12 +1,13 @@
import axios from 'axios';
import $ from 'jquery';
import { extend, isNumber, merge } from 'lodash';
import { isNumber, merge } from 'lodash';
import { convColorValue, convertDictById, stringFormat } from '@/common_legacy';
import { InvalidResponse } from '@/defs';
import { unwrap } from "@util/unwrap";
import { convertFormData } from '@util/convertFormData';
import { exportWindow } from '@util/exportWindow';
import { htmlReady } from './util/htmlReady';
import { initTooltip } from './legacy/initTooltip';
declare const serverNick: string;
declare const serverID: string;
@@ -506,6 +507,9 @@ export async function reloadWorldMap(option: loadMapOption, drawTarget = '.world
}
function setMouseWork(obj: MapCityDrawable) {
initTooltip($(drawTarget));
const $tooltip = $(drawTarget + ' .city_tooltip');
const $tooltip_city = $tooltip.find('.city_name');
const $tooltip_nation = $tooltip.find('.nation_name');
+32 -26
View File
@@ -1,34 +1,38 @@
<template>
<MapLegacyTemplate
:isDetailMap="false"
:clickableAll="true"
:neutralView="true"
:useCachedMap="true"
:mapTheme="mapTheme"
v-model="selectedCityObj"
/>
<div>
선택된 도시로 강행합니다.<br />
최대 3칸내 도시로만 강행이 가능합니다.<br />
목록을 선택하거나 도시를 클릭하세요.<br />
</div>
<div class="row">
<div class="col">
<CitySelect :cities="citiesMap" :modelValue="selectedCityID" />
<TopBackBar :title="commandName" />
<div class="bg0">
<MapLegacyTemplate
:isDetailMap="false"
:clickableAll="true"
:neutralView="true"
:useCachedMap="true"
:mapTheme="mapTheme"
v-model="selectedCityObj"
/>
<div>
선택된 도시로 강행합니다.<br />
최대 3칸내 도시로만 강행이 가능합니다.<br />
목록을 선택하거나 도시를 클릭하세요.<br />
</div>
<div class="col">
<b-button @click="submit">{{ commandName }}</b-button>
<div class="row">
<div class="col">
<CitySelect :cities="citiesMap" :modelValue="selectedCityID" />
</div>
<div class="col">
<b-button @click="submit">{{ commandName }}</b-button>
</div>
</div>
<CityBasedOnDistance
:citiesMap="citiesMap"
:distanceList="distanceList"
@selected="selected"
/>
</div>
<CityBasedOnDistance
:citiesMap="citiesMap"
:distanceList="distanceList"
@selected="selected"
/>
<BottomBar :title="commandName" />
</template>
<script lang="ts">
import "@/../css/map.css";
import MapLegacyTemplate, {
MapCityParsed,
} from "@/components/MapLegacyTemplate.vue";
@@ -37,17 +41,20 @@ import CityBasedOnDistance from "@/processing/CitiesBasedOnDistance.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 distanceList: Record<number, number[]>;
declare const commandName: string;
export default defineComponent({
name: "che_강행",
components: {
MapLegacyTemplate,
CitySelect,
CityBasedOnDistance,
TopBackBar,
BottomBar,
},
watch: {
selectedCityObj(city: MapCityParsed) {
@@ -55,7 +62,6 @@ export default defineComponent({
},
},
setup() {
console.log("start!");
const citiesMap = new Map<
number,
{
+104
View File
@@ -0,0 +1,104 @@
<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>
<CityBasedOnDistance
:citiesMap="citiesMap"
:distanceList="distanceList"
@selected="selected"
/>
</div>
<BottomBar :title="commandName" />
</template>
<script lang="ts">
import MapLegacyTemplate, {
MapCityParsed,
} from "@/components/MapLegacyTemplate.vue";
import CitySelect from "@/processing/CitySelect.vue";
import CityBasedOnDistance from "@/processing/CitiesBasedOnDistance.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 distanceList: Record<number, number[]>;
declare const commandName: string;
export default defineComponent({
components: {
MapLegacyTemplate,
CitySelect,
CityBasedOnDistance,
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),
distanceList,
commandName,
selected,
submit,
};
},
});
</script>
+2 -1
View File
@@ -1 +1,2 @@
export { default as che_강행 } from "./che_강행.vue";
export { default as che_강행 } from "./che_강행.vue";
export { default as che_이동 } from "./che_이동.vue";
+4 -4
View File
@@ -72,9 +72,6 @@ async function submitCommand<T>(isChiefTurn: boolean, turnList: number[], comman
declare const entryInfo: ['General', keyof typeof GeneralActions] | ['Nation', keyof typeof NationActions];
console.log('entry', entryInfo);
auto500px();
const app: App<Element> | undefined = (function () {
//NOTE: route를 쓴다?
const groupName = entryInfo[0];
@@ -96,7 +93,7 @@ const app: App<Element> | undefined = (function () {
console.error('알수')
return undefined;
}());
console.log(app);
if (app === undefined) {
console.error(`모듈이 지정되지 않음`, entryInfo);
}
@@ -110,3 +107,6 @@ else {
app.use(BootstrapVue3).component('v-multiselect', Multiselect).mount('#container');
}
auto500px();
@@ -63,8 +63,6 @@ if (!$commandObj->hasPermissionToReserve()) {
die_redirect();
}
$jsList = $commandObj->getJSPlugins();
$cssList = $commandObj->getCSSFiles();
?>
<!DOCTYPE html>
@@ -74,7 +72,7 @@ $cssList = $commandObj->getCSSFiles();
<title><?= $commandObj->getName() ?></title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<meta name="viewport" content="width=500" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printJS('d_shared/base_map.js') ?>
<?= WebUtil::printStaticValues([
@@ -87,9 +85,6 @@ $cssList = $commandObj->getCSSFiles();
'entryInfo' => [$isChiefTurn?'Nation':'General', $commandType]
])?>
<?= WebUtil::printStaticValues($commandObj->exportJSVars(), false) ?>
<script>
</script>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?php
foreach ($cssList as $css) {