[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 {
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.x = (width - imageView.width) / 2;
imageView.y = (height - imageView.height) / 2;

View File

@@ -112,7 +112,7 @@ class Editor {
view.mapView.config = 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.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 {
var tankType = config.getTeam(value.team).tanks[0];
var tankConfig = config.getTank(tankType.type);
var preset:GamePreset = config.presets[config.presets.length - 1];
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) {
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 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() {
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)) {
items[brick.key] = new BrickItem(brick);
if (brick.config.layer > 2) {