1
0
forked from noxious/client

Started refactoring zone editor

This commit is contained in:
2024-10-17 02:32:39 +02:00
parent 2fad54fd26
commit 3765cfe5e9
13 changed files with 245 additions and 427 deletions

View File

@ -0,0 +1,31 @@
<template>
<SelectedZoneObject v-if="zoneEditorStore.selectedZoneObject" />
<Image v-for="object in zoneEditorStore.zone?.zoneObjects" :key="object.id" v-bind="getObjectImageProps(object)" />
</template>
<script setup lang="ts">
import { tileToWorldX, tileToWorldY } from '@/composables/zoneComposable'
import { Image } from 'phavuer'
import { useZoneEditorStore } from '@/stores/zoneEditorStore'
import type { ZoneObject } from '@/types'
import { ZoneEventTileType } from '@/types'
import SelectedZoneObject from '@/components/gameMaster/zoneEditor/partials/SelectedZoneObject.vue'
const zoneEditorStore = useZoneEditorStore()
const props = defineProps<{
tilemap: Phaser.Tilemaps.Tilemap
}>()
function getObjectImageProps(object: ZoneObject) {
return {
// alpha: object.id === movingZoneObject.value?.id ? .5 : 1,
tint: zoneEditorStore.selectedZoneObject?.id === object.id ? 0x00ff00 : 0xffffff,
x: tileToWorldX(props.tilemap as any, object.positionX, object.positionY),
y: tileToWorldY(props.tilemap as any, object.positionX, object.positionY),
texture: object.object.id,
originY: Number(object.object.originX),
originX: Number(object.object.originY)
}
}
</script>