[common] added PlayerState

This commit is contained in:
2018-02-20 17:23:53 +03:00
parent 5b04242aab
commit 2e856c1256
16 changed files with 135 additions and 126 deletions

View File

@@ -1,5 +1,9 @@
package ru.m.tankz.editor;
import ru.m.tankz.bundle.LevelBundle;
import ru.m.tankz.bundle.ILevelBundle;
import ru.m.tankz.bundle.ConfigBundle;
import ru.m.tankz.bundle.IConfigBundle;
import flash.text.Font;
import haxework.gui.ButtonView;
import haxework.gui.frame.FrameSwitcher;
@@ -54,6 +58,9 @@ class Editor {
Root.bind(view);
view.content.stage.stageFocusRect = false;
Provider.setFactory(IConfigBundle, ConfigBundle);
Provider.setFactory(ILevelBundle, LevelBundle);
view.switcher.change(LevelFrame.ID);
}

View File

@@ -4,7 +4,7 @@ pWidth: 100
pHeight: 100
skin:
$type: haxework.gui.skin.BitmapSkin
image: "@asset:image:resources/images/background.png"
image: "@asset:image:resources/image/ui/background.png"
fillType: REPEAT
views:
# Tabs

View File

@@ -1,5 +1,7 @@
package ru.m.tankz.editor.frame;
import ru.m.tankz.util.LevelUtil;
import ru.m.tankz.bundle.IConfigBundle;
import haxework.gui.ButtonView;
import haxework.gui.LabelView;
import haxework.gui.list.ListView;
@@ -8,8 +10,6 @@ import haxework.gui.VGroupView;
import haxework.gui.ViewBuilder;
import haxework.provider.Provider;
import ru.m.tankz.config.Config;
import ru.m.tankz.config.ConfigBundle;
import ru.m.tankz.config.LevelBundle;
import ru.m.tankz.editor.FileUtil;
import ru.m.tankz.editor.level.BrickView;
import ru.m.tankz.editor.level.MapEditView;
@@ -73,11 +73,11 @@ class LevelFrame extends VGroupView implements ViewBuilder implements LevelFrame
}
private function setGameType(type:GameType):Void {
config = ConfigBundle.get(type);
config = Provider.get(IConfigBundle).get(type);
Provider.set(Config, config);
mapView.config = config;
mapView.data = LevelBundle.empty(config);
mapView.data = LevelUtil.empty(config);
brickList.data = config.bricks.filter(function(brick) return brick.index > -1);
spawnPointList.data = config.points;
@@ -96,13 +96,13 @@ class LevelFrame extends VGroupView implements ViewBuilder implements LevelFrame
L.d(TAG, 'OPEN');
FileUtil.browse().then(function(content:FileContent) {
fileNameLabel.text = content.name;
mapView.data = LevelBundle.loads(config, content.content);
mapView.data = LevelUtil.loads(config, content.content);
});
case 'saveButton':
L.d(TAG, 'SAVE');
FileUtil.save({
name: fileNameLabel.text,
content: LevelBundle.dumps(config, mapView.data),
content: LevelUtil.dumps(config, mapView.data),
});
case _:
}