[config] refactored

This commit is contained in:
2018-01-14 18:48:12 +03:00
parent 14d2b863c5
commit e77573803e
9 changed files with 195 additions and 108 deletions

View File

@@ -35,7 +35,7 @@ class BrickState implements IState<Brick> {
class EntityState implements IState<Entity> {
private var x:Float;
private var y:Float;
private var level:Int;
private var type:Int;
public function new() {}
@@ -47,8 +47,8 @@ class EntityState implements IState<Entity> {
}
if (Std.is(object, Tank)) {
var tank:Tank = cast object;
if (tank.config.level != level) {
level = tank.config.level;
if (tank.config.type != type) {
type = tank.config.type;
return true;
}
}
@@ -192,7 +192,7 @@ class Render extends SpriteView implements IRender {
var image:String = null;
if (Std.is(ent, Tank)) {
var tank:Tank = cast ent;
image = 'resources/images/tank/player/tank_p${tank.config.level}_${tank.index}-0.png';
image = 'resources/images/tank/${tank.config.group}/tank_${tank.config.group.charAt(0)}${tank.config.type}_${tank.index}-0.png';
} else if (Std.is(ent, Bullet)) {
var bullet:Bullet = cast ent;
image = 'resources/images/bullet/bullet_${bullet.config.piercing > 1 ? 1 : 0}.png';

View File

@@ -1,5 +1,6 @@
package ru.m.tankz.view.frames;
import ru.m.tankz.config.ConfigBundle;
import ru.m.tankz.proto.core.GameType;
import ru.m.tankz.proto.core.Game;
import ru.m.tankz.core.PlayerControl;
@@ -8,11 +9,11 @@ import protohx.Message;
import ru.m.tankz.proto.pack.GameUpdateResponse;
import ru.m.connect.IConnection;
import haxework.gui.ViewBuilder;
import ru.m.tankz.config.Config;
import flash.events.Event;
import haxework.provider.Provider;
import haxework.gui.VGroupView;
@:template("layout/frames/game.json", "layout/styles.json")
class GameFrame extends VGroupView implements ViewBuilder implements IPacketHandler {