[client] update haxework. ep2
This commit is contained in:
@@ -12,10 +12,10 @@ views:
|
||||
views:
|
||||
- id: start
|
||||
$type: ru.m.tankz.frame.StartFrame
|
||||
# - id: level
|
||||
# $type: ru.m.tankz.frame.StartGameFrame
|
||||
# - id: game
|
||||
# $type: ru.m.tankz.frame.GameFrame
|
||||
- id: level
|
||||
$type: ru.m.tankz.frame.StartGameFrame
|
||||
- id: game
|
||||
$type: ru.m.tankz.frame.GameFrame
|
||||
# - id: network
|
||||
# $type: ru.m.tankz.frame.NetworkFrame
|
||||
- id: settings
|
||||
|
||||
@@ -2,7 +2,6 @@ package ru.m.tankz;
|
||||
|
||||
import ru.m.skin.SimpleButtonSkin;
|
||||
import haxework.gui.skin.Skin;
|
||||
import haxework.gui.skin.TextSkin;
|
||||
import haxework.gui.skin.ButtonBitmapSkin;
|
||||
import haxework.gui.utils.DrawUtil;
|
||||
import haxework.resources.IResources;
|
||||
@@ -15,22 +14,26 @@ class Style {
|
||||
private static var lightColor = 0x95937D;
|
||||
private static var darkColor = 0x777564;
|
||||
private static var textColor = 0xE7E0BB;
|
||||
private static var fontFamily = "Courirer New";
|
||||
|
||||
public static function register() {
|
||||
var text = new TextSkin(textColor, "Courirer New");
|
||||
//text.fontSize = 18; // ToDo:
|
||||
var button = new ButtonBitmapSkin();
|
||||
button.fillType = FillType.NINEPATH;
|
||||
button.upImage = Assets.getBitmapData("resources/image/ui/button/normal.png");
|
||||
button.downImage = Assets.getBitmapData("resources/image/ui/button/down.png");
|
||||
button.overImage = Assets.getBitmapData("resources/image/ui/button/over.png");
|
||||
|
||||
resources.skin.put("light", [Skin.color(lightColor)]);
|
||||
resources.skin.put("dark", [Skin.color(darkColor)]);
|
||||
resources.skin.put("text", [text]);
|
||||
resources.skin.put("button", [button, text]);
|
||||
resources.skin.put("text", [Skin.text(textColor, 16, fontFamily)]);
|
||||
resources.skin.put("button", [button, Skin.text(textColor, 18, fontFamily), Skin.size(250, 60)]);
|
||||
resources.skin.put("button.simple", [
|
||||
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"))
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,4 +21,11 @@ views:
|
||||
controlIndex: 1
|
||||
- id: close
|
||||
$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
|
||||
|
||||
@@ -37,6 +37,6 @@ import ru.m.tankz.Type;
|
||||
|
||||
private function startGame(type:GameType, presetId:PresetId):Void {
|
||||
state = new GameState(type, presetId);
|
||||
//frameSwitcher.change(StartGameFrame.ID);
|
||||
frameSwitcher.change(StartGameFrame.ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@ pHeight: 100
|
||||
views:
|
||||
- $type: haxework.gui.ImageView
|
||||
image: $asset:image:resources/image/ui/logo.png
|
||||
width: 367
|
||||
height: 157
|
||||
contentSize: true
|
||||
bottomMargin: 15
|
||||
- $type: haxework.gui.VGroupView
|
||||
contentSize: true
|
||||
@@ -14,24 +13,19 @@ views:
|
||||
$type: haxework.gui.ButtonView
|
||||
skin: $r:skin:button
|
||||
+onPress: $this:onPress
|
||||
width: 250
|
||||
height: 60
|
||||
text: Classic
|
||||
- id: dota
|
||||
$type: haxework.gui.ButtonView
|
||||
skin: $r:skin:button
|
||||
+onPress: $this:onPress
|
||||
width: 250
|
||||
height: 60
|
||||
text: DotA
|
||||
- id: network
|
||||
$type: haxework.gui.ButtonView
|
||||
skin: $r:skin:button
|
||||
+onPress: $this:onPress
|
||||
width: 250
|
||||
height: 60
|
||||
text: Network (in developing)
|
||||
fontColor: 0xff0000
|
||||
visible: false
|
||||
- $type: haxework.gui.LabelView
|
||||
skin: $r:skin:text
|
||||
inLayout: false
|
||||
@@ -48,8 +42,7 @@ views:
|
||||
vAlign: BOTTOM
|
||||
leftMargin: 10
|
||||
bottomMargin: 10
|
||||
width: 64
|
||||
height: 64
|
||||
contentSize: true
|
||||
skin:
|
||||
- $type: haxework.gui.skin.ButtonBitmapSkin
|
||||
image: $asset:image:resources/image/ui/settings.png
|
||||
|
||||
@@ -30,7 +30,6 @@ import ru.m.tankz.Type;
|
||||
private var preset:GamePreset;
|
||||
|
||||
public function init():Void {
|
||||
levels.dispatcher.addListener(this);
|
||||
presets.change.connect(function(presetId) this.presetId = presetId);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,28 +17,21 @@ views:
|
||||
pHeight: 100
|
||||
paddings: 10
|
||||
scroll:
|
||||
$type: haxework.gui.list.VScrollView
|
||||
$type: haxework.gui.list.VScrollBarView
|
||||
width: 10
|
||||
pHeight: 100
|
||||
skin:
|
||||
$type: haxework.gui.list.VScrollSkin
|
||||
skin:
|
||||
$type: haxework.gui.skin.ColorSkin
|
||||
color: 0x000000
|
||||
alpha: 0
|
||||
- $type: [haxework.gui.list.ScrollBarSkin.vertical]
|
||||
- id: levels
|
||||
$type: haxework.gui.list.VListView<Int>
|
||||
factory: { $class: ru.m.tankz.frame.start.LevelView }
|
||||
+onItemSelect: $this:onListItemClick
|
||||
pWidth: 50
|
||||
pHeight: 100
|
||||
paddings: 10
|
||||
scroll:
|
||||
$type: haxework.gui.list.VScrollView
|
||||
$type: haxework.gui.list.VScrollBarView
|
||||
width: 10
|
||||
pHeight: 100
|
||||
skin:
|
||||
$type: haxework.gui.list.VScrollSkin
|
||||
skin:
|
||||
$type: haxework.gui.skin.ColorSkin
|
||||
color: "#000000"
|
||||
alpha: 0
|
||||
- $type: [haxework.gui.list.ScrollBarSkin.vertical]
|
||||
|
||||
@@ -3,6 +3,6 @@ package ru.m.tankz.frame.game;
|
||||
import ru.m.tankz.game.Game;
|
||||
import haxework.gui.IView;
|
||||
|
||||
interface IGamePanel extends IView {
|
||||
interface IGamePanel extends IView<Dynamic> {
|
||||
public var game:Game;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class KeyboardMap {
|
||||
|
||||
@: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;
|
||||
|
||||
@:view var action(default, null):LabelView;
|
||||
@@ -55,11 +55,6 @@ class KeyboardMap {
|
||||
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 {
|
||||
data = value;
|
||||
action.text = actionLabel(data.action);
|
||||
|
||||
@@ -11,22 +11,16 @@ views:
|
||||
$type: haxework.gui.ButtonView
|
||||
+onPress: $this:onPress
|
||||
skin: $r:skin:button.simple
|
||||
width: 100
|
||||
height: 36
|
||||
text: Change
|
||||
- id: clear
|
||||
$type: haxework.gui.ButtonView
|
||||
+onPress: $this:onPress
|
||||
skin: $r:skin:button.simple
|
||||
width: 100
|
||||
height: 36
|
||||
text: Clear
|
||||
- id: reset
|
||||
$type: haxework.gui.ButtonView
|
||||
+onPress: $this:onPress
|
||||
skin: $r:skin:button.simple
|
||||
width: 100
|
||||
height: 36
|
||||
text: Reset
|
||||
- id: list
|
||||
$type: haxework.gui.list.VListView<ru.m.tankz.control.ActionItem>
|
||||
|
||||
@@ -10,6 +10,6 @@ views:
|
||||
pHeight: 100
|
||||
text: ""
|
||||
skin:
|
||||
$type: haxework.gui.skin.ColorSkin
|
||||
color: 0x000000
|
||||
alpha: 0.2
|
||||
- $type: haxework.gui.skin.ColorSkin
|
||||
color: 0x000000
|
||||
alpha: 0.2
|
||||
|
||||
@@ -26,7 +26,7 @@ import ru.m.tankz.Type;
|
||||
@:provide var configBundle:IConfigBundle;
|
||||
|
||||
private function init():Void {
|
||||
control.onPress = this;
|
||||
control.onPress.connect(onPress);
|
||||
}
|
||||
|
||||
private function set_data(value:PlayerId):PlayerId {
|
||||
@@ -51,7 +51,7 @@ import ru.m.tankz.Type;
|
||||
}
|
||||
indexLabel.fontColor = cast color;
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -66,4 +66,4 @@ import ru.m.tankz.Type;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ views:
|
||||
pHeight: 100
|
||||
pWidth: 100
|
||||
skin:
|
||||
$type: haxework.gui.skin.ColorSkin
|
||||
color: 0x000000
|
||||
alpha: 0.2
|
||||
- $type: haxework.gui.skin.ColorSkin
|
||||
color: 0x000000
|
||||
alpha: 0.2
|
||||
shadow: true
|
||||
shadowColor: 0x000000
|
||||
- id: control
|
||||
|
||||
@@ -29,8 +29,8 @@ class PresetsView extends HGroupView {
|
||||
removeAllViews();
|
||||
for (item in data) {
|
||||
var view = new ToggleButtonView();
|
||||
view.skin = new SimpleButtonSkin();
|
||||
view.onSkin = new SimpleButtonSkin(0x00ff00);
|
||||
view.skin = [new SimpleButtonSkin()];
|
||||
view.onSkin = [new SimpleButtonSkin(0x00ff00)];
|
||||
view.text = item.id;
|
||||
view.width = 250;
|
||||
view.height = 36;
|
||||
@@ -38,7 +38,7 @@ class PresetsView extends HGroupView {
|
||||
view.fontColor = 0xffffff;
|
||||
view.fontSize = 18;
|
||||
view.shadowColor = 0x000000;
|
||||
view.onPress = this;
|
||||
view.onPress.connect(onPress);
|
||||
view.update();
|
||||
addView(view);
|
||||
}
|
||||
|
||||
@@ -37,11 +37,11 @@ class Render extends SpriteView {
|
||||
entryLayer = new Sprite();
|
||||
upLayer = new Sprite();
|
||||
upperLayer = new Sprite();
|
||||
contentAsSprite.addChild(backgroundLayer);
|
||||
contentAsSprite.addChild(groundLayer);
|
||||
contentAsSprite.addChild(entryLayer);
|
||||
contentAsSprite.addChild(upLayer);
|
||||
contentAsSprite.addChild(upperLayer);
|
||||
content.addChild(backgroundLayer);
|
||||
content.addChild(groundLayer);
|
||||
content.addChild(entryLayer);
|
||||
content.addChild(upLayer);
|
||||
content.addChild(upperLayer);
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user