1
0
forked from noxious/client

Refactoring of modalShown booleans

This commit is contained in:
2025-01-25 23:27:15 -06:00
parent 14aa696197
commit 791830fd6f
23 changed files with 377 additions and 448 deletions

View File

@ -2,7 +2,7 @@
<Debug />
<Notifications />
<BackgroundImageLoader />
<GmPanel v-if="gameStore.character?.role === 'gm'" />
<GmPanel v-if="gameStore.character?.role === 'gm'" @open-map-editor="isEditorShown = true"/>
<component :is="currentScreen" />
</template>
@ -17,24 +17,26 @@ import BackgroundImageLoader from '@/components/utilities/BackgroundImageLoader.
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, ref, useTemplateRef, watch } from 'vue'
import { useMapEditorComposable } from '@/composables/useMapEditorComposable'
import { computed, watch } from 'vue'
const gameStore = useGameStore()
const mapEditor = useMapEditorComposable()
const isEditorShown = ref(false)
const currentScreen = computed(() => {
if (!gameStore.game.isLoaded) return Loading
if (!gameStore.connection) return Login
if (!gameStore.token) return Login
if (!gameStore.character) return Characters
if (mapEditor.active.value) return MapEditor
if (isEditorShown.value) return MapEditor
return Game
})
// Watch mapEditor.active and empty gameStore.game.loadedAssets
watch(
() => mapEditor.active.value,
() => isEditorShown.value,
() => {
gameStore.game.loadedTextures = []
}