3 Commits

Author SHA1 Message Date
ee4438f2b4 build(ansible): remove ansible 2026-07-13 23:36:21 +03:00
4212d85d86 feat(haxework): update haxework to 2.1.1 2026-07-13 23:36:01 +03:00
0b24c03068 style: format code 2026-07-13 22:41:32 +03:00
229 changed files with 7640 additions and 8016 deletions

View File

@@ -8,5 +8,6 @@ indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.yaml]
indent_size = 2
[*.md]
max_line_length = off
trim_trailing_whitespace = false

View File

@@ -19,3 +19,6 @@ DOCKER_PROJECTS=(
DOCKER_ARGS=(
"PROJECT_NAME=$PROJECT"
)
NEKO_SDK="$SDK_PATH/neko/2.2.0"
HAXE_SDK="$SDK_PATH/haxe/4.2.5"

View File

@@ -1,11 +0,0 @@
[defaults]
hash_behaviour = merge
host_key_checking = False
#callback_whitelist = profile_tasks
display_skipped_hosts = False
stdout_callback = yaml
bin_ansible_callbacks = True
[ssh_connection]
pipelining = True
ssh_args = -o ForwardAgent=yes

View File

@@ -1,14 +0,0 @@
---
- hosts: all
vars:
ansible_user: "{{ deploy_user }}"
roles:
- ansible-deploy
- build
post_tasks:
- include_role:
name: ansible-deploy
tasks_from: complete.yml
- include_role:
name: service
tasks_from: restart.yml

View File

@@ -1,2 +0,0 @@
all:
hosts: localhost

View File

@@ -1,15 +0,0 @@
---
project_name: tankz
project_user: holop
deploy_user: "{{ project_user }}"
deploy_project: "{{ project_name }}"
deploy_repo_url: "git@bitbucket.org:infernalgames/{{ project_name }}.git"
deploy_repo_version: develop
deploy_npm: yes
service_name: "{{ project_name }}"
service_work_dir: "{{ deploy_current_dir }}/target/server/cpp"
service_command: "{{ service_work_dir }}/{{ project_name }} {{ service_host }}"
service_user: www-data
service_control_user: "{{ project_user }}"

View File

@@ -1,5 +0,0 @@
all:
hosts: shmyga.ru
vars:
service_host: 213.139.208.180
config_src: "/home/holop/tankz/config.json"

View File

@@ -1,7 +0,0 @@
---
- name: ansible-deploy
src: git@bitbucket.org:shmyga/ansible-deploy.git
version: master
scm: git
- name: geerlingguy.nodejs

View File

@@ -1,2 +0,0 @@
config_src: "{{ deploy_release_dir }}/config.{{ inventory_hostname }}.json"
config_dest: "{{ deploy_release_dir }}/config.json"

View File

@@ -1,11 +0,0 @@
---
- name: "Copy config"
copy:
src: "{{ config_src }}"
dest: "{{ config_dest }}"
remote_src: true
- name: "Gulp build"
command: "{{ deploy_release_dir }}/node_modules/.bin/gulp default --host shmyga.ru"
args:
chdir: "{{ deploy_release_dir }}"

View File

@@ -1,6 +0,0 @@
service_name: null
service_description: "{{ service_name }} service"
service_work_dir: null
service_command: null
service_user: null
service_control_user: null

View File

@@ -1,21 +0,0 @@
---
- name: "Install {{ service_name }} systemd unit file"
template:
src: "template/service.j2"
dest: "/etc/systemd/system/{{ service_name }}.service"
- name: "Start {{ service_name }} service"
systemd:
enabled: yes
state: started
name: "{{ service_name }}"
daemon_reload: yes
- name: "Add sudoers record for {{ service_name }} service"
lineinfile:
path: /etc/sudoers.d/{{ service_name }}
state: present
create: yes
regexp: "^{{ service_control_user }} ALL="
line: "{{ service_control_user }} ALL= NOPASSWD: /bin/systemctl * {{ service_name }}"
validate: "/usr/sbin/visudo -cf %s"

View File

@@ -1,11 +0,0 @@
---
# - name: "Restart {{ service_name }} service"
# systemd:
# enabled: yes
# state: restarted
# name: "{{ service_name }}"
- name: "Restart {{ service_name }} service"
command: "sudo /bin/systemctl restart {{ service_name }}"
args:
warn: no

View File

@@ -1,15 +0,0 @@
[Unit]
Description={{ service_description }}
[Service]
Type=simple
PIDFile=/var/run/{{ service_name }}.pid
WorkingDirectory={{ service_work_dir }}
User={{ service_user }}
Group={{ service_user }}
ExecStart={{ service_command }}
TimeoutSec=300
Restart=always
[Install]
WantedBy=multi-user.target

View File

@@ -1,3 +0,0 @@
- name: "Install neko package"
apt:
name: neko

View File

@@ -1,2 +0,0 @@
- import_tasks: apt.yml
when: ansible_distribution|lower == 'ubuntu'

View File

@@ -1 +0,0 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCot1zSeqj7Tj5/7aNMzXAuXQPPxudYFV9z6M03dPijh2bXyHDcXk53xUO8XY5R4GyLhvAn98axbPM++urKY8BXuQqAG36soI7iZJ/KcPY1EKDwVBeZneFC/wMc8HMT0hj9+uHcGAMtmklIgPPkawzLxbEh6oAY4H8Vvz08qyco6suYB5NjkpFwVMf9Xa2Fj8rTodKpPRDBh/Xk+5bh11RKL6b9WcwuwpKU8zl2qZiqNfjr0H+sKEk7ohcYvzSCltLdKJcoKbiCcnrnBJT5/JpGWeAbA2MMmvmt/dJrHykd1CbmXW2DuG4tIlwMb5xU739PoKCePctK1retb8TrWOLT shmyga@shmyga-desktop

View File

@@ -1,40 +0,0 @@
# barin
- name: Make barin group
group:
name: barin
state: present
- name: Make barin user
user:
name: barin
group: barin
password: '$6$mbw5KZWwtrRUy$eFcMNTW.QzG1Em45r5hZf/qri4hKAHImozWuW4/pYnDK.tOrVKrXTKYfRDtYEFRgCgVVg0zuPvyq/xn0KiKlz0'
groups: www-data,sudo,adm
- name: Set up authorized_keys for the barin user
authorized_key:
user: barin
key: '{{ item }}'
with_file:
- keys/shmyga.pub
# holop
- name: Make holop group
group:
name: holop
state: present
- name: Make holop user
user:
name: holop
group: holop
password: '$6$B/7g0xlcXFCIHk$hzSjb8KLll7YrTsp3z640sxNixNAkLpm6UUdZgWPh0Ffy7Ue18AiXTzkDdGTaTH6Woz4kvgVDSggnKGTU6u03.'
groups: www-data
- name: Set up authorized_keys for the holop user
authorized_key:
user: holop
key: '{{ item }}'
with_file:
- keys/shmyga.pub

View File

@@ -1 +0,0 @@
ansible_become: yes

View File

@@ -1,8 +0,0 @@
---
- hosts: all
vars:
ansible_user: "{{ deploy_user }}"
tasks:
- include_role:
name: service
tasks_from: restart.yml

View File

@@ -1,16 +0,0 @@
---
- hosts:
- all
pre_tasks:
- include_role:
name: ansible-deploy
tasks_from: facts.yml
roles:
- geerlingguy.nodejs
- setup
- service
vars:
nodejs_version: 9.x
nodejs_npm_global_packages: [gulp-cli]
vars_files:
- vars/barin.yml

View File

@@ -1,4 +0,0 @@
- hosts: all
gather_facts: no
roles:
- user

View File

@@ -1,4 +0,0 @@
---
ansible_user: barin
ansible_become_pass: 1234!QAZ
ansible_become: yes

View File

@@ -1,5 +1,8 @@
{
"indentation": {
"character": " "
},
"wrapping": {
"maxLineLength": 120
}
}

View File

@@ -11,7 +11,7 @@
"yargs": "^13.2.4"
},
"haxeDependencies": {
"haxework": "2.1.0",
"haxework": "2.1.1",
"lime": "8.0.0",
"openfl": "9.2.0",
"hxcpp": "4.2.1",

View File

@@ -2,6 +2,7 @@
set -e
cd "$(dirname $(dirname "$0"))" || exit
source .env
source $NEKO_SDK/activate
source $HAXE_SDK/activate
haxelib install formatter

View File

@@ -2,6 +2,7 @@
set -e
cd "$(dirname $(dirname "$0"))" || exit
source .env
source $NEKO_SDK/activate
source $HAXE_SDK/activate
haxelib install formatter

View File

@@ -7,7 +7,6 @@ package ru.m;
}
class Device {
public static var platform(get, null):Platform;
private static function get_platform():Platform {
@@ -22,9 +21,8 @@ class Device {
#end
}
private static var MOBILES(default, never):Array<String> = [
"Android", "webOS", "iPhone", "iPad", "iPod", "BlackBerry", "Windows Phone",
];
private static var MOBILES(default,
never):Array<String> = ["Android", "webOS", "iPhone", "iPad", "iPod", "BlackBerry", "Windows Phone",];
public static function isMobile():Bool {
#if android

View File

@@ -10,7 +10,6 @@ typedef Frame = {
}
class Animate extends Bitmap {
public var playing(default, default):Bool;
public var frames(default, set):Array<Frame>;

View File

@@ -4,7 +4,6 @@ import promhx.Deferred;
import promhx.Promise;
class OnceAnimate extends Animate {
private var deferred:Deferred<Animate>;
public function play():Promise<Animate> {

View File

@@ -4,7 +4,6 @@ import hw.signal.Signal;
import ru.m.control.IControlBus;
class ControlBus implements IControlBus {
private static inline var TAG = "control";
public var devices(default, null):Array<IControlDevice>;
@@ -23,7 +22,7 @@ class ControlBus implements IControlBus {
public function connect(device:IControlDevice):Void {
var connector = function(action:DeviceAction, on:Bool):Void {
//L.d("TAG", '${device.type}, ${action}, ${on}');
// L.d("TAG", '${device.type}, ${action}, ${on}');
signal.emit(device.type, action, on);
}
connections.set(device.type, connector);

View File

@@ -7,7 +7,6 @@ import ru.m.control.DeviceType;
import ru.m.geom.Direction;
class JoystickDevice implements IControlDevice {
public var type(default, null):DeviceType;
public var signal(default, null):Signal2<DeviceAction, Bool>;

View File

@@ -6,7 +6,6 @@ import hw.signal.Signal;
import ru.m.control.DeviceAction;
class KeyboardDevice implements IControlDevice {
public var type(default, null):DeviceType;
public var signal(default, null):Signal2<DeviceAction, Bool>;

View File

@@ -4,7 +4,6 @@ import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
class DisplayObjectContainerExtender {
public static function childrenIterator():Iterator<DisplayObject> {
throw "Not implemented";
}

View File

@@ -9,7 +9,6 @@ using StringTools;
using hw.color.ColorUtil;
@:style class ButtonSVGSkin implements ISkin<ButtonView> {
@:style(null) private var svg:String;
@:style(0) private var color:Null<Color>;
@:style(false) private var solid:Null<Bool>;

View File

@@ -15,7 +15,6 @@ import ru.m.skin.ButtonSVGSkin;
using hw.color.ColorUtil;
class AppTheme extends Theme {
public static var COLORS(default, never):ThemeColors = {
light: 0x95937D,
dark: 0x777564,
@@ -29,17 +28,11 @@ class AppTheme extends Theme {
override private function reload():Void {
super.reload();
register(new Style("light", [
"skin.background.color" => colors.light,
]));
register(new Style("light", ["skin.background.color" => colors.light,]));
register(new Style("dark", [
"skin.background.color" => colors.dark,
]));
register(new Style("dark", ["skin.background.color" => colors.dark,]));
register(new Style("font", [
"_" => null,
], ["text"]));
register(new Style("font", ["_" => null,], ["text"]));
register(new Style("text.header", [
"font.size" => fontSize.big,
@@ -97,14 +90,10 @@ class AppTheme extends Theme {
"layout.vAlign" => VAlign.MIDDLE,
], ["light"]));
register(new Style("panel_button", [
"font.size" => fontSize.big,
"geometry.height" => SizeValue.fromString("100%"),
], ["button"]));
register(new Style("panel_button",
["font.size" => fontSize.big, "geometry.height" => SizeValue.fromString("100%"),], ["button"]));
register(new Style("window", [
"geometry.padding" => Box.fromFloat(2),
], ["dark", "border"]));
register(new Style("window", ["geometry.padding" => Box.fromFloat(2),], ["dark", "border"]));
register(new Style("line", [
"geometry.width" => SizeValue.fromString("100%"),
@@ -112,7 +101,8 @@ class AppTheme extends Theme {
], ["border"]));
register(new Style("window.close", [
"skin" => function() return new ButtonSVGSkin(Assets.getText("resources/image/icon/window-close-solid.svg"), colors.light),
"skin" => function() return new ButtonSVGSkin(Assets.getText("resources/image/icon/window-close-solid.svg"),
colors.light),
"geometry.width" => SizeValue.fromString("8h"),
"geometry.height" => SizeValue.fromString("8h"),
]));
@@ -137,14 +127,8 @@ class AppTheme extends Theme {
"skin.border.thickness" => 5,
"skin.round" => 10,
], ["light"]));
register(new Style("player.winner", [
"skin.background.alpha" => 0.2,
"skin.background.color" => green,
]));
register(new Style("player.loser", [
"skin.background.alpha" => 0.2,
"skin.background.color" => red,
]));
register(new Style("player.winner", ["skin.background.alpha" => 0.2, "skin.background.color" => green,]));
register(new Style("player.loser", ["skin.background.alpha" => 0.2, "skin.background.color" => red,]));
register(new Style("button.pack", [
"geometry.width" => SizeValue.fromString("35h"),
@@ -157,9 +141,7 @@ class AppTheme extends Theme {
"skin.round" => 15,
], ["border", "light"]));
register(new Style("button.menu", [
"geometry.padding" => Box.fromArray([20, 10]),
]));
register(new Style("button.menu", ["geometry.padding" => Box.fromArray([20, 10]),]));
registerButton("settings", "cog-solid.svg");
registerButton("close", "times-circle-solid.svg");
@@ -174,27 +156,23 @@ class AppTheme extends Theme {
registerButton("backspace", "backspace-light.svg", true);
registerButton("tablet-android-alt", "tablet-android-alt-light.svg", true);
register(new Style("gamepad", [
"skin.color" => colors.text,
"skin.activeColor" => colors.active,
]));
register(new Style("gamepad", ["skin.color" => colors.text, "skin.activeColor" => colors.active,]));
register(new Style("render", [
"skin.background.color" => colors.dark,
]));
register(new Style("render", ["skin.background.color" => colors.dark,]));
}
private function registerButton(name:String, resource:String, solid:Bool = false):Void {
register(new Style('button.$name', [
"geometry.width" => SizeValue.fromString("10h"),
"geometry.height" => SizeValue.fromString("10h"),
"skin" => function() return new ButtonSVGSkin(Assets.getText('resources/image/icon/$resource'), colors.light, solid),
"skin" => function() return new ButtonSVGSkin(Assets.getText('resources/image/icon/$resource'), colors.light,
solid),
]));
register(new Style('button.$name.small', [
"geometry.width" => SizeValue.fromString("7h"),
"geometry.height" => SizeValue.fromString("7h"),
"skin" => function() return new ButtonSVGSkin(Assets.getText('resources/image/icon/$resource'), colors.light, solid),
"skin" => function() return new ButtonSVGSkin(Assets.getText('resources/image/icon/$resource'), colors.light,
solid),
]));
}
}

View File

@@ -22,7 +22,7 @@ class Client {
L.push(new hw.log.JSLogger());
#end
#if debug
//L.push(new hw.log.SocketLogger());
// L.push(new hw.log.SocketLogger());
#end
// ToDo: fix @:provide macro
PopupManager;

View File

@@ -23,7 +23,6 @@ import ru.m.tankz.proto.pack.Response;
import ru.m.update.Updater;
class Init {
@:provide static var theme:ITheme;
@:provide static var levelBundle:ILevelBundle;
@:provide static var configBundle:IConfigBundle;
@@ -39,7 +38,8 @@ class Init {
#if flash
return new ru.m.connect.flash.FlashConnection<Request, Response>(host, port, Response);
#elseif html5
return new ru.m.connect.js.JsConnection<Request, Response>(host, port + (ru.m.connect.js.JsConnection.isSecured() ? 1 : 0), Response);
return new ru.m.connect.js.JsConnection<Request, Response>(host,
port + (ru.m.connect.js.JsConnection.isSecured() ? 1 : 0), Response);
#else
return new ru.m.connect.desktop.DesktopConnection<Request, Response>(host, port, Response);
#end

View File

@@ -7,7 +7,6 @@ import flash.Lib;
import openfl.Assets;
class LinuxIcon {
private static function prepareIcon(bitmap:BitmapData):BitmapData {
var matrix:Array<Float> = [];
matrix = matrix.concat([0, 0, 1, 0, 0]);

View File

@@ -9,7 +9,6 @@ import hw.view.geometry.Size;
import ru.m.tankz.AppTheme;
class Progress extends Sprite {
public var color(default, set):Int = 0;
public var backColor(default, set):Int = 0;
public var progress(default, set):Float = 0;
@@ -85,7 +84,7 @@ class Progress extends Sprite {
maskShape.graphics.moveTo(radius, radius);
var sides = 6;
var rotation = (-(Math.PI) / 2);
var r = radius / Math.cos(1/sides * Math.PI);
var r = radius / Math.cos(1 / sides * Math.PI);
var lineToRadians = function(rads:Float):Void {
maskShape.graphics.lineTo(Math.cos(rads) * r + radius, Math.sin(rads) * r + radius);
};
@@ -101,7 +100,6 @@ class Progress extends Sprite {
}
class Preloader extends Sprite {
private var progress:Progress;
public function new() {

View File

@@ -8,7 +8,6 @@ import ru.m.tankz.Type;
import ru.m.tankz.util.LevelUtil;
class ClientLevelSource implements ILevelSource {
public function new() {}
public function resolveMeta(id:PackId):LevelPackMeta {

View File

@@ -8,7 +8,6 @@ import yaml.Parser;
import yaml.Yaml;
class ConfigBundle implements IConfigBundle {
private var _cache:Map<GameType, Config> = new Map();
public function new() {}

View File

@@ -13,7 +13,6 @@ import ru.m.tankz.Type;
using haxe.EnumTools.EnumValueTools;
class HumanControl extends Control {
@:provide static var storage:SettingsStorage;
@:provide static var bus:IControlBus;
@@ -110,7 +109,7 @@ class HumanControl extends Control {
}
}
private function shooter(weapon:Int):Void -> Void {
private function shooter(weapon:Int):Void->Void {
return function():Void {
action(SHOT(weapon));
}

View File

@@ -6,7 +6,6 @@ import ru.m.tankz.control.HumanControl;
import ru.m.tankz.Type;
class LocalControlFactory extends BaseControlFactory {
override private function buildHuman(id:PlayerId, index:Int):Control {
return new HumanControl(id, index);
}

View File

@@ -8,7 +8,6 @@ import ru.m.tankz.storage.GameStorage;
import ru.m.tankz.Type;
class LocalGame extends GameRunner {
@:provide static var gameStorage:GameStorage;
public function new(start:Start) {

View File

@@ -5,10 +5,9 @@ import flash.events.Event;
import ru.m.tankz.engine.ICaller;
class StageCaller implements ICaller {
private var stage:Stage;
private var event:String;
private var calback:Void -> Void;
private var calback:Void->Void;
public function new(stage:Stage, ?event:String) {
this.stage = stage;
@@ -19,7 +18,7 @@ class StageCaller implements ICaller {
calback();
}
public function start(calback:Void -> Void):Void {
public function start(calback:Void->Void):Void {
this.calback = calback;
stage.addEventListener(event, onEvent);
}

View File

@@ -5,7 +5,6 @@ import ru.m.tankz.network.NetworkManager;
import ru.m.tankz.control.Control;
class NetworkControl extends HumanControl {
@:provide private var network:NetworkManager;
override public function action(action:TankAction):Void {

View File

@@ -5,7 +5,6 @@ import ru.m.tankz.control.Control;
import ru.m.tankz.Type;
class NetworkControlFactory extends BaseControlFactory {
override private function buildHuman(id:PlayerId, index:Int):Control {
return new NetworkControl(id, index);
}

View File

@@ -10,7 +10,6 @@ import ru.m.tankz.proto.pack.GameEventResponse;
import ru.m.tankz.proto.room.RoomSlotProto;
class NetworkGame extends Game {
private var network:NetworkManager;
public function new(network:NetworkManager) {
@@ -39,7 +38,8 @@ class NetworkGame extends Game {
}
override private function onStart(start:Start):Void {
var slot:RoomSlotProto = Lambda.find(network.room.slots, function(slot:RoomSlotProto) return slot.hasUser() && slot.user.uuid == network.user.uuid);
var slot:RoomSlotProto = Lambda.find(network.room.slots,
function(slot:RoomSlotProto) return slot.hasUser() && slot.user.uuid == network.user.uuid);
if (slot != null) {
start.state.controls.push({playerId: [slot.slot.team, slot.slot.index], controller: HUMAN(0)});
}

View File

@@ -37,7 +37,6 @@ enum ConnectionState {
}
@:provide class NetworkManager {
private static inline var TAG = "NetworkManager";
public var state(default, null):ConnectionState;
@@ -91,11 +90,7 @@ enum ConnectionState {
public function login(name:String, uuid:String = null):Void {
updateState(LOGIN);
connection.send(new Request().setLogin(
new LoginRequest()
.setUuid(uuid)
.setName(name)
));
connection.send(new Request().setLogin(new LoginRequest().setUuid(uuid).setName(name)));
}
public function logout():Void {
@@ -107,11 +102,13 @@ enum ConnectionState {
}
public function createGame(type:String, level:Int):Void {
connection.send(new Request().setRoom(new RoomRequest().setCreate(new CreateRequest().setType(type).setLevel(level))));
connection.send(new Request().setRoom(new RoomRequest().setCreate(new CreateRequest().setType(type)
.setLevel(level))));
}
public function joinGame(gameId:Int, restore:Bool = false):Void {
connection.send(new Request().setRoom(new RoomRequest().setJoin(new JoinRequest().setGameId(gameId).setRestore(restore))));
connection.send(new Request().setRoom(new RoomRequest().setJoin(new JoinRequest().setGameId(gameId)
.setRestore(restore))));
}
public function selectSlot(slot:SlotProto):Void {
@@ -127,11 +124,8 @@ enum ConnectionState {
}
public function action(tankId:Int, action:TankAction):Void {
connection.send(new Request().setGameEvent(new GameEventRequest().setEvent(
new GameEventProto().setTime(0).setEvent(
Serializer.run(GameEvent.ACTION(tankId, action))
)))
);
connection.send(new Request().setGameEvent(new GameEventRequest().setEvent(new GameEventProto().setTime(0)
.setEvent(Serializer.run(GameEvent.ACTION(tankId, action))))));
}
private function connect():Void {

View File

@@ -5,38 +5,35 @@ import ru.m.animate.Animate;
import ru.m.animate.OnceAnimate;
class AnimateBundle {
private static function buildAnimate(name:String, sequence:Array<Int>):OnceAnimate {
var template:String = 'resources/image/animate/${name}/%index%.png';
var frames = [for (i in sequence) ({
image: Assets.getBitmapData(StringTools.replace(template, '%index%', Std.string(i))),
length: 1
})];
var frames = [
for (i in sequence)
({
image:Assets.getBitmapData(StringTools.replace(template, '%index%', Std.string(i))), length:1
})
];
return new OnceAnimate(frames);
}
public static function tankSpawn():OnceAnimate {
return buildAnimate('appear', [
0, 1, 2, 3, 3, 4, 5, 5, 6
]);
return buildAnimate('appear', [0, 1, 2, 3, 3, 4, 5, 5, 6]);
}
public static function tankBoom():OnceAnimate {
return buildAnimate('boom', [
0, 1, 2, 3, 4, 4, 4, 1, 4, 4, 7, 7, 8, 9, 9
]);
return buildAnimate('boom', [0, 1, 2, 3, 4, 4, 4, 1, 4, 4, 7, 7, 8, 9, 9]);
}
public static function bulletBoom():OnceAnimate {
return buildAnimate('boom-sm', [
0, 1, 1, 0, 0, 1
]);
return buildAnimate('boom-sm', [0, 1, 1, 0, 0, 1]);
}
public static function tankProtect():Animate {
return new Animate([for (i in 0...2) ({
image: Assets.getBitmapData('resources/image/animate/protect/${i}.png'),
length: 5
})]);
return new Animate([
for (i in 0...2)
({
image:Assets.getBitmapData('resources/image/animate/protect/${i}.png'), length:5
})
]);
}
}

View File

@@ -23,10 +23,10 @@ import ru.m.tankz.render.item.EagleRenderItem;
import ru.m.tankz.render.item.IRenderItem;
import ru.m.tankz.render.item.TankRenderItem;
import ru.m.tankz.Type;
using ru.m.display.DisplayObjectContainerExtender;
class Render extends SpriteView implements IRender {
public var config(default, set):Config;
public var gridSize(default, set):GridSize;

View File

@@ -5,7 +5,6 @@ import openfl.Assets;
import ru.m.tankz.Type;
class RenderUtil {
public static function eagleImage(death:Bool = false):BitmapData {
var suffix = death ? '-death' : '';
return Assets.getBitmapData('resources/image/eagle/eagle${suffix}.png');

View File

@@ -4,8 +4,8 @@ import ru.m.geom.Rectangle;
import ru.m.tankz.Type;
class BonusRenderItem extends BitmapRenderItem {
public var type(default, set):BonusType;
private var d = -0.05;
private var alpha = 1.0;

View File

@@ -7,7 +7,6 @@ import ru.m.geom.Rectangle;
import ru.m.tankz.Type;
class BrickBitmapBundle {
private var data:Map<String, BitmapData>;
public function new() {
@@ -24,10 +23,7 @@ class BrickBitmapBundle {
var image = RenderUtil.brickImage(type, frame);
var result = new BitmapData(image.width, image.height, true, 0x00000000);
for (point in cells) {
var rect = new flash.geom.Rectangle(
point.x * image.width / 2,
point.y * image.height / 2,
image.width / 2,
var rect = new flash.geom.Rectangle(point.x * image.width / 2, point.y * image.height / 2, image.width / 2,
image.height / 2);
result.draw(image, null, null, null, rect);
}
@@ -45,7 +41,6 @@ class BrickBitmapBundle {
}
class BrickRenderItem extends BitmapRenderItem {
private static var bundle:BrickBitmapBundle = new BrickBitmapBundle();
public var type(default, set):BrickType;

View File

@@ -5,7 +5,6 @@ import ru.m.geom.Position;
import ru.m.geom.Rectangle;
class RenderItem implements IRenderItem {
public var view(get, null):DisplayObject;
public var content(get, null):DisplayObject;
@@ -30,12 +29,22 @@ class RenderItem implements IRenderItem {
rect.direction = position.direction;
if (content != null) {
content.rotation = rect.direction.angle;
content.x = - rect.width * (rect.direction.x + 1) / 2 + rect.width * (rect.direction.y + 1) / 2 + 0.5 * rect.width;
content.y = - rect.height * (rect.direction.x + 1) / 2 - rect.height * (rect.direction.y + 1) / 2 + 1.5 * rect.height;
content.x = -rect.width * (rect.direction.x + 1) / 2
+ rect.width * (rect.direction.y + 1) / 2
+ 0.5 * rect.width;
content.y = -rect.height * (rect.direction.x + 1) / 2
- rect.height * (rect.direction.y + 1) / 2
+ 1.5 * rect.height;
} else {
view.rotation = rect.direction.angle;
view.x = rect.x - rect.width * (rect.direction.x + 1) / 2 + rect.width * (rect.direction.y + 1) / 2 + 0.5 * rect.width;
view.y = rect.y - rect.height * (rect.direction.x + 1) / 2 - rect.height * (rect.direction.y + 1) / 2 + 1.5 * rect.height;
view.x = rect.x
- rect.width * (rect.direction.x + 1) / 2
+ rect.width * (rect.direction.y + 1) / 2
+ 0.5 * rect.width;
view.y = rect.y
- rect.height * (rect.direction.x + 1) / 2
- rect.height * (rect.direction.y + 1) / 2
+ 1.5 * rect.height;
}
}
}

View File

@@ -155,7 +155,7 @@ class TankRenderItem extends BitmapRenderItem {
name = value;
nameView.text = name;
nameView.x = (rect.width - nameView.width) / 2;
nameView.y = -nameView.height / 2; //(rect.height - nameView.height) / 2;
nameView.y = -nameView.height / 2; // (rect.height - nameView.height) / 2;
}
return name;
}

View File

@@ -58,7 +58,7 @@ import ru.m.tankz.game.IGame;
}
public function play(id:String):Void {
//L.d(TAG, 'play: ${id}');
// L.d(TAG, 'play: ${id}');
var sound:Sound = Assets.getSound('resources/sounds/${id}.${type}');
if (sound != null) {
var channel = sound.play(0, 0, transform);
@@ -105,7 +105,7 @@ import ru.m.tankz.game.IGame;
play("bullet_hit");
case HIT(CELL(_, _, shot)):
if (humanBullets.indexOf(shot.bulletId) > -1) {
//play("bullet_block");
// play("bullet_block");
}
case DESTROY(TANK(id, _)):
if (humanTanks.indexOf(id) > -1) {
@@ -116,7 +116,7 @@ import ru.m.tankz.game.IGame;
case DESTROY(EAGLE(_, _)):
play("boom_player");
case DESTROY(BONUS(id, _)):
play("bonus_get");
// play("bonus_get");
if (liveBonuses.indexOf(id) > -1) {
play("live");
} else {

View File

@@ -5,7 +5,6 @@ import ru.m.tankz.game.PackProgress;
import ru.m.tankz.Type;
@:provide class GameStorage extends SharedObjectStorage {
private static inline var VERSION = 1;
public function new() {

View File

@@ -3,7 +3,6 @@ package ru.m.tankz.storage;
import hw.storage.SharedObjectStorage;
@:provide class NetworkStorage extends SharedObjectStorage {
public var user(get, set):User;
public function new() {

View File

@@ -5,7 +5,6 @@ import hw.storage.SharedObjectStorage;
import ru.m.tankz.game.record.GameRecord;
@:provide class RecordStorage extends SharedObjectStorage {
private static inline var VERSION = 1;
public function new() {

View File

@@ -17,7 +17,6 @@ enum Setting {
}
@:provide class SettingsStorage extends SharedObjectStorage {
private static inline var VERSION = 4.1;
public var signal(default, null):Signal<Setting> = new Signal();
@@ -88,9 +87,7 @@ enum Setting {
];
}
private static var mobileDefaults:Map<Int, Binding> = [
0 => buildDeviceBinding(SCREEN),
];
private static var mobileDefaults:Map<Int, Binding> = [0 => buildDeviceBinding(SCREEN),];
private static var defaults:Map<Int, Binding> = [
0 => [

View File

@@ -17,6 +17,7 @@ import ru.m.tankz.sound.SoundManager;
@:provide var resources:IResources;
@:provide var switcher:FrameSwitcher;
@:provide var soundManager:SoundManager;
@:provide static var bus:IControlBus;
public function new():Void {

View File

@@ -19,7 +19,6 @@ import ru.m.update.Updater;
using ru.m.tankz.view.ViewUtil;
@:template class MenuFrame extends FrameView<Dynamic> {
public static var ID(default, never):String = "menu";
@:provide static var gameInit:GameInit;
@@ -59,7 +58,8 @@ using ru.m.tankz.view.ViewUtil;
private function onSettingChange(setting:Setting):Void {
switch setting {
case ENABLE_NETWORK(value): networkButton.visible = value;
case ENABLE_NETWORK(value):
networkButton.visible = value;
case _:
}
}

View File

@@ -7,7 +7,6 @@ import ru.m.tankz.game.record.GameRecord;
import ru.m.tankz.storage.RecordStorage;
@:template class RecordFrame extends FrameView<Dynamic> {
public static var ID(default, never):String = "record";
@:provide static var switcher:FrameSwitcher;

View File

@@ -22,6 +22,7 @@ using ru.m.tankz.view.ViewUtil;
@:view("next") var nextButton:ButtonView;
@:provide var frames:FrameSwitcher;
@:provide static var levelBundle:ILevelBundle;
@:provide static var gameStorage:GameStorage;
@@ -38,7 +39,8 @@ using ru.m.tankz.view.ViewUtil;
view.winner = view.data.id.team == data.winner;
}
levelLabel.text = data.level.toLevelLabel();
nextButton.disabled = !gameStorage.get(result.level.packId).isPresetAvailable(result.level.id + 1, result.state.presetId);
nextButton.disabled = !gameStorage.get(result.level.packId)
.isPresetAvailable(result.level.id + 1, result.state.presetId);
nextButton.text = 'Next #${result.level.id + 1}';
}

View File

@@ -31,8 +31,10 @@ import ru.m.tankz.storage.SettingsStorage;
private function onSettingChange(setting:Setting):Void {
switch setting {
case DISPLAY_FPS(value): fpsButton.on = value;
case ENABLE_NETWORK(value): networkButton.on = value;
case DISPLAY_FPS(value):
fpsButton.on = value;
case ENABLE_NETWORK(value):
networkButton.on = value;
case _:
}
}

View File

@@ -19,7 +19,6 @@ using haxe.EnumTools.EnumValueTools;
using ru.m.tankz.view.ViewUtil;
@:template class StartFrame extends FrameView<Start> {
public static var ID(default, never):String = "start";
@:provide static var switcher:FrameSwitcher;

View File

@@ -8,7 +8,6 @@ import ru.m.tankz.control.Binding;
import ru.m.tankz.control.Control;
class KeyboardMap {
private var data:Map<Int, String>;
public function new() {
@@ -20,19 +19,18 @@ class KeyboardMap {
this.data.set(Std.parseInt(arr[1]), arr[0]);
}
}
}
private static var instance:KeyboardMap;
public static function getName(key:Int):String {
if (instance == null) instance = new KeyboardMap();
if (instance == null)
instance = new KeyboardMap();
return key == -1 ? "(NONE)" : instance.data.exists(key) ? instance.data.get(key) : Std.string(key);
}
}
class ViewUtil {
public static function toLevelLabel(level:LevelConfig, oneline:Bool = false):String {
var result:Array<String> = ['${level.packId.type} #${level.id}'];
if (level.name != null) {
@@ -41,7 +39,7 @@ class ViewUtil {
return result.join(oneline ? " " : "\n");
}
public static function toPackLabel(packId:PackId, separator=" #"):String {
public static function toPackLabel(packId:PackId, separator = " #"):String {
return packId.name != PackId.DEFAULT ? '${packId.type}${separator}${packId.name}' : packId.type;
}

View File

@@ -9,7 +9,6 @@ import ru.m.tankz.network.NetworkManager;
import ru.m.tankz.view.popup.LoginPopup;
@:template class NetworkStateView extends HGroupView {
@:view("state") var stateView:SpriteView;
@:view("user") var userLabel:LabelView;
@:view("login") var loginButton:ButtonView;

View File

@@ -9,7 +9,6 @@ import ru.m.tankz.Type;
using ru.m.tankz.view.ViewUtil;
@:template class PackView extends VGroupView {
public var data(default, set):PackId;
@:view var label:LabelView;

View File

@@ -10,7 +10,6 @@ import ru.m.tankz.control.Controller;
import ru.m.tankz.control.PlayerControl;
@:template class SlotView extends HGroupView {
@:view("tank") public var tankView:ImageView;
@:view("slot") public var slotLabel:LabelView;
@:view("select") public var select:SelectView<Controller>;

View File

@@ -6,7 +6,6 @@ import ru.m.tankz.render.RenderUtil;
import ru.m.tankz.Type.TankInfo;
class TankView extends ImageView {
public var tank(null, set):TankInfo;
public function new() {

View File

@@ -7,7 +7,6 @@ import ru.m.tankz.Type;
import ru.m.tankz.view.common.TankView;
@:template class PlayerView extends VGroupView {
@:view("title") public var titleView:LabelView;
@:view("tank") public var tankView:TankView;
@:view("life") public var lifeLabel:LabelView;

View File

@@ -5,7 +5,6 @@ import ru.m.tankz.game.GameState;
import ru.m.tankz.Type;
class TeamView extends DataView<PlayerState, PlayerView> {
public var teamId(default, default):TeamId;
public var state(default, set):TeamState;

View File

@@ -5,38 +5,27 @@ import ru.m.geom.Direction;
import ru.m.geom.Rectangle;
class DefaultActionAreaBuilder implements IActionAreaBuilder {
public function new() {
}
public function new() {}
public function build(width:Float, height:Float):Array<IActionArea> {
var areas:Array<IActionArea> = [];
var size = Math.min(width, height) / 7;
var padding = size / 2;
// top
areas.push(new RectangleActionArea(
DIRECTION(Direction.TOP),
new Rectangle(padding + size, height - size * 3 - padding, size, size)
));
areas.push(new RectangleActionArea(DIRECTION(Direction.TOP),
new Rectangle(padding + size, height - size * 3 - padding, size, size)));
// left
areas.push(new RectangleActionArea(
DIRECTION(Direction.LEFT),
new Rectangle(padding, height - size * 2 - padding, size, size)
));
areas.push(new RectangleActionArea(DIRECTION(Direction.LEFT),
new Rectangle(padding, height - size * 2 - padding, size, size)));
// bottom
areas.push(new RectangleActionArea(
DIRECTION(Direction.BOTTOM),
new Rectangle(padding + size, height - size - padding, size, size)
));
areas.push(new RectangleActionArea(DIRECTION(Direction.BOTTOM),
new Rectangle(padding + size, height - size - padding, size, size)));
// right
areas.push(new RectangleActionArea(
DIRECTION(Direction.RIGHT),
new Rectangle(padding + size * 2, height - size * 2 - padding, size, size)
));
areas.push(new RectangleActionArea(DIRECTION(Direction.RIGHT),
new Rectangle(padding + size * 2, height - size * 2 - padding, size, size)));
// button
areas.push(new RectangleActionArea(
KEY(0),
new Rectangle(width - size * 1.5 - padding, height - size * 2 - padding, size, size)
));
areas.push(new RectangleActionArea(KEY(0),
new Rectangle(width - size * 1.5 - padding, height - size * 2 - padding, size, size)));
return areas;
}
}

View File

@@ -6,7 +6,6 @@ import hw.view.skin.ISkin;
import ru.m.control.DeviceAction;
@:style class GamepadSkin implements ISkin<GamepadView> {
@:style(0xffffff) public var color(default, default):Null<Color>;
@:style(0x00ff00) public var activeColor(default, default):Null<Color>;

View File

@@ -12,7 +12,6 @@ import ru.m.geom.Point;
import ru.m.tankz.config.Config;
class GamepadView extends SpriteView implements IControlDevice {
public var type(default, null):DeviceType;
public var signal(default, null):Signal2<DeviceAction, Bool>;

View File

@@ -7,43 +7,30 @@ import ru.m.geom.Direction;
import ru.m.geom.Rectangle;
class SmartActionAreaBuilder implements IActionAreaBuilder {
public function new() {
}
public function new() {}
public function build(width:Float, height:Float):Array<IActionArea> {
var areas:Array<IActionArea> = [];
var size = Math.min(width, height) / 5;
var padding = Box.fromArray([size / 4, size / 3]);
// top
areas.push(new RhombusActionArea(
DIRECTION(Direction.TOP),
new Rectangle(padding.left + size * 0.5, height - size * 2 - padding.bottom, size, size )
));
areas.push(new RhombusActionArea(DIRECTION(Direction.TOP),
new Rectangle(padding.left + size * 0.5, height - size * 2 - padding.bottom, size, size)));
// left
areas.push(new RhombusActionArea(
DIRECTION(Direction.LEFT),
new Rectangle(padding.left, height - size * 1.5 - padding.bottom, size, size)
));
areas.push(new RhombusActionArea(DIRECTION(Direction.LEFT),
new Rectangle(padding.left, height - size * 1.5 - padding.bottom, size, size)));
// bottom
areas.push(new RhombusActionArea(
DIRECTION(Direction.BOTTOM),
new Rectangle(padding.left + size * 0.5, height - size - padding.bottom, size, size)
));
areas.push(new RhombusActionArea(DIRECTION(Direction.BOTTOM),
new Rectangle(padding.left + size * 0.5, height - size - padding.bottom, size, size)));
// right
areas.push(new RhombusActionArea(
DIRECTION(Direction.RIGHT),
new Rectangle(padding.left + size, height - size * 1.5 - padding.bottom, size, size)
));
areas.push(new RhombusActionArea(DIRECTION(Direction.RIGHT),
new Rectangle(padding.left + size, height - size * 1.5 - padding.bottom, size, size)));
// key 0
areas.push(new CircleActionArea(
KEY(0),
new Circle(width - size * 0.5 - padding.right, height - size * 0.5 - padding.bottom, size / 2)
));
areas.push(new CircleActionArea(KEY(0),
new Circle(width - size * 0.5 - padding.right, height - size * 0.5 - padding.bottom, size / 2)));
// key 1
areas.push(new CircleActionArea(
KEY(1),
new Circle(width - size * 0.5 - padding.right, height - size * 1.5 - padding.bottom, size / 2)
));
areas.push(new CircleActionArea(KEY(1),
new Circle(width - size * 0.5 - padding.right, height - size * 1.5 - padding.bottom, size / 2)));
return areas;
}
}

View File

@@ -11,7 +11,6 @@ import ru.m.tankz.proto.room.RoomProto;
import ru.m.tankz.proto.room.RoomSlotProto;
@:template class RoomFrame extends FrameView<RoomProto> {
public static inline var ID = "room";
@:view var start:ButtonView;

View File

@@ -9,7 +9,6 @@ import hw.view.list.ListView;
import ru.m.tankz.proto.room.RoomProto;
@:template class RoomItemView extends HGroupView implements IListItemView<RoomProto> {
public var item_index(default, default):Int;
public var data(default, set):RoomProto;

View File

@@ -9,7 +9,6 @@ import ru.m.tankz.network.NetworkManager;
import ru.m.tankz.proto.room.RoomSlotProto;
@:template class SlotItemView extends HGroupView implements IListItemView<RoomSlotProto> {
public var item_index(default, default):Int;
public var data(default, set):RoomSlotProto;

View File

@@ -14,7 +14,6 @@ private typedef Result = {
}
@:template class CreateGamePopup extends PopupView<Result> {
@:view("type") var typeView:DataView<GameType, ToggleButtonView>;
@:view("level") var levelView:DataView<LevelConfig, ToggleButtonView>;
@@ -30,7 +29,7 @@ private typedef Result = {
}
private function submit():Void {
close({type:type, level:level});
close({type: type, level: level});
}
private function gameTypeViewFactory(index:Int, type:GameType):ToggleButtonView {

View File

@@ -7,7 +7,6 @@ import hw.view.text.TextView;
import ru.m.tankz.network.NetworkManager;
@:singleton @:template class LoginPopup extends PopupView<User> {
@:view var username:InputView;
@:view var password:InputView;
@:view var error:TextView;
@@ -26,9 +25,12 @@ import ru.m.tankz.network.NetworkManager;
private function onStateChange(state:ConnectionState):Void {
switch state {
case ONLINE(user): close(user);
case ERROR(error): this.error.text = LoggerUtil.printError(error);
case _: this.error.text = null;
case ONLINE(user):
close(user);
case ERROR(error):
this.error.text = LoggerUtil.printError(error);
case _:
this.error.text = null;
}
}

View File

@@ -7,6 +7,4 @@ enum Action {
EXIT;
}
@:singleton @:template class PausePopup extends PopupView<Action> {
}
@:singleton @:template class PausePopup extends PopupView<Action> {}

View File

@@ -7,7 +7,6 @@ import ru.m.tankz.render.RenderUtil;
import ru.m.tankz.view.common.TankView;
@:template class FragView extends HGroupView {
@:view("tank") var tankView:TankView;
@:view("title") var titleView:LabelView;
@:view("score") var scoreView:LabelView;

View File

@@ -8,7 +8,6 @@ import ru.m.tankz.game.GameState;
import ru.m.tankz.view.common.TankView;
@:template class ResultPlayerView extends VGroupView {
@:view("player") var playerView:HGroupView;
@:view("tank") var tankView:TankView;
@:view("title") var titleView:LabelView;

View File

@@ -14,7 +14,6 @@ typedef ActionItem = {
}
@:template class ActionView extends HGroupView implements IListItemView<ActionItem> {
public var item_index(default, default):Int;
public var data(default, set):ActionItem;

View File

@@ -14,7 +14,6 @@ import ru.m.tankz.storage.SettingsStorage;
import ru.m.tankz.view.settings.ActionView;
class BindEditor {
private var editViews:Array<ActionView>;
@:provide static var bus:IControlBus;
@@ -63,8 +62,7 @@ class BindEditor {
}
@:template class SettingsEditor extends VGroupView {
public var controlIndex(default, set): Int;
public var controlIndex(default, set):Int;
@:view var label:LabelView;
@:view var list:DataView<ActionItem, ActionView>;
@@ -74,12 +72,12 @@ class BindEditor {
@:provide static var bus:IControlBus;
private function refresh():Void {
label.text = 'Player ${controlIndex+1}';
label.text = 'Player ${controlIndex + 1}';
var binding = storage.getBinding(controlIndex);
list.data = bindingToArray(binding);
}
private function set_controlIndex(value: Int): Int {
private function set_controlIndex(value:Int):Int {
this.controlIndex = value;
refresh();
return this.controlIndex;

View File

@@ -30,7 +30,6 @@ typedef PackagesBundle = {
}
class Updater {
private static inline var TAG = "Update";
public var type(get, null):PackageType;
@@ -63,11 +62,9 @@ class Updater {
public function check():Promise<Bool> {
return resolveBundle().then(function(bundle:PackagesBundle):Bool {
this.bundle = bundle;
return Lambda.exists(bundle.packages, function(item) return (
item.platform == Device.platform &&
item.type == type &&
version < Version.fromString(item.version)
));
return Lambda.exists(bundle.packages,
function(item) return (item.platform == Device.platform && item.type == type
&& version < Version.fromString(item.version)));
});
}

View File

@@ -1,17 +1,12 @@
package ru.m.update;
abstract Version(Array<Int>) {
public function new(mayor:Int, minor:Int, patch:Int, snapshot:Bool = false) {
this = [
mayor,
minor,
patch,
snapshot ? -1 : 0,
];
this = [mayor, minor, patch, snapshot ? -1 : 0,];
}
@:arrayAccess public inline function get(key:Int) return this[key];
@:arrayAccess public inline function get(key:Int)
return this[key];
public function compare(other:Version):Int {
if (other == null) {
@@ -26,21 +21,20 @@ abstract Version(Array<Int>) {
return 0;
}
@:op(A > B) static function gt(a:Version, b:Version):Bool return a.compare(b) > 0;
@:op(A > B) static function gt(a:Version, b:Version):Bool
return a.compare(b) > 0;
@:op(A == B) static function eq(a:Version, b:Version):Bool return a.compare(b) == 0;
@:op(A == B) static function eq(a:Version, b:Version):Bool
return a.compare(b) == 0;
@:op(A < B) static function lt(a:Version, b:Version):Bool return a.compare(b) < 0;
@:op(A < B) static function lt(a:Version, b:Version):Bool
return a.compare(b) < 0;
@:from public static function fromString(value:String):Version {
var r = ~/(\d+)\.(\d+)\.(\d+)(-SNAPSHOT)?/;
return if (r.match(value)) {
new Version(
Std.parseInt(r.matched(1)),
Std.parseInt(r.matched(2)),
Std.parseInt(r.matched(3)),
r.matched(4) != null
);
new Version(Std.parseInt(r.matched(1)), Std.parseInt(r.matched(2)), Std.parseInt(r.matched(3)),
r.matched(4) != null);
} else {
new Version(0, 0, 0);
}

View File

@@ -7,9 +7,7 @@ class Base64 {
private inline static var BASE64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
private static var codec:BaseCode;
public function new() {
}
public function new() {}
static function getCodec():BaseCode {
if (codec == null) {
@@ -20,7 +18,7 @@ class Base64 {
}
public static function encodeBase64(content:haxe.io.Bytes):String {
var suffix = switch (content.length % 3){
var suffix = switch (content.length % 3) {
case 2: "=";
case 1: "==";
default: "";
@@ -45,5 +43,4 @@ class Base64 {
var bytes:Bytes = Bytes.ofString(removeNullbits(content));
return getCodec().decodeBytes(bytes);
}
}

View File

@@ -1,13 +1,11 @@
package ru.m;
#if neko
import haxe.Log;
import haxe.PosInfos;
import neko.vm.Thread;
class Timer {
private var sleep:Float;
private var stopped:Bool;
@@ -32,7 +30,7 @@ class Timer {
public dynamic function run() {}
public static function delay(f:Void -> Void, time_ms:Int) {
public static function delay(f:Void->Void, time_ms:Int) {
var t = new Timer(time_ms);
t.run = function() {
t.stop();
@@ -41,7 +39,7 @@ class Timer {
return t;
}
public static function measure<T>(f:Void -> T, ?pos:PosInfos):T {
public static function measure<T>(f:Void->T, ?pos:PosInfos):T {
var t0 = stamp();
var r = f();
Log.trace((stamp() - t0) + "s", pos);
@@ -52,9 +50,6 @@ class Timer {
return Sys.time();
}
}
#else
typedef Timer = haxe.Timer;
#end

View File

@@ -7,7 +7,6 @@ import haxe.io.BytesInput;
import protohx.Message;
class PacketQueue<P:Message> {
public var packetClass(default, null):Class<P>;
private var buffer:BytesBuffer;

View File

@@ -5,7 +5,6 @@ import haxe.io.BytesOutput;
import protohx.Message;
class PacketUtil {
public static function fromBytes<P:Message>(bytes:Bytes, factory:Class<P>):P {
var packet:P = Type.createInstance(factory, []);
packet.mergeFrom(bytes);

View File

@@ -3,15 +3,13 @@ package ru.m.connect;
import haxe.io.BytesOutput;
import protohx.Message;
class WebSocketTools {
public static function packet2string(packet:Message):String {
var b = new BytesOutput();
packet.writeTo(b);
var data = b.getBytes();
var res = new BytesOutput();
//res.writeUInt16(data.length);
// res.writeUInt16(data.length);
res.write(data);
return Base64.encodeBase64(res.getBytes());
}

View File

@@ -10,7 +10,6 @@ import sys.net.Host;
import sys.net.Socket;
class DesktopConnection<O:Message, I:Message> extends BaseConnection<O, I> {
private var host:String;
private var port:Int;
private var socket:Socket;

View File

@@ -5,7 +5,6 @@ import promhx.Promise;
import protohx.Message;
class FakeConnection<O:Message, I:Message> extends BaseConnection<O, I> {
override public function connect():Promise<IConnection<O, I>> {
handler.emit(ConnectionEvent.CONNECTED);
var promise:Promise<IConnection<O, I>> = cast Promise.promise(this);

View File

@@ -14,7 +14,6 @@ import protohx.Message;
import ru.m.connect.IConnection;
class FlashConnection<O:Message, I:Message> extends BaseConnection<O, I> {
private var host:String;
private var port:Int;
private var socket:Socket;

View File

@@ -10,7 +10,6 @@ import protohx.Message;
import ru.m.connect.IConnection;
class JsConnection<O:Message, I:Message> extends BaseConnection<O, I> {
private var host:String;
private var port:Int;
private var socket:WebSocket;

Some files were not shown because too many files have changed in this diff Show More