diff --git a/src/components/game/character/partials/CharacterChest.vue b/src/components/game/character/partials/CharacterChest.vue deleted file mode 100644 index cbc2a05..0000000 --- a/src/components/game/character/partials/CharacterChest.vue +++ /dev/null @@ -1,51 +0,0 @@ -<template> - <Image v-bind="imageProps" v-if="gameStore.getLoadedAsset(texture)" /> -</template> - -<script lang="ts" setup> -import type { MapCharacter, Sprite as SpriteT } from '@/application/types' -import { loadSpriteTextures } from '@/services/textureService' -import { useGameStore } from '@/stores/gameStore' -import { Image, useScene } from 'phavuer' -import { computed } from 'vue' - -const props = defineProps<{ - mapCharacter: MapCharacter - currentX: number - currentY: number -}>() - -const gameStore = useGameStore() -const scene = useScene() - -const texture = computed(() => { - const { rotation, characterHair } = props.mapCharacter.character - const spriteId = characterHair?.sprite?.id - const direction = [0, 6].includes(rotation) ? 'back' : 'front' - - return `${spriteId}-${direction}` -}) - -const isFlippedX = computed(() => [6, 4].includes(props.mapCharacter.character.rotation ?? 0)) - -const imageProps = computed(() => { - // Get the current sprite action based on direction - const direction = [0, 6].includes(props.mapCharacter.character.rotation ?? 0) ? 'back' : 'front' - const spriteAction = props.mapCharacter.character.characterHair?.sprite?.spriteActions?.find((spriteAction) => spriteAction.action === direction) - - return { - depth: 1, - originX: Number(spriteAction?.originX) ?? 0, - originY: Number(spriteAction?.originY) ?? 0, - flipX: isFlippedX.value, - texture: texture.value - // y: props.mapCharacter.isMoving ? Math.floor(Date.now() / 250) % 2 : 0 - } -}) - -loadSpriteTextures(scene, props.mapCharacter.character.characterHair?.sprite as SpriteT) - .then(() => {}) - .catch((error) => { - console.error('Error loading texture:', error) - }) -</script> diff --git a/src/components/gameMaster/mapEditor/partials/MapList.vue b/src/components/gameMaster/mapEditor/partials/MapList.vue index 2cdbc25..28d9446 100644 --- a/src/components/gameMaster/mapEditor/partials/MapList.vue +++ b/src/components/gameMaster/mapEditor/partials/MapList.vue @@ -30,13 +30,12 @@ <script setup lang="ts"> import { SocketEvent } from '@/application/enums' -import type { Map, UUID } from '@/application/types' +import type { Map } from '@/application/types' import CreateMap from '@/components/gameMaster/mapEditor/partials/CreateMap.vue' import Modal from '@/components/utilities/Modal.vue' import { useMapEditorComposable } from '@/composables/useMapEditorComposable' import { MapStorage } from '@/storage/storages' import { useGameStore } from '@/stores/gameStore' -import { useMapEditorStore } from '@/stores/mapEditorStore' import { onMounted, ref, useTemplateRef } from 'vue' const gameStore = useGameStore() @@ -61,14 +60,14 @@ async function fetchMaps() { mapList.value = await mapStorage.getAll() } -function loadMap(id: UUID) { +function loadMap(id: string) { gameStore.connection?.emit(SocketEvent.GM_MAP_REQUEST, { mapId: id }, (response: Map) => { mapEditor.loadMap(response) }) modalRef.value?.close() } -async function deleteMap(id: UUID) { +async function deleteMap(id: string) { gameStore.connection?.emit(SocketEvent.GM_MAP_DELETE, { mapId: id }, async (response: boolean) => { if (!response) { gameStore.addNotification({ diff --git a/src/components/gameMaster/mapEditor/partials/SelectedPlacedMapObject.vue b/src/components/gameMaster/mapEditor/partials/SelectedPlacedMapObject.vue index 05ddce3..65cfd01 100644 --- a/src/components/gameMaster/mapEditor/partials/SelectedPlacedMapObject.vue +++ b/src/components/gameMaster/mapEditor/partials/SelectedPlacedMapObject.vue @@ -47,6 +47,7 @@ import { useMapEditorComposable } from '@/composables/useMapEditorComposable' import { MapObjectStorage } from '@/storage/storages' import { useGameStore } from '@/stores/gameStore' import { onMounted, ref } from 'vue' +import {SocketEvent} from "@/application/enums"; const props = defineProps<{ placedMapObject: PlacedMapObject @@ -81,7 +82,7 @@ async function handleUpdate() { if (!mapObject.value) return gameStore.connection?.emit( - 'gm:mapObject:update', + SocketEvent.GM_MAPOBJECT_UPDATE, { id: props.placedMapObject.mapObject as string, name: mapObjectName.value, diff --git a/src/components/gameMaster/mapEditor/partials/TeleportModal.vue b/src/components/gameMaster/mapEditor/partials/TeleportModal.vue index 38fcca0..9cfd613 100644 --- a/src/components/gameMaster/mapEditor/partials/TeleportModal.vue +++ b/src/components/gameMaster/mapEditor/partials/TeleportModal.vue @@ -59,9 +59,9 @@ defineExpose({ onMounted(fetchMaps) function fetchMaps() { - gameStore.connection?.emit(SocketEvent.GM_MAP_LIST, {}, (response: Map[]) => { - mapList.value = response - }) + // gameStore.connection?.emit(SocketEvent.GM_MAP_LIST, {}, (response: Map[]) => { + // mapList.value = response + // }) } const { toPositionX, toPositionY, toRotation, toMap } = useRefTeleportSettings()