mirror of
https://github.com/MapMakersAndProgrammers/TankiOnline2.0DemoClient.git
synced 2025-10-26 09:59:07 -07:00
package_15 alternativa.utils
This commit is contained in:
@@ -16,7 +16,7 @@ package alternativa
|
||||
import package_106.name_367;
|
||||
import package_107.name_362;
|
||||
import package_107.name_369;
|
||||
import package_15.name_19;
|
||||
import alternativa.utils.Properties;
|
||||
import package_31.name_366;
|
||||
import package_39.name_160;
|
||||
import package_39.name_368;
|
||||
@@ -45,7 +45,7 @@ package alternativa
|
||||
super();
|
||||
}
|
||||
|
||||
public function start(rootContainer:DisplayObjectContainer, urlParams:name_19, libraryInfos:Vector.<LibraryInfo>, connectionParameters:ConnectionParameters, startupLogStrings:Vector.<String>) : void
|
||||
public function start(rootContainer:DisplayObjectContainer, urlParams:Properties, libraryInfos:Vector.<LibraryInfo>, connectionParameters:ConnectionParameters, startupLogStrings:Vector.<String>) : void
|
||||
{
|
||||
var libraryInfo:LibraryInfo = null;
|
||||
this.osgi = OSGi.name_8();
|
||||
@@ -66,7 +66,7 @@ package alternativa
|
||||
}
|
||||
}
|
||||
|
||||
private function initClientLog(urlParams:name_19, startupLogStrings:Vector.<String>) : void
|
||||
private function initClientLog(urlParams:Properties, startupLogStrings:Vector.<String>) : void
|
||||
{
|
||||
var s:String = null;
|
||||
var logChannelBufferSize:int = int(int(urlParams.method_25("log_channel_buffer_size","1000")));
|
||||
@@ -79,7 +79,7 @@ package alternativa
|
||||
}
|
||||
}
|
||||
|
||||
private function initConsole(stage:Stage, urlParams:name_19) : void
|
||||
private function initConsole(stage:Stage, urlParams:Properties) : void
|
||||
{
|
||||
var channelName:String = null;
|
||||
this.console = new Console(stage,50,100,1,1);
|
||||
|
||||
@@ -14,9 +14,9 @@ package alternativa.osgi.service.console
|
||||
import flash.ui.Keyboard;
|
||||
import flash.utils.setTimeout;
|
||||
import alternativa.osgi.service.console.variables.ConsoleVar;
|
||||
import package_15.name_632;
|
||||
import package_15.name_634;
|
||||
import package_15.name_635;
|
||||
import alternativa.utils.IStringBufferIterator;
|
||||
import alternativa.utils.CircularStringBuffer;
|
||||
import alternativa.utils.ICircularStringBuffer;
|
||||
|
||||
public class Console implements IConsole
|
||||
{
|
||||
@@ -66,7 +66,7 @@ package alternativa.osgi.service.console
|
||||
|
||||
private var var_530:int;
|
||||
|
||||
private var buffer:name_635;
|
||||
private var buffer:ICircularStringBuffer;
|
||||
|
||||
private var var_535:int;
|
||||
|
||||
@@ -86,7 +86,7 @@ package alternativa.osgi.service.console
|
||||
{
|
||||
super();
|
||||
this.stage = stage;
|
||||
this.buffer = new name_634(1000);
|
||||
this.buffer = new CircularStringBuffer(1000);
|
||||
this.calcTextMetrics(stage);
|
||||
this.initInput();
|
||||
this.initOutput();
|
||||
@@ -431,7 +431,7 @@ package alternativa.osgi.service.console
|
||||
private function printPage() : void
|
||||
{
|
||||
var pageLineIndex:int = 0;
|
||||
var iterator:name_632 = this.buffer.name_633(this.var_530);
|
||||
var iterator:IStringBufferIterator = this.buffer.name_633(this.var_530);
|
||||
while(pageLineIndex < this.var_529 && Boolean(iterator.hasNext()))
|
||||
{
|
||||
TextField(this.var_532[pageLineIndex++]).text = iterator.getNext();
|
||||
@@ -659,7 +659,7 @@ package alternativa.osgi.service.console
|
||||
|
||||
private function copyConsoleContent(console:IConsole, params:Array) : void
|
||||
{
|
||||
var iterator:name_632 = this.buffer.name_633(0);
|
||||
var iterator:IStringBufferIterator = this.buffer.name_633(0);
|
||||
var result:String = "Console content:\n";
|
||||
while(iterator.hasNext())
|
||||
{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package alternativa.startup
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import package_15.name_19;
|
||||
import alternativa.utils.Properties;
|
||||
|
||||
public interface IClientConfigurator
|
||||
{
|
||||
function start(param1:DisplayObjectContainer, param2:name_19, param3:Vector.<LibraryInfo>, param4:ConnectionParameters, param5:Vector.<String>) : void;
|
||||
function start(param1:DisplayObjectContainer, param2:Properties, param3:Vector.<LibraryInfo>, param4:ConnectionParameters, param5:Vector.<String>) : void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package alternativa.startup
|
||||
{
|
||||
import flash.display.Loader;
|
||||
import package_15.name_19;
|
||||
import alternativa.utils.Properties;
|
||||
|
||||
public class LibraryInfo
|
||||
{
|
||||
@@ -11,13 +11,13 @@ package alternativa.startup
|
||||
|
||||
public var resourceVersion:String;
|
||||
|
||||
public var manifestProperties:name_19;
|
||||
public var manifestProperties:Properties;
|
||||
|
||||
public var loader:Loader;
|
||||
|
||||
public var size:int;
|
||||
|
||||
public function LibraryInfo(name:String, resourceId:String, resourceVersion:String, manifestProperties:name_19, size:int)
|
||||
public function LibraryInfo(name:String, resourceId:String, resourceVersion:String, manifestProperties:Properties, size:int)
|
||||
{
|
||||
super();
|
||||
this.name = name;
|
||||
|
||||
@@ -7,7 +7,7 @@ package alternativa.tanks
|
||||
import alternativa.tanks.config.Config;
|
||||
import alternativa.tanks.config.BlobGroup;
|
||||
import alternativa.tanks.config.BlobCategory;
|
||||
import package_15.name_55;
|
||||
import alternativa.utils.ByteArrayMap;
|
||||
import package_18.name_44;
|
||||
import package_19.name_53;
|
||||
import alternativa.tanks.game.entities.map.A3DMapComponent;
|
||||
@@ -49,13 +49,13 @@ package alternativa.tanks
|
||||
|
||||
private function createMapEntity() : Entity
|
||||
{
|
||||
var _loc2_:name_55 = null;
|
||||
var _loc2_:ByteArrayMap = null;
|
||||
var _loc6_:BlobGroup = null;
|
||||
var _loc7_:String = null;
|
||||
var _loc3_:BlobCategory = this.config.name_68.name_72("skybox");
|
||||
if(_loc3_ != null)
|
||||
{
|
||||
_loc2_ = new name_55();
|
||||
_loc2_ = new ByteArrayMap();
|
||||
_loc6_ = _loc3_.name_62(this.config.name_67());
|
||||
for each(_loc7_ in [name_53.BACK,name_53.BOTTOM,name_53.FRONT,name_53.LEFT,name_53.RIGHT,name_53.TOP])
|
||||
{
|
||||
|
||||
@@ -14,8 +14,8 @@ package alternativa.tanks
|
||||
import alternativa.tanks.game.GameEvents;
|
||||
import alternativa.tanks.game.weapons.ammunition.plasma.PlasmaRoundEffectsFactory;
|
||||
import alternativa.tanks.config.Config;
|
||||
import package_15.name_275;
|
||||
import package_15.name_55;
|
||||
import alternativa.utils.ColorUtils;
|
||||
import alternativa.utils.ByteArrayMap;
|
||||
import package_18.name_102;
|
||||
import package_18.name_44;
|
||||
import alternativa.tanks.game.subsystems.eventsystem.IGameEventListener;
|
||||
@@ -348,7 +348,7 @@ package alternativa.tanks
|
||||
|
||||
private function createRandomBattleMessage() : void
|
||||
{
|
||||
this.var_71.name_305("Message: " + Math.random(),name_275.random());
|
||||
this.var_71.name_305("Message: " + Math.random(),ColorUtils.random());
|
||||
}
|
||||
|
||||
private function controlKeyPressed() : Boolean
|
||||
@@ -704,7 +704,7 @@ package alternativa.tanks
|
||||
|
||||
private function createTracksMaterial(param1:name_249) : TracksMaterial2
|
||||
{
|
||||
var _loc2_:name_55 = param1.textureData;
|
||||
var _loc2_:ByteArrayMap = param1.textureData;
|
||||
var _loc3_:name_241 = this.var_65.name_254(_loc2_.name_248(name_243.KEY_TRACKS_DIFFUSE));
|
||||
var _loc4_:name_241 = this.var_65.name_254(_loc2_.name_248(name_243.KEY_TRACKS_NORMAL));
|
||||
var _loc5_:TracksMaterial2 = new TracksMaterial2();
|
||||
@@ -722,7 +722,7 @@ package alternativa.tanks
|
||||
private function createShadowMaterial(param1:name_249) : GiShadowMaterial
|
||||
{
|
||||
var _loc3_:name_241 = null;
|
||||
var _loc2_:name_55 = param1.textureData;
|
||||
var _loc2_:ByteArrayMap = param1.textureData;
|
||||
if(_loc2_.name_248(name_243.KEY_SHADOW) != null)
|
||||
{
|
||||
_loc3_ = this.var_65.name_254(_loc2_.name_248(name_243.KEY_SHADOW));
|
||||
@@ -943,7 +943,7 @@ package alternativa.tanks
|
||||
var _loc15_:name_249 = null;
|
||||
var _loc16_:name_318 = null;
|
||||
var _loc6_:name_44 = this.gameKernel.name_5();
|
||||
var _loc7_:name_55 = param1.textureData;
|
||||
var _loc7_:ByteArrayMap = param1.textureData;
|
||||
var _loc8_:name_241 = this.var_65.name_254(_loc7_.name_248(name_258.KEY_DIFFUSE_MAP));
|
||||
var _loc9_:name_241 = this.var_65.name_254(_loc7_.name_248(name_258.KEY_NORMAL_MAP));
|
||||
var _loc10_:name_241 = this.var_65.name_254(_loc7_.name_248(name_258.KEY_SURFACE_MAP));
|
||||
@@ -1165,7 +1165,7 @@ import flash.utils.ByteArray;
|
||||
import alternativa.tanks.game.GameKernel;
|
||||
import package_101.name_304;
|
||||
import alternativa.tanks.config.TextureLibrary;
|
||||
import package_15.name_275;
|
||||
import alternativa.utils.ColorUtils;
|
||||
import package_18.name_44;
|
||||
import package_28.name_129;
|
||||
import package_28.name_241;
|
||||
@@ -1248,7 +1248,7 @@ class PointHitRoundAmmo implements IGenericAmmunition
|
||||
while(_loc4_ < 20)
|
||||
{
|
||||
_loc5_ = 255 - 255 / (20 - 1) * _loc4_;
|
||||
_loc2_.push(new name_313(name_275.name_345(_loc5_,_loc5_,_loc5_),_loc5_ / 255 + 0.5));
|
||||
_loc2_.push(new name_313(ColorUtils.name_345(_loc5_,_loc5_,_loc5_),_loc5_ / 255 + 0.5));
|
||||
_loc4_++;
|
||||
}
|
||||
this.weaponHitEffects = new WeaponHitEffects(null,_loc2_,param1);
|
||||
|
||||
@@ -3,7 +3,7 @@ package alternativa.tanks.config
|
||||
import flash.events.Event;
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.utils.ByteArray;
|
||||
import package_15.name_55;
|
||||
import alternativa.utils.ByteArrayMap;
|
||||
import package_40.class_7;
|
||||
import package_40.name_169;
|
||||
import package_40.name_170;
|
||||
@@ -14,7 +14,7 @@ package alternativa.tanks.config
|
||||
[Event(name="complete",type="flash.events.Event")]
|
||||
public class Config extends EventDispatcher
|
||||
{
|
||||
public var mapData:name_55;
|
||||
public var mapData:ByteArrayMap;
|
||||
|
||||
public var var_37:TextureLibrary;
|
||||
|
||||
@@ -114,7 +114,7 @@ package alternativa.tanks.config
|
||||
private function setMapData(param1:ByteArray) : void
|
||||
{
|
||||
var _loc2_:name_171 = new name_171(param1);
|
||||
this.mapData = new name_55(_loc2_.data);
|
||||
this.mapData = new ByteArrayMap(_loc2_.data);
|
||||
}
|
||||
|
||||
private function parseOptions() : void
|
||||
|
||||
@@ -3,7 +3,7 @@ package alternativa.tanks.game.camera
|
||||
import flash.geom.Vector3D;
|
||||
import alternativa.tanks.game.ObjectController;
|
||||
import alternativa.tanks.game.Entity;
|
||||
import package_15.name_191;
|
||||
import alternativa.utils.KeyboardUtils;
|
||||
import package_18.name_102;
|
||||
import package_18.name_90;
|
||||
import package_21.name_78;
|
||||
@@ -20,19 +20,19 @@ package alternativa.tanks.game.camera
|
||||
|
||||
public static var targeted:Boolean = false;
|
||||
|
||||
private static const KEY_FORWARD:int = name_191.W;
|
||||
private static const KEY_FORWARD:int = KeyboardUtils.W;
|
||||
|
||||
private static const KEY_BACK:int = name_191.S;
|
||||
private static const KEY_BACK:int = KeyboardUtils.S;
|
||||
|
||||
private static const KEY_LEFT:int = name_191.A;
|
||||
private static const KEY_LEFT:int = KeyboardUtils.A;
|
||||
|
||||
private static const KEY_RIGHT:int = name_191.D;
|
||||
private static const KEY_RIGHT:int = KeyboardUtils.D;
|
||||
|
||||
private static const KEY_UP:int = name_191.E;
|
||||
private static const KEY_UP:int = KeyboardUtils.E;
|
||||
|
||||
private static const KEY_DOWN:int = name_191.C;
|
||||
private static const KEY_DOWN:int = KeyboardUtils.C;
|
||||
|
||||
private static const KEY_SPEED:int = name_191.SHIFT;
|
||||
private static const KEY_SPEED:int = KeyboardUtils.SHIFT;
|
||||
|
||||
private static var matrix:Matrix3 = new Matrix3();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ package alternativa.tanks.game.entities.map
|
||||
import package_116.name_529;
|
||||
import package_116.name_530;
|
||||
import package_116.name_641;
|
||||
import package_15.name_55;
|
||||
import alternativa.utils.ByteArrayMap;
|
||||
import package_19.name_117;
|
||||
import package_19.name_380;
|
||||
import package_19.name_91;
|
||||
@@ -60,7 +60,7 @@ package alternativa.tanks.game.entities.map
|
||||
|
||||
private var var_570:name_170;
|
||||
|
||||
private var mapFiles:name_55;
|
||||
private var mapFiles:ByteArrayMap;
|
||||
|
||||
private var collector:Vector.<name_78>;
|
||||
|
||||
@@ -91,7 +91,7 @@ package alternativa.tanks.game.entities.map
|
||||
return this.var_406;
|
||||
}
|
||||
|
||||
public function name_385(mapFiles:name_55) : void
|
||||
public function name_385(mapFiles:ByteArrayMap) : void
|
||||
{
|
||||
var geometryFileName:String = null;
|
||||
this.mapFiles = mapFiles;
|
||||
@@ -238,7 +238,7 @@ package alternativa.tanks.game.entities.map
|
||||
}
|
||||
}
|
||||
|
||||
private function getMapGeometryFiles(mapFiles:name_55) : Vector.<String>
|
||||
private function getMapGeometryFiles(mapFiles:ByteArrayMap) : Vector.<String>
|
||||
{
|
||||
var name:String = null;
|
||||
var names:Vector.<String> = new Vector.<String>();
|
||||
@@ -355,7 +355,7 @@ package alternativa.tanks.game.entities.map
|
||||
}
|
||||
}
|
||||
|
||||
private function getCompressedTextureResource(fileTextureResource:name_167, resourceCache:Object, mapFiles:name_55) : name_241
|
||||
private function getCompressedTextureResource(fileTextureResource:name_167, resourceCache:Object, mapFiles:ByteArrayMap) : name_241
|
||||
{
|
||||
var textureName:String = null;
|
||||
var resource:name_241 = null;
|
||||
|
||||
@@ -11,7 +11,7 @@ package alternativa.tanks.game.entities.map
|
||||
import package_109.name_377;
|
||||
import package_109.name_378;
|
||||
import package_109.name_381;
|
||||
import package_15.name_55;
|
||||
import alternativa.utils.ByteArrayMap;
|
||||
import package_18.name_44;
|
||||
import package_18.name_79;
|
||||
import package_18.name_89;
|
||||
@@ -47,9 +47,9 @@ package alternativa.tanks.game.entities.map
|
||||
{
|
||||
public static const PHYSICS_GEOMETRY:String = "physicsGeometry";
|
||||
|
||||
private var files:name_55;
|
||||
private var files:ByteArrayMap;
|
||||
|
||||
private var skyboxFiles:name_55;
|
||||
private var skyboxFiles:ByteArrayMap;
|
||||
|
||||
private var skyboxSize:Number;
|
||||
|
||||
@@ -63,7 +63,7 @@ package alternativa.tanks.game.entities.map
|
||||
|
||||
private var var_91:Boolean = true;
|
||||
|
||||
public function A3DMapComponent(files:name_55, skyboxFiles:name_55, skyboxSize:Number, listener:IA3DMapComponentListener)
|
||||
public function A3DMapComponent(files:ByteArrayMap, skyboxFiles:ByteArrayMap, skyboxSize:Number, listener:IA3DMapComponentListener)
|
||||
{
|
||||
super();
|
||||
this.files = files;
|
||||
|
||||
31
src/alternativa/utils/ByteArrayMap.as
Normal file
31
src/alternativa/utils/ByteArrayMap.as
Normal file
@@ -0,0 +1,31 @@
|
||||
package alternativa.utils
|
||||
{
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
public class ByteArrayMap
|
||||
{
|
||||
private var var_102:Object;
|
||||
|
||||
public function ByteArrayMap(data:Object = null)
|
||||
{
|
||||
super();
|
||||
this.var_102 = data == null ? {} : data;
|
||||
}
|
||||
|
||||
public function get data() : Object
|
||||
{
|
||||
return this.var_102;
|
||||
}
|
||||
|
||||
public function name_248(key:String) : ByteArray
|
||||
{
|
||||
return this.var_102[key];
|
||||
}
|
||||
|
||||
public function name_59(key:String, value:ByteArray) : void
|
||||
{
|
||||
this.var_102[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
128
src/alternativa/utils/CircularStringBuffer.as
Normal file
128
src/alternativa/utils/CircularStringBuffer.as
Normal file
@@ -0,0 +1,128 @@
|
||||
package alternativa.utils
|
||||
{
|
||||
public class CircularStringBuffer implements ICircularStringBuffer
|
||||
{
|
||||
public var strings:Vector.<String>;
|
||||
|
||||
public var var_665:int;
|
||||
|
||||
public var var_664:int;
|
||||
|
||||
private var var_666:int;
|
||||
|
||||
public function CircularStringBuffer(capacity:int)
|
||||
{
|
||||
super();
|
||||
this.var_666 = capacity;
|
||||
this.strings = new Vector.<String>(this.var_666 + 1);
|
||||
}
|
||||
|
||||
public function add(s:String) : void
|
||||
{
|
||||
this.strings[this.var_664] = s;
|
||||
this.var_664 = this.incIndex(this.var_664);
|
||||
if(this.var_664 == this.var_665)
|
||||
{
|
||||
this.var_665 = this.incIndex(this.var_665);
|
||||
}
|
||||
}
|
||||
|
||||
public function clear() : void
|
||||
{
|
||||
this.var_665 = 0;
|
||||
this.var_664 = 0;
|
||||
var len:int = int(this.strings.length);
|
||||
for(var i:int = 0; i < len; i++)
|
||||
{
|
||||
this.strings[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function get size() : int
|
||||
{
|
||||
var result:int = this.var_664 - this.var_665;
|
||||
if(result < 0)
|
||||
{
|
||||
result += this.strings.length;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public function get capacity() : int
|
||||
{
|
||||
return this.var_666;
|
||||
}
|
||||
|
||||
public function name_638() : Vector.<String>
|
||||
{
|
||||
var result:Vector.<String> = new Vector.<String>();
|
||||
for(var i:int = this.var_665; i != this.var_664; i = this.incIndex(i))
|
||||
{
|
||||
result.push(this.strings[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public function set capacity(value:int) : void
|
||||
{
|
||||
throw new Error("Unimplemented");
|
||||
}
|
||||
|
||||
public function name_633(startIndex:int) : IStringBufferIterator
|
||||
{
|
||||
return new Iterator(this,startIndex);
|
||||
}
|
||||
|
||||
private function incIndex(index:int) : int
|
||||
{
|
||||
return ++index >= this.strings.length ? 0 : index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Iterator implements IStringBufferIterator
|
||||
{
|
||||
private var buffer:CircularStringBuffer;
|
||||
|
||||
private var index:int;
|
||||
|
||||
public function Iterator(buffer:CircularStringBuffer, startIndex:int)
|
||||
{
|
||||
super();
|
||||
if(startIndex < 0 || startIndex > buffer.size)
|
||||
{
|
||||
throw new Error("Index " + startIndex + " is out of range [0, " + buffer.size + "]");
|
||||
}
|
||||
this.buffer = buffer;
|
||||
var bufferLength:uint = uint(buffer.strings.length);
|
||||
this.index = buffer.var_665 + startIndex - 1;
|
||||
if(this.index < 0)
|
||||
{
|
||||
this.index = bufferLength - 1;
|
||||
}
|
||||
if(this.index >= bufferLength)
|
||||
{
|
||||
this.index -= bufferLength;
|
||||
}
|
||||
}
|
||||
|
||||
public function hasNext() : Boolean
|
||||
{
|
||||
return this.incIndex(this.index) != this.buffer.var_664;
|
||||
}
|
||||
|
||||
public function getNext() : String
|
||||
{
|
||||
this.index = this.incIndex(this.index);
|
||||
if(this.index == this.buffer.var_664)
|
||||
{
|
||||
throw new Error("End of buffer");
|
||||
}
|
||||
return this.buffer.strings[this.index];
|
||||
}
|
||||
|
||||
private function incIndex(index:int) : int
|
||||
{
|
||||
return ++index >= this.buffer.strings.length ? 0 : index;
|
||||
}
|
||||
}
|
||||
121
src/alternativa/utils/ColorUtils.as
Normal file
121
src/alternativa/utils/ColorUtils.as
Normal file
@@ -0,0 +1,121 @@
|
||||
package alternativa.utils
|
||||
{
|
||||
import flash.geom.ColorTransform;
|
||||
|
||||
public class ColorUtils
|
||||
{
|
||||
public static const BLACK:uint = 0;
|
||||
|
||||
public static const RED:uint = 8323072;
|
||||
|
||||
public static const GREEN:uint = 32512;
|
||||
|
||||
public static const BLUE:uint = 127;
|
||||
|
||||
public static const BROWN:uint = 8355584;
|
||||
|
||||
public static const CYAN:uint = 32639;
|
||||
|
||||
public static const MAGENTA:uint = 8323199;
|
||||
|
||||
public static const GRAY:uint = 8355711;
|
||||
|
||||
public static const LIGHT_RED:uint = 16711680;
|
||||
|
||||
public static const LIGHT_GREEN:uint = 65280;
|
||||
|
||||
public static const LIGHT_BLUE:uint = 255;
|
||||
|
||||
public static const YELLOW:uint = 16776960;
|
||||
|
||||
public static const LIGHT_CYAN:uint = 65535;
|
||||
|
||||
public static const LIGHT_MAGENTA:uint = 16711935;
|
||||
|
||||
public static const WHITE:uint = 16777215;
|
||||
|
||||
public function ColorUtils()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function sum(a:uint, b:uint) : uint
|
||||
{
|
||||
var red:int = (a & 0xFF0000) + (b & 0xFF0000);
|
||||
var green:int = (a & 0xFF00) + (b & 0xFF00);
|
||||
var blue:int = (a & 0xFF) + (b & 0xFF);
|
||||
return (Boolean(red >>> 24) ? 16711680 : red) + (Boolean(green >>> 16) ? 65280 : green) + (Boolean(blue >>> 8) ? 255 : blue);
|
||||
}
|
||||
|
||||
public static function difference(a:uint, b:uint) : uint
|
||||
{
|
||||
var red:int = (a & 0xFF0000) - (b & 0xFF0000);
|
||||
var green:int = (a & 0xFF00) - (b & 0xFF00);
|
||||
var blue:int = (a & 0xFF) - (b & 0xFF);
|
||||
return (red < 0 ? 0 : red) + (green < 0 ? 0 : green) + (blue < 0 ? 0 : blue);
|
||||
}
|
||||
|
||||
public static function method_552(color:uint, multiplier:Number) : uint
|
||||
{
|
||||
var red:int = ((color & 0xFF0000) >>> 16) * multiplier;
|
||||
var green:int = ((color & 0xFF00) >>> 8) * multiplier;
|
||||
var blue:int = (color & 0xFF) * multiplier;
|
||||
return name_345(red,green,blue);
|
||||
}
|
||||
|
||||
public static function interpolate(a:uint, b:uint, k:Number = 0.5) : uint
|
||||
{
|
||||
var red:int = (a & 0xFF0000) >>> 16;
|
||||
red += (((b & 0xFF0000) >>> 16) - red) * k;
|
||||
var green:int = (a & 0xFF00) >>> 8;
|
||||
green += (((b & 0xFF00) >>> 8) - green) * k;
|
||||
var blue:int = a & 0xFF;
|
||||
blue += ((b & 0xFF) - blue) * k;
|
||||
return name_345(red,green,blue);
|
||||
}
|
||||
|
||||
public static function method_551(fromColor:ColorTransform, toColor:ColorTransform, progress:Number, result:ColorTransform = null) : ColorTransform
|
||||
{
|
||||
if(result == null)
|
||||
{
|
||||
result = new ColorTransform();
|
||||
}
|
||||
var k:Number = 1 - progress;
|
||||
result.redMultiplier = fromColor.redMultiplier * k + toColor.redMultiplier * progress;
|
||||
result.greenMultiplier = fromColor.greenMultiplier * k + toColor.greenMultiplier * progress;
|
||||
result.blueMultiplier = fromColor.blueMultiplier * k + toColor.blueMultiplier * progress;
|
||||
result.alphaMultiplier = fromColor.alphaMultiplier * k + toColor.alphaMultiplier * progress;
|
||||
result.redOffset = fromColor.redOffset * k + toColor.redOffset * progress;
|
||||
result.greenOffset = fromColor.greenOffset * k + toColor.greenOffset * progress;
|
||||
result.blueOffset = fromColor.blueOffset * k + toColor.blueOffset * progress;
|
||||
result.alphaOffset = fromColor.alphaOffset * k + toColor.alphaOffset * progress;
|
||||
return result;
|
||||
}
|
||||
|
||||
public static function random(redMin:uint = 0, redMax:uint = 255, greenMin:uint = 0, greenMax:uint = 255, blueMin:uint = 0, blueMax:uint = 255) : uint
|
||||
{
|
||||
return name_345(MathUtils.random(redMin,redMax),MathUtils.random(greenMin,greenMax),MathUtils.random(blueMin,blueMax));
|
||||
}
|
||||
|
||||
public static function name_345(red:int, green:int, blue:int) : uint
|
||||
{
|
||||
return (red < 0 ? 0 : (Boolean(red >>> 8) ? 16711680 : red << 16)) + (green < 0 ? 0 : (Boolean(green >>> 8) ? 65280 : green << 8)) + (blue < 0 ? 0 : (Boolean(blue >>> 8) ? 255 : blue));
|
||||
}
|
||||
|
||||
public static function red(color:uint) : uint
|
||||
{
|
||||
return (color & 0xFF0000) >>> 16;
|
||||
}
|
||||
|
||||
public static function green(color:uint) : uint
|
||||
{
|
||||
return (color & 0xFF00) >>> 8;
|
||||
}
|
||||
|
||||
public static function blue(color:uint) : uint
|
||||
{
|
||||
return color & 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
src/alternativa/utils/ICircularStringBuffer.as
Normal file
18
src/alternativa/utils/ICircularStringBuffer.as
Normal file
@@ -0,0 +1,18 @@
|
||||
package alternativa.utils
|
||||
{
|
||||
public interface ICircularStringBuffer
|
||||
{
|
||||
function add(param1:String) : void;
|
||||
|
||||
function clear() : void;
|
||||
|
||||
function get size() : int;
|
||||
|
||||
function get capacity() : int;
|
||||
|
||||
function set capacity(param1:int) : void;
|
||||
|
||||
function name_633(param1:int) : IStringBufferIterator;
|
||||
}
|
||||
}
|
||||
|
||||
10
src/alternativa/utils/IStringBufferIterator.as
Normal file
10
src/alternativa/utils/IStringBufferIterator.as
Normal file
@@ -0,0 +1,10 @@
|
||||
package alternativa.utils
|
||||
{
|
||||
public interface IStringBufferIterator
|
||||
{
|
||||
function hasNext() : Boolean;
|
||||
|
||||
function getNext() : String;
|
||||
}
|
||||
}
|
||||
|
||||
207
src/alternativa/utils/KeyboardUtils.as
Normal file
207
src/alternativa/utils/KeyboardUtils.as
Normal file
@@ -0,0 +1,207 @@
|
||||
package alternativa.utils
|
||||
{
|
||||
public class KeyboardUtils
|
||||
{
|
||||
public static const A:uint = 65;
|
||||
|
||||
public static const B:uint = 66;
|
||||
|
||||
public static const C:uint = 67;
|
||||
|
||||
public static const D:uint = 68;
|
||||
|
||||
public static const E:uint = 69;
|
||||
|
||||
public static const F:uint = 70;
|
||||
|
||||
public static const G:uint = 71;
|
||||
|
||||
public static const H:uint = 72;
|
||||
|
||||
public static const I:uint = 73;
|
||||
|
||||
public static const J:uint = 74;
|
||||
|
||||
public static const K:uint = 75;
|
||||
|
||||
public static const L:uint = 76;
|
||||
|
||||
public static const M:uint = 77;
|
||||
|
||||
public static const N:uint = 78;
|
||||
|
||||
public static const O:uint = 79;
|
||||
|
||||
public static const P:uint = 80;
|
||||
|
||||
public static const Q:uint = 81;
|
||||
|
||||
public static const R:uint = 82;
|
||||
|
||||
public static const S:uint = 83;
|
||||
|
||||
public static const T:uint = 84;
|
||||
|
||||
public static const U:uint = 85;
|
||||
|
||||
public static const V:uint = 86;
|
||||
|
||||
public static const W:uint = 87;
|
||||
|
||||
public static const X:uint = 88;
|
||||
|
||||
public static const Y:uint = 89;
|
||||
|
||||
public static const Z:uint = 90;
|
||||
|
||||
public static const SPACE:uint = 32;
|
||||
|
||||
public static const SEMICOLON:uint = 186;
|
||||
|
||||
public static const COMMA:uint = 188;
|
||||
|
||||
public static const PERIOD:uint = 190;
|
||||
|
||||
public static const SLASH:uint = 191;
|
||||
|
||||
public static const BACKQUOTE:uint = 192;
|
||||
|
||||
public static const LEFTBRACKET:uint = 219;
|
||||
|
||||
public static const BACKSLASH:uint = 220;
|
||||
|
||||
public static const RIGHTBRACKET:uint = 221;
|
||||
|
||||
public static const QUOTE:uint = 222;
|
||||
|
||||
public static const BACKSPACE:uint = 8;
|
||||
|
||||
public static const TAB:uint = 9;
|
||||
|
||||
public static const PAGE_UP:uint = 33;
|
||||
|
||||
public static const PAGE_DOWN:uint = 34;
|
||||
|
||||
public static const END:uint = 35;
|
||||
|
||||
public static const HOME:uint = 36;
|
||||
|
||||
public static const INSERT:uint = 45;
|
||||
|
||||
public static const DELETE:uint = 46;
|
||||
|
||||
public static const NUMBER_0:uint = 48;
|
||||
|
||||
public static const NUMBER_1:uint = 49;
|
||||
|
||||
public static const NUMBER_2:uint = 50;
|
||||
|
||||
public static const NUMBER_3:uint = 51;
|
||||
|
||||
public static const NUMBER_4:uint = 52;
|
||||
|
||||
public static const NUMBER_5:uint = 53;
|
||||
|
||||
public static const NUMBER_6:uint = 54;
|
||||
|
||||
public static const NUMBER_7:uint = 55;
|
||||
|
||||
public static const NUMBER_8:uint = 56;
|
||||
|
||||
public static const NUMBER_9:uint = 57;
|
||||
|
||||
public static const EQUAL:uint = 187;
|
||||
|
||||
public static const MINUS:uint = 189;
|
||||
|
||||
public static const NUMPAD:uint = 21;
|
||||
|
||||
public static const NUMPAD_0:uint = 96;
|
||||
|
||||
public static const NUMPAD_1:uint = 97;
|
||||
|
||||
public static const NUMPAD_2:uint = 98;
|
||||
|
||||
public static const NUMPAD_3:uint = 99;
|
||||
|
||||
public static const NUMPAD_4:uint = 100;
|
||||
|
||||
public static const NUMPAD_5:uint = 101;
|
||||
|
||||
public static const NUMPAD_6:uint = 102;
|
||||
|
||||
public static const NUMPAD_7:uint = 103;
|
||||
|
||||
public static const NUMPAD_8:uint = 104;
|
||||
|
||||
public static const NUMPAD_9:uint = 105;
|
||||
|
||||
public static const NUMPAD_ADD:uint = 107;
|
||||
|
||||
public static const NUMPAD_DECIMAL:uint = 110;
|
||||
|
||||
public static const NUMPAD_DIVIDE:uint = 111;
|
||||
|
||||
public static const NUMPAD_ENTER:uint = 108;
|
||||
|
||||
public static const NUMPAD_MULTIPLY:uint = 106;
|
||||
|
||||
public static const NUMPAD_SUBTRACT:uint = 109;
|
||||
|
||||
public static const ENTER:uint = 13;
|
||||
|
||||
public static const COMMAND:uint = 15;
|
||||
|
||||
public static const SHIFT:uint = 16;
|
||||
|
||||
public static const CONTROL:uint = 17;
|
||||
|
||||
public static const CAPS_LOCK:uint = 20;
|
||||
|
||||
public static const ESCAPE:uint = 27;
|
||||
|
||||
public static const LEFT:uint = 37;
|
||||
|
||||
public static const UP:uint = 38;
|
||||
|
||||
public static const RIGHT:uint = 39;
|
||||
|
||||
public static const DOWN:uint = 40;
|
||||
|
||||
public static const F1:uint = 112;
|
||||
|
||||
public static const F2:uint = 113;
|
||||
|
||||
public static const F3:uint = 114;
|
||||
|
||||
public static const F4:uint = 115;
|
||||
|
||||
public static const F5:uint = 116;
|
||||
|
||||
public static const F6:uint = 117;
|
||||
|
||||
public static const F7:uint = 118;
|
||||
|
||||
public static const F8:uint = 119;
|
||||
|
||||
public static const F9:uint = 120;
|
||||
|
||||
public static const F10:uint = 121;
|
||||
|
||||
public static const F11:uint = 122;
|
||||
|
||||
public static const F12:uint = 123;
|
||||
|
||||
public static const F13:uint = 124;
|
||||
|
||||
public static const F14:uint = 125;
|
||||
|
||||
public static const F15:uint = 126;
|
||||
|
||||
public function KeyboardUtils()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
141
src/alternativa/utils/MathUtils.as
Normal file
141
src/alternativa/utils/MathUtils.as
Normal file
@@ -0,0 +1,141 @@
|
||||
package alternativa.utils
|
||||
{
|
||||
import flash.geom.Point;
|
||||
|
||||
public final class MathUtils
|
||||
{
|
||||
private static const toRad:Number = Math.PI / 180;
|
||||
|
||||
private static const toDeg:Number = 180 / Math.PI;
|
||||
|
||||
public static const DEG1:Number = toRad;
|
||||
|
||||
public static const DEG5:Number = Math.PI / 36;
|
||||
|
||||
public static const DEG10:Number = Math.PI / 18;
|
||||
|
||||
public static const DEG30:Number = Math.PI / 6;
|
||||
|
||||
public static const DEG45:Number = Math.PI / 4;
|
||||
|
||||
public static const DEG60:Number = Math.PI / 3;
|
||||
|
||||
public static const DEG90:Number = Math.PI / 2;
|
||||
|
||||
public static const DEG180:Number = Math.PI;
|
||||
|
||||
public static const DEG360:Number = Math.PI + Math.PI;
|
||||
|
||||
public function MathUtils()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function method_806(angle:Number) : Number
|
||||
{
|
||||
return angle * toRad;
|
||||
}
|
||||
|
||||
public static function method_801(angle:Number) : Number
|
||||
{
|
||||
return angle * toDeg;
|
||||
}
|
||||
|
||||
public static function method_802(angle:Number) : Number
|
||||
{
|
||||
var res:Number = angle % DEG360;
|
||||
return res > 0 ? (res > DEG180 ? res - DEG360 : res) : (res < -DEG180 ? res + DEG360 : res);
|
||||
}
|
||||
|
||||
public static function method_805(a:Number, b:Number) : Number
|
||||
{
|
||||
var delta:Number = b - a;
|
||||
if(delta > DEG180)
|
||||
{
|
||||
return delta - DEG360;
|
||||
}
|
||||
if(delta < -DEG180)
|
||||
{
|
||||
return delta + DEG360;
|
||||
}
|
||||
return delta;
|
||||
}
|
||||
|
||||
public static function random(a:Number = NaN, b:Number = NaN) : Number
|
||||
{
|
||||
if(isNaN(a))
|
||||
{
|
||||
return Math.random();
|
||||
}
|
||||
if(isNaN(b))
|
||||
{
|
||||
return Math.random() * a;
|
||||
}
|
||||
return Math.random() * (b - a) + a;
|
||||
}
|
||||
|
||||
public static function method_807() : Number
|
||||
{
|
||||
return Math.random() * DEG360;
|
||||
}
|
||||
|
||||
public static function method_803(a:Number, b:Number, threshold:Number = 0) : Boolean
|
||||
{
|
||||
return b - a <= threshold && b - a >= -threshold;
|
||||
}
|
||||
|
||||
public static function method_809(first:Point, second:Point, point:Point) : Number
|
||||
{
|
||||
var dx:Number = second.x - first.x;
|
||||
var dy:Number = second.y - first.y;
|
||||
var px:Number = point.x - first.x;
|
||||
var py:Number = point.y - first.y;
|
||||
return (dx * py - dy * px) / Math.sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
public static function method_804(a:Point, b:Point, c:Point, point:Point) : Boolean
|
||||
{
|
||||
if(method_799(c.subtract(a),point.subtract(a)) <= 0)
|
||||
{
|
||||
if(method_799(b.subtract(c),point.subtract(c)) <= 0)
|
||||
{
|
||||
if(method_799(a.subtract(b),point.subtract(b)) <= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function method_799(a:Point, b:Point) : Number
|
||||
{
|
||||
return a.x * b.y - a.y * b.x;
|
||||
}
|
||||
|
||||
public static function method_800(a:Point, b:Point) : Number
|
||||
{
|
||||
return a.x * b.x + a.y * b.y;
|
||||
}
|
||||
|
||||
public static function method_810(a:Point, b:Point) : Number
|
||||
{
|
||||
var len:Number = a.length * b.length;
|
||||
var cos:Number = len != 0 ? method_800(a,b) / len : 1;
|
||||
return Math.acos(cos);
|
||||
}
|
||||
|
||||
public static function method_808(a:Point, b:Point) : Number
|
||||
{
|
||||
var dot:Number = method_800(a,b);
|
||||
if(Math.abs(dot) > 1)
|
||||
{
|
||||
dot = dot > 0 ? 1 : -1;
|
||||
}
|
||||
return Math.acos(dot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
59
src/alternativa/utils/Properties.as
Normal file
59
src/alternativa/utils/Properties.as
Normal file
@@ -0,0 +1,59 @@
|
||||
package alternativa.utils
|
||||
{
|
||||
public class Properties
|
||||
{
|
||||
private var data:Object;
|
||||
|
||||
public function Properties(data:Object = null)
|
||||
{
|
||||
super();
|
||||
this.data = data || new Object();
|
||||
}
|
||||
|
||||
public function method_24(key:String) : String
|
||||
{
|
||||
return this.data[key];
|
||||
}
|
||||
|
||||
public function method_25(key:String, defaultValue:String) : String
|
||||
{
|
||||
return this.data[key] || defaultValue;
|
||||
}
|
||||
|
||||
public function method_27(key:String, value:String) : void
|
||||
{
|
||||
if(!value)
|
||||
{
|
||||
throw new ArgumentError("Empty values are not allowed");
|
||||
}
|
||||
this.data[key] = value;
|
||||
}
|
||||
|
||||
public function get method_26() : Vector.<String>
|
||||
{
|
||||
var name:String = null;
|
||||
var names:Vector.<String> = new Vector.<String>();
|
||||
for(name in this.data)
|
||||
{
|
||||
names.push(name);
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public function toString() : String
|
||||
{
|
||||
var key:String = null;
|
||||
var result:String = "";
|
||||
for(key in this.data)
|
||||
{
|
||||
if(Boolean(result))
|
||||
{
|
||||
result += ", ";
|
||||
}
|
||||
result += key + ": " + this.data[key];
|
||||
}
|
||||
return "[Properties " + result + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
21
src/alternativa/utils/TextUtils.as
Normal file
21
src/alternativa/utils/TextUtils.as
Normal file
@@ -0,0 +1,21 @@
|
||||
package alternativa.utils
|
||||
{
|
||||
public class TextUtils
|
||||
{
|
||||
public function TextUtils()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function name_719(msg:String, ... args) : String
|
||||
{
|
||||
var len:int = int(args.length);
|
||||
for(var i:int = 0; i < len; i++)
|
||||
{
|
||||
msg = msg.replace(new RegExp("%" + (i + 1),"g"),args[i]);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user