1
0
forked from noxious/client

#217: Solved duplicate texture loading issue, #215: Finished Dexie implementation.

This commit is contained in:
2024-11-02 02:20:34 +01:00
parent a3532a5940
commit ed17e7f16e
5 changed files with 163 additions and 83 deletions

View File

@ -37,7 +37,6 @@ const props = defineProps<{
character: ExtendedCharacter
}>()
const isTextureLoaded = ref(false)
const charChatContainer = refObj<Phaser.GameObjects.Container>()
const charContainer = refObj<Phaser.GameObjects.Container>()
const charSprite = refObj<Phaser.GameObjects.Sprite>()
@ -183,13 +182,14 @@ watch(
watch(() => props.character.isMoving, updateSprite)
watch(() => props.character.rotation, updateSprite)
loadSpriteTextures(scene, props.character.characterType?.sprite as SpriteT).then((loaded) => {
isTextureLoaded.value = loaded
charSprite.value!.setTexture(charTexture.value)
charSprite.value!.setFlipX(isFlippedX.value)
}).catch((error) => {
console.error('Error loading texture:', error)
})
loadSpriteTextures(scene, props.character.characterType?.sprite as SpriteT)
.then(() => {
charSprite.value!.setTexture(charTexture.value)
charSprite.value!.setFlipX(isFlippedX.value)
})
.catch((error) => {
console.error('Error loading texture:', error)
})
onMounted(() => {
charChatContainer.value!.setName(`${props.character!.name}_chatContainer`)