diff --git a/package.json b/package.json index f5685cc..7136012 100755 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "gulp-haxetool": "^0.0.14" }, "haxeDependencies": { - "haxework": "git", + "haxework": "git@bitbucket.org:shmyga/haxework.git", "lime": "7.2.1", "openfl": "8.8.0", "hxcpp": "4.0.4", @@ -17,7 +17,7 @@ "protohx": "0.4.6", "yaml": "1.3.0", "orm": "2.1.0", - "yield": "1.1.2", + "yield": "2.0.0", "haxe-crypto": "0.0.7" }, "dependencies": { diff --git a/src/client/haxe/ru/m/tankz/Client.hx b/src/client/haxe/ru/m/tankz/Client.hx index 34a4a1d..506fe2b 100755 --- a/src/client/haxe/ru/m/tankz/Client.hx +++ b/src/client/haxe/ru/m/tankz/Client.hx @@ -1,10 +1,12 @@ package ru.m.tankz; +import flash.Lib; +import haxework.animate.Animate; import ru.m.tankz.frame.StartFrame; import flash.ui.Keyboard; import flash.events.KeyboardEvent; import flash.text.Font; -import haxework.gui.frame.IFrameSwitcher; +import haxework.gui.frame.FrameSwitcher; import haxework.gui.Root; import haxework.gui.VGroupView; import haxework.log.TraceLogger; @@ -26,6 +28,7 @@ class Client { #end Const.init(); Init.init(); + Animate.bind(Lib.current.stage); L.d(TAG, 'Debug: ${Const.DEBUG}'); L.i(TAG, 'Version: ${Const.VERSION}'); L.i(TAG, 'Build: ${Const.BUILD}'); @@ -33,21 +36,20 @@ class Client { var view:ClientView = new ClientView(); Root.bind(view); view.launch(); - } } @:template class ClientView extends VGroupView { private static inline var TAG = 'Tankz'; - @:view private var switcher(default, null):IFrameSwitcher; + @: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} b${Const.BUILD}'); - Provider.set(IFrameSwitcher, switcher); + Provider.set(FrameSwitcher, switcher); } public function launch():Void { diff --git a/src/client/haxe/ru/m/tankz/ClientView.yaml b/src/client/haxe/ru/m/tankz/ClientView.yaml index 843ef97..2a75bbe 100755 --- a/src/client/haxe/ru/m/tankz/ClientView.yaml +++ b/src/client/haxe/ru/m/tankz/ClientView.yaml @@ -3,27 +3,32 @@ $type: haxework.gui.VGroupView geometry.size.stretch: true layout.hAlign: center layout.vAlign: middle -skin: $r:skin:light +skinId: light views: -- id: switcher - $type: haxework.gui.frame.FrameSwitcher - geometry.size.width: 960 - geometry.size.height: 720 - skin: $r:skin:dark - 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 - # - id: network - # $type: ru.m.tankz.frame.NetworkFrame - - id: settings - $type: ru.m.tankz.frame.SettingsFrame + - id: switcher + $type: haxework.gui.frame.FrameSwitcher + animateFactory: { $class: haxework.animate.CircleMaskAnimate } + geometry.size.width: 960 + geometry.size.height: 720 + views: + - id: start + $type: ru.m.tankz.frame.StartFrame + skinId: dark + # classic + - id: classic.level + $type: ru.m.tankz.frame.classic.ClassicLevelFrame + skinId: dark + - id: classic.game + $type: ru.m.tankz.frame.classic.ClassicGameFrame + # dota + - id: dota.level + $type: ru.m.tankz.frame.dota.DotaLevelFrame + skinId: dark + - id: dota.game + $type: ru.m.tankz.frame.dota.DotaGameFrame + # - id: network + # $type: ru.m.tankz.frame.NetworkFrame + # skinId: dark + - id: settings + $type: ru.m.tankz.frame.SettingsFrame + skinId: dark diff --git a/src/client/haxe/ru/m/tankz/frame/SettingsFrame.hx b/src/client/haxe/ru/m/tankz/frame/SettingsFrame.hx index a0445c4..8fc7c3e 100644 --- a/src/client/haxe/ru/m/tankz/frame/SettingsFrame.hx +++ b/src/client/haxe/ru/m/tankz/frame/SettingsFrame.hx @@ -1,6 +1,6 @@ package ru.m.tankz.frame; -import haxework.gui.frame.IFrameSwitcher; +import haxework.gui.frame.FrameSwitcher; import haxework.gui.ButtonView; import haxework.gui.VGroupView; @@ -8,7 +8,7 @@ import haxework.gui.VGroupView; public static var ID(default, never):String = "settings"; - @:provide var frameSwitcher:IFrameSwitcher; + @:provide var frameSwitcher:FrameSwitcher; @:view var close:ButtonView; diff --git a/src/client/haxe/ru/m/tankz/frame/SettingsFrame.yaml b/src/client/haxe/ru/m/tankz/frame/SettingsFrame.yaml index 7c153d4..ebdc562 100644 --- a/src/client/haxe/ru/m/tankz/frame/SettingsFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/SettingsFrame.yaml @@ -2,7 +2,7 @@ geometry.size.stretch: true views: - $type: haxework.gui.LabelView - skin: $r:skin:text + skinId: text geometry.size.percent.width: 100 geometry.size.fixed.height: 20 text: Settings @@ -19,7 +19,7 @@ views: controlIndex: 1 - id: close $type: haxework.gui.ButtonView - skin: $r:skin:button.close + skinId: button.close +onPress: $this:onPress geometry.position: absolute geometry.margin.left: 10 diff --git a/src/client/haxe/ru/m/tankz/frame/StartFrame.hx b/src/client/haxe/ru/m/tankz/frame/StartFrame.hx index e1fadd1..df59b55 100644 --- a/src/client/haxe/ru/m/tankz/frame/StartFrame.hx +++ b/src/client/haxe/ru/m/tankz/frame/StartFrame.hx @@ -3,7 +3,7 @@ package ru.m.tankz.frame; import ru.m.tankz.frame.classic.ClassicLevelFrame; import ru.m.tankz.frame.dota.DotaLevelFrame; import haxework.gui.ButtonView; -import haxework.gui.frame.IFrameSwitcher; +import haxework.gui.frame.FrameSwitcher; import haxework.gui.VGroupView; import ru.m.tankz.storage.SaveStorage; @@ -11,7 +11,7 @@ import ru.m.tankz.storage.SaveStorage; public static var ID(default, never):String = "start"; - @:provide var frameSwitcher:IFrameSwitcher; + @:provide var frameSwitcher:FrameSwitcher; @:provide var storage:SaveStorage; public function onPress(view:ButtonView):Void { diff --git a/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml b/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml index a2bc169..88b772f 100644 --- a/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml +++ b/src/client/haxe/ru/m/tankz/frame/StartFrame.yaml @@ -10,23 +10,23 @@ views: views: - id: classic $type: haxework.gui.ButtonView - skin: $r:skin:button + skinId: button +onPress: $this:onPress text: Classic - id: dota $type: haxework.gui.ButtonView - skin: $r:skin:button + skinId: button +onPress: $this:onPress text: DotA - id: network $type: haxework.gui.ButtonView - skin: $r:skin:button + skinId: button +onPress: $this:onPress text: Network (in developing) fontColor: 0xff0000 visible: false - $type: haxework.gui.LabelView - skin: $r:skin:text + skinId: text geometry.position: absolute geometry.margin.right: 10 geometry.margin.bottom: 10 diff --git a/src/client/haxe/ru/m/tankz/frame/classic/ClassicGamePanel.yaml b/src/client/haxe/ru/m/tankz/frame/classic/ClassicGamePanel.yaml index 2103abc..dddc3bb 100644 --- a/src/client/haxe/ru/m/tankz/frame/classic/ClassicGamePanel.yaml +++ b/src/client/haxe/ru/m/tankz/frame/classic/ClassicGamePanel.yaml @@ -8,11 +8,11 @@ views: geometry.size.height: 20 - id: player1state $type: haxework.gui.LabelView - skin: $r:skin:text + skinId: text geometry.size.width: 100% geometry.size.height: 20 - id: player2state $type: haxework.gui.LabelView - skin: $r:skin:text + skinId: text geometry.size.width: 100% geometry.size.height: 20 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 3e0edd0..d5383f6 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,7 @@ package ru.m.tankz.frame.classic; +import haxework.gui.frame.FrameSwitcher; import haxework.gui.DataView; -import haxework.gui.frame.IFrameSwitcher; import haxework.gui.ToggleButtonView; import ru.m.tankz.config.Config; import ru.m.tankz.frame.common.LevelFrame; @@ -13,7 +13,7 @@ import ru.m.tankz.preset.ClassicGame; @:view var presets(default, null):DataView; @:view var levels(default, null):DataView; - @:provide var frames:IFrameSwitcher; + @:provide var frames:FrameSwitcher; private function onShow():Void { gameType = ClassicGame.TYPE; diff --git a/src/client/haxe/ru/m/tankz/frame/common/GameFrame.hx b/src/client/haxe/ru/m/tankz/frame/common/GameFrame.hx index 9761eef..f2b35d0 100644 --- a/src/client/haxe/ru/m/tankz/frame/common/GameFrame.hx +++ b/src/client/haxe/ru/m/tankz/frame/common/GameFrame.hx @@ -3,7 +3,7 @@ package ru.m.tankz.frame.common; import flash.events.Event; import haxe.ds.Option; import haxe.Timer; -import haxework.gui.frame.IFrameSwitcher; +import haxework.gui.frame.FrameSwitcher; import haxework.gui.GroupView; import ru.m.tankz.frame.common.IGamePanel; import ru.m.tankz.game.Game; @@ -24,7 +24,7 @@ class GameFrame extends GroupView { @:provide var sound:SoundManager; @:provide var state:GameState; @:provide var storage:SaveStorage; - @:provide var switcher:IFrameSwitcher; + @:provide var switcher:FrameSwitcher; private var game:Game; private var timer:Timer; diff --git a/src/client/haxe/ru/m/tankz/frame/common/LevelView.yaml b/src/client/haxe/ru/m/tankz/frame/common/LevelView.yaml index b4417ab..1cb70ff 100644 --- a/src/client/haxe/ru/m/tankz/frame/common/LevelView.yaml +++ b/src/client/haxe/ru/m/tankz/frame/common/LevelView.yaml @@ -5,7 +5,7 @@ geometry.margin: 5 views: - id: label $type: haxework.gui.LabelView - skin: $r:skin:text + skinId: text geometry.size.stretch: true text: "" skin: diff --git a/src/client/haxe/ru/m/tankz/frame/common/PlayerView.yaml b/src/client/haxe/ru/m/tankz/frame/common/PlayerView.yaml index da0433a..20438e6 100644 --- a/src/client/haxe/ru/m/tankz/frame/common/PlayerView.yaml +++ b/src/client/haxe/ru/m/tankz/frame/common/PlayerView.yaml @@ -6,7 +6,7 @@ layout.margin: 10 views: - id: index $type: haxework.gui.LabelView - $style: label + skinId: text geometry.size.stretch: true skin: - $type: haxework.gui.skin.ColorSkin diff --git a/src/client/haxe/ru/m/tankz/frame/dota/DotaGameFrame.hx b/src/client/haxe/ru/m/tankz/frame/dota/DotaGameFrame.hx index 171870f..463713d 100755 --- a/src/client/haxe/ru/m/tankz/frame/dota/DotaGameFrame.hx +++ b/src/client/haxe/ru/m/tankz/frame/dota/DotaGameFrame.hx @@ -6,7 +6,7 @@ import flash.events.Event; import haxe.ds.Option; import haxe.Timer; import haxework.gui.core.Geometry.Position; -import haxework.gui.frame.IFrameSwitcher; +import haxework.gui.frame.FrameSwitcher; import haxework.gui.VGroupView; import ru.m.tankz.game.Game; import ru.m.tankz.game.GameState; @@ -36,7 +36,7 @@ import ru.m.tankz.Type.GameType; @:provide var sound:SoundManager; @:provide var state:GameState; @:provide var storage:SaveStorage; - @:provide var switcher:IFrameSwitcher; + @:provide var switcher:FrameSwitcher; private var game:Game; private var timer:Timer; diff --git a/src/client/haxe/ru/m/tankz/frame/dota/DotaGamePanel.yaml b/src/client/haxe/ru/m/tankz/frame/dota/DotaGamePanel.yaml index 31f8962..3ac4de6 100644 --- a/src/client/haxe/ru/m/tankz/frame/dota/DotaGamePanel.yaml +++ b/src/client/haxe/ru/m/tankz/frame/dota/DotaGamePanel.yaml @@ -2,6 +2,6 @@ views: - id: state $type: haxework.gui.LabelView - skin: $r:skin:text + skinId: text geometry.size.width: 100% geometry.size.height: 20 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 9a1e00e..71325e8 100644 --- a/src/client/haxe/ru/m/tankz/frame/dota/DotaLevelFrame.hx +++ b/src/client/haxe/ru/m/tankz/frame/dota/DotaLevelFrame.hx @@ -1,7 +1,7 @@ package ru.m.tankz.frame.dota; import haxework.gui.DataView; -import haxework.gui.frame.IFrameSwitcher; +import haxework.gui.frame.FrameSwitcher; import ru.m.tankz.frame.common.LevelFrame; import ru.m.tankz.frame.common.PlayerView; import ru.m.tankz.preset.DotaGame; @@ -13,7 +13,7 @@ import ru.m.tankz.Type; @:view var levels(default, null):DataView; @:view var players(default, null):DataView; - @:provide var frames:IFrameSwitcher; + @:provide var frames:FrameSwitcher; private function onShow():Void { gameType = DotaGame.TYPE; diff --git a/src/client/haxe/ru/m/tankz/frame/settings/ActionView.yaml b/src/client/haxe/ru/m/tankz/frame/settings/ActionView.yaml index 2539a03..8258536 100644 --- a/src/client/haxe/ru/m/tankz/frame/settings/ActionView.yaml +++ b/src/client/haxe/ru/m/tankz/frame/settings/ActionView.yaml @@ -5,13 +5,13 @@ geometry.margin: 5 views: - id: action $type: haxework.gui.LabelView - skin: $r:skin:text + skinId: text geometry.size.width: 50% geometry.size.height: 100% text: "" - id: key $type: haxework.gui.LabelView - skin: $r:skin:text + skinId: text geometry.size.width: 50% geometry.size.height: 100% text: "" 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 30517c6..3f20330 100644 --- a/src/client/haxe/ru/m/tankz/frame/settings/SettingsEditor.yaml +++ b/src/client/haxe/ru/m/tankz/frame/settings/SettingsEditor.yaml @@ -3,28 +3,28 @@ layout.hAlign: center views: - id: label $type: haxework.gui.LabelView - skin: $r:skin:text + skinId: text - $type: haxework.gui.HGroupView layout.margin: 10 views: - id: change $type: haxework.gui.ButtonView +onPress: $this:onPress - skin: $r:skin:button.simple + skinId: button.simple text: Change - id: clear $type: haxework.gui.ButtonView +onPress: $this:onPress - skin: $r:skin:button.simple + skinId: button.simple text: Clear - id: reset $type: haxework.gui.ButtonView +onPress: $this:onPress - skin: $r:skin:button.simple + skinId: button.simple text: Reset - id: list $type: haxework.gui.list.VListView - factory: { $class: ru.m.tankz.frame.settings.ActionView } + factory: $code:function() return new ru.m.tankz.frame.settings.ActionView() geometry.size.stretch: true scroll: $type: haxework.gui.list.VScrollBarView diff --git a/src/editor/haxe/ru/m/tankz/editor/EditorView.yaml b/src/editor/haxe/ru/m/tankz/editor/EditorView.yaml index 7db66d0..0156506 100644 --- a/src/editor/haxe/ru/m/tankz/editor/EditorView.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/EditorView.yaml @@ -11,18 +11,18 @@ views: views: - id: level $type: haxework.gui.ToggleButtonView - skin: $r:skin:button.toggle + skinId: button.tab text: Level +onPress: $this:onPress - id: tank $type: haxework.gui.ToggleButtonView - skin: $r:skin:button.toggle + skinId: button.tab text: Tank +onPress: $this:onPress # Switcher - id: switcher $type: haxework.gui.frame.FrameSwitcher - skin: $r:skin:border + skinId: border +onSwitch: $this:onFrameSwitch geometry.size.stretch: true geometry.padding: 5 @@ -33,7 +33,7 @@ views: $type: ru.m.tankz.editor.frame.TankFrame # Version - $type: haxework.gui.LabelView - skin: $r:skin:text + skinId: text geometry.position: absolute geometry.vAlign: bottom geometry.hAlign: right 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 c5b3e55..9bf3722 100644 --- a/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.yaml +++ b/src/editor/haxe/ru/m/tankz/editor/frame/LevelFrame.yaml @@ -9,24 +9,24 @@ views: views: - id: gameClassicButton $type: haxework.gui.ButtonView - skin: $r:skin:button.simple + skinId: button.simple text: Classic +onPress: $this:onPress - id: gameDotaButton $type: haxework.gui.ButtonView - skin: $r:skin:button.simple + skinId: button.simple text: DotA +onPress: $this:onPress - $type: haxework.gui.HGroupView views: - id: openButton $type: haxework.gui.ButtonView - skin: $r:skin:button.simple + skinId: button.simple text: Open +onPress: $this:onPress - id: saveButton $type: haxework.gui.ButtonView - skin: $r:skin:button.simple + skinId: button.simple text: Save +onPress: $this:onPress - id: fileNameLabel @@ -35,13 +35,13 @@ views: views: - id: spawnPointList $type: haxework.gui.list.VListView - factory: { $class: ru.m.tankz.editor.level.SpawnPointView } + factory: $code:function() return new ru.m.tankz.editor.level.SpawnPointView() geometry.size.width: 56 geometry.size.height: 100% - id: mapView $type: ru.m.tankz.editor.level.MapEditView - id: brickList $type: haxework.gui.list.VListView - factory: { $class: ru.m.tankz.editor.level.BrickView } + factory: $code:function() return new ru.m.tankz.editor.level.BrickView() geometry.size.width: 30 geometry.size.height: 100% 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 25bd92f..e5a6592 100644 --- a/src/editor/haxe/ru/m/tankz/editor/level/BrickView.hx +++ b/src/editor/haxe/ru/m/tankz/editor/level/BrickView.hx @@ -9,6 +9,7 @@ import ru.m.tankz.config.Config; class BrickView extends SpriteView implements IListItemView { + private static var size = 26; public var item_index(default, default):Int; public var data(default, set):BrickConfig; @@ -19,8 +20,8 @@ class BrickView extends SpriteView implements IListItemView { public function new() { super(); - setContentSize(26, 26); - selectView = createSelectView(geometry.size.content.width, geometry.size.content.height); + setContentSize(size, size); + selectView = createSelectView(size, size); selectView.visible = false; content.addChild(selectView); imageView = new Bitmap(); 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 08ae9ad..d26d88d 100644 --- a/src/editor/haxe/ru/m/tankz/editor/level/SpawnPointView.hx +++ b/src/editor/haxe/ru/m/tankz/editor/level/SpawnPointView.hx @@ -11,6 +11,7 @@ import ru.m.tankz.editor.level.MapEditView; class SpawnPointView extends SpriteView implements IListItemView { + private static var size = 52; public var item_index(default, default):Int; public var data(default, set):SpawnPoint; @@ -21,8 +22,8 @@ class SpawnPointView extends SpriteView implements IListItemView { public function new() { super(); - setContentSize(52, 52); - selectView = createSelectView(geometry.size.content.width, geometry.size.content.height); + setContentSize(size, size); + selectView = createSelectView(size, size); selectView.visible = false; content.addChild(selectView); imageView = new Bitmap();