1
0
forked from noxious/client

Added connect sound

This commit is contained in:
Dennis Postma 2025-02-06 21:08:55 +01:00
parent c09e9ea841
commit 557b8aaabb
3 changed files with 8 additions and 2 deletions

Binary file not shown.

View File

@ -20,9 +20,12 @@ import { useMapEditorComposable } from '@/composables/useMapEditorComposable'
import { useGameStore } from '@/stores/gameStore' import { useGameStore } from '@/stores/gameStore'
import { useMapEditorStore } from '@/stores/mapEditorStore' import { useMapEditorStore } from '@/stores/mapEditorStore'
import { computed, ref, useTemplateRef, watch } from 'vue' import { computed, ref, useTemplateRef, watch } from 'vue'
import { useGameComposable } from '@/composables/useGameComposable'
const gameStore = useGameStore() const gameStore = useGameStore()
const mapEditor = useMapEditorComposable() const mapEditor = useMapEditorComposable()
const { playSound } = useGameComposable()
const currentScreen = computed(() => { const currentScreen = computed(() => {
if (!gameStore.game.isLoaded) return Loading if (!gameStore.game.isLoaded) return Loading
@ -45,8 +48,7 @@ watch(
// @TODO: Not all button-like elements will actually be a button, so we need to find a better way to do this // @TODO: Not all button-like elements will actually be a button, so we need to find a better way to do this
addEventListener('click', (event) => { addEventListener('click', (event) => {
if (!(event.target instanceof HTMLButtonElement)) return if (!(event.target instanceof HTMLButtonElement)) return
const audio = new Audio('/assets/sounds/button-click.wav') playSound('/assets/sounds/button-click.wav')
audio.play()
}) })
// Watch for "G" key press and toggle the gm panel // Watch for "G" key press and toggle the gm panel

View File

@ -29,8 +29,10 @@ import Menu from '@/components/game/gui/Menu.vue'
import Map from '@/components/game/map/Map.vue' import Map from '@/components/game/map/Map.vue'
import { useGameStore } from '@/stores/gameStore' import { useGameStore } from '@/stores/gameStore'
import { Game, Scene } from 'phavuer' import { Game, Scene } from 'phavuer'
import { useGameComposable } from '@/composables/useGameComposable'
const gameStore = useGameStore() const gameStore = useGameStore()
const { playSound } = useGameComposable()
const gameConfig = { const gameConfig = {
name: config.name, name: config.name,
@ -57,6 +59,8 @@ const createGame = (game: Phaser.Game) => {
}) })
gameStore.disconnectSocket() gameStore.disconnectSocket()
} }
playSound('/assets/sounds/connect.wav')
} }
function preloadScene(scene: Phaser.Scene) { function preloadScene(scene: Phaser.Scene) {