tile editor wip
This commit is contained in:
@ -28,13 +28,13 @@
|
||||
</select>
|
||||
</button>
|
||||
<div class="divider"></div>
|
||||
<button @click="() => zoneEditorStore.toggleZoneSettings()">
|
||||
<button @click="() => zoneEditorStore.toggleSettingsModal()">
|
||||
<img src="/assets/icons/zoneEditor/gear.svg" alt="Zone settings" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<button class="btn-cyan">Save</button>
|
||||
<button class="btn-cyan">Load</button>
|
||||
<button class="btn-cyan">Save</button>
|
||||
<button class="btn-cyan" @click="clear">Clear</button>
|
||||
<button class="btn-cyan" @click="() => zoneEditorStore.toggleActive()">Exit</button>
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<Toolbar :layer="layer" @eraser="eraser" @pencil="pencil" />
|
||||
<Tiles v-if="zoneEditorStore.tool === 'pencil' || zoneEditorStore.tool === 'eraser'" />
|
||||
<Walls v-if="zoneEditorStore.tool === 'pencil' || zoneEditorStore.tool === 'eraser'" />
|
||||
<ZoneSettings v-if="zoneEditorStore.zoneSettingsOpen" />
|
||||
<ZoneSettings v-if="zoneEditorStore.isSettingsModalShown" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@ -21,6 +21,7 @@ import { useZoneEditorStore } from '@/stores/zoneEditor'
|
||||
import ZoneSettings from '@/components/utilities/zoneEditor/ZoneSettings.vue'
|
||||
import Walls from '@/components/utilities/zoneEditor/Walls.vue'
|
||||
import { generateTilemap } from '@/services/zone'
|
||||
import type { Zone } from '@/types'
|
||||
|
||||
// Phavuer logic
|
||||
let scene = useScene()
|
||||
@ -54,10 +55,11 @@ watch(
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
socket.connection.on('gm:zone_editor:zone:load', (data) => {
|
||||
tileMap = generateTilemap(scene, data.zone.width, data.zone.height);
|
||||
zoneEditorStore.setZoneSettings(data.zone)
|
||||
zoneEditorStore.setTiles(data.zone.tiles)
|
||||
socket.connection.on('gm:zone_editor:zone:load', (data: Zone) => {
|
||||
tileMap = generateTilemap(scene, data.width, data.height);
|
||||
zoneEditorStore.setName(data.name)
|
||||
zoneEditorStore.setWidth(data.width)
|
||||
zoneEditorStore.setTiles(data.tiles)
|
||||
})
|
||||
|
||||
function eraser(tile: Phaser.Tilemaps.Tile) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<Modal :isModalOpen="true" @modal:close="() => zoneEditorStore.toggleZoneSettings()">
|
||||
<Modal :isModalOpen="true" @modal:close="() => zoneEditorStore.toggleSettingsModal()">
|
||||
<template #modalHeader>
|
||||
<h3 class="modal-title">Zone settings</h3>
|
||||
</template>
|
||||
@ -9,15 +9,15 @@
|
||||
<div class="form-fields">
|
||||
<div>
|
||||
<label for="name">Name</label>
|
||||
<input name="name" id="name" />
|
||||
<input v-model="name" name="name" id="name" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="name">Width</label>
|
||||
<input name="name" id="name" />
|
||||
<input v-model="width" name="name" id="name" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="name">Height</label>
|
||||
<input name="name" id="name" />
|
||||
<input v-model="height" name="name" id="name" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="name">PVP enabled</label>
|
||||
@ -30,9 +30,26 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, watch } from 'vue'
|
||||
import Modal from '@/components/utilities/Modal.vue'
|
||||
import { useZoneEditorStore } from '@/stores/zoneEditor'
|
||||
|
||||
const zoneEditorStore = useZoneEditorStore()
|
||||
|
||||
const name = ref(zoneEditorStore.name)
|
||||
const width = ref(zoneEditorStore.width)
|
||||
const height = ref(zoneEditorStore.height)
|
||||
|
||||
|
||||
watch(name, (value) => {
|
||||
zoneEditorStore.setName(value)
|
||||
})
|
||||
|
||||
watch(width, (value) => {
|
||||
zoneEditorStore.setWidth(value)
|
||||
})
|
||||
|
||||
watch(height, (value) => {
|
||||
zoneEditorStore.setHeight(value)
|
||||
})
|
||||
</script>
|
Reference in New Issue
Block a user