forked from noxious/client
Loading char. texture works again
This commit is contained in:
parent
8191a039c9
commit
6ec9f8a7bc
@ -183,7 +183,7 @@ export type Character = {
|
||||
positionY: number
|
||||
rotation: number
|
||||
characterTypeId: number | null
|
||||
characterType: CharacterType | null
|
||||
characterType: CharacterType | null | string
|
||||
characterHairId: number | null
|
||||
characterHair: CharacterHair | null
|
||||
zoneId: number
|
||||
|
@ -108,7 +108,7 @@ const isFlippedX = computed(() => [6, 4].includes(props.zoneCharacter.character.
|
||||
|
||||
const charTexture = computed(() => {
|
||||
const { rotation, characterType } = props.zoneCharacter.character
|
||||
const spriteId = characterType?.sprite?.id ?? 'idle_right_down'
|
||||
const spriteId = characterType?.sprite ?? 'idle_right_down'
|
||||
const action = props.zoneCharacter.isMoving ? 'walk' : 'idle'
|
||||
const direction = [0, 6].includes(rotation) ? 'left_up' : 'right_down'
|
||||
|
||||
@ -148,7 +148,7 @@ watch(
|
||||
|
||||
watch(() => props.zoneCharacter, updateSprite)
|
||||
|
||||
loadSpriteTextures(scene, props.zoneCharacter.character.characterType?.sprite as SpriteT)
|
||||
loadSpriteTextures(scene, props.zoneCharacter.character.characterType?.sprite as string)
|
||||
.then(() => {
|
||||
charSprite.value!.setTexture(charTexture.value)
|
||||
charSprite.value!.setFlipX(isFlippedX.value)
|
||||
|
@ -56,11 +56,11 @@ export async function loadTexture(scene: Phaser.Scene, assetData: AssetDataT): P
|
||||
return loadingPromise
|
||||
}
|
||||
|
||||
export async function loadSpriteTextures(scene: Phaser.Scene, sprite: Sprite) {
|
||||
if (!sprite) return
|
||||
export async function loadSpriteTextures(scene: Phaser.Scene, sprite_id: string) {
|
||||
if (!sprite_id) return
|
||||
|
||||
// @TODO: Fix this
|
||||
const sprite_actions: HttpResponse<any[]> = await fetch(config.server_endpoint + '/assets/list_sprite_actions/' + sprite?.id).then((response) => response.json())
|
||||
const sprite_actions: HttpResponse<any[]> = await fetch(config.server_endpoint + '/assets/list_sprite_actions/' + sprite_id).then((response) => response.json())
|
||||
|
||||
for await (const sprite_action of sprite_actions.data ?? []) {
|
||||
await loadTexture(scene, {
|
||||
|
Loading…
x
Reference in New Issue
Block a user