[Editor] Remove unnecessary rows and columns fields from GameMapAsset object
This commit is contained in:
@@ -2,15 +2,10 @@ package com.bartlomiejpluta.base.editor.map.asset
|
|||||||
|
|
||||||
import com.bartlomiejpluta.base.editor.asset.model.Asset
|
import com.bartlomiejpluta.base.editor.asset.model.Asset
|
||||||
import javafx.beans.property.SimpleStringProperty
|
import javafx.beans.property.SimpleStringProperty
|
||||||
import tornadofx.*
|
import tornadofx.getValue
|
||||||
|
import tornadofx.setValue
|
||||||
|
|
||||||
// TODO(Add tileSetUID field)
|
class GameMapAsset(override val uid: String, name: String) : Asset {
|
||||||
class GameMapAsset(
|
|
||||||
override val uid: String,
|
|
||||||
name: String,
|
|
||||||
val rows: Int,
|
|
||||||
val columns: Int,
|
|
||||||
) : Asset {
|
|
||||||
override val source = "$uid.dat"
|
override val source = "$uid.dat"
|
||||||
|
|
||||||
val nameProperty = SimpleStringProperty(name)
|
val nameProperty = SimpleStringProperty(name)
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class DefaultProjectContext : ProjectContext {
|
|||||||
override fun importMap(name: String, map: GameMap) {
|
override fun importMap(name: String, map: GameMap) {
|
||||||
project?.let {
|
project?.let {
|
||||||
UID.next(it.maps.map(Asset::uid)).let { uid ->
|
UID.next(it.maps.map(Asset::uid)).let { uid ->
|
||||||
val asset = GameMapAsset(uid, name, map.rows, map.columns)
|
val asset = GameMapAsset(uid, name)
|
||||||
map.uid = uid
|
map.uid = uid
|
||||||
it.maps += asset
|
it.maps += asset
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,5 @@ class ProtobufProjectDeserializer : ProjectDeserializer {
|
|||||||
return project
|
return project
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deserializeMap(map: ProjectProto.GameMapAsset) = GameMapAsset(
|
private fun deserializeMap(map: ProjectProto.GameMapAsset) = GameMapAsset(uid = map.uid, name = map.name)
|
||||||
uid = map.uid,
|
|
||||||
name = map.name,
|
|
||||||
rows = map.rows,
|
|
||||||
columns = map.columns
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
@@ -20,8 +20,6 @@ class ProtobufProjectSerializer : ProjectSerializer {
|
|||||||
.setUid(map.uid)
|
.setUid(map.uid)
|
||||||
.setSource(map.source)
|
.setSource(map.source)
|
||||||
.setName(map.name)
|
.setName(map.name)
|
||||||
.setRows(map.rows)
|
|
||||||
.setColumns(map.columns)
|
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,11 +8,8 @@ message Project {
|
|||||||
repeated GameMapAsset maps = 2;
|
repeated GameMapAsset maps = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(Add tileSetUID field)
|
|
||||||
message GameMapAsset {
|
message GameMapAsset {
|
||||||
required string uid = 1;
|
required string uid = 1;
|
||||||
required string source = 2;
|
required string source = 2;
|
||||||
required string name = 3;
|
required string name = 3;
|
||||||
required uint32 rows = 4;
|
|
||||||
required uint32 columns = 5;
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user