29 lines
861 B
Haxe
29 lines
861 B
Haxe
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>;
|
|
|
|
public function onGameEvent(event:GameEvent):Void {
|
|
switch event {
|
|
case START(state):
|
|
level.text = 'Level ${state.levelId}';
|
|
players.data = Lambda.array(state.players);
|
|
case _:
|
|
for (view in players.views) {
|
|
view.toUpdate();
|
|
}
|
|
}
|
|
}
|
|
}
|