[editor] add PackListFrame
This commit is contained in:
@@ -14,7 +14,6 @@ import ru.m.tankz.game.record.GamePlayer;
|
||||
import ru.m.tankz.game.record.GameRecord;
|
||||
import ru.m.tankz.local.LocalGame;
|
||||
import ru.m.tankz.network.NetworkGame;
|
||||
import ru.m.tankz.preset.DotaGame;
|
||||
import ru.m.tankz.sound.SoundManager;
|
||||
import ru.m.tankz.storage.GameStorage;
|
||||
import ru.m.tankz.storage.SettingsStorage;
|
||||
@@ -58,7 +57,7 @@ import ru.m.tankz.view.gamepad.GamepadView;
|
||||
case RECORD(record): new GamePlayer(record);
|
||||
}
|
||||
gameView = switch game.type {
|
||||
case DotaGame.TYPE: GameViewB.factory(game.config);
|
||||
case "dota": GameViewB.factory(game.config);
|
||||
case _: GameViewA.factory(game.config);
|
||||
};
|
||||
gameViewContainer.addView(gameView);
|
||||
|
||||
@@ -5,6 +5,8 @@ overflow.y: crop
|
||||
views:
|
||||
- id: game
|
||||
$type: ru.m.tankz.view.game.GameViewContainer
|
||||
layout.hAlign: center
|
||||
layout.vAlign: middle
|
||||
- id: gamepad
|
||||
$type: ru.m.tankz.view.gamepad.GamepadView
|
||||
geometry.position: absolute
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.m.tankz.view.game;
|
||||
|
||||
import haxework.view.geometry.HAlign;
|
||||
import haxework.view.geometry.VAlign;
|
||||
import haxework.view.group.GroupView;
|
||||
|
||||
class GameViewContainer extends GroupView {
|
||||
@@ -10,8 +12,16 @@ class GameViewContainer extends GroupView {
|
||||
var s = Math.min(parent.width / width, parent.height / height);
|
||||
if (s < 1) {
|
||||
content.scaleX = content.scaleY = s;
|
||||
content.x = (parent.width - width * s) / 2;
|
||||
content.y = (parent.height - height * s) / 2;
|
||||
content.x = switch layout.hAlign {
|
||||
case LEFT | NONE: 0;
|
||||
case CENTER: (parent.width - width * s) / 2;
|
||||
case RIGHT: (parent.width - width * s);
|
||||
}
|
||||
content.y = switch layout.vAlign {
|
||||
case TOP | NONE: 0;
|
||||
case MIDDLE: (parent.height - height * s) / 2;
|
||||
case BOTTOM: (parent.height - height * s);
|
||||
}
|
||||
} else {
|
||||
content.scaleX = content.scaleY = 1;
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
package ru.m.tankz.preset;
|
||||
|
||||
import ru.m.tankz.Type;
|
||||
|
||||
class ClassicGame {
|
||||
public static var TYPE(default, never):GameType = 'classic';
|
||||
|
||||
public static var HUMAN(default, never):TeamId = 'human';
|
||||
public static var BOT(default, never):TeamId = 'bot';
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package ru.m.tankz.preset;
|
||||
|
||||
import ru.m.tankz.Type;
|
||||
|
||||
class DeathGame {
|
||||
public static var TYPE(default, never):GameType = 'death';
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package ru.m.tankz.preset;
|
||||
|
||||
import ru.m.tankz.Type;
|
||||
|
||||
class DotaGame {
|
||||
public static var TYPE(default, never):GameType = 'dota';
|
||||
|
||||
public static var RADIANT(default, never):TeamId = 'radiant';
|
||||
public static var DIRE(default, never):TeamId = 'dire';
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.m.tankz.editor;
|
||||
|
||||
import haxework.view.frame.FrameSwitcher;
|
||||
import haxework.provider.Provider;
|
||||
import haxework.resources.IResources;
|
||||
import haxework.resources.Resources;
|
||||
@@ -10,13 +11,14 @@ import ru.m.tankz.bundle.IConfigBundle;
|
||||
import ru.m.tankz.bundle.ILevelBundle;
|
||||
import ru.m.tankz.bundle.LevelBundle;
|
||||
import ru.m.tankz.editor.view.EditorView;
|
||||
import ru.m.tankz.editor.view.MapFrame;
|
||||
import ru.m.tankz.editor.view.PackListFrame;
|
||||
|
||||
class Editor {
|
||||
private static inline var TAG = 'Editor';
|
||||
private static inline var TAG = "Editor";
|
||||
|
||||
@:provide static var resources:IResources;
|
||||
@:provide static var theme:ITheme;
|
||||
@:provide static var switcher:FrameSwitcher;
|
||||
|
||||
public static function main() {
|
||||
L.push(new haxework.log.TraceLogger());
|
||||
@@ -31,7 +33,7 @@ class Editor {
|
||||
L.i(TAG, 'Version: ${Const.VERSION}');
|
||||
L.i(TAG, 'Build: ${Const.BUILD}');
|
||||
resources = new Resources();
|
||||
resources.text.put('version', '${Const.VERSION}');
|
||||
resources.text.put("version", '${Const.VERSION}');
|
||||
|
||||
theme = new AppTheme();
|
||||
|
||||
@@ -40,6 +42,7 @@ class Editor {
|
||||
|
||||
var view = new EditorView();
|
||||
Root.bind(view);
|
||||
view.switcher.change(MapFrame.ID);
|
||||
switcher = view.switcher;
|
||||
switcher.change(PackListFrame.ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,9 @@
|
||||
---
|
||||
$type: haxework.view.VGroupView
|
||||
style: dark
|
||||
geometry.stretch: true
|
||||
layout.hAlign: center
|
||||
views:
|
||||
# Tabs
|
||||
- id: tabs
|
||||
$type: haxework.view.data.ButtonGroup<String>
|
||||
geometry.margin.bottom: -4
|
||||
layout.margin: 2
|
||||
buttonStyle: button.tab
|
||||
+onDataSelect: ~function(id) switcher.change(id)
|
||||
data:
|
||||
- "map"
|
||||
- "tank"
|
||||
selected: "map"
|
||||
# Switcher
|
||||
- id: switcher
|
||||
$type: haxework.view.frame.FrameSwitcher
|
||||
- $type: haxework.view.frame.FrameSwitcher
|
||||
id: switcher
|
||||
geometry.stretch: true
|
||||
style: dark
|
||||
factory:
|
||||
_map_: {$class: ru.m.tankz.editor.view.MapFrame}
|
||||
_tank_: {$class: ru.m.tankz.editor.view.TankFrame}
|
||||
# Version
|
||||
- $type: haxework.view.form.LabelView
|
||||
geometry.position: absolute
|
||||
geometry.vAlign: top
|
||||
geometry.hAlign: right
|
||||
geometry.margin: 10
|
||||
text: $r:text:version
|
||||
_pack_list_: {$class: ru.m.tankz.editor.view.PackListFrame}
|
||||
_pack_: {$class: ru.m.tankz.editor.view.PackFrame}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
---
|
||||
geometry.stretch: true
|
||||
geometry.padding: 10
|
||||
overflow.y: scroll
|
||||
layout:
|
||||
$type: haxework.view.layout.VerticalLayout
|
||||
margin: 2
|
||||
vAlign: top
|
||||
hAlign: center
|
||||
views:
|
||||
- $type: haxework.view.group.HGroupView
|
||||
layout.margin: 5
|
||||
views:
|
||||
- $type: haxework.view.form.ButtonView
|
||||
text: Classic
|
||||
+onPress: ~function(_) type = 'classic'
|
||||
- $type: haxework.view.form.ButtonView
|
||||
text: DotA
|
||||
+onPress: ~function(_) type = 'dota'
|
||||
- $type: haxework.view.form.ButtonView
|
||||
text: DeathMatch
|
||||
+onPress: ~function(_) type = 'death'
|
||||
- $type: haxework.view.group.HGroupView
|
||||
layout.vAlign: middle
|
||||
views:
|
||||
- $type: haxework.view.form.LabelView
|
||||
text: "Name:"
|
||||
- id: levelName
|
||||
$type: haxework.view.form.InputView
|
||||
geometry.width: 300
|
||||
geometry.height: 26
|
||||
text: ""
|
||||
- $type: haxework.view.form.LabelView
|
||||
text: "Size:"
|
||||
geometry.margin.left: 20
|
||||
- id: width
|
||||
$type: haxework.view.form.InputView
|
||||
geometry.width: 50
|
||||
geometry.height: 26
|
||||
- $type: haxework.view.form.LabelView
|
||||
text: "x"
|
||||
- id: height
|
||||
$type: haxework.view.form.InputView
|
||||
geometry.width: 50
|
||||
geometry.height: 26
|
||||
- $type: haxework.view.form.ButtonView
|
||||
style: button.start.small
|
||||
+onPress: ~applySize()
|
||||
- $type: haxework.view.form.ButtonView
|
||||
style: button.close.small
|
||||
+onPress: ~resetSize()
|
||||
# map
|
||||
- $type: haxework.view.group.HGroupView
|
||||
views:
|
||||
- id: spawnPointList
|
||||
$type: haxework.view.data.DataView
|
||||
geometry.padding: 3
|
||||
layout:
|
||||
$type: haxework.view.layout.VerticalLayout
|
||||
hAlign: center
|
||||
margin: 5
|
||||
factory: ~ru.m.tankz.editor.view.map.SpawnPointView.factory
|
||||
+onDataSelect: ~selectSpawnPoint
|
||||
- id: mapView
|
||||
$type: ru.m.tankz.editor.view.map.MapEditView
|
||||
- id: brickList
|
||||
$type: haxework.view.data.DataView
|
||||
geometry.padding: 3
|
||||
layout:
|
||||
$type: haxework.view.layout.VerticalLayout
|
||||
hAlign: center
|
||||
margin: 5
|
||||
factory: ~ru.m.tankz.editor.view.map.BrickView.factory
|
||||
+onDataSelect: ~selectBrick
|
||||
- $type: haxework.view.group.HGroupView
|
||||
layout.margin: 5
|
||||
views:
|
||||
- id: openButton
|
||||
$type: haxework.view.form.ButtonView
|
||||
text: Open
|
||||
+onPress: ~open()
|
||||
- id: saveButton
|
||||
$type: haxework.view.form.ButtonView
|
||||
text: Save
|
||||
+onPress: ~save()
|
||||
@@ -1,25 +1,31 @@
|
||||
package ru.m.tankz.editor.view;
|
||||
|
||||
import haxework.view.list.LabelListItem;
|
||||
import haxework.view.data.DataView;
|
||||
import haxework.view.frame.FrameView;
|
||||
import haxework.view.form.InputView;
|
||||
import haxework.view.frame.FrameSwitcher;
|
||||
import haxework.view.frame.FrameView;
|
||||
import haxework.view.list.ListView;
|
||||
import ru.m.tankz.bundle.IConfigBundle;
|
||||
import ru.m.tankz.config.Config;
|
||||
import ru.m.tankz.editor.FileUtil;
|
||||
import ru.m.tankz.editor.view.map.BrickView;
|
||||
import ru.m.tankz.editor.view.map.MapEditView;
|
||||
import ru.m.tankz.editor.view.map.SpawnPointView;
|
||||
import ru.m.tankz.preset.ClassicGame;
|
||||
import ru.m.tankz.Type;
|
||||
import ru.m.tankz.util.LevelUtil;
|
||||
|
||||
@:template class MapFrame extends FrameView<Dynamic> {
|
||||
public static inline var ID = 'map';
|
||||
public static inline var TAG = 'map';
|
||||
using ru.m.tankz.view.ViewUtil;
|
||||
|
||||
@:template class PackFrame extends FrameView<LevelPack> {
|
||||
public static inline var ID = "pack";
|
||||
|
||||
public var type(default, set):GameType;
|
||||
public var level(default, set):LevelConfig;
|
||||
|
||||
private var fileName:String;
|
||||
|
||||
@:view var levels:ListView<LevelConfig>;
|
||||
@:view var levelName:InputView;
|
||||
@:view var mapView:MapEditView;
|
||||
@:view var spawnPointList:DataView<SpawnPoint, SpawnPointView>;
|
||||
@@ -29,14 +35,16 @@ import ru.m.tankz.util.LevelUtil;
|
||||
|
||||
@:provide var configBundle:IConfigBundle;
|
||||
@:provide var config:Config;
|
||||
@:provide static var switcher:FrameSwitcher;
|
||||
|
||||
public function new() {
|
||||
super(ID);
|
||||
}
|
||||
|
||||
public function init():Void {
|
||||
fileName = "level000.txt";
|
||||
type = ClassicGame.TYPE;
|
||||
override public function onShow(data:LevelPack):Void {
|
||||
super.onShow(data);
|
||||
type = data.id.type;
|
||||
levels.data = data.data;
|
||||
}
|
||||
|
||||
private function set_type(value:GameType):GameType {
|
||||
@@ -52,6 +60,31 @@ import ru.m.tankz.util.LevelUtil;
|
||||
return type;
|
||||
}
|
||||
|
||||
private function set_level(value:LevelConfig):LevelConfig {
|
||||
level = value;
|
||||
mapView.gridSize = level.size;
|
||||
mapView.data = level;
|
||||
levelName.text = level.name;
|
||||
if (level.size != null) {
|
||||
widthInput.text = Std.string(level.size.width);
|
||||
heightInput.text = Std.string(level.size.height);
|
||||
} else {
|
||||
widthInput.text = Std.string(config.map.grid.width);
|
||||
heightInput.text = Std.string(config.map.grid.height);
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
||||
private function levelViewFactory():IListItemView<LevelConfig> {
|
||||
var result = new LabelListItem(function(index:Int, value:LevelConfig) return value.toLevelLabel(true));
|
||||
result.geometry.height = 48;
|
||||
return result;
|
||||
}
|
||||
|
||||
private function onLevelSelect(item:IListItemView<LevelConfig>):Void {
|
||||
level = item.data;
|
||||
}
|
||||
|
||||
private function updateSelected(brick:BrickConfig = null, point:SpawnPoint = null) {
|
||||
for (v in brickList.dataViews) {
|
||||
v.selected = v.data == brick;
|
||||
@@ -74,17 +107,7 @@ import ru.m.tankz.util.LevelUtil;
|
||||
private function open():Void {
|
||||
FileUtil.browse().then(function(content:FileContent) {
|
||||
fileName = content.name;
|
||||
var data = LevelUtil.loads(content.content);
|
||||
mapView.gridSize = data.size;
|
||||
mapView.data = data;
|
||||
levelName.text = data.name;
|
||||
if (data.size != null) {
|
||||
widthInput.text = Std.string(data.size.width);
|
||||
heightInput.text = Std.string(data.size.height);
|
||||
} else {
|
||||
widthInput.text = Std.string(config.map.grid.width);
|
||||
heightInput.text = Std.string(config.map.grid.height);
|
||||
}
|
||||
level = LevelUtil.loads(content.content);
|
||||
});
|
||||
}
|
||||
|
||||
92
src/editor/haxe/ru/m/tankz/editor/view/PackFrame.yaml
Normal file
92
src/editor/haxe/ru/m/tankz/editor/view/PackFrame.yaml
Normal file
@@ -0,0 +1,92 @@
|
||||
---
|
||||
views:
|
||||
- $type: haxework.view.group.HGroupView
|
||||
geometry.stretch: true
|
||||
views:
|
||||
- id: levels
|
||||
$type: haxework.view.list.VListView
|
||||
geometry.width: 200
|
||||
geometry.height: 100%
|
||||
factory: ~levelViewFactory
|
||||
+onItemSelect: ~onLevelSelect
|
||||
scroll:
|
||||
$type: haxework.view.list.VScrollBarView
|
||||
- $type: haxework.view.group.VGroupView
|
||||
geometry.stretch: true
|
||||
views:
|
||||
- $type: haxework.view.group.HGroupView
|
||||
style: panel
|
||||
views:
|
||||
- $type: haxework.view.form.LabelView
|
||||
text: "Name:"
|
||||
- id: levelName
|
||||
$type: haxework.view.form.InputView
|
||||
geometry.width: 300
|
||||
geometry.height: 26
|
||||
text: ""
|
||||
- $type: haxework.view.form.LabelView
|
||||
text: "Size:"
|
||||
geometry.margin.left: 20
|
||||
- id: width
|
||||
$type: haxework.view.form.InputView
|
||||
geometry.width: 50
|
||||
geometry.height: 26
|
||||
- $type: haxework.view.form.LabelView
|
||||
text: "x"
|
||||
- id: height
|
||||
$type: haxework.view.form.InputView
|
||||
geometry.width: 50
|
||||
geometry.height: 26
|
||||
- $type: haxework.view.form.ButtonView
|
||||
style: button.start.small
|
||||
+onPress: ~applySize()
|
||||
- $type: haxework.view.form.ButtonView
|
||||
style: button.close.small
|
||||
+onPress: ~resetSize()
|
||||
- $type: haxework.view.group.HGroupView
|
||||
geometry.stretch: true
|
||||
views:
|
||||
- id: spawnPointList
|
||||
$type: haxework.view.data.DataView
|
||||
geometry.padding: 3
|
||||
layout:
|
||||
$type: haxework.view.layout.VerticalLayout
|
||||
hAlign: center
|
||||
margin: 5
|
||||
factory: ~ru.m.tankz.editor.view.map.SpawnPointView.factory
|
||||
+onDataSelect: ~selectSpawnPoint
|
||||
- id: brickList
|
||||
$type: haxework.view.data.DataView
|
||||
geometry.padding: 3
|
||||
layout:
|
||||
$type: haxework.view.layout.VerticalLayout
|
||||
hAlign: center
|
||||
margin: 5
|
||||
factory: ~ru.m.tankz.editor.view.map.BrickView.factory
|
||||
+onDataSelect: ~selectBrick
|
||||
- $type: haxework.view.group.GroupView
|
||||
geometry.stretch: true
|
||||
overflow.x: crop
|
||||
overflow.y: crop
|
||||
views:
|
||||
- $type: ru.m.tankz.view.game.GameViewContainer
|
||||
views:
|
||||
- id: mapView
|
||||
$type: ru.m.tankz.editor.view.map.MapEditView
|
||||
- $type: haxework.view.group.HGroupView
|
||||
style: panel
|
||||
layout.margin: 10
|
||||
views:
|
||||
- $type: haxework.view.SpriteView
|
||||
geometry.width: 100%
|
||||
- id: openButton
|
||||
$type: haxework.view.form.ButtonView
|
||||
text: Open
|
||||
+onPress: ~open()
|
||||
- id: saveButton
|
||||
$type: haxework.view.form.ButtonView
|
||||
text: Save
|
||||
+onPress: ~save()
|
||||
- $type: haxework.view.form.ButtonView
|
||||
style: button.prev
|
||||
+onPress: ~switcher.change("pack_list")
|
||||
41
src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.hx
Normal file
41
src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.hx
Normal file
@@ -0,0 +1,41 @@
|
||||
package ru.m.tankz.editor.view;
|
||||
|
||||
import haxework.view.data.DataView;
|
||||
import haxework.view.form.ButtonView;
|
||||
import haxework.view.frame.FrameSwitcher;
|
||||
import haxework.view.frame.FrameView;
|
||||
import ru.m.tankz.bundle.ILevelBundle;
|
||||
import ru.m.tankz.config.Config;
|
||||
import ru.m.tankz.Type;
|
||||
|
||||
@:template class PackListFrame extends FrameView<Dynamic> {
|
||||
public static inline var ID = "pack_list";
|
||||
|
||||
@:view("packs") var packView:DataView<LevelPack, ButtonView>;
|
||||
|
||||
@:provide static var levelBundle:ILevelBundle;
|
||||
@:provide static var switcher:FrameSwitcher;
|
||||
|
||||
public function new() {
|
||||
super(ID);
|
||||
}
|
||||
|
||||
override public function onShow(data:Dynamic):Void {
|
||||
super.onShow(data);
|
||||
packView.data = [
|
||||
levelBundle.get(new PackId("classic")),
|
||||
levelBundle.get(new PackId("dota")),
|
||||
levelBundle.get(new PackId("death")),
|
||||
];
|
||||
}
|
||||
|
||||
private function packViewFactory(index:Int, value:LevelPack):ButtonView {
|
||||
var result = new ButtonView();
|
||||
result.text = value.id;
|
||||
return result;
|
||||
}
|
||||
|
||||
private function onPackSelect(value:LevelPack):Void {
|
||||
switcher.change(PackFrame.ID, value);
|
||||
}
|
||||
}
|
||||
23
src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.yaml
Normal file
23
src/editor/haxe/ru/m/tankz/editor/view/PackListFrame.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
views:
|
||||
- id: packs
|
||||
$type: haxework.view.data.DataView
|
||||
geometry.width: 100%
|
||||
geometry.height: 100%
|
||||
geometry.padding: 30
|
||||
overflow.y: scroll
|
||||
layout:
|
||||
$type: haxework.view.layout.TailLayout
|
||||
rowSize: 10
|
||||
margin: 5
|
||||
factory: ~packViewFactory
|
||||
+onDataSelect: ~onPackSelect
|
||||
- $type: haxework.view.group.HGroupView
|
||||
style: panel
|
||||
layout.margin: 10
|
||||
views:
|
||||
- $type: haxework.view.SpriteView
|
||||
geometry.width: 100%
|
||||
- $type: haxework.view.form.ButtonView
|
||||
style: button.prev
|
||||
+onPress: ~switcher.change("pack_list")
|
||||
@@ -1,11 +1,24 @@
|
||||
package ru.m.tankz.editor.view.map;
|
||||
|
||||
import flash.geom.Matrix;
|
||||
import flash.display.BitmapData;
|
||||
import openfl.utils.Assets;
|
||||
import ru.m.tankz.config.Config;
|
||||
|
||||
class BrickView extends BrushView<BrickConfig> {
|
||||
|
||||
override private function resolveSrc(value:BrickConfig):String {
|
||||
return 'resources/image/map/${value.type}.png';
|
||||
override private function resolveImage(value:BrickConfig):BitmapData {
|
||||
var image = Assets.getBitmapData('resources/image/map/${value.type}.png');
|
||||
var result = new BitmapData(image.width * 2, image.height * 2, true, 0x00000000);
|
||||
var m = new Matrix();
|
||||
result.draw(image, m);
|
||||
m.translate(image.width, 0);
|
||||
result.draw(image, m);
|
||||
m.translate(0, image.height);
|
||||
result.draw(image, m);
|
||||
m.translate(-image.width, 0);
|
||||
result.draw(image, m);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static inline function factory(index:Int, value:BrickConfig) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package ru.m.tankz.editor.view.map;
|
||||
|
||||
import haxework.color.Color;
|
||||
import flash.display.BitmapData;
|
||||
import flash.display.Shape;
|
||||
import haxework.color.Color;
|
||||
import haxework.view.ImageView;
|
||||
import openfl.utils.Assets;
|
||||
|
||||
class BrushView<D> extends ImageView {
|
||||
|
||||
@@ -30,7 +30,7 @@ class BrushView<D> extends ImageView {
|
||||
selectView.graphics.lineStyle();
|
||||
}
|
||||
|
||||
private function resolveSrc(value:D):String {
|
||||
private function resolveImage(value:D):BitmapData {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -40,8 +40,7 @@ class BrushView<D> extends ImageView {
|
||||
|
||||
private function set_data(value:D):D {
|
||||
data = value;
|
||||
var src = resolveSrc(value);
|
||||
image = Assets.getBitmapData(src);
|
||||
image = resolveImage(value);
|
||||
color = resolveColor(value);
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package ru.m.tankz.editor.view.map;
|
||||
|
||||
import flash.display.BitmapData;
|
||||
import haxework.color.Color;
|
||||
import ru.m.tankz.config.Config;
|
||||
import ru.m.tankz.render.RenderUtil;
|
||||
import ru.m.tankz.Type.PlayerId;
|
||||
|
||||
class SpawnPointView extends BrushView<SpawnPoint> {
|
||||
@@ -12,7 +14,7 @@ class SpawnPointView extends BrushView<SpawnPoint> {
|
||||
return config.getColor(new PlayerId(value.team, value.index));
|
||||
}
|
||||
|
||||
override private function resolveSrc(value:SpawnPoint):String {
|
||||
override private function resolveImage(value:SpawnPoint):BitmapData {
|
||||
var preset:GamePreset = config.presets[config.presets.length - 1];
|
||||
var tankConfig:TankConfig = null;
|
||||
if (value.type == 'tank') {
|
||||
@@ -20,10 +22,10 @@ class SpawnPointView extends BrushView<SpawnPoint> {
|
||||
var tankType = player.tanks[0];
|
||||
tankConfig = config.getTank(tankType.type);
|
||||
}
|
||||
return switch(value.type) {
|
||||
case 'eagle': 'resources/image/eagle/eagle.png';
|
||||
case 'tank': 'resources/image/tank/${tankConfig.skin}-0.png';
|
||||
case _: 'resources/image/eagle/eagle-death.png';
|
||||
return switch value.type {
|
||||
case "eagle": RenderUtil.eagleImage();
|
||||
case "tank": RenderUtil.tankImage(tankConfig.skin);
|
||||
case _: RenderUtil.eagleImage(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user