forked from noxious/client
Added world settings type and added it into gameStore
This commit is contained in:
parent
1bdd2bc75a
commit
8b1efca7b8
@ -78,8 +78,8 @@ const toggleRain = (isRaining: boolean) => {
|
|||||||
const createFogEffect = (scene: Phaser.Scene) => {
|
const createFogEffect = (scene: Phaser.Scene) => {
|
||||||
fogSprite.value = scene.add.sprite(window.innerWidth / 2, window.innerHeight / 2, 'fog')
|
fogSprite.value = scene.add.sprite(window.innerWidth / 2, window.innerHeight / 2, 'fog')
|
||||||
fogSprite.value.setScale(2)
|
fogSprite.value.setScale(2)
|
||||||
fogSprite.value.setAlpha(0) // yeetdasasdasd
|
fogSprite.value.setAlpha(0)
|
||||||
fogSprite.value.setDepth(950) // yeetdasasdasd
|
fogSprite.value.setDepth(950)
|
||||||
}
|
}
|
||||||
|
|
||||||
const updateFogEffect = () => {
|
const updateFogEffect = () => {
|
||||||
|
@ -18,6 +18,7 @@ export async function login(username: string, password: string, gameStore = useG
|
|||||||
const response = await axios.post(`${config.server_endpoint}/login`, { username, password })
|
const response = await axios.post(`${config.server_endpoint}/login`, { username, password })
|
||||||
useCookies().set('token', response.data.token as string, {
|
useCookies().set('token', response.data.token as string, {
|
||||||
// for whole domain
|
// for whole domain
|
||||||
|
// @TODO : #190
|
||||||
domain: window.location.hostname.split('.').slice(-2).join('.')
|
domain: window.location.hostname.split('.').slice(-2).join('.')
|
||||||
})
|
})
|
||||||
return { success: true, token: response.data.token }
|
return { success: true, token: response.data.token }
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { io, Socket } from 'socket.io-client'
|
import { io, Socket } from 'socket.io-client'
|
||||||
import type { Asset, Character, Notification, User } from '@/types'
|
import type { Asset, Character, Notification, User, WorldSettings } from '@/types'
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
import { useCookies } from '@vueuse/integrations/useCookies'
|
import { useCookies } from '@vueuse/integrations/useCookies'
|
||||||
|
|
||||||
@ -15,6 +15,12 @@ export const useGameStore = defineStore('game', {
|
|||||||
user: null as User | null,
|
user: null as User | null,
|
||||||
character: null as Character | null,
|
character: null as Character | null,
|
||||||
isPlayerDraggingCamera: false,
|
isPlayerDraggingCamera: false,
|
||||||
|
world: {
|
||||||
|
date: new Date(),
|
||||||
|
isRainEnabled: false,
|
||||||
|
isFogEnabled: false,
|
||||||
|
fogDensity: 0.5
|
||||||
|
} as WorldSettings,
|
||||||
gameSettings: {
|
gameSettings: {
|
||||||
isCameraFollowingCharacter: false
|
isCameraFollowingCharacter: false
|
||||||
},
|
},
|
||||||
@ -150,6 +156,7 @@ export const useGameStore = defineStore('game', {
|
|||||||
|
|
||||||
useCookies().remove('token', {
|
useCookies().remove('token', {
|
||||||
// for whole domain
|
// for whole domain
|
||||||
|
// @TODO : #190
|
||||||
domain: window.location.hostname.split('.').slice(-2).join('.')
|
domain: window.location.hostname.split('.').slice(-2).join('.')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -163,6 +170,11 @@ export const useGameStore = defineStore('game', {
|
|||||||
this.gameSettings.isCameraFollowingCharacter = false
|
this.gameSettings.isCameraFollowingCharacter = false
|
||||||
this.uiSettings.isChatOpen = false
|
this.uiSettings.isChatOpen = false
|
||||||
this.uiSettings.isUserPanelOpen = false
|
this.uiSettings.isUserPanelOpen = false
|
||||||
|
|
||||||
|
this.world.date = new Date()
|
||||||
|
this.world.isRainEnabled = false
|
||||||
|
this.world.isFogEnabled = false
|
||||||
|
this.world.fogDensity = 0.5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -215,3 +215,10 @@ export type ChatMessage = {
|
|||||||
character: Character
|
character: Character
|
||||||
message: string
|
message: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type WorldSettings = {
|
||||||
|
date: Date
|
||||||
|
isRainEnabled: boolean
|
||||||
|
isFogEnabled: boolean
|
||||||
|
fogDensity: number
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user