[client] update haxework
This commit is contained in:
@@ -1,29 +1,19 @@
|
|||||||
package ru.m.tankz;
|
package ru.m.tankz;
|
||||||
|
|
||||||
import openfl.Assets;
|
|
||||||
import ru.m.tankz.frame.StartFrame;
|
import ru.m.tankz.frame.StartFrame;
|
||||||
import flash.ui.Keyboard;
|
import flash.ui.Keyboard;
|
||||||
import flash.events.KeyboardEvent;
|
import flash.events.KeyboardEvent;
|
||||||
import ru.m.tankz.proto.pack.Response;
|
|
||||||
import ru.m.tankz.proto.pack.Request;
|
|
||||||
import flash.text.Font;
|
import flash.text.Font;
|
||||||
import haxework.gui.frame.IFrameSwitcher;
|
import haxework.gui.frame.IFrameSwitcher;
|
||||||
import haxework.gui.Root;
|
import haxework.gui.Root;
|
||||||
import haxework.gui.VGroupView;
|
import haxework.gui.VGroupView;
|
||||||
import haxework.gui.ViewBuilder;
|
|
||||||
import haxework.log.TraceLogger;
|
import haxework.log.TraceLogger;
|
||||||
import haxework.provider.Provider;
|
import haxework.provider.Provider;
|
||||||
import haxework.resources.IResources;
|
import haxework.resources.IResources;
|
||||||
import haxework.resources.Resources;
|
|
||||||
import ru.m.connect.IConnection;
|
|
||||||
#if flash import haxework.log.JSLogger; #end
|
#if flash import haxework.log.JSLogger; #end
|
||||||
#if debug import haxework.log.SocketLogger; #end
|
#if debug import haxework.log.SocketLogger; #end
|
||||||
|
|
||||||
|
|
||||||
interface ClientLayout {
|
|
||||||
var switcher(default, null):IFrameSwitcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Client {
|
class Client {
|
||||||
private static inline var TAG = 'Tankz';
|
private static inline var TAG = 'Tankz';
|
||||||
|
|
||||||
@@ -44,11 +34,11 @@ class Client {
|
|||||||
Root.bind(view);
|
Root.bind(view);
|
||||||
view.launch();
|
view.launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@:template('ru/m/tankz/Client.yaml', 'ru/m/tankz/Style.yaml')
|
@:template('ru/m/tankz/Client.yaml', 'ru/m/tankz/Style.yaml')
|
||||||
class ClientView extends VGroupView implements ClientLayout implements ViewBuilder {
|
class ClientView extends VGroupView {
|
||||||
|
@:view private var switcher(default, null):IFrameSwitcher;
|
||||||
|
|
||||||
private static inline var TAG = 'Tankz';
|
private static inline var TAG = 'Tankz';
|
||||||
|
|
||||||
@@ -56,32 +46,16 @@ class ClientView extends VGroupView implements ClientLayout implements ViewBuild
|
|||||||
var font:Font = Font.enumerateFonts()[0];
|
var font:Font = Font.enumerateFonts()[0];
|
||||||
Provider.get(IResources).text.put('font', 'Bookman Old Style');
|
Provider.get(IResources).text.put('font', 'Bookman Old Style');
|
||||||
Provider.get(IResources).text.put('version', 'v${Const.VERSION} b${Const.BUILD}');
|
Provider.get(IResources).text.put('version', 'v${Const.VERSION} b${Const.BUILD}');
|
||||||
|
|
||||||
#if flash
|
|
||||||
Provider.set(IConnection, new ru.m.connect.flash.FlashConnection<Request, Response>('localhost', 5001, Response));
|
|
||||||
#elseif html5
|
|
||||||
Provider.set(IConnection, new ru.m.connect.js.JsConnection('localhost', 5001));
|
|
||||||
#else
|
|
||||||
Provider.set(IConnection, new ru.m.connect.fake.FakeConnection());
|
|
||||||
#end
|
|
||||||
|
|
||||||
Provider.set(IFrameSwitcher, switcher);
|
Provider.set(IFrameSwitcher, switcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function launch():Void {
|
public function launch():Void {
|
||||||
content.stage.stageFocusRect = false;
|
content.stage.stageFocusRect = false;
|
||||||
|
|
||||||
content.stage.addEventListener(KeyboardEvent.KEY_UP, function(event:KeyboardEvent):Void {
|
content.stage.addEventListener(KeyboardEvent.KEY_UP, function(event:KeyboardEvent):Void {
|
||||||
if (event.keyCode == Keyboard.ESCAPE) {
|
if (event.keyCode == Keyboard.ESCAPE) {
|
||||||
switcher.change(StartFrame.ID);
|
switcher.change(StartFrame.ID);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
L.d(TAG, 'resources');
|
|
||||||
for (resource in Assets.list()) {
|
|
||||||
L.d(TAG, '\t${resource}');
|
|
||||||
}
|
|
||||||
|
|
||||||
switcher.change(StartFrame.ID);
|
switcher.change(StartFrame.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package ru.m.tankz;
|
|||||||
import haxework.provider.Provider;
|
import haxework.provider.Provider;
|
||||||
import haxework.resources.IResources;
|
import haxework.resources.IResources;
|
||||||
import haxework.resources.Resources;
|
import haxework.resources.Resources;
|
||||||
|
import ru.m.connect.IConnection;
|
||||||
import ru.m.tankz.bundle.ConfigBundle;
|
import ru.m.tankz.bundle.ConfigBundle;
|
||||||
import ru.m.tankz.bundle.IConfigBundle;
|
import ru.m.tankz.bundle.IConfigBundle;
|
||||||
import ru.m.tankz.bundle.ILevelBundle;
|
import ru.m.tankz.bundle.ILevelBundle;
|
||||||
@@ -13,6 +14,8 @@ import ru.m.tankz.game.ClassicGame;
|
|||||||
import ru.m.tankz.game.DotaGame;
|
import ru.m.tankz.game.DotaGame;
|
||||||
import ru.m.tankz.game.Game;
|
import ru.m.tankz.game.Game;
|
||||||
import ru.m.tankz.network.NetworkManager;
|
import ru.m.tankz.network.NetworkManager;
|
||||||
|
import ru.m.tankz.proto.pack.Request;
|
||||||
|
import ru.m.tankz.proto.pack.Response;
|
||||||
import ru.m.tankz.sound.SoundManager;
|
import ru.m.tankz.sound.SoundManager;
|
||||||
import ru.m.tankz.storage.SaveStorage;
|
import ru.m.tankz.storage.SaveStorage;
|
||||||
import ru.m.tankz.storage.UserStorage;
|
import ru.m.tankz.storage.UserStorage;
|
||||||
@@ -31,5 +34,13 @@ class Init {
|
|||||||
Provider.setFactory(IControlFactory, ClientControlFactory);
|
Provider.setFactory(IControlFactory, ClientControlFactory);
|
||||||
Provider.setFactory(Game, ClassicGame, ClassicGame.TYPE);
|
Provider.setFactory(Game, ClassicGame, ClassicGame.TYPE);
|
||||||
Provider.setFactory(Game, DotaGame, DotaGame.TYPE);
|
Provider.setFactory(Game, DotaGame, DotaGame.TYPE);
|
||||||
|
|
||||||
|
#if flash
|
||||||
|
Provider.set(IConnection, new ru.m.connect.flash.FlashConnection<Request, Response>('localhost', 5001, Response));
|
||||||
|
#elseif html5
|
||||||
|
Provider.set(IConnection, new ru.m.connect.js.JsConnection('localhost', 5001));
|
||||||
|
#else
|
||||||
|
Provider.set(IConnection, new ru.m.connect.fake.FakeConnection());
|
||||||
|
#end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,9 @@ import ru.m.tankz.network.NetworkManager;
|
|||||||
import ru.m.tankz.control.Control;
|
import ru.m.tankz.control.Control;
|
||||||
|
|
||||||
|
|
||||||
@:haxework
|
|
||||||
class ClientNetworkControl extends HumanControl {
|
class ClientNetworkControl extends HumanControl {
|
||||||
|
|
||||||
@:provider
|
@:provide private var network:NetworkManager;
|
||||||
private var network:NetworkManager;
|
|
||||||
|
|
||||||
override public function action(action:TankAction):Void {
|
override public function action(action:TankAction):Void {
|
||||||
network.action(action);
|
network.action(action);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import haxe.Timer;
|
|||||||
import haxework.gui.frame.IFrameSwitcher;
|
import haxework.gui.frame.IFrameSwitcher;
|
||||||
import haxework.gui.LabelView;
|
import haxework.gui.LabelView;
|
||||||
import haxework.gui.VGroupView;
|
import haxework.gui.VGroupView;
|
||||||
import haxework.gui.ViewBuilder;
|
|
||||||
import haxework.provider.Provider;
|
import haxework.provider.Provider;
|
||||||
import ru.m.tankz.game.Game;
|
import ru.m.tankz.game.Game;
|
||||||
import ru.m.tankz.game.GameSave;
|
import ru.m.tankz.game.GameSave;
|
||||||
@@ -16,18 +15,16 @@ import ru.m.tankz.sound.SoundManager;
|
|||||||
import ru.m.tankz.storage.SaveStorage;
|
import ru.m.tankz.storage.SaveStorage;
|
||||||
|
|
||||||
|
|
||||||
interface GameFrameLayout {
|
|
||||||
var state(default, null):LabelView;
|
|
||||||
var render(default, null):Render;
|
|
||||||
}
|
|
||||||
|
|
||||||
@:template("ru/m/tankz/frame/GameFrame.yaml", "ru/m/tankz/Style.yaml")
|
@:template("ru/m/tankz/frame/GameFrame.yaml", "ru/m/tankz/Style.yaml")
|
||||||
class GameFrame extends VGroupView implements ViewBuilder implements GameFrameLayout {
|
class GameFrame extends VGroupView {
|
||||||
|
|
||||||
private static inline var TAG = "GameFrame";
|
private static inline var TAG = "GameFrame";
|
||||||
|
|
||||||
public static inline var ID = "game";
|
public static inline var ID = "game";
|
||||||
|
|
||||||
|
@:view var state(default, null):LabelView;
|
||||||
|
@:view var render(default, null):Render;
|
||||||
|
|
||||||
private var game:Game;
|
private var game:Game;
|
||||||
private var timer:Timer;
|
private var timer:Timer;
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,20 @@
|
|||||||
package ru.m.tankz.frame;
|
package ru.m.tankz.frame;
|
||||||
|
|
||||||
import ru.m.tankz.game.GameSave;
|
|
||||||
import haxework.gui.frame.IFrameSwitcher;
|
import haxework.gui.frame.IFrameSwitcher;
|
||||||
import haxework.gui.list.ListView;
|
import haxework.gui.list.ListView;
|
||||||
import haxework.gui.VGroupView;
|
import haxework.gui.VGroupView;
|
||||||
import haxework.gui.ViewBuilder;
|
|
||||||
import haxework.provider.Provider;
|
import haxework.provider.Provider;
|
||||||
import ru.m.tankz.bundle.IConfigBundle;
|
import ru.m.tankz.bundle.IConfigBundle;
|
||||||
|
import ru.m.tankz.game.GameSave;
|
||||||
import ru.m.tankz.game.GameState;
|
import ru.m.tankz.game.GameState;
|
||||||
|
|
||||||
|
|
||||||
interface LevelFrameLayout {
|
|
||||||
var levels(default, null):ListView<Int>;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@:template("ru/m/tankz/frame/LevelFrame.yaml", "ru/m/tankz/Style.yaml")
|
@:template("ru/m/tankz/frame/LevelFrame.yaml", "ru/m/tankz/Style.yaml")
|
||||||
class LevelFrame extends VGroupView implements ViewBuilder implements LevelFrameLayout {
|
class LevelFrame extends VGroupView {
|
||||||
public static inline var ID = "level";
|
public static inline var ID = "level";
|
||||||
|
|
||||||
|
@:view var levels(default, null):ListView<Int>;
|
||||||
|
|
||||||
public function init():Void {
|
public function init():Void {
|
||||||
levels.dispatcher.addListener(this);
|
levels.dispatcher.addListener(this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,42 +1,34 @@
|
|||||||
package ru.m.tankz.frame;
|
package ru.m.tankz.frame;
|
||||||
|
|
||||||
import ru.m.tankz.proto.core.Game;
|
|
||||||
import ru.m.tankz.proto.core.User;
|
|
||||||
import haxework.gui.list.ListView;
|
|
||||||
import haxework.gui.IGroupView;
|
|
||||||
import haxework.gui.frame.IFrameSwitcher;
|
|
||||||
import haxework.gui.ButtonView;
|
import haxework.gui.ButtonView;
|
||||||
|
import haxework.gui.frame.IFrameSwitcher;
|
||||||
|
import haxework.gui.IGroupView;
|
||||||
import haxework.gui.InputView;
|
import haxework.gui.InputView;
|
||||||
import haxework.gui.LabelView;
|
import haxework.gui.LabelView;
|
||||||
|
import haxework.gui.list.ListView;
|
||||||
import haxework.gui.VGroupView;
|
import haxework.gui.VGroupView;
|
||||||
import haxework.gui.ViewBuilder;
|
|
||||||
import haxework.provider.Provider;
|
|
||||||
import ru.m.tankz.network.NetworkManager;
|
import ru.m.tankz.network.NetworkManager;
|
||||||
|
import ru.m.tankz.proto.core.Game;
|
||||||
|
import ru.m.tankz.proto.core.User;
|
||||||
|
|
||||||
|
|
||||||
interface NetworkFrameLayout {
|
|
||||||
var frameSwitcher(default, null):IFrameSwitcher;
|
|
||||||
|
|
||||||
var loginFrame(default, null):IGroupView;
|
|
||||||
var stateLabel(default, null):LabelView;
|
|
||||||
var nameInput(default, null):InputView;
|
|
||||||
var loginButton(default, null):ButtonView;
|
|
||||||
|
|
||||||
var gameListFrame(default, null):IGroupView;
|
|
||||||
var createGameButton(default, null):ButtonView;
|
|
||||||
var gameList(default, null):ListView<Game>;
|
|
||||||
|
|
||||||
var gameFrame(default, null):IGroupView;
|
|
||||||
var leaveGameButton(default, null):ButtonView;
|
|
||||||
var userList(default, null):ListView<User>;
|
|
||||||
}
|
|
||||||
|
|
||||||
@:haxework
|
|
||||||
@:template("ru/m/tankz/frame/NetworkFrame.yaml", "ru/m/tankz/Style.yaml")
|
@:template("ru/m/tankz/frame/NetworkFrame.yaml", "ru/m/tankz/Style.yaml")
|
||||||
class NetworkFrame extends VGroupView implements ViewBuilder implements NetworkFrameLayout {
|
class NetworkFrame extends VGroupView {
|
||||||
public static var ID(default, never):String = "network";
|
public static var ID(default, never):String = "network";
|
||||||
|
|
||||||
@:provide private var network:NetworkManager;
|
@:view var frameSwitcher(default, null):IFrameSwitcher;
|
||||||
|
@:view var loginFrame(default, null):IGroupView;
|
||||||
|
@:view var stateLabel(default, null):LabelView;
|
||||||
|
@:view var nameInput(default, null):InputView;
|
||||||
|
@:view var loginButton(default, null):ButtonView;
|
||||||
|
@:view var gameListFrame(default, null):IGroupView;
|
||||||
|
@:view var createGameButton(default, null):ButtonView;
|
||||||
|
@:view var gameList(default, null):ListView<Game>;
|
||||||
|
@:view var gameFrame(default, null):IGroupView;
|
||||||
|
@:view var leaveGameButton(default, null):ButtonView;
|
||||||
|
@:view var userList(default, null):ListView<User>;
|
||||||
|
|
||||||
|
@:provide var network:NetworkManager;
|
||||||
|
|
||||||
public function init():Void {
|
public function init():Void {
|
||||||
loginButton.onPress = this;
|
loginButton.onPress = this;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package ru.m.tankz.frame;
|
|||||||
import haxework.gui.ButtonView;
|
import haxework.gui.ButtonView;
|
||||||
import haxework.gui.frame.IFrameSwitcher;
|
import haxework.gui.frame.IFrameSwitcher;
|
||||||
import haxework.gui.VGroupView;
|
import haxework.gui.VGroupView;
|
||||||
import haxework.gui.ViewBuilder;
|
|
||||||
import haxework.provider.Provider;
|
import haxework.provider.Provider;
|
||||||
import ru.m.tankz.game.ClassicGame;
|
import ru.m.tankz.game.ClassicGame;
|
||||||
import ru.m.tankz.game.DotaGame;
|
import ru.m.tankz.game.DotaGame;
|
||||||
@@ -12,23 +11,20 @@ import ru.m.tankz.storage.SaveStorage;
|
|||||||
import ru.m.tankz.Type;
|
import ru.m.tankz.Type;
|
||||||
|
|
||||||
|
|
||||||
interface StartFrameLayout {
|
|
||||||
var classic_1p(default, null):ButtonView;
|
|
||||||
var classic_2p(default, null):ButtonView;
|
|
||||||
var classic_load(default, null):ButtonView;
|
|
||||||
var dota_1p(default, null):ButtonView;
|
|
||||||
var dota_2p_coop(default, null):ButtonView;
|
|
||||||
var dota_2p_vs(default, null):ButtonView;
|
|
||||||
var network(default, null):ButtonView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@:haxework
|
|
||||||
@:template("ru/m/tankz/frame/StartFrame.yaml", "ru/m/tankz/Style.yaml")
|
@:template("ru/m/tankz/frame/StartFrame.yaml", "ru/m/tankz/Style.yaml")
|
||||||
class StartFrame extends VGroupView implements ViewBuilder implements StartFrameLayout {
|
class StartFrame extends VGroupView {
|
||||||
|
|
||||||
public static var ID(default, never):String = "start";
|
public static var ID(default, never):String = "start";
|
||||||
|
|
||||||
@:provide private var frameSwitcher:IFrameSwitcher;
|
@:view var classic_1p(default, null):ButtonView;
|
||||||
|
@:view var classic_2p(default, null):ButtonView;
|
||||||
|
@:view var classic_load(default, null):ButtonView;
|
||||||
|
@:view var dota_1p(default, null):ButtonView;
|
||||||
|
@:view var dota_2p_coop(default, null):ButtonView;
|
||||||
|
@:view var dota_2p_vs(default, null):ButtonView;
|
||||||
|
@:view var network(default, null):ButtonView;
|
||||||
|
|
||||||
|
@:provide var frameSwitcher:IFrameSwitcher;
|
||||||
|
|
||||||
public function init():Void {
|
public function init():Void {
|
||||||
classic_1p.onPress = this;
|
classic_1p.onPress = this;
|
||||||
|
|||||||
@@ -1,21 +1,18 @@
|
|||||||
package ru.m.tankz.frame.level;
|
package ru.m.tankz.frame.level;
|
||||||
|
|
||||||
import haxework.gui.ViewBuilder;
|
|
||||||
import haxework.gui.HGroupView;
|
import haxework.gui.HGroupView;
|
||||||
import haxework.gui.LabelView;
|
import haxework.gui.LabelView;
|
||||||
import haxework.gui.list.ListView.IListItemView;
|
import haxework.gui.list.ListView.IListItemView;
|
||||||
|
|
||||||
|
|
||||||
interface LevelViewLayout {
|
|
||||||
var label(default, null):LabelView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@:template("ru/m/tankz/frame/level/LevelView.yaml", "ru/m/tankz/Style.yaml")
|
@:template("ru/m/tankz/frame/level/LevelView.yaml", "ru/m/tankz/Style.yaml")
|
||||||
class LevelView extends HGroupView implements ViewBuilder implements IListItemView<Int> implements LevelViewLayout {
|
class LevelView extends HGroupView implements IListItemView<Int> {
|
||||||
|
|
||||||
public var item_index(default, default):Int;
|
public var item_index(default, default):Int;
|
||||||
public var data(default, set):Int;
|
public var data(default, set):Int;
|
||||||
|
|
||||||
|
@:view var label(default, null):LabelView;
|
||||||
|
|
||||||
private function set_data(value:Int):Int {
|
private function set_data(value:Int):Int {
|
||||||
data = value;
|
data = value;
|
||||||
label.text = 'Level ${data}';
|
label.text = 'Level ${data}';
|
||||||
|
|||||||
@@ -1,22 +1,19 @@
|
|||||||
package ru.m.tankz.frame.network;
|
package ru.m.tankz.frame.network;
|
||||||
|
|
||||||
import ru.m.tankz.proto.core.Game;
|
|
||||||
import haxework.gui.HGroupView;
|
import haxework.gui.HGroupView;
|
||||||
import haxework.gui.LabelView;
|
import haxework.gui.LabelView;
|
||||||
import haxework.gui.list.ListView;
|
import haxework.gui.list.ListView;
|
||||||
import haxework.gui.ViewBuilder;
|
import ru.m.tankz.proto.core.Game;
|
||||||
|
|
||||||
|
|
||||||
interface GameItemViewLayout {
|
|
||||||
var label(default, null):LabelView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@:template("ru/m/tankz/frame/network/GameItemView.yaml", "ru/m/tankz/Style.yaml")
|
@:template("ru/m/tankz/frame/network/GameItemView.yaml", "ru/m/tankz/Style.yaml")
|
||||||
class GameItemView extends HGroupView implements ViewBuilder implements IListItemView<Game> implements GameItemViewLayout {
|
class GameItemView extends HGroupView implements IListItemView<Game> {
|
||||||
|
|
||||||
public var item_index(default, default):Int;
|
public var item_index(default, default):Int;
|
||||||
public var data(default, set):Game;
|
public var data(default, set):Game;
|
||||||
|
|
||||||
|
@:view var label(default, null):LabelView;
|
||||||
|
|
||||||
private function set_data(value:Game):Game {
|
private function set_data(value:Game):Game {
|
||||||
data = value;
|
data = value;
|
||||||
label.text = '${data.type}';
|
label.text = '${data.type}';
|
||||||
|
|||||||
@@ -3,20 +3,17 @@ package ru.m.tankz.frame.network;
|
|||||||
import haxework.gui.HGroupView;
|
import haxework.gui.HGroupView;
|
||||||
import haxework.gui.LabelView;
|
import haxework.gui.LabelView;
|
||||||
import haxework.gui.list.ListView;
|
import haxework.gui.list.ListView;
|
||||||
import haxework.gui.ViewBuilder;
|
|
||||||
import ru.m.tankz.proto.core.User;
|
import ru.m.tankz.proto.core.User;
|
||||||
|
|
||||||
|
|
||||||
interface UserItemViewLayout {
|
|
||||||
var label(default, null):LabelView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@:template("ru/m/tankz/frame/network/UserItemView.yaml", "ru/m/tankz/Style.yaml")
|
@:template("ru/m/tankz/frame/network/UserItemView.yaml", "ru/m/tankz/Style.yaml")
|
||||||
class UserItemView extends HGroupView implements ViewBuilder implements IListItemView<User> implements UserItemViewLayout {
|
class UserItemView extends HGroupView implements IListItemView<User> {
|
||||||
|
|
||||||
public var item_index(default, default):Int;
|
public var item_index(default, default):Int;
|
||||||
public var data(default, set):User;
|
public var data(default, set):User;
|
||||||
|
|
||||||
|
@:view var label(default, null):LabelView;
|
||||||
|
|
||||||
private function set_data(value:User):User {
|
private function set_data(value:User):User {
|
||||||
data = value;
|
data = value;
|
||||||
label.text = '${data.uuid} -- ${data.name}';
|
label.text = '${data.uuid} -- ${data.name}';
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import ru.m.tankz.storage.UserStorage;
|
|||||||
|
|
||||||
typedef ClientConnection = IConnection<Request, Response>;
|
typedef ClientConnection = IConnection<Request, Response>;
|
||||||
|
|
||||||
@:haxework
|
|
||||||
class NetworkManager {
|
class NetworkManager {
|
||||||
|
|
||||||
public var state(default, null):String;
|
public var state(default, null):String;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import haxework.gui.ButtonView;
|
|||||||
import haxework.gui.frame.FrameSwitcher;
|
import haxework.gui.frame.FrameSwitcher;
|
||||||
import haxework.gui.VGroupView;
|
import haxework.gui.VGroupView;
|
||||||
import haxework.gui.Root;
|
import haxework.gui.Root;
|
||||||
import haxework.gui.ViewBuilder;
|
|
||||||
import haxework.log.TraceLogger;
|
import haxework.log.TraceLogger;
|
||||||
import haxework.provider.Provider;
|
import haxework.provider.Provider;
|
||||||
import haxework.resources.IResources;
|
import haxework.resources.IResources;
|
||||||
@@ -19,12 +18,12 @@ import ru.m.tankz.frame.LevelFrame;
|
|||||||
#if debug import haxework.log.SocketLogger; #end
|
#if debug import haxework.log.SocketLogger; #end
|
||||||
|
|
||||||
|
|
||||||
interface EditorViewLayout {
|
|
||||||
var switcher(default, null):FrameSwitcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
@:template('ru/m/tankz/editor/Editor.yaml', 'ru/m/tankz/editor/Style.yaml')
|
@:template('ru/m/tankz/editor/Editor.yaml', 'ru/m/tankz/editor/Style.yaml')
|
||||||
class EditorView extends VGroupView implements ViewBuilder implements EditorViewLayout {}
|
class EditorView extends VGroupView {
|
||||||
|
@:view public var switcher(default, null):FrameSwitcher;
|
||||||
|
@:view public var btn_level(default, null):ButtonView;
|
||||||
|
@:view public var btn_tank(default, null):ButtonView;
|
||||||
|
}
|
||||||
|
|
||||||
class Editor {
|
class Editor {
|
||||||
|
|
||||||
@@ -54,13 +53,15 @@ class Editor {
|
|||||||
Provider.get(IResources).text.put('font', 'Bookman Old Style');
|
Provider.get(IResources).text.put('font', 'Bookman Old Style');
|
||||||
Provider.get(IResources).text.put('version', 'v${Const.VERSION} b${Const.BUILD}');
|
Provider.get(IResources).text.put('version', 'v${Const.VERSION} b${Const.BUILD}');
|
||||||
|
|
||||||
view = new EditorView({handler: this});
|
view = new EditorView();
|
||||||
Root.bind(view);
|
Root.bind(view);
|
||||||
view.content.stage.stageFocusRect = false;
|
view.content.stage.stageFocusRect = false;
|
||||||
|
|
||||||
Provider.setFactory(IConfigBundle, ConfigBundle);
|
Provider.setFactory(IConfigBundle, ConfigBundle);
|
||||||
Provider.setFactory(ILevelBundle, LevelBundle);
|
Provider.setFactory(ILevelBundle, LevelBundle);
|
||||||
|
|
||||||
|
view.btn_level.onPress = this;
|
||||||
|
view.btn_tank.onPress = this;
|
||||||
view.switcher.change(LevelFrame.ID);
|
view.switcher.change(LevelFrame.ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,10 @@ views:
|
|||||||
$type: haxework.gui.ButtonView
|
$type: haxework.gui.ButtonView
|
||||||
$style: button
|
$style: button
|
||||||
text: Level
|
text: Level
|
||||||
onPress: "@link:handler"
|
|
||||||
- id: btn_tank
|
- id: btn_tank
|
||||||
$type: haxework.gui.ButtonView
|
$type: haxework.gui.ButtonView
|
||||||
$style: button
|
$style: button
|
||||||
text: Tank
|
text: Tank
|
||||||
onPress: "@link:handler"
|
|
||||||
- $type: haxework.gui.SpriteView
|
- $type: haxework.gui.SpriteView
|
||||||
height: 3
|
height: 3
|
||||||
pWidth: 100
|
pWidth: 100
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import haxework.gui.LabelView;
|
|||||||
import haxework.gui.list.ListView;
|
import haxework.gui.list.ListView;
|
||||||
import haxework.gui.list.VListView;
|
import haxework.gui.list.VListView;
|
||||||
import haxework.gui.VGroupView;
|
import haxework.gui.VGroupView;
|
||||||
import haxework.gui.ViewBuilder;
|
|
||||||
import haxework.provider.Provider;
|
import haxework.provider.Provider;
|
||||||
import ru.m.tankz.config.Config;
|
import ru.m.tankz.config.Config;
|
||||||
import ru.m.tankz.editor.FileUtil;
|
import ru.m.tankz.editor.FileUtil;
|
||||||
@@ -19,22 +18,20 @@ import ru.m.tankz.game.DotaGame;
|
|||||||
import ru.m.tankz.Type;
|
import ru.m.tankz.Type;
|
||||||
|
|
||||||
|
|
||||||
interface LevelFrameLayout {
|
|
||||||
var gameClassicButton(default, null):ButtonView;
|
|
||||||
var gameDotaButton(default, null):ButtonView;
|
|
||||||
var openButton(default, null):ButtonView;
|
|
||||||
var saveButton(default, null):ButtonView;
|
|
||||||
var fileNameLabel(default, null):LabelView;
|
|
||||||
var mapView(default, null):MapEditView;
|
|
||||||
var spawnPointList(default, null):VListView<SpawnPoint>;
|
|
||||||
var brickList(default, null):VListView<BrickConfig>;
|
|
||||||
}
|
|
||||||
|
|
||||||
@:template('ru/m/tankz/editor/frame/LevelFrame.yaml', 'ru/m/tankz/editor/Style.yaml')
|
@:template('ru/m/tankz/editor/frame/LevelFrame.yaml', 'ru/m/tankz/editor/Style.yaml')
|
||||||
class LevelFrame extends VGroupView implements ViewBuilder implements LevelFrameLayout {
|
class LevelFrame extends VGroupView {
|
||||||
public static inline var ID = 'level';
|
public static inline var ID = 'level';
|
||||||
public static inline var TAG = 'level';
|
public static inline var TAG = 'level';
|
||||||
|
|
||||||
|
@:view var gameClassicButton(default, null):ButtonView;
|
||||||
|
@:view var gameDotaButton(default, null):ButtonView;
|
||||||
|
@:view var openButton(default, null):ButtonView;
|
||||||
|
@:view var saveButton(default, null):ButtonView;
|
||||||
|
@:view var fileNameLabel(default, null):LabelView;
|
||||||
|
@:view var mapView(default, null):MapEditView;
|
||||||
|
@:view var spawnPointList(default, null):VListView<SpawnPoint>;
|
||||||
|
@:view var brickList(default, null):VListView<BrickConfig>;
|
||||||
|
|
||||||
private var config:Config;
|
private var config:Config;
|
||||||
|
|
||||||
public function init():Void {
|
public function init():Void {
|
||||||
|
|||||||
@@ -4,20 +4,17 @@ import ru.m.draw.Color;
|
|||||||
import ru.m.tankz.editor.tank.TankView;
|
import ru.m.tankz.editor.tank.TankView;
|
||||||
import haxework.gui.InputView;
|
import haxework.gui.InputView;
|
||||||
import haxework.gui.HGroupView;
|
import haxework.gui.HGroupView;
|
||||||
import haxework.gui.ViewBuilder;
|
|
||||||
|
|
||||||
|
|
||||||
interface TankFrameLayout {
|
|
||||||
var tank(default, null):TankView;
|
|
||||||
var colorR(default, null):InputView;
|
|
||||||
var colorG(default, null):InputView;
|
|
||||||
var colorB(default, null):InputView;
|
|
||||||
}
|
|
||||||
|
|
||||||
@:template('ru/m/tankz/editor/frame/TankFrame.yaml', 'ru/m/tankz/editor/Style.yaml')
|
@:template('ru/m/tankz/editor/frame/TankFrame.yaml', 'ru/m/tankz/editor/Style.yaml')
|
||||||
class TankFrame extends HGroupView implements ViewBuilder implements TankFrameLayout {
|
class TankFrame extends HGroupView {
|
||||||
public static inline var ID = 'tank';
|
public static inline var ID = 'tank';
|
||||||
|
|
||||||
|
@:view var tank(default, null):TankView;
|
||||||
|
@:view var colorR(default, null):InputView;
|
||||||
|
@:view var colorG(default, null):InputView;
|
||||||
|
@:view var colorB(default, null):InputView;
|
||||||
|
|
||||||
public function init():Void {
|
public function init():Void {
|
||||||
colorR.onKeyUp = this;
|
colorR.onKeyUp = this;
|
||||||
colorG.onKeyUp = this;
|
colorG.onKeyUp = this;
|
||||||
|
|||||||
Reference in New Issue
Block a user