From d9915120d471ab0661cb24ac2979950b83d9a5dc Mon Sep 17 00:00:00 2001 From: shmyga Date: Wed, 13 Mar 2019 13:06:48 +0300 Subject: [PATCH] [client] update haxework. ep8 --- gulpfile.js | 13 +++- src/client/haxe/ru/m/tankz/Client.hx | 2 +- src/client/haxe/ru/m/tankz/Style.hx | 1 + .../haxe/ru/m/tankz/frame/SettingsFrame.yaml | 9 +-- .../haxe/ru/m/tankz/frame/StartFrame.yaml | 76 +++++++++---------- .../tankz/frame/classic/ClassicLevelFrame.hx | 7 +- .../frame/classic/ClassicLevelFrame.yaml | 7 +- .../haxe/ru/m/tankz/frame/common/LevelView.hx | 20 ----- .../ru/m/tankz/frame/common/LevelView.yaml | 14 ---- .../ru/m/tankz/frame/dota/DotaLevelFrame.hx | 5 +- .../ru/m/tankz/frame/dota/DotaLevelFrame.yaml | 40 +++++----- .../m/tankz/frame/settings/SettingsEditor.hx | 2 +- .../tankz/frame/settings/SettingsEditor.yaml | 2 +- .../haxe/ru/m/tankz/editor/EditorView.yaml | 4 +- .../ru/m/tankz/editor/frame/LevelFrame.hx | 41 +++++----- .../ru/m/tankz/editor/frame/LevelFrame.yaml | 23 ++++-- .../haxe/ru/m/tankz/editor/level/BrickView.hx | 49 ++---------- .../haxe/ru/m/tankz/editor/level/BrushView.hx | 48 ++++++++++++ .../ru/m/tankz/editor/level/MapEditView.hx | 9 +-- .../ru/m/tankz/editor/level/SpawnPointView.hx | 50 ++---------- src/webapp/index.html | 35 --------- 21 files changed, 188 insertions(+), 269 deletions(-) delete mode 100755 src/client/haxe/ru/m/tankz/frame/common/LevelView.hx delete mode 100644 src/client/haxe/ru/m/tankz/frame/common/LevelView.yaml create mode 100644 src/editor/haxe/ru/m/tankz/editor/level/BrushView.hx delete mode 100644 src/webapp/index.html diff --git a/gulpfile.js b/gulpfile.js index 7df7ee5..3c6e367 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -70,6 +70,10 @@ const client = new Project( sources: ['src/client/haxe'], main: 'ru.m.tankz.Client', assets: ['src/client/resources'], + meta: { + width: 1024, + height: 768, + }, flags: [ //'dom', //'dev_layout', @@ -90,7 +94,14 @@ const editor = new Project( sources: ['src/client/haxe', 'src/editor/haxe'], main: 'ru.m.tankz.editor.Editor', assets: ['src/client/resources'], - meta: {filename: 'editor'} + meta: { + filename: 'editor', + width: 1024, + height: 800, + }, + flags: [ + //'dev_layout', + ] }) ).bind(module, gulp); diff --git a/src/client/haxe/ru/m/tankz/Client.hx b/src/client/haxe/ru/m/tankz/Client.hx index 506fe2b..f036b2d 100755 --- a/src/client/haxe/ru/m/tankz/Client.hx +++ b/src/client/haxe/ru/m/tankz/Client.hx @@ -48,7 +48,7 @@ class Client { public function init():Void { var font:Font = Font.enumerateFonts()[0]; resources.text.put('font', 'Bookman Old Style'); - resources.text.put('version', 'v${Const.VERSION} b${Const.BUILD}'); + resources.text.put('version', 'v${Const.VERSION} (${Const.BUILD})'); Provider.set(FrameSwitcher, switcher); } diff --git a/src/client/haxe/ru/m/tankz/Style.hx b/src/client/haxe/ru/m/tankz/Style.hx index b302a92..7f185ed 100644 --- a/src/client/haxe/ru/m/tankz/Style.hx +++ b/src/client/haxe/ru/m/tankz/Style.hx @@ -19,6 +19,7 @@ class Style { resources.skin.put("light", [Skin.color(lightColor)]); resources.skin.put("dark", [Skin.color(darkColor)]); resources.skin.put("text", [Skin.text(textColor, 16, fontFamily)]); + resources.skin.put("text.header", [Skin.text(textColor, 22, fontFamily)]); resources.skin.put("button", [ Skin.buttonColor(lightColor), Skin.text(textColor, 18, fontFamily), diff --git a/src/client/haxe/ru/m/tankz/frame/SettingsFrame.yaml b/src/client/haxe/ru/m/tankz/frame/SettingsFrame.yaml index d756fbd..7deda09 100644 --- a/src/client/haxe/ru/m/tankz/frame/SettingsFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/SettingsFrame.yaml @@ -4,19 +4,14 @@ layout.hAlign: center layout.vAlign: middle views: - $type: haxework.gui.LabelView - skinId: text - geometry.size.fixed.height: 20 + skinId: text.header text: Settings - $type: haxework.gui.HGroupView - geometry.size.width: 100% + layout.margin: 20 views: - $type: ru.m.tankz.frame.settings.SettingsEditor - geometry.size.percent.width: 50 - #geometry.size.percent.height: 100 controlIndex: 0 - $type: ru.m.tankz.frame.settings.SettingsEditor - geometry.size.percent.width: 50 - #geometry.size.percent.height: 100 controlIndex: 1 - id: close $type: haxework.gui.ButtonView diff --git a/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml b/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml index 2790d4e..e10c847 100644 --- a/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml @@ -3,43 +3,43 @@ geometry.size.stretch: true layout.hAlign: center layout.vAlign: middle views: -- $type: haxework.gui.ImageView - image: $asset:image:resources/image/ui/logo.png - geometry.margin.bottom: 15 -- $type: haxework.gui.VGroupView - layout.margin: 3 - views: - - id: classic + - $type: haxework.gui.ImageView + image: $asset:image:resources/image/ui/logo.png + geometry.margin.bottom: 15 + - $type: haxework.gui.VGroupView + layout.margin: 3 + views: + - id: classic + $type: haxework.gui.ButtonView + skinId: button + +onPress: $this:onPress + text: Classic + - id: dota + $type: haxework.gui.ButtonView + skinId: button + +onPress: $this:onPress + text: DotA + - id: network + $type: haxework.gui.ButtonView + skinId: button + +onPress: $this:onPress + text: Network (in developing) + fontColor: 0xff0000 + visible: false + - $type: haxework.gui.LabelView + skinId: text + geometry.position: absolute + geometry.margin.right: 10 + geometry.margin.bottom: 10 + geometry.vAlign: bottom + geometry.hAlign: right + text: $r:text:version + - id: settings $type: haxework.gui.ButtonView - skinId: button + geometry.position: absolute + geometry.margin.left: 10 + geometry.margin.bottom: 10 + geometry.vAlign: bottom + geometry.hAlign: left + skinId: button.settings +onPress: $this:onPress - text: Classic - - id: dota - $type: haxework.gui.ButtonView - skinId: button - +onPress: $this:onPress - text: DotA - - id: network - $type: haxework.gui.ButtonView - skinId: button - +onPress: $this:onPress - text: Network (in developing) - fontColor: 0xff0000 - visible: false -- $type: haxework.gui.LabelView - skinId: text - geometry.position: absolute - geometry.margin.right: 10 - geometry.margin.bottom: 10 - geometry.vAlign: bottom - geometry.hAlign: right - text: $r:text:version -- id: settings - $type: haxework.gui.ButtonView - geometry.position: absolute - geometry.margin.left: 10 - geometry.margin.bottom: 10 - geometry.vAlign: bottom - geometry.hAlign: left - skinId: button.settings - +onPress: $this:onPress diff --git a/src/client/haxe/ru/m/tankz/frame/classic/ClassicLevelFrame.hx b/src/client/haxe/ru/m/tankz/frame/classic/ClassicLevelFrame.hx index d5383f6..1a5e5a3 100644 --- a/src/client/haxe/ru/m/tankz/frame/classic/ClassicLevelFrame.hx +++ b/src/client/haxe/ru/m/tankz/frame/classic/ClassicLevelFrame.hx @@ -1,7 +1,8 @@ package ru.m.tankz.frame.classic; -import haxework.gui.frame.FrameSwitcher; +import haxework.gui.ButtonView; import haxework.gui.DataView; +import haxework.gui.frame.FrameSwitcher; import haxework.gui.ToggleButtonView; import ru.m.tankz.config.Config; import ru.m.tankz.frame.common.LevelFrame; @@ -10,8 +11,8 @@ import ru.m.tankz.preset.ClassicGame; @:template class ClassicLevelFrame extends LevelFrame { public static inline var ID = "classic.level"; - @:view var presets(default, null):DataView; - @:view var levels(default, null):DataView; + @:view var presets(default, null):DataView; + @:view var levels(default, null):DataView; @:provide var frames:FrameSwitcher; diff --git a/src/client/haxe/ru/m/tankz/frame/classic/ClassicLevelFrame.yaml b/src/client/haxe/ru/m/tankz/frame/classic/ClassicLevelFrame.yaml index 2d51a6a..2711ea7 100644 --- a/src/client/haxe/ru/m/tankz/frame/classic/ClassicLevelFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/classic/ClassicLevelFrame.yaml @@ -3,8 +3,11 @@ layout: $type: haxework.gui.layout.VerticalLayout hAlign: center views: + - $type: haxework.gui.LabelView + skinId: text.header + text: Classic - id: presets - $type: haxework.gui.DataView + $type: haxework.gui.DataView layout: $type: haxework.gui.layout.HorizontalLayout hAlign: center @@ -13,7 +16,7 @@ views: +onDataSelect: $code:function(value) preset = value geometry.padding: 10 - id: levels - $type: haxework.gui.DataView + $type: haxework.gui.DataView layout: $type: haxework.gui.layout.TailLayout rowSize: 10 diff --git a/src/client/haxe/ru/m/tankz/frame/common/LevelView.hx b/src/client/haxe/ru/m/tankz/frame/common/LevelView.hx deleted file mode 100755 index bd2424b..0000000 --- a/src/client/haxe/ru/m/tankz/frame/common/LevelView.hx +++ /dev/null @@ -1,20 +0,0 @@ -package ru.m.tankz.frame.common; - -import haxework.gui.HGroupView; -import haxework.gui.LabelView; -import haxework.gui.list.ListView.IListItemView; - - -@:template class LevelView extends HGroupView implements IListItemView { - - public var item_index(default, default):Int; - public var data(default, set):Int; - - @:view var label(default, null):LabelView; - - private function set_data(value:Int):Int { - data = value; - label.text = 'Level ${data}'; - return data; - } -} diff --git a/src/client/haxe/ru/m/tankz/frame/common/LevelView.yaml b/src/client/haxe/ru/m/tankz/frame/common/LevelView.yaml deleted file mode 100644 index 1cb70ff..0000000 --- a/src/client/haxe/ru/m/tankz/frame/common/LevelView.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -geometry.size.width: 100% -geometry.size.height: 44 -geometry.margin: 5 -views: - - id: label - $type: haxework.gui.LabelView - skinId: text - geometry.size.stretch: true - text: "" -skin: - - $type: haxework.gui.skin.ColorSkin - color: 0x000000 - alpha: 0.2 diff --git a/src/client/haxe/ru/m/tankz/frame/dota/DotaLevelFrame.hx b/src/client/haxe/ru/m/tankz/frame/dota/DotaLevelFrame.hx index 71325e8..132d92c 100644 --- a/src/client/haxe/ru/m/tankz/frame/dota/DotaLevelFrame.hx +++ b/src/client/haxe/ru/m/tankz/frame/dota/DotaLevelFrame.hx @@ -1,5 +1,6 @@ package ru.m.tankz.frame.dota; +import haxework.gui.ButtonView; import haxework.gui.DataView; import haxework.gui.frame.FrameSwitcher; import ru.m.tankz.frame.common.LevelFrame; @@ -10,8 +11,8 @@ import ru.m.tankz.Type; @:template class DotaLevelFrame extends LevelFrame { public static inline var ID = "dota.level"; - @:view var levels(default, null):DataView; - @:view var players(default, null):DataView; + @:view var levels(default, null):DataView; + @:view var players(default, null):DataView; @:provide var frames:FrameSwitcher; diff --git a/src/client/haxe/ru/m/tankz/frame/dota/DotaLevelFrame.yaml b/src/client/haxe/ru/m/tankz/frame/dota/DotaLevelFrame.yaml index 450e907..7afda59 100644 --- a/src/client/haxe/ru/m/tankz/frame/dota/DotaLevelFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/dota/DotaLevelFrame.yaml @@ -1,20 +1,26 @@ --- layout: - $type: haxework.gui.layout.HorizontalLayout + $type: haxework.gui.layout.VerticalLayout + hAlign: center views: - - id: players - $type: haxework.gui.DataView - layout: - $type: haxework.gui.layout.VerticalLayout - hAlign: center - factory: $this:playerViewFactory - geometry.padding: 10 - - id: levels - $type: haxework.gui.DataView - layout: - $type: haxework.gui.layout.TailLayout - rowSize: 5 - margin: 5 - factory: $this:levelViewFactory - +onDataSelect: $code:function(value) level = value - geometry.padding: 10 + - $type: haxework.gui.LabelView + skinId: text.header + text: DotA + - $type: haxework.gui.HGroupView + views: + - id: players + $type: haxework.gui.DataView + layout: + $type: haxework.gui.layout.VerticalLayout + hAlign: center + factory: $this:playerViewFactory + geometry.padding: 10 + - id: levels + $type: haxework.gui.DataView + layout: + $type: haxework.gui.layout.TailLayout + rowSize: 5 + margin: 5 + factory: $this:levelViewFactory + +onDataSelect: $code:function(value) level = value + geometry.padding: 10 diff --git a/src/client/haxe/ru/m/tankz/frame/settings/SettingsEditor.hx b/src/client/haxe/ru/m/tankz/frame/settings/SettingsEditor.hx index 8183f6f..80e9b7d 100644 --- a/src/client/haxe/ru/m/tankz/frame/settings/SettingsEditor.hx +++ b/src/client/haxe/ru/m/tankz/frame/settings/SettingsEditor.hx @@ -14,7 +14,7 @@ import ru.m.tankz.storage.SettingsStorage; public var controlIndex(default, set): Int; @:view var label:LabelView; - @:view var list:DataView; + @:view var list:DataView; @:view var change:ButtonView; @:view var clear:ButtonView; @:view var reset:ButtonView; diff --git a/src/client/haxe/ru/m/tankz/frame/settings/SettingsEditor.yaml b/src/client/haxe/ru/m/tankz/frame/settings/SettingsEditor.yaml index 31cb3c7..fdd764f 100644 --- a/src/client/haxe/ru/m/tankz/frame/settings/SettingsEditor.yaml +++ b/src/client/haxe/ru/m/tankz/frame/settings/SettingsEditor.yaml @@ -23,7 +23,7 @@ views: skinId: button.simple text: Reset - id: list - $type: haxework.gui.DataView + $type: haxework.gui.DataView layout: $type: haxework.gui.layout.VerticalLayout factory: $this:viewFactory diff --git a/src/editor/haxe/ru/m/tankz/editor/EditorView.yaml b/src/editor/haxe/ru/m/tankz/editor/EditorView.yaml index 0156506..92d286f 100644 --- a/src/editor/haxe/ru/m/tankz/editor/EditorView.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/EditorView.yaml @@ -1,13 +1,13 @@ --- $type: haxework.gui.VGroupView -skin: $r:skin:dark +skinId: dark geometry.size.stretch: true layout.hAlign: center views: # Tabs - id: tabs $type: haxework.gui.HGroupView - geometry.margin.bottom: -3 + geometry.margin.bottom: -2 views: - id: level $type: haxework.gui.ToggleButtonView diff --git a/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.hx b/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.hx index 7b11918..17a880d 100644 --- a/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.hx +++ b/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.hx @@ -1,57 +1,56 @@ package ru.m.tankz.editor.frame; -import ru.m.tankz.preset.DotaGame; -import ru.m.tankz.preset.ClassicGame; -import ru.m.tankz.util.LevelUtil; -import ru.m.tankz.bundle.IConfigBundle; import haxework.gui.ButtonView; +import haxework.gui.DataView; import haxework.gui.LabelView; -import haxework.gui.list.ListView; -import haxework.gui.list.VListView; import haxework.gui.VGroupView; import haxework.provider.Provider; +import ru.m.tankz.bundle.IConfigBundle; import ru.m.tankz.config.Config; import ru.m.tankz.editor.FileUtil; import ru.m.tankz.editor.level.BrickView; import ru.m.tankz.editor.level.MapEditView; import ru.m.tankz.editor.level.SpawnPointView; +import ru.m.tankz.preset.ClassicGame; +import ru.m.tankz.preset.DotaGame; import ru.m.tankz.Type; +import ru.m.tankz.util.LevelUtil; @:template class LevelFrame extends VGroupView { public static inline var ID = 'level'; public static inline var TAG = 'level'; - @:view var gameClassicButton(default, null):ButtonView; - @:view var gameDotaButton(default, null):ButtonView; - @:view var openButton(default, null):ButtonView; - @:view var saveButton(default, null):ButtonView; - @:view var fileNameLabel(default, null):LabelView; - @:view var mapView(default, null):MapEditView; - @:view var spawnPointList(default, null):VListView; - @:view var brickList(default, null):VListView; + @:view var gameClassicButton:ButtonView; + @:view var gameDotaButton:ButtonView; + @:view var openButton:ButtonView; + @:view var saveButton:ButtonView; + @:view var fileNameLabel:LabelView; + @:view var mapView:MapEditView; + @:view var spawnPointList:DataView; + @:view var brickList:DataView; private var config:Config; public function init():Void { var resetSelected = function() { - for (v in brickList.items) { + for (v in brickList.views) { cast(v, BrickView).selected = false; } - for (v in spawnPointList.items) { + for (v in spawnPointList.views) { cast(v, SpawnPointView).selected = false; } }; - brickList.onItemSelect.connect(function(item:IListItemView) { + brickList.onItemSelect.connect(function(index:Int, value:BrickConfig, item:BrickView):Void { mapView.brush = Brush.BRICK(item.data); resetSelected(); - cast(item, BrickView).selected = true; + item.selected = true; }); - spawnPointList.onItemSelect.connect(function(item:IListItemView) { + spawnPointList.onItemSelect.connect(function(index:Int, value:SpawnPoint, item:SpawnPointView):Void { mapView.brush = Brush.POINT(item.data); resetSelected(); - cast(item, SpawnPointView).selected = true; + item.selected = true; }); } @@ -70,7 +69,7 @@ import ru.m.tankz.Type; spawnPointList.data = config.points; mapView.brush = Brush.BRICK(brickList.data[0]); - cast(brickList.items[0], BrickView).selected = true; + cast(brickList.views[0], BrickView).selected = true; } public function onPress(v:ButtonView):Void { diff --git a/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.yaml b/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.yaml index 9bf3722..ce2dcdf 100644 --- a/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.yaml @@ -31,17 +31,24 @@ views: +onPress: $this:onPress - id: fileNameLabel $type: haxework.gui.LabelView + # map - $type: haxework.gui.HGroupView views: - id: spawnPointList - $type: haxework.gui.list.VListView - factory: $code:function() return new ru.m.tankz.editor.level.SpawnPointView() - geometry.size.width: 56 - geometry.size.height: 100% + $type: haxework.gui.DataView + geometry.padding: 3 + layout: + $type: haxework.gui.layout.VerticalLayout + hAlign: center + margin: 5 + factory: $code:ru.m.tankz.editor.level.SpawnPointView.factory - id: mapView $type: ru.m.tankz.editor.level.MapEditView - id: brickList - $type: haxework.gui.list.VListView - factory: $code:function() return new ru.m.tankz.editor.level.BrickView() - geometry.size.width: 30 - geometry.size.height: 100% + $type: haxework.gui.DataView + geometry.padding: 3 + layout: + $type: haxework.gui.layout.VerticalLayout + hAlign: center + margin: 5 + factory: $code:ru.m.tankz.editor.level.BrickView.factory diff --git a/src/editor/haxe/ru/m/tankz/editor/level/BrickView.hx b/src/editor/haxe/ru/m/tankz/editor/level/BrickView.hx index e5a6592..44f2ebf 100644 --- a/src/editor/haxe/ru/m/tankz/editor/level/BrickView.hx +++ b/src/editor/haxe/ru/m/tankz/editor/level/BrickView.hx @@ -1,53 +1,14 @@ package ru.m.tankz.editor.level; -import flash.display.Bitmap; -import flash.display.Shape; -import haxework.gui.list.ListView; -import haxework.gui.SpriteView; -import openfl.utils.Assets; import ru.m.tankz.config.Config; +class BrickView extends BrushView { -class BrickView extends SpriteView implements IListItemView { - private static var size = 26; - - public var item_index(default, default):Int; - public var data(default, set):BrickConfig; - public var selected(default, set):Bool; - - private var imageView:Bitmap; - private var selectView:Shape; - - public function new() { - super(); - setContentSize(size, size); - selectView = createSelectView(size, size); - selectView.visible = false; - content.addChild(selectView); - imageView = new Bitmap(); - content.addChild(imageView); + override private function resolveSrc(value:BrickConfig):String { + return 'resources/image/map/${value.type}.png'; } - private static function createSelectView(width:Float, height:Float):Shape { - var view = new Shape(); - view.graphics.lineStyle(4, 0x33ff00); - view.graphics.drawRect(0, 0, width, height); - view.graphics.lineStyle(); - return view; - } - - private function set_data(value:BrickConfig):BrickConfig { - data = value; - 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; - return data; - } - - private function set_selected(value:Bool):Bool { - selected = value; - selectView.visible = value; - return selected; + public static inline function factory(index:Int, value:BrickConfig) { + return new BrickView(value); } } diff --git a/src/editor/haxe/ru/m/tankz/editor/level/BrushView.hx b/src/editor/haxe/ru/m/tankz/editor/level/BrushView.hx new file mode 100644 index 0000000..b0add74 --- /dev/null +++ b/src/editor/haxe/ru/m/tankz/editor/level/BrushView.hx @@ -0,0 +1,48 @@ +package ru.m.tankz.editor.level; + +import flash.display.Shape; +import haxework.gui.ImageView; +import openfl.utils.Assets; + +class BrushView extends ImageView { + + public var data(default, set):D; + public var selected(default, set):Bool; + + private var selectView:Shape; + + public function new(data:D = null) { + super(); + selectView = new Shape(); + selectView.visible = false; + content.addChild(selectView); + if (data != null) { + this.data = data; + } + } + + override public function update():Void { + super.update(); + selectView.graphics.clear(); + selectView.graphics.lineStyle(4, 0x33ff00); + selectView.graphics.drawRect(0, 0, width, height); + selectView.graphics.lineStyle(); + } + + private function resolveSrc(value:D):String { + return null; + } + + private function set_data(value:D):D { + data = value; + var src = resolveSrc(value); + image = Assets.getBitmapData(src); + return data; + } + + private function set_selected(value:Bool):Bool { + selected = value; + selectView.visible = value; + return selected; + } +} diff --git a/src/editor/haxe/ru/m/tankz/editor/level/MapEditView.hx b/src/editor/haxe/ru/m/tankz/editor/level/MapEditView.hx index 26af065..c5da9fa 100644 --- a/src/editor/haxe/ru/m/tankz/editor/level/MapEditView.hx +++ b/src/editor/haxe/ru/m/tankz/editor/level/MapEditView.hx @@ -13,7 +13,6 @@ import ru.m.tankz.map.Brick; import ru.m.tankz.map.LevelMap; import ru.m.tankz.render.RenderItem; - class SpawnPointEntity extends Entity { public var point(default, null):SpawnPoint; @@ -77,13 +76,11 @@ class SpawnPointItem extends BitmapItem { } } - enum Brush { POINT(point:SpawnPoint); BRICK(brick:BrickConfig); } - //ToDo: copy paste from ru.m.tankz.render.Render class MapEditView extends SpriteView { @@ -213,11 +210,7 @@ class MapEditView extends SpriteView { private function set_config(value:Config):Config { config = value; map = new LevelMap(config.map); - setContentSize(map.gridWidth * map.cellWidth, map.gridHeight * map.cellHeight); - //ToDo: - if (parent != null) { - parent.toUpdateParent(); - } + setContentSize(map.gridWidth * map.cellWidth, map.gridHeight * map.cellHeight, "map"); return config; } diff --git a/src/editor/haxe/ru/m/tankz/editor/level/SpawnPointView.hx b/src/editor/haxe/ru/m/tankz/editor/level/SpawnPointView.hx index d26d88d..f9e5e5a 100644 --- a/src/editor/haxe/ru/m/tankz/editor/level/SpawnPointView.hx +++ b/src/editor/haxe/ru/m/tankz/editor/level/SpawnPointView.hx @@ -1,55 +1,17 @@ package ru.m.tankz.editor.level; -import flash.display.Bitmap; -import flash.display.Shape; -import haxework.gui.list.ListView; -import haxework.gui.SpriteView; import haxework.provider.Provider; -import openfl.utils.Assets; import ru.m.tankz.config.Config; import ru.m.tankz.editor.level.MapEditView; +class SpawnPointView extends BrushView { -class SpawnPointView extends SpriteView implements IListItemView { - private static var size = 52; - - public var item_index(default, default):Int; - public var data(default, set):SpawnPoint; - public var selected(default, set):Bool; - - private var imageView:Bitmap; - private var selectView:Shape; - - public function new() { - super(); - setContentSize(size, size); - selectView = createSelectView(size, size); - selectView.visible = false; - content.addChild(selectView); - imageView = new Bitmap(); - content.addChild(imageView); + override private function resolveSrc(value:SpawnPoint):String { + return SpawnPointItem.getSrc(value, Provider.get(Config)); } - private static function createSelectView(width:Float, height:Float):Shape { - var view = new Shape(); - view.graphics.lineStyle(4, 0x33ff00); - view.graphics.drawRect(0, 0, width, height); - view.graphics.lineStyle(); - return view; - } - - private function set_data(value:SpawnPoint):SpawnPoint { - data = value; - var src = SpawnPointItem.getSrc(value, Provider.get(Config)); - imageView.bitmapData = Assets.getBitmapData(src); - imageView.x = (width - imageView.width) / 2; - imageView.y = (height - imageView.height) / 2; - return data; - } - - private function set_selected(value:Bool):Bool { - selected = value; - selectView.visible = value; - return selected; + public static inline function factory(index:Int, value:SpawnPoint) { + return new SpawnPointView(value); } } + diff --git a/src/webapp/index.html b/src/webapp/index.html deleted file mode 100644 index 358e364..0000000 --- a/src/webapp/index.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - Tank'z - - - -
-
    -
  • -
  • -
-
- - - \ No newline at end of file