-
This commit is contained in:
@@ -13,7 +13,7 @@ import ru.m.armageddon.core.connect.flash.FlashConnection;
|
||||
import ru.m.armageddon.core.connect.IConnection;
|
||||
import haxework.log.TraceLogger;
|
||||
|
||||
class Client {
|
||||
class Client implements IConnectionHandler {
|
||||
|
||||
private static inline var TAG = "Armageddon";
|
||||
|
||||
@@ -34,8 +34,19 @@ class Client {
|
||||
|
||||
Provider.setFactory(GameData, GameData);
|
||||
Provider.set(IFrameSwitcher, switcher);
|
||||
Provider.set(IConnection, new FlashConnection("localhost", 5000));
|
||||
Provider.set(IConnection, new FlashConnection("localhost", 5000, this));
|
||||
|
||||
switcher.change(AuthFrame.ID);
|
||||
}
|
||||
|
||||
public function onConnected():Void {}
|
||||
|
||||
public function onDisconnected():Void {
|
||||
switcher.change(AuthFrame.ID);
|
||||
}
|
||||
|
||||
public function onError(error:Dynamic):Void {
|
||||
L.e(TAG, "", error);
|
||||
switcher.change(AuthFrame.ID);
|
||||
}
|
||||
}
|
||||
|
||||
35
src/client/haxe/ru/m/armageddon/client/frames/GameFrame.hx
Executable file
35
src/client/haxe/ru/m/armageddon/client/frames/GameFrame.hx
Executable file
@@ -0,0 +1,35 @@
|
||||
package ru.m.armageddon.client.frames;
|
||||
|
||||
import ru.m.armageddon.core.connect.IConnection;
|
||||
import haxework.gui.LabelView;
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.provider.Provider;
|
||||
import ru.m.armageddon.client.data.GameData;
|
||||
import haxework.gui.VGroupView;
|
||||
|
||||
class GameFrame extends VGroupView {
|
||||
|
||||
private static inline var TAG = "GameFrame";
|
||||
|
||||
public static inline var ID = "game";
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
}
|
||||
|
||||
public function init():Void {
|
||||
findViewById("logout", ButtonView).onPress = this;
|
||||
}
|
||||
|
||||
public function onShow():Void {
|
||||
var person = Provider.get(GameData).person;
|
||||
findViewById("name", LabelView).text = person.name;
|
||||
}
|
||||
|
||||
public function onPress(view:ButtonView):Void {
|
||||
switch (view.id) {
|
||||
case "logout":
|
||||
Provider.get(IConnection).disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ class PersonFrame extends HGroupView implements IPacketHandler implements ListVi
|
||||
|
||||
public function onPersonSelectResponse(packet:PersonSelectResponse):Void {
|
||||
Provider.get(GameData).person = packet.person;
|
||||
Provider.get(IFrameSwitcher).change("game");
|
||||
Provider.get(IFrameSwitcher).change(GameFrame.ID);
|
||||
}
|
||||
|
||||
public function onPacket(packet:Message):Void {}
|
||||
|
||||
Reference in New Issue
Block a user