feat(editor): update editor ui
This commit is contained in:
@@ -112,6 +112,7 @@ const editor = new Project(
|
|||||||
[
|
[
|
||||||
Project.Platform.FLASH,
|
Project.Platform.FLASH,
|
||||||
Project.Platform.HTML5,
|
Project.Platform.HTML5,
|
||||||
|
Project.Platform.LINUX,
|
||||||
],
|
],
|
||||||
config.branch({
|
config.branch({
|
||||||
name: 'editor',
|
name: 'editor',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tankz",
|
"name": "tankz",
|
||||||
"version": "0.17.6",
|
"version": "0.18.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"dateformat": "^3.0.3",
|
"dateformat": "^3.0.3",
|
||||||
|
|||||||
@@ -97,6 +97,11 @@ class AppTheme extends Theme {
|
|||||||
"layout.vAlign" => VAlign.MIDDLE,
|
"layout.vAlign" => VAlign.MIDDLE,
|
||||||
], ["light"]));
|
], ["light"]));
|
||||||
|
|
||||||
|
register(new Style("panel_button", [
|
||||||
|
"font.size" => fontSize.big,
|
||||||
|
"geometry.height" => SizeValue.fromString("100%"),
|
||||||
|
], ["button"]));
|
||||||
|
|
||||||
register(new Style("window", [
|
register(new Style("window", [
|
||||||
"geometry.padding" => Box.fromFloat(2),
|
"geometry.padding" => Box.fromFloat(2),
|
||||||
], ["dark", "border"]));
|
], ["dark", "border"]));
|
||||||
@@ -141,10 +146,21 @@ class AppTheme extends Theme {
|
|||||||
"skin.background.color" => red,
|
"skin.background.color" => red,
|
||||||
]));
|
]));
|
||||||
|
|
||||||
register(new Style("button.menu", [
|
register(new Style("button.pack", [
|
||||||
|
"geometry.width" => SizeValue.fromString("35h"),
|
||||||
|
"geometry.height" => SizeValue.fromString("20h"),
|
||||||
|
"geometry.padding" => Box.fromFloat(5),
|
||||||
|
"layout.hAlign" => HAlign.CENTER,
|
||||||
|
"layout.vAlign" => VAlign.MIDDLE,
|
||||||
|
"content.buttonMode" => true,
|
||||||
|
"content.mouseChildren" => false,
|
||||||
"skin.round" => 15,
|
"skin.round" => 15,
|
||||||
], ["border", "light"]));
|
], ["border", "light"]));
|
||||||
|
|
||||||
|
register(new Style("button.menu", [
|
||||||
|
"geometry.padding" => Box.fromArray([20, 10]),
|
||||||
|
]));
|
||||||
|
|
||||||
registerButton("settings", "cog-solid.svg");
|
registerButton("settings", "cog-solid.svg");
|
||||||
registerButton("close", "times-circle-solid.svg");
|
registerButton("close", "times-circle-solid.svg");
|
||||||
registerButton("next", "arrow-alt-circle-right-solid.svg");
|
registerButton("next", "arrow-alt-circle-right-solid.svg");
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ views:
|
|||||||
geometry.margin: [0, 10]
|
geometry.margin: [0, 10]
|
||||||
visible: false
|
visible: false
|
||||||
- $type: hw.view.form.ButtonView
|
- $type: hw.view.form.ButtonView
|
||||||
style: button.menu
|
|
||||||
+onPress: ~switcher.change('record')
|
+onPress: ~switcher.change('record')
|
||||||
text: Records
|
text: Records
|
||||||
visible: false
|
visible: false
|
||||||
|
|||||||
@@ -24,17 +24,18 @@ views:
|
|||||||
views:
|
views:
|
||||||
- $type: hw.view.SpriteView
|
- $type: hw.view.SpriteView
|
||||||
geometry.width: 50%
|
geometry.width: 50%
|
||||||
- id: levels
|
|
||||||
$type: hw.view.form.ButtonView
|
|
||||||
text: Levels
|
|
||||||
+onPress: ~levels()
|
|
||||||
- id: restart
|
- id: restart
|
||||||
$type: hw.view.form.ButtonView
|
$type: hw.view.form.ButtonView
|
||||||
|
style: panel_button
|
||||||
text: Restart
|
text: Restart
|
||||||
+onPress: ~restart()
|
+onPress: ~restart()
|
||||||
- id: next
|
- id: next
|
||||||
$type: hw.view.form.ButtonView
|
$type: hw.view.form.ButtonView
|
||||||
|
style: panel_button
|
||||||
text: Next
|
text: Next
|
||||||
+onPress: ~next()
|
+onPress: ~next()
|
||||||
- $type: hw.view.SpriteView
|
- $type: hw.view.SpriteView
|
||||||
geometry.width: 50%
|
geometry.width: 50%
|
||||||
|
- $type: hw.view.form.ButtonView
|
||||||
|
style: button.prev
|
||||||
|
+onPress: ~levels()
|
||||||
|
|||||||
@@ -114,7 +114,8 @@ using ru.m.tankz.view.ViewUtil;
|
|||||||
private function presetViewFactory(index:Int, value:GamePreset):ButtonView {
|
private function presetViewFactory(index:Int, value:GamePreset):ButtonView {
|
||||||
var result = new ButtonView();
|
var result = new ButtonView();
|
||||||
result.style = 'button${!progress.isPresetCompleted(start.level.id, value.id) ? ".active" : ""}';
|
result.style = 'button${!progress.isPresetCompleted(start.level.id, value.id) ? ".active" : ""}';
|
||||||
result.text = value.name;
|
result.geometry.height = "100%";
|
||||||
|
result.text = value.name == "default" ? "start" : value.name;
|
||||||
result.disabled = !progress.isPresetAvailable(start.level.id, value.id);
|
result.disabled = !progress.isPresetAvailable(start.level.id, value.id);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ views:
|
|||||||
$type: hw.view.data.DataView
|
$type: hw.view.data.DataView
|
||||||
factory: ~presetViewFactory
|
factory: ~presetViewFactory
|
||||||
+onDataSelect: ~onPresetSelect
|
+onDataSelect: ~onPresetSelect
|
||||||
|
geometry.height: 100%
|
||||||
layout:
|
layout:
|
||||||
$type: hw.view.layout.HorizontalLayout
|
$type: hw.view.layout.HorizontalLayout
|
||||||
hAlign: center
|
hAlign: center
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
---
|
---
|
||||||
style: button.menu
|
style: button.pack
|
||||||
geometry.width: 35h
|
|
||||||
geometry.height: 20h
|
|
||||||
geometry.padding: 5
|
|
||||||
layout.hAlign: center
|
|
||||||
layout.vAlign: middle
|
|
||||||
content.buttonMode: true
|
|
||||||
content.mouseChildren: false
|
|
||||||
views:
|
views:
|
||||||
- id: label
|
- id: label
|
||||||
$type: hw.view.form.LabelView
|
$type: hw.view.form.LabelView
|
||||||
|
|||||||
Binary file not shown.
@@ -45,7 +45,7 @@ class Editor {
|
|||||||
L.i(TAG, 'Build: ${Const.BUILD}');
|
L.i(TAG, 'Build: ${Const.BUILD}');
|
||||||
resources.text.put("version", '${Const.VERSION}');
|
resources.text.put("version", '${Const.VERSION}');
|
||||||
|
|
||||||
theme = new AppTheme();
|
theme = new EditorTheme();
|
||||||
configBundle = new ConfigBundle();
|
configBundle = new ConfigBundle();
|
||||||
levelBundle = new CachedLevelBundle(new ClientLevelSource());
|
levelBundle = new CachedLevelBundle(new ClientLevelSource());
|
||||||
|
|
||||||
|
|||||||
16
src/editor/haxe/ru/m/tankz/editor/EditorTheme.hx
Normal file
16
src/editor/haxe/ru/m/tankz/editor/EditorTheme.hx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package ru.m.tankz.editor;
|
||||||
|
|
||||||
|
import hw.view.utils.DrawUtil;
|
||||||
|
import hw.view.theme.Theme;
|
||||||
|
import hw.view.geometry.SizeValue;
|
||||||
|
|
||||||
|
class EditorTheme extends AppTheme {
|
||||||
|
override private function reload():Void {
|
||||||
|
super.reload();
|
||||||
|
register(new Style("brush", [
|
||||||
|
"geometry.width" => SizeValue.fromString("6h"),
|
||||||
|
"geometry.height" => SizeValue.fromString("6h"),
|
||||||
|
"fillType" => FillType.CONTAIN,
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ views:
|
|||||||
views:
|
views:
|
||||||
- id: levels
|
- id: levels
|
||||||
$type: hw.view.list.VListView
|
$type: hw.view.list.VListView
|
||||||
geometry.width: 200
|
geometry.width: 30h
|
||||||
geometry.height: 100%
|
geometry.height: 100%
|
||||||
factory: ~levelViewFactory
|
factory: ~levelViewFactory
|
||||||
+onItemSelect: ~onLevelSelect
|
+onItemSelect: ~onLevelSelect
|
||||||
@@ -24,22 +24,25 @@ views:
|
|||||||
text: "Name:"
|
text: "Name:"
|
||||||
- id: levelName
|
- id: levelName
|
||||||
$type: hw.view.form.InputView
|
$type: hw.view.form.InputView
|
||||||
geometry.width: 300
|
layout.vAlign: middle
|
||||||
geometry.height: 26
|
geometry.width: "60%"
|
||||||
|
geometry.height: 100%
|
||||||
text: ""
|
text: ""
|
||||||
- $type: hw.view.form.LabelView
|
- $type: hw.view.form.LabelView
|
||||||
text: "Size:"
|
text: "Size:"
|
||||||
geometry.margin.left: 20
|
geometry.margin.left: 20
|
||||||
- id: width
|
- id: width
|
||||||
$type: hw.view.form.InputView
|
$type: hw.view.form.InputView
|
||||||
geometry.width: 50
|
layout.vAlign: middle
|
||||||
geometry.height: 26
|
geometry.width: "15%"
|
||||||
|
geometry.height: 100%
|
||||||
- $type: hw.view.form.LabelView
|
- $type: hw.view.form.LabelView
|
||||||
text: "x"
|
text: "x"
|
||||||
- id: height
|
- id: height
|
||||||
$type: hw.view.form.InputView
|
$type: hw.view.form.InputView
|
||||||
geometry.width: 50
|
layout.vAlign: middle
|
||||||
geometry.height: 26
|
geometry.width: "15%"
|
||||||
|
geometry.height: 100%
|
||||||
- $type: hw.view.form.ButtonView
|
- $type: hw.view.form.ButtonView
|
||||||
style: button.start.small
|
style: button.start.small
|
||||||
+onPress: ~applySize()
|
+onPress: ~applySize()
|
||||||
@@ -73,26 +76,26 @@ views:
|
|||||||
+onDataSelect: ~selectBrick
|
+onDataSelect: ~selectBrick
|
||||||
- $type: hw.view.group.GroupView
|
- $type: hw.view.group.GroupView
|
||||||
geometry.stretch: true
|
geometry.stretch: true
|
||||||
overflow.x: crop
|
|
||||||
overflow.y: crop
|
|
||||||
views:
|
views:
|
||||||
- $type: ru.m.tankz.view.game.GameViewContainer
|
- id: mapView
|
||||||
views:
|
$type: ru.m.tankz.editor.view.map.MapEditView
|
||||||
- id: mapView
|
geometry.stretch: true
|
||||||
$type: ru.m.tankz.editor.view.map.MapEditView
|
|
||||||
- $type: hw.view.group.HGroupView
|
- $type: hw.view.group.HGroupView
|
||||||
style: panel
|
style: panel
|
||||||
layout.margin: 10
|
layout.margin: 10
|
||||||
views:
|
views:
|
||||||
- $type: hw.view.form.ButtonView
|
- $type: hw.view.form.ButtonView
|
||||||
|
style: panel_button
|
||||||
text: Add
|
text: Add
|
||||||
+onPress: ~addLevel()
|
+onPress: ~addLevel()
|
||||||
- $type: hw.view.form.ButtonView
|
- $type: hw.view.form.ButtonView
|
||||||
|
style: panel_button
|
||||||
text: Remove
|
text: Remove
|
||||||
+onPress: ~removeLevel()
|
+onPress: ~removeLevel()
|
||||||
- $type: hw.view.SpriteView
|
- $type: hw.view.SpriteView
|
||||||
geometry.width: 100%
|
geometry.width: 100%
|
||||||
- $type: hw.view.form.ButtonView
|
- $type: hw.view.form.ButtonView
|
||||||
|
style: panel_button
|
||||||
text: Save
|
text: Save
|
||||||
+onPress: ~save()
|
+onPress: ~save()
|
||||||
- $type: hw.view.form.ButtonView
|
- $type: hw.view.form.ButtonView
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ views:
|
|||||||
layout.margin: 10
|
layout.margin: 10
|
||||||
views:
|
views:
|
||||||
- $type: hw.view.form.ButtonView
|
- $type: hw.view.form.ButtonView
|
||||||
|
style: button.menu
|
||||||
text: New
|
text: New
|
||||||
+onPress: ~create()
|
+onPress: ~create()
|
||||||
- id: packs
|
- id: packs
|
||||||
@@ -15,6 +16,7 @@ views:
|
|||||||
factory: ~ru.m.tankz.editor.view.PackView.factory
|
factory: ~ru.m.tankz.editor.view.PackView.factory
|
||||||
+onDataAction: ~onPackAction
|
+onDataAction: ~onPackAction
|
||||||
- $type: hw.view.form.ButtonView
|
- $type: hw.view.form.ButtonView
|
||||||
|
style: button.menu
|
||||||
text: Open
|
text: Open
|
||||||
+onPress: ~open()
|
+onPress: ~open()
|
||||||
- $type: hw.view.group.HGroupView
|
- $type: hw.view.group.HGroupView
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ views:
|
|||||||
+onPress: ~export()
|
+onPress: ~export()
|
||||||
- id: label
|
- id: label
|
||||||
$type: hw.view.form.ButtonView
|
$type: hw.view.form.ButtonView
|
||||||
geometry.width: 250
|
geometry.width: 50w
|
||||||
|
geometry.height: 100%
|
||||||
+onPress: ~edit()
|
+onPress: ~edit()
|
||||||
- $type: hw.view.form.ButtonView
|
- $type: hw.view.form.ButtonView
|
||||||
style: button.close
|
style: button.close
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package ru.m.tankz.editor.view.map;
|
package ru.m.tankz.editor.view.map;
|
||||||
|
|
||||||
|
import hw.view.utils.DrawUtil.FillType;
|
||||||
import flash.display.BitmapData;
|
import flash.display.BitmapData;
|
||||||
import flash.display.Shape;
|
import flash.display.Shape;
|
||||||
import hw.color.Color;
|
import hw.color.Color;
|
||||||
import hw.view.ImageView;
|
import hw.view.ImageView;
|
||||||
|
|
||||||
class BrushView<D> extends ImageView {
|
class BrushView<D> extends ImageView {
|
||||||
|
|
||||||
public var data(default, set):D;
|
public var data(default, set):D;
|
||||||
public var selected(default, set):Bool;
|
public var selected(default, set):Bool;
|
||||||
@@ -20,6 +21,9 @@ class BrushView<D> extends ImageView {
|
|||||||
if (data != null) {
|
if (data != null) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
style = "brush";
|
||||||
|
// TODO: fillType in style
|
||||||
|
fillType = FillType.CONTAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
override public function update():Void {
|
override public function update():Void {
|
||||||
|
|||||||
@@ -81,7 +81,12 @@ enum Brush {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function onMouseMove(event:MouseEvent):Void {
|
private function onMouseMove(event:MouseEvent):Void {
|
||||||
var b = map.getPointBrick(new Point(event.localX, event.localY));
|
var p = new Point(event.localX, event.localY);
|
||||||
|
p.x -= container.x;
|
||||||
|
p.y -= container.y;
|
||||||
|
p.x *= (1 / container.scaleX);
|
||||||
|
p.y *= (1 / container.scaleY);
|
||||||
|
var b = map.getPointBrick(p);
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
switch (brush) {
|
switch (brush) {
|
||||||
case Brush.POINT(point):
|
case Brush.POINT(point):
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ layout.vAlign: middle
|
|||||||
view:
|
view:
|
||||||
$type: hw.view.group.VGroupView
|
$type: hw.view.group.VGroupView
|
||||||
layout.hAlign: center
|
layout.hAlign: center
|
||||||
geometry.width: 400
|
geometry.width: 60h
|
||||||
#geometry.stretch: true
|
|
||||||
#geometry.margin: 10
|
|
||||||
style: window
|
style: window
|
||||||
views:
|
views:
|
||||||
- $type: hw.view.group.HGroupView
|
- $type: hw.view.group.HGroupView
|
||||||
|
|||||||
@@ -11,7 +11,12 @@
|
|||||||
"HAXE_STD_PATH": "/home/shmyga/sdk/haxe/4.2.5/std"
|
"HAXE_STD_PATH": "/home/shmyga/sdk/haxe/4.2.5/std"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"haxe.configurations": [["build/client/flash/haxe/debug.hxml"]],
|
"haxe.configurations": [
|
||||||
|
[
|
||||||
|
//"build/client/flash/haxe/debug.hxml",
|
||||||
|
"build/editor/flash/haxe/debug.hxml"
|
||||||
|
]
|
||||||
|
],
|
||||||
"haxe.displayServer": {
|
"haxe.displayServer": {
|
||||||
"arguments": [
|
"arguments": [
|
||||||
//"-v"
|
//"-v"
|
||||||
@@ -38,7 +43,12 @@
|
|||||||
{
|
{
|
||||||
"id": "task",
|
"id": "task",
|
||||||
"description": "Please enter task name",
|
"description": "Please enter task name",
|
||||||
"options": ["client:flash:test", "server:cpp:test", "generate"],
|
"options": [
|
||||||
|
"client:flash:test",
|
||||||
|
"editor:flash:test",
|
||||||
|
"server:cpp:test",
|
||||||
|
"generate"
|
||||||
|
],
|
||||||
"type": "pickString"
|
"type": "pickString"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user