[client] refactored GameFrame
This commit is contained in:
26
src/client/haxe/ru/m/tankz/view/game/DeathGamePanel.hx
Normal file
26
src/client/haxe/ru/m/tankz/view/game/DeathGamePanel.hx
Normal file
@@ -0,0 +1,26 @@
|
||||
package ru.m.tankz.view.game;
|
||||
|
||||
import haxework.view.DataView;
|
||||
import haxework.view.LabelView;
|
||||
import haxework.view.VGroupView;
|
||||
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 {
|
||||
|
||||
@: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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user