-
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package ru.m.armageddon.client;
|
||||
|
||||
import protohx.Message;
|
||||
import haxe.crypto.Md5;
|
||||
import flash.Lib;
|
||||
import flash.events.MouseEvent;
|
||||
import ru.m.armageddon.core.connect.FlashConnection;
|
||||
@@ -7,7 +9,7 @@ import ru.m.armageddon.core.connect.IConnection;
|
||||
import haxework.log.TraceLogger;
|
||||
import ru.m.armageddon.proto.LoginRequest;
|
||||
|
||||
class Client {
|
||||
class Client implements IConnectionHandler {
|
||||
|
||||
private static inline var TAG = "Armageddon";
|
||||
|
||||
@@ -21,17 +23,29 @@ class Client {
|
||||
private var connection:IConnection;
|
||||
|
||||
public function new() {
|
||||
connection = new FlashConnection("localhost", 5000, onConnect);
|
||||
connection = new FlashConnection("localhost", 5000, this);
|
||||
|
||||
Lib.current.stage.addEventListener(MouseEvent.CLICK, function(_) {
|
||||
onConnect(_);
|
||||
onConnected();
|
||||
});
|
||||
}
|
||||
|
||||
public function onConnect(?event:Dynamic):Void {
|
||||
public function onConnected():Void {
|
||||
var request = new LoginRequest();
|
||||
request.login = "shmyga";
|
||||
request.password = "xkbp8jh9z2";
|
||||
request.password = Md5.encode("xkbp8jh9z2");
|
||||
connection.send(request);
|
||||
}
|
||||
|
||||
public function onDisconnected():Void {
|
||||
|
||||
}
|
||||
|
||||
public function onError(error:Dynamic):Void {
|
||||
|
||||
}
|
||||
|
||||
public function onPacket(packet:Message):Void {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user