[editor] game type select
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
package ru.m.tankz.editor;
|
||||
|
||||
|
||||
import ru.m.tankz.editor.MapEditView.Brush;
|
||||
import ru.m.tankz.game.Game;
|
||||
import ru.m.tankz.editor.MapEditView;
|
||||
import ru.m.tankz.game.DotaGame;
|
||||
import haxework.gui.list.ListView;
|
||||
import haxework.gui.list.VListView;
|
||||
@@ -25,6 +26,8 @@ import haxework.log.SocketLogger;
|
||||
|
||||
|
||||
interface EditorViewLayout {
|
||||
var gameClassicButton(default, null):ButtonView;
|
||||
var gameDotaButton(default, null):ButtonView;
|
||||
var openButton(default, null):ButtonView;
|
||||
var saveButton(default, null):ButtonView;
|
||||
var fileNameLabel(default, null):LabelView;
|
||||
@@ -70,16 +73,11 @@ class Editor {
|
||||
Root.bind(view);
|
||||
view.content.stage.stageFocusRect = false;
|
||||
|
||||
view.gameClassicButton.onPress = this;
|
||||
view.gameDotaButton.onPress = this;
|
||||
view.openButton.onPress = this;
|
||||
view.saveButton.onPress = this;
|
||||
|
||||
config = ConfigBundle.get(DotaGame.TYPE);
|
||||
view.mapView.config = config;
|
||||
view.mapView.data = LevelBundle.empty(config);
|
||||
|
||||
view.brickList.data = config.bricks.filter(function(brick) return brick.type > -1);
|
||||
view.spawnPointList.data = config.points;
|
||||
|
||||
var resetSelected = function() {
|
||||
for (v in view.brickList.items) {
|
||||
cast(v, BrickView).selected = false;
|
||||
@@ -104,12 +102,27 @@ class Editor {
|
||||
}
|
||||
});
|
||||
|
||||
setGameType(ClassicGame.TYPE);
|
||||
}
|
||||
|
||||
private function setGameType(type:GameType):Void {
|
||||
config = ConfigBundle.get(type);
|
||||
view.mapView.config = config;
|
||||
view.mapView.data = LevelBundle.empty(config);
|
||||
|
||||
view.brickList.data = config.bricks.filter(function(brick) return brick.type > -1);
|
||||
view.spawnPointList.data = config.points;
|
||||
|
||||
view.mapView.brush = Brush.BRICK(view.brickList.data[0]);
|
||||
cast(view.brickList.items[0], BrickView).selected = true;
|
||||
}
|
||||
|
||||
public function onPress(v:ButtonView):Void {
|
||||
switch (v.id) {
|
||||
case 'gameClassicButton':
|
||||
setGameType(ClassicGame.TYPE);
|
||||
case 'gameDotaButton':
|
||||
setGameType(DotaGame.TYPE);
|
||||
case 'openButton':
|
||||
L.d(TAG, 'OPEN');
|
||||
FileUtil.browse().then(function(content:FileContent) {
|
||||
|
||||
@@ -6,6 +6,24 @@ views:
|
||||
pWidth: 100
|
||||
pHeight: 100
|
||||
views:
|
||||
- $type: haxework.gui.HGroupView
|
||||
pWidth: 100
|
||||
height: 20
|
||||
views:
|
||||
- id: gameClassicButton
|
||||
$type: haxework.gui.ButtonView
|
||||
text: Classic
|
||||
contentSize: true
|
||||
skin:
|
||||
$type: haxework.gui.skin.ButtonColorSkin
|
||||
color: 0xaaff00
|
||||
- id: gameDotaButton
|
||||
$type: haxework.gui.ButtonView
|
||||
text: DotA
|
||||
contentSize: true
|
||||
skin:
|
||||
$type: haxework.gui.skin.ButtonColorSkin
|
||||
color: 0xaaff00
|
||||
- $type: haxework.gui.HGroupView
|
||||
pWidth: 100
|
||||
height: 20
|
||||
|
||||
Reference in New Issue
Block a user