[client] yaml layouts
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"views": [
|
||||
{
|
||||
"id": "state", "@type": "haxework.gui.LabelView", "@style": "label",
|
||||
"pWidth": 100, "height": 20
|
||||
},
|
||||
{
|
||||
"id": "render", "@type": "ru.m.tankz.render.Render",
|
||||
"contentSize": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"views": [
|
||||
{
|
||||
"id":"levels", "@type":"haxework.gui.list.VListView<Int>",
|
||||
"factory": "@class:ru.m.tankz.view.frames.list.LevelView",
|
||||
"pWidth":100,
|
||||
"pHeight":100,
|
||||
"paddings":10,
|
||||
"scroll":{
|
||||
"@type":"haxework.gui.list.VScrollView",
|
||||
"width":10, "pHeight":100,
|
||||
"skin":{"@type":"haxework.gui.list.VScrollSkin"}
|
||||
},
|
||||
"skin": {
|
||||
"@type": "haxework.gui.skin.ColorSkin",
|
||||
"color": "0x000000", "alpha": 0.0
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
{
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"views": [
|
||||
{
|
||||
"@type": "haxework.gui.ImageView",
|
||||
"image": "@asset:image:resources/images/logo/logo.png",
|
||||
"contentSize": true, "bottomMargin": 15
|
||||
},
|
||||
{
|
||||
"@type": "haxework.gui.LabelView", "@style": "label",
|
||||
"fontSize": 20, "topMargin": 15,
|
||||
"contentSize": true,
|
||||
"text": "Classic"
|
||||
},
|
||||
{
|
||||
"id": "classic_1p",
|
||||
"@type": "haxework.gui.ButtonView",
|
||||
"text": "1 Player",
|
||||
"@style": "button"
|
||||
},
|
||||
{
|
||||
"id": "classic_2p",
|
||||
"@type": "haxework.gui.ButtonView",
|
||||
"text": "2 Player",
|
||||
"@style": "button"
|
||||
},
|
||||
{
|
||||
"@type": "haxework.gui.LabelView", "@style": "label",
|
||||
"fontSize": 20, "topMargin": 15,
|
||||
"contentSize": true,
|
||||
"text": "DotA"
|
||||
},
|
||||
{
|
||||
"id": "dota_1p",
|
||||
"@type": "haxework.gui.ButtonView",
|
||||
"text": "1 Player",
|
||||
"@style": "button"
|
||||
},
|
||||
{
|
||||
"id": "dota_2p_coop",
|
||||
"@type": "haxework.gui.ButtonView",
|
||||
"text": "2 COOP",
|
||||
"@style": "button"
|
||||
},
|
||||
{
|
||||
"id": "dota_2p_vs",
|
||||
"@type": "haxework.gui.ButtonView",
|
||||
"text": "2 VS",
|
||||
"@style": "button"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"@type": "haxework.gui.VGroupView",
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"views": [
|
||||
{
|
||||
"id": "switcher", "@type": "haxework.gui.frame.FrameSwitcher",
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"skin": {
|
||||
"@type": "haxework.gui.skin.BitmapSkin",
|
||||
"image": "@asset:image:resources/images/background.png",
|
||||
"fillType": "REPEAT"
|
||||
},
|
||||
"views": [
|
||||
{
|
||||
"id": "start",
|
||||
"@type": "ru.m.tankz.view.frames.StartFrame"
|
||||
},
|
||||
{
|
||||
"id": "level",
|
||||
"@type": "ru.m.tankz.view.frames.LevelFrame"
|
||||
},
|
||||
{
|
||||
"id": "game",
|
||||
"@type": "ru.m.tankz.view.frames.GameFrame"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"@type": "haxework.gui.LabelView",
|
||||
"inLayout": false,
|
||||
"contentSize": true,
|
||||
"vAlign": "BOTTOM",
|
||||
"hAlign": "RIGHT",
|
||||
"text": "@res:text:version",
|
||||
"@style": "label"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"level": {
|
||||
"width": 440, "height": 44,
|
||||
"margins": 5,
|
||||
"views": [
|
||||
{
|
||||
"id": "label",
|
||||
"@type": "haxework.gui.LabelView",
|
||||
"pWidth": 100, "pHeight": 100, "text": "",
|
||||
"@style": "label"
|
||||
}
|
||||
],
|
||||
"skin": {
|
||||
"@type": "haxework.gui.skin.ColorSkin",
|
||||
"color": "0x000000", "alpha": 0.2
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
{
|
||||
"button": {
|
||||
"width":250, "height":60,
|
||||
"skin": {
|
||||
"@type": "haxework.gui.skin.ButtonBitmapSkin",
|
||||
"upImage": "@asset:image:resources/images/control/button_normal.png",
|
||||
"downImage": "@asset:image:resources/images/control/button_down.png",
|
||||
"overImage": "@asset:image:resources/images/control/button_over.png",
|
||||
"fillType": "NINEPATH"
|
||||
},
|
||||
"fontFamily":"@res:text:font", "fontEmbed":true, "fontColor":"0xE7E0BB", "fontSize":20
|
||||
},
|
||||
|
||||
"label": {
|
||||
"fontColor": "0xffffff",
|
||||
"fontEmbed": false,
|
||||
"fontFamily": "@res:text:fontName",
|
||||
"fontSize": 16,
|
||||
"shadowColor": "0x000000"
|
||||
},
|
||||
|
||||
"input": {
|
||||
"fontColor": "0xffffff",
|
||||
"fontEmbed": false,
|
||||
"fontFamily": "@res:text:fontName",
|
||||
"fontSize": 16,
|
||||
"shadowColor": "0x000000",
|
||||
"skin": {
|
||||
"@type": "haxework.gui.skin.ColorSkin",
|
||||
"color": "0x000000"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,37 @@
|
||||
package ru.m.tankz;
|
||||
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.text.Font;
|
||||
import flash.ui.Keyboard;
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.frame.IFrameSwitcher;
|
||||
import haxework.gui.Root;
|
||||
import haxework.gui.VGroupView;
|
||||
import haxework.gui.ViewBuilder;
|
||||
import haxework.log.TraceLogger;
|
||||
import haxework.provider.Provider;
|
||||
import haxework.resources.IResources;
|
||||
import haxework.resources.Resources;
|
||||
import ru.m.connect.IConnection;
|
||||
import ru.m.tankz.frame.StartFrame;
|
||||
import ru.m.tankz.game.ClassicGame;
|
||||
import ru.m.tankz.game.DotaGame;
|
||||
import ru.m.tankz.game.Game;
|
||||
import flash.ui.Keyboard;
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.text.Font;
|
||||
import ru.m.tankz.view.frames.StartFrame;
|
||||
import haxework.log.SocketLogger;
|
||||
import haxework.resources.Resources;
|
||||
import haxework.resources.IResources;
|
||||
import haxework.gui.VGroupView;
|
||||
import haxework.gui.ViewBuilder;
|
||||
import haxework.gui.ButtonView;
|
||||
import ru.m.tankz.PacketBuilder;
|
||||
import haxework.log.JSLogger;
|
||||
import haxework.gui.frame.IFrameSwitcher;
|
||||
import haxework.provider.Provider;
|
||||
import haxework.gui.frame.FrameSwitcher;
|
||||
import haxework.gui.Root;
|
||||
import openfl.Assets;
|
||||
import ru.m.connect.IConnection;
|
||||
import haxework.log.TraceLogger;
|
||||
#if flash import haxework.log.JSLogger; #end
|
||||
#if debug import haxework.log.SocketLogger; #end
|
||||
|
||||
@:template("layout/main.json", "layout/styles.json")
|
||||
class MainView extends VGroupView implements ViewBuilder {}
|
||||
|
||||
interface ClientViewLayout {
|
||||
var switcher(default, null):IFrameSwitcher;
|
||||
}
|
||||
|
||||
@:template('ru/m/tankz/Client.yaml', 'ru/m/tankz/Style.yaml')
|
||||
class ClientView extends VGroupView implements ClientViewLayout implements ViewBuilder {}
|
||||
|
||||
class Client implements IConnectionHandler {
|
||||
|
||||
private static inline var TAG = "Tankz";
|
||||
private static inline var TAG = 'Tankz';
|
||||
|
||||
public static function main() {
|
||||
L.push(new TraceLogger());
|
||||
@@ -39,31 +42,31 @@ class Client implements IConnectionHandler {
|
||||
L.push(new SocketLogger());
|
||||
#end
|
||||
Const.init();
|
||||
L.d(TAG, "Debug: " + Const.DEBUG);
|
||||
L.i(TAG, "Version: " + Const.VERSION);
|
||||
L.i(TAG, "Build: " + Const.BUILD);
|
||||
L.d(TAG, 'Debug: ${Const.DEBUG}');
|
||||
L.i(TAG, 'Version: ${Const.VERSION}');
|
||||
L.i(TAG, 'Build: ${Const.BUILD}');
|
||||
new Client();
|
||||
}
|
||||
|
||||
|
||||
private var view:MainView;
|
||||
private var view:ClientView;
|
||||
|
||||
public function new() {
|
||||
Provider.setFactory(IResources, Resources);
|
||||
|
||||
var font:Font = Font.enumerateFonts()[0];
|
||||
Provider.get(IResources).text.put("font", "Bookman Old Style");
|
||||
Provider.get(IResources).text.put("version", 'v${Const.VERSION} b${Const.BUILD}');
|
||||
Provider.get(IResources).text.put('font', 'Bookman Old Style');
|
||||
Provider.get(IResources).text.put('version', 'v${Const.VERSION} b${Const.BUILD}');
|
||||
|
||||
Provider.set(IPacketBuilder, new PacketBuilder());
|
||||
#if flash
|
||||
Provider.set(IConnection, new ru.m.connect.flash.FlashConnection("localhost", 5001));
|
||||
Provider.set(IConnection, new ru.m.connect.flash.FlashConnection('localhost', 5001));
|
||||
#elseif html5
|
||||
Provider.set(IConnection, new ru.m.connect.js.JsConnection("localhost", 5001));
|
||||
Provider.set(IConnection, new ru.m.connect.js.JsConnection('localhost', 5001));
|
||||
#end
|
||||
|
||||
//Provider.get(IConnection).handler.addListener(this);
|
||||
view = new MainView();
|
||||
view = new ClientView();
|
||||
Provider.set(IFrameSwitcher, view.switcher);
|
||||
Root.bind(view);
|
||||
view.content.stage.stageFocusRect = false;
|
||||
@@ -82,7 +85,7 @@ class Client implements IConnectionHandler {
|
||||
|
||||
public function onPress(view:ButtonView):Void {
|
||||
switch (view.id) {
|
||||
case "logout":
|
||||
case 'logout':
|
||||
Provider.get(IConnection).disconnect();
|
||||
}
|
||||
}
|
||||
@@ -94,7 +97,7 @@ class Client implements IConnectionHandler {
|
||||
}
|
||||
|
||||
public function onError(error:Dynamic):Void {
|
||||
L.e(TAG, "", error);
|
||||
L.e(TAG, '', error);
|
||||
//view.switcher.change(AuthFrame.ID);
|
||||
}
|
||||
}
|
||||
|
||||
27
src/client/haxe/ru/m/tankz/Client.yaml
Executable file
27
src/client/haxe/ru/m/tankz/Client.yaml
Executable file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
$type: haxework.gui.VGroupView
|
||||
pWidth: 100
|
||||
pHeight: 100
|
||||
views:
|
||||
- id: switcher
|
||||
$type: haxework.gui.frame.FrameSwitcher
|
||||
pWidth: 100
|
||||
pHeight: 100
|
||||
skin:
|
||||
$type: haxework.gui.skin.BitmapSkin
|
||||
image: "@asset:image:resources/images/background.png"
|
||||
fillType: REPEAT
|
||||
views:
|
||||
- id: start
|
||||
$type: ru.m.tankz.frame.StartFrame
|
||||
- id: level
|
||||
$type: ru.m.tankz.frame.LevelFrame
|
||||
- id: game
|
||||
$type: ru.m.tankz.frame.GameFrame
|
||||
- $type: haxework.gui.LabelView
|
||||
$style: label
|
||||
inLayout: false
|
||||
contentSize: true
|
||||
vAlign: BOTTOM
|
||||
hAlign: RIGHT
|
||||
text: "@res:text:version"
|
||||
21
src/client/haxe/ru/m/tankz/Style.yaml
Normal file
21
src/client/haxe/ru/m/tankz/Style.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
button:
|
||||
width: 250
|
||||
height: 60
|
||||
skin:
|
||||
$type: haxework.gui.skin.ButtonBitmapSkin
|
||||
upImage: "@asset:image:resources/images/control/button_normal.png"
|
||||
downImage: "@asset:image:resources/images/control/button_down.png"
|
||||
overImage: "@asset:image:resources/images/control/button_over.png"
|
||||
fillType: NINEPATH
|
||||
fontFamily: "@res:text:font"
|
||||
fontEmbed: true
|
||||
fontColor: "#E7E0BB"
|
||||
fontSize: 20
|
||||
|
||||
label:
|
||||
fontColor: "#ffffff"
|
||||
fontEmbed: false
|
||||
fontFamily: Courirer New
|
||||
fontSize: 16
|
||||
shadowColor: 0x000000
|
||||
@@ -1,8 +1,7 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
package ru.m.tankz.frame;
|
||||
|
||||
import haxe.ds.Option;
|
||||
import haxe.ds.Option;
|
||||
import flash.events.Event;
|
||||
import haxe.ds.Option;
|
||||
import haxe.Timer;
|
||||
import haxework.gui.frame.IFrameSwitcher;
|
||||
import haxework.gui.LabelView;
|
||||
@@ -22,8 +21,7 @@ interface GameFrameLayout {
|
||||
var render(default, null):Render;
|
||||
}
|
||||
|
||||
|
||||
@:template("layout/frames/game.json", "layout/styles.json")
|
||||
@:template("ru/m/tankz/frame/GameFrame.yaml", "ru/m/tankz/Style.yaml")
|
||||
class GameFrame extends VGroupView implements ViewBuilder implements IPacketHandler implements GameFrameLayout {
|
||||
|
||||
private static inline var TAG = "GameFrame";
|
||||
12
src/client/haxe/ru/m/tankz/frame/GameFrame.yaml
Normal file
12
src/client/haxe/ru/m/tankz/frame/GameFrame.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
pWidth: 100
|
||||
pHeight: 100
|
||||
views:
|
||||
- id: state
|
||||
$type: haxework.gui.LabelView
|
||||
$style: label
|
||||
pWidth: 100
|
||||
height: 20
|
||||
- id: render
|
||||
$type: ru.m.tankz.render.Render
|
||||
contentSize: true
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
package ru.m.tankz.frame;
|
||||
|
||||
import ru.m.tankz.config.ConfigBundle;
|
||||
import haxework.gui.frame.IFrameSwitcher;
|
||||
@@ -14,7 +14,7 @@ interface LevelFrameLayout {
|
||||
}
|
||||
|
||||
|
||||
@:template("layout/frames/level.json", "layout/styles.json")
|
||||
@:template("ru/m/tankz/frame/LevelFrame.yaml", "ru/m/tankz/Style.yaml")
|
||||
class LevelFrame extends VGroupView implements ViewBuilder implements LevelFrameLayout {
|
||||
public static inline var ID = "level";
|
||||
|
||||
20
src/client/haxe/ru/m/tankz/frame/LevelFrame.yaml
Normal file
20
src/client/haxe/ru/m/tankz/frame/LevelFrame.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
pWidth: 100
|
||||
pHeight: 100
|
||||
views:
|
||||
- id: levels
|
||||
$type: haxework.gui.list.VListView<Int>
|
||||
factory: "@class:ru.m.tankz.frame.level.LevelView"
|
||||
pWidth: 100
|
||||
pHeight: 100
|
||||
paddings: 10
|
||||
scroll:
|
||||
$type: haxework.gui.list.VScrollView
|
||||
width: 10
|
||||
pHeight: 100
|
||||
skin:
|
||||
$type: haxework.gui.list.VScrollSkin
|
||||
skin:
|
||||
$type: haxework.gui.skin.ColorSkin
|
||||
color: "#000000"
|
||||
alpha: 0
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
package ru.m.tankz.frame;
|
||||
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.frame.IFrameSwitcher;
|
||||
@@ -19,7 +19,7 @@ interface StartFrameLayout {
|
||||
var dota_2p_vs(default, null):ButtonView;
|
||||
}
|
||||
|
||||
@:template("layout/frames/start.json", "layout/styles.json")
|
||||
@:template("ru/m/tankz/frame/StartFrame.yaml", "ru/m/tankz/Style.yaml")
|
||||
class StartFrame extends VGroupView implements ViewBuilder implements StartFrameLayout {
|
||||
|
||||
public static inline var ID = "start";
|
||||
40
src/client/haxe/ru/m/tankz/frame/StartFrame.yaml
Normal file
40
src/client/haxe/ru/m/tankz/frame/StartFrame.yaml
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
pWidth: 100
|
||||
pHeight: 100
|
||||
views:
|
||||
- $type: haxework.gui.ImageView
|
||||
image: "@asset:image:resources/images/logo/logo.png"
|
||||
contentSize: true
|
||||
bottomMargin: 15
|
||||
- $type: haxework.gui.LabelView
|
||||
$style: label
|
||||
fontSize: 20
|
||||
topMargin: 15
|
||||
contentSize: true
|
||||
text: Classic
|
||||
- id: classic_1p
|
||||
$type: haxework.gui.ButtonView
|
||||
text: 1 Player
|
||||
$style: button
|
||||
- id: classic_2p
|
||||
$type: haxework.gui.ButtonView
|
||||
text: 2 Player
|
||||
$style: button
|
||||
- $type: haxework.gui.LabelView
|
||||
$style: label
|
||||
fontSize: 20
|
||||
topMargin: 15
|
||||
contentSize: true
|
||||
text: DotA
|
||||
- id: dota_1p
|
||||
$type: haxework.gui.ButtonView
|
||||
text: 1 Player
|
||||
$style: button
|
||||
- id: dota_2p_coop
|
||||
$type: haxework.gui.ButtonView
|
||||
text: 2 COOP
|
||||
$style: button
|
||||
- id: dota_2p_vs
|
||||
$type: haxework.gui.ButtonView
|
||||
text: 2 VS
|
||||
$style: button
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.m.tankz.view.frames.list;
|
||||
package ru.m.tankz.frame.level;
|
||||
|
||||
import haxework.gui.ViewBuilder;
|
||||
import haxework.gui.HGroupView;
|
||||
@@ -10,7 +10,7 @@ interface LevelViewLayout {
|
||||
var label(default, null):LabelView;
|
||||
}
|
||||
|
||||
@:template("layout/other.json@level", "layout/styles.json")
|
||||
@:template("ru/m/tankz/frame/level/LevelView.yaml", "ru/m/tankz/Style.yaml")
|
||||
class LevelView extends HGroupView implements ViewBuilder implements IListItemView<Int> implements LevelViewLayout {
|
||||
|
||||
public var item_index(default, default):Int;
|
||||
15
src/client/haxe/ru/m/tankz/frame/level/LevelView.yaml
Normal file
15
src/client/haxe/ru/m/tankz/frame/level/LevelView.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
width: 440
|
||||
height: 44
|
||||
margins: 5
|
||||
views:
|
||||
- id: label
|
||||
$type: haxework.gui.LabelView
|
||||
$style: label
|
||||
pWidth: 100
|
||||
pHeight: 100
|
||||
text: ""
|
||||
skin:
|
||||
$type: haxework.gui.skin.ColorSkin
|
||||
color: "#000000"
|
||||
alpha: 0.2
|
||||
Reference in New Issue
Block a user