[client] add position to IGamePanel
This commit is contained in:
@@ -2,6 +2,7 @@ package ru.m.tankz.view.game;
|
||||
|
||||
import haxework.view.LabelView;
|
||||
import haxework.view.VGroupView;
|
||||
import ru.m.geom.Direction;
|
||||
import ru.m.tankz.game.GameEvent;
|
||||
import ru.m.tankz.game.GameState;
|
||||
import ru.m.tankz.preset.ClassicGame;
|
||||
@@ -9,6 +10,7 @@ import ru.m.tankz.Type.PlayerId;
|
||||
import ru.m.tankz.view.common.LifeView;
|
||||
|
||||
@:template class ClassicGamePanel extends VGroupView implements IGamePanel {
|
||||
public var position(default, null):Direction = Direction.RIGHT;
|
||||
|
||||
@:view var bot:LifeView;
|
||||
@:view var player1:LifeView;
|
||||
|
||||
@@ -3,11 +3,13 @@ package ru.m.tankz.view.game;
|
||||
import haxework.view.DataView;
|
||||
import haxework.view.LabelView;
|
||||
import haxework.view.VGroupView;
|
||||
import ru.m.geom.Direction;
|
||||
import ru.m.tankz.game.GameEvent;
|
||||
import ru.m.tankz.game.GameState;
|
||||
import ru.m.tankz.view.common.LifeView;
|
||||
|
||||
@:template class DeathGamePanel extends VGroupView implements IGamePanel {
|
||||
public var position(default, null):Direction = Direction.RIGHT;
|
||||
|
||||
@:view var level:LabelView;
|
||||
@:view var players:DataView<PlayerState, LifeView>;
|
||||
|
||||
@@ -2,6 +2,7 @@ package ru.m.tankz.view.game;
|
||||
|
||||
import haxework.view.HGroupView;
|
||||
import haxework.view.LabelView;
|
||||
import ru.m.geom.Direction;
|
||||
import ru.m.tankz.game.GameEvent;
|
||||
import ru.m.tankz.game.GameState;
|
||||
import ru.m.tankz.preset.DotaGame;
|
||||
@@ -9,6 +10,7 @@ import ru.m.tankz.Type.TeamId;
|
||||
import ru.m.tankz.view.common.LifeView;
|
||||
|
||||
@:template class DotaGamePanel extends HGroupView implements IGamePanel {
|
||||
public var position(default, null):Direction = Direction.TOP;
|
||||
|
||||
@:view var radiant:LifeView;
|
||||
@:view var dire:LifeView;
|
||||
|
||||
@@ -2,6 +2,7 @@ package ru.m.tankz.view.game;
|
||||
|
||||
import haxework.view.IGroupView;
|
||||
import haxework.view.VGroupView;
|
||||
import ru.m.geom.Direction;
|
||||
import ru.m.tankz.preset.ClassicGame;
|
||||
import ru.m.tankz.preset.DeathGame;
|
||||
import ru.m.tankz.preset.DotaGame;
|
||||
@@ -26,7 +27,7 @@ import ru.m.tankz.Type;
|
||||
panel.remove();
|
||||
}
|
||||
panel = buildPanel(type);
|
||||
panelContainer(type).addView(panel);
|
||||
getContainer(panel.position).addView(panel);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@@ -40,12 +41,13 @@ import ru.m.tankz.Type;
|
||||
}
|
||||
}
|
||||
|
||||
private function panelContainer(type:GameType):IGroupView {
|
||||
return switch type {
|
||||
case ClassicGame.TYPE: right;
|
||||
case DotaGame.TYPE: top;
|
||||
case DeathGame.TYPE: right;
|
||||
case _: throw 'Unsupported type: ${type}';
|
||||
private function getContainer(position:Direction):IGroupView {
|
||||
return switch position.toString() {
|
||||
case "RIGHT": right;
|
||||
case "LEFT": left;
|
||||
case "TOP": top;
|
||||
case "BOTTOM": bottom;
|
||||
case _: throw 'Unsupported position: ${position}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package ru.m.tankz.view.game;
|
||||
|
||||
import haxework.view.IView;
|
||||
import ru.m.geom.Direction;
|
||||
import ru.m.tankz.game.IGame;
|
||||
|
||||
interface IGamePanel extends IView<Dynamic> extends GameListener {
|
||||
|
||||
public var position(default, null):Direction;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package ru.m.tankz.network;
|
||||
|
||||
import ru.m.tankz.game.Game;
|
||||
import ru.m.tankz.proto.core.GameProto;
|
||||
import ru.m.tankz.proto.game.GameChangeProto;
|
||||
|
||||
class NetworkGame extends Game {
|
||||
|
||||
@@ -13,10 +12,6 @@ class NetworkGame extends Game {
|
||||
// ToDo:
|
||||
}
|
||||
|
||||
public function update(changes:Array<GameChangeProto>):Void {
|
||||
|
||||
}
|
||||
|
||||
public function export():GameProto {
|
||||
return new GameProto();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user