From 032fa0c0adad3d7de9c3f6ea637082aa286ec590 Mon Sep 17 00:00:00 2001 From: shmyga Date: Wed, 14 Feb 2018 17:15:15 +0300 Subject: [PATCH] [client] yaml layouts --- src/client/haxe/layout/frames/game.json | 13 ---- src/client/haxe/layout/frames/level.json | 21 ------ src/client/haxe/layout/frames/start.json | 52 -------------- src/client/haxe/layout/main.json | 38 ----------- src/client/haxe/layout/other.json | 18 ----- src/client/haxe/layout/styles.json | 33 --------- src/client/haxe/ru/m/tankz/Client.hx | 67 ++++++++++--------- src/client/haxe/ru/m/tankz/Client.yaml | 27 ++++++++ src/client/haxe/ru/m/tankz/Style.yaml | 21 ++++++ .../tankz/{view/frames => frame}/GameFrame.hx | 8 +-- .../haxe/ru/m/tankz/frame/GameFrame.yaml | 12 ++++ .../{view/frames => frame}/LevelFrame.hx | 4 +- .../haxe/ru/m/tankz/frame/LevelFrame.yaml | 20 ++++++ .../{view/frames => frame}/StartFrame.hx | 4 +- .../haxe/ru/m/tankz/frame/StartFrame.yaml | 40 +++++++++++ .../frames/list => frame/level}/LevelView.hx | 4 +- .../ru/m/tankz/frame/level/LevelView.yaml | 15 +++++ src/editor/haxe/ru/m/tankz/editor/Editor.hx | 20 +++--- src/editor/haxe/ru/m/tankz/editor/Editor.yaml | 53 ++++++++------- src/editor/haxe/ru/m/tankz/editor/Style.json | 18 ----- src/editor/haxe/ru/m/tankz/editor/Style.yaml | 2 + .../ru/m/tankz/editor/frame/LevelFrame.hx | 2 +- .../ru/m/tankz/editor/frame/LevelFrame.yaml | 14 ++-- .../haxe/ru/m/tankz/editor/frame/TankFrame.hx | 2 +- .../ru/m/tankz/editor/frame/TankFrame.yaml | 21 +++--- 25 files changed, 241 insertions(+), 288 deletions(-) delete mode 100644 src/client/haxe/layout/frames/game.json delete mode 100644 src/client/haxe/layout/frames/level.json delete mode 100644 src/client/haxe/layout/frames/start.json delete mode 100755 src/client/haxe/layout/main.json delete mode 100644 src/client/haxe/layout/other.json delete mode 100644 src/client/haxe/layout/styles.json create mode 100755 src/client/haxe/ru/m/tankz/Client.yaml create mode 100644 src/client/haxe/ru/m/tankz/Style.yaml rename src/client/haxe/ru/m/tankz/{view/frames => frame}/GameFrame.hx (93%) create mode 100644 src/client/haxe/ru/m/tankz/frame/GameFrame.yaml rename src/client/haxe/ru/m/tankz/{view/frames => frame}/LevelFrame.hx (90%) create mode 100644 src/client/haxe/ru/m/tankz/frame/LevelFrame.yaml rename src/client/haxe/ru/m/tankz/{view/frames => frame}/StartFrame.hx (94%) create mode 100644 src/client/haxe/ru/m/tankz/frame/StartFrame.yaml rename src/client/haxe/ru/m/tankz/{view/frames/list => frame/level}/LevelView.hx (83%) create mode 100644 src/client/haxe/ru/m/tankz/frame/level/LevelView.yaml delete mode 100644 src/editor/haxe/ru/m/tankz/editor/Style.json diff --git a/src/client/haxe/layout/frames/game.json b/src/client/haxe/layout/frames/game.json deleted file mode 100644 index 338c97c..0000000 --- a/src/client/haxe/layout/frames/game.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "pWidth": 100, "pHeight": 100, - "views": [ - { - "id": "state", "@type": "haxework.gui.LabelView", "@style": "label", - "pWidth": 100, "height": 20 - }, - { - "id": "render", "@type": "ru.m.tankz.render.Render", - "contentSize": true - } - ] -} \ No newline at end of file diff --git a/src/client/haxe/layout/frames/level.json b/src/client/haxe/layout/frames/level.json deleted file mode 100644 index 4da14f3..0000000 --- a/src/client/haxe/layout/frames/level.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "pWidth": 100, "pHeight": 100, - "views": [ - { - "id":"levels", "@type":"haxework.gui.list.VListView", - "factory": "@class:ru.m.tankz.view.frames.list.LevelView", - "pWidth":100, - "pHeight":100, - "paddings":10, - "scroll":{ - "@type":"haxework.gui.list.VScrollView", - "width":10, "pHeight":100, - "skin":{"@type":"haxework.gui.list.VScrollSkin"} - }, - "skin": { - "@type": "haxework.gui.skin.ColorSkin", - "color": "0x000000", "alpha": 0.0 - } - } - ] -} \ No newline at end of file diff --git a/src/client/haxe/layout/frames/start.json b/src/client/haxe/layout/frames/start.json deleted file mode 100644 index 7bbc59c..0000000 --- a/src/client/haxe/layout/frames/start.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "pWidth": 100, "pHeight": 100, - "views": [ - { - "@type": "haxework.gui.ImageView", - "image": "@asset:image:resources/images/logo/logo.png", - "contentSize": true, "bottomMargin": 15 - }, - { - "@type": "haxework.gui.LabelView", "@style": "label", - "fontSize": 20, "topMargin": 15, - "contentSize": true, - "text": "Classic" - }, - { - "id": "classic_1p", - "@type": "haxework.gui.ButtonView", - "text": "1 Player", - "@style": "button" - }, - { - "id": "classic_2p", - "@type": "haxework.gui.ButtonView", - "text": "2 Player", - "@style": "button" - }, - { - "@type": "haxework.gui.LabelView", "@style": "label", - "fontSize": 20, "topMargin": 15, - "contentSize": true, - "text": "DotA" - }, - { - "id": "dota_1p", - "@type": "haxework.gui.ButtonView", - "text": "1 Player", - "@style": "button" - }, - { - "id": "dota_2p_coop", - "@type": "haxework.gui.ButtonView", - "text": "2 COOP", - "@style": "button" - }, - { - "id": "dota_2p_vs", - "@type": "haxework.gui.ButtonView", - "text": "2 VS", - "@style": "button" - } - ] -} \ No newline at end of file diff --git a/src/client/haxe/layout/main.json b/src/client/haxe/layout/main.json deleted file mode 100755 index b475189..0000000 --- a/src/client/haxe/layout/main.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "@type": "haxework.gui.VGroupView", - "pWidth": 100, "pHeight": 100, - "views": [ - { - "id": "switcher", "@type": "haxework.gui.frame.FrameSwitcher", - "pWidth": 100, "pHeight": 100, - "skin": { - "@type": "haxework.gui.skin.BitmapSkin", - "image": "@asset:image:resources/images/background.png", - "fillType": "REPEAT" - }, - "views": [ - { - "id": "start", - "@type": "ru.m.tankz.view.frames.StartFrame" - }, - { - "id": "level", - "@type": "ru.m.tankz.view.frames.LevelFrame" - }, - { - "id": "game", - "@type": "ru.m.tankz.view.frames.GameFrame" - } - ] - }, - { - "@type": "haxework.gui.LabelView", - "inLayout": false, - "contentSize": true, - "vAlign": "BOTTOM", - "hAlign": "RIGHT", - "text": "@res:text:version", - "@style": "label" - } - ] -} \ No newline at end of file diff --git a/src/client/haxe/layout/other.json b/src/client/haxe/layout/other.json deleted file mode 100644 index d798e31..0000000 --- a/src/client/haxe/layout/other.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "level": { - "width": 440, "height": 44, - "margins": 5, - "views": [ - { - "id": "label", - "@type": "haxework.gui.LabelView", - "pWidth": 100, "pHeight": 100, "text": "", - "@style": "label" - } - ], - "skin": { - "@type": "haxework.gui.skin.ColorSkin", - "color": "0x000000", "alpha": 0.2 - } - } -} \ No newline at end of file diff --git a/src/client/haxe/layout/styles.json b/src/client/haxe/layout/styles.json deleted file mode 100644 index 2df4c7c..0000000 --- a/src/client/haxe/layout/styles.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "button": { - "width":250, "height":60, - "skin": { - "@type": "haxework.gui.skin.ButtonBitmapSkin", - "upImage": "@asset:image:resources/images/control/button_normal.png", - "downImage": "@asset:image:resources/images/control/button_down.png", - "overImage": "@asset:image:resources/images/control/button_over.png", - "fillType": "NINEPATH" - }, - "fontFamily":"@res:text:font", "fontEmbed":true, "fontColor":"0xE7E0BB", "fontSize":20 - }, - - "label": { - "fontColor": "0xffffff", - "fontEmbed": false, - "fontFamily": "@res:text:fontName", - "fontSize": 16, - "shadowColor": "0x000000" - }, - - "input": { - "fontColor": "0xffffff", - "fontEmbed": false, - "fontFamily": "@res:text:fontName", - "fontSize": 16, - "shadowColor": "0x000000", - "skin": { - "@type": "haxework.gui.skin.ColorSkin", - "color": "0x000000" - } - } -} \ No newline at end of file diff --git a/src/client/haxe/ru/m/tankz/Client.hx b/src/client/haxe/ru/m/tankz/Client.hx index a90df2d..e30339a 100755 --- a/src/client/haxe/ru/m/tankz/Client.hx +++ b/src/client/haxe/ru/m/tankz/Client.hx @@ -1,34 +1,37 @@ package ru.m.tankz; +import flash.events.KeyboardEvent; +import flash.text.Font; +import flash.ui.Keyboard; +import haxework.gui.ButtonView; +import haxework.gui.frame.IFrameSwitcher; +import haxework.gui.Root; +import haxework.gui.VGroupView; +import haxework.gui.ViewBuilder; +import haxework.log.TraceLogger; +import haxework.provider.Provider; +import haxework.resources.IResources; +import haxework.resources.Resources; +import ru.m.connect.IConnection; +import ru.m.tankz.frame.StartFrame; import ru.m.tankz.game.ClassicGame; import ru.m.tankz.game.DotaGame; import ru.m.tankz.game.Game; -import flash.ui.Keyboard; -import flash.events.KeyboardEvent; -import flash.text.Font; -import ru.m.tankz.view.frames.StartFrame; -import haxework.log.SocketLogger; -import haxework.resources.Resources; -import haxework.resources.IResources; -import haxework.gui.VGroupView; -import haxework.gui.ViewBuilder; -import haxework.gui.ButtonView; import ru.m.tankz.PacketBuilder; -import haxework.log.JSLogger; -import haxework.gui.frame.IFrameSwitcher; -import haxework.provider.Provider; -import haxework.gui.frame.FrameSwitcher; -import haxework.gui.Root; -import openfl.Assets; -import ru.m.connect.IConnection; -import haxework.log.TraceLogger; +#if flash import haxework.log.JSLogger; #end +#if debug import haxework.log.SocketLogger; #end -@:template("layout/main.json", "layout/styles.json") -class MainView extends VGroupView implements ViewBuilder {} + +interface ClientViewLayout { + var switcher(default, null):IFrameSwitcher; +} + +@:template('ru/m/tankz/Client.yaml', 'ru/m/tankz/Style.yaml') +class ClientView extends VGroupView implements ClientViewLayout implements ViewBuilder {} class Client implements IConnectionHandler { - private static inline var TAG = "Tankz"; + private static inline var TAG = 'Tankz'; public static function main() { L.push(new TraceLogger()); @@ -39,31 +42,31 @@ class Client implements IConnectionHandler { L.push(new SocketLogger()); #end Const.init(); - L.d(TAG, "Debug: " + Const.DEBUG); - L.i(TAG, "Version: " + Const.VERSION); - L.i(TAG, "Build: " + Const.BUILD); + L.d(TAG, 'Debug: ${Const.DEBUG}'); + L.i(TAG, 'Version: ${Const.VERSION}'); + L.i(TAG, 'Build: ${Const.BUILD}'); new Client(); } - private var view:MainView; + private var view:ClientView; public function new() { Provider.setFactory(IResources, Resources); var font:Font = Font.enumerateFonts()[0]; - Provider.get(IResources).text.put("font", "Bookman Old Style"); - Provider.get(IResources).text.put("version", 'v${Const.VERSION} b${Const.BUILD}'); + Provider.get(IResources).text.put('font', 'Bookman Old Style'); + Provider.get(IResources).text.put('version', 'v${Const.VERSION} b${Const.BUILD}'); Provider.set(IPacketBuilder, new PacketBuilder()); #if flash - Provider.set(IConnection, new ru.m.connect.flash.FlashConnection("localhost", 5001)); + Provider.set(IConnection, new ru.m.connect.flash.FlashConnection('localhost', 5001)); #elseif html5 - Provider.set(IConnection, new ru.m.connect.js.JsConnection("localhost", 5001)); + Provider.set(IConnection, new ru.m.connect.js.JsConnection('localhost', 5001)); #end //Provider.get(IConnection).handler.addListener(this); - view = new MainView(); + view = new ClientView(); Provider.set(IFrameSwitcher, view.switcher); Root.bind(view); view.content.stage.stageFocusRect = false; @@ -82,7 +85,7 @@ class Client implements IConnectionHandler { public function onPress(view:ButtonView):Void { switch (view.id) { - case "logout": + case 'logout': Provider.get(IConnection).disconnect(); } } @@ -94,7 +97,7 @@ class Client implements IConnectionHandler { } public function onError(error:Dynamic):Void { - L.e(TAG, "", error); + L.e(TAG, '', error); //view.switcher.change(AuthFrame.ID); } } diff --git a/src/client/haxe/ru/m/tankz/Client.yaml b/src/client/haxe/ru/m/tankz/Client.yaml new file mode 100755 index 0000000..d868671 --- /dev/null +++ b/src/client/haxe/ru/m/tankz/Client.yaml @@ -0,0 +1,27 @@ +--- +$type: haxework.gui.VGroupView +pWidth: 100 +pHeight: 100 +views: +- id: switcher + $type: haxework.gui.frame.FrameSwitcher + pWidth: 100 + pHeight: 100 + skin: + $type: haxework.gui.skin.BitmapSkin + image: "@asset:image:resources/images/background.png" + fillType: REPEAT + views: + - id: start + $type: ru.m.tankz.frame.StartFrame + - id: level + $type: ru.m.tankz.frame.LevelFrame + - id: game + $type: ru.m.tankz.frame.GameFrame +- $type: haxework.gui.LabelView + $style: label + inLayout: false + contentSize: true + vAlign: BOTTOM + hAlign: RIGHT + text: "@res:text:version" diff --git a/src/client/haxe/ru/m/tankz/Style.yaml b/src/client/haxe/ru/m/tankz/Style.yaml new file mode 100644 index 0000000..72ed6fe --- /dev/null +++ b/src/client/haxe/ru/m/tankz/Style.yaml @@ -0,0 +1,21 @@ +--- +button: + width: 250 + height: 60 + skin: + $type: haxework.gui.skin.ButtonBitmapSkin + upImage: "@asset:image:resources/images/control/button_normal.png" + downImage: "@asset:image:resources/images/control/button_down.png" + overImage: "@asset:image:resources/images/control/button_over.png" + fillType: NINEPATH + fontFamily: "@res:text:font" + fontEmbed: true + fontColor: "#E7E0BB" + fontSize: 20 + +label: + fontColor: "#ffffff" + fontEmbed: false + fontFamily: Courirer New + fontSize: 16 + shadowColor: 0x000000 diff --git a/src/client/haxe/ru/m/tankz/view/frames/GameFrame.hx b/src/client/haxe/ru/m/tankz/frame/GameFrame.hx similarity index 93% rename from src/client/haxe/ru/m/tankz/view/frames/GameFrame.hx rename to src/client/haxe/ru/m/tankz/frame/GameFrame.hx index 8a3162f..b36dd56 100755 --- a/src/client/haxe/ru/m/tankz/view/frames/GameFrame.hx +++ b/src/client/haxe/ru/m/tankz/frame/GameFrame.hx @@ -1,8 +1,7 @@ -package ru.m.tankz.view.frames; +package ru.m.tankz.frame; -import haxe.ds.Option; -import haxe.ds.Option; import flash.events.Event; +import haxe.ds.Option; import haxe.Timer; import haxework.gui.frame.IFrameSwitcher; import haxework.gui.LabelView; @@ -22,8 +21,7 @@ interface GameFrameLayout { var render(default, null):Render; } - -@:template("layout/frames/game.json", "layout/styles.json") +@:template("ru/m/tankz/frame/GameFrame.yaml", "ru/m/tankz/Style.yaml") class GameFrame extends VGroupView implements ViewBuilder implements IPacketHandler implements GameFrameLayout { private static inline var TAG = "GameFrame"; diff --git a/src/client/haxe/ru/m/tankz/frame/GameFrame.yaml b/src/client/haxe/ru/m/tankz/frame/GameFrame.yaml new file mode 100644 index 0000000..34c3854 --- /dev/null +++ b/src/client/haxe/ru/m/tankz/frame/GameFrame.yaml @@ -0,0 +1,12 @@ +--- +pWidth: 100 +pHeight: 100 +views: +- id: state + $type: haxework.gui.LabelView + $style: label + pWidth: 100 + height: 20 +- id: render + $type: ru.m.tankz.render.Render + contentSize: true diff --git a/src/client/haxe/ru/m/tankz/view/frames/LevelFrame.hx b/src/client/haxe/ru/m/tankz/frame/LevelFrame.hx similarity index 90% rename from src/client/haxe/ru/m/tankz/view/frames/LevelFrame.hx rename to src/client/haxe/ru/m/tankz/frame/LevelFrame.hx index 4b3dc0d..44eb18b 100644 --- a/src/client/haxe/ru/m/tankz/view/frames/LevelFrame.hx +++ b/src/client/haxe/ru/m/tankz/frame/LevelFrame.hx @@ -1,4 +1,4 @@ -package ru.m.tankz.view.frames; +package ru.m.tankz.frame; import ru.m.tankz.config.ConfigBundle; import haxework.gui.frame.IFrameSwitcher; @@ -14,7 +14,7 @@ interface LevelFrameLayout { } -@:template("layout/frames/level.json", "layout/styles.json") +@:template("ru/m/tankz/frame/LevelFrame.yaml", "ru/m/tankz/Style.yaml") class LevelFrame extends VGroupView implements ViewBuilder implements LevelFrameLayout { public static inline var ID = "level"; diff --git a/src/client/haxe/ru/m/tankz/frame/LevelFrame.yaml b/src/client/haxe/ru/m/tankz/frame/LevelFrame.yaml new file mode 100644 index 0000000..8909aea --- /dev/null +++ b/src/client/haxe/ru/m/tankz/frame/LevelFrame.yaml @@ -0,0 +1,20 @@ +--- +pWidth: 100 +pHeight: 100 +views: +- id: levels + $type: haxework.gui.list.VListView + factory: "@class:ru.m.tankz.frame.level.LevelView" + pWidth: 100 + pHeight: 100 + paddings: 10 + scroll: + $type: haxework.gui.list.VScrollView + width: 10 + pHeight: 100 + skin: + $type: haxework.gui.list.VScrollSkin + skin: + $type: haxework.gui.skin.ColorSkin + color: "#000000" + alpha: 0 diff --git a/src/client/haxe/ru/m/tankz/view/frames/StartFrame.hx b/src/client/haxe/ru/m/tankz/frame/StartFrame.hx similarity index 94% rename from src/client/haxe/ru/m/tankz/view/frames/StartFrame.hx rename to src/client/haxe/ru/m/tankz/frame/StartFrame.hx index 8d47409..ff3dccf 100644 --- a/src/client/haxe/ru/m/tankz/view/frames/StartFrame.hx +++ b/src/client/haxe/ru/m/tankz/frame/StartFrame.hx @@ -1,4 +1,4 @@ -package ru.m.tankz.view.frames; +package ru.m.tankz.frame; import haxework.gui.ButtonView; import haxework.gui.frame.IFrameSwitcher; @@ -19,7 +19,7 @@ interface StartFrameLayout { var dota_2p_vs(default, null):ButtonView; } -@:template("layout/frames/start.json", "layout/styles.json") +@:template("ru/m/tankz/frame/StartFrame.yaml", "ru/m/tankz/Style.yaml") class StartFrame extends VGroupView implements ViewBuilder implements StartFrameLayout { public static inline var ID = "start"; diff --git a/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml b/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml new file mode 100644 index 0000000..97881ee --- /dev/null +++ b/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml @@ -0,0 +1,40 @@ +--- +pWidth: 100 +pHeight: 100 +views: +- $type: haxework.gui.ImageView + image: "@asset:image:resources/images/logo/logo.png" + contentSize: true + bottomMargin: 15 +- $type: haxework.gui.LabelView + $style: label + fontSize: 20 + topMargin: 15 + contentSize: true + text: Classic +- id: classic_1p + $type: haxework.gui.ButtonView + text: 1 Player + $style: button +- id: classic_2p + $type: haxework.gui.ButtonView + text: 2 Player + $style: button +- $type: haxework.gui.LabelView + $style: label + fontSize: 20 + topMargin: 15 + contentSize: true + text: DotA +- id: dota_1p + $type: haxework.gui.ButtonView + text: 1 Player + $style: button +- id: dota_2p_coop + $type: haxework.gui.ButtonView + text: 2 COOP + $style: button +- id: dota_2p_vs + $type: haxework.gui.ButtonView + text: 2 VS + $style: button diff --git a/src/client/haxe/ru/m/tankz/view/frames/list/LevelView.hx b/src/client/haxe/ru/m/tankz/frame/level/LevelView.hx similarity index 83% rename from src/client/haxe/ru/m/tankz/view/frames/list/LevelView.hx rename to src/client/haxe/ru/m/tankz/frame/level/LevelView.hx index 072fed4..0924718 100755 --- a/src/client/haxe/ru/m/tankz/view/frames/list/LevelView.hx +++ b/src/client/haxe/ru/m/tankz/frame/level/LevelView.hx @@ -1,4 +1,4 @@ -package ru.m.tankz.view.frames.list; +package ru.m.tankz.frame.level; import haxework.gui.ViewBuilder; import haxework.gui.HGroupView; @@ -10,7 +10,7 @@ interface LevelViewLayout { var label(default, null):LabelView; } -@:template("layout/other.json@level", "layout/styles.json") +@:template("ru/m/tankz/frame/level/LevelView.yaml", "ru/m/tankz/Style.yaml") class LevelView extends HGroupView implements ViewBuilder implements IListItemView implements LevelViewLayout { public var item_index(default, default):Int; diff --git a/src/client/haxe/ru/m/tankz/frame/level/LevelView.yaml b/src/client/haxe/ru/m/tankz/frame/level/LevelView.yaml new file mode 100644 index 0000000..1cf0139 --- /dev/null +++ b/src/client/haxe/ru/m/tankz/frame/level/LevelView.yaml @@ -0,0 +1,15 @@ +--- +width: 440 +height: 44 +margins: 5 +views: +- id: label + $type: haxework.gui.LabelView + $style: label + pWidth: 100 + pHeight: 100 + text: "" +skin: + $type: haxework.gui.skin.ColorSkin + color: "#000000" + alpha: 0.2 diff --git a/src/editor/haxe/ru/m/tankz/editor/Editor.hx b/src/editor/haxe/ru/m/tankz/editor/Editor.hx index 5fc592a..7e209e4 100644 --- a/src/editor/haxe/ru/m/tankz/editor/Editor.hx +++ b/src/editor/haxe/ru/m/tankz/editor/Editor.hx @@ -3,14 +3,14 @@ package ru.m.tankz.editor; import flash.text.Font; import haxework.gui.ButtonView; import haxework.gui.frame.FrameSwitcher; -import haxework.gui.GroupView; +import haxework.gui.VGroupView; import haxework.gui.Root; import haxework.gui.ViewBuilder; import haxework.log.TraceLogger; import haxework.provider.Provider; import haxework.resources.IResources; import haxework.resources.Resources; -import ru.m.tankz.view.frames.LevelFrame; +import ru.m.tankz.frame.LevelFrame; #if flash import haxework.log.JSLogger; #end #if debug import haxework.log.SocketLogger; #end @@ -19,12 +19,12 @@ interface EditorViewLayout { var switcher(default, null):FrameSwitcher; } -@:template("ru/m/tankz/editor/Editor.yaml", "ru/m/tankz/editor/Style.json") -class EditorView extends GroupView implements ViewBuilder implements EditorViewLayout {} +@:template('ru/m/tankz/editor/Editor.yaml', 'ru/m/tankz/editor/Style.yaml') +class EditorView extends VGroupView implements ViewBuilder implements EditorViewLayout {} class Editor { - private static inline var TAG = "Tankz.Editor"; + private static inline var TAG = 'Editor'; public static function main() { L.push(new TraceLogger()); @@ -35,9 +35,9 @@ class Editor { L.push(new SocketLogger()); #end Const.init(); - L.d(TAG, "Debug: " + Const.DEBUG); - L.i(TAG, "Version: " + Const.VERSION); - L.i(TAG, "Build: " + Const.BUILD); + L.d(TAG, 'Debug: ${Const.DEBUG}'); + L.i(TAG, 'Version: ${Const.VERSION}'); + L.i(TAG, 'Build: ${Const.BUILD}'); new Editor(); } @@ -47,8 +47,8 @@ class Editor { Provider.setFactory(IResources, Resources); var font:Font = Font.enumerateFonts()[0]; - Provider.get(IResources).text.put("font", "Bookman Old Style"); - Provider.get(IResources).text.put("version", 'v${Const.VERSION} b${Const.BUILD}'); + Provider.get(IResources).text.put('font', 'Bookman Old Style'); + Provider.get(IResources).text.put('version', 'v${Const.VERSION} b${Const.BUILD}'); view = new EditorView({handler: this}); Root.bind(view); diff --git a/src/editor/haxe/ru/m/tankz/editor/Editor.yaml b/src/editor/haxe/ru/m/tankz/editor/Editor.yaml index 6c04d31..36042df 100644 --- a/src/editor/haxe/ru/m/tankz/editor/Editor.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/Editor.yaml @@ -1,43 +1,48 @@ -$type: haxework.gui.GroupView +--- +$type: haxework.gui.VGroupView pWidth: 100 pHeight: 100 +skin: + $type: haxework.gui.skin.BitmapSkin + image: "@asset:image:resources/images/background.png" + fillType: REPEAT views: + # Tabs + - $type: haxework.gui.HGroupView + contentSize: true + views: + - id: btn_level + $type: haxework.gui.ButtonView + $style: button + text: Level + onPress: "@link:handler" + - id: btn_tank + $type: haxework.gui.ButtonView + $style: button + text: Tank + onPress: "@link:handler" + - $type: haxework.gui.SpriteView + height: 3 + pWidth: 100 + skin: + $type: haxework.gui.skin.ColorSkin + color: "#aaaaaa" # Switcher - id: switcher $type: haxework.gui.frame.FrameSwitcher pWidth: 100 pHeight: 100 - skin: - $type: haxework.gui.skin.BitmapSkin - image: '@asset:image:resources/images/background.png' - fillType: REPEAT + paddings: 5 views: - id: level $type: ru.m.tankz.editor.frame.LevelFrame - id: tank $type: ru.m.tankz.editor.frame.TankFrame - # Tabs - - $type: haxework.gui.HGroupView - vAlign: TOP - hAlign: CENTER - contentSize: true - inLayout: false - views: - - id: btn_level - $type: haxework.gui.ButtonView - text: Level - '@style': button - onPress: '@link:handler' - - id: btn_tank - $type: haxework.gui.ButtonView - text: Tank - '@style': button - onPress: '@link:handler' # Version - $type: haxework.gui.LabelView + $style: label inLayout: false contentSize: true vAlign: BOTTOM hAlign: RIGHT - '@style': label - text: '@res:text:version' + text: "@res:text:version" diff --git a/src/editor/haxe/ru/m/tankz/editor/Style.json b/src/editor/haxe/ru/m/tankz/editor/Style.json deleted file mode 100644 index a31e5aa..0000000 --- a/src/editor/haxe/ru/m/tankz/editor/Style.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "button": { - "width": 150, - "height": 20, - "margins": 2, - "skin": { - "@type": "haxework.gui.skin.ButtonColorSkin", - "color": "0xaaff00" - } - }, - "label": { - "fontColor": "0xffffff", - "fontEmbed": false, - "fontFamily": "@res:text:fontName", - "fontSize": 16, - "shadowColor": "0x000000" - } -} diff --git a/src/editor/haxe/ru/m/tankz/editor/Style.yaml b/src/editor/haxe/ru/m/tankz/editor/Style.yaml index e7c338a..35e8aa3 100644 --- a/src/editor/haxe/ru/m/tankz/editor/Style.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/Style.yaml @@ -1,6 +1,8 @@ +--- button: height: 20 width: 150 + margins: 2 skin: $type: haxework.gui.skin.ButtonColorSkin color: 0xaaff00 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 5beab49..888c144 100644 --- a/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.hx +++ b/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.hx @@ -30,7 +30,7 @@ interface LevelFrameLayout { var brickList(default, null):VListView; } -@:template('ru/m/tankz/editor/frame/LevelFrame.yaml', 'ru/m/tankz/editor/Style.json') +@:template('ru/m/tankz/editor/frame/LevelFrame.yaml', 'ru/m/tankz/editor/Style.yaml') class LevelFrame extends VGroupView implements ViewBuilder implements LevelFrameLayout { public static inline var ID = 'level'; public static inline var TAG = 'level'; 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 9b6083d..28f835b 100644 --- a/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.yaml @@ -1,30 +1,32 @@ +--- $type: haxework.gui.VGroupView pWidth: 100 pHeight: 100 layoutMargin: 2 +layoutVAlign: TOP views: - $type: haxework.gui.HGroupView contentSize: true views: - id: gameClassicButton $type: haxework.gui.ButtonView + $style: button text: Classic - '@style': button - id: gameDotaButton $type: haxework.gui.ButtonView + $style: button text: DotA - '@style': button - $type: haxework.gui.HGroupView contentSize: true views: - id: openButton $type: haxework.gui.ButtonView + $style: button text: Open - '@style': button - id: saveButton $type: haxework.gui.ButtonView + $style: button text: Save - '@style': button - id: fileNameLabel $type: haxework.gui.LabelView contentSize: true @@ -33,7 +35,7 @@ views: views: - id: spawnPointList $type: haxework.gui.list.VListView - factory: '@class:ru.m.tankz.editor.level.SpawnPointView' + factory: "@class:ru.m.tankz.editor.level.SpawnPointView" width: 56 pHeight: 100 scroll: @@ -51,7 +53,7 @@ views: contentSize: true - id: brickList $type: haxework.gui.list.VListView - factory: '@class:ru.m.tankz.editor.level.BrickView' + factory: "@class:ru.m.tankz.editor.level.BrickView" width: 30 pHeight: 100 scroll: diff --git a/src/editor/haxe/ru/m/tankz/editor/frame/TankFrame.hx b/src/editor/haxe/ru/m/tankz/editor/frame/TankFrame.hx index e166e6c..09cb340 100644 --- a/src/editor/haxe/ru/m/tankz/editor/frame/TankFrame.hx +++ b/src/editor/haxe/ru/m/tankz/editor/frame/TankFrame.hx @@ -14,7 +14,7 @@ interface TankFrameLayout { var colorB(default, null):InputView; } -@:template('ru/m/tankz/editor/frame/TankFrame.yaml') +@:template('ru/m/tankz/editor/frame/TankFrame.yaml', 'ru/m/tankz/editor/Style.yaml') class TankFrame extends HGroupView implements ViewBuilder implements TankFrameLayout { public static inline var ID = 'tank'; 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 2a66369..60ce848 100644 --- a/src/editor/haxe/ru/m/tankz/editor/frame/TankFrame.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/frame/TankFrame.yaml @@ -1,3 +1,4 @@ +--- $type: haxework.gui.HGroupView pWidth: 100 pHeight: 100 @@ -5,28 +6,28 @@ views: - $type: ru.m.tankz.editor.tank.TankView contentSize: true rightMargin: 20 - image: '@asset:image:resources/image/tank/bc-0.png' - color: '#ff4422' + image: "@asset:image:resources/image/tank/bc-0.png" + color: "#ff4422" - $type: ru.m.tankz.editor.tank.TankView contentSize: true rightMargin: 20 - image: '@asset:image:resources/image/tank/bc-0.png' - color: '#f055a0' + image: "@asset:image:resources/image/tank/bc-0.png" + color: "#f055a0" - $type: ru.m.tankz.editor.tank.TankView contentSize: true rightMargin: 20 - image: '@asset:image:resources/image/tank/bc-0.png' - color: '#2244ff' + image: "@asset:image:resources/image/tank/bc-0.png" + color: "#2244ff" - id: tank $type: ru.m.tankz.editor.tank.TankView contentSize: true rightMargin: 20 - image: '@asset:image:resources/image/tank/bc-0.png' + image: "@asset:image:resources/image/tank/bc-0.png" - id: colorR $type: haxework.gui.InputView width: 30 height: 20 - text: 'a0' + text: "a0" skin: $type: haxework.gui.skin.ColorSkin color: 0xffffff @@ -34,7 +35,7 @@ views: $type: haxework.gui.InputView width: 30 height: 20 - text: '55' + text: "55" skin: $type: haxework.gui.skin.ColorSkin color: 0xffffff @@ -42,7 +43,7 @@ views: $type: haxework.gui.InputView width: 30 height: 20 - text: 'f0' + text: "f0" skin: $type: haxework.gui.skin.ColorSkin color: 0xffffff