-
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
|
||||
import ru.m.tankz.proto.ExitGameResponse;
|
||||
import haxework.frame.IFrameSwitcher;
|
||||
import ru.m.tankz.proto.GamesResponse;
|
||||
import ru.m.tankz.proto.ExitGameRequest;
|
||||
import ru.m.tankz.proto.StartGameResponse;
|
||||
import ru.m.tankz.proto.StartGameRequest;
|
||||
import ru.m.tankz.data.GameData;
|
||||
import protohx.Message;
|
||||
import haxework.gui.ButtonView;
|
||||
@@ -33,14 +39,23 @@ class GameReadyFrame extends VGroupView implements IPacketHandler {
|
||||
list.data = Provider.get(GameData).game.persons;
|
||||
}
|
||||
|
||||
public function onStartGameResponse(packet:StartGameResponse):Void {
|
||||
Provider.get(GameData).game = packet.game;
|
||||
Provider.get(IFrameSwitcher).change(GameFrame.ID);
|
||||
}
|
||||
|
||||
public function onExitGameResponse(packet:ExitGameResponse):Void {
|
||||
Provider.get(IFrameSwitcher).change(GameListFrame.ID);
|
||||
}
|
||||
|
||||
public function onPacket(packet:Message):Void {}
|
||||
|
||||
public function onPress(view:ButtonView):Void {
|
||||
switch (view.id) {
|
||||
case "start":
|
||||
|
||||
Provider.get(IConnection).send(new StartGameRequest());
|
||||
case "exit":
|
||||
|
||||
Provider.get(IConnection).send(new ExitGameRequest());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user