[client] yaml layouts

This commit is contained in:
2018-02-14 17:15:15 +03:00
parent 1f8b43ba5d
commit 032fa0c0ad
25 changed files with 241 additions and 288 deletions

View File

@@ -3,14 +3,14 @@ package ru.m.tankz.editor;
import flash.text.Font;
import haxework.gui.ButtonView;
import haxework.gui.frame.FrameSwitcher;
import haxework.gui.GroupView;
import haxework.gui.VGroupView;
import haxework.gui.Root;
import haxework.gui.ViewBuilder;
import haxework.log.TraceLogger;
import haxework.provider.Provider;
import haxework.resources.IResources;
import haxework.resources.Resources;
import ru.m.tankz.view.frames.LevelFrame;
import ru.m.tankz.frame.LevelFrame;
#if flash import haxework.log.JSLogger; #end
#if debug import haxework.log.SocketLogger; #end
@@ -19,12 +19,12 @@ interface EditorViewLayout {
var switcher(default, null):FrameSwitcher;
}
@:template("ru/m/tankz/editor/Editor.yaml", "ru/m/tankz/editor/Style.json")
class EditorView extends GroupView implements ViewBuilder implements EditorViewLayout {}
@:template('ru/m/tankz/editor/Editor.yaml', 'ru/m/tankz/editor/Style.yaml')
class EditorView extends VGroupView implements ViewBuilder implements EditorViewLayout {}
class Editor {
private static inline var TAG = "Tankz.Editor";
private static inline var TAG = 'Editor';
public static function main() {
L.push(new TraceLogger());
@@ -35,9 +35,9 @@ class Editor {
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 Editor();
}
@@ -47,8 +47,8 @@ class Editor {
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}');
view = new EditorView({handler: this});
Root.bind(view);

View File

@@ -1,43 +1,48 @@
$type: haxework.gui.GroupView
---
$type: haxework.gui.VGroupView
pWidth: 100
pHeight: 100
skin:
$type: haxework.gui.skin.BitmapSkin
image: "@asset:image:resources/images/background.png"
fillType: REPEAT
views:
# Tabs
- $type: haxework.gui.HGroupView
contentSize: true
views:
- id: btn_level
$type: haxework.gui.ButtonView
$style: button
text: Level
onPress: "@link:handler"
- id: btn_tank
$type: haxework.gui.ButtonView
$style: button
text: Tank
onPress: "@link:handler"
- $type: haxework.gui.SpriteView
height: 3
pWidth: 100
skin:
$type: haxework.gui.skin.ColorSkin
color: "#aaaaaa"
# Switcher
- 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
paddings: 5
views:
- id: level
$type: ru.m.tankz.editor.frame.LevelFrame
- id: tank
$type: ru.m.tankz.editor.frame.TankFrame
# Tabs
- $type: haxework.gui.HGroupView
vAlign: TOP
hAlign: CENTER
contentSize: true
inLayout: false
views:
- id: btn_level
$type: haxework.gui.ButtonView
text: Level
'@style': button
onPress: '@link:handler'
- id: btn_tank
$type: haxework.gui.ButtonView
text: Tank
'@style': button
onPress: '@link:handler'
# Version
- $type: haxework.gui.LabelView
$style: label
inLayout: false
contentSize: true
vAlign: BOTTOM
hAlign: RIGHT
'@style': label
text: '@res:text:version'
text: "@res:text:version"

View File

@@ -1,18 +0,0 @@
{
"button": {
"width": 150,
"height": 20,
"margins": 2,
"skin": {
"@type": "haxework.gui.skin.ButtonColorSkin",
"color": "0xaaff00"
}
},
"label": {
"fontColor": "0xffffff",
"fontEmbed": false,
"fontFamily": "@res:text:fontName",
"fontSize": 16,
"shadowColor": "0x000000"
}
}

View File

@@ -1,6 +1,8 @@
---
button:
height: 20
width: 150
margins: 2
skin:
$type: haxework.gui.skin.ButtonColorSkin
color: 0xaaff00

View File

@@ -30,7 +30,7 @@ interface LevelFrameLayout {
var brickList(default, null):VListView<BrickConfig>;
}
@:template('ru/m/tankz/editor/frame/LevelFrame.yaml', 'ru/m/tankz/editor/Style.json')
@:template('ru/m/tankz/editor/frame/LevelFrame.yaml', 'ru/m/tankz/editor/Style.yaml')
class LevelFrame extends VGroupView implements ViewBuilder implements LevelFrameLayout {
public static inline var ID = 'level';
public static inline var TAG = 'level';

View File

@@ -1,30 +1,32 @@
---
$type: haxework.gui.VGroupView
pWidth: 100
pHeight: 100
layoutMargin: 2
layoutVAlign: TOP
views:
- $type: haxework.gui.HGroupView
contentSize: true
views:
- id: gameClassicButton
$type: haxework.gui.ButtonView
$style: button
text: Classic
'@style': button
- id: gameDotaButton
$type: haxework.gui.ButtonView
$style: button
text: DotA
'@style': button
- $type: haxework.gui.HGroupView
contentSize: true
views:
- id: openButton
$type: haxework.gui.ButtonView
$style: button
text: Open
'@style': button
- id: saveButton
$type: haxework.gui.ButtonView
$style: button
text: Save
'@style': button
- id: fileNameLabel
$type: haxework.gui.LabelView
contentSize: true
@@ -33,7 +35,7 @@ views:
views:
- id: spawnPointList
$type: haxework.gui.list.VListView<SpawnPoint>
factory: '@class:ru.m.tankz.editor.level.SpawnPointView'
factory: "@class:ru.m.tankz.editor.level.SpawnPointView"
width: 56
pHeight: 100
scroll:
@@ -51,7 +53,7 @@ views:
contentSize: true
- id: brickList
$type: haxework.gui.list.VListView<BrickConfig>
factory: '@class:ru.m.tankz.editor.level.BrickView'
factory: "@class:ru.m.tankz.editor.level.BrickView"
width: 30
pHeight: 100
scroll:

View File

@@ -14,7 +14,7 @@ interface TankFrameLayout {
var colorB(default, null):InputView;
}
@:template('ru/m/tankz/editor/frame/TankFrame.yaml')
@:template('ru/m/tankz/editor/frame/TankFrame.yaml', 'ru/m/tankz/editor/Style.yaml')
class TankFrame extends HGroupView implements ViewBuilder implements TankFrameLayout {
public static inline var ID = 'tank';

View File

@@ -1,3 +1,4 @@
---
$type: haxework.gui.HGroupView
pWidth: 100
pHeight: 100
@@ -5,28 +6,28 @@ views:
- $type: ru.m.tankz.editor.tank.TankView
contentSize: true
rightMargin: 20
image: '@asset:image:resources/image/tank/bc-0.png'
color: '#ff4422'
image: "@asset:image:resources/image/tank/bc-0.png"
color: "#ff4422"
- $type: ru.m.tankz.editor.tank.TankView
contentSize: true
rightMargin: 20
image: '@asset:image:resources/image/tank/bc-0.png'
color: '#f055a0'
image: "@asset:image:resources/image/tank/bc-0.png"
color: "#f055a0"
- $type: ru.m.tankz.editor.tank.TankView
contentSize: true
rightMargin: 20
image: '@asset:image:resources/image/tank/bc-0.png'
color: '#2244ff'
image: "@asset:image:resources/image/tank/bc-0.png"
color: "#2244ff"
- id: tank
$type: ru.m.tankz.editor.tank.TankView
contentSize: true
rightMargin: 20
image: '@asset:image:resources/image/tank/bc-0.png'
image: "@asset:image:resources/image/tank/bc-0.png"
- id: colorR
$type: haxework.gui.InputView
width: 30
height: 20
text: 'a0'
text: "a0"
skin:
$type: haxework.gui.skin.ColorSkin
color: 0xffffff
@@ -34,7 +35,7 @@ views:
$type: haxework.gui.InputView
width: 30
height: 20
text: '55'
text: "55"
skin:
$type: haxework.gui.skin.ColorSkin
color: 0xffffff
@@ -42,7 +43,7 @@ views:
$type: haxework.gui.InputView
width: 30
height: 20
text: 'f0'
text: "f0"
skin:
$type: haxework.gui.skin.ColorSkin
color: 0xffffff