diff --git a/src/client/haxe/ru/m/tankz/Client.hx b/src/client/haxe/ru/m/tankz/Client.hx index f6b4219..72921b1 100755 --- a/src/client/haxe/ru/m/tankz/Client.hx +++ b/src/client/haxe/ru/m/tankz/Client.hx @@ -8,7 +8,6 @@ import flash.events.KeyboardEvent; import flash.text.Font; import haxework.gui.frame.FrameSwitcher; import haxework.gui.Root; -import haxework.gui.VGroupView; import haxework.log.TraceLogger; import haxework.provider.Provider; import haxework.resources.IResources; @@ -42,26 +41,25 @@ class Client { } } -@:template class ClientView extends VGroupView { +@:template class ClientView extends FrameSwitcher { private static inline var TAG = 'Tankz'; - @:view private var switcher(default, null):FrameSwitcher; @:provide var resources:IResources; public function init():Void { var font:Font = Font.enumerateFonts()[0]; resources.text.put('font', 'Bookman Old Style'); resources.text.put('version', 'v${Const.VERSION} (${Const.BUILD})'); - Provider.set(FrameSwitcher, switcher); + Provider.set(FrameSwitcher, this); } public function launch():Void { content.stage.stageFocusRect = false; content.stage.addEventListener(KeyboardEvent.KEY_UP, function(event:KeyboardEvent):Void { if (event.keyCode == Keyboard.ESCAPE) { - switcher.change(StartFrame.ID); + change(StartFrame.ID); } }); - switcher.change(StartFrame.ID); + change(StartFrame.ID); } } diff --git a/src/client/haxe/ru/m/tankz/ClientView.yaml b/src/client/haxe/ru/m/tankz/ClientView.yaml index ee7d9d3..3b209b9 100755 --- a/src/client/haxe/ru/m/tankz/ClientView.yaml +++ b/src/client/haxe/ru/m/tankz/ClientView.yaml @@ -1,34 +1,25 @@ --- -$type: haxework.gui.VGroupView +$type: haxework.gui.frame.FrameSwitcher geometry.size.stretch: true -layout.hAlign: center -layout.vAlign: middle -skinId: light +skinId: dark views: - - id: switcher - $type: haxework.gui.frame.FrameSwitcher - skinId: dark - geometry.size.stretch: true - layout.hAlign: center - layout.vAlign: middle - views: - - id: start - $type: ru.m.tankz.frame.StartFrame - # classic - - id: classic.level - $type: ru.m.tankz.frame.classic.ClassicLevelFrame - - id: classic.game - $type: ru.m.tankz.frame.classic.ClassicGameFrame - # dota - - id: dota.level - $type: ru.m.tankz.frame.dota.DotaLevelFrame - - id: dota.game - $type: ru.m.tankz.frame.dota.DotaGameFrame - # result - - id: result - $type: ru.m.tankz.frame.ResultFrame - # - id: network - # $type: ru.m.tankz.frame.NetworkFrame - # settings - - id: settings - $type: ru.m.tankz.frame.SettingsFrame + - id: start + $type: ru.m.tankz.frame.StartFrame + # classic + - id: classic.level + $type: ru.m.tankz.frame.classic.ClassicLevelFrame + - id: classic.game + $type: ru.m.tankz.frame.classic.ClassicGameFrame + # dota + - id: dota.level + $type: ru.m.tankz.frame.dota.DotaLevelFrame + - id: dota.game + $type: ru.m.tankz.frame.dota.DotaGameFrame + # result + - id: result + $type: ru.m.tankz.frame.ResultFrame + # - id: network + # $type: ru.m.tankz.frame.NetworkFrame + # settings + - id: settings + $type: ru.m.tankz.frame.SettingsFrame diff --git a/src/client/haxe/ru/m/tankz/Style.hx b/src/client/haxe/ru/m/tankz/Style.hx index 78013e5..7e15200 100644 --- a/src/client/haxe/ru/m/tankz/Style.hx +++ b/src/client/haxe/ru/m/tankz/Style.hx @@ -1,5 +1,6 @@ package ru.m.tankz; +import haxework.gui.layout.Layout; import haxework.color.ColorUtil; import haxework.gui.core.Geometry; import haxework.gui.core.HAlign; @@ -18,10 +19,6 @@ class Style { private static var textColor = 0xE7E0BB; private static var fontFamily = "Courirer New"; - private static function iconButton():Geometry { - return new Geometry().setSize(64, 64).setMargin(30).setPosition(ABSOLUTE); - } - public static function register() { resources.skin.put("light", [ Skin.color(lightColor), @@ -69,16 +66,27 @@ class Style { Skin.size(64, 64), ]); + resources.skin.put("container", [ + Skin.geometry(new Geometry().setSize("100%", "100%")), + Skin.layout(new Layout().setAlign(CENTER, MIDDLE)), + Skin.color(darkColor), + ]); + resources.skin.put("panel", [ + Skin.geometry(new Geometry().setSize("100%", -1).setPadding([20, 10])), + Skin.layout(new Layout().setAlign(NONE, MIDDLE)), + Skin.color(lightColor), + ]); + resources.skin.put("button.settings", [ - Skin.geometry(iconButton().setAlign(LEFT, BOTTOM)), + Skin.size(64, 64), new ButtonSVGSkin(Assets.getText("resources/image/icon/cog-solid.svg"), lightColor), ]); resources.skin.put("button.close", [ - Skin.geometry(iconButton().setAlign(LEFT, BOTTOM)), + Skin.size(64, 64), new ButtonSVGSkin(Assets.getText("resources/image/icon/times-circle-solid.svg"), lightColor), ]); resources.skin.put("button.next", [ - Skin.geometry(iconButton().setAlign(RIGHT, BOTTOM)), + Skin.size(64, 64), new ButtonSVGSkin(Assets.getText("resources/image/icon/arrow-alt-circle-right-solid.svg"), lightColor), ]); } diff --git a/src/client/haxe/ru/m/tankz/frame/ResultFrame.yaml b/src/client/haxe/ru/m/tankz/frame/ResultFrame.yaml index e5c34e5..0495513 100644 --- a/src/client/haxe/ru/m/tankz/frame/ResultFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/ResultFrame.yaml @@ -1,27 +1,29 @@ --- -geometry.size.stretch: true -layout.hAlign: center -layout.vAlign: middle views: - - id: level - $type: haxework.gui.LabelView - skinId: text.header - - - id: result - $type: haxework.gui.DataView - factory: $this:playerViewFactory - geometry.margin.top: 20 - layout: - $type: haxework.gui.layout.VerticalLayout - hAlign: right - margin: 10 - - - id: close - $type: haxework.gui.ButtonView - skinId: button.close - +onPress: $code:close() - - - id: next - $type: haxework.gui.ButtonView - skinId: button.next - +onPress: $code:next() + - $type: haxework.gui.VGroupView + skinId: container + views: + - id: level + $type: haxework.gui.LabelView + skinId: text.header + - id: result + $type: haxework.gui.DataView + factory: $this:playerViewFactory + geometry.margin.top: 20 + layout: + $type: haxework.gui.layout.VerticalLayout + hAlign: right + margin: 10 + - $type: haxework.gui.HGroupView + skinId: panel + views: + - id: close + $type: haxework.gui.ButtonView + skinId: button.close + +onPress: $code:close() + - $type: haxework.gui.SpriteView + geometry.size.width: 100% + - id: next + $type: haxework.gui.ButtonView + skinId: button.next + +onPress: $code:next() diff --git a/src/client/haxe/ru/m/tankz/frame/SettingsFrame.yaml b/src/client/haxe/ru/m/tankz/frame/SettingsFrame.yaml index bbb3c23..2b1ab8c 100644 --- a/src/client/haxe/ru/m/tankz/frame/SettingsFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/SettingsFrame.yaml @@ -1,19 +1,22 @@ --- -geometry.size.stretch: true -layout.hAlign: center -layout.vAlign: middle views: - - $type: haxework.gui.LabelView - skinId: text.header - text: Settings - - $type: haxework.gui.HGroupView - layout.margin: 20 + - $type: haxework.gui.VGroupView + skinId: container views: - - $type: ru.m.tankz.frame.settings.SettingsEditor - controlIndex: 0 - - $type: ru.m.tankz.frame.settings.SettingsEditor - controlIndex: 1 - - id: close - $type: haxework.gui.ButtonView - skinId: button.close - +onPress: $this:onPress + - $type: haxework.gui.LabelView + skinId: text.header + text: Settings + - $type: haxework.gui.HGroupView + layout.margin: 20 + views: + - $type: ru.m.tankz.frame.settings.SettingsEditor + controlIndex: 0 + - $type: ru.m.tankz.frame.settings.SettingsEditor + controlIndex: 1 + - $type: haxework.gui.HGroupView + skinId: panel + views: + - id: close + $type: haxework.gui.ButtonView + skinId: button.close + +onPress: $this:onPress diff --git a/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml b/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml index a0fc372..609cac7 100644 --- a/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml @@ -1,14 +1,12 @@ --- -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 + skinId: container layout.margin: 3 views: + - $type: haxework.gui.ImageView + image: $asset:image:resources/image/ui/logo.png + geometry.margin.bottom: 15 - id: classic $type: haxework.gui.ButtonView skinId: button @@ -26,14 +24,15 @@ views: text: Network (in developing) fontColor: 0xff0000 visible: false - - $type: haxework.gui.LabelView - skinId: text - geometry.position: absolute - geometry.margin: 10 - geometry.vAlign: bottom - geometry.hAlign: right - text: $r:text:version - - id: settings - $type: haxework.gui.ButtonView - skinId: button.settings - +onPress: $this:onPress + - $type: haxework.gui.HGroupView + skinId: panel + views: + - id: settings + $type: haxework.gui.ButtonView + skinId: button.settings + +onPress: $this:onPress + - $type: haxework.gui.SpriteView + geometry.size.width: 100% + - $type: haxework.gui.LabelView + skinId: text + text: $r:text:version diff --git a/src/client/haxe/ru/m/tankz/frame/classic/ClassicGameFrame.yaml b/src/client/haxe/ru/m/tankz/frame/classic/ClassicGameFrame.yaml index 582b440..1dc3fb3 100644 --- a/src/client/haxe/ru/m/tankz/frame/classic/ClassicGameFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/classic/ClassicGameFrame.yaml @@ -1,11 +1,10 @@ --- -layout: - $type: haxework.gui.layout.HorizontalLayout - margin: 5 - hAlign: center - vAlign: middle +skinId: container views: - - id: render - $type: ru.m.tankz.render.Render - - id: panel - $type: ru.m.tankz.frame.classic.ClassicGamePanel + - $type: haxework.gui.HGroupView + layout.margin: 5 + views: + - id: render + $type: ru.m.tankz.render.Render + - id: panel + $type: ru.m.tankz.frame.classic.ClassicGamePanel 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 2711ea7..889ab48 100644 --- a/src/client/haxe/ru/m/tankz/frame/classic/ClassicLevelFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/classic/ClassicLevelFrame.yaml @@ -1,7 +1,7 @@ --- +skinId: container layout: $type: haxework.gui.layout.VerticalLayout - hAlign: center views: - $type: haxework.gui.LabelView skinId: text.header diff --git a/src/client/haxe/ru/m/tankz/frame/dota/DotaGameFrame.yaml b/src/client/haxe/ru/m/tankz/frame/dota/DotaGameFrame.yaml index b80a1d8..a80c0c1 100644 --- a/src/client/haxe/ru/m/tankz/frame/dota/DotaGameFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/dota/DotaGameFrame.yaml @@ -1,9 +1,10 @@ --- -layout: - $type: haxework.gui.layout.VerticalLayout - margin: 5 +skinId: container views: - - id: panel - $type: ru.m.tankz.frame.dota.DotaGamePanel - - id: render - $type: ru.m.tankz.render.Render + - $type: haxework.gui.VGroupView + layout.margin: 5 + views: + - id: panel + $type: ru.m.tankz.frame.dota.DotaGamePanel + - id: render + $type: ru.m.tankz.render.Render 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 0052582..bf8abd9 100644 --- a/src/client/haxe/ru/m/tankz/frame/dota/DotaLevelFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/dota/DotaLevelFrame.yaml @@ -1,7 +1,7 @@ --- +skinId: container layout: $type: haxework.gui.layout.VerticalLayout - hAlign: center views: - $type: haxework.gui.LabelView skinId: text.header diff --git a/src/common/haxe/ru/m/tankz/preset/ClassicGame.hx b/src/common/haxe/ru/m/tankz/preset/ClassicGame.hx index 7f4b7e8..75960a9 100644 --- a/src/common/haxe/ru/m/tankz/preset/ClassicGame.hx +++ b/src/common/haxe/ru/m/tankz/preset/ClassicGame.hx @@ -2,18 +2,9 @@ package ru.m.tankz.preset; import ru.m.tankz.Type; - -class ClassicGame extends GamePreset { - +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'; - - public static var PLAYER1(default, never):PresetId = 'player1'; - public static var PLAYER2(default, never):PresetId = 'player2'; - - public function new() { - super(TYPE, [HUMAN, BOT], [PLAYER1, PLAYER2]); - } } diff --git a/src/common/haxe/ru/m/tankz/preset/DotaGame.hx b/src/common/haxe/ru/m/tankz/preset/DotaGame.hx index 49d7de2..ee89f54 100644 --- a/src/common/haxe/ru/m/tankz/preset/DotaGame.hx +++ b/src/common/haxe/ru/m/tankz/preset/DotaGame.hx @@ -2,19 +2,9 @@ package ru.m.tankz.preset; import ru.m.tankz.Type; - -class DotaGame extends GamePreset { - +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'; - - public static var PLAYER1(default, never):PresetId = 'player1'; - public static var PLAYER2_COOP(default, never):PresetId = 'player2_coop'; - public static var PLAYER2_VS(default, never):PresetId = 'player2_vs'; - - public function new() { - super(TYPE, [RADIANT, DIRE], [PLAYER1, PLAYER2_COOP, PLAYER2_VS]); - } } diff --git a/src/common/haxe/ru/m/tankz/preset/GamePreset.hx b/src/common/haxe/ru/m/tankz/preset/GamePreset.hx deleted file mode 100644 index f933a51..0000000 --- a/src/common/haxe/ru/m/tankz/preset/GamePreset.hx +++ /dev/null @@ -1,17 +0,0 @@ -package ru.m.tankz.preset; - -import ru.m.tankz.Type; - - -class GamePreset { - - public var type(default, null):GameType; - public var teams(default, null):Array; - public var presets(default, null):Array; - - public function new(type:GameType, teams:Array, presets:Array) { - this.type = type; - this.teams = teams; - this.presets = presets; - } -} \ No newline at end of file