diff --git a/gulpfile.js b/gulpfile.js index d7a9eb1..c7b6193 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -112,6 +112,7 @@ const editor = new Project( [ Project.Platform.FLASH, Project.Platform.HTML5, + Project.Platform.LINUX, ], config.branch({ name: 'editor', diff --git a/package.json b/package.json index 9b41e5d..481d1a2 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tankz", - "version": "0.17.6", + "version": "0.18.0", "private": true, "devDependencies": { "dateformat": "^3.0.3", diff --git a/src/client/haxe/ru/m/tankz/AppTheme.hx b/src/client/haxe/ru/m/tankz/AppTheme.hx index 7539e03..b8c1d93 100644 --- a/src/client/haxe/ru/m/tankz/AppTheme.hx +++ b/src/client/haxe/ru/m/tankz/AppTheme.hx @@ -97,6 +97,11 @@ class AppTheme extends Theme { "layout.vAlign" => VAlign.MIDDLE, ], ["light"])); + register(new Style("panel_button", [ + "font.size" => fontSize.big, + "geometry.height" => SizeValue.fromString("100%"), + ], ["button"])); + register(new Style("window", [ "geometry.padding" => Box.fromFloat(2), ], ["dark", "border"])); @@ -141,10 +146,21 @@ class AppTheme extends Theme { "skin.background.color" => red, ])); - register(new Style("button.menu", [ + register(new Style("button.pack", [ + "geometry.width" => SizeValue.fromString("35h"), + "geometry.height" => SizeValue.fromString("20h"), + "geometry.padding" => Box.fromFloat(5), + "layout.hAlign" => HAlign.CENTER, + "layout.vAlign" => VAlign.MIDDLE, + "content.buttonMode" => true, + "content.mouseChildren" => false, "skin.round" => 15, ], ["border", "light"])); + register(new Style("button.menu", [ + "geometry.padding" => Box.fromArray([20, 10]), + ])); + registerButton("settings", "cog-solid.svg"); registerButton("close", "times-circle-solid.svg"); registerButton("next", "arrow-alt-circle-right-solid.svg"); diff --git a/src/client/haxe/ru/m/tankz/view/MenuFrame.yaml b/src/client/haxe/ru/m/tankz/view/MenuFrame.yaml index 607f2eb..4313e57 100644 --- a/src/client/haxe/ru/m/tankz/view/MenuFrame.yaml +++ b/src/client/haxe/ru/m/tankz/view/MenuFrame.yaml @@ -29,7 +29,6 @@ views: geometry.margin: [0, 10] visible: false - $type: hw.view.form.ButtonView - style: button.menu +onPress: ~switcher.change('record') text: Records visible: false diff --git a/src/client/haxe/ru/m/tankz/view/ResultFrame.yaml b/src/client/haxe/ru/m/tankz/view/ResultFrame.yaml index db629c6..445949e 100644 --- a/src/client/haxe/ru/m/tankz/view/ResultFrame.yaml +++ b/src/client/haxe/ru/m/tankz/view/ResultFrame.yaml @@ -24,17 +24,18 @@ views: views: - $type: hw.view.SpriteView geometry.width: 50% - - id: levels - $type: hw.view.form.ButtonView - text: Levels - +onPress: ~levels() - id: restart $type: hw.view.form.ButtonView + style: panel_button text: Restart +onPress: ~restart() - id: next $type: hw.view.form.ButtonView + style: panel_button text: Next +onPress: ~next() - $type: hw.view.SpriteView geometry.width: 50% + - $type: hw.view.form.ButtonView + style: button.prev + +onPress: ~levels() diff --git a/src/client/haxe/ru/m/tankz/view/StartFrame.hx b/src/client/haxe/ru/m/tankz/view/StartFrame.hx index c59deab..473c8bc 100644 --- a/src/client/haxe/ru/m/tankz/view/StartFrame.hx +++ b/src/client/haxe/ru/m/tankz/view/StartFrame.hx @@ -114,7 +114,8 @@ using ru.m.tankz.view.ViewUtil; private function presetViewFactory(index:Int, value:GamePreset):ButtonView { var result = new ButtonView(); result.style = 'button${!progress.isPresetCompleted(start.level.id, value.id) ? ".active" : ""}'; - result.text = value.name; + result.geometry.height = "100%"; + result.text = value.name == "default" ? "start" : value.name; result.disabled = !progress.isPresetAvailable(start.level.id, value.id); return result; } diff --git a/src/client/haxe/ru/m/tankz/view/StartFrame.yaml b/src/client/haxe/ru/m/tankz/view/StartFrame.yaml index 0d88154..8cfd9d2 100644 --- a/src/client/haxe/ru/m/tankz/view/StartFrame.yaml +++ b/src/client/haxe/ru/m/tankz/view/StartFrame.yaml @@ -28,6 +28,7 @@ views: $type: hw.view.data.DataView factory: ~presetViewFactory +onDataSelect: ~onPresetSelect + geometry.height: 100% layout: $type: hw.view.layout.HorizontalLayout hAlign: center diff --git a/src/client/haxe/ru/m/tankz/view/common/PackView.yaml b/src/client/haxe/ru/m/tankz/view/common/PackView.yaml index 895ee68..14b106f 100644 --- a/src/client/haxe/ru/m/tankz/view/common/PackView.yaml +++ b/src/client/haxe/ru/m/tankz/view/common/PackView.yaml @@ -1,12 +1,5 @@ --- -style: button.menu -geometry.width: 35h -geometry.height: 20h -geometry.padding: 5 -layout.hAlign: center -layout.vAlign: middle -content.buttonMode: true -content.mouseChildren: false +style: button.pack views: - id: label $type: hw.view.form.LabelView diff --git a/src/common/resources/level/death_standard.zip b/src/common/resources/level/death_standard.zip index a80bd86..7a8d3a6 100644 Binary files a/src/common/resources/level/death_standard.zip and b/src/common/resources/level/death_standard.zip differ diff --git a/src/editor/haxe/ru/m/tankz/editor/Editor.hx b/src/editor/haxe/ru/m/tankz/editor/Editor.hx index ab8d6d1..03301ae 100644 --- a/src/editor/haxe/ru/m/tankz/editor/Editor.hx +++ b/src/editor/haxe/ru/m/tankz/editor/Editor.hx @@ -45,7 +45,7 @@ class Editor { L.i(TAG, 'Build: ${Const.BUILD}'); resources.text.put("version", '${Const.VERSION}'); - theme = new AppTheme(); + theme = new EditorTheme(); configBundle = new ConfigBundle(); levelBundle = new CachedLevelBundle(new ClientLevelSource()); diff --git a/src/editor/haxe/ru/m/tankz/editor/EditorTheme.hx b/src/editor/haxe/ru/m/tankz/editor/EditorTheme.hx new file mode 100644 index 0000000..c4b8770 --- /dev/null +++ b/src/editor/haxe/ru/m/tankz/editor/EditorTheme.hx @@ -0,0 +1,16 @@ +package ru.m.tankz.editor; + +import hw.view.utils.DrawUtil; +import hw.view.theme.Theme; +import hw.view.geometry.SizeValue; + +class EditorTheme extends AppTheme { + override private function reload():Void { + super.reload(); + register(new Style("brush", [ + "geometry.width" => SizeValue.fromString("6h"), + "geometry.height" => SizeValue.fromString("6h"), + "fillType" => FillType.CONTAIN, + ])); + } +} diff --git a/src/editor/haxe/ru/m/tankz/editor/view/PackFrame.yaml b/src/editor/haxe/ru/m/tankz/editor/view/PackFrame.yaml index 86f4dbe..e392452 100644 --- a/src/editor/haxe/ru/m/tankz/editor/view/PackFrame.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/view/PackFrame.yaml @@ -8,7 +8,7 @@ views: views: - id: levels $type: hw.view.list.VListView - geometry.width: 200 + geometry.width: 30h geometry.height: 100% factory: ~levelViewFactory +onItemSelect: ~onLevelSelect @@ -24,22 +24,25 @@ views: text: "Name:" - id: levelName $type: hw.view.form.InputView - geometry.width: 300 - geometry.height: 26 + layout.vAlign: middle + geometry.width: "60%" + geometry.height: 100% text: "" - $type: hw.view.form.LabelView text: "Size:" geometry.margin.left: 20 - id: width $type: hw.view.form.InputView - geometry.width: 50 - geometry.height: 26 + layout.vAlign: middle + geometry.width: "15%" + geometry.height: 100% - $type: hw.view.form.LabelView text: "x" - id: height $type: hw.view.form.InputView - geometry.width: 50 - geometry.height: 26 + layout.vAlign: middle + geometry.width: "15%" + geometry.height: 100% - $type: hw.view.form.ButtonView style: button.start.small +onPress: ~applySize() @@ -73,26 +76,26 @@ views: +onDataSelect: ~selectBrick - $type: hw.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 + - id: mapView + $type: ru.m.tankz.editor.view.map.MapEditView + geometry.stretch: true - $type: hw.view.group.HGroupView style: panel layout.margin: 10 views: - $type: hw.view.form.ButtonView + style: panel_button text: Add +onPress: ~addLevel() - $type: hw.view.form.ButtonView + style: panel_button text: Remove +onPress: ~removeLevel() - $type: hw.view.SpriteView geometry.width: 100% - $type: hw.view.form.ButtonView + style: panel_button text: Save +onPress: ~save() - $type: hw.view.form.ButtonView diff --git a/src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.yaml b/src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.yaml index 2a3f144..c518da0 100644 --- a/src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.yaml @@ -5,6 +5,7 @@ views: layout.margin: 10 views: - $type: hw.view.form.ButtonView + style: button.menu text: New +onPress: ~create() - id: packs @@ -15,6 +16,7 @@ views: factory: ~ru.m.tankz.editor.view.PackView.factory +onDataAction: ~onPackAction - $type: hw.view.form.ButtonView + style: button.menu text: Open +onPress: ~open() - $type: hw.view.group.HGroupView diff --git a/src/editor/haxe/ru/m/tankz/editor/view/PackView.yaml b/src/editor/haxe/ru/m/tankz/editor/view/PackView.yaml index 2174a84..cdb311d 100644 --- a/src/editor/haxe/ru/m/tankz/editor/view/PackView.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/view/PackView.yaml @@ -6,7 +6,8 @@ views: +onPress: ~export() - id: label $type: hw.view.form.ButtonView - geometry.width: 250 + geometry.width: 50w + geometry.height: 100% +onPress: ~edit() - $type: hw.view.form.ButtonView style: button.close 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 5ef05ff..e223466 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,11 +1,12 @@ package ru.m.tankz.editor.view.map; +import hw.view.utils.DrawUtil.FillType; import flash.display.BitmapData; import flash.display.Shape; import hw.color.Color; import hw.view.ImageView; -class BrushView extends ImageView { +class BrushView extends ImageView { public var data(default, set):D; public var selected(default, set):Bool; @@ -20,6 +21,9 @@ class BrushView extends ImageView { if (data != null) { this.data = data; } + style = "brush"; + // TODO: fillType in style + fillType = FillType.CONTAIN; } override public function update():Void { diff --git a/src/editor/haxe/ru/m/tankz/editor/view/map/MapEditView.hx b/src/editor/haxe/ru/m/tankz/editor/view/map/MapEditView.hx index 2c8258f..91000c8 100644 --- a/src/editor/haxe/ru/m/tankz/editor/view/map/MapEditView.hx +++ b/src/editor/haxe/ru/m/tankz/editor/view/map/MapEditView.hx @@ -81,7 +81,12 @@ enum Brush { } private function onMouseMove(event:MouseEvent):Void { - var b = map.getPointBrick(new Point(event.localX, event.localY)); + var p = new Point(event.localX, event.localY); + p.x -= container.x; + p.y -= container.y; + p.x *= (1 / container.scaleX); + p.y *= (1 / container.scaleY); + var b = map.getPointBrick(p); if (b != null) { switch (brush) { case Brush.POINT(point): diff --git a/src/editor/haxe/ru/m/tankz/editor/view/popup/PackPopup.yaml b/src/editor/haxe/ru/m/tankz/editor/view/popup/PackPopup.yaml index 0525f55..cb01070 100644 --- a/src/editor/haxe/ru/m/tankz/editor/view/popup/PackPopup.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/view/popup/PackPopup.yaml @@ -4,9 +4,7 @@ layout.vAlign: middle view: $type: hw.view.group.VGroupView layout.hAlign: center - geometry.width: 400 - #geometry.stretch: true - #geometry.margin: 10 + geometry.width: 60h style: window views: - $type: hw.view.group.HGroupView diff --git a/tankz.code-workspace b/tankz.code-workspace index 88fcd73..117b5ce 100644 --- a/tankz.code-workspace +++ b/tankz.code-workspace @@ -11,7 +11,12 @@ "HAXE_STD_PATH": "/home/shmyga/sdk/haxe/4.2.5/std" } }, - "haxe.configurations": [["build/client/flash/haxe/debug.hxml"]], + "haxe.configurations": [ + [ + //"build/client/flash/haxe/debug.hxml", + "build/editor/flash/haxe/debug.hxml" + ] + ], "haxe.displayServer": { "arguments": [ //"-v" @@ -38,7 +43,12 @@ { "id": "task", "description": "Please enter task name", - "options": ["client:flash:test", "server:cpp:test", "generate"], + "options": [ + "client:flash:test", + "editor:flash:test", + "server:cpp:test", + "generate" + ], "type": "pickString" } ]