webscoket implemented
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package ru.m.armageddon.client;
|
||||
|
||||
import flash.text.TextFieldType;
|
||||
import flash.Lib;
|
||||
import flash.text.TextField;
|
||||
import haxework.log.JSLogger;
|
||||
import ru.m.armageddon.client.data.GameData;
|
||||
import haxework.frame.IFrameSwitcher;
|
||||
import haxework.provider.Provider;
|
||||
@@ -10,6 +14,7 @@ import haxework.gui.GuiBuilder;
|
||||
import haxe.Json;
|
||||
import openfl.Assets;
|
||||
import ru.m.armageddon.core.connect.flash.FlashConnection;
|
||||
import ru.m.armageddon.core.connect.js.JsConnection;
|
||||
import ru.m.armageddon.core.connect.IConnection;
|
||||
import haxework.log.TraceLogger;
|
||||
|
||||
@@ -19,6 +24,7 @@ class Client implements IConnectionHandler {
|
||||
|
||||
public static function main() {
|
||||
L.push(new TraceLogger());
|
||||
L.push(new JSLogger());
|
||||
L.d(TAG, Meta.getVersion());
|
||||
new Client();
|
||||
}
|
||||
@@ -34,9 +40,20 @@ class Client implements IConnectionHandler {
|
||||
|
||||
Provider.setFactory(GameData, GameData);
|
||||
Provider.set(IFrameSwitcher, switcher);
|
||||
Provider.set(IConnection, new FlashConnection("localhost", 5000, this));
|
||||
//#if flash
|
||||
//Provider.set(IConnection, new FlashConnection("localhost", 5001, this));
|
||||
//#elseif html5
|
||||
Provider.set(IConnection, new JsConnection("localhost", 5001, this));
|
||||
//#end
|
||||
|
||||
switcher.change(AuthFrame.ID);
|
||||
|
||||
/*var tf = new TextField();
|
||||
tf.type = TextFieldType.INPUT;
|
||||
tf.text = "Azaza";
|
||||
tf.border = true;
|
||||
tf.borderColor = 0xff0000;
|
||||
Lib.current.addChild(tf);*/
|
||||
}
|
||||
|
||||
public function onConnected():Void {}
|
||||
|
||||
@@ -47,6 +47,9 @@ class AuthFrame extends VGroupView implements IPacketHandler {
|
||||
loginInput.text = so.data.login;
|
||||
passwordInput.text = so.data.password;
|
||||
onPress(null);
|
||||
} else {
|
||||
loginInput.text = "shmyga";
|
||||
passwordInput.text = "xkbp8jh9z2";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +59,7 @@ class AuthFrame extends VGroupView implements IPacketHandler {
|
||||
var connection:IConnection = Provider.get(IConnection);
|
||||
connection.connect()
|
||||
.success(function(_) {
|
||||
L.d(TAG, "Connected");
|
||||
connection.send(new LoginRequest().setLogin(login).setPassword(password));
|
||||
})
|
||||
.fail(function(error) {
|
||||
|
||||
Reference in New Issue
Block a user