From 6983454ce365fe49d4f06608ead7d963b9ffde55 Mon Sep 17 00:00:00 2001 From: kts of kettek Date: Sat, 29 Jan 2022 17:54:42 -0800 Subject: [PATCH] Add zone parsing --- Engine/src/data/segment.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Engine/src/data/segment.ts b/Engine/src/data/segment.ts index e8dcd9e..c38abf6 100644 --- a/Engine/src/data/segment.ts +++ b/Engine/src/data/segment.ts @@ -3,7 +3,7 @@ export class Segment { width: number height: number bg: string | string[] - zones: Zone[] = [] + zones: SegmentZone[] = [] layers: SegmentLayer[] = [] constructor(o: any) { @@ -13,7 +13,7 @@ export class Segment { this.bg = o.backgroundColor for (let z of o.zones) { - this.zones.push(new Zone(z)) + this.zones.push(new SegmentZone(z)) } for (let l of o.layers) { @@ -68,8 +68,19 @@ export class SegmentDecoration { } } -export class Zone { +export class SegmentZone { + uuid: string + points: [number, number][] = [] + type: 'solid'|'fluid' constructor(o: any) { - // ??? + this.uuid = o.uuid + this.points = o.points.map((v: any) => { + return [v.x, v.y] + }) + if (o.data.type === 'fluid') { + this.type = o.data.type + } else { + this.type = 'solid' + } } } \ No newline at end of file