[editor] update to haxework
This commit is contained in:
@@ -28,7 +28,7 @@ class LocalGame extends GameRunner {
|
|||||||
var complete = false;
|
var complete = false;
|
||||||
var humansTeams:Array<TeamId> = [];
|
var humansTeams:Array<TeamId> = [];
|
||||||
for (control in controls) {
|
for (control in controls) {
|
||||||
if (Std.is(HumanControl, control) && humansTeams.indexOf(control.playerId.team) == -1) {
|
if (Std.is(control, HumanControl) && humansTeams.indexOf(control.playerId.team) == -1) {
|
||||||
humansTeams.push(control.playerId.team);
|
humansTeams.push(control.playerId.team);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ import ru.m.tankz.view.common.LifeView;
|
|||||||
label += '\n${result.level.name}';
|
label += '\n${result.level.name}';
|
||||||
}
|
}
|
||||||
levelLabel.text = label;
|
levelLabel.text = label;
|
||||||
nextButton.visible = gameStorage.get(result.level.packId).isPresetAvailable(result.level.id + 1, result.state.presetId);
|
nextButton.disabled = !gameStorage.get(result.level.packId).isPresetAvailable(result.level.id + 1, result.state.presetId);
|
||||||
nextButton.text = 'Next (${result.level.id + 1})';
|
nextButton.text = 'Next (${result.level.id + 1})';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import haxework.provider.Provider;
|
|||||||
import haxework.resources.IResources;
|
import haxework.resources.IResources;
|
||||||
import haxework.resources.Resources;
|
import haxework.resources.Resources;
|
||||||
import haxework.view.Root;
|
import haxework.view.Root;
|
||||||
|
import haxework.view.theme.ITheme;
|
||||||
import ru.m.tankz.bundle.ConfigBundle;
|
import ru.m.tankz.bundle.ConfigBundle;
|
||||||
import ru.m.tankz.bundle.IConfigBundle;
|
import ru.m.tankz.bundle.IConfigBundle;
|
||||||
import ru.m.tankz.bundle.ILevelBundle;
|
import ru.m.tankz.bundle.ILevelBundle;
|
||||||
@@ -14,7 +15,8 @@ import ru.m.tankz.editor.view.MapFrame;
|
|||||||
class Editor {
|
class Editor {
|
||||||
private static inline var TAG = 'Editor';
|
private static inline var TAG = 'Editor';
|
||||||
|
|
||||||
@:provide private static var resources:IResources;
|
@:provide static var resources:IResources;
|
||||||
|
@:provide static var theme:ITheme;
|
||||||
|
|
||||||
public static function main() {
|
public static function main() {
|
||||||
L.push(new haxework.log.TraceLogger());
|
L.push(new haxework.log.TraceLogger());
|
||||||
@@ -31,7 +33,7 @@ class Editor {
|
|||||||
resources = new Resources();
|
resources = new Resources();
|
||||||
resources.text.put('version', '${Const.VERSION}');
|
resources.text.put('version', '${Const.VERSION}');
|
||||||
|
|
||||||
AppTheme.register();
|
theme = new AppTheme();
|
||||||
|
|
||||||
Provider.setFactory(IConfigBundle, ConfigBundle);
|
Provider.setFactory(IConfigBundle, ConfigBundle);
|
||||||
Provider.setFactory(ILevelBundle, LevelBundle);
|
Provider.setFactory(ILevelBundle, LevelBundle);
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
---
|
---
|
||||||
$type: haxework.view.VGroupView
|
$type: haxework.view.VGroupView
|
||||||
skinId: dark
|
style: dark
|
||||||
geometry.size.stretch: true
|
geometry.stretch: true
|
||||||
layout.hAlign: center
|
layout.hAlign: center
|
||||||
views:
|
views:
|
||||||
# Tabs
|
# Tabs
|
||||||
- id: tabs
|
- id: tabs
|
||||||
$type: haxework.view.ButtonGroup<String>
|
$type: haxework.view.data.ButtonGroup<String>
|
||||||
geometry.margin.bottom: -2
|
geometry.margin.bottom: -4
|
||||||
buttonSkinId: button.tab
|
layout.margin: 2
|
||||||
+onDataSelect: $code:function(id) switcher.change(id)
|
buttonStyle: button.tab
|
||||||
|
+onDataSelect: ~function(id) switcher.change(id)
|
||||||
data:
|
data:
|
||||||
- "map"
|
- "map"
|
||||||
- "tank"
|
- "tank"
|
||||||
@@ -17,15 +18,12 @@ views:
|
|||||||
# Switcher
|
# Switcher
|
||||||
- id: switcher
|
- id: switcher
|
||||||
$type: haxework.view.frame.FrameSwitcher
|
$type: haxework.view.frame.FrameSwitcher
|
||||||
skinId: border
|
geometry.stretch: true
|
||||||
geometry.size.stretch: true
|
|
||||||
geometry.padding: 5
|
|
||||||
factory:
|
factory:
|
||||||
_map_: {$class: ru.m.tankz.editor.view.MapFrame}
|
_map_: {$class: ru.m.tankz.editor.view.MapFrame}
|
||||||
_tank_: {$class: ru.m.tankz.editor.view.TankFrame}
|
_tank_: {$class: ru.m.tankz.editor.view.TankFrame}
|
||||||
# Version
|
# Version
|
||||||
- $type: haxework.view.LabelView
|
- $type: haxework.view.form.LabelView
|
||||||
skinId: text
|
|
||||||
geometry.position: absolute
|
geometry.position: absolute
|
||||||
geometry.vAlign: top
|
geometry.vAlign: top
|
||||||
geometry.hAlign: right
|
geometry.hAlign: right
|
||||||
|
|||||||
@@ -1,92 +1,85 @@
|
|||||||
---
|
---
|
||||||
geometry.size.stretch: true
|
geometry.stretch: true
|
||||||
|
geometry.padding: 10
|
||||||
|
overflow.y: scroll
|
||||||
layout:
|
layout:
|
||||||
$type: haxework.view.layout.VerticalLayout
|
$type: haxework.view.layout.VerticalLayout
|
||||||
margin: 2
|
margin: 2
|
||||||
vAlign: top
|
vAlign: top
|
||||||
hAlign: center
|
hAlign: center
|
||||||
views:
|
views:
|
||||||
- $type: haxework.view.HGroupView
|
- $type: haxework.view.group.HGroupView
|
||||||
layout.margin: 5
|
layout.margin: 5
|
||||||
views:
|
views:
|
||||||
- $type: haxework.view.ButtonView
|
- $type: haxework.view.form.ButtonView
|
||||||
skinId: button.simple
|
|
||||||
text: Classic
|
text: Classic
|
||||||
+onPress: $code:function(_) type = 'classic'
|
+onPress: ~function(_) type = 'classic'
|
||||||
- $type: haxework.view.ButtonView
|
- $type: haxework.view.form.ButtonView
|
||||||
skinId: button.simple
|
|
||||||
text: DotA
|
text: DotA
|
||||||
+onPress: $code:function(_) type = 'dota'
|
+onPress: ~function(_) type = 'dota'
|
||||||
- $type: haxework.view.ButtonView
|
- $type: haxework.view.form.ButtonView
|
||||||
skinId: button.simple
|
|
||||||
text: DeathMatch
|
text: DeathMatch
|
||||||
+onPress: $code:function(_) type = 'death'
|
+onPress: ~function(_) type = 'death'
|
||||||
- $type: haxework.view.HGroupView
|
- $type: haxework.view.group.HGroupView
|
||||||
layout.vAlign: middle
|
layout.vAlign: middle
|
||||||
views:
|
views:
|
||||||
- $type: haxework.view.LabelView
|
- $type: haxework.view.form.LabelView
|
||||||
skinId: text
|
|
||||||
text: "Name:"
|
text: "Name:"
|
||||||
- id: levelName
|
- id: levelName
|
||||||
$type: haxework.view.InputView
|
$type: haxework.view.form.InputView
|
||||||
skinId: text.box
|
geometry.width: 300
|
||||||
geometry.size.width: 300
|
geometry.height: 26
|
||||||
geometry.size.height: 26
|
|
||||||
text: ""
|
text: ""
|
||||||
- $type: haxework.view.LabelView
|
- $type: haxework.view.form.LabelView
|
||||||
skinId: text
|
|
||||||
text: "Size:"
|
text: "Size:"
|
||||||
geometry.margin.left: 20
|
geometry.margin.left: 20
|
||||||
- id: width
|
- id: width
|
||||||
$type: haxework.view.InputView
|
$type: haxework.view.form.InputView
|
||||||
skinId: text.box
|
geometry.width: 50
|
||||||
geometry.size.fixed: [50, 26]
|
geometry.height: 26
|
||||||
- $type: haxework.view.LabelView
|
- $type: haxework.view.form.LabelView
|
||||||
skinId: text
|
|
||||||
text: "x"
|
text: "x"
|
||||||
- id: height
|
- id: height
|
||||||
$type: haxework.view.InputView
|
$type: haxework.view.form.InputView
|
||||||
skinId: text.box
|
geometry.width: 50
|
||||||
geometry.size.fixed: [50, 26]
|
geometry.height: 26
|
||||||
- $type: haxework.view.ButtonView
|
- $type: haxework.view.form.ButtonView
|
||||||
skinId: button.start.small
|
style: button.start.small
|
||||||
+onPress: $code:applySize()
|
+onPress: ~applySize()
|
||||||
- $type: haxework.view.ButtonView
|
- $type: haxework.view.form.ButtonView
|
||||||
skinId: button.close.small
|
style: button.close.small
|
||||||
+onPress: $code:resetSize()
|
+onPress: ~resetSize()
|
||||||
# map
|
# map
|
||||||
- $type: haxework.view.HGroupView
|
- $type: haxework.view.group.HGroupView
|
||||||
views:
|
views:
|
||||||
- id: spawnPointList
|
- id: spawnPointList
|
||||||
$type: haxework.view.DataView
|
$type: haxework.view.data.DataView
|
||||||
geometry.padding: 3
|
geometry.padding: 3
|
||||||
layout:
|
layout:
|
||||||
$type: haxework.view.layout.VerticalLayout
|
$type: haxework.view.layout.VerticalLayout
|
||||||
hAlign: center
|
hAlign: center
|
||||||
margin: 5
|
margin: 5
|
||||||
factory: $code:ru.m.tankz.editor.view.map.SpawnPointView.factory
|
factory: ~ru.m.tankz.editor.view.map.SpawnPointView.factory
|
||||||
+onDataSelect: $this:selectSpawnPoint
|
+onDataSelect: ~selectSpawnPoint
|
||||||
- id: mapView
|
- id: mapView
|
||||||
$type: ru.m.tankz.editor.view.map.MapEditView
|
$type: ru.m.tankz.editor.view.map.MapEditView
|
||||||
- id: brickList
|
- id: brickList
|
||||||
$type: haxework.view.DataView
|
$type: haxework.view.data.DataView
|
||||||
geometry.padding: 3
|
geometry.padding: 3
|
||||||
layout:
|
layout:
|
||||||
$type: haxework.view.layout.VerticalLayout
|
$type: haxework.view.layout.VerticalLayout
|
||||||
hAlign: center
|
hAlign: center
|
||||||
margin: 5
|
margin: 5
|
||||||
factory: $code:ru.m.tankz.editor.view.map.BrickView.factory
|
factory: ~ru.m.tankz.editor.view.map.BrickView.factory
|
||||||
+onDataSelect: $this:selectBrick
|
+onDataSelect: ~selectBrick
|
||||||
- $type: haxework.view.HGroupView
|
- $type: haxework.view.group.HGroupView
|
||||||
layout.margin: 5
|
layout.margin: 5
|
||||||
views:
|
views:
|
||||||
- id: openButton
|
- id: openButton
|
||||||
$type: haxework.view.ButtonView
|
$type: haxework.view.form.ButtonView
|
||||||
skinId: button.simple
|
|
||||||
text: Open
|
text: Open
|
||||||
+onPress: $code:open()
|
+onPress: ~open()
|
||||||
- id: saveButton
|
- id: saveButton
|
||||||
$type: haxework.view.ButtonView
|
$type: haxework.view.form.ButtonView
|
||||||
skinId: button.simple
|
|
||||||
text: Save
|
text: Save
|
||||||
+onPress: $code:save()
|
+onPress: ~save()
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package ru.m.tankz.editor.view;
|
package ru.m.tankz.editor.view;
|
||||||
|
|
||||||
import haxework.color.Color;
|
import haxework.color.Color;
|
||||||
import haxework.view.frame.FrameView;
|
|
||||||
import haxework.view.IGroupView;
|
|
||||||
import haxework.view.form.InputView;
|
import haxework.view.form.InputView;
|
||||||
|
import haxework.view.frame.FrameView;
|
||||||
|
import haxework.view.group.IGroupView;
|
||||||
import ru.m.tankz.editor.view.tank.TankView;
|
import ru.m.tankz.editor.view.tank.TankView;
|
||||||
|
|
||||||
@:template class TankFrame extends FrameView<Dynamic> {
|
@:template class TankFrame extends FrameView<Dynamic> {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
geometry.size.stretch: true
|
geometry.stretch: true
|
||||||
geometry.padding: 10
|
geometry.padding: 10
|
||||||
layout:
|
layout:
|
||||||
$type: haxework.view.layout.VerticalLayout
|
$type: haxework.view.layout.VerticalLayout
|
||||||
@@ -7,8 +7,8 @@ layout:
|
|||||||
margin: 10
|
margin: 10
|
||||||
views:
|
views:
|
||||||
- id: tanks
|
- id: tanks
|
||||||
$type: haxework.view.GroupView
|
$type: haxework.view.group.GroupView
|
||||||
geometry.size.width: 100%
|
geometry.width: 100%
|
||||||
layout:
|
layout:
|
||||||
$type: haxework.view.layout.TailLayout
|
$type: haxework.view.layout.TailLayout
|
||||||
rowSize: 4
|
rowSize: 4
|
||||||
@@ -31,10 +31,9 @@ views:
|
|||||||
- $type: ru.m.tankz.editor.view.tank.TankView
|
- $type: ru.m.tankz.editor.view.tank.TankView
|
||||||
image: "$asset:image:resources/image/tank/bd-0.png"
|
image: "$asset:image:resources/image/tank/bd-0.png"
|
||||||
- id: color
|
- id: color
|
||||||
$type: haxework.view.InputView
|
$type: haxework.view.form.InputView
|
||||||
skinId: text.box
|
+onChange: ~function(value) color = value
|
||||||
+onChange: $code:function(value) color = value
|
geometry.width: 120
|
||||||
geometry.size.width: 120
|
|
||||||
layout.hAlign: right
|
layout.hAlign: right
|
||||||
- $type: ru.m.tankz.editor.ColorView
|
- $type: ru.m.tankz.editor.ColorView
|
||||||
+onSelect: $code:function(value) color = value
|
+onSelect: ~function(value) color = value
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class TankView extends View<Bitmap> {
|
|||||||
inline private function set_image(value:BitmapData):BitmapData {
|
inline private function set_image(value:BitmapData):BitmapData {
|
||||||
image = value;
|
image = value;
|
||||||
content.bitmapData = BitmapUtil.colorize(image, color);
|
content.bitmapData = BitmapUtil.colorize(image, color);
|
||||||
setContentSize(image.width, image.height);
|
setSize(image.width, image.height);
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user