This commit is contained in:
2026-09-10 04:19:15 +07:00
parent 23eacd0aa4
commit cc5c0e18c6
40 changed files with 53 additions and 46 deletions
+9 -2
View File
@@ -56,6 +56,7 @@ const game = ref<Game>({
})
const screens = ref<ScreenState[]>([])
const mapItems = ref<MapItem[]>([])
const mapSaving = ref(false)
const mapScale = ref(1)
const mapOffset = ref({ x: 0, y: 0 })
let dragState: { item: MapItem; startX: number; startY: number; itemX: number; itemY: number } | undefined
@@ -107,14 +108,20 @@ async function getGameScreens() {
getGameScreens()
async function getGameMap() {
if (dragState) return
if (dragState || mapSaving.value) return
const res = await client.GetGameMap({ gameId: Number(gameId) })
if (res.error == '') mapItems.value = res.items || []
}
getGameMap()
async function saveMapItem(item: MapItem, hidden = item.hidden) {
await client.UpdateGameMapItem({ gameId: Number(gameId), kind: item.kind, itemId: item.itemId, x: item.x, y: item.y, hidden })
mapSaving.value = true
try {
const res = await client.UpdateGameMapItem({ gameId: Number(gameId), kind: item.kind, itemId: item.itemId, x: item.x, y: item.y, hidden })
if (res.error != '') message.error(res.error || 'Не удалось сохранить координаты')
} finally {
mapSaving.value = false
}
}
function startMapDrag(item: MapItem, event: PointerEvent) {