refactor: update dependencies

This commit is contained in:
2023-01-01 13:33:34 +03:00
parent ee846f6219
commit 1cfc98dd57
9 changed files with 4897 additions and 3493 deletions

View File

@@ -1,9 +1,13 @@
package ru.m.tankz;
import ru.m.animate.AnimateManager;
import flash.Lib;
import haxework.animate.Animate;
import haxework.log.TraceLogger;
import haxework.net.manage.LoaderManager;
import haxework.view.Root;
import haxework.view.popup.PopupManager;
import ru.m.tankz.storage.GameStorage;
import ru.m.tankz.storage.SettingsStorage;
import ru.m.tankz.view.ClientView;
@@ -20,6 +24,12 @@ class Client {
#if debug
//L.push(new haxework.log.SocketLogger());
#end
// ToDo: fix @:provide macro
PopupManager;
LoaderManager;
GameStorage;
AnimateManager;
//
Const.init();
Init.init();
Animate.bind(Lib.current.stage);

View File

@@ -41,10 +41,10 @@ using ru.m.tankz.view.ViewUtil;
super.onShow(data);
appUpdater.check().then(function(update:Bool) {
updateButton.visible = update;
if (update) {
updateButton.text = 'Update ${appUpdater.bundle.version}';
}
});
if (update) {
updateButton.text = 'Update ${appUpdater.bundle.version}';
}
}).catchError(function(error) {});
var list = levelBundle.list();
list.sort(function(a:PackId, b:PackId) return a.toPackLabel() > b.toPackLabel() ? 1 : -1);
packs.data = list;

View File

@@ -18,8 +18,7 @@ import ru.m.tankz.game.GameEvent;
import ru.m.tankz.game.GameState;
import ru.m.tankz.game.Spawner;
import ru.m.tankz.Type;
using ru.m.tankz.game.GameUtil;
import ru.m.tankz.game.GameUtil;
class GameRunner extends Game implements EngineListener {
private var updater:ICaller;
@@ -116,7 +115,7 @@ class GameRunner extends Game implements EngineListener {
engine.spawn(tank);
gameEventSignal.emit(EventUtil.buildTankSpawn(tank));
if (player.config.protect > 0) {
protectTank(tank, player.config.protect);
GameUtil.protectTank(this, tank, player.config.protect);
}
}
@@ -169,13 +168,13 @@ class GameRunner extends Game implements EngineListener {
switch [entity, with] {
case [TANK(tank), TANK(other_tank)]:
tank.rect.lean(other_tank.rect);
emitTankMove(tank);
GameUtil.emitTankMove(this, tank);
case [TANK(tank), EAGLE(eagle)]:
tank.rect.lean(eagle.rect);
emitTankMove(tank);
GameUtil.emitTankMove(this, tank);
case [TANK(tank), CELL(cell)]:
tank.rect.lean(cell.rect);
emitTankMove(tank);
GameUtil.emitTankMove(this, tank);
case [BULLET(bullet), BULLET(other_bullet)]:
if (bullet.playerId != other_bullet.playerId && bullet.layer > 0 && other_bullet.layer > 0) {
gameEventSignal.emit(DESTROY(BULLET(bullet.id)));
@@ -194,7 +193,7 @@ class GameRunner extends Game implements EngineListener {
if (!tank.protect) {
if (tank.boat) {
tank.boat = false;
emitTankChange(tank);
GameUtil.emitTankChange(this, tank);
} else if (tank.hits > 0) {
tank.hits--;
if (tank.bonus) {
@@ -202,11 +201,11 @@ class GameRunner extends Game implements EngineListener {
spawnBonus();
}
gameEventSignal.emit(HIT(TANK(tank.id, buildShot(bullet))));
emitTankChange(tank);
GameUtil.emitTankChange(this, tank);
} else if (tank.config.downgrade != null) {
tank.config = config.getTank(tank.config.downgrade);
gameEventSignal.emit(HIT(TANK(tank.id, buildShot(bullet))));
emitTankChange(tank);
GameUtil.emitTankChange(this, tank);
} else {
var score = tank.config.score;
if (score != null && tank.playerId.team == bullet.playerId.team) {
@@ -235,7 +234,7 @@ class GameRunner extends Game implements EngineListener {
public function onMove(entity:EntityType, move:Bool):Void {
switch entity {
case TANK(tank):
emitTankMove(tank, move);
GameUtil.emitTankMove(this, tank, move);
case BULLET(bullet):
gameEventSignal.emit(MOVE(BULLET(bullet.id, {x:bullet.rect.x, y:bullet.rect.y, direction:bullet.rect.direction})));
case _:
@@ -328,7 +327,7 @@ class GameRunner extends Game implements EngineListener {
});
if (shot.score != null) {
var tank:Tank = engine.getEntity(shot.tankId);
changeScore(tank.playerId, shot.score);
GameUtil.changeScore(this, tank.playerId, shot.score);
}
checkComplete();
case DESTROY(TANK(id, shot)):
@@ -338,9 +337,9 @@ class GameRunner extends Game implements EngineListener {
player.tankId = -1;
team.onDestroy(player.id);
if (player.state.life > 0) {
changeLife(player.id, -1);
GameUtil.changeLife(this, player.id, -1);
} else if (team.state.life > 0) {
changeTeamLife(team.id, -1);
GameUtil.changeTeamLife(this, team.id, -1);
}
var respawn:Bool = team.tryRespawn(player.id);
if (respawn) {
@@ -359,7 +358,7 @@ class GameRunner extends Game implements EngineListener {
score: shot.score,
});
if (shot.score != null) {
changeScore(shooter.id, shot.score);
GameUtil.changeScore(this, shooter.id, shot.score);
}
engine.destroy(id);
case DESTROY(BONUS(id, shot)):
@@ -373,7 +372,7 @@ class GameRunner extends Game implements EngineListener {
score: shot.score,
});
if (shot.score != null) {
changeScore(tank.playerId, shot.score);
GameUtil.changeScore(this, tank.playerId, shot.score);
}
engine.destroy(id);
case DESTROY(BULLET(id)):

View File

@@ -1,9 +1,12 @@
package ru.m.tankz.editor;
import haxework.net.manage.LoaderManager;
import haxework.resources.IResources;
import haxework.view.frame.FrameSwitcher;
import haxework.view.Root;
import haxework.view.frame.FrameSwitcher;
import haxework.view.popup.PopupManager;
import haxework.view.theme.ITheme;
import ru.m.animate.AnimateManager;
import ru.m.tankz.bundle.CachedLevelBundle;
import ru.m.tankz.bundle.ClientLevelSource;
import ru.m.tankz.bundle.ConfigBundle;
@@ -11,6 +14,7 @@ import ru.m.tankz.bundle.IConfigBundle;
import ru.m.tankz.bundle.ILevelBundle;
import ru.m.tankz.editor.view.EditorView;
import ru.m.tankz.editor.view.PackListFrame;
import ru.m.tankz.storage.GameStorage;
class Editor {
private static inline var TAG = "Editor";
@@ -29,6 +33,12 @@ class Editor {
#if debug
//L.push(new haxework.log.SocketLogger());
#end
// ToDo: fix @:provide macro
PopupManager;
LoaderManager;
GameStorage;
AnimateManager;
//
Const.init();
L.d(TAG, 'Debug: ${Const.DEBUG}');
L.i(TAG, 'Version: ${Const.VERSION}');