[client] apply LayoutSkin
This commit is contained in:
@@ -8,7 +8,6 @@ import flash.events.KeyboardEvent;
|
|||||||
import flash.text.Font;
|
import flash.text.Font;
|
||||||
import haxework.gui.frame.FrameSwitcher;
|
import haxework.gui.frame.FrameSwitcher;
|
||||||
import haxework.gui.Root;
|
import haxework.gui.Root;
|
||||||
import haxework.gui.VGroupView;
|
|
||||||
import haxework.log.TraceLogger;
|
import haxework.log.TraceLogger;
|
||||||
import haxework.provider.Provider;
|
import haxework.provider.Provider;
|
||||||
import haxework.resources.IResources;
|
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';
|
private static inline var TAG = 'Tankz';
|
||||||
|
|
||||||
@: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} (${Const.BUILD})');
|
resources.text.put('version', 'v${Const.VERSION} (${Const.BUILD})');
|
||||||
Provider.set(FrameSwitcher, switcher);
|
Provider.set(FrameSwitcher, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function launch():Void {
|
public function launch():Void {
|
||||||
content.stage.stageFocusRect = false;
|
content.stage.stageFocusRect = false;
|
||||||
content.stage.addEventListener(KeyboardEvent.KEY_UP, function(event:KeyboardEvent):Void {
|
content.stage.addEventListener(KeyboardEvent.KEY_UP, function(event:KeyboardEvent):Void {
|
||||||
if (event.keyCode == Keyboard.ESCAPE) {
|
if (event.keyCode == Keyboard.ESCAPE) {
|
||||||
switcher.change(StartFrame.ID);
|
change(StartFrame.ID);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
switcher.change(StartFrame.ID);
|
change(StartFrame.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,8 @@
|
|||||||
---
|
---
|
||||||
$type: haxework.gui.VGroupView
|
$type: haxework.gui.frame.FrameSwitcher
|
||||||
geometry.size.stretch: true
|
geometry.size.stretch: true
|
||||||
layout.hAlign: center
|
skinId: dark
|
||||||
layout.vAlign: middle
|
|
||||||
skinId: light
|
|
||||||
views:
|
views:
|
||||||
- id: switcher
|
|
||||||
$type: haxework.gui.frame.FrameSwitcher
|
|
||||||
skinId: dark
|
|
||||||
geometry.size.stretch: true
|
|
||||||
layout.hAlign: center
|
|
||||||
layout.vAlign: middle
|
|
||||||
views:
|
|
||||||
- id: start
|
- id: start
|
||||||
$type: ru.m.tankz.frame.StartFrame
|
$type: ru.m.tankz.frame.StartFrame
|
||||||
# classic
|
# classic
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package ru.m.tankz;
|
package ru.m.tankz;
|
||||||
|
|
||||||
|
import haxework.gui.layout.Layout;
|
||||||
import haxework.color.ColorUtil;
|
import haxework.color.ColorUtil;
|
||||||
import haxework.gui.core.Geometry;
|
import haxework.gui.core.Geometry;
|
||||||
import haxework.gui.core.HAlign;
|
import haxework.gui.core.HAlign;
|
||||||
@@ -18,10 +19,6 @@ class Style {
|
|||||||
private static var textColor = 0xE7E0BB;
|
private static var textColor = 0xE7E0BB;
|
||||||
private static var fontFamily = "Courirer New";
|
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() {
|
public static function register() {
|
||||||
resources.skin.put("light", [
|
resources.skin.put("light", [
|
||||||
Skin.color(lightColor),
|
Skin.color(lightColor),
|
||||||
@@ -69,16 +66,27 @@ class Style {
|
|||||||
Skin.size(64, 64),
|
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", [
|
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),
|
new ButtonSVGSkin(Assets.getText("resources/image/icon/cog-solid.svg"), lightColor),
|
||||||
]);
|
]);
|
||||||
resources.skin.put("button.close", [
|
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),
|
new ButtonSVGSkin(Assets.getText("resources/image/icon/times-circle-solid.svg"), lightColor),
|
||||||
]);
|
]);
|
||||||
resources.skin.put("button.next", [
|
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),
|
new ButtonSVGSkin(Assets.getText("resources/image/icon/arrow-alt-circle-right-solid.svg"), lightColor),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
---
|
---
|
||||||
geometry.size.stretch: true
|
|
||||||
layout.hAlign: center
|
|
||||||
layout.vAlign: middle
|
|
||||||
views:
|
views:
|
||||||
|
- $type: haxework.gui.VGroupView
|
||||||
|
skinId: container
|
||||||
|
views:
|
||||||
- id: level
|
- id: level
|
||||||
$type: haxework.gui.LabelView
|
$type: haxework.gui.LabelView
|
||||||
skinId: text.header
|
skinId: text.header
|
||||||
|
|
||||||
- id: result
|
- id: result
|
||||||
$type: haxework.gui.DataView
|
$type: haxework.gui.DataView
|
||||||
factory: $this:playerViewFactory
|
factory: $this:playerViewFactory
|
||||||
@@ -15,12 +14,15 @@ views:
|
|||||||
$type: haxework.gui.layout.VerticalLayout
|
$type: haxework.gui.layout.VerticalLayout
|
||||||
hAlign: right
|
hAlign: right
|
||||||
margin: 10
|
margin: 10
|
||||||
|
- $type: haxework.gui.HGroupView
|
||||||
|
skinId: panel
|
||||||
|
views:
|
||||||
- id: close
|
- id: close
|
||||||
$type: haxework.gui.ButtonView
|
$type: haxework.gui.ButtonView
|
||||||
skinId: button.close
|
skinId: button.close
|
||||||
+onPress: $code:close()
|
+onPress: $code:close()
|
||||||
|
- $type: haxework.gui.SpriteView
|
||||||
|
geometry.size.width: 100%
|
||||||
- id: next
|
- id: next
|
||||||
$type: haxework.gui.ButtonView
|
$type: haxework.gui.ButtonView
|
||||||
skinId: button.next
|
skinId: button.next
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
geometry.size.stretch: true
|
|
||||||
layout.hAlign: center
|
|
||||||
layout.vAlign: middle
|
|
||||||
views:
|
views:
|
||||||
|
- $type: haxework.gui.VGroupView
|
||||||
|
skinId: container
|
||||||
|
views:
|
||||||
- $type: haxework.gui.LabelView
|
- $type: haxework.gui.LabelView
|
||||||
skinId: text.header
|
skinId: text.header
|
||||||
text: Settings
|
text: Settings
|
||||||
@@ -13,6 +13,9 @@ views:
|
|||||||
controlIndex: 0
|
controlIndex: 0
|
||||||
- $type: ru.m.tankz.frame.settings.SettingsEditor
|
- $type: ru.m.tankz.frame.settings.SettingsEditor
|
||||||
controlIndex: 1
|
controlIndex: 1
|
||||||
|
- $type: haxework.gui.HGroupView
|
||||||
|
skinId: panel
|
||||||
|
views:
|
||||||
- id: close
|
- id: close
|
||||||
$type: haxework.gui.ButtonView
|
$type: haxework.gui.ButtonView
|
||||||
skinId: button.close
|
skinId: button.close
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
---
|
---
|
||||||
geometry.size.stretch: true
|
|
||||||
layout.hAlign: center
|
|
||||||
layout.vAlign: middle
|
|
||||||
views:
|
views:
|
||||||
|
- $type: haxework.gui.VGroupView
|
||||||
|
skinId: container
|
||||||
|
layout.margin: 3
|
||||||
|
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
|
||||||
geometry.margin.bottom: 15
|
geometry.margin.bottom: 15
|
||||||
- $type: haxework.gui.VGroupView
|
|
||||||
layout.margin: 3
|
|
||||||
views:
|
|
||||||
- id: classic
|
- id: classic
|
||||||
$type: haxework.gui.ButtonView
|
$type: haxework.gui.ButtonView
|
||||||
skinId: button
|
skinId: button
|
||||||
@@ -26,14 +24,15 @@ views:
|
|||||||
text: Network (in developing)
|
text: Network (in developing)
|
||||||
fontColor: 0xff0000
|
fontColor: 0xff0000
|
||||||
visible: false
|
visible: false
|
||||||
- $type: haxework.gui.LabelView
|
- $type: haxework.gui.HGroupView
|
||||||
skinId: text
|
skinId: panel
|
||||||
geometry.position: absolute
|
views:
|
||||||
geometry.margin: 10
|
|
||||||
geometry.vAlign: bottom
|
|
||||||
geometry.hAlign: right
|
|
||||||
text: $r:text:version
|
|
||||||
- id: settings
|
- id: settings
|
||||||
$type: haxework.gui.ButtonView
|
$type: haxework.gui.ButtonView
|
||||||
skinId: button.settings
|
skinId: button.settings
|
||||||
+onPress: $this:onPress
|
+onPress: $this:onPress
|
||||||
|
- $type: haxework.gui.SpriteView
|
||||||
|
geometry.size.width: 100%
|
||||||
|
- $type: haxework.gui.LabelView
|
||||||
|
skinId: text
|
||||||
|
text: $r:text:version
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
---
|
---
|
||||||
layout:
|
skinId: container
|
||||||
$type: haxework.gui.layout.HorizontalLayout
|
|
||||||
margin: 5
|
|
||||||
hAlign: center
|
|
||||||
vAlign: middle
|
|
||||||
views:
|
views:
|
||||||
|
- $type: haxework.gui.HGroupView
|
||||||
|
layout.margin: 5
|
||||||
|
views:
|
||||||
- id: render
|
- id: render
|
||||||
$type: ru.m.tankz.render.Render
|
$type: ru.m.tankz.render.Render
|
||||||
- id: panel
|
- id: panel
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
skinId: container
|
||||||
layout:
|
layout:
|
||||||
$type: haxework.gui.layout.VerticalLayout
|
$type: haxework.gui.layout.VerticalLayout
|
||||||
hAlign: center
|
|
||||||
views:
|
views:
|
||||||
- $type: haxework.gui.LabelView
|
- $type: haxework.gui.LabelView
|
||||||
skinId: text.header
|
skinId: text.header
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
---
|
---
|
||||||
layout:
|
skinId: container
|
||||||
$type: haxework.gui.layout.VerticalLayout
|
|
||||||
margin: 5
|
|
||||||
views:
|
views:
|
||||||
|
- $type: haxework.gui.VGroupView
|
||||||
|
layout.margin: 5
|
||||||
|
views:
|
||||||
- id: panel
|
- id: panel
|
||||||
$type: ru.m.tankz.frame.dota.DotaGamePanel
|
$type: ru.m.tankz.frame.dota.DotaGamePanel
|
||||||
- id: render
|
- id: render
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
skinId: container
|
||||||
layout:
|
layout:
|
||||||
$type: haxework.gui.layout.VerticalLayout
|
$type: haxework.gui.layout.VerticalLayout
|
||||||
hAlign: center
|
|
||||||
views:
|
views:
|
||||||
- $type: haxework.gui.LabelView
|
- $type: haxework.gui.LabelView
|
||||||
skinId: text.header
|
skinId: text.header
|
||||||
|
|||||||
@@ -2,18 +2,9 @@ package ru.m.tankz.preset;
|
|||||||
|
|
||||||
import ru.m.tankz.Type;
|
import ru.m.tankz.Type;
|
||||||
|
|
||||||
|
class ClassicGame {
|
||||||
class ClassicGame extends GamePreset {
|
|
||||||
|
|
||||||
public static var TYPE(default, never):GameType = 'classic';
|
public static var TYPE(default, never):GameType = 'classic';
|
||||||
|
|
||||||
public static var HUMAN(default, never):TeamId = 'human';
|
public static var HUMAN(default, never):TeamId = 'human';
|
||||||
public static var BOT(default, never):TeamId = 'bot';
|
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]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,19 +2,9 @@ package ru.m.tankz.preset;
|
|||||||
|
|
||||||
import ru.m.tankz.Type;
|
import ru.m.tankz.Type;
|
||||||
|
|
||||||
|
class DotaGame {
|
||||||
class DotaGame extends GamePreset {
|
|
||||||
|
|
||||||
public static var TYPE(default, never):GameType = 'dota';
|
public static var TYPE(default, never):GameType = 'dota';
|
||||||
|
|
||||||
public static var RADIANT(default, never):TeamId = 'radiant';
|
public static var RADIANT(default, never):TeamId = 'radiant';
|
||||||
public static var DIRE(default, never):TeamId = 'dire';
|
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]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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<TeamId>;
|
|
||||||
public var presets(default, null):Array<PresetId>;
|
|
||||||
|
|
||||||
public function new(type:GameType, teams:Array<TeamId>, presets:Array<PresetId>) {
|
|
||||||
this.type = type;
|
|
||||||
this.teams = teams;
|
|
||||||
this.presets = presets;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user