big update
This commit is contained in:
43
src/client/haxe/layout/frames/auth.json
Normal file
43
src/client/haxe/layout/frames/auth.json
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"pWidth": 100, "pHeight": 100, "layoutMargin": 3,
|
||||
"views": [
|
||||
{
|
||||
"@type": "haxework.gui.HGroupView",
|
||||
"contentSize": true,
|
||||
"views": [
|
||||
{
|
||||
"@type": "haxework.gui.LabelView",
|
||||
"width": 150, "height": 25, "text": "Login"
|
||||
},
|
||||
{
|
||||
"id": "loginInput", "@type": "haxework.gui.InputView",
|
||||
"skin": {"@type": "haxework.gui.skin.ColorSkin", "color": "0xffffff"},
|
||||
"width": 200, "height": 25, "text": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"@type": "haxework.gui.HGroupView",
|
||||
"contentSize": true,
|
||||
"views": [
|
||||
{
|
||||
"@type": "haxework.gui.LabelView",
|
||||
"width": 150, "height": 25, "text": "Password"
|
||||
},
|
||||
{
|
||||
"id": "passwordInput", "@type": "haxework.gui.InputView",
|
||||
"skin": {"@type": "haxework.gui.skin.ColorSkin", "color": "0xffffff"},
|
||||
"width": 200, "height": 25, "text": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"id": "authButton",
|
||||
"@type": "haxework.gui.ButtonView",
|
||||
"width": 100, "height": 45,
|
||||
"text": "Auth",
|
||||
"@style": "button_skin"
|
||||
}
|
||||
]
|
||||
}
|
||||
19
src/client/haxe/layout/frames/game.json
Normal file
19
src/client/haxe/layout/frames/game.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"views": [
|
||||
{
|
||||
"id": "name", "@type": "haxework.gui.LabelView",
|
||||
"pWidth": 100, "height": 25, "text": ""
|
||||
},
|
||||
{
|
||||
"id": "restart", "@type": "haxework.gui.ButtonView",
|
||||
"width": 100, "height": 45,
|
||||
"text": "Restart",
|
||||
"@style": "button_skin"
|
||||
},
|
||||
{
|
||||
"id": "render", "@type": "ru.m.tankz.render.Render",
|
||||
"contentSize": true
|
||||
}
|
||||
]
|
||||
}
|
||||
24
src/client/haxe/layout/frames/game_list.json
Normal file
24
src/client/haxe/layout/frames/game_list.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"views": [
|
||||
{
|
||||
"id": "name", "@type": "haxework.gui.LabelView",
|
||||
"pWidth": 100, "height": 25, "text": ""
|
||||
},
|
||||
{
|
||||
"id": "create", "@type": "haxework.gui.ButtonView",
|
||||
"width": 100, "height": 45,
|
||||
"text": "Create",
|
||||
"@style": "button_skin"
|
||||
},
|
||||
{
|
||||
"id": "list", "@type": "haxework.gui.list.VListView<ru.m.tankz.proto.Game>",
|
||||
"factory": "@class:ru.m.tankz.view.frames.list.GameView",
|
||||
"scroll": {
|
||||
"@type": "haxework.gui.list.VScrollView",
|
||||
"skin": {"@type": "haxework.gui.list.VScrollSkin"}
|
||||
},
|
||||
"pWidth": 100, "pHeight": 100, "layoutMargin": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
30
src/client/haxe/layout/frames/game_ready.json
Normal file
30
src/client/haxe/layout/frames/game_ready.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"views": [
|
||||
{
|
||||
"id": "name", "@type": "haxework.gui.LabelView",
|
||||
"pWidth": 100, "height": 25, "text": ""
|
||||
},
|
||||
{
|
||||
"id": "start", "@type": "haxework.gui.ButtonView",
|
||||
"width": 100, "height": 45,
|
||||
"text": "Start",
|
||||
"@style": "button_skin"
|
||||
},
|
||||
{
|
||||
"id": "exit", "@type": "haxework.gui.ButtonView",
|
||||
"width": 100, "height": 45,
|
||||
"text": "Exit",
|
||||
"@style": "button_skin"
|
||||
},
|
||||
{
|
||||
"id": "list", "@type": "haxework.gui.list.VListView<ru.m.tankz.proto.Person>",
|
||||
"factory": "@class:ru.m.tankz.view.frames.list.PersonView",
|
||||
"scroll": {
|
||||
"@type": "haxework.gui.list.VScrollView",
|
||||
"skin": {"@type": "haxework.gui.list.VScrollSkin"}
|
||||
},
|
||||
"pWidth": 100, "pHeight": 100, "layoutMargin": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
14
src/client/haxe/layout/frames/person_list.json
Normal file
14
src/client/haxe/layout/frames/person_list.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"pWidth": 100, "pHeight": 100, "layoutMargin": 3, "paddings": 10,
|
||||
"views": [
|
||||
{
|
||||
"id": "list", "@type": "haxework.gui.list.VListView<ru.m.tankz.proto.Person>",
|
||||
"factory": "@class:ru.m.tankz.view.frames.list.PersonView",
|
||||
"scroll": {
|
||||
"@type": "haxework.gui.list.VScrollView",
|
||||
"skin": {"@type": "haxework.gui.list.VScrollSkin"}
|
||||
},
|
||||
"pWidth": 100, "pHeight": 100, "layoutMargin": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
46
src/client/haxe/layout/main.json
Executable file
46
src/client/haxe/layout/main.json
Executable file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"@type": "haxework.gui.VGroupView",
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"views": [
|
||||
{
|
||||
"id":"top", "@type": "haxework.gui.HGroupView",
|
||||
"pWidth": 100, "height": 30,
|
||||
"skin": {"@type": "haxework.gui.skin.ColorSkin", "color": "0x105000"},
|
||||
"views": [
|
||||
{
|
||||
"id": "logout", "@type": "haxework.gui.ButtonView",
|
||||
"width": 100, "height": 30,
|
||||
"text": "Logout",
|
||||
"@style": "button_skin"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "switcher", "@type": "haxework.gui.frame.FrameSwitcher",
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"skin": {"@type": "haxework.gui.skin.BitmapSkin", "image": "@asset:image:resources/images/background.png", "fillType": "REPEAT"},
|
||||
"views": [
|
||||
{
|
||||
"id": "auth",
|
||||
"@type": "ru.m.tankz.view.frames.AuthFrame"
|
||||
},
|
||||
{
|
||||
"id": "person_list",
|
||||
"@type": "ru.m.tankz.view.frames.PersonListFrame"
|
||||
},
|
||||
{
|
||||
"id": "game_list",
|
||||
"@type": "ru.m.tankz.view.frames.GameListFrame"
|
||||
},
|
||||
{
|
||||
"id": "game_ready",
|
||||
"@type": "ru.m.tankz.view.frames.GameReadyFrame"
|
||||
},
|
||||
{
|
||||
"id": "game",
|
||||
"@type": "ru.m.tankz.view.frames.GameFrame"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
12
src/client/haxe/layout/styles.json
Normal file
12
src/client/haxe/layout/styles.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"button_skin": {
|
||||
"skin": {
|
||||
"@type": "haxework.gui.skin.ButtonBitmapSkin",
|
||||
"upImage": "@asset:image:resources/images/control/button_normal.png",
|
||||
"downImage": "@asset:image:resources/images/control/button_down.png",
|
||||
"overImage": "@asset:image:resources/images/control/button_over.png",
|
||||
"fillType": "NINEPATH"
|
||||
},
|
||||
"fontColor": "0xffffff"
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,25 @@
|
||||
package ru.m.tankz;
|
||||
|
||||
import haxework.gui.VGroupView;
|
||||
import haxework.gui.ViewBuilder;
|
||||
import haxework.gui.ButtonView;
|
||||
import flash.display.Sprite;
|
||||
import haxework.gui.IGroupView;
|
||||
import ru.m.tankz.PacketBuilder;
|
||||
import haxework.log.JSLogger;
|
||||
import ru.m.tankz.data.GameData;
|
||||
import haxework.frame.IFrameSwitcher;
|
||||
import haxework.gui.frame.IFrameSwitcher;
|
||||
import haxework.provider.Provider;
|
||||
import ru.m.tankz.view.frames.AuthFrame;
|
||||
import haxework.frame.FrameSwitcher;
|
||||
import haxework.gui.frame.FrameSwitcher;
|
||||
import haxework.gui.Root;
|
||||
import haxework.gui.GuiBuilder;
|
||||
import haxe.Json;
|
||||
import openfl.Assets;
|
||||
import ru.m.core.connect.IConnection;
|
||||
import haxework.log.TraceLogger;
|
||||
|
||||
@:template("layout/main.json", "layout/styles.json")
|
||||
class MainView extends VGroupView implements ViewBuilder {}
|
||||
|
||||
class Client implements IConnectionHandler {
|
||||
|
||||
private static inline var TAG = "Tankz";
|
||||
@@ -31,28 +34,25 @@ class Client implements IConnectionHandler {
|
||||
}
|
||||
|
||||
|
||||
private var view:IGroupView<Sprite>;
|
||||
private var logout:ButtonView;
|
||||
private var view:MainView;
|
||||
private var switcher:FrameSwitcher;
|
||||
|
||||
public function new() {
|
||||
var bytes = Assets.getBytes("resources/layout/main.json");
|
||||
var form:Dynamic = Json.parse(bytes.readUTFBytes(bytes.bytesAvailable));
|
||||
view = GuiBuilder.build(form);
|
||||
new Root(view);
|
||||
switcher = view.findViewById("switcher");
|
||||
logout = view.findViewById("top:logout");
|
||||
logout.onPress = this;
|
||||
view = new MainView();
|
||||
Root.bind(view);
|
||||
switcher = view.switcher;
|
||||
view.logout.onPress = this;
|
||||
|
||||
Provider.setFactory(GameData, GameData);
|
||||
Provider.set(IFrameSwitcher, switcher);
|
||||
Provider.set(IPacketBuilder, new PacketBuilder());
|
||||
#if flash
|
||||
Provider.set(IConnection, new ru.m.core.connect.flash.FlashConnection("localhost", 5001, this));
|
||||
Provider.set(IConnection, new ru.m.core.connect.flash.FlashConnection("localhost", 5001));
|
||||
#elseif html5
|
||||
Provider.set(IConnection, new ru.m.core.connect.js.JsConnection("localhost", 5001, this));
|
||||
Provider.set(IConnection, new ru.m.core.connect.js.JsConnection("localhost", 5001));
|
||||
#end
|
||||
|
||||
Provider.get(IConnection).handler.addListener(this);
|
||||
switcher.change(AuthFrame.ID);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package ru.m.tankz.render;
|
||||
|
||||
import flash.display.Sprite;
|
||||
import haxework.gui.IView;
|
||||
import ru.m.tankz.game.ITankz;
|
||||
|
||||
interface IRender extends IView<Sprite> {
|
||||
interface IRender extends IView {
|
||||
public function draw(game:ITankz):Void;
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ class Render extends SpriteView implements IRender {
|
||||
super();
|
||||
mapLayer = new Sprite();
|
||||
tankLayer = new Sprite();
|
||||
content.addChild(mapLayer);
|
||||
content.addChild(tankLayer);
|
||||
contentAsSprite.addChild(mapLayer);
|
||||
contentAsSprite.addChild(tankLayer);
|
||||
}
|
||||
|
||||
public function draw(game:ITankz):Void {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
|
||||
import haxework.gui.ViewBuilder;
|
||||
import ru.m.core.connect.IConnection;
|
||||
import ru.m.tankz.data.GameData;
|
||||
import flash.net.SharedObject;
|
||||
import ru.m.tankz.proto.ErrorResponse;
|
||||
import protohx.Message;
|
||||
import haxework.frame.IFrameSwitcher;
|
||||
import haxework.gui.frame.IFrameSwitcher;
|
||||
import ru.m.tankz.proto.LoginRequest;
|
||||
import ru.m.tankz.proto.LoginResponse;
|
||||
import haxework.provider.Provider;
|
||||
@@ -14,7 +15,8 @@ import haxework.gui.InputView;
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.VGroupView;
|
||||
|
||||
class AuthFrame extends VGroupView implements IPacketHandler {
|
||||
@:template("layout/frames/auth.json", "layout/styles.json")
|
||||
class AuthFrame extends VGroupView implements ViewBuilder implements IPacketHandler implements IConnectionHandler {
|
||||
|
||||
private static inline var TAG = "AuthFrame";
|
||||
|
||||
@@ -22,18 +24,9 @@ class AuthFrame extends VGroupView implements IPacketHandler {
|
||||
|
||||
private var so:SharedObject;
|
||||
|
||||
private var loginInput:InputView;
|
||||
private var passwordInput:InputView;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
public function init() {
|
||||
so = SharedObject.getLocal("auth", "/");
|
||||
}
|
||||
|
||||
public function init():Void {
|
||||
findViewById("auth", ButtonView).onPress = this;
|
||||
loginInput = findViewById("login:input");
|
||||
passwordInput = findViewById("password:input");
|
||||
authButton.onPress = this;
|
||||
passwordInput.textField.displayAsPassword = true;
|
||||
if (so.data.login != null && so.data.password != null) {
|
||||
loginInput.text = so.data.login;
|
||||
@@ -41,8 +34,9 @@ class AuthFrame extends VGroupView implements IPacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public function onShow():Void {
|
||||
Provider.get(IConnection).packetHandler = this;
|
||||
public function onShow() {
|
||||
Provider.get(IConnection).handler.addListener(this);
|
||||
Provider.get(IConnection).packetHandler.addListener(this);
|
||||
if (so.data.login != null && so.data.password != null) {
|
||||
loginInput.text = so.data.login;
|
||||
passwordInput.text = so.data.password;
|
||||
@@ -53,21 +47,18 @@ class AuthFrame extends VGroupView implements IPacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public function onPress(_):Void {
|
||||
var login:String = loginInput.text;
|
||||
var password:String = Md5.encode(passwordInput.text);
|
||||
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) {
|
||||
L.e(TAG, "Auth", error);
|
||||
});
|
||||
|
||||
public function onHide() {
|
||||
Provider.get(IConnection).handler.removeListener(this);
|
||||
Provider.get(IConnection).packetHandler.removeListener(this);
|
||||
}
|
||||
|
||||
public function onPress(_) {
|
||||
Provider.get(IConnection).connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* IPacketHandler
|
||||
**/
|
||||
public function onLoginResponse(packet:LoginResponse):Void {
|
||||
so.setProperty("login", loginInput.text);
|
||||
so.setProperty("password", passwordInput.text);
|
||||
@@ -82,4 +73,20 @@ class AuthFrame extends VGroupView implements IPacketHandler {
|
||||
|
||||
public function onPacket(packet:Message):Void {}
|
||||
|
||||
/**
|
||||
* IConnectionHandler
|
||||
**/
|
||||
public function onConnected():Void {
|
||||
Provider.get(IConnection).send(
|
||||
new LoginRequest()
|
||||
.setLogin(loginInput.text)
|
||||
.setPassword(Md5.encode(passwordInput.text))
|
||||
);
|
||||
}
|
||||
|
||||
public function onDisconnected():Void {}
|
||||
|
||||
public function onError(error:Dynamic):Void {
|
||||
L.e(TAG, "Auth", error);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,28 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
|
||||
import haxework.gui.ViewBuilder;
|
||||
import ru.m.tankz.config.TankzConfig;
|
||||
import ru.m.tankz.render.IRender;
|
||||
import flash.events.Event;
|
||||
import ru.m.tankz.game.Tankz;
|
||||
import ru.m.tankz.game.ITankz;
|
||||
import ru.m.core.connect.IConnection;
|
||||
import haxework.gui.LabelView;
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.provider.Provider;
|
||||
import ru.m.tankz.data.GameData;
|
||||
import haxework.gui.VGroupView;
|
||||
import ru.m.tankz.render.Render;
|
||||
|
||||
class GameFrame extends VGroupView {
|
||||
@:template("layout/frames/game.json", "layout/styles.json")
|
||||
class GameFrame extends VGroupView implements ViewBuilder {
|
||||
|
||||
private static inline var TAG = "GameFrame";
|
||||
|
||||
public static inline var ID = "game";
|
||||
|
||||
private var render:IRender;
|
||||
private var game:ITankz;
|
||||
|
||||
private var config:TankzConfig;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
public function init():Void {
|
||||
game = new Tankz();
|
||||
config = {
|
||||
map: {
|
||||
@@ -35,16 +32,12 @@ class GameFrame extends VGroupView {
|
||||
gridHeight: 26
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public function init():Void {
|
||||
render = findViewById("render");
|
||||
findViewById("restart", ButtonView).onPress = this;
|
||||
restart.onPress = this;
|
||||
}
|
||||
|
||||
public function onShow():Void {
|
||||
var person = Provider.get(GameData).person;
|
||||
findViewById("name", LabelView).text = person.name;
|
||||
name.text = person.name;
|
||||
game.init(config);
|
||||
content.addEventListener(Event.ENTER_FRAME, updateGame);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
|
||||
import haxework.gui.ViewBuilder;
|
||||
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.list.GameView;
|
||||
import haxework.frame.IFrameSwitcher;
|
||||
import haxework.gui.frame.IFrameSwitcher;
|
||||
import haxework.gui.ButtonView;
|
||||
import haxework.gui.LabelView;
|
||||
import ru.m.tankz.proto.GamesResponse;
|
||||
@@ -19,18 +19,13 @@ import haxework.provider.Provider;
|
||||
import haxework.gui.list.VListView;
|
||||
import haxework.gui.VGroupView;
|
||||
|
||||
class GameListFrame extends VGroupView implements IPacketHandler implements ListViewListener<Game> {
|
||||
@:template("layout/frames/game_list.json", "layout/styles.json")
|
||||
class GameListFrame extends VGroupView implements ViewBuilder implements IPacketHandler implements ListViewListener<Game> {
|
||||
|
||||
private static inline var TAG = "GameListFrame";
|
||||
|
||||
public static inline var ID = "game_list";
|
||||
|
||||
private var list:VListView<Game>;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
}
|
||||
|
||||
public function init() {
|
||||
list = findViewById("list");
|
||||
list.dispatcher.addListener(this);
|
||||
@@ -39,10 +34,14 @@ class GameListFrame extends VGroupView implements IPacketHandler implements List
|
||||
|
||||
public function onShow() {
|
||||
findViewById("name", LabelView).text = Provider.get(GameData).person.name;
|
||||
Provider.get(IConnection).packetHandler = this;
|
||||
Provider.get(IConnection).packetHandler.addListener(this);
|
||||
Provider.get(IConnection).send(new GamesRequest());
|
||||
}
|
||||
|
||||
public function onHide() {
|
||||
Provider.get(IConnection).packetHandler.removeListener(this);
|
||||
}
|
||||
|
||||
public function onListItemClick(item:IListItemView<Game>):Void {
|
||||
L.d(TAG, "game selected: ", item.data.id);
|
||||
Provider.get(IConnection).send(new JoinGameRequest().setGameId(item.data.id));
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
|
||||
import haxework.gui.ViewBuilder;
|
||||
import ru.m.tankz.proto.ExitGameResponse;
|
||||
import haxework.frame.IFrameSwitcher;
|
||||
import haxework.gui.frame.IFrameSwitcher;
|
||||
import ru.m.tankz.proto.GamesResponse;
|
||||
import ru.m.tankz.proto.ExitGameRequest;
|
||||
import ru.m.tankz.proto.StartGameResponse;
|
||||
@@ -15,18 +16,13 @@ import haxework.provider.Provider;
|
||||
import haxework.gui.VGroupView;
|
||||
import ru.m.core.connect.IConnection;
|
||||
|
||||
class GameReadyFrame extends VGroupView implements IPacketHandler {
|
||||
@:template("layout/frames/game_ready.json", "layout/styles.json")
|
||||
class GameReadyFrame extends VGroupView implements ViewBuilder implements IPacketHandler {
|
||||
|
||||
private static inline var TAG = "GameReadyFrame";
|
||||
|
||||
public static inline var ID = "game_ready";
|
||||
|
||||
private var list:VListView<Person>;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
}
|
||||
|
||||
public function init() {
|
||||
list = findViewById("list");
|
||||
//list.dispatcher.addListener(this);
|
||||
@@ -35,10 +31,14 @@ class GameReadyFrame extends VGroupView implements IPacketHandler {
|
||||
}
|
||||
|
||||
public function onShow() {
|
||||
Provider.get(IConnection).packetHandler = this;
|
||||
Provider.get(IConnection).packetHandler.addListener(this);
|
||||
list.data = Provider.get(GameData).game.persons;
|
||||
}
|
||||
|
||||
public function onHide() {
|
||||
Provider.get(IConnection).packetHandler.removeListener(this);
|
||||
}
|
||||
|
||||
public function onStartGameResponse(packet:StartGameResponse):Void {
|
||||
Provider.get(GameData).game = packet.game;
|
||||
Provider.get(IFrameSwitcher).change(GameFrame.ID);
|
||||
|
||||
@@ -1,31 +1,25 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
|
||||
import haxework.gui.ViewBuilder;
|
||||
import ru.m.tankz.view.frames.GameListFrame;
|
||||
import haxework.frame.IFrameSwitcher;
|
||||
import haxework.gui.frame.IFrameSwitcher;
|
||||
import ru.m.tankz.proto.PersonSelectResponse;
|
||||
import ru.m.tankz.proto.PersonSelectRequest;
|
||||
import haxework.gui.list.ListView;
|
||||
import protohx.Message;
|
||||
import ru.m.core.connect.IConnection;
|
||||
import ru.m.tankz.view.frames.list.PersonView;
|
||||
import ru.m.tankz.data.GameData;
|
||||
import haxework.provider.Provider;
|
||||
import ru.m.tankz.proto.Person;
|
||||
import haxework.gui.list.VListView;
|
||||
import haxework.gui.HGroupView;
|
||||
|
||||
class PersonListFrame extends HGroupView implements IPacketHandler implements ListViewListener<Person> {
|
||||
@:template("layout/frames/person_list.json", "layout/styles.json")
|
||||
class PersonListFrame extends HGroupView implements ViewBuilder implements IPacketHandler implements ListViewListener<Person> {
|
||||
|
||||
private static inline var TAG = "PersonListFrame";
|
||||
|
||||
public static inline var ID = "person_list";
|
||||
|
||||
private var list:VListView<Person>;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
}
|
||||
|
||||
public function init() {
|
||||
list = findViewById("list");
|
||||
list.dispatcher.addListener(this);
|
||||
@@ -33,7 +27,11 @@ class PersonListFrame extends HGroupView implements IPacketHandler implements Li
|
||||
|
||||
public function onShow() {
|
||||
list.data = Provider.get(GameData).account.persons;
|
||||
Provider.get(IConnection).packetHandler = this;
|
||||
Provider.get(IConnection).packetHandler.addListener(this);
|
||||
}
|
||||
|
||||
public function onHide() {
|
||||
Provider.get(IConnection).packetHandler.removeListener(this);
|
||||
}
|
||||
|
||||
public function onListItemClick(item:IListItemView<Person>):Void {
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
{
|
||||
"type":"haxework.frame.FrameSwitcher",
|
||||
"skin":{"type":"haxework.gui.skin.BitmapSkin", "image":"@~image:resources/images/background.png", "fillType":"REPEAT"},
|
||||
"views":[
|
||||
{
|
||||
"id":"menu", "type":"haxework.gui.VGroupView",
|
||||
"pWidth":100, "pHeight":100,
|
||||
"views":[
|
||||
{
|
||||
"id":"logo", "type":"haxework.gui.SpriteView", "contentSize":true,
|
||||
"skin":{"type":"haxework.gui.skin.BitmapSkin", "image":"@~image:resources/images/logo/logo.png"}
|
||||
},
|
||||
{
|
||||
"type":"haxework.gui.VGroupView", "contentSize":true,
|
||||
"views":[
|
||||
{
|
||||
"id":"start1", "type":"haxework.gui.ButtonView", "_include":"button",
|
||||
"text":"1 Player", "onPress":"#listener"
|
||||
},
|
||||
{
|
||||
"id":"start2", "type":"haxework.gui.ButtonView", "_include":"button",
|
||||
"text":"2 Player", "onPress":"#listener"
|
||||
},
|
||||
{
|
||||
"id":"options", "type":"haxework.gui.ButtonView", "_include":"button",
|
||||
"text":"Options", "onPress":"#listener"
|
||||
},
|
||||
{
|
||||
"id":"about", "type":"haxework.gui.ButtonView", "_include":"button",
|
||||
"text":"About", "onPress":"#listener"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"game", "type":"haxework.gui.HGroupView",
|
||||
"pWidth":100, "pHeight":100,
|
||||
"views":[
|
||||
{
|
||||
"id":"map", "type":"haxework.gui.SpriteView",
|
||||
"pHeight":100, "r":1,
|
||||
"skin":{"type":"haxework.gui.skin.ColorSkin", "color":"0xff0000"}
|
||||
},
|
||||
{
|
||||
"type":"haxework.gui.VGroupView",
|
||||
"pWidth":100, "pHeight":100,
|
||||
"skin":{"type":"haxework.gui.skin.ColorSkin", "color":"0x00ff00"}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id":"about", "type":"haxework.gui.VGroupView",
|
||||
"pWidth":100, "pHeight":100,
|
||||
"views":[
|
||||
{
|
||||
"type":"haxework.gui.LabelView", "text":"@text:about",
|
||||
"fontFamily":"@text:font", "fontEmbed":true, "fontSize":48, "contentSize":true
|
||||
},
|
||||
{"type":"haxework.gui.SpriteView", "height":400},
|
||||
{
|
||||
"id":"back", "type":"haxework.gui.ButtonView", "_include":"button",
|
||||
"text":"Back", "onPress":"#listener"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
"_includes":{
|
||||
"button":{
|
||||
"width":250, "height":60,
|
||||
"skin":{
|
||||
"type":"haxework.gui.skin.ButtonBitmapSkin",
|
||||
"upImage":"@~image:resources/images/control/button_normal.png",
|
||||
"overImage":"@~image:resources/images/control/button_over.png",
|
||||
"downImage":"@~image:resources/images/control/button_down.png",
|
||||
"fillType":"NINEPATH"
|
||||
},
|
||||
"fontFamily":"@text:font", "fontEmbed":true, "fontColor":"0xE7E0BB", "fontSize":20
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
{
|
||||
"_includes": {
|
||||
"button_skin": {
|
||||
"skin": {
|
||||
"type": "haxework.gui.skin.ButtonBitmapSkin",
|
||||
"upImage": "@~image:resources/images/control/button_normal.png",
|
||||
"downImage": "@~image:resources/images/control/button_down.png",
|
||||
"overImage": "@~image:resources/images/control/button_over.png",
|
||||
"fillType": "NINEPATH"
|
||||
},
|
||||
"fontColor": "0xffffff"
|
||||
}
|
||||
},
|
||||
|
||||
"type": "haxework.gui.VGroupView",
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"views": [
|
||||
{
|
||||
"id":"top", "type": "haxework.gui.HGroupView",
|
||||
"pWidth": 100, "height": 30,
|
||||
"skin": {"type": "haxework.gui.skin.ColorSkin", "color": "0x105000"},
|
||||
"views": [
|
||||
{
|
||||
"id": "logout", "type": "haxework.gui.ButtonView",
|
||||
"width": 100, "height": 30,
|
||||
"text": "Logout",
|
||||
"_include": "button_skin"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "switcher", "type": "haxework.frame.FrameSwitcher",
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"skin": {"type": "haxework.gui.skin.BitmapSkin", "image": "@~image:resources/images/background.png", "fillType": "REPEAT"},
|
||||
"views": [
|
||||
|
||||
{
|
||||
"id": "auth", "type": "ru.m.tankz.view.frames.AuthFrame",
|
||||
"pWidth": 100, "pHeight": 100, "layoutMargin": 3,
|
||||
"views": [
|
||||
{
|
||||
"id": "login", "type": "haxework.gui.HGroupView",
|
||||
"contentSize": true,
|
||||
"views": [
|
||||
{
|
||||
"type": "haxework.gui.LabelView",
|
||||
"width": 150, "height": 25, "text": "Login"
|
||||
},
|
||||
{
|
||||
"id": "input", "type": "haxework.gui.InputView",
|
||||
"skin": {"type": "haxework.gui.skin.ColorSkin", "color": "0xffffff"},
|
||||
"width": 200, "height": 25, "text": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "password", "type": "haxework.gui.HGroupView",
|
||||
"contentSize": true,
|
||||
"views": [
|
||||
{
|
||||
"type": "haxework.gui.LabelView",
|
||||
"width": 150, "height": 25, "text": "Password"
|
||||
},
|
||||
{
|
||||
"id": "input", "type": "haxework.gui.InputView",
|
||||
"skin": {"type": "haxework.gui.skin.ColorSkin", "color": "0xffffff"},
|
||||
"width": 200, "height": 25, "text": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"id": "auth",
|
||||
"type": "haxework.gui.ButtonView",
|
||||
"width": 100, "height": 45,
|
||||
"text": "Auth",
|
||||
"_include": "button_skin"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"id": "person_list", "type": "ru.m.tankz.view.frames.PersonListFrame",
|
||||
"pWidth": 100, "pHeight": 100, "layoutMargin": 3, "paddings": 10,
|
||||
"views": [
|
||||
{
|
||||
"id": "list", "type": "haxework.gui.list.VListView",
|
||||
"factory": {
|
||||
"type": "~ru.m.tankz.view.frames.list.PersonView"
|
||||
},
|
||||
"scroll": {
|
||||
"type": "haxework.gui.list.VScrollView",
|
||||
"skin": {"type": "haxework.gui.list.VScrollSkin"}
|
||||
},
|
||||
"pWidth": 100, "pHeight": 100, "layoutMargin": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"id": "game_list", "type": "ru.m.tankz.view.frames.GameListFrame",
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"views": [
|
||||
{
|
||||
"id": "name", "type": "haxework.gui.LabelView",
|
||||
"pWidth": 100, "height": 25, "text": ""
|
||||
},
|
||||
{
|
||||
"id": "create", "type": "haxework.gui.ButtonView",
|
||||
"width": 100, "height": 45,
|
||||
"text": "Create",
|
||||
"_include": "button_skin"
|
||||
},
|
||||
{
|
||||
"id": "list", "type": "haxework.gui.list.VListView",
|
||||
"factory": {
|
||||
"type": "~ru.m.tankz.view.frames.list.GameView"
|
||||
},
|
||||
"scroll": {
|
||||
"type": "haxework.gui.list.VScrollView",
|
||||
"skin": {"type": "haxework.gui.list.VScrollSkin"}
|
||||
},
|
||||
"pWidth": 100, "pHeight": 100, "layoutMargin": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"id": "game_ready", "type": "ru.m.tankz.view.frames.GameReadyFrame",
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"views": [
|
||||
{
|
||||
"id": "name", "type": "haxework.gui.LabelView",
|
||||
"pWidth": 100, "height": 25, "text": ""
|
||||
},
|
||||
{
|
||||
"id": "start", "type": "haxework.gui.ButtonView",
|
||||
"width": 100, "height": 45,
|
||||
"text": "Start",
|
||||
"_include": "button_skin"
|
||||
},
|
||||
{
|
||||
"id": "exit", "type": "haxework.gui.ButtonView",
|
||||
"width": 100, "height": 45,
|
||||
"text": "Exit",
|
||||
"_include": "button_skin"
|
||||
},
|
||||
{
|
||||
"id": "list", "type": "haxework.gui.list.VListView",
|
||||
"factory": {
|
||||
"type": "~ru.m.tankz.view.frames.list.PersonView"
|
||||
},
|
||||
"scroll": {
|
||||
"type": "haxework.gui.list.VScrollView",
|
||||
"skin": {"type": "haxework.gui.list.VScrollSkin"}
|
||||
},
|
||||
"pWidth": 100, "pHeight": 100, "layoutMargin": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"id": "game", "type": "ru.m.tankz.view.frames.GameFrame",
|
||||
"pWidth": 100, "pHeight": 100,
|
||||
"views": [
|
||||
{
|
||||
"id": "name", "type": "haxework.gui.LabelView",
|
||||
"pWidth": 100, "height": 25, "text": ""
|
||||
},
|
||||
{
|
||||
"id": "restart", "type": "haxework.gui.ButtonView",
|
||||
"width": 100, "height": 45,
|
||||
"text": "Restart",
|
||||
"_include": "button_skin"
|
||||
},
|
||||
{
|
||||
"id": "render", "type": "ru.m.tankz.render.Render",
|
||||
"contentSize": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,26 +1,27 @@
|
||||
package ru.m.core.connect;
|
||||
|
||||
import haxework.dispath.Dispatcher;
|
||||
import haxework.dispath.IDispatcher;
|
||||
import haxework.provider.Provider;
|
||||
import haxework.net.callback.ICallback;
|
||||
import haxe.io.Bytes;
|
||||
import protohx.Message;
|
||||
import ru.m.core.connect.IConnection;
|
||||
|
||||
class BaseConnection implements IConnection {
|
||||
public var handler(default,default):IConnectionHandler;
|
||||
public var packetHandler(default,default):IPacketHandler;
|
||||
public var handler(default,default):IDispatcher<IConnectionHandler>;
|
||||
public var packetHandler(default,default):IDispatcher<IPacketHandler>;
|
||||
public var connected(default, null):Bool;
|
||||
public var queue(default, null):PacketQueue;
|
||||
public var builder(default, null):IPacketBuilder;
|
||||
|
||||
public function new(?handler:IConnectionHandler = null, ?packetHandler:IPacketHandler) {
|
||||
public function new() {
|
||||
this.builder = Provider.get(IPacketBuilder);
|
||||
this.queue = new PacketQueue(builder);
|
||||
this.packetHandler = packetHandler;
|
||||
this.handler = handler;
|
||||
this.handler = new Dispatcher<IConnectionHandler>();
|
||||
this.packetHandler = new Dispatcher<IPacketHandler>();
|
||||
}
|
||||
|
||||
public function connect():ICallback<Dynamic> {
|
||||
public function connect():Void {
|
||||
throw "Not implemented";
|
||||
}
|
||||
|
||||
@@ -36,7 +37,7 @@ class BaseConnection implements IConnection {
|
||||
receive(packet);
|
||||
} catch (error:Dynamic) {
|
||||
trace(error);
|
||||
handler.onError(error);
|
||||
handler.dispatch(function(h) h.onError(error));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,13 +47,14 @@ class BaseConnection implements IConnection {
|
||||
|
||||
public function receive(packet:Message):Void {
|
||||
L.d("Receive", Type.getClassName(Type.getClass(packet)).split(".").pop());
|
||||
if (packetHandler == null) return;
|
||||
var name = "on" + Type.getClassName(Type.getClass(packet)).split(".").pop();
|
||||
var method = Reflect.field(packetHandler, name);
|
||||
if (method != null && Reflect.isFunction(method)) {
|
||||
Reflect.callMethod(packetHandler, method, [packet]);
|
||||
} else {
|
||||
packetHandler.onPacket(packet);
|
||||
}
|
||||
packetHandler.dispatch(function(h) {
|
||||
var method = Reflect.field(h, name);
|
||||
if (method != null && Reflect.isFunction(method)) {
|
||||
Reflect.callMethod(h, method, [packet]);
|
||||
} else {
|
||||
h.onPacket(packet);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
package ru.m.core.connect;
|
||||
|
||||
import haxework.net.callback.ICallback;
|
||||
import haxework.dispath.IDispatcher;
|
||||
import haxe.io.Bytes;
|
||||
import protohx.Message;
|
||||
|
||||
interface IConnection {
|
||||
public var connected(default,null):Bool;
|
||||
public var handler(default,default):IConnectionHandler;
|
||||
public var packetHandler(default,default):IPacketHandler;
|
||||
public var handler(default,default):IDispatcher<IConnectionHandler>;
|
||||
public var packetHandler(default,default):IDispatcher<IPacketHandler>;
|
||||
|
||||
public var builder(default,null):IPacketBuilder;
|
||||
|
||||
public function connect():ICallback<Dynamic>;
|
||||
public function connect():Void;
|
||||
public function disconnect():Void;
|
||||
public function send(packet:Message):Void;
|
||||
public function pushData(bytes:Bytes):Void;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package ru.m.core.connect.flash;
|
||||
|
||||
import haxework.net.callback.Callback;
|
||||
import haxework.net.callback.ICallback;
|
||||
import ru.m.core.connect.IConnection.IConnectionHandler;
|
||||
import flash.utils.Endian;
|
||||
import haxe.io.BytesOutput;
|
||||
@@ -20,10 +18,8 @@ class FlashConnection extends BaseConnection {
|
||||
private var port:Int;
|
||||
private var socket:Socket;
|
||||
|
||||
private var callback:ICallback<Dynamic>;
|
||||
|
||||
public function new(host:String, port:Int, ?handler:IConnectionHandler = null) {
|
||||
super(handler);
|
||||
public function new(host:String, port:Int) {
|
||||
super();
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
connected = false;
|
||||
@@ -36,55 +32,43 @@ class FlashConnection extends BaseConnection {
|
||||
socket.endian = Endian.LITTLE_ENDIAN;
|
||||
}
|
||||
|
||||
override public function connect():ICallback<Dynamic> {
|
||||
callback = Callback.build();
|
||||
override public function connect():Void {
|
||||
socket.connect(host, port);
|
||||
return callback;
|
||||
}
|
||||
|
||||
override public function disconnect():Void {
|
||||
if (socket.connected) {
|
||||
socket.close();
|
||||
connected = false;
|
||||
if (handler != null) handler.onDisconnected();
|
||||
handler.dispatch(function(h) h.onDisconnected());
|
||||
}
|
||||
}
|
||||
|
||||
private function onError(event:ErrorEvent):Void {
|
||||
socket.close();
|
||||
connected = false;
|
||||
if (handler != null) handler.onError(event);
|
||||
if (callback != null) {
|
||||
var c = callback;
|
||||
callback = null;
|
||||
c.callFail(event);
|
||||
}
|
||||
handler.dispatch(function(h) h.onError(event));
|
||||
}
|
||||
|
||||
private function onConnect(_):Void {
|
||||
connected = true;
|
||||
if (handler != null) handler.onConnected();
|
||||
if (callback != null) {
|
||||
var c = callback;
|
||||
callback = null;
|
||||
c.callSuccess(null);
|
||||
}
|
||||
handler.dispatch(function(h) h.onConnected());
|
||||
}
|
||||
|
||||
private function onClose(_):Void {
|
||||
socket.close();
|
||||
connected = false;
|
||||
if (handler != null) handler.onDisconnected();
|
||||
handler.dispatch(function(h) h.onDisconnected());
|
||||
}
|
||||
|
||||
private function onSocketData(_):Void {
|
||||
try {
|
||||
var b = new flash.utils.ByteArray();
|
||||
socket.readBytes(b);
|
||||
var bs = Bytes.ofData(cast b);
|
||||
pushData(bs);
|
||||
var b = new flash.utils.ByteArray();
|
||||
socket.readBytes(b);
|
||||
var bs = Bytes.ofData(cast b);
|
||||
pushData(bs);
|
||||
} catch (error:Dynamic) {
|
||||
handler.onError(error);
|
||||
handler.dispatch(function(h) h.onError(error));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package ru.m.core.connect.js;
|
||||
|
||||
import ru.m.core.Base64;
|
||||
import haxework.net.callback.Callback;
|
||||
import haxework.net.callback.ICallback;
|
||||
import ru.m.core.connect.IConnection.IConnectionHandler;
|
||||
import protohx.Message;
|
||||
import haxe.io.Bytes;
|
||||
@@ -23,10 +21,8 @@ class JsConnection extends BaseConnection {
|
||||
private var port:Int;
|
||||
private var socket:WebSocket;
|
||||
|
||||
private var callback:ICallback<Dynamic>;
|
||||
|
||||
public function new(host:String, port:Int, ?handler:IConnectionHandler = null) {
|
||||
super(handler);
|
||||
public function new(host:String, port:Int) {
|
||||
super();
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
connected = false;
|
||||
@@ -36,8 +32,7 @@ class JsConnection extends BaseConnection {
|
||||
return untyped __js__("self.socket = new WebSocket('ws://'+host+':'+port); ");
|
||||
}
|
||||
|
||||
override public function connect():ICallback<Dynamic> {
|
||||
callback = Callback.build();
|
||||
override public function connect():Void {
|
||||
var self = this;
|
||||
var decodeBytes = Base64.decodeBase64;
|
||||
socket = buildSocket(host, port);
|
||||
@@ -45,40 +40,29 @@ class JsConnection extends BaseConnection {
|
||||
socket.onclose = this.onClose;
|
||||
socket.onerror = this.onError;
|
||||
socket.onmessage = this.onSocketData;
|
||||
return callback;
|
||||
}
|
||||
|
||||
override public function disconnect():Void {
|
||||
socket.close();
|
||||
connected = false;
|
||||
if (handler != null) handler.onDisconnected();
|
||||
handler.dispatch(function(h) h.onDisconnected());
|
||||
}
|
||||
|
||||
private function onError(event:Dynamic):Void {
|
||||
socket.close();
|
||||
connected = false;
|
||||
if (handler != null) handler.onError(event);
|
||||
if (callback != null) {
|
||||
var c = callback;
|
||||
callback = null;
|
||||
c.callFail(event);
|
||||
}
|
||||
handler.dispatch(function(h) h.onError(event));
|
||||
}
|
||||
|
||||
private function onConnect(_):Void {
|
||||
connected = true;
|
||||
if (handler != null) handler.onConnected();
|
||||
if (callback != null) {
|
||||
var c = callback;
|
||||
callback = null;
|
||||
c.callSuccess(null);
|
||||
}
|
||||
handler.dispatch(function(h) h.onConnected());
|
||||
}
|
||||
|
||||
private function onClose(_):Void {
|
||||
socket.close();
|
||||
connected = false;
|
||||
if (handler != null) handler.onDisconnected();
|
||||
handler.dispatch(function(h) h.onDisconnected());
|
||||
}
|
||||
|
||||
private function onSocketData(event:Dynamic):Void {
|
||||
@@ -87,7 +71,7 @@ class JsConnection extends BaseConnection {
|
||||
var packet = WebSocketTools.string2packet(data, builder);
|
||||
receive(packet);
|
||||
} catch (error:Dynamic) {
|
||||
handler.onError(error);
|
||||
handler.dispatch(function(h) h.onError(error));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,8 @@ class NekoConnection extends BaseConnection {
|
||||
|
||||
public var socket(default, null):Socket;
|
||||
|
||||
public function new(socket:Socket, ?handler:IConnectionHandler = null, ?packetHandler:IPacketHandler = null) {
|
||||
super(handler, packetHandler);
|
||||
public function new(socket:Socket) {
|
||||
super();
|
||||
this.socket = socket;
|
||||
socket.setFastSend(true);
|
||||
socket.output.bigEndian = false;
|
||||
|
||||
@@ -11,8 +11,8 @@ class NekoWebConnection extends NekoConnection {
|
||||
|
||||
private var opened:Bool;
|
||||
|
||||
public function new(socket:Socket, ?handler:IConnectionHandler = null, ?packetHandler:IPacketHandler = null) {
|
||||
super(socket, handler, packetHandler);
|
||||
public function new(socket:Socket) {
|
||||
super(socket);
|
||||
opened = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,10 +105,12 @@ class Session implements IConnectionHandler implements IPacketHandler {
|
||||
} else {
|
||||
var str:String = bytes.getString(0, bytes.length);
|
||||
if (StringTools.startsWith(str, "GET")) {
|
||||
connection = new NekoWebConnection(socket, this, this);
|
||||
connection = new NekoWebConnection(socket);
|
||||
} else {
|
||||
connection = new NekoConnection(socket, this, this);
|
||||
connection = new NekoConnection(socket);
|
||||
}
|
||||
connection.handler.addListener(this);
|
||||
connection.packetHandler.addListener(this);
|
||||
connection.pushData(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user