asset mngr stuff

This commit is contained in:
2024-06-29 22:39:22 +02:00
parent 2313a0faea
commit 270b14d8e5
22 changed files with 316 additions and 261 deletions

View File

@ -10,8 +10,8 @@ import { getTile, tileToWorldXY } from '@/services/zone'
import { useZoneStore } from '@/stores/zone'
import { useZoneEditorStore } from '@/stores/zoneEditor'
const zoneStore = useZoneStore();
const zoneEditorStore = useZoneEditorStore();
const zoneStore = useZoneStore()
const zoneEditorStore = useZoneEditorStore()
const scene = useScene()
const props = defineProps({
layer: Phaser.Tilemaps.TilemapLayer
@ -43,7 +43,7 @@ function onPointerMove(pointer: Phaser.Input.Pointer) {
scene.input.on(Phaser.Input.Events.POINTER_MOVE, onPointerMove)
// Zone camera system
function dragZone (pointer: Phaser.Input.Pointer) {
function dragZone(pointer: Phaser.Input.Pointer) {
if (!pointer.isDown) return
cam.scrollX -= (pointer.x - pointer.prevPosition.x) / cam.zoom
cam.scrollY -= (pointer.y - pointer.prevPosition.y) / cam.zoom
@ -52,14 +52,16 @@ let cam = scene.cameras.main
scene.input.on(Phaser.Input.Events.POINTER_MOVE, dragZone)
watch(
() => zoneEditorStore.tool, () => {
() => zoneEditorStore.tool,
() => {
// @TODO : change to zone for when loading other maps
if (zoneEditorStore.tool === 'move') {
scene.input.on(Phaser.Input.Events.POINTER_MOVE, dragZone)
} else {
scene.input.off(Phaser.Input.Events.POINTER_MOVE, dragZone)
}
}, { deep: true }
if (zoneEditorStore.tool === 'move') {
scene.input.on(Phaser.Input.Events.POINTER_MOVE, dragZone)
} else {
scene.input.off(Phaser.Input.Events.POINTER_MOVE, dragZone)
}
},
{ deep: true }
)
// Unload funcs