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 {
|
||||
|
||||
Reference in New Issue
Block a user