[client] update haxework. ep5

This commit is contained in:
2019-03-06 17:48:51 +03:00
parent d4a9c720d6
commit 7cca35195d
21 changed files with 82 additions and 73 deletions

View File

@@ -9,7 +9,7 @@
"gulp-haxetool": "^0.0.14" "gulp-haxetool": "^0.0.14"
}, },
"haxeDependencies": { "haxeDependencies": {
"haxework": "git", "haxework": "git@bitbucket.org:shmyga/haxework.git",
"lime": "7.2.1", "lime": "7.2.1",
"openfl": "8.8.0", "openfl": "8.8.0",
"hxcpp": "4.0.4", "hxcpp": "4.0.4",
@@ -17,7 +17,7 @@
"protohx": "0.4.6", "protohx": "0.4.6",
"yaml": "1.3.0", "yaml": "1.3.0",
"orm": "2.1.0", "orm": "2.1.0",
"yield": "1.1.2", "yield": "2.0.0",
"haxe-crypto": "0.0.7" "haxe-crypto": "0.0.7"
}, },
"dependencies": { "dependencies": {

View File

@@ -1,10 +1,12 @@
package ru.m.tankz; package ru.m.tankz;
import flash.Lib;
import haxework.animate.Animate;
import ru.m.tankz.frame.StartFrame; import ru.m.tankz.frame.StartFrame;
import flash.ui.Keyboard; import flash.ui.Keyboard;
import flash.events.KeyboardEvent; import flash.events.KeyboardEvent;
import flash.text.Font; import flash.text.Font;
import haxework.gui.frame.IFrameSwitcher; import haxework.gui.frame.FrameSwitcher;
import haxework.gui.Root; import haxework.gui.Root;
import haxework.gui.VGroupView; import haxework.gui.VGroupView;
import haxework.log.TraceLogger; import haxework.log.TraceLogger;
@@ -26,6 +28,7 @@ class Client {
#end #end
Const.init(); Const.init();
Init.init(); Init.init();
Animate.bind(Lib.current.stage);
L.d(TAG, 'Debug: ${Const.DEBUG}'); L.d(TAG, 'Debug: ${Const.DEBUG}');
L.i(TAG, 'Version: ${Const.VERSION}'); L.i(TAG, 'Version: ${Const.VERSION}');
L.i(TAG, 'Build: ${Const.BUILD}'); L.i(TAG, 'Build: ${Const.BUILD}');
@@ -33,21 +36,20 @@ class Client {
var view:ClientView = new ClientView(); var view:ClientView = new ClientView();
Root.bind(view); Root.bind(view);
view.launch(); view.launch();
} }
} }
@:template class ClientView extends VGroupView { @:template class ClientView extends VGroupView {
private static inline var TAG = 'Tankz'; private static inline var TAG = 'Tankz';
@:view private var switcher(default, null):IFrameSwitcher; @:view private var switcher(default, null):FrameSwitcher;
@:provide var resources:IResources; @:provide var resources:IResources;
public function init():Void { public function init():Void {
var font:Font = Font.enumerateFonts()[0]; var font:Font = Font.enumerateFonts()[0];
resources.text.put('font', 'Bookman Old Style'); resources.text.put('font', 'Bookman Old Style');
resources.text.put('version', 'v${Const.VERSION} b${Const.BUILD}'); resources.text.put('version', 'v${Const.VERSION} b${Const.BUILD}');
Provider.set(IFrameSwitcher, switcher); Provider.set(FrameSwitcher, switcher);
} }
public function launch():Void { public function launch():Void {

View File

@@ -3,27 +3,32 @@ $type: haxework.gui.VGroupView
geometry.size.stretch: true geometry.size.stretch: true
layout.hAlign: center layout.hAlign: center
layout.vAlign: middle layout.vAlign: middle
skin: $r:skin:light skinId: light
views: views:
- id: switcher - id: switcher
$type: haxework.gui.frame.FrameSwitcher $type: haxework.gui.frame.FrameSwitcher
geometry.size.width: 960 animateFactory: { $class: haxework.animate.CircleMaskAnimate }
geometry.size.height: 720 geometry.size.width: 960
skin: $r:skin:dark geometry.size.height: 720
views: views:
- id: start - id: start
$type: ru.m.tankz.frame.StartFrame $type: ru.m.tankz.frame.StartFrame
# classic skinId: dark
- id: classic.level # classic
$type: ru.m.tankz.frame.classic.ClassicLevelFrame - id: classic.level
- id: classic.game $type: ru.m.tankz.frame.classic.ClassicLevelFrame
$type: ru.m.tankz.frame.classic.ClassicGameFrame skinId: dark
# dota - id: classic.game
- id: dota.level $type: ru.m.tankz.frame.classic.ClassicGameFrame
$type: ru.m.tankz.frame.dota.DotaLevelFrame # dota
- id: dota.game - id: dota.level
$type: ru.m.tankz.frame.dota.DotaGameFrame $type: ru.m.tankz.frame.dota.DotaLevelFrame
# - id: network skinId: dark
# $type: ru.m.tankz.frame.NetworkFrame - id: dota.game
- id: settings $type: ru.m.tankz.frame.dota.DotaGameFrame
$type: ru.m.tankz.frame.SettingsFrame # - id: network
# $type: ru.m.tankz.frame.NetworkFrame
# skinId: dark
- id: settings
$type: ru.m.tankz.frame.SettingsFrame
skinId: dark

View File

@@ -1,6 +1,6 @@
package ru.m.tankz.frame; package ru.m.tankz.frame;
import haxework.gui.frame.IFrameSwitcher; import haxework.gui.frame.FrameSwitcher;
import haxework.gui.ButtonView; import haxework.gui.ButtonView;
import haxework.gui.VGroupView; import haxework.gui.VGroupView;
@@ -8,7 +8,7 @@ import haxework.gui.VGroupView;
public static var ID(default, never):String = "settings"; public static var ID(default, never):String = "settings";
@:provide var frameSwitcher:IFrameSwitcher; @:provide var frameSwitcher:FrameSwitcher;
@:view var close:ButtonView; @:view var close:ButtonView;

View File

@@ -2,7 +2,7 @@
geometry.size.stretch: true geometry.size.stretch: true
views: views:
- $type: haxework.gui.LabelView - $type: haxework.gui.LabelView
skin: $r:skin:text skinId: text
geometry.size.percent.width: 100 geometry.size.percent.width: 100
geometry.size.fixed.height: 20 geometry.size.fixed.height: 20
text: Settings text: Settings
@@ -19,7 +19,7 @@ views:
controlIndex: 1 controlIndex: 1
- id: close - id: close
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
skin: $r:skin:button.close skinId: button.close
+onPress: $this:onPress +onPress: $this:onPress
geometry.position: absolute geometry.position: absolute
geometry.margin.left: 10 geometry.margin.left: 10

View File

@@ -3,7 +3,7 @@ package ru.m.tankz.frame;
import ru.m.tankz.frame.classic.ClassicLevelFrame; import ru.m.tankz.frame.classic.ClassicLevelFrame;
import ru.m.tankz.frame.dota.DotaLevelFrame; import ru.m.tankz.frame.dota.DotaLevelFrame;
import haxework.gui.ButtonView; import haxework.gui.ButtonView;
import haxework.gui.frame.IFrameSwitcher; import haxework.gui.frame.FrameSwitcher;
import haxework.gui.VGroupView; import haxework.gui.VGroupView;
import ru.m.tankz.storage.SaveStorage; import ru.m.tankz.storage.SaveStorage;
@@ -11,7 +11,7 @@ import ru.m.tankz.storage.SaveStorage;
public static var ID(default, never):String = "start"; public static var ID(default, never):String = "start";
@:provide var frameSwitcher:IFrameSwitcher; @:provide var frameSwitcher:FrameSwitcher;
@:provide var storage:SaveStorage; @:provide var storage:SaveStorage;
public function onPress(view:ButtonView):Void { public function onPress(view:ButtonView):Void {

View File

@@ -10,23 +10,23 @@ views:
views: views:
- id: classic - id: classic
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
skin: $r:skin:button skinId: button
+onPress: $this:onPress +onPress: $this:onPress
text: Classic text: Classic
- id: dota - id: dota
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
skin: $r:skin:button skinId: button
+onPress: $this:onPress +onPress: $this:onPress
text: DotA text: DotA
- id: network - id: network
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
skin: $r:skin:button skinId: button
+onPress: $this:onPress +onPress: $this:onPress
text: Network (in developing) text: Network (in developing)
fontColor: 0xff0000 fontColor: 0xff0000
visible: false visible: false
- $type: haxework.gui.LabelView - $type: haxework.gui.LabelView
skin: $r:skin:text skinId: text
geometry.position: absolute geometry.position: absolute
geometry.margin.right: 10 geometry.margin.right: 10
geometry.margin.bottom: 10 geometry.margin.bottom: 10

View File

@@ -8,11 +8,11 @@ views:
geometry.size.height: 20 geometry.size.height: 20
- id: player1state - id: player1state
$type: haxework.gui.LabelView $type: haxework.gui.LabelView
skin: $r:skin:text skinId: text
geometry.size.width: 100% geometry.size.width: 100%
geometry.size.height: 20 geometry.size.height: 20
- id: player2state - id: player2state
$type: haxework.gui.LabelView $type: haxework.gui.LabelView
skin: $r:skin:text skinId: text
geometry.size.width: 100% geometry.size.width: 100%
geometry.size.height: 20 geometry.size.height: 20

View File

@@ -1,7 +1,7 @@
package ru.m.tankz.frame.classic; package ru.m.tankz.frame.classic;
import haxework.gui.frame.FrameSwitcher;
import haxework.gui.DataView; import haxework.gui.DataView;
import haxework.gui.frame.IFrameSwitcher;
import haxework.gui.ToggleButtonView; import haxework.gui.ToggleButtonView;
import ru.m.tankz.config.Config; import ru.m.tankz.config.Config;
import ru.m.tankz.frame.common.LevelFrame; import ru.m.tankz.frame.common.LevelFrame;
@@ -13,7 +13,7 @@ import ru.m.tankz.preset.ClassicGame;
@:view var presets(default, null):DataView<GamePreset>; @:view var presets(default, null):DataView<GamePreset>;
@:view var levels(default, null):DataView<Int>; @:view var levels(default, null):DataView<Int>;
@:provide var frames:IFrameSwitcher; @:provide var frames:FrameSwitcher;
private function onShow():Void { private function onShow():Void {
gameType = ClassicGame.TYPE; gameType = ClassicGame.TYPE;

View File

@@ -3,7 +3,7 @@ package ru.m.tankz.frame.common;
import flash.events.Event; import flash.events.Event;
import haxe.ds.Option; import haxe.ds.Option;
import haxe.Timer; import haxe.Timer;
import haxework.gui.frame.IFrameSwitcher; import haxework.gui.frame.FrameSwitcher;
import haxework.gui.GroupView; import haxework.gui.GroupView;
import ru.m.tankz.frame.common.IGamePanel; import ru.m.tankz.frame.common.IGamePanel;
import ru.m.tankz.game.Game; import ru.m.tankz.game.Game;
@@ -24,7 +24,7 @@ class GameFrame extends GroupView {
@:provide var sound:SoundManager; @:provide var sound:SoundManager;
@:provide var state:GameState; @:provide var state:GameState;
@:provide var storage:SaveStorage; @:provide var storage:SaveStorage;
@:provide var switcher:IFrameSwitcher; @:provide var switcher:FrameSwitcher;
private var game:Game; private var game:Game;
private var timer:Timer; private var timer:Timer;

View File

@@ -5,7 +5,7 @@ geometry.margin: 5
views: views:
- id: label - id: label
$type: haxework.gui.LabelView $type: haxework.gui.LabelView
skin: $r:skin:text skinId: text
geometry.size.stretch: true geometry.size.stretch: true
text: "" text: ""
skin: skin:

View File

@@ -6,7 +6,7 @@ layout.margin: 10
views: views:
- id: index - id: index
$type: haxework.gui.LabelView $type: haxework.gui.LabelView
$style: label skinId: text
geometry.size.stretch: true geometry.size.stretch: true
skin: skin:
- $type: haxework.gui.skin.ColorSkin - $type: haxework.gui.skin.ColorSkin

View File

@@ -6,7 +6,7 @@ import flash.events.Event;
import haxe.ds.Option; import haxe.ds.Option;
import haxe.Timer; import haxe.Timer;
import haxework.gui.core.Geometry.Position; import haxework.gui.core.Geometry.Position;
import haxework.gui.frame.IFrameSwitcher; import haxework.gui.frame.FrameSwitcher;
import haxework.gui.VGroupView; import haxework.gui.VGroupView;
import ru.m.tankz.game.Game; import ru.m.tankz.game.Game;
import ru.m.tankz.game.GameState; import ru.m.tankz.game.GameState;
@@ -36,7 +36,7 @@ import ru.m.tankz.Type.GameType;
@:provide var sound:SoundManager; @:provide var sound:SoundManager;
@:provide var state:GameState; @:provide var state:GameState;
@:provide var storage:SaveStorage; @:provide var storage:SaveStorage;
@:provide var switcher:IFrameSwitcher; @:provide var switcher:FrameSwitcher;
private var game:Game; private var game:Game;
private var timer:Timer; private var timer:Timer;

View File

@@ -2,6 +2,6 @@
views: views:
- id: state - id: state
$type: haxework.gui.LabelView $type: haxework.gui.LabelView
skin: $r:skin:text skinId: text
geometry.size.width: 100% geometry.size.width: 100%
geometry.size.height: 20 geometry.size.height: 20

View File

@@ -1,7 +1,7 @@
package ru.m.tankz.frame.dota; package ru.m.tankz.frame.dota;
import haxework.gui.DataView; 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.LevelFrame;
import ru.m.tankz.frame.common.PlayerView; import ru.m.tankz.frame.common.PlayerView;
import ru.m.tankz.preset.DotaGame; import ru.m.tankz.preset.DotaGame;
@@ -13,7 +13,7 @@ import ru.m.tankz.Type;
@:view var levels(default, null):DataView<Int>; @:view var levels(default, null):DataView<Int>;
@:view var players(default, null):DataView<PlayerId>; @:view var players(default, null):DataView<PlayerId>;
@:provide var frames:IFrameSwitcher; @:provide var frames:FrameSwitcher;
private function onShow():Void { private function onShow():Void {
gameType = DotaGame.TYPE; gameType = DotaGame.TYPE;

View File

@@ -5,13 +5,13 @@ geometry.margin: 5
views: views:
- id: action - id: action
$type: haxework.gui.LabelView $type: haxework.gui.LabelView
skin: $r:skin:text skinId: text
geometry.size.width: 50% geometry.size.width: 50%
geometry.size.height: 100% geometry.size.height: 100%
text: "" text: ""
- id: key - id: key
$type: haxework.gui.LabelView $type: haxework.gui.LabelView
skin: $r:skin:text skinId: text
geometry.size.width: 50% geometry.size.width: 50%
geometry.size.height: 100% geometry.size.height: 100%
text: "" text: ""

View File

@@ -3,28 +3,28 @@ layout.hAlign: center
views: views:
- id: label - id: label
$type: haxework.gui.LabelView $type: haxework.gui.LabelView
skin: $r:skin:text skinId: text
- $type: haxework.gui.HGroupView - $type: haxework.gui.HGroupView
layout.margin: 10 layout.margin: 10
views: views:
- id: change - id: change
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
+onPress: $this:onPress +onPress: $this:onPress
skin: $r:skin:button.simple skinId: button.simple
text: Change text: Change
- id: clear - id: clear
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
+onPress: $this:onPress +onPress: $this:onPress
skin: $r:skin:button.simple skinId: button.simple
text: Clear text: Clear
- id: reset - id: reset
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
+onPress: $this:onPress +onPress: $this:onPress
skin: $r:skin:button.simple skinId: button.simple
text: Reset text: Reset
- id: list - id: list
$type: haxework.gui.list.VListView<ru.m.tankz.control.ActionItem> $type: haxework.gui.list.VListView<ru.m.tankz.control.ActionItem>
factory: { $class: ru.m.tankz.frame.settings.ActionView } factory: $code:function() return new ru.m.tankz.frame.settings.ActionView()
geometry.size.stretch: true geometry.size.stretch: true
scroll: scroll:
$type: haxework.gui.list.VScrollBarView $type: haxework.gui.list.VScrollBarView

View File

@@ -11,18 +11,18 @@ views:
views: views:
- id: level - id: level
$type: haxework.gui.ToggleButtonView $type: haxework.gui.ToggleButtonView
skin: $r:skin:button.toggle skinId: button.tab
text: Level text: Level
+onPress: $this:onPress +onPress: $this:onPress
- id: tank - id: tank
$type: haxework.gui.ToggleButtonView $type: haxework.gui.ToggleButtonView
skin: $r:skin:button.toggle skinId: button.tab
text: Tank text: Tank
+onPress: $this:onPress +onPress: $this:onPress
# Switcher # Switcher
- id: switcher - id: switcher
$type: haxework.gui.frame.FrameSwitcher $type: haxework.gui.frame.FrameSwitcher
skin: $r:skin:border skinId: border
+onSwitch: $this:onFrameSwitch +onSwitch: $this:onFrameSwitch
geometry.size.stretch: true geometry.size.stretch: true
geometry.padding: 5 geometry.padding: 5
@@ -33,7 +33,7 @@ views:
$type: ru.m.tankz.editor.frame.TankFrame $type: ru.m.tankz.editor.frame.TankFrame
# Version # Version
- $type: haxework.gui.LabelView - $type: haxework.gui.LabelView
skin: $r:skin:text skinId: text
geometry.position: absolute geometry.position: absolute
geometry.vAlign: bottom geometry.vAlign: bottom
geometry.hAlign: right geometry.hAlign: right

View File

@@ -9,24 +9,24 @@ views:
views: views:
- id: gameClassicButton - id: gameClassicButton
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
skin: $r:skin:button.simple skinId: button.simple
text: Classic text: Classic
+onPress: $this:onPress +onPress: $this:onPress
- id: gameDotaButton - id: gameDotaButton
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
skin: $r:skin:button.simple skinId: button.simple
text: DotA text: DotA
+onPress: $this:onPress +onPress: $this:onPress
- $type: haxework.gui.HGroupView - $type: haxework.gui.HGroupView
views: views:
- id: openButton - id: openButton
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
skin: $r:skin:button.simple skinId: button.simple
text: Open text: Open
+onPress: $this:onPress +onPress: $this:onPress
- id: saveButton - id: saveButton
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
skin: $r:skin:button.simple skinId: button.simple
text: Save text: Save
+onPress: $this:onPress +onPress: $this:onPress
- id: fileNameLabel - id: fileNameLabel
@@ -35,13 +35,13 @@ views:
views: views:
- id: spawnPointList - id: spawnPointList
$type: haxework.gui.list.VListView<SpawnPoint> $type: haxework.gui.list.VListView<SpawnPoint>
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.width: 56
geometry.size.height: 100% geometry.size.height: 100%
- id: mapView - id: mapView
$type: ru.m.tankz.editor.level.MapEditView $type: ru.m.tankz.editor.level.MapEditView
- id: brickList - id: brickList
$type: haxework.gui.list.VListView<BrickConfig> $type: haxework.gui.list.VListView<BrickConfig>
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.width: 30
geometry.size.height: 100% geometry.size.height: 100%

View File

@@ -9,6 +9,7 @@ import ru.m.tankz.config.Config;
class BrickView extends SpriteView implements IListItemView<BrickConfig> { class BrickView extends SpriteView implements IListItemView<BrickConfig> {
private static var size = 26;
public var item_index(default, default):Int; public var item_index(default, default):Int;
public var data(default, set):BrickConfig; public var data(default, set):BrickConfig;
@@ -19,8 +20,8 @@ class BrickView extends SpriteView implements IListItemView<BrickConfig> {
public function new() { public function new() {
super(); super();
setContentSize(26, 26); setContentSize(size, size);
selectView = createSelectView(geometry.size.content.width, geometry.size.content.height); selectView = createSelectView(size, size);
selectView.visible = false; selectView.visible = false;
content.addChild(selectView); content.addChild(selectView);
imageView = new Bitmap(); imageView = new Bitmap();

View File

@@ -11,6 +11,7 @@ import ru.m.tankz.editor.level.MapEditView;
class SpawnPointView extends SpriteView implements IListItemView<SpawnPoint> { class SpawnPointView extends SpriteView implements IListItemView<SpawnPoint> {
private static var size = 52;
public var item_index(default, default):Int; public var item_index(default, default):Int;
public var data(default, set):SpawnPoint; public var data(default, set):SpawnPoint;
@@ -21,8 +22,8 @@ class SpawnPointView extends SpriteView implements IListItemView<SpawnPoint> {
public function new() { public function new() {
super(); super();
setContentSize(52, 52); setContentSize(size, size);
selectView = createSelectView(geometry.size.content.width, geometry.size.content.height); selectView = createSelectView(size, size);
selectView.visible = false; selectView.visible = false;
content.addChild(selectView); content.addChild(selectView);
imageView = new Bitmap(); imageView = new Bitmap();