[editor] fixes

This commit is contained in:
2018-02-13 17:12:24 +03:00
parent 592e59e01f
commit bd86412d83
4 changed files with 18 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

View File

@@ -38,7 +38,7 @@ class BrickView extends SpriteView implements IListItemView<BrickConfig> {
private function set_data(value:BrickConfig):BrickConfig { private function set_data(value:BrickConfig):BrickConfig {
data = value; data = value;
var src = 'resources/images/map/map_${value.type}.png'; var src = 'resources/image/map/${value.type}.png';
imageView.bitmapData = Assets.getBitmapData(src); imageView.bitmapData = Assets.getBitmapData(src);
imageView.x = (width - imageView.width) / 2; imageView.x = (width - imageView.width) / 2;
imageView.y = (height - imageView.height) / 2; imageView.y = (height - imageView.height) / 2;

View File

@@ -112,7 +112,7 @@ class Editor {
view.mapView.config = config; view.mapView.config = config;
view.mapView.data = LevelBundle.empty(config); view.mapView.data = LevelBundle.empty(config);
view.brickList.data = config.bricks.filter(function(brick) return brick.type > -1); view.brickList.data = config.bricks.filter(function(brick) return brick.index > -1);
view.spawnPointList.data = config.points; view.spawnPointList.data = config.points;
view.mapView.brush = Brush.BRICK(view.brickList.data[0]); view.mapView.brush = Brush.BRICK(view.brickList.data[0]);

View File

@@ -41,12 +41,23 @@ class SpawnPointItem extends BitmapItem<SpawnPointEntity> {
} }
public static function getSrc(value:SpawnPoint, config:Config):String { public static function getSrc(value:SpawnPoint, config:Config):String {
var tankType = config.getTeam(value.team).tanks[0]; var preset:GamePreset = config.presets[config.presets.length - 1];
var tankConfig = config.getTank(tankType.type); var tankConfig:TankConfig = null;
if (value.type == 'tank') {
var team:TeamConfig = Lambda.find(preset.teams, function(t) return t.id == value.team);
var player:PlayerConfig = null;
if (value.index > 0) {
player = Lambda.find(team.players, function(p) return p.index == value.index);
} else {
player = team.players[0];
}
var tankType = player.tanks[0];
tankConfig = config.getTank(tankType.type);
}
return switch(value.type) { return switch(value.type) {
case 'eagle': 'resources/images/eagle/eagle-0.png'; case 'eagle': 'resources/image/eagle/eagle.png';
case 'tank': 'resources/image/tank/${tankConfig.skin}-0.png'; case 'tank': 'resources/image/tank/${tankConfig.skin}-0.png';
case x: 'resources/images/eagle/eagle-1.png'; case x: 'resources/image/eagle/eagle-death.png';
} }
} }
@@ -181,7 +192,7 @@ class MapEditView extends SpriteView {
} }
private function drawMap() { private function drawMap() {
for (brick in map.bricks) if (brick.config.type > 0) { for (brick in map.bricks) if (brick.config.index > 0) {
if (!items.exists(brick.key)) { if (!items.exists(brick.key)) {
items[brick.key] = new BrickItem(brick); items[brick.key] = new BrickItem(brick);
if (brick.config.layer > 2) { if (brick.config.layer > 2) {