From fb18841c9109942cb28bd37af5125bffd881eef4 Mon Sep 17 00:00:00 2001 From: Dennis Postma Date: Thu, 9 Jan 2025 16:02:17 +0100 Subject: [PATCH] npm run format --- src/App.vue | 2 +- src/components/game/character/Character.vue | 6 ++--- src/components/game/map/Map.vue | 4 ++-- src/components/game/map/MapTiles.vue | 6 ++--- src/components/screens/Characters.vue | 23 +++++++++---------- src/components/screens/Loading.vue | 15 +++--------- src/components/utilities/Debug.vue | 19 ++++----------- src/composables/gameComposable.ts | 2 +- .../pointerHandlers/useGamePointerHandlers.ts | 19 +++------------ src/storage/baseStorage.ts | 2 +- src/storage/storages.ts | 3 +-- src/stores/gameStore.ts | 6 +++-- src/stores/mapStore.ts | 2 +- 13 files changed, 39 insertions(+), 70 deletions(-) diff --git a/src/App.vue b/src/App.vue index 13e49fb..f4af5ff 100644 --- a/src/App.vue +++ b/src/App.vue @@ -14,11 +14,11 @@ import Loading from '@/components/screens/Loading.vue' import Login from '@/components/screens/Login.vue' import MapEditor from '@/components/screens/MapEditor.vue' import BackgroundImageLoader from '@/components/utilities/BackgroundImageLoader.vue' +import Debug from '@/components/utilities/Debug.vue' import Notifications from '@/components/utilities/Notifications.vue' import { useGameStore } from '@/stores/gameStore' import { useMapEditorStore } from '@/stores/mapEditorStore' import { computed, onMounted, onUnmounted, watch } from 'vue' -import Debug from '@/components/utilities/Debug.vue' const gameStore = useGameStore() const mapEditorStore = useMapEditorStore() diff --git a/src/components/game/character/Character.vue b/src/components/game/character/Character.vue index adcea29..e0a0aea 100644 --- a/src/components/game/character/Character.vue +++ b/src/components/game/character/Character.vue @@ -2,8 +2,8 @@ - - + + @@ -16,11 +16,11 @@ import ChatBubble from '@/components/game/character/partials/ChatBubble.vue' import Healthbar from '@/components/game/character/partials/Healthbar.vue' import { loadSpriteTextures } from '@/composables/gameComposable' import { calculateIsometricDepth, tileToWorldX, tileToWorldY } from '@/composables/mapComposable' +import { CharacterTypeStorage } from '@/storage/storages' import { useGameStore } from '@/stores/gameStore' import { useMapStore } from '@/stores/mapStore' import { Container, refObj, Sprite, useScene } from 'phavuer' import { computed, onMounted, onUnmounted, ref, watch } from 'vue' -import { CharacterTypeStorage } from '@/storage/storages' // import CharacterChest from '@/components/game/character/partials/CharacterChest.vue' diff --git a/src/components/game/map/Map.vue b/src/components/game/map/Map.vue index 9b5a22c..884f074 100644 --- a/src/components/game/map/Map.vue +++ b/src/components/game/map/Map.vue @@ -5,16 +5,16 @@ \ No newline at end of file + diff --git a/src/components/screens/Characters.vue b/src/components/screens/Characters.vue index 040e071..f82ba79 100644 --- a/src/components/screens/Characters.vue +++ b/src/components/screens/Characters.vue @@ -41,16 +41,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -124,9 +124,9 @@ import config from '@/application/config' import { type CharacterHair, type Character as CharacterT, type Map } from '@/application/types' import Modal from '@/components/utilities/Modal.vue' +import { CharacterHairStorage } from '@/storage/storages' import { useGameStore } from '@/stores/gameStore' import { onBeforeUnmount, onMounted, ref, watch } from 'vue' -import { CharacterHairStorage } from '@/storage/storages' const gameStore = useGameStore() const isLoading = ref(true) @@ -137,7 +137,6 @@ const newCharacterName = ref('') const characterHairs = ref([]) const selectedHairId = ref(null) - // Fetch characters setTimeout(() => { gameStore.connection?.emit('character:list') diff --git a/src/components/screens/Loading.vue b/src/components/screens/Loading.vue index 044fcc8..caa7109 100644 --- a/src/components/screens/Loading.vue +++ b/src/components/screens/Loading.vue @@ -17,27 +17,18 @@ \ No newline at end of file + diff --git a/src/composables/gameComposable.ts b/src/composables/gameComposable.ts index 5efd737..c17ddfc 100644 --- a/src/composables/gameComposable.ts +++ b/src/composables/gameComposable.ts @@ -1,7 +1,7 @@ import type { TextureData } from '@/application/types' +import { SpriteStorage } from '@/storage/storages' import { TextureStorage } from '@/storage/textureStorage' import { useGameStore } from '@/stores/gameStore' -import { SpriteStorage } from '@/storage/storages' const textureLoadingPromises = new Map>() diff --git a/src/composables/pointerHandlers/useGamePointerHandlers.ts b/src/composables/pointerHandlers/useGamePointerHandlers.ts index f01225b..a6c4017 100644 --- a/src/composables/pointerHandlers/useGamePointerHandlers.ts +++ b/src/composables/pointerHandlers/useGamePointerHandlers.ts @@ -34,32 +34,19 @@ export function useGamePointerHandlers(scene: Phaser.Scene, layer: Phaser.Tilema if (!gameStore.game.isPlayerDraggingCamera) return - const distance = Phaser.Math.Distance.Between( - pointerStartPosition.value.x, - pointerStartPosition.value.y, - pointer.x, - pointer.y - ) + const distance = Phaser.Math.Distance.Between(pointerStartPosition.value.x, pointerStartPosition.value.y, pointer.x, pointer.y) // If the distance is less than the drag threshold, return // We do this to prevent the camera from scrolling too quickly if (distance <= dragThreshold) return - camera.setScroll( - camera.scrollX - (pointer.x - pointer.prevPosition.x) / camera.zoom, - camera.scrollY - (pointer.y - pointer.prevPosition.y) / camera.zoom - ) + camera.setScroll(camera.scrollX - (pointer.x - pointer.prevPosition.x) / camera.zoom, camera.scrollY - (pointer.y - pointer.prevPosition.y) / camera.zoom) } function handlePointerUp(pointer: Phaser.Input.Pointer) { gameStore.setPlayerDraggingCamera(false) - const distance = Phaser.Math.Distance.Between( - pointerStartPosition.value.x, - pointerStartPosition.value.y, - pointer.x, - pointer.y - ) + const distance = Phaser.Math.Distance.Between(pointerStartPosition.value.x, pointerStartPosition.value.y, pointer.x, pointer.y) // If the distance is greater than the drag threshold, return // We do this to prevent the camera from scrolling too quickly diff --git a/src/storage/baseStorage.ts b/src/storage/baseStorage.ts index b12036f..79a6cde 100644 --- a/src/storage/baseStorage.ts +++ b/src/storage/baseStorage.ts @@ -57,4 +57,4 @@ export class BaseStorage { console.error(`Failed to destroy ${this.tableName}:`, error) } } -} \ No newline at end of file +} diff --git a/src/storage/storages.ts b/src/storage/storages.ts index 65dd969..96bf41b 100644 --- a/src/storage/storages.ts +++ b/src/storage/storages.ts @@ -1,4 +1,4 @@ -import type { Tile, Map, MapObject } from '@/application/types' +import type { Map, MapObject, Tile } from '@/application/types' import { BaseStorage } from '@/storage/baseStorage' export class MapStorage extends BaseStorage { @@ -41,4 +41,3 @@ export class CharacterHairStorage extends BaseStorage { super('characterHairs', 'id, name, createdAt, updatedAt') } } - diff --git a/src/stores/gameStore.ts b/src/stores/gameStore.ts index c9c05cd..ff7edca 100644 --- a/src/stores/gameStore.ts +++ b/src/stores/gameStore.ts @@ -38,8 +38,10 @@ export const useGameStore = defineStore('game', { return state.game.loadedTextures }, isAssetLoaded: (state) => { - return (key: string) => { return state.game.loadedTextures.includes(key)} - }, + return (key: string) => { + return state.game.loadedTextures.includes(key) + } + } }, actions: { addNotification(notification: Notification) { diff --git a/src/stores/mapStore.ts b/src/stores/mapStore.ts index fc798fd..313924e 100644 --- a/src/stores/mapStore.ts +++ b/src/stores/mapStore.ts @@ -15,7 +15,7 @@ export const useMapStore = defineStore('map', { }, getCharacterCount: (state) => { return state.characters.length - }, + } }, actions: { setMapId(mapId: UUID) {