1
0
forked from noxious/client

Cleaned character create event

This commit is contained in:
Dennis Postma 2025-02-09 17:13:22 +01:00
parent e3c3d4d420
commit 275dd95c69
6 changed files with 30 additions and 40 deletions

12
package-lock.json generated
View File

@ -2168,9 +2168,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001698",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001698.tgz",
"integrity": "sha512-xJ3km2oiG/MbNU8G6zIq6XRZ6HtAOVXsbOrP/blGazi52kc5Yy7b6sDA5O+FbROzRrV7BSTllLHuNvmawYUJjw==",
"version": "1.0.30001699",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001699.tgz",
"integrity": "sha512-b+uH5BakXZ9Do9iK+CkDmctUSEqZl+SP056vc5usa0PL+ev5OHw003rZXcnjNDv3L8P5j6rwT6C0BPKSikW08w==",
"dev": true,
"funding": [
{
@ -4099,9 +4099,9 @@
"license": "MIT"
},
"node_modules/prettier": {
"version": "3.4.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz",
"integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==",
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.0.tgz",
"integrity": "sha512-quyMrVt6svPS7CjQ9gKb3GLEX/rl3BCL2oa/QkNcXv4YNVBC9olt3s+H7ukto06q7B1Qz46PbrKLO34PR6vXcA==",
"dev": true,
"license": "MIT",
"bin": {

View File

@ -28,12 +28,12 @@
<script setup lang="ts">
import type { Tile } from '@/application/types'
import ObjectList from '@/components/gameMaster/mapEditor/partials/lists/MapObjectList.vue'
import TileList from '@/components/gameMaster/mapEditor/partials/lists/TileList.vue'
import { useMapEditorComposable } from '@/composables/useMapEditorComposable'
import { TileStorage } from '@/storage/storages'
import { liveQuery } from 'dexie'
import { onMounted, onUnmounted, ref, watch } from 'vue'
import { useMapEditorComposable } from '@/composables/useMapEditorComposable'
import TileList from '@/components/gameMaster/mapEditor/partials/lists/TileList.vue'
import ObjectList from '@/components/gameMaster/mapEditor/partials/lists/MapObjectList.vue'
const mapEditor = useMapEditorComposable()

View File

@ -1,21 +1,21 @@
<template>
<div class="h-full overflow-auto">
<div class="flex justify-between flex-wrap gap-2.5 items-center">
<div v-for="(mapObject, index) in filteredMapObjects" :key="index" class="max-w-1/4 inline-block">
<img
class="border-2 border-solid rounded max-w-full"
:src="`${config.server_endpoint}/textures/map_objects/${mapObject.id}.png`"
alt="Object"
@click="mapEditor.setSelectedMapObject(mapObject)"
:class="{
'cursor-pointer transition-all duration-300': true,
'border-cyan shadow-lg': mapEditor.selectedMapObject.value?.id === mapObject.id,
'border-transparent hover:border-gray-300': mapEditor.selectedMapObject.value?.id !== mapObject.id
}"
/>
</div>
<div class="h-full overflow-auto">
<div class="flex justify-between flex-wrap gap-2.5 items-center">
<div v-for="(mapObject, index) in filteredMapObjects" :key="index" class="max-w-1/4 inline-block">
<img
class="border-2 border-solid rounded max-w-full"
:src="`${config.server_endpoint}/textures/map_objects/${mapObject.id}.png`"
alt="Object"
@click="mapEditor.setSelectedMapObject(mapObject)"
:class="{
'cursor-pointer transition-all duration-300': true,
'border-cyan shadow-lg': mapEditor.selectedMapObject.value?.id === mapObject.id,
'border-transparent hover:border-gray-300': mapEditor.selectedMapObject.value?.id !== mapObject.id
}"
/>
</div>
</div>
</div>
</template>
<script setup lang="ts">

View File

@ -167,11 +167,10 @@ function loginWithCharacter() {
// Create character logics
function createCharacter() {
gameStore.connection?.on('character:create:success', (data: CharacterT) => {
gameStore.setCharacter(data)
isCreateNewCharacterModalOpen.value = false
gameStore.connection?.emit('character:create', { name: newCharacterName.value }, (success: boolean) => {
if (success) return
isCreateNewCharacterModalOpen.value = false
})
gameStore.connection?.emit('character:create', { name: newCharacterName.value })
}
// Watch changes for selected character and update hairs

View File

@ -5,16 +5,7 @@
<div v-if="!isLoaded" class="absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 text-white text-3xl font-ui">Loading...</div>
<div v-else>
<Map v-if="mapEditor.currentMap.value" :key="mapEditor.currentMap.value?.id" />
<Toolbar
ref="toolbar"
@save="save"
@clear="clear"
@open-maps="mapModal?.open"
@open-settings="mapSettingsModal?.open"
@close-editor="mapEditor.toggleActive"
@close-lists="list?.close"
@open-lists="list?.open"
/>
<Toolbar ref="toolbar" @save="save" @clear="clear" @open-maps="mapModal?.open" @open-settings="mapSettingsModal?.open" @close-editor="mapEditor.toggleActive" @close-lists="list?.close" @open-lists="list?.open" />
<MapList ref="mapModal" @open-create-map="mapSettingsModal?.open" />
<ListPanel ref="list" />
<MapSettings ref="mapSettingsModal" />
@ -30,8 +21,8 @@ import config from '@/application/config'
import 'phaser'
import type { Map as MapT } from '@/application/types'
import Map from '@/components/gameMaster/mapEditor/Map.vue'
import MapList from '@/components/gameMaster/mapEditor/partials/MapList.vue'
import ListPanel from '@/components/gameMaster/mapEditor/partials/ListPanel.vue'
import MapList from '@/components/gameMaster/mapEditor/partials/MapList.vue'
import MapSettings from '@/components/gameMaster/mapEditor/partials/MapSettings.vue'
import TeleportModal from '@/components/gameMaster/mapEditor/partials/TeleportModal.vue'
import Toolbar from '@/components/gameMaster/mapEditor/partials/Toolbar.vue'

View File

@ -73,7 +73,7 @@ export const useGameStore = defineStore('game', {
},
initConnection() {
this.connection = io(config.server_endpoint, {
secure: (config.environment === 'production'),
secure: config.environment === 'production',
withCredentials: true,
transports: ['websocket'],
reconnectionAttempts: 5