[client] update haxework. ep2

This commit is contained in:
2019-02-25 17:38:14 +03:00
parent 2aa1c82aea
commit e3d3359019
17 changed files with 54 additions and 69 deletions

View File

@@ -34,7 +34,7 @@ const config = new Project.Config({
meta: { meta: {
title: 'Tank\'z', title: 'Tank\'z',
filename: 'tankz', filename: 'tankz',
icon: 'resources/images/tank/player/tank_p3_0-0.png', icon: 'src/client/resources/image/tank/pd-0.png',
pack: 'ru.m.tankz', pack: 'ru.m.tankz',
author: 'shmyga <shmyga.z@gmail.com>', author: 'shmyga <shmyga.z@gmail.com>',
company: 'MegaLoMania', company: 'MegaLoMania',
@@ -49,7 +49,7 @@ const config = new Project.Config({
'src/common/resources' 'src/common/resources'
], ],
macros: [ macros: [
'yield.parser.Parser.auto()', // ToDo: bug with extraParams.hxml in yield library //'yield.parser.Parser.auto()', // ToDo: bug with extraParams.hxml in yield library
`CompilationOption.set('build','${dateformat(new Date(), 'yyyy-mm-dd HH:MM:ss')}')`, `CompilationOption.set('build','${dateformat(new Date(), 'yyyy-mm-dd HH:MM:ss')}')`,
] ]
}); });
@@ -71,6 +71,7 @@ const client = new Project(
main: 'ru.m.tankz.Client', main: 'ru.m.tankz.Client',
assets: ['src/client/resources'], assets: ['src/client/resources'],
//flags: ['bitmap_text'], //flags: ['bitmap_text'],
flags: ['dom'],
}), }),
module.exports.generate module.exports.generate
).bind(module, gulp); ).bind(module, gulp);

View File

@@ -10,8 +10,8 @@
}, },
"haxeDependencies": { "haxeDependencies": {
"haxework": "git", "haxework": "git",
"lime": "7.1.1", "lime": "7.2.1",
"openfl": "8.5.1", "openfl": "8.8.0",
"hxcpp": "4.0.4", "hxcpp": "4.0.4",
"promhx": "1.1.0", "promhx": "1.1.0",
"protohx": "0.4.6", "protohx": "0.4.6",

View File

@@ -12,10 +12,10 @@ views:
views: views:
- id: start - id: start
$type: ru.m.tankz.frame.StartFrame $type: ru.m.tankz.frame.StartFrame
# - id: level - id: level
# $type: ru.m.tankz.frame.StartGameFrame $type: ru.m.tankz.frame.StartGameFrame
# - id: game - id: game
# $type: ru.m.tankz.frame.GameFrame $type: ru.m.tankz.frame.GameFrame
# - id: network # - id: network
# $type: ru.m.tankz.frame.NetworkFrame # $type: ru.m.tankz.frame.NetworkFrame
- id: settings - id: settings

View File

@@ -2,7 +2,6 @@ package ru.m.tankz;
import ru.m.skin.SimpleButtonSkin; import ru.m.skin.SimpleButtonSkin;
import haxework.gui.skin.Skin; import haxework.gui.skin.Skin;
import haxework.gui.skin.TextSkin;
import haxework.gui.skin.ButtonBitmapSkin; import haxework.gui.skin.ButtonBitmapSkin;
import haxework.gui.utils.DrawUtil; import haxework.gui.utils.DrawUtil;
import haxework.resources.IResources; import haxework.resources.IResources;
@@ -15,22 +14,26 @@ class Style {
private static var lightColor = 0x95937D; private static var lightColor = 0x95937D;
private static var darkColor = 0x777564; private static var darkColor = 0x777564;
private static var textColor = 0xE7E0BB; private static var textColor = 0xE7E0BB;
private static var fontFamily = "Courirer New";
public static function register() { public static function register() {
var text = new TextSkin(textColor, "Courirer New");
//text.fontSize = 18; // ToDo:
var button = new ButtonBitmapSkin(); var button = new ButtonBitmapSkin();
button.fillType = FillType.NINEPATH; button.fillType = FillType.NINEPATH;
button.upImage = Assets.getBitmapData("resources/image/ui/button/normal.png"); button.upImage = Assets.getBitmapData("resources/image/ui/button/normal.png");
button.downImage = Assets.getBitmapData("resources/image/ui/button/down.png"); button.downImage = Assets.getBitmapData("resources/image/ui/button/down.png");
button.overImage = Assets.getBitmapData("resources/image/ui/button/over.png"); button.overImage = Assets.getBitmapData("resources/image/ui/button/over.png");
resources.skin.put("light", [Skin.color(lightColor)]); resources.skin.put("light", [Skin.color(lightColor)]);
resources.skin.put("dark", [Skin.color(darkColor)]); resources.skin.put("dark", [Skin.color(darkColor)]);
resources.skin.put("text", [text]); resources.skin.put("text", [Skin.text(textColor, 16, fontFamily)]);
resources.skin.put("button", [button, text]); resources.skin.put("button", [button, Skin.text(textColor, 18, fontFamily), Skin.size(250, 60)]);
resources.skin.put("button.simple", [ resources.skin.put("button.simple", [
new SimpleButtonSkin(lightColor, textColor), new SimpleButtonSkin(lightColor, textColor),
text Skin.text(textColor, 16, fontFamily),
Skin.size(100, 36),
]);
resources.skin.put("button.close", [
new ButtonBitmapSkin(Assets.getBitmapData("resources/image/ui/close.png"))
]); ]);
} }
} }

View File

@@ -21,4 +21,11 @@ views:
controlIndex: 1 controlIndex: 1
- id: close - id: close
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
$style: close skin: $r:skin:button.close
+onPress: $this:onPress
inLayout: false
hAlign: LEFT
vAlign: BOTTOM
leftMargin: 10
bottomMargin: 10
contentSize: true

View File

@@ -37,6 +37,6 @@ import ru.m.tankz.Type;
private function startGame(type:GameType, presetId:PresetId):Void { private function startGame(type:GameType, presetId:PresetId):Void {
state = new GameState(type, presetId); state = new GameState(type, presetId);
//frameSwitcher.change(StartGameFrame.ID); frameSwitcher.change(StartGameFrame.ID);
} }
} }

View File

@@ -4,8 +4,7 @@ pHeight: 100
views: views:
- $type: haxework.gui.ImageView - $type: haxework.gui.ImageView
image: $asset:image:resources/image/ui/logo.png image: $asset:image:resources/image/ui/logo.png
width: 367 contentSize: true
height: 157
bottomMargin: 15 bottomMargin: 15
- $type: haxework.gui.VGroupView - $type: haxework.gui.VGroupView
contentSize: true contentSize: true
@@ -14,24 +13,19 @@ views:
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
skin: $r:skin:button skin: $r:skin:button
+onPress: $this:onPress +onPress: $this:onPress
width: 250
height: 60
text: Classic text: Classic
- id: dota - id: dota
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
skin: $r:skin:button skin: $r:skin:button
+onPress: $this:onPress +onPress: $this:onPress
width: 250
height: 60
text: DotA text: DotA
- id: network - id: network
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
skin: $r:skin:button skin: $r:skin:button
+onPress: $this:onPress +onPress: $this:onPress
width: 250
height: 60
text: Network (in developing) text: Network (in developing)
fontColor: 0xff0000 fontColor: 0xff0000
visible: false
- $type: haxework.gui.LabelView - $type: haxework.gui.LabelView
skin: $r:skin:text skin: $r:skin:text
inLayout: false inLayout: false
@@ -48,8 +42,7 @@ views:
vAlign: BOTTOM vAlign: BOTTOM
leftMargin: 10 leftMargin: 10
bottomMargin: 10 bottomMargin: 10
width: 64 contentSize: true
height: 64
skin: skin:
- $type: haxework.gui.skin.ButtonBitmapSkin - $type: haxework.gui.skin.ButtonBitmapSkin
image: $asset:image:resources/image/ui/settings.png image: $asset:image:resources/image/ui/settings.png

View File

@@ -30,7 +30,6 @@ import ru.m.tankz.Type;
private var preset:GamePreset; private var preset:GamePreset;
public function init():Void { public function init():Void {
levels.dispatcher.addListener(this);
presets.change.connect(function(presetId) this.presetId = presetId); presets.change.connect(function(presetId) this.presetId = presetId);
} }

View File

@@ -17,28 +17,21 @@ views:
pHeight: 100 pHeight: 100
paddings: 10 paddings: 10
scroll: scroll:
$type: haxework.gui.list.VScrollView $type: haxework.gui.list.VScrollBarView
width: 10 width: 10
pHeight: 100 pHeight: 100
skin: skin:
$type: haxework.gui.list.VScrollSkin - $type: [haxework.gui.list.ScrollBarSkin.vertical]
skin:
$type: haxework.gui.skin.ColorSkin
color: 0x000000
alpha: 0
- id: levels - id: levels
$type: haxework.gui.list.VListView<Int> $type: haxework.gui.list.VListView<Int>
factory: { $class: ru.m.tankz.frame.start.LevelView } factory: { $class: ru.m.tankz.frame.start.LevelView }
+onItemSelect: $this:onListItemClick
pWidth: 50 pWidth: 50
pHeight: 100 pHeight: 100
paddings: 10 paddings: 10
scroll: scroll:
$type: haxework.gui.list.VScrollView $type: haxework.gui.list.VScrollBarView
width: 10 width: 10
pHeight: 100 pHeight: 100
skin: skin:
$type: haxework.gui.list.VScrollSkin - $type: [haxework.gui.list.ScrollBarSkin.vertical]
skin:
$type: haxework.gui.skin.ColorSkin
color: "#000000"
alpha: 0

View File

@@ -3,6 +3,6 @@ package ru.m.tankz.frame.game;
import ru.m.tankz.game.Game; import ru.m.tankz.game.Game;
import haxework.gui.IView; import haxework.gui.IView;
interface IGamePanel extends IView { interface IGamePanel extends IView<Dynamic> {
public var game:Game; public var game:Game;
} }

View File

@@ -39,7 +39,7 @@ class KeyboardMap {
@:template class ActionView extends HGroupView implements IListItemView<ActionItem> { @:template class ActionView extends HGroupView implements IListItemView<ActionItem> {
public var item_index(default, set):Int; public var item_index(default, default):Int;
public var data(default, set):ActionItem; public var data(default, set):ActionItem;
@:view var action(default, null):LabelView; @:view var action(default, null):LabelView;
@@ -55,11 +55,6 @@ class KeyboardMap {
return KeyboardMap.getName(key); return KeyboardMap.getName(key);
} }
private function set_item_index(value:Int):Int {
item_index = value;
return item_index;
}
private function set_data(value:ActionItem):ActionItem { private function set_data(value:ActionItem):ActionItem {
data = value; data = value;
action.text = actionLabel(data.action); action.text = actionLabel(data.action);

View File

@@ -11,22 +11,16 @@ views:
$type: haxework.gui.ButtonView $type: haxework.gui.ButtonView
+onPress: $this:onPress +onPress: $this:onPress
skin: $r:skin:button.simple skin: $r:skin:button.simple
width: 100
height: 36
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 skin: $r:skin:button.simple
width: 100
height: 36
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 skin: $r:skin:button.simple
width: 100
height: 36
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>

View File

@@ -10,6 +10,6 @@ views:
pHeight: 100 pHeight: 100
text: "" text: ""
skin: skin:
$type: haxework.gui.skin.ColorSkin - $type: haxework.gui.skin.ColorSkin
color: 0x000000 color: 0x000000
alpha: 0.2 alpha: 0.2

View File

@@ -26,7 +26,7 @@ import ru.m.tankz.Type;
@:provide var configBundle:IConfigBundle; @:provide var configBundle:IConfigBundle;
private function init():Void { private function init():Void {
control.onPress = this; control.onPress.connect(onPress);
} }
private function set_data(value:PlayerId):PlayerId { private function set_data(value:PlayerId):PlayerId {
@@ -51,7 +51,7 @@ import ru.m.tankz.Type;
} }
indexLabel.fontColor = cast color; indexLabel.fontColor = cast color;
var controlType = state.control.get(value); var controlType = state.control.get(value);
control.skin = new ButtonBitmapSkin(Assets.getBitmapData('resources/image/ui/control/${controlType}.png')); control.skin = [new ButtonBitmapSkin(Assets.getBitmapData('resources/image/ui/control/${controlType}.png'))];
return data; return data;
} }

View File

@@ -10,7 +10,7 @@ views:
pHeight: 100 pHeight: 100
pWidth: 100 pWidth: 100
skin: skin:
$type: haxework.gui.skin.ColorSkin - $type: haxework.gui.skin.ColorSkin
color: 0x000000 color: 0x000000
alpha: 0.2 alpha: 0.2
shadow: true shadow: true

View File

@@ -29,8 +29,8 @@ class PresetsView extends HGroupView {
removeAllViews(); removeAllViews();
for (item in data) { for (item in data) {
var view = new ToggleButtonView(); var view = new ToggleButtonView();
view.skin = new SimpleButtonSkin(); view.skin = [new SimpleButtonSkin()];
view.onSkin = new SimpleButtonSkin(0x00ff00); view.onSkin = [new SimpleButtonSkin(0x00ff00)];
view.text = item.id; view.text = item.id;
view.width = 250; view.width = 250;
view.height = 36; view.height = 36;
@@ -38,7 +38,7 @@ class PresetsView extends HGroupView {
view.fontColor = 0xffffff; view.fontColor = 0xffffff;
view.fontSize = 18; view.fontSize = 18;
view.shadowColor = 0x000000; view.shadowColor = 0x000000;
view.onPress = this; view.onPress.connect(onPress);
view.update(); view.update();
addView(view); addView(view);
} }

View File

@@ -37,11 +37,11 @@ class Render extends SpriteView {
entryLayer = new Sprite(); entryLayer = new Sprite();
upLayer = new Sprite(); upLayer = new Sprite();
upperLayer = new Sprite(); upperLayer = new Sprite();
contentAsSprite.addChild(backgroundLayer); content.addChild(backgroundLayer);
contentAsSprite.addChild(groundLayer); content.addChild(groundLayer);
contentAsSprite.addChild(entryLayer); content.addChild(entryLayer);
contentAsSprite.addChild(upLayer); content.addChild(upLayer);
contentAsSprite.addChild(upperLayer); content.addChild(upperLayer);
reset(); reset();
} }