forked from noxious/client
Make zone loading dynamic
This commit is contained in:
@ -1,19 +1,14 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import type { Object, ZoneObject } from '@/types'
|
||||
import type { Object, ZoneObject, Zone } from '@/types'
|
||||
|
||||
export const useZoneEditorStore = defineStore('zoneEditor', {
|
||||
state: () => ({
|
||||
active: true,
|
||||
name: '',
|
||||
width: 10,
|
||||
height: 10,
|
||||
zone: null as Zone | null,
|
||||
tool: 'move',
|
||||
drawMode: 'tile',
|
||||
tileList: [] as string[],
|
||||
tiles: [] as string[][],
|
||||
objectList: [] as Object[],
|
||||
objects: [] as ZoneObject[],
|
||||
|
||||
selectedTile: '',
|
||||
selectedObject: null as Object | null,
|
||||
isZoneListModalShown: false,
|
||||
@ -24,14 +19,8 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
|
||||
toggleActive() {
|
||||
this.active = !this.active
|
||||
},
|
||||
setName(name: string) {
|
||||
this.name = name
|
||||
},
|
||||
setWidth(width: number) {
|
||||
this.width = width
|
||||
},
|
||||
setHeight(height: number) {
|
||||
this.height = height
|
||||
setZone(zone: Zone) {
|
||||
this.zone = zone
|
||||
},
|
||||
setTool(tool: string) {
|
||||
this.tool = tool
|
||||
@ -42,21 +31,9 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
|
||||
setTileList(tiles: string[]) {
|
||||
this.tileList = tiles
|
||||
},
|
||||
setTiles(tiles: string[][]) {
|
||||
this.tiles = tiles
|
||||
},
|
||||
updateTile(x: number, y: number, tile: string) {
|
||||
this.tiles[y][x] = tile
|
||||
},
|
||||
setObjectList(objects: Object[]) {
|
||||
this.objectList = objects
|
||||
},
|
||||
setObjects(objects: ZoneObject[]) {
|
||||
this.objects = objects
|
||||
},
|
||||
updateObject(index: number, object: ZoneObject) {
|
||||
this.objects[index] = object
|
||||
},
|
||||
setSelectedTile(tile: string) {
|
||||
this.selectedTile = tile
|
||||
},
|
||||
@ -74,13 +51,9 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
|
||||
this.isCreateZoneModalShown = !this.isCreateZoneModalShown
|
||||
},
|
||||
reset() {
|
||||
this.name = ''
|
||||
this.width = 10
|
||||
this.height = 10
|
||||
this.zone = null
|
||||
this.tileList = []
|
||||
this.tiles = []
|
||||
this.objectList = []
|
||||
this.objects = []
|
||||
this.tool = 'move'
|
||||
this.drawMode = 'tile'
|
||||
this.selectedTile = ''
|
||||
@ -90,10 +63,4 @@ export const useZoneEditorStore = defineStore('zoneEditor', {
|
||||
this.isCreateZoneModalShown = false
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* Resources:
|
||||
* https://www.html5gamedevs.com/topic/21908-phaser-is-there-any-tutorial-on-how-to-do-an-isometric-game/
|
||||
* http://murdochcarpenter.com/isometric-starling-part-i/
|
||||
*/
|
||||
})
|
Reference in New Issue
Block a user