[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 javafx.beans.property.SimpleStringProperty
|
||||
import tornadofx.*
|
||||
import tornadofx.getValue
|
||||
import tornadofx.setValue
|
||||
|
||||
// TODO(Add tileSetUID field)
|
||||
class GameMapAsset(
|
||||
override val uid: String,
|
||||
name: String,
|
||||
val rows: Int,
|
||||
val columns: Int,
|
||||
) : Asset {
|
||||
class GameMapAsset(override val uid: String, name: String) : Asset {
|
||||
override val source = "$uid.dat"
|
||||
|
||||
val nameProperty = SimpleStringProperty(name)
|
||||
|
||||
@@ -63,7 +63,7 @@ class DefaultProjectContext : ProjectContext {
|
||||
override fun importMap(name: String, map: GameMap) {
|
||||
project?.let {
|
||||
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
|
||||
it.maps += asset
|
||||
|
||||
|
||||
@@ -18,10 +18,5 @@ class ProtobufProjectDeserializer : ProjectDeserializer {
|
||||
return project
|
||||
}
|
||||
|
||||
private fun deserializeMap(map: ProjectProto.GameMapAsset) = GameMapAsset(
|
||||
uid = map.uid,
|
||||
name = map.name,
|
||||
rows = map.rows,
|
||||
columns = map.columns
|
||||
)
|
||||
private fun deserializeMap(map: ProjectProto.GameMapAsset) = GameMapAsset(uid = map.uid, name = map.name)
|
||||
}
|
||||
@@ -20,8 +20,6 @@ class ProtobufProjectSerializer : ProjectSerializer {
|
||||
.setUid(map.uid)
|
||||
.setSource(map.source)
|
||||
.setName(map.name)
|
||||
.setRows(map.rows)
|
||||
.setColumns(map.columns)
|
||||
.build()
|
||||
|
||||
}
|
||||
@@ -8,11 +8,8 @@ message Project {
|
||||
repeated GameMapAsset maps = 2;
|
||||
}
|
||||
|
||||
// TODO(Add tileSetUID field)
|
||||
message GameMapAsset {
|
||||
required string uid = 1;
|
||||
required string source = 2;
|
||||
required string name = 3;
|
||||
required uint32 rows = 4;
|
||||
required uint32 columns = 5;
|
||||
}
|
||||
Reference in New Issue
Block a user