-
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package ru.m.tankz.data;
|
||||
|
||||
import ru.m.tankz.proto.Game;
|
||||
import ru.m.tankz.proto.Person;
|
||||
import ru.m.tankz.proto.Account;
|
||||
|
||||
class GameData {
|
||||
public var account:Account;
|
||||
public var person:Person;
|
||||
public var game:Game;
|
||||
}
|
||||
|
||||
9
src/client/haxe/ru/m/tankz/view/frames/GameListFrame.hx
Normal file → Executable file
9
src/client/haxe/ru/m/tankz/view/frames/GameListFrame.hx
Normal file → Executable file
@@ -1,5 +1,7 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
|
||||
import ru.m.tankz.proto.JoinGameResponse;
|
||||
import ru.m.tankz.proto.JoinGameRequest;
|
||||
import ru.m.tankz.proto.CreateGameResponse;
|
||||
import ru.m.tankz.proto.CreateGameRequest;
|
||||
import ru.m.tankz.view.frames.game.GameView;
|
||||
@@ -44,7 +46,7 @@ class GameListFrame extends VGroupView implements IPacketHandler implements List
|
||||
|
||||
public function onListItemClick(item:IListItemView<Game>):Void {
|
||||
L.d(TAG, "game selected: ", item.data.id);
|
||||
Provider.get(IFrameSwitcher).change(GameFrame.ID);
|
||||
Provider.get(IConnection).send(new JoinGameRequest().setGameId(item.data.id));
|
||||
}
|
||||
|
||||
public function onGamesResponse(packet:GamesResponse):Void {
|
||||
@@ -56,6 +58,11 @@ class GameListFrame extends VGroupView implements IPacketHandler implements List
|
||||
list.update();
|
||||
}
|
||||
|
||||
public function onJoinGameResponse(packet:JoinGameResponse):Void {
|
||||
Provider.get(GameData).game = packet.game;
|
||||
Provider.get(IFrameSwitcher).change(GameFrame.ID);
|
||||
}
|
||||
|
||||
public function onPacket(packet:Message):Void {}
|
||||
|
||||
public function onPress(view:ButtonView):Void {
|
||||
|
||||
4
src/client/haxe/ru/m/tankz/view/frames/game/GameView.hx
Normal file → Executable file
4
src/client/haxe/ru/m/tankz/view/frames/game/GameView.hx
Normal file → Executable file
@@ -1,5 +1,6 @@
|
||||
package ru.m.tankz.view.frames.game;
|
||||
|
||||
import ru.m.tankz.proto.Person;
|
||||
import ru.m.tankz.proto.Game;
|
||||
import haxework.gui.list.ListView.IListItemView;
|
||||
import haxework.gui.LabelView;
|
||||
@@ -25,7 +26,8 @@ class GameView extends HGroupView implements IListItemView<Game> {
|
||||
|
||||
private function set_data(value:Game):Game {
|
||||
this.data = value;
|
||||
nameLabel.text = "Game_" + this.data.id;
|
||||
var persons:String = Lambda.map(this.data.persons, function(p:Person) return p.name).join(",");
|
||||
nameLabel.text = "Game_" + this.data.id + "(" + persons + ")";
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user