feat: 임시용 cachedMap 출력 추가

This commit is contained in:
2022-04-21 23:51:43 +09:00
parent 85f801df4d
commit e9b76217f7
4 changed files with 135 additions and 0 deletions
+90
View File
@@ -0,0 +1,90 @@
<template>
<BContainer v-if="asyncReady" id="container" :toast="{ root: true }">
<div class="card">
<h3 class="card-header">{{ serverName }} 현황</h3>
<MapViewer
v-if="cachedMap"
:server-nick="serverNick"
:serverID="serverID"
:map-name="unwrap(gameConstStore?.gameConst.mapName)"
:model-value="cachedMap"
:is-detail-map="true"
:city-position="cityPosition"
:format-city-info="formatCityInfoText"
:image-path="imagePath"
:disallow-click="true"
/>
<div v-if="cachedMap" class="card-body">
<template v-for="(item, idx) in cachedMap.history" :key="idx">
<span v-html="formatLog(item)" />
<br />
</template>
</div>
</div>
</BContainer>
</template>
<script lang="ts">
declare const staticValues: {
serverName: string;
serverNick: string;
serverID: string;
};
declare const getCityPosition: () => CityPositionMap;
declare const formatCityInfo: (city: MapCityParsedRaw) => MapCityParsed;
</script>
<script lang="ts" setup>
import { onMounted, provide, ref } from "vue";
import { BContainer } from "bootstrap-vue-3";
import { SammoAPI } from "./SammoAPI";
import { formatLog } from "./utilGame/formatLog";
import MapViewer, { type CityPositionMap, type MapCityParsedRaw, type MapCityParsed } from "./components/MapViewer.vue";
import { getGameConstStore, type GameConstStore } from "./GameConstStore";
import { unwrap } from "@/util/unwrap";
import type { CachedMapResult } from "./defs";
const serverName = staticValues.serverName;
const serverNick = staticValues.serverNick;
const serverID = staticValues.serverID;
const asyncReady = ref<boolean>(false);
const gameConstStore = ref<GameConstStore>();
provide("gameConstStore", gameConstStore);
const storeP = getGameConstStore().then((store) => {
gameConstStore.value = store;
});
void Promise.all([storeP]).then(() => {
asyncReady.value = true;
});
const cityPosition = getCityPosition();
const formatCityInfoText = formatCityInfo;
const imagePath = window.pathConfig.gameImage;
const cachedMap = ref<CachedMapResult>();
onMounted(async () => {
try {
cachedMap.value = await SammoAPI.Global.GetCachedMap();
} catch (e) {
console.error(e);
}
});
</script>
<style lang="scss">
@import "@/../scss/common/bootstrap5.scss";
@include media-1000px {
#container {
width: 700px;
}
}
@include media-500px {
#container {
width: 500px;
}
}
</style>
+1
View File
@@ -24,6 +24,7 @@
"ingame_vue": {
"v_inheritPoint": "v_inheritPoint.ts",
"v_board": "v_board.ts",
"v_cachedMap": "v_cachedMap",
"v_chiefCenter": "v_chiefCenter.ts",
"v_NPCControl": "v_NPCControl.ts",
"v_join": "v_join.ts",
+8
View File
@@ -0,0 +1,8 @@
import { createApp } from 'vue'
import PageCachedMap from '@/PageCachedMap.vue';
import { BootstrapVue3, BToastPlugin } from 'bootstrap-vue-3'
import { auto500px } from "./util/auto500px";
auto500px();
createApp(PageCachedMap).use(BootstrapVue3).use(BToastPlugin).mount('#app');
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
$mapName = GameConst::$mapName;
?>
<!DOCTYPE html>
<html>
<head>
<title>최근 지도</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=500" />
<?= WebUtil::printJS('../d_shared/common_path.js', true) ?>
<?= WebUtil::printJS("js/map/theme_{$mapName}.js") ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printStaticValues([
'staticValues' => [
'serverName' => UniqueConst::$serverName,
'serverNick' => DB::prefix(),
'serverID' => UniqueConst::$serverID,
],
]) ?>
<?= WebUtil::printDist('vue', 'v_cachedMap', true) ?>
</head>
<body>
<div id="app"></div>
</body>
</html>