[editor] game type select
This commit is contained in:
@@ -35,8 +35,8 @@ points:
|
||||
- {team: human, type: tank, index: 0, direction: top, x: 8, y: 24}
|
||||
- {team: human, type: tank, index: 1, direction: top, x: 16, y: 24}
|
||||
- {team: bot, type: tank, index: -1, direction: bottom, x: 0, y: 0}
|
||||
- {team: bot, type: tank, index: -1, direction: bottom, x: 12, y: 0}
|
||||
- {team: bot, type: tank, index: -1, direction: bottom, x: 24, y: 0}
|
||||
- {team: bot, type: tank, index: -2, direction: bottom, x: 12, y: 0}
|
||||
- {team: bot, type: tank, index: -3, direction: bottom, x: 24, y: 0}
|
||||
|
||||
bullet: &bullet
|
||||
width: 12
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
[keyboard]
|
||||
reset = 27 ;Escape
|
||||
pause = 80 ;P
|
||||
|
||||
[player0]
|
||||
key_left = 37 ;Left
|
||||
key_up = 38 ;Up
|
||||
key_right = 39 ;Rigth
|
||||
key_down = 40 ;Down
|
||||
key_shot = 96 ;Num0
|
||||
|
||||
[player1]
|
||||
key_left = 65 ;A
|
||||
key_up = 87 ;W
|
||||
key_right = 68 ;D
|
||||
key_down = 83 ;S
|
||||
key_shot = 32 ;Space
|
||||
|
||||
[bonus]
|
||||
score = 500
|
||||
freeztime = 10
|
||||
eagletime = 20
|
||||
protecttime = 15
|
||||
|
||||
[bots]
|
||||
count = 20 ;количество ботов на уровне
|
||||
respawntime = 2.5 ;задержка между появлением ботов в секундах
|
||||
shotdelay = 1.0 ;задержка между выстрелами
|
||||
turndelay = 0.3 ;задержка перед поворотом при столкновении
|
||||
rndturndelay = 2.0 ;задержка перед случайным поворотом
|
||||
turntoeagle = 0.75 ;вероятность поворота к Орлу
|
||||
bonus = 0.25 ;вероятность появления бонусного танка
|
||||
|
||||
|
||||
[tank_p0]
|
||||
movespeed = 2.5 ;скорость передвижения
|
||||
bulletspeed = 8.0 ;скорость полёта снаряда
|
||||
bullettype = 0 ;тип снаряда (0 - обычный, 1 - бронебойный)
|
||||
bulletcount = 1 ;количество снарядов
|
||||
hits = 1 ;количество хитпойнтов
|
||||
|
||||
[tank_p1]
|
||||
movespeed = 3.0
|
||||
bulletspeed = 8.5
|
||||
bullettype = 0
|
||||
bulletcount = 1
|
||||
hits = 1
|
||||
|
||||
[tank_p2]
|
||||
movespeed = 3.0
|
||||
bulletspeed = 9.0
|
||||
bullettype = 0
|
||||
bulletcount = 2
|
||||
hits = 1
|
||||
|
||||
[tank_p3]
|
||||
movespeed = 2.9
|
||||
bulletspeed = 9.0
|
||||
bullettype = 1
|
||||
bulletcount = 2
|
||||
hits = 2
|
||||
|
||||
|
||||
|
||||
[tank_b0]
|
||||
movespeed = 2.0
|
||||
bulletspeed = 7.0
|
||||
bullettype = 0
|
||||
bulletcount = 1
|
||||
hits = 1
|
||||
score = 100
|
||||
|
||||
[tank_b1]
|
||||
movespeed = 4.0
|
||||
bulletspeed = 7.0
|
||||
bullettype = 0
|
||||
bulletcount = 1
|
||||
hits = 1
|
||||
score = 200
|
||||
|
||||
[tank_b2]
|
||||
movespeed = 2.0
|
||||
bulletspeed = 9.0
|
||||
bullettype = 0
|
||||
bulletcount = 1
|
||||
hits = 1
|
||||
score = 300
|
||||
|
||||
[tank_b3]
|
||||
movespeed = 1.8
|
||||
bulletspeed = 8.0
|
||||
bullettype = 0
|
||||
bulletcount = 1
|
||||
hits = 4
|
||||
score = 400
|
||||
@@ -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