mirror of
https://github.com/MapMakersAndProgrammers/TankiOnline2.0DemoClient.git
synced 2025-10-27 02:19:07 -07:00
Initial commit
This commit is contained in:
133
src/package_42/name_177.as
Normal file
133
src/package_42/name_177.as
Normal file
@@ -0,0 +1,133 @@
|
||||
package package_42
|
||||
{
|
||||
import package_10.class_1;
|
||||
import package_10.name_17;
|
||||
|
||||
public class name_177 extends class_1 implements name_184
|
||||
{
|
||||
private var var_214:Vector.<name_477>;
|
||||
|
||||
private var var_215:int;
|
||||
|
||||
private var running:Boolean;
|
||||
|
||||
private var gameKernel:name_17;
|
||||
|
||||
public function name_177(priority:int, gameKernel:name_17)
|
||||
{
|
||||
super(priority);
|
||||
this.gameKernel = gameKernel;
|
||||
this.var_214 = new Vector.<name_477>();
|
||||
}
|
||||
|
||||
public function addLogicUnit(logicUnit:name_477) : void
|
||||
{
|
||||
var actionAddUnit:ActionAddUnit = null;
|
||||
if(this.running)
|
||||
{
|
||||
actionAddUnit = ActionAddUnit(this.gameKernel.method_108().name_110(ActionAddUnit));
|
||||
this.method_329(actionAddUnit,logicUnit);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(this.var_214.indexOf(logicUnit) >= 0)
|
||||
{
|
||||
throw new Error("Logic unit already exists");
|
||||
}
|
||||
var _loc3_:* = this.var_215++;
|
||||
this.var_214[_loc3_] = logicUnit;
|
||||
}
|
||||
}
|
||||
|
||||
public function removeLogicUnit(logicUnit:name_477) : void
|
||||
{
|
||||
var actionRemoveUnit:ActionRemoveUnit = null;
|
||||
var index:int = 0;
|
||||
if(this.running)
|
||||
{
|
||||
actionRemoveUnit = ActionRemoveUnit(this.gameKernel.method_108().name_110(ActionRemoveUnit));
|
||||
this.method_329(actionRemoveUnit,logicUnit);
|
||||
}
|
||||
else
|
||||
{
|
||||
index = int(this.var_214.indexOf(logicUnit));
|
||||
if(index < 0)
|
||||
{
|
||||
throw new Error("Logic unit not found");
|
||||
}
|
||||
this.var_214[index] = this.var_214[--this.var_215];
|
||||
this.var_214[this.var_215] = null;
|
||||
}
|
||||
}
|
||||
|
||||
override public function run() : void
|
||||
{
|
||||
this.running = true;
|
||||
for(var i:int = 0; i < this.var_215; i++)
|
||||
{
|
||||
this.var_214[i].runLogic();
|
||||
}
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
private function method_329(action:DeferredAction, unit:name_477) : void
|
||||
{
|
||||
action.system = this;
|
||||
action.unit = unit;
|
||||
this.gameKernel.method_111(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
import package_26.class_18;
|
||||
import package_26.name_402;
|
||||
import package_43.name_190;
|
||||
|
||||
class DeferredAction extends name_190
|
||||
{
|
||||
public var system:name_184;
|
||||
|
||||
public var unit:name_477;
|
||||
|
||||
public function DeferredAction(objectPool:name_402)
|
||||
{
|
||||
super(objectPool);
|
||||
}
|
||||
|
||||
override public function execute() : void
|
||||
{
|
||||
this.doExecute();
|
||||
this.system = null;
|
||||
this.unit = null;
|
||||
}
|
||||
|
||||
protected function doExecute() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class ActionAddUnit extends DeferredAction
|
||||
{
|
||||
public function ActionAddUnit(objectPool:name_402)
|
||||
{
|
||||
super(objectPool);
|
||||
}
|
||||
|
||||
override protected function doExecute() : void
|
||||
{
|
||||
system.addLogicUnit(unit);
|
||||
}
|
||||
}
|
||||
|
||||
class ActionRemoveUnit extends DeferredAction
|
||||
{
|
||||
public function ActionRemoveUnit(objectPool:name_402)
|
||||
{
|
||||
super(objectPool);
|
||||
}
|
||||
|
||||
override protected function doExecute() : void
|
||||
{
|
||||
system.removeLogicUnit(unit);
|
||||
}
|
||||
}
|
||||
10
src/package_42/name_184.as
Normal file
10
src/package_42/name_184.as
Normal file
@@ -0,0 +1,10 @@
|
||||
package package_42
|
||||
{
|
||||
public interface name_184
|
||||
{
|
||||
function addLogicUnit(param1:name_477) : void;
|
||||
|
||||
function removeLogicUnit(param1:name_477) : void;
|
||||
}
|
||||
}
|
||||
|
||||
8
src/package_42/name_477.as
Normal file
8
src/package_42/name_477.as
Normal file
@@ -0,0 +1,8 @@
|
||||
package package_42
|
||||
{
|
||||
public interface name_477
|
||||
{
|
||||
function runLogic() : void;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user