From 4fa5cf84fa3b756ccc8c1486854177460006aece Mon Sep 17 00:00:00 2001 From: shmyga Date: Fri, 6 Sep 2019 16:23:31 +0300 Subject: [PATCH] [editor] add PackListFrame --- gulpfile.js | 2 +- src/client/haxe/ru/m/tankz/view/GameFrame.hx | 3 +- .../haxe/ru/m/tankz/view/GameFrame.yaml | 2 + .../ru/m/tankz/view/game/GameViewContainer.hx | 14 ++- .../haxe/ru/m/tankz/preset/ClassicGame.hx | 10 -- .../haxe/ru/m/tankz/preset/DeathGame.hx | 7 -- src/common/haxe/ru/m/tankz/preset/DotaGame.hx | 10 -- src/editor/haxe/ru/m/tankz/editor/Editor.hx | 11 ++- .../ru/m/tankz/editor/view/EditorView.yaml | 32 +------ .../haxe/ru/m/tankz/editor/view/MapFrame.yaml | 85 ----------------- .../editor/view/{MapFrame.hx => PackFrame.hx} | 61 ++++++++---- .../ru/m/tankz/editor/view/PackFrame.yaml | 92 +++++++++++++++++++ .../ru/m/tankz/editor/view/PackListFrame.hx | 41 +++++++++ .../ru/m/tankz/editor/view/PackListFrame.yaml | 23 +++++ .../ru/m/tankz/editor/view/map/BrickView.hx | 17 +++- .../ru/m/tankz/editor/view/map/BrushView.hx | 9 +- .../m/tankz/editor/view/map/SpawnPointView.hx | 12 ++- 17 files changed, 252 insertions(+), 179 deletions(-) delete mode 100644 src/common/haxe/ru/m/tankz/preset/ClassicGame.hx delete mode 100644 src/common/haxe/ru/m/tankz/preset/DeathGame.hx delete mode 100644 src/common/haxe/ru/m/tankz/preset/DotaGame.hx delete mode 100644 src/editor/haxe/ru/m/tankz/editor/view/MapFrame.yaml rename src/editor/haxe/ru/m/tankz/editor/view/{MapFrame.hx => PackFrame.hx} (64%) create mode 100644 src/editor/haxe/ru/m/tankz/editor/view/PackFrame.yaml create mode 100644 src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.hx create mode 100644 src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.yaml diff --git a/gulpfile.js b/gulpfile.js index 19532aa..59936c9 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -137,7 +137,7 @@ const editor = new Project( meta: { filename: 'editor', width: 1024, - height: 850, + height: 768, }, flags: [ //'dev_layout', diff --git a/src/client/haxe/ru/m/tankz/view/GameFrame.hx b/src/client/haxe/ru/m/tankz/view/GameFrame.hx index 07c6a36..0df4f29 100644 --- a/src/client/haxe/ru/m/tankz/view/GameFrame.hx +++ b/src/client/haxe/ru/m/tankz/view/GameFrame.hx @@ -14,7 +14,6 @@ import ru.m.tankz.game.record.GamePlayer; import ru.m.tankz.game.record.GameRecord; import ru.m.tankz.local.LocalGame; import ru.m.tankz.network.NetworkGame; -import ru.m.tankz.preset.DotaGame; import ru.m.tankz.sound.SoundManager; import ru.m.tankz.storage.GameStorage; import ru.m.tankz.storage.SettingsStorage; @@ -58,7 +57,7 @@ import ru.m.tankz.view.gamepad.GamepadView; case RECORD(record): new GamePlayer(record); } gameView = switch game.type { - case DotaGame.TYPE: GameViewB.factory(game.config); + case "dota": GameViewB.factory(game.config); case _: GameViewA.factory(game.config); }; gameViewContainer.addView(gameView); diff --git a/src/client/haxe/ru/m/tankz/view/GameFrame.yaml b/src/client/haxe/ru/m/tankz/view/GameFrame.yaml index 9e7b3d4..3538bc9 100644 --- a/src/client/haxe/ru/m/tankz/view/GameFrame.yaml +++ b/src/client/haxe/ru/m/tankz/view/GameFrame.yaml @@ -5,6 +5,8 @@ overflow.y: crop views: - id: game $type: ru.m.tankz.view.game.GameViewContainer + layout.hAlign: center + layout.vAlign: middle - id: gamepad $type: ru.m.tankz.view.gamepad.GamepadView geometry.position: absolute diff --git a/src/client/haxe/ru/m/tankz/view/game/GameViewContainer.hx b/src/client/haxe/ru/m/tankz/view/game/GameViewContainer.hx index 3382edd..a3226d9 100644 --- a/src/client/haxe/ru/m/tankz/view/game/GameViewContainer.hx +++ b/src/client/haxe/ru/m/tankz/view/game/GameViewContainer.hx @@ -1,5 +1,7 @@ package ru.m.tankz.view.game; +import haxework.view.geometry.HAlign; +import haxework.view.geometry.VAlign; import haxework.view.group.GroupView; class GameViewContainer extends GroupView { @@ -10,8 +12,16 @@ class GameViewContainer extends GroupView { var s = Math.min(parent.width / width, parent.height / height); if (s < 1) { content.scaleX = content.scaleY = s; - content.x = (parent.width - width * s) / 2; - content.y = (parent.height - height * s) / 2; + content.x = switch layout.hAlign { + case LEFT | NONE: 0; + case CENTER: (parent.width - width * s) / 2; + case RIGHT: (parent.width - width * s); + } + content.y = switch layout.vAlign { + case TOP | NONE: 0; + case MIDDLE: (parent.height - height * s) / 2; + case BOTTOM: (parent.height - height * s); + } } else { content.scaleX = content.scaleY = 1; } diff --git a/src/common/haxe/ru/m/tankz/preset/ClassicGame.hx b/src/common/haxe/ru/m/tankz/preset/ClassicGame.hx deleted file mode 100644 index 75960a9..0000000 --- a/src/common/haxe/ru/m/tankz/preset/ClassicGame.hx +++ /dev/null @@ -1,10 +0,0 @@ -package ru.m.tankz.preset; - -import ru.m.tankz.Type; - -class ClassicGame { - public static var TYPE(default, never):GameType = 'classic'; - - public static var HUMAN(default, never):TeamId = 'human'; - public static var BOT(default, never):TeamId = 'bot'; -} diff --git a/src/common/haxe/ru/m/tankz/preset/DeathGame.hx b/src/common/haxe/ru/m/tankz/preset/DeathGame.hx deleted file mode 100644 index 2332802..0000000 --- a/src/common/haxe/ru/m/tankz/preset/DeathGame.hx +++ /dev/null @@ -1,7 +0,0 @@ -package ru.m.tankz.preset; - -import ru.m.tankz.Type; - -class DeathGame { - public static var TYPE(default, never):GameType = 'death'; -} diff --git a/src/common/haxe/ru/m/tankz/preset/DotaGame.hx b/src/common/haxe/ru/m/tankz/preset/DotaGame.hx deleted file mode 100644 index ee89f54..0000000 --- a/src/common/haxe/ru/m/tankz/preset/DotaGame.hx +++ /dev/null @@ -1,10 +0,0 @@ -package ru.m.tankz.preset; - -import ru.m.tankz.Type; - -class DotaGame { - public static var TYPE(default, never):GameType = 'dota'; - - public static var RADIANT(default, never):TeamId = 'radiant'; - public static var DIRE(default, never):TeamId = 'dire'; -} diff --git a/src/editor/haxe/ru/m/tankz/editor/Editor.hx b/src/editor/haxe/ru/m/tankz/editor/Editor.hx index 2affa65..bf0d022 100644 --- a/src/editor/haxe/ru/m/tankz/editor/Editor.hx +++ b/src/editor/haxe/ru/m/tankz/editor/Editor.hx @@ -1,5 +1,6 @@ package ru.m.tankz.editor; +import haxework.view.frame.FrameSwitcher; import haxework.provider.Provider; import haxework.resources.IResources; import haxework.resources.Resources; @@ -10,13 +11,14 @@ import ru.m.tankz.bundle.IConfigBundle; import ru.m.tankz.bundle.ILevelBundle; import ru.m.tankz.bundle.LevelBundle; import ru.m.tankz.editor.view.EditorView; -import ru.m.tankz.editor.view.MapFrame; +import ru.m.tankz.editor.view.PackListFrame; class Editor { - private static inline var TAG = 'Editor'; + private static inline var TAG = "Editor"; @:provide static var resources:IResources; @:provide static var theme:ITheme; + @:provide static var switcher:FrameSwitcher; public static function main() { L.push(new haxework.log.TraceLogger()); @@ -31,7 +33,7 @@ class Editor { L.i(TAG, 'Version: ${Const.VERSION}'); L.i(TAG, 'Build: ${Const.BUILD}'); resources = new Resources(); - resources.text.put('version', '${Const.VERSION}'); + resources.text.put("version", '${Const.VERSION}'); theme = new AppTheme(); @@ -40,6 +42,7 @@ class Editor { var view = new EditorView(); Root.bind(view); - view.switcher.change(MapFrame.ID); + switcher = view.switcher; + switcher.change(PackListFrame.ID); } } diff --git a/src/editor/haxe/ru/m/tankz/editor/view/EditorView.yaml b/src/editor/haxe/ru/m/tankz/editor/view/EditorView.yaml index e04f43f..79b4b6f 100644 --- a/src/editor/haxe/ru/m/tankz/editor/view/EditorView.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/view/EditorView.yaml @@ -1,31 +1,9 @@ --- -$type: haxework.view.VGroupView -style: dark -geometry.stretch: true -layout.hAlign: center views: - # Tabs - - id: tabs - $type: haxework.view.data.ButtonGroup - geometry.margin.bottom: -4 - layout.margin: 2 - buttonStyle: button.tab - +onDataSelect: ~function(id) switcher.change(id) - data: - - "map" - - "tank" - selected: "map" - # Switcher - - id: switcher - $type: haxework.view.frame.FrameSwitcher + - $type: haxework.view.frame.FrameSwitcher + id: switcher geometry.stretch: true + style: dark factory: - _map_: {$class: ru.m.tankz.editor.view.MapFrame} - _tank_: {$class: ru.m.tankz.editor.view.TankFrame} - # Version - - $type: haxework.view.form.LabelView - geometry.position: absolute - geometry.vAlign: top - geometry.hAlign: right - geometry.margin: 10 - text: $r:text:version + _pack_list_: {$class: ru.m.tankz.editor.view.PackListFrame} + _pack_: {$class: ru.m.tankz.editor.view.PackFrame} diff --git a/src/editor/haxe/ru/m/tankz/editor/view/MapFrame.yaml b/src/editor/haxe/ru/m/tankz/editor/view/MapFrame.yaml deleted file mode 100644 index bc32745..0000000 --- a/src/editor/haxe/ru/m/tankz/editor/view/MapFrame.yaml +++ /dev/null @@ -1,85 +0,0 @@ ---- -geometry.stretch: true -geometry.padding: 10 -overflow.y: scroll -layout: - $type: haxework.view.layout.VerticalLayout - margin: 2 - vAlign: top - hAlign: center -views: - - $type: haxework.view.group.HGroupView - layout.margin: 5 - views: - - $type: haxework.view.form.ButtonView - text: Classic - +onPress: ~function(_) type = 'classic' - - $type: haxework.view.form.ButtonView - text: DotA - +onPress: ~function(_) type = 'dota' - - $type: haxework.view.form.ButtonView - text: DeathMatch - +onPress: ~function(_) type = 'death' - - $type: haxework.view.group.HGroupView - layout.vAlign: middle - views: - - $type: haxework.view.form.LabelView - text: "Name:" - - id: levelName - $type: haxework.view.form.InputView - geometry.width: 300 - geometry.height: 26 - text: "" - - $type: haxework.view.form.LabelView - text: "Size:" - geometry.margin.left: 20 - - id: width - $type: haxework.view.form.InputView - geometry.width: 50 - geometry.height: 26 - - $type: haxework.view.form.LabelView - text: "x" - - id: height - $type: haxework.view.form.InputView - geometry.width: 50 - geometry.height: 26 - - $type: haxework.view.form.ButtonView - style: button.start.small - +onPress: ~applySize() - - $type: haxework.view.form.ButtonView - style: button.close.small - +onPress: ~resetSize() - # map - - $type: haxework.view.group.HGroupView - views: - - id: spawnPointList - $type: haxework.view.data.DataView - geometry.padding: 3 - layout: - $type: haxework.view.layout.VerticalLayout - hAlign: center - margin: 5 - factory: ~ru.m.tankz.editor.view.map.SpawnPointView.factory - +onDataSelect: ~selectSpawnPoint - - id: mapView - $type: ru.m.tankz.editor.view.map.MapEditView - - id: brickList - $type: haxework.view.data.DataView - geometry.padding: 3 - layout: - $type: haxework.view.layout.VerticalLayout - hAlign: center - margin: 5 - factory: ~ru.m.tankz.editor.view.map.BrickView.factory - +onDataSelect: ~selectBrick - - $type: haxework.view.group.HGroupView - layout.margin: 5 - views: - - id: openButton - $type: haxework.view.form.ButtonView - text: Open - +onPress: ~open() - - id: saveButton - $type: haxework.view.form.ButtonView - text: Save - +onPress: ~save() diff --git a/src/editor/haxe/ru/m/tankz/editor/view/MapFrame.hx b/src/editor/haxe/ru/m/tankz/editor/view/PackFrame.hx similarity index 64% rename from src/editor/haxe/ru/m/tankz/editor/view/MapFrame.hx rename to src/editor/haxe/ru/m/tankz/editor/view/PackFrame.hx index c6c5d52..e29aeea 100644 --- a/src/editor/haxe/ru/m/tankz/editor/view/MapFrame.hx +++ b/src/editor/haxe/ru/m/tankz/editor/view/PackFrame.hx @@ -1,25 +1,31 @@ package ru.m.tankz.editor.view; +import haxework.view.list.LabelListItem; import haxework.view.data.DataView; -import haxework.view.frame.FrameView; import haxework.view.form.InputView; +import haxework.view.frame.FrameSwitcher; +import haxework.view.frame.FrameView; +import haxework.view.list.ListView; import ru.m.tankz.bundle.IConfigBundle; import ru.m.tankz.config.Config; import ru.m.tankz.editor.FileUtil; import ru.m.tankz.editor.view.map.BrickView; import ru.m.tankz.editor.view.map.MapEditView; import ru.m.tankz.editor.view.map.SpawnPointView; -import ru.m.tankz.preset.ClassicGame; import ru.m.tankz.Type; import ru.m.tankz.util.LevelUtil; -@:template class MapFrame extends FrameView { - public static inline var ID = 'map'; - public static inline var TAG = 'map'; +using ru.m.tankz.view.ViewUtil; + +@:template class PackFrame extends FrameView { + public static inline var ID = "pack"; public var type(default, set):GameType; + public var level(default, set):LevelConfig; + private var fileName:String; + @:view var levels:ListView; @:view var levelName:InputView; @:view var mapView:MapEditView; @:view var spawnPointList:DataView; @@ -29,14 +35,16 @@ import ru.m.tankz.util.LevelUtil; @:provide var configBundle:IConfigBundle; @:provide var config:Config; + @:provide static var switcher:FrameSwitcher; public function new() { super(ID); } - public function init():Void { - fileName = "level000.txt"; - type = ClassicGame.TYPE; + override public function onShow(data:LevelPack):Void { + super.onShow(data); + type = data.id.type; + levels.data = data.data; } private function set_type(value:GameType):GameType { @@ -52,6 +60,31 @@ import ru.m.tankz.util.LevelUtil; return type; } + private function set_level(value:LevelConfig):LevelConfig { + level = value; + mapView.gridSize = level.size; + mapView.data = level; + levelName.text = level.name; + if (level.size != null) { + widthInput.text = Std.string(level.size.width); + heightInput.text = Std.string(level.size.height); + } else { + widthInput.text = Std.string(config.map.grid.width); + heightInput.text = Std.string(config.map.grid.height); + } + return level; + } + + private function levelViewFactory():IListItemView { + var result = new LabelListItem(function(index:Int, value:LevelConfig) return value.toLevelLabel(true)); + result.geometry.height = 48; + return result; + } + + private function onLevelSelect(item:IListItemView):Void { + level = item.data; + } + private function updateSelected(brick:BrickConfig = null, point:SpawnPoint = null) { for (v in brickList.dataViews) { v.selected = v.data == brick; @@ -74,17 +107,7 @@ import ru.m.tankz.util.LevelUtil; private function open():Void { FileUtil.browse().then(function(content:FileContent) { fileName = content.name; - var data = LevelUtil.loads(content.content); - mapView.gridSize = data.size; - mapView.data = data; - levelName.text = data.name; - if (data.size != null) { - widthInput.text = Std.string(data.size.width); - heightInput.text = Std.string(data.size.height); - } else { - widthInput.text = Std.string(config.map.grid.width); - heightInput.text = Std.string(config.map.grid.height); - } + level = LevelUtil.loads(content.content); }); } diff --git a/src/editor/haxe/ru/m/tankz/editor/view/PackFrame.yaml b/src/editor/haxe/ru/m/tankz/editor/view/PackFrame.yaml new file mode 100644 index 0000000..78aa424 --- /dev/null +++ b/src/editor/haxe/ru/m/tankz/editor/view/PackFrame.yaml @@ -0,0 +1,92 @@ +--- +views: + - $type: haxework.view.group.HGroupView + geometry.stretch: true + views: + - id: levels + $type: haxework.view.list.VListView + geometry.width: 200 + geometry.height: 100% + factory: ~levelViewFactory + +onItemSelect: ~onLevelSelect + scroll: + $type: haxework.view.list.VScrollBarView + - $type: haxework.view.group.VGroupView + geometry.stretch: true + views: + - $type: haxework.view.group.HGroupView + style: panel + views: + - $type: haxework.view.form.LabelView + text: "Name:" + - id: levelName + $type: haxework.view.form.InputView + geometry.width: 300 + geometry.height: 26 + text: "" + - $type: haxework.view.form.LabelView + text: "Size:" + geometry.margin.left: 20 + - id: width + $type: haxework.view.form.InputView + geometry.width: 50 + geometry.height: 26 + - $type: haxework.view.form.LabelView + text: "x" + - id: height + $type: haxework.view.form.InputView + geometry.width: 50 + geometry.height: 26 + - $type: haxework.view.form.ButtonView + style: button.start.small + +onPress: ~applySize() + - $type: haxework.view.form.ButtonView + style: button.close.small + +onPress: ~resetSize() + - $type: haxework.view.group.HGroupView + geometry.stretch: true + views: + - id: spawnPointList + $type: haxework.view.data.DataView + geometry.padding: 3 + layout: + $type: haxework.view.layout.VerticalLayout + hAlign: center + margin: 5 + factory: ~ru.m.tankz.editor.view.map.SpawnPointView.factory + +onDataSelect: ~selectSpawnPoint + - id: brickList + $type: haxework.view.data.DataView + geometry.padding: 3 + layout: + $type: haxework.view.layout.VerticalLayout + hAlign: center + margin: 5 + factory: ~ru.m.tankz.editor.view.map.BrickView.factory + +onDataSelect: ~selectBrick + - $type: haxework.view.group.GroupView + geometry.stretch: true + overflow.x: crop + overflow.y: crop + views: + - $type: ru.m.tankz.view.game.GameViewContainer + views: + - id: mapView + $type: ru.m.tankz.editor.view.map.MapEditView + - $type: haxework.view.group.HGroupView + style: panel + layout.margin: 10 + views: + - $type: haxework.view.SpriteView + geometry.width: 100% + - id: openButton + $type: haxework.view.form.ButtonView + text: Open + +onPress: ~open() + - id: saveButton + $type: haxework.view.form.ButtonView + text: Save + +onPress: ~save() + - $type: haxework.view.form.ButtonView + style: button.prev + +onPress: ~switcher.change("pack_list") diff --git a/src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.hx b/src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.hx new file mode 100644 index 0000000..c4fed06 --- /dev/null +++ b/src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.hx @@ -0,0 +1,41 @@ +package ru.m.tankz.editor.view; + +import haxework.view.data.DataView; +import haxework.view.form.ButtonView; +import haxework.view.frame.FrameSwitcher; +import haxework.view.frame.FrameView; +import ru.m.tankz.bundle.ILevelBundle; +import ru.m.tankz.config.Config; +import ru.m.tankz.Type; + +@:template class PackListFrame extends FrameView { + public static inline var ID = "pack_list"; + + @:view("packs") var packView:DataView; + + @:provide static var levelBundle:ILevelBundle; + @:provide static var switcher:FrameSwitcher; + + public function new() { + super(ID); + } + + override public function onShow(data:Dynamic):Void { + super.onShow(data); + packView.data = [ + levelBundle.get(new PackId("classic")), + levelBundle.get(new PackId("dota")), + levelBundle.get(new PackId("death")), + ]; + } + + private function packViewFactory(index:Int, value:LevelPack):ButtonView { + var result = new ButtonView(); + result.text = value.id; + return result; + } + + private function onPackSelect(value:LevelPack):Void { + switcher.change(PackFrame.ID, value); + } +} diff --git a/src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.yaml b/src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.yaml new file mode 100644 index 0000000..848ee99 --- /dev/null +++ b/src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.yaml @@ -0,0 +1,23 @@ +--- +views: + - id: packs + $type: haxework.view.data.DataView + geometry.width: 100% + geometry.height: 100% + geometry.padding: 30 + overflow.y: scroll + layout: + $type: haxework.view.layout.TailLayout + rowSize: 10 + margin: 5 + factory: ~packViewFactory + +onDataSelect: ~onPackSelect + - $type: haxework.view.group.HGroupView + style: panel + layout.margin: 10 + views: + - $type: haxework.view.SpriteView + geometry.width: 100% + - $type: haxework.view.form.ButtonView + style: button.prev + +onPress: ~switcher.change("pack_list") diff --git a/src/editor/haxe/ru/m/tankz/editor/view/map/BrickView.hx b/src/editor/haxe/ru/m/tankz/editor/view/map/BrickView.hx index bf884f4..da59897 100644 --- a/src/editor/haxe/ru/m/tankz/editor/view/map/BrickView.hx +++ b/src/editor/haxe/ru/m/tankz/editor/view/map/BrickView.hx @@ -1,11 +1,24 @@ package ru.m.tankz.editor.view.map; +import flash.geom.Matrix; +import flash.display.BitmapData; +import openfl.utils.Assets; import ru.m.tankz.config.Config; class BrickView extends BrushView { - override private function resolveSrc(value:BrickConfig):String { - return 'resources/image/map/${value.type}.png'; + override private function resolveImage(value:BrickConfig):BitmapData { + var image = Assets.getBitmapData('resources/image/map/${value.type}.png'); + var result = new BitmapData(image.width * 2, image.height * 2, true, 0x00000000); + var m = new Matrix(); + result.draw(image, m); + m.translate(image.width, 0); + result.draw(image, m); + m.translate(0, image.height); + result.draw(image, m); + m.translate(-image.width, 0); + result.draw(image, m); + return result; } public static inline function factory(index:Int, value:BrickConfig) { diff --git a/src/editor/haxe/ru/m/tankz/editor/view/map/BrushView.hx b/src/editor/haxe/ru/m/tankz/editor/view/map/BrushView.hx index af15bde..93f6a37 100644 --- a/src/editor/haxe/ru/m/tankz/editor/view/map/BrushView.hx +++ b/src/editor/haxe/ru/m/tankz/editor/view/map/BrushView.hx @@ -1,9 +1,9 @@ package ru.m.tankz.editor.view.map; -import haxework.color.Color; +import flash.display.BitmapData; import flash.display.Shape; +import haxework.color.Color; import haxework.view.ImageView; -import openfl.utils.Assets; class BrushView extends ImageView { @@ -30,7 +30,7 @@ class BrushView extends ImageView { selectView.graphics.lineStyle(); } - private function resolveSrc(value:D):String { + private function resolveImage(value:D):BitmapData { return null; } @@ -40,8 +40,7 @@ class BrushView extends ImageView { private function set_data(value:D):D { data = value; - var src = resolveSrc(value); - image = Assets.getBitmapData(src); + image = resolveImage(value); color = resolveColor(value); return data; } diff --git a/src/editor/haxe/ru/m/tankz/editor/view/map/SpawnPointView.hx b/src/editor/haxe/ru/m/tankz/editor/view/map/SpawnPointView.hx index 748d28d..f6533a3 100644 --- a/src/editor/haxe/ru/m/tankz/editor/view/map/SpawnPointView.hx +++ b/src/editor/haxe/ru/m/tankz/editor/view/map/SpawnPointView.hx @@ -1,7 +1,9 @@ package ru.m.tankz.editor.view.map; +import flash.display.BitmapData; import haxework.color.Color; import ru.m.tankz.config.Config; +import ru.m.tankz.render.RenderUtil; import ru.m.tankz.Type.PlayerId; class SpawnPointView extends BrushView { @@ -12,7 +14,7 @@ class SpawnPointView extends BrushView { return config.getColor(new PlayerId(value.team, value.index)); } - override private function resolveSrc(value:SpawnPoint):String { + override private function resolveImage(value:SpawnPoint):BitmapData { var preset:GamePreset = config.presets[config.presets.length - 1]; var tankConfig:TankConfig = null; if (value.type == 'tank') { @@ -20,10 +22,10 @@ class SpawnPointView extends BrushView { var tankType = player.tanks[0]; tankConfig = config.getTank(tankType.type); } - return switch(value.type) { - case 'eagle': 'resources/image/eagle/eagle.png'; - case 'tank': 'resources/image/tank/${tankConfig.skin}-0.png'; - case _: 'resources/image/eagle/eagle-death.png'; + return switch value.type { + case "eagle": RenderUtil.eagleImage(); + case "tank": RenderUtil.tankImage(tankConfig.skin); + case _: RenderUtil.eagleImage(true); } }