From 4a4ca463c3ab7ec802d49239aa8a4077a8a36888 Mon Sep 17 00:00:00 2001 From: shmyga Date: Mon, 8 Apr 2019 21:45:52 +0300 Subject: [PATCH] [client] update LevelPopup --- package.json | 2 +- src/client/haxe/ru/m/tankz/Style.hx | 43 +++++-------------- .../haxe/ru/m/tankz/view/popup/LevelPopup.hx | 3 +- .../ru/m/tankz/view/popup/LevelPopup.yaml | 18 ++++++-- .../resources/image/icon/frown-open-solid.svg | 1 - .../resources/image/icon/sad-cry-solid.svg | 1 - .../resources/image/icon/smile-solid.svg | 1 - .../image/icon/window-close-solid.svg | 1 + .../haxe/ru/m/tankz/bot/StupidBotControl.hx | 11 ++--- src/common/resources/classic/config.yaml | 2 +- .../ru/m/tankz/editor/frame/TankFrame.yaml | 1 + .../ru/m/tankz/editor/level/MapEditView.hx | 2 +- 12 files changed, 37 insertions(+), 49 deletions(-) delete mode 100644 src/client/resources/image/icon/frown-open-solid.svg delete mode 100644 src/client/resources/image/icon/sad-cry-solid.svg delete mode 100644 src/client/resources/image/icon/smile-solid.svg create mode 100644 src/client/resources/image/icon/window-close-solid.svg diff --git a/package.json b/package.json index 0d4f359..9e91ca8 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tankz", - "version": "0.9.2", + "version": "0.10.0", "private": true, "devDependencies": { "dateformat": "^3.0.3", diff --git a/src/client/haxe/ru/m/tankz/Style.hx b/src/client/haxe/ru/m/tankz/Style.hx index bd0bb27..0e857f2 100644 --- a/src/client/haxe/ru/m/tankz/Style.hx +++ b/src/client/haxe/ru/m/tankz/Style.hx @@ -21,6 +21,7 @@ class Style { public static var lightColor = 0x95937D; public static var darkColor = 0x777564; public static var textColor = 0xE7E0BB; + public static var activeColor = 0xFFFF00; public static var baseFontSize = 18; public static var bigFontSize = 22; @@ -88,6 +89,11 @@ class Style { Skin.text(textColor, baseFontSize, fontFamily, fontEmbed), Skin.geometry(new Geometry().setPadding([25, 8])), ]); + resources.skin.put("button.simple.active", [ + Skin.buttonColor(lightColor, activeColor), + Skin.text(activeColor, baseFontSize, fontFamily, fontEmbed), + Skin.geometry(new Geometry().setPadding([25, 8])), + ]); resources.skin.put("button.tab", [ Skin.tabColor(lightColor), Skin.text(textColor, baseFontSize, fontFamily, fontEmbed), @@ -117,6 +123,10 @@ class Style { Skin.border(ColorUtil.multiply(lightColor, 1.5), 1, 2), Skin.geometry(new Geometry().setPadding(2)), ]); + resources.skin.put("window.close", [ + Skin.size(36, 36), + new ButtonSVGSkin(Assets.getText("resources/image/icon/window-close-solid.svg"), lightColor), + ]); resources.skin.put("button.settings", [ Skin.size(64, 64), @@ -134,38 +144,5 @@ class Style { Skin.size(64, 64), new ButtonSVGSkin(Assets.getText("resources/image/icon/play-circle-solid.svg"), lightColor), ]); - - resources.skin.put("preset.easy", [ - Skin.size(64, 64), - new ButtonSVGSkin(Assets.getText("resources/image/icon/smile-solid.svg"), lightColor), - ]); - resources.skin.put("preset.normal", [ - Skin.size(64, 64), - new ButtonSVGSkin(Assets.getText("resources/image/icon/frown-open-solid.svg"), lightColor), - ]); - resources.skin.put("preset.hard", [ - Skin.size(64, 64), - new ButtonSVGSkin(Assets.getText("resources/image/icon/sad-cry-solid.svg"), lightColor), - ]); - resources.skin.put("preset.default", [ - Skin.size(64, 64), - new ButtonSVGSkin(Assets.getText("resources/image/icon/play-circle-solid.svg"), lightColor), - ]); - resources.skin.put("preset.easy.complete", [ - Skin.size(64, 64), - new ButtonSVGSkin(Assets.getText("resources/image/icon/smile-solid.svg"), 0x337733), - ]); - resources.skin.put("preset.normal.complete", [ - Skin.size(64, 64), - new ButtonSVGSkin(Assets.getText("resources/image/icon/frown-open-solid.svg"), 0x337733), - ]); - resources.skin.put("preset.hard.complete", [ - Skin.size(64, 64), - new ButtonSVGSkin(Assets.getText("resources/image/icon/sad-cry-solid.svg"), 0x337733), - ]); - resources.skin.put("preset.default.complete", [ - Skin.size(64, 64), - new ButtonSVGSkin(Assets.getText("resources/image/icon/play-circle-solid.svg"), 0x337733), - ]); } } diff --git a/src/client/haxe/ru/m/tankz/view/popup/LevelPopup.hx b/src/client/haxe/ru/m/tankz/view/popup/LevelPopup.hx index ae1a998..87199a1 100644 --- a/src/client/haxe/ru/m/tankz/view/popup/LevelPopup.hx +++ b/src/client/haxe/ru/m/tankz/view/popup/LevelPopup.hx @@ -24,7 +24,8 @@ import ru.m.tankz.game.GameProgress; private function presetViewFactory(index:Int, value:GamePreset):ButtonView { var result = new ButtonView(); - result.skinId = 'preset.${value.name}${progress.isPresetCompleted(level.id, value.id) ? '.complete' : ''}'; + result.skinId = 'button.simple${!progress.isPresetCompleted(level.id, value.id) ? ".active" : ""}'; + result.text = value.name; result.disabled = !progress.isPresetAvailable(level.id, value.id); return result; } diff --git a/src/client/haxe/ru/m/tankz/view/popup/LevelPopup.yaml b/src/client/haxe/ru/m/tankz/view/popup/LevelPopup.yaml index f868fc0..0ba2854 100644 --- a/src/client/haxe/ru/m/tankz/view/popup/LevelPopup.yaml +++ b/src/client/haxe/ru/m/tankz/view/popup/LevelPopup.yaml @@ -8,10 +8,20 @@ view: geometry.size.height: 400 skinId: window views: - - id: name - $type: haxework.view.LabelView - skinId: text - geometry.padding: [20, 15] + - $type: haxework.view.HGroupView + geometry.size.width: 100% + geometry.padding: 10 + layout.vAlign: middle + views: + - id: name + $type: haxework.view.LabelView + geometry.size.width: 100% + geometry.margin.left: 10 + layout.hAlign: left + skinId: text + - $type: haxework.view.ButtonView + skinId: window.close + +onPress: $code:reject('close') - $type: haxework.view.SpriteView geometry.size.height: 100% - id: presets diff --git a/src/client/resources/image/icon/frown-open-solid.svg b/src/client/resources/image/icon/frown-open-solid.svg deleted file mode 100644 index 8e6fa18..0000000 --- a/src/client/resources/image/icon/frown-open-solid.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/client/resources/image/icon/sad-cry-solid.svg b/src/client/resources/image/icon/sad-cry-solid.svg deleted file mode 100644 index 135d603..0000000 --- a/src/client/resources/image/icon/sad-cry-solid.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/client/resources/image/icon/smile-solid.svg b/src/client/resources/image/icon/smile-solid.svg deleted file mode 100644 index 91e480f..0000000 --- a/src/client/resources/image/icon/smile-solid.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/client/resources/image/icon/window-close-solid.svg b/src/client/resources/image/icon/window-close-solid.svg new file mode 100644 index 0000000..eaa6802 --- /dev/null +++ b/src/client/resources/image/icon/window-close-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/common/haxe/ru/m/tankz/bot/StupidBotControl.hx b/src/common/haxe/ru/m/tankz/bot/StupidBotControl.hx index 1fc0744..c675d6e 100644 --- a/src/common/haxe/ru/m/tankz/bot/StupidBotControl.hx +++ b/src/common/haxe/ru/m/tankz/bot/StupidBotControl.hx @@ -27,6 +27,7 @@ class StupidBotControl extends BotControl { turnRandomTimer = new Timer(2000); turnRandomTimer.run = calcTurn; } + shot(1000 + Math.round(Math.random() * 4000)); } override public function stop():Void { @@ -37,12 +38,12 @@ class StupidBotControl extends BotControl { } } + override private function _shot():Void { + super._shot(); + shot(1000 + Math.round(Math.random() * 4000)); + } + private function calcTurn():Void { - if (turnTimer != null) { - turnTimer.stop(); - turnTimer = null; - } - // ToDo: if (handler == null || tank == null) return; var eagle:Eagle = BotHelper.findEagle(playerId.team, handler); if (eagle != null && Math.random() > 0.5) { diff --git a/src/common/resources/classic/config.yaml b/src/common/resources/classic/config.yaml index 4b8cce6..4122850 100644 --- a/src/common/resources/classic/config.yaml +++ b/src/common/resources/classic/config.yaml @@ -37,7 +37,7 @@ player: points: - {team: human, type: eagle, index: -1, direction: right, x: 12, y: 24} - {team: human, type: tank, index: 0, direction: top, x: 8, y: 24} - - {team: human, type: tank, index: 1, direction: top, x: 16, y: 24} + #- {team: human, type: tank, index: 1, direction: top, x: 16, y: 24} - {team: bot, type: tank, index: -1, direction: bottom, x: 0, y: 0} - {team: bot, type: tank, index: -2, direction: bottom, x: 12, y: 0} - {team: bot, type: tank, index: -3, direction: bottom, x: 24, y: 0} diff --git a/src/editor/haxe/ru/m/tankz/editor/frame/TankFrame.yaml b/src/editor/haxe/ru/m/tankz/editor/frame/TankFrame.yaml index 6034a56..42b1723 100644 --- a/src/editor/haxe/ru/m/tankz/editor/frame/TankFrame.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/frame/TankFrame.yaml @@ -6,6 +6,7 @@ layout.margin: 10 views: - id: tanks $type: haxework.view.GroupView + geometry.size.width: 100% layout: $type: haxework.view.layout.TailLayout rowSize: 4 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 5f417df..b4b9ae9 100644 --- a/src/editor/haxe/ru/m/tankz/editor/level/MapEditView.hx +++ b/src/editor/haxe/ru/m/tankz/editor/level/MapEditView.hx @@ -56,7 +56,7 @@ class SpawnPointItem extends BitmapItem { return switch(value.type) { case 'eagle': 'resources/image/eagle/eagle.png'; case 'tank': 'resources/image/tank/${tankConfig.skin}-0.png'; - case x: 'resources/image/eagle/eagle-death.png'; + case _: 'resources/image/eagle/eagle-death.png'; } }