npm update, improved gameStore structure

This commit is contained in:
2024-09-29 15:12:20 +02:00
parent c31dada1f9
commit d214bd37ad
5 changed files with 23 additions and 18 deletions

View File

@ -12,11 +12,15 @@ export const useGameStore = defineStore('game', {
connection: null as Socket | null,
user: null as User | null,
character: null as Character | null,
isGmPanelOpen: false,
isPlayerDraggingCamera: false,
isCameraFollowingCharacter: false,
isChatOpen: false,
isUserPanelOpen: false
gameSettings: {
isCameraFollowingCharacter: false
},
uiSettings: {
isChatOpen: false,
isUserPanelOpen: false,
isGmPanelOpen: false
}
}),
getters: {
getNotifications: (state: any) => state.notifications,
@ -92,7 +96,7 @@ export const useGameStore = defineStore('game', {
this.character = character
},
toggleGmPanel() {
this.isGmPanelOpen = !this.isGmPanelOpen
this.uiSettings.isGmPanelOpen = !this.uiSettings.isGmPanelOpen
},
togglePlayerDraggingCamera() {
this.isPlayerDraggingCamera = !this.isPlayerDraggingCamera
@ -101,16 +105,16 @@ export const useGameStore = defineStore('game', {
this.isPlayerDraggingCamera = moving
},
toggleCameraFollowingCharacter() {
this.isCameraFollowingCharacter = !this.isCameraFollowingCharacter
this.gameSettings.isCameraFollowingCharacter = !this.gameSettings.isCameraFollowingCharacter
},
setCameraFollowingCharacter(following: boolean) {
this.isCameraFollowingCharacter = following
this.gameSettings.isCameraFollowingCharacter = following
},
toggleChat() {
this.isChatOpen = !this.isChatOpen
this.uiSettings.isChatOpen = !this.uiSettings.isChatOpen
},
toggleUserPanel() {
this.isUserPanelOpen = !this.isUserPanelOpen
this.uiSettings.isUserPanelOpen = !this.uiSettings.isUserPanelOpen
},
initConnection() {
this.connection = io(config.server_endpoint, {
@ -151,10 +155,11 @@ export const useGameStore = defineStore('game', {
this.token = null
this.user = null
this.character = null
this.isGmPanelOpen = false
this.uiSettings.isGmPanelOpen = false
this.isPlayerDraggingCamera = false
this.isChatOpen = false
this.isUserPanelOpen = false
this.gameSettings.isCameraFollowingCharacter = false
this.uiSettings.isChatOpen = false
this.uiSettings.isUserPanelOpen = false
}
}
})