Section 1
//AssetLibrary (com.gamedozer.battalion.assets.AssetLibrary)
package com.gamedozer.battalion.assets {
import flash.display.*;
import flash.media.*;
import flash.utils.*;
public class AssetLibrary {
public static function createSound(_arg1:String):Sound{
var _local2:Object = getDefinitionByName(_arg1);
var _local3:Sound = (new (_local2) as Sound);
return (_local3);
}
public static function createBitmapData(_arg1:String):BitmapData{
var _local2:Object = getDefinitionByName(_arg1);
var _local3:BitmapData = (new _local2(0, 0) as BitmapData);
return (_local3);
}
}
}//package com.gamedozer.battalion.assets
Section 2
//AudioProfile (com.gamedozer.battalion.audio.AudioProfile)
package com.gamedozer.battalion.audio {
import flash.media.*;
import flash.utils.*;
public class AudioProfile {
private var m_profile:Dictionary;
public static const k_attackType:String = "attack";
public static const k_moveType:String = "move";
static var s_multiton:Dictionary = null;
public function AudioProfile(){
m_profile = new Dictionary();
}
function registerSound(_arg1:String, _arg2:String):void{
if (m_profile[_arg1] == null){
m_profile[_arg1] = new Array();
};
m_profile[_arg1].push(_arg2);
}
public function playSound(_arg1:String):void{
var _local4:Number;
var _local2:Array = m_profile[_arg1];
var _local3:String = _local2[Math.floor((Math.random() * _local2.length))];
if (_local3 != ""){
_local4 = 1;
SoundSystem.instance.playSound(SoundSystem.instance.createSound(_local3), _local4);
};
}
private static function initialize():void{
if (s_multiton != null){
return;
};
s_multiton = new Dictionary(true);
registerProfiles();
}
private static function createProfile(_arg1:String):AudioProfile{
var _local2:AudioProfile = new (AudioProfile);
s_multiton[_arg1] = _local2;
return (_local2);
}
private static function registerProfiles():void{
var _local1:AudioProfile = createProfile("Heavy Commando");
_local1.registerSound(k_moveType, "CommandoMove1");
_local1.registerSound(k_moveType, "CommandoMove2");
_local1.registerSound(k_moveType, "CommandoMove3");
_local1.registerSound(k_attackType, "FireHeavyCommando");
_local1 = createProfile("Strike Commando");
_local1.registerSound(k_moveType, "CommandoMove1");
_local1.registerSound(k_moveType, "CommandoMove2");
_local1.registerSound(k_moveType, "CommandoMove3");
_local1.registerSound(k_attackType, "FireStrikeCommando");
_local1 = createProfile("Flak Tank");
_local1.registerSound(k_moveType, "TankMove1");
_local1.registerSound(k_moveType, "TankMove2");
_local1.registerSound(k_moveType, "TankMove3");
_local1.registerSound(k_attackType, "FireFlakTank");
_local1 = createProfile("Scorpion Tank");
_local1.registerSound(k_moveType, "TankMove1");
_local1.registerSound(k_moveType, "TankMove2");
_local1.registerSound(k_moveType, "TankMove3");
_local1.registerSound(k_attackType, "FireScorpionTank");
_local1 = createProfile("Annihilator Tank");
_local1.registerSound(k_moveType, "TankMove1");
_local1.registerSound(k_moveType, "TankMove2");
_local1.registerSound(k_moveType, "TankMove3");
_local1.registerSound(k_attackType, "FireAnnihilatorTank");
_local1 = createProfile("Stealth Tank");
_local1.registerSound(k_moveType, "TankMove1");
_local1.registerSound(k_moveType, "TankMove2");
_local1.registerSound(k_moveType, "TankMove3");
_local1.registerSound(k_attackType, "FireStealthTank");
_local1 = createProfile("Mortar Truck");
_local1.registerSound(k_moveType, "VehicleMove");
_local1.registerSound(k_attackType, "FireMortarTruck");
_local1 = createProfile("Rocket Truck");
_local1.registerSound(k_moveType, "VehicleMove");
_local1.registerSound(k_attackType, "FireRocketTruck");
_local1 = createProfile("Turret");
_local1.registerSound(k_moveType, "VehicleMove");
_local1.registerSound(k_attackType, "FireTurret");
_local1 = createProfile("Raptor Fighter");
_local1.registerSound(k_moveType, "AircraftMove");
_local1.registerSound(k_attackType, "FireRaptorFighter");
_local1 = createProfile("Albatross Transport");
_local1.registerSound(k_moveType, "BlimpMove");
_local1.registerSound(k_attackType, "FireAlbatrossTransport");
_local1 = createProfile("Condor Bomber");
_local1.registerSound(k_moveType, "BlimpMove");
_local1.registerSound(k_attackType, "FireCondorBomber");
_local1 = createProfile("Leviathan Barge");
_local1.registerSound(k_moveType, "ShipMove");
_local1.registerSound(k_attackType, "FireLeviathanBarge");
_local1 = createProfile("Hunter Support");
_local1.registerSound(k_moveType, "ShipMove");
_local1.registerSound(k_attackType, "FireHunterSupport");
_local1 = createProfile("Corvette Fighter");
_local1.registerSound(k_moveType, "ShipMove");
_local1.registerSound(k_attackType, "FireCorvetteFighter");
_local1 = createProfile("Battlecruiser");
_local1.registerSound(k_moveType, "ShipMove");
_local1.registerSound(k_attackType, "FireBattlecruiser");
_local1 = createProfile("Intrepid");
_local1.registerSound(k_moveType, "BoatMove");
_local1.registerSound(k_attackType, "FireIntrepid");
_local1 = createProfile("U-Boat");
_local1.registerSound(k_moveType, "SubmarineMove");
_local1.registerSound(k_attackType, "FireUboat");
}
public static function getProfile(_arg1:String):AudioProfile{
initialize();
return (s_multiton[_arg1]);
}
}
}//package com.gamedozer.battalion.audio
Section 3
//SoundSystem (com.gamedozer.battalion.audio.SoundSystem)
package com.gamedozer.battalion.audio {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class SoundSystem {
private var m_loopMap:Dictionary;
private var m_isMuted:Boolean;
private var m_effectMasterVolumeModifier:Number;// = 0.75
private var m_loopMasterVolumeModifier:Number;// = 0.75
private var m_volume:Number;
private static var s_singleton:SoundSystem = null;
public function SoundSystem(){
m_loopMap = new Dictionary();
m_isMuted = false;
m_volume = 1;
}
public function createLoop(_arg1:String, _arg2:Sound, _arg3:Number=1, _arg4:Boolean=true):Boolean{
if (m_loopMap[_arg1] != null){
return (false);
};
var _local5:BackgroundLoop = new BackgroundLoop();
_local5.id = _arg1;
_local5.customVolume = _arg3;
var _local6:SoundTransform = new SoundTransform();
_local6.volume = (_arg3 * m_loopMasterVolumeModifier);
_local5.sound = _arg2;
m_loopMap[_arg1] = _local5;
if (_arg4){
_local5.loopChannel = _arg2.play(0, 999999999, _local6);
};
return (true);
}
private function updateMute():void{
if (m_isMuted){
changeVolume(0);
} else {
changeVolume(m_volume);
};
}
public function getMasterEffectVolume():Number{
return (m_effectMasterVolumeModifier);
}
public function playSound(_arg1:Sound, _arg2:Number=1, _arg3:Function=null):void{
var _local4:SoundTransform = new SoundTransform();
_local4.volume = (_arg2 * m_effectMasterVolumeModifier);
var _local5:SoundChannel = _arg1.play(0, 1, _local4);
if (_arg3 != null){
_local5.addEventListener(Event.SOUND_COMPLETE, _arg3);
};
}
public function toggleMute():void{
m_isMuted = !(m_isMuted);
updateMute();
}
public function stopLoop(_arg1:String):Boolean{
var _local2:BackgroundLoop = m_loopMap[_arg1];
if (_local2 != null){
if (_local2.loopChannel != null){
_local2.loopChannel.stop();
_local2.loopChannel = null;
};
return (true);
};
return (false);
}
public function getMasterLoopVolume():Number{
return (m_loopMasterVolumeModifier);
}
public function mute():void{
m_isMuted = true;
updateMute();
}
public function setMaxVolume(_arg1:Number):void{
m_volume = _arg1;
}
public function isMuted():Boolean{
return (m_isMuted);
}
public function setMasterLoopVolume(_arg1:Number):void{
var _local2:BackgroundLoop;
var _local3:SoundChannel;
var _local4:Number;
_arg1 = (Math.floor((_arg1 * 100)) / 100);
for each (_local2 in m_loopMap) {
_local3 = _local2.loopChannel;
_local4 = (_local2.customVolume * _arg1);
if (_local4 > 1){
_local4 = 1;
};
if (_local4 < 0){
_local4 = 0;
};
if (_local3 != null){
_local3.soundTransform = new SoundTransform(_local4);
};
};
m_loopMasterVolumeModifier = _arg1;
}
public function isPlaying(_arg1:String):Boolean{
var _local2:BackgroundLoop = m_loopMap[_arg1];
if (_local2 != null){
if (_local2.loopChannel != null){
if (_local2.loopChannel.position > 0){
return (true);
};
};
};
return (false);
}
public function startLoop(_arg1:String, _arg2:Number=1):Boolean{
var _local4:SoundTransform;
var _local3:BackgroundLoop = m_loopMap[_arg1];
if (_local3 != null){
if (isPlaying(_arg1)){
return (false);
};
_local4 = new SoundTransform();
_local4.volume = (_arg2 * m_loopMasterVolumeModifier);
_local3.loopChannel = _local3.sound.play(0, 999999999, _local4);
return (true);
};
return (false);
}
public function setMasterEffectVolume(_arg1:Number):void{
_arg1 = (Math.floor((_arg1 * 100)) / 100);
if (_arg1 > 1){
_arg1 = 1;
};
if (_arg1 < 0){
_arg1 = 0;
};
m_effectMasterVolumeModifier = _arg1;
}
public function changeVolume(_arg1:Number):void{
var _local2:SoundTransform = new SoundTransform();
_local2.volume = _arg1;
SoundMixer.soundTransform = _local2;
}
public function changeLoopVolume(_arg1:String, _arg2:Number):Boolean{
var _local4:SoundTransform;
var _local3:BackgroundLoop = m_loopMap[_arg1];
if (_local3 == null){
return (false);
};
_local3.customVolume = _arg2;
if (_local3.loopChannel != null){
_local4 = new SoundTransform((_arg2 * m_loopMasterVolumeModifier));
_local3.loopChannel.soundTransform = _local4;
};
return (true);
}
public function unmute():void{
m_isMuted = false;
updateMute();
}
public function createSound(_arg1:String):Sound{
var _local2:Class = (getDefinitionByName(_arg1) as Class);
return (new (_local2));
}
public function destroyLoop(_arg1:String):Boolean{
var _local2:BackgroundLoop = m_loopMap[_arg1];
if (_local2 != null){
if (_local2.loopChannel != null){
_local2.loopChannel.stop();
_local2.loopChannel = null;
};
_local2.sound = null;
_local2 = null;
delete m_loopMap[_arg1];
return (true);
};
return (false);
}
public static function get instance():SoundSystem{
if (s_singleton == null){
s_singleton = new (SoundSystem);
};
return (s_singleton);
}
}
}//package com.gamedozer.battalion.audio
import flash.media.*;
class BackgroundLoop {
public var customVolume:Number;
public var sound:Sound;
public var id:String;
public var loopChannel:SoundChannel;
private function BackgroundLoop(){
}
}
Section 4
//Astar (com.gamedozer.battalion.data.Astar)
package com.gamedozer.battalion.data {
import flash.utils.*;
public class Astar {
protected static var open:Array;
protected static var iteration:int = -1;
static function remove(_arg1:Node):void{
var _local2:int = (open.length - 1);
while (_local2 >= 0) {
if (open[_local2] == _arg1){
open.splice(_local2, 1);
};
_local2--;
};
}
public static function path(_arg1:Node, _arg2:Node, _arg3:Unit=null, _arg4:Number=0, _arg5:int=0):Array{
var _local6:Array;
var _local7:Node;
if (_arg1 == _arg2){
return ([_arg1]);
};
if (search(_arg1, _arg2, _arg3, _arg4, false, _arg5) == null){
return (null);
};
if (_arg2.iteration == iteration){
_local6 = new Array();
_local7 = _arg2;
while (_local7 != _arg1) {
_local6.unshift(_local7);
_local7 = _local7.previous;
};
_local6.unshift(_local7);
return (_local6);
};
return (null);
}
public static function pathTrim(_arg1:Node, _arg2:Node, _arg3:Unit, _arg4:int=0):Array{
var _local5:Array = path(_arg1, _arg2, _arg3, Number.POSITIVE_INFINITY, _arg4);
if (_local5 == null){
return (null);
};
var _local6:int = (_local5.length - 1);
while (_local6 >= 0) {
if (_local5[_local6].g > _arg3.getRange()){
_local5.splice(_local6, 1);
};
_local6--;
};
return (_local5);
}
public static function search(_arg1:Node, _arg2:Node=null, _arg3:Unit=null, _arg4:Number=0, _arg5:Boolean=false, _arg6:int=0):Array{
var _local11:Node;
var _local12:Array;
var _local13:int;
var _local14:Node;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local7:int = getTimer();
iteration++;
if (_arg3 != null){
if (_arg2 != null){
if (_arg2.getCost(_arg3, _arg6, true) == Number.POSITIVE_INFINITY){
return (null);
};
};
if (_arg1.getCost(_arg3, _arg6, false) == Number.POSITIVE_INFINITY){
return (null);
};
};
if (_arg1 == _arg2){
return (null);
};
var _local8:Array = new Array();
open = new Array();
_arg1.reset();
_arg1.iteration = iteration;
addSorted(_arg1);
_local8.push(_arg1);
var _local9:Number = 0;
if (_arg3 != null){
_local9 = _arg3.getRange();
};
var _local10:Boolean;
while ((((open.length > 0)) && (!(_local10)))) {
_local11 = open.shift();
_local11.state = Node.CLOSED;
_local12 = _local11.getConnections();
_local13 = 0;
for (;_local13 < _local12.length;_local13++) {
_local14 = _local12[_local13];
if ((((_local14.iteration == iteration)) && ((_local14.state == Node.CLOSED)))){
} else {
_local15 = _local14.getHeuristic(_arg2);
_local16 = 1;
if (_arg3 != null){
_local16 = _local14.getCost(_arg3, _arg6, false);
};
if ((((((_local16 == Number.POSITIVE_INFINITY)) && ((_arg5 == false)))) && ((_arg6 == 0)))){
} else {
if ((((_local14.iteration == iteration)) && ((_local14.state == Node.OPEN)))){
if (_local14.g > (_local11.g + _local16)){
remove(_local14);
_local14.g = (_local11.g + _local16);
_local14.f = (_local14.g + _local14.h);
_local14.previous = _local11;
addSorted(_local14);
};
} else {
_local17 = (_local11.g + _local16);
if ((((_local17 > _local9)) && ((_local17 > _arg4)))){
if (_arg5){
if (_local11.g == Number.POSITIVE_INFINITY){
continue;
};
if (((((_local11.g + 1) > (_local9 + 1))) && (((_local11.g + 1) > (_arg4 + 1))))){
continue;
};
//unresolved jump
};
if (_arg6 != 0){
};
if ((((_arg6 & Tile.k_astarFlagIgnoreLastNode)) && ((_local14 == _arg2)))){
_local16 = _local14.getCost(_arg3, _arg6, true);
_local17 = (_local11.g + _local16);
if ((((_local17 > _local9)) && ((_local17 > _arg4)))){
continue;
};
//unresolved jump
};
} else {
_local14.reset(_local11, _local17, _local15, (_local17 + _local15));
_local14.iteration = iteration;
addSorted(_local14);
_local8.push(_local14);
if (_local14 == _arg2){
_local10 = true;
break;
};
};
};
};
};
};
};
return (_local8);
}
public static function range(_arg1:Node, _arg2:Number, _arg3:Number):Array{
var _local4:Array = search(_arg1, null, null, _arg3);
var _local5:int = (_local4.length - 1);
while (_local5 >= 0) {
if (_local4[_local5].g < _arg2){
_local4.splice(_local5, 1);
};
_local5--;
};
return (_local4);
}
public static function calculatePositionsToTargetEndNode(_arg1:Node, _arg2:Node, _arg3:Unit, _arg4:Boolean):Array{
var _local9:Node;
var _local10:int;
var _local11:int;
var _local5:Array = range(_arg2, _arg3.getWeaponRangeMin(), _arg3.getWeaponRangeMax());
var _local6:Node;
var _local7:int = int.MAX_VALUE;
var _local8:int = (_local5.length - 1);
while (_local8 >= 0) {
_local9 = _local5[_local8];
_local10 = 0;
if (_arg4){
_local10 = Tile.k_astarFlagIgnoreUnits;
};
_local11 = calculateTurnsToPath(_arg1, _local9, _arg3, _local10);
if (_local11 > 0){
if (_local11 < _local7){
_local6 = _local9;
_local7 = _local11;
};
} else {
_local5.splice(_local8, 1);
};
_local8--;
};
return (_local5);
}
public static function calculateTurnsToPath(_arg1:Node, _arg2:Node, _arg3:Unit, _arg4:int=0):int{
if (_arg3.getRange() == 0){
return (-1);
};
var _local5:Array = path(_arg1, _arg2, _arg3, Number.POSITIVE_INFINITY, _arg4);
if (_local5 == null){
return (-1);
};
if ((_arg4 & Tile.k_astarFlagIgnoreLastNode)){
if (_local5[(_local5.length - 1)].g == Number.POSITIVE_INFINITY){
_local5.splice((_local5.length - 1), 1);
if (_local5.length == 0){
return (1);
};
};
};
if (_local5[(_local5.length - 1)].g == Number.POSITIVE_INFINITY){
return (-1);
};
return (Math.ceil((_local5[(_local5.length - 1)].g / _arg3.getRange())));
}
static function addSorted(_arg1:Node):void{
var _local2:int;
while (_local2 < open.length) {
if (_arg1.compare(open[_local2]) == 1){
open.splice(_local2, 0, _arg1);
return;
};
_local2++;
};
open.push(_arg1);
}
}
}//package com.gamedozer.battalion.data
Section 5
//BattalionSettings (com.gamedozer.battalion.data.BattalionSettings)
package com.gamedozer.battalion.data {
import com.gamedozer.utils.*;
public class BattalionSettings {
private static var m_singleton:Settings = null;
public static function getSingleton():Settings{
return (m_singleton);
}
public static function createSingleton(_arg1:XML):void{
m_singleton = Settings.createSettingsFromXML(_arg1);
}
}
}//package com.gamedozer.battalion.data
Section 6
//CampaignManager (com.gamedozer.battalion.data.CampaignManager)
package com.gamedozer.battalion.data {
import flash.utils.*;
public class CampaignManager {
protected var completeName:String;
protected var levels:Array;
protected var victoryImage:String;
protected var levelName:String;
protected static var campaigns:Dictionary;
public function CampaignManager(_arg1:String, _arg2:XML){
var _local5:Level;
super();
levels = new Array(_arg2.@levels);
victoryImage = _arg2.@victoryImage;
var _local3:XMLList = _arg2..level;
var _local4:int;
while (_local4 < _local3.length()) {
_local5 = new Level();
_local5.name = _local3[_local4].@name;
_local5.mapURL = _local3[_local4].map.@url;
_local5.mapName = _local3[_local4].map.@name;
_local5.teamName = _local3[_local4].team.@name;
_local5.teamIcon = _local3[_local4].team.@icon;
_local5.bg = _local3[_local4].team.@bg;
_local5.brief = _local3[_local4].brief.@value;
_local5.objective = _local3[_local4].objective.@value;
_local5.mapSettings = _local3[_local4]..mapsettings[0];
levels[parseInt(_local3[_local4].@number)] = _local5;
_local4++;
};
levelName = _arg2.@levelname;
completeName = _arg2.@completename;
if (campaigns == null){
campaigns = new Dictionary();
};
campaigns[_arg1] = this;
}
public function getCompleteName():String{
return (completeName);
}
public function getMapSettings(_arg1:int):XML{
return (levels[_arg1].mapSettings);
}
public function getName(_arg1:int):String{
return (levels[_arg1].name);
}
public function getFinalVictoryImage():String{
return (victoryImage);
}
public function getObjective(_arg1:int):String{
return (levels[_arg1].objective);
}
public function getBrief(_arg1:int):String{
return (levels[_arg1].brief);
}
public function getTeamIcon(_arg1:int):String{
return (levels[_arg1].teamIcon);
}
public function getTeamName(_arg1:int):String{
return (levels[_arg1].teamName);
}
public function getMapName(_arg1:int):String{
return (levels[_arg1].mapName);
}
public function numLevels():int{
return (levels.length);
}
public function getMapURL(_arg1:int):String{
return (levels[_arg1].mapURL);
}
public function getLevelName():String{
return (levelName);
}
public function getBG(_arg1:int):String{
return (levels[_arg1].bg);
}
public static function getInstance(_arg1:String):CampaignManager{
if (campaigns[_arg1] == null){
trace("CampaignManager::No campaign exists");
};
return (campaigns[_arg1]);
}
}
}//package com.gamedozer.battalion.data
class Level {
public var bg:String;
public var mapName:String;
public var teamName:String;
public var name:String;
public var mapURL:String;
public var teamIcon:String;
public var objective:String;
public var brief:String;
public var mapSettings:XML;
private function Level(){
}
}
Section 7
//Map (com.gamedozer.battalion.data.Map)
package com.gamedozer.battalion.data {
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.display.*;
import flash.geom.*;
import com.gamedozer.battalion.game.*;
public class Map {
protected var _hasGroundControl:Boolean;// = false
protected var width:int;
protected var mapName:String;// = "mapname"
protected var _hasSeaControl:Boolean;// = false
protected var author:String;// = "author"
protected var name:String;
protected var script:XML;
protected var structures:Array;
protected var height:int;
protected var data:Array;
protected var _hasAirControl:Boolean;// = false
protected var units:Array;
protected var mapURL:String;
protected var palette:Array;
protected var description:String;// = "description"
public function Map(_arg1:XML, _arg2:String, _arg3:String){
var index:int;
var y:int;
var x:int;
var layerEntries:XMLList;
var j:int;
var reference:int;
var a_xml = _arg1;
var a_mapURL = _arg2;
var a_mapName = _arg3;
super();
mapURL = a_mapURL;
mapName = a_mapName;
try {
if (a_xml.name.length() > 0){
name = a_xml.name;
};
} catch(e:Error) {
trace("Map constructor. You are loading a map that doesn't exist.");
};
if (a_xml.description != null){
description = a_xml.description;
};
author = a_xml.author;
palette = new Array();
var paletteEntries:XMLList = a_xml.palette..entry;
var i:int;
while (i < paletteEntries.length()) {
index = parseInt(paletteEntries[i].@reference);
palette[index] = new TileSwatch(stripPlayers(paletteEntries[i].name), paletteEntries[i].imageCode);
i = (i + 1);
};
height = parseInt(a_xml.rows);
width = parseInt(a_xml.cols);
data = new Array();
units = new Array();
structures = new Array();
i = 0;
while (i < height) {
data[i] = new Array();
j = 0;
while (j < width) {
data[i][j] = new Array();
j = (j + 1);
};
i = (i + 1);
};
var tileEntries:XMLList = a_xml..tile;
i = 0;
while (i < tileEntries.length()) {
y = tileEntries[i].@r;
x = tileEntries[i].@c;
layerEntries = tileEntries[i]..layer;
j = 0;
while (j < layerEntries.length()) {
index = parseInt(layerEntries[j].@depth);
reference = layerEntries[j].@reference;
if (index == 0){
data[y][x] = reference;
} else {
if (index == 1){
structures.push(new UnitHelper(reference, x, y));
} else {
if (index == 2){
units.push(new UnitHelper(reference, x, y));
};
};
};
j = (j + 1);
};
i = (i + 1);
};
script = a_xml..script[0];
}
public function getScript():XML{
return (script);
}
public function getName():String{
return (name);
}
public function getDescription():String{
return (description);
}
public function get hasSeaControl():Boolean{
return (_hasSeaControl);
}
public function generateMiniMap():BitmapData{
var _local3:int;
var _local4:Terrain;
var _local5:BitmapData;
var _local1:BitmapData = new BitmapData((width * 6), (height * 6));
var _local2:int;
while (_local2 < height) {
_local3 = 0;
while (_local3 < width) {
_local4 = TileManager.getInstance().get(palette[data[_local2][_local3]].getName());
if (_local4 == null){
_local4 = new Terrain(palette[data[_local2][_local3]].getName(), 1, "", "minimap_sea");
};
_local5 = BitmapLibrary.loadBitmap(_local4.getMiniMapImage());
_local1.copyPixels(_local5, _local5.rect, new Point((_local3 * TileManager.getInstance().getMiniMapWidth()), (_local2 * TileManager.getInstance().getMiniMapHeight())));
_local3++;
};
_local2++;
};
return (_local1);
}
public function getMapName():String{
return (mapName);
}
public function getWidth():int{
return (width);
}
public function ownedBy(_arg1:int, _arg2:int):int{
return (palette[data[_arg2][_arg1]].getTeam());
}
public function getAuthor():String{
return (author);
}
public function generateTileMap():Array{
var _local3:int;
var _local4:GameTile;
var _local5:Terrain;
var _local6:Tile;
var _local1:Array = new Array();
var _local2:int;
while (_local2 < height) {
_local1[_local2] = new Array();
_local3 = 0;
while (_local3 < width) {
_local4 = new GameTile(palette[data[_local2][_local3]].getSprite());
if (_local2 == 0){
_local4.addChild(new Bitmap(BitmapLibrary.loadBitmap("border_top")));
} else {
if (_local2 == (height - 1)){
_local4.addChild(new Bitmap(BitmapLibrary.loadBitmap("border_bottom")));
};
};
if (_local3 == 0){
_local4.addChild(new Bitmap(BitmapLibrary.loadBitmap("border_left")));
} else {
if (_local3 == (width - 1)){
_local4.addChild(new Bitmap(BitmapLibrary.loadBitmap("border_right")));
};
};
_local5 = TileManager.getInstance().get(palette[data[_local2][_local3]].getName());
if (_local5 == null){
_local5 = new Terrain(palette[data[_local2][_local3]].getName(), 1, "", "minimap_sea", "undefined");
};
_local6 = new Tile(_local4, _local3, _local2, _local5);
_local1[_local2][_local3] = _local6;
_local3++;
};
_local2++;
};
_local2 = 0;
while (_local2 < height) {
_local3 = 0;
while (_local3 < width) {
if (_local3 > 0){
_local1[_local2][_local3].addConnection(_local1[_local2][(_local3 - 1)]);
};
if (_local3 < (width - 1)){
_local1[_local2][_local3].addConnection(_local1[_local2][(_local3 + 1)]);
};
if (_local2 > 0){
_local1[_local2][_local3].addConnection(_local1[(_local2 - 1)][_local3]);
};
if (_local2 < (height - 1)){
_local1[_local2][_local3].addConnection(_local1[(_local2 + 1)][_local3]);
};
_local3++;
};
_local2++;
};
return (_local1);
}
public function getMapURL():String{
return (mapURL);
}
public function get hasGroundControl():Boolean{
return (_hasGroundControl);
}
public function stripPlayers(_arg1:String):String{
var _local2:String = _arg1.replace("P1 ", "");
_local2 = _local2.replace("P2 ", "");
_local2 = _local2.replace("P3 ", "");
_local2 = _local2.replace("P4 ", "");
_local2 = _local2.replace("Neutral ", "");
return (_local2);
}
public function getNums():Object{
var _local3:TileSwatch;
var _local4:String;
var _local5:UnitData;
var _local1:Object = {air:0, ground:0, sea:0};
var _local2:int;
while (_local2 < units.length) {
_local3 = palette[units[_local2].swatch];
if (_local3.getTeam() == 1){
_local4 = _local3.getName();
_local5 = UnitManager.getInstance().get(_local4);
if (_local5.isAir()){
_local1.air++;
} else {
if (_local5.isGround()){
_local1.ground++;
} else {
if (_local5.isSea()){
_local1.sea++;
};
};
};
};
_local2++;
};
return (_local1);
}
public function get hasAirControl():Boolean{
return (_hasAirControl);
}
public function generateStructures(_arg1:Array, _arg2:Array):Array{
var _local5:Tile;
var _local6:TileSwatch;
var _local7:Controller;
var _local8:uint;
var _local9:String;
var _local10:Terrain;
var _local11:GameSprite;
var _local3:Array = new Array();
var _local4:int;
while (_local4 < structures.length) {
_local5 = _arg1[structures[_local4].y][structures[_local4].x];
_local6 = palette[structures[_local4].swatch];
_local7 = null;
_local8 = 4294967295;
if (_local6.getTeam() > 0){
_local7 = _arg2[(_local6.getTeam() - 1)];
_local8 = _local7.getTeam().getColor();
};
_local9 = _local6.getName();
if (_local9 == "Air Control"){
_hasAirControl = true;
};
if (_local9 == "Ground Control"){
_hasGroundControl = true;
};
if (_local9 == "Sea Control"){
_hasSeaControl = true;
};
_local10 = TileManager.getInstance().get(_local9);
if (_local10 != null){
if ((((((_local10.getSprite() == "oilrig")) || ((_local10.getSprite() == "oilrefinery")))) || ((_local10.getSprite() == "oiladvanced")))){
_local11 = TileSheetManager.getInstance().getColorised(_local9, _local8);
(_local11 as TileSheet).playAnimation("default");
} else {
_local11 = new ColoredSprite(BitmapLibrary.loadBitmap(_local10.getSprite()), BitmapLibrary.loadBitmap((_local10.getSprite() + "_mask")), _local8, "overlay");
};
_local5.upgrade(_local11, _local10, _local7);
_local3.push(_local5);
};
_local4++;
};
return (_local3);
}
public function generateUnits(_arg1:Array):Array{
var _local4:TileSwatch;
var _local5:String;
var _local6:UnitData;
var _local7:GameUnit;
var _local8:Unit;
var _local9:TileSheet;
var _local2:Array = new Array();
var _local3:int;
while (_local3 < units.length) {
_local4 = palette[units[_local3].swatch];
if (_local4.getTeam() > 0){
_local5 = _local4.getName();
_local6 = UnitManager.getInstance().get(_local5);
if (_local6 != null){
_local7 = new GameUnit(TileSheetManager.getInstance().getColorised(_local6.getSprite(), _arg1[(_local4.getTeam() - 1)].getTeam().getColor()));
_local8 = new Unit(_local7, _local6, units[_local3].x, units[_local3].y, _arg1[(_local4.getTeam() - 1)]);
_local9 = (_local8.getGameUnit().getSprite() as TileSheet);
if (_local8.getX() > (width / 2)){
_local9.playAnimation("left_idle");
} else {
_local9.playAnimation("right_idle");
};
_local2.push(_local8);
};
};
_local3++;
};
return (_local2);
}
public function getHeight():int{
return (height);
}
}
}//package com.gamedozer.battalion.data
class UnitHelper {
public var y:int;
public var swatch:int;
public var x:int;
private function UnitHelper(_arg1:int, _arg2:int, _arg3:int){
swatch = _arg1;
x = _arg2;
y = _arg3;
}
}
Section 8
//MapSettings (com.gamedozer.battalion.data.MapSettings)
package com.gamedozer.battalion.data {
import com.gamedozer.battalion.ui.*;
public class MapSettings {
protected var campaignName:String;
protected var campaign:int;
protected var map:Map;
protected var resources:int;
protected var rounds:int;
protected var difficulty:int;
protected var teams:Array;
public function MapSettings(_arg1:int, _arg2:int, _arg3:int, _arg4:String="", _arg5:int=-1){
rounds = _arg1;
difficulty = _arg3;
resources = _arg2;
difficulty = _arg3;
campaign = _arg5;
campaignName = _arg4;
teams = new Array();
}
public function getTeams():Array{
return (teams);
}
public function setCampaignName(_arg1:String):void{
campaignName = _arg1;
}
public function getCampaign():int{
return (campaign);
}
public function setCampaign(_arg1:int):void{
campaign = _arg1;
}
public function getTeam(_arg1:int):Team{
return (teams[_arg1]);
}
public function setMap(_arg1:Map):void{
map = _arg1;
}
public function getRounds():int{
return (rounds);
}
public function toXML():XML{
var _local1 = ((((((((" <mapsettings rounds=\"" + rounds) + "\" resources=\"0\" campaignname= \"") + campaignName) + "\" campaign=\"") + campaign) + "\" difficulty=\"") + difficulty) + "\"> <teams> ");
var _local2:int;
while (_local2 < teams.length) {
_local1 = (_local1 + teams[_local2].toXML());
_local2++;
};
_local1 = (_local1 + "</teams> </mapsettings>");
return (new XML(_local1));
}
public function addTeam(_arg1:Team):void{
teams.push(_arg1);
}
public function getMap():Map{
return (map);
}
public function setRounds(_arg1:int):void{
rounds = _arg1;
}
public function setResources(_arg1:int):void{
resources = _arg1;
}
public function getResources():int{
return (resources);
}
public function getCampaignName():String{
return (campaignName);
}
public static function getFromXML(_arg1:XML):MapSettings{
var _local6:Team;
var _local2:MapSettings = new MapSettings(parseInt(_arg1.@rounds), parseInt(_arg1.@resources), parseInt(_arg1.@difficulty), _arg1.@campaignname, parseInt(_arg1.@campaign));
var _local3:XMLList = _arg1.teams..team;
var _local4:int;
while (_local4 < _local3.length()) {
if (_local3[_local4].controllertype.@value == "AI"){
_local3[_local4].difficulty.@value = _local2.difficulty;
} else {
_local3[_local4].difficulty.@value = 1;
};
_local6 = Team.getFromXML(_local3[_local4]);
_local2.addTeam(_local6);
_local4++;
};
var _local5:String = _arg1.@map;
return (_local2);
}
}
}//package com.gamedozer.battalion.data
Section 9
//Modifier (com.gamedozer.battalion.data.Modifier)
package com.gamedozer.battalion.data {
import flash.display.*;
public class Modifier {
protected var effects:Array;
protected var name:String;
protected var visible:Boolean;
protected var type:String;
protected var image:String;
protected var description:String;
public function Modifier(_arg1:String, _arg2:String="", _arg3:String=null, _arg4:Boolean=false, _arg5:String=""){
name = _arg1;
description = _arg2;
image = _arg3;
visible = _arg4;
type = _arg5;
effects = new Array();
}
public function getName():String{
return (name);
}
public function getVisible():Boolean{
return (visible);
}
public function getImage():String{
return (image);
}
public function getDescription():String{
return (description);
}
public function toString():String{
var _local1 = (name + " ");
var _local2:int;
while (_local2 < effects.length) {
_local1 = (_local1 + (effects[_local2] + " "));
_local2++;
};
return (_local1);
}
public function removeEffect(_arg1:ModifierEffect):void{
var _local2:int = (effects.length - 1);
while (_local2 >= 0) {
if (effects[_local2] == _arg1){
effects.splice(_local2, 1);
return;
};
_local2--;
};
}
public function apply(_arg1:String, _arg2:Unit, _arg3:Number):Number{
var _local4:int;
if (_arg1.toLowerCase() == type.toLowerCase()){
_local4 = 0;
while (_local4 < effects.length) {
_arg3 = effects[_local4].apply(_arg2, _arg3);
_local4++;
};
};
return (_arg3);
}
public function setVisible(_arg1:Boolean):void{
visible = _arg1;
}
public function addEffect(_arg1:ModifierEffect):void{
effects.push(_arg1);
}
}
}//package com.gamedozer.battalion.data
Section 10
//ModifierEffect (com.gamedozer.battalion.data.ModifierEffect)
package com.gamedozer.battalion.data {
public class ModifierEffect {
protected var value:String;
protected var effects:Array;
public function ModifierEffect(_arg1:String){
value = _arg1.toLowerCase();
effects = new Array();
}
public function removeEffect(_arg1:ModifierEffect):void{
var _local2:int = (effects.length - 1);
while (_local2 >= 0) {
if (effects[_local2] == _arg1){
effects.splice(_local2, 1);
return;
};
_local2--;
};
}
public function toString():String{
var _local1 = (value + " ");
var _local2:int;
while (_local2 < effects.length) {
_local1 = (_local1 + (effects[_local2] + " "));
_local2++;
};
return (_local1);
}
public function apply(_arg1:Unit, _arg2:Number):Number{
var _local3:String;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
if (value == "0"){
return (0);
};
if (value == "infinity"){
return (Number.POSITIVE_INFINITY);
};
if (value.charAt(0) == "+"){
_local3 = value.substring(1);
if (_local3.charAt((_local3.length - 1)) == "%"){
_local4 = Number(_local3.substring(0, (_local3.length - 1)));
if (!isNaN(_local4)){
_local4 = (_local4 / 100);
return ((_arg2 + (_local4 * _arg2)));
};
} else {
_local5 = Number(_local3);
if (!isNaN(_local5)){
return ((_arg2 + _local5));
};
};
} else {
if (value.charAt(0) == "-"){
_local3 = value.substring(1);
if (_local3.charAt((_local3.length - 1)) == "%"){
_local6 = Number(_local3.substring(0, (_local3.length - 1)));
if (!isNaN(_local6)){
_local6 = (_local6 / 100);
return ((_arg2 - (_local6 * _arg2)));
};
} else {
_local7 = Number(_local3);
if (!isNaN(_local7)){
return ((_arg2 + _local7));
};
};
} else {
if (value.charAt(0) == "*"){
_local3 = value.substring(1);
_local8 = Number(_local3);
if (!isNaN(_local8)){
return ((_arg2 * _local8));
};
} else {
_local9 = Number(value);
if (!isNaN(_local9)){
return (_local9);
};
};
};
};
throw (new Error("ModifierEffect::Modify returned without affecting anything!"));
}
public function addEffect(_arg1:ModifierEffect):void{
effects.push(_arg1);
}
}
}//package com.gamedozer.battalion.data
Section 11
//ModifierEffectMatch (com.gamedozer.battalion.data.ModifierEffectMatch)
package com.gamedozer.battalion.data {
public class ModifierEffectMatch extends ModifierEffect {
protected var type:String;
public function ModifierEffectMatch(_arg1:String, _arg2:String){
super(_arg2);
type = _arg1.toLowerCase();
}
override public function apply(_arg1:Unit, _arg2:Number):Number{
if (_arg1 == null){
return (_arg2);
};
if (type == "unittype"){
if (UnitData.unitTypes[_arg1.getUnitData().getUnitType()].toLowerCase() != value){
return (_arg2);
};
} else {
if (type.toLowerCase() == "movementtype"){
if (UnitData.movementTypes[_arg1.getUnitData().getMovementType()].toLowerCase() != value){
return (_arg2);
};
} else {
if (type.toLowerCase() == "weapontype"){
if (UnitData.weaponTypes[_arg1.getUnitData().getWeaponType()].toLowerCase() != value){
return (_arg2);
};
} else {
if (type.toLowerCase() == "armortype"){
if (UnitData.armorTypes[_arg1.getUnitData().getArmorType()].toLowerCase() != value){
return (_arg2);
};
} else {
if (type.toLowerCase() == "modifier"){
if (!_arg1.getUnitData().hasModifier(value)){
return (_arg2);
};
} else {
throw (new Error("ModifierEffect::Nothing matched, invalid modifier match!"));
};
};
};
};
};
var _local3:int;
while (_local3 < effects.length) {
_arg2 = effects[_local3].apply(_arg1, _arg2);
_local3++;
};
return (_arg2);
}
override public function toString():String{
return (type);
}
}
}//package com.gamedozer.battalion.data
Section 12
//ModifierManager (com.gamedozer.battalion.data.ModifierManager)
package com.gamedozer.battalion.data {
import flash.display.*;
import flash.utils.*;
public class ModifierManager {
protected var modifiers:Dictionary;
private static var singleton:ModifierManager;
public function ModifierManager(){
singleton = this;
modifiers = new Dictionary();
}
public function add(_arg1:Modifier):void{
modifiers[_arg1.getName()] = _arg1;
}
public function importXML(_arg1:XML):void{
var _local4:Boolean;
var _local5:Modifier;
var _local6:XMLList;
var _local7:int;
var _local8:XML;
var _local9:String;
var _local10:ModifierEffect;
if (_arg1 == null){
return;
};
var _local2:XMLList = _arg1..modifier;
var _local3:int;
while (_local3 < _local2.length()) {
_local4 = false;
if (_local2[_local3].visible.@value.toLowerCase() == "true"){
_local4 = true;
};
_local5 = new Modifier(_local2[_local3].@name, _local2[_local3].description.@value, _local2[_local3].image.@value, _local4, _local2[_local3].modify.@type);
_local6 = _local2[_local3].modify.children();
_local7 = 0;
while (_local7 < _local6.length()) {
_local8 = _local6[_local7];
_local9 = _local8.localName().toLowerCase();
if (_local9 == "effect"){
_local5.addEffect(new ModifierEffect(_local8.@value));
} else {
if (_local9 == "match"){
_local10 = new ModifierEffectMatch(_local8.@type, _local8.@value);
_local5.addEffect(_local10);
handleEffect(_local8, _local10);
};
};
_local7++;
};
modifiers[_local5.getName()] = _local5;
_local3++;
};
}
public function remove(_arg1:Modifier):void{
delete modifiers[_arg1.getName()];
}
public function get(_arg1:String):Modifier{
if (modifiers[_arg1] == null){
trace(("ModifierManager::Could not get modifier: " + _arg1));
};
return (modifiers[_arg1]);
}
public function handleEffect(_arg1:XML, _arg2:ModifierEffect=null):void{
var _local5:XML;
var _local6:String;
var _local7:ModifierEffect;
var _local3:XMLList = _arg1.children();
var _local4:int;
while (_local4 < _local3.length()) {
_local5 = _local3[_local4];
_local6 = _local5.localName().toLowerCase();
if (_local6 == "effect"){
_arg2.addEffect(new ModifierEffect(_local5.@value));
} else {
if (_local6 == "match"){
_local7 = new ModifierEffectMatch(_local5.@type, _local5.@value);
_arg2.addEffect(_local7);
handleEffect(_local5, _local7);
};
};
_local4++;
};
}
public function clear():void{
modifiers = new Dictionary();
}
public static function getInstance():ModifierManager{
if (singleton == null){
trace("ModifierManager::No instance exists");
};
return (singleton);
}
}
}//package com.gamedozer.battalion.data
Section 13
//Node (com.gamedozer.battalion.data.Node)
package com.gamedozer.battalion.data {
public class Node {
public var f:Number;
public var g:Number;
public var h:Number;
public var state:int;
public var previous:Node;
protected var connections:Array;
public var iteration:int;
static const OPEN:int = 0;
static const CLOSED:int = 1;
public function Node(_arg1:Node=null, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
previous = _arg1;
g = _arg2;
h = _arg3;
f = _arg4;
state = Node.OPEN;
iteration = -1;
connections = new Array();
}
public function addConnection(_arg1:Node):void{
if (!isConnected(_arg1)){
connections.push(_arg1);
};
}
public function getCost(... _args):Number{
return (1);
}
public function compare(_arg1:Node):int{
if (_arg1.f > f){
return (1);
};
if (_arg1.f < f){
return (-1);
};
return (0);
}
public function removeConnection(_arg1:Node):void{
var _local2:int = (connections.length - 1);
while (_local2 >= 0) {
if (connections[_local2] == _arg1){
connections.splice(_local2, 1);
};
_local2--;
};
}
function reset(_arg1:Node=null, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0):void{
previous = _arg1;
g = _arg2;
h = _arg3;
f = _arg4;
state = Node.OPEN;
iteration = -1;
}
public function getHeuristic(_arg1:Node):Number{
return (0);
}
public function getConnections():Array{
return (connections);
}
public function isConnected(_arg1:Node):Boolean{
var _local2:int;
while (_local2 < connections.length) {
if (connections[_local2] == _arg1){
return (true);
};
_local2++;
};
return (false);
}
}
}//package com.gamedozer.battalion.data
Section 14
//Team (com.gamedozer.battalion.data.Team)
package com.gamedozer.battalion.data {
import com.kongregate.as3.client.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.controllers.*;
public class Team {
protected var difficulty:int;
protected var rank:int;
protected var teamName:String;
protected var name:String;
protected var active:Boolean;
protected var allies:Array;
protected var avatar:String;
protected var stats:Array;
protected var color:uint;
protected var controllerType:String;
public static const STRUCTURES_LOST:int = 4;
public static const FINAL_SCORE:int = 6;
public static const UNITS_KILLED:int = 1;
public static const UNITS_BUILT:int = 0;
public static const RESOURCES_COLLECTED:int = 5;
public static const UNITS_LOST:int = 2;
public static const TIME_TAKEN:int = 7;
public static const STATISTICS:int = 8;
public static const STRUCTURES_CAPTURED:int = 3;
public function Team(_arg1:String, _arg2:String, _arg3:String, _arg4:int, _arg5:uint, _arg6:String, _arg7:int, _arg8:Boolean=true){
name = _arg1;
teamName = _arg2;
color = _arg5;
avatar = _arg3;
rank = _arg4;
controllerType = _arg6;
difficulty = _arg7;
active = _arg8;
stats = new Array();
var _local9:int;
while (_local9 < STATISTICS) {
stats[_local9] = 0;
_local9++;
};
allies = new Array();
}
public function getName():String{
return (name);
}
public function getTeamName():String{
return (teamName);
}
public function calculateFinalScore():void{
submitScores();
var _local1:int;
_local1 = (_local1 + (stats[UNITS_BUILT] * 500));
_local1 = (_local1 + (stats[UNITS_KILLED] * 1000));
_local1 = (_local1 - (stats[UNITS_LOST] * 100));
_local1 = (_local1 + (stats[STRUCTURES_CAPTURED] * 2500));
_local1 = (_local1 - (stats[STRUCTURES_LOST] * 1000));
_local1 = (_local1 + stats[RESOURCES_COLLECTED]);
_local1 = Math.max(0, _local1);
stats[FINAL_SCORE] = _local1;
}
public function getControllerType():String{
return (controllerType);
}
public function getAvatar():String{
return (avatar);
}
public function isAllied(_arg1:int):Boolean{
return (!((allies.indexOf(_arg1) == -1)));
}
public function setActive(_arg1:Boolean):void{
active = _arg1;
}
public function getStatistic(_arg1:int):int{
return (stats[_arg1]);
}
public function toXML():XML{
var _local1 = ((((((((((((((((" <team active=\"" + ((active == true)) ? "true" : "false") + "\"> <name value=\"") + name) + "\"/> <teamname value=\"") + teamName) + "\"/> <color value=\"") + color.toString(16)) + "\"/> <avatar value=\"") + avatar) + "\"/> <rank value=\"") + rank) + "\"/> <controllertype value=\"") + controllerType) + "\"/> <difficulty value=\"") + difficulty) + "\"/>");
_local1 = (_local1 + (("<stats value=\"" + stats.join(",")) + "\"/>"));
if (allies.length > 0){
_local1 = (_local1 + (("<allies value=\"" + allies.join(",")) + "\"/>"));
};
_local1 = (_local1 + "</team>");
return (new XML(_local1));
}
private function submitScores():void{
}
public function getRank():int{
return (rank);
}
public function getColor():uint{
return (color);
}
public function addStatistic(_arg1:int, _arg2:int):void{
var _local3:String;
stats[_arg1] = (stats[_arg1] + _arg2);
if (_arg2 != 0){
if (controllerType != "AI"){
_local3 = "";
switch (_arg1){
case UNITS_KILLED:
_local3 = "Enemy Units Destroyed";
break;
case UNITS_LOST:
_local3 = "Allied Units Lost";
break;
case UNITS_BUILT:
_local3 = "Allied Units Built";
break;
case STRUCTURES_CAPTURED:
_local3 = "Enemy Structures Captured";
break;
case STRUCTURES_LOST:
_local3 = "Allied Structures Lost";
break;
case RESOURCES_COLLECTED:
_local3 = "Resources Collected";
break;
case TIME_TAKEN:
_local3 = "Time Taken";
break;
};
if (_local3 != ""){
KongregateAPI.getInstance().stats.submit(_local3, _arg2);
};
};
};
}
public function getDifficulty():int{
return (difficulty);
}
public function createController():Controller{
var _local1:Controller;
if (controllerType == "Human"){
_local1 = new HumanController(this);
} else {
if (controllerType == "AI"){
_local1 = new AIController(this);
} else {
_local1 = new Controller(this);
};
};
return (_local1);
}
public function addAlly(_arg1:int):void{
allies.push(_arg1);
}
public function getActive():Boolean{
return (active);
}
public static function getFromXML(_arg1:XML):Team{
var _local9:String;
var _local10:Array;
var _local11:int;
var _local12:Array;
var _local2:Boolean;
var _local3:String = _arg1.@active;
if (_local3.toLowerCase().charAt(0) == "t"){
_local2 = true;
};
var _local4:Number = parseFloat(_arg1.difficulty.@value);
var _local5:String = _arg1.controllertype.@value;
if (((isNaN(_local4)) || ((_local5 == "Human")))){
_local4 = 1;
};
var _local6:Team = new Team(_arg1.name.@value, _arg1.teamname.@value, _arg1.avatar.@value, parseInt(_arg1.rank.@value), parseInt(_arg1.color.@value, 16), _local5, _local4, _local2);
var _local7:String = _arg1.stats.@value;
if (_local7 != ""){
_local10 = _local7.split(",");
_local11 = 0;
while (_local11 < _local10.length) {
_local6.addStatistic(_local11, parseInt(_local10[_local11]));
_local11++;
};
};
var _local8:String = _arg1.allies.@value;
if (_local8 != ""){
_local12 = _local8.split(",");
_local11 = 0;
while (_local11 < _local12.length) {
_local6.addAlly(parseInt(_local12[_local11]));
_local11++;
};
};
return (_local6);
}
}
}//package com.gamedozer.battalion.data
Section 15
//Terrain (com.gamedozer.battalion.data.Terrain)
package com.gamedozer.battalion.data {
import flash.display.*;
public class Terrain {
protected var sprite:String;
protected var name:String;
protected var cost:Number;
protected var description:String;
protected var miniMapImage:String;
protected var resources:int;// = 0
protected var modifiers:Array;
public function Terrain(_arg1:String, _arg2:Number, _arg3:String, _arg4:String, _arg5:String=""){
name = _arg1;
cost = _arg2;
description = _arg3;
miniMapImage = _arg4;
sprite = _arg5;
resources = 0;
modifiers = new Array();
}
public function getName():String{
return (name);
}
public function removeModifier(_arg1:Modifier):void{
var _local2:int = (modifiers.length - 1);
while (_local2 >= 0) {
if (modifiers[_local2] == _arg1){
modifiers.splice(_local2, 1);
return;
};
_local2--;
};
}
public function getCost():Number{
return (cost);
}
public function getDescription():String{
return (description);
}
public function getMiniMapImage():String{
return (miniMapImage);
}
public function getModifiers():Array{
return (modifiers);
}
public function addModifier(_arg1:Modifier):void{
modifiers.push(_arg1);
}
public function hasModifier(_arg1:String):Boolean{
var _local2:int;
while (_local2 < modifiers.length) {
if (modifiers[_local2].getName().toLowerCase() == _arg1.toLowerCase()){
return (true);
};
_local2++;
};
return (false);
}
public function clone():Terrain{
var _local1:Terrain = new Terrain(name, cost, description, miniMapImage, sprite);
var _local2:int;
while (_local2 < modifiers.length) {
_local1.addModifier(modifiers[_local2]);
_local2++;
};
return (_local1);
}
public function applyModifiers(_arg1:String, _arg2:Unit, _arg3:Number):Number{
var _local4:int;
while (_local4 < modifiers.length) {
_arg3 = modifiers[_local4].apply(_arg1, _arg2, _arg3);
_local4++;
};
return (_arg3);
}
public function getSprite():String{
return (sprite);
}
}
}//package com.gamedozer.battalion.data
Section 16
//Tile (com.gamedozer.battalion.data.Tile)
package com.gamedozer.battalion.data {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.ui.*;
import com.gamedozer.battalion.display.*;
import flash.text.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
import flash.filters.*;
public class Tile extends Node {
protected var structure:GameSprite;
protected var unit:Unit;
protected var controller:Controller;
protected var baseTerrain:Terrain;
protected var resources:int;
protected var chunks:int;
protected var miniMapSprite:TileSheet;
protected var terrain:Terrain;
protected var gameTile:GameTile;
protected var resourcesField:TextField;
protected var captureBar:TileSheet;
protected var capturer:Unit;
protected var x:int;
protected var y:int;
protected var m_textField:TextField;
public static const k_astarFlagForceCost1:int = 2;
protected static const flagX:Number = 43;
protected static const flagY:Number = -5;
public static const k_allowDebugTextfield:Boolean = false;
public static const k_astarFlagUnused3:int = 8;
public static const k_astarFlagIgnoreLastNode:int = 1;
public static const k_astarFlagIgnoreUnits:int = 4;
protected static const flagH:Number = 20;
public function Tile(_arg1:GameTile, _arg2:int, _arg3:int, _arg4:Terrain, _arg5:Unit=null){
terrain = (baseTerrain = _arg4);
x = _arg2;
y = _arg3;
gameTile = _arg1;
gameTile.x = (x * TileManager.getInstance().getWidth());
gameTile.y = (y * TileManager.getInstance().getHeight());
unit = _arg5;
controller = null;
structure = null;
capturer = null;
chunks = GameManager.TILE_CHUNKS;
resources = 0;
if (k_allowDebugTextfield){
m_textField = new DefaultTextField();
m_textField.filters = [new GlowFilter(0)];
gameTile.addChild(m_textField);
} else {
m_textField = null;
};
resourcesField = new DefaultTextField(0xFFFFFF, TextFormatAlign.CENTER);
resourcesField.text = "0";
resourcesField.y = ((TileManager.getInstance().getHeight() - resourcesField.textHeight) - 5);
resourcesField.width = TileManager.getInstance().getWidth();
}
public function canBeMovedOnBy(_arg1:Unit):Boolean{
return (!((getMovementCost(_arg1) == Number.POSITIVE_INFINITY)));
}
public function setUnit(_arg1:Unit):void{
if (((((!((unit == null))) && (!((_arg1 == null))))) && (!((unit == _arg1))))){
throw (new Error("Tile::Unit trying to be placed on a Tile, while a unit already exists on it"));
};
unit = _arg1;
}
public function getController():Controller{
return (controller);
}
protected function updateCaptureBar():void{
var _local1:Number = (flagY + (flagH * (1 - (chunks / GameManager.TILE_CHUNKS))));
captureBar.x = (flagX - 1);
TweenManager.getInstance().removeTweens(captureBar);
if ((((((this.getUnit() == null)) || ((this.getUnit().getController() == this.getController())))) || (!(this.getUnit().getUnitData().hasModifier("Capture"))))){
captureBar.filters = [];
captureBar.y = _local1;
return;
};
var _local2:uint = this.getUnit().getController().getTeam().getColor();
captureBar.filters = [new GlowFilter(_local2)];
TweenManager.getInstance().add(new Tween(captureBar, Quad.easeIn, ["y"], [captureBar.y], [_local1], 1000), TweenManager.SEQUENTIAL);
}
public function getMovementCost(_arg1:Unit):Number{
return (terrain.applyModifiers("movementCost", _arg1, terrain.getCost()));
}
public function setController(_arg1:Controller):void{
var _local2:uint = 4286414205;
controller = _arg1;
if (controller == null){
if ((structure is ColoredSprite)){
(structure as ColoredSprite).setColor(_local2);
} else {
(structure as TileSheet).setTileSheet(TileSheetManager.getInstance().getColorised(terrain.getName(), _local2).getTileSheet());
};
captureBar = TileSheetManager.getInstance().getColorised("flag", _local2);
} else {
if ((structure is ColoredSprite)){
(structure as ColoredSprite).setColor(controller.getTeam().getColor());
} else {
(structure as TileSheet).setTileSheet(TileSheetManager.getInstance().getColorised(terrain.getName(), controller.getTeam().getColor()).getTileSheet());
};
captureBar = TileSheetManager.getInstance().getColorised("flag", controller.getTeam().getColor());
};
gameTile.setFlag(captureBar);
captureBar.playAnimation("default");
updateCaptureBar();
updateMiniMap();
}
public function upgrade(_arg1:GameSprite, _arg2:Terrain, _arg3:Controller=null):void{
if (structure != null){
throw (new Error("Tile::Trying to upgrade a tile which already has a structure on it"));
};
structure = _arg1;
var _local4:uint = 4294967295;
if (_arg3 != null){
_local4 = _arg3.getTeam().getColor();
};
captureBar = TileSheetManager.getInstance().getColorised("flag", _local4);
captureBar.playAnimation("default");
updateCaptureBar();
gameTile.setStructure(structure);
gameTile.setFlag(captureBar);
terrain = _arg2;
controller = _arg3;
updateMiniMap();
}
public function isAdjacentTo(_arg1:Tile):Boolean{
if (_arg1 == this){
trace("Tile: Can't be adjacent to ourself.");
return (false);
};
if (_arg1.getX() == getX()){
if ((((_arg1.getY() == (getY() + 1))) || ((_arg1.getY() == (getY() - 1))))){
return (true);
};
};
if (_arg1.getY() == getY()){
if ((((_arg1.getX() == (getX() + 1))) || ((_arg1.getX() == (getX() - 1))))){
return (true);
};
};
return (false);
}
public function setChunks(_arg1:int):void{
chunks = _arg1;
updateCaptureBar();
}
public function getChunks():int{
return (chunks);
}
public function getGameTile():GameTile{
return (gameTile);
}
public function getStructure():GameSprite{
return (structure);
}
public function seaBordered():Boolean{
var _local1:Array = getConnections();
var _local2:int;
while (_local2 < _local1.length) {
if (_local1[_local2].getTerrain().hasModifier("Water")){
return (true);
};
_local2++;
};
return (false);
}
public function getX():int{
return (x);
}
public function getY():int{
return (y);
}
public function showText(_arg1:String, _arg2:uint=0xFFFFFF):void{
if (!k_allowDebugTextfield){
return;
};
m_textField.textColor = _arg2;
m_textField.text = _arg1;
m_textField.parent.setChildIndex(m_textField, (m_textField.parent.numChildren - 1));
}
override public function getCost(... _args):Number{
var _local6:Boolean;
var _local2:Unit = _args[0];
var _local3:int = _args[1];
var _local4:Boolean = _args[2];
if ((_local3 & Tile.k_astarFlagForceCost1)){
return (1);
};
if (((!((unit == null))) && (!((_local3 & k_astarFlagIgnoreUnits))))){
if (!unit.getController().isAllied(_args[0].getController())){
if (!unit.isCloaked()){
_local6 = !(((_local3 & Tile.k_astarFlagIgnoreLastNode) == 0));
if (!((_local4) && (_local6))){
return (Number.POSITIVE_INFINITY);
};
};
};
};
var _local5:Number = terrain.applyModifiers("movementCost", _local2, terrain.getCost());
return (_local5);
}
override public function getHeuristic(_arg1:Node):Number{
var a_tile:Tile;
var a_node = _arg1;
try {
a_tile = (a_node as Tile);
return ((Math.abs((x - a_tile.getX())) + Math.abs((y - a_tile.getY()))));
} catch(e:Error) {
};
return (0);
}
protected function updateResources():void{
if (resources > 0){
if (resourcesField.parent == null){
gameTile.addChild(resourcesField);
};
resourcesField.text = ("" + resources);
} else {
if (resourcesField.parent != null){
gameTile.removeChild(resourcesField);
};
};
}
public function takeResources(_arg1:Number=1):Number{
var _local2:int = (getTerrain().applyModifiers("resources", null, 0) * _arg1);
var _local3:Number = getTerrain().applyModifiers("reducedResources", null, _local2);
if (_local2 > resources){
resources = 0;
updateResources();
return (_local3);
};
resources = (resources - _local2);
updateResources();
return (_local2);
}
public function getFlag():GameSprite{
return (captureBar);
}
public function setResources(_arg1:int):void{
resources = _arg1;
updateResources();
}
public function isStructure():Boolean{
return (!((structure == null)));
}
public function toString():String{
return ((((("[Tile: " + x) + ",") + y) + " ]"));
}
public function setCapturer(_arg1:Unit):void{
capturer = _arg1;
if (capturer == null){
chunks = GameManager.TILE_CHUNKS;
};
}
public function getResources():int{
return (resources);
}
public function getCapturer():Unit{
return (capturer);
}
public function downgrade():void{
if (structure == null){
throw (new Error("Tile::Trying to downgrade a tile which does not have a structure on it"));
};
gameTile.setStructure(null);
gameTile.setFlag(null);
structure = null;
controller = null;
capturer = null;
captureBar = null;
terrain = baseTerrain;
chunks = GameManager.TILE_CHUNKS;
updateMiniMap();
}
public function getUnit():Unit{
return (unit);
}
public function updateMiniMap():void{
if (miniMapSprite != null){
GameManager.getInstance().getMiniMap().getMap().removeChild(miniMapSprite);
};
if (isStructure()){
if (controller == null){
miniMapSprite = TileSheetManager.getInstance().get("minimap_overlay");
} else {
miniMapSprite = TileSheetManager.getInstance().getColorised("minimap_overlay", controller.getTeam().getColor());
};
miniMapSprite.playAnimation(getTerrain().getMiniMapImage());
miniMapSprite.x = (x * TileManager.getInstance().getMiniMapWidth());
miniMapSprite.y = (y * TileManager.getInstance().getMiniMapHeight());
GameManager.getInstance().getMiniMap().getMap().addChild(miniMapSprite);
};
}
public function isSeaBased():Boolean{
return (getTerrain().hasModifier("Water"));
}
public function getTerrain():Terrain{
return (terrain);
}
}
}//package com.gamedozer.battalion.data
Section 17
//TileManager (com.gamedozer.battalion.data.TileManager)
package com.gamedozer.battalion.data {
import flash.display.*;
import flash.utils.*;
public class TileManager {
protected var miniMapWidth:int;
protected var width:int;
protected var height:int;
protected var miniMapHeight:int;
protected var terrain:Dictionary;
private static var singleton:TileManager;
public function TileManager(_arg1:int, _arg2:int, _arg3:int, _arg4:int){
singleton = this;
width = _arg1;
height = _arg2;
miniMapWidth = _arg3;
miniMapHeight = _arg4;
terrain = new Dictionary();
}
public function remove(_arg1:Terrain):void{
delete terrain[_arg1.getName()];
}
public function get(_arg1:String):Terrain{
if (terrain[_arg1] == null){
trace(("TileManager::Could not get terrain: " + _arg1));
return (null);
};
return (terrain[_arg1].clone());
}
public function add(_arg1:Terrain):void{
terrain[_arg1.getName()] = _arg1;
}
public function clear():void{
terrain = new Dictionary();
}
public function getWidth():int{
return (width);
}
public function importXML(_arg1:XML):void{
var _local4:Terrain;
var _local5:XMLList;
var _local6:int;
if (_arg1 == null){
return;
};
var _local2:XMLList = _arg1..terrain;
var _local3:int;
while (_local3 < _local2.length()) {
_local4 = new Terrain(_local2[_local3].@name, Number(_local2[_local3].cost.@value), _local2[_local3].description.@value, _local2[_local3].minimapimage.@value, _local2[_local3].sprite.@value);
_local5 = _local2[_local3]..modifier;
_local6 = 0;
while (_local6 < _local5.length()) {
if (_local5[_local6].@type != ""){
_local4.addModifier(ModifierManager.getInstance().get(_local5[_local6].@type));
};
_local6++;
};
terrain[_local4.getName()] = _local4;
_local3++;
};
}
public function getMiniMapHeight():int{
return (miniMapHeight);
}
public function getMiniMapWidth():int{
return (miniMapWidth);
}
public function getHeight():int{
return (height);
}
public static function getInstance():TileManager{
if (singleton == null){
trace("TileManager::No instance exists");
};
return (singleton);
}
}
}//package com.gamedozer.battalion.data
Section 18
//Unit (com.gamedozer.battalion.data.Unit)
package com.gamedozer.battalion.data {
import flash.display.*;
import com.gamedozer.battalion.ui.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.audio.*;
import flash.geom.*;
import flash.text.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
import flash.filters.*;
public class Unit {
protected var gameUnit:GameUnit;
protected var controller:Controller;
protected var miniMapSprite:TileSheet;
protected var moved:Boolean;
protected var vehicle:GameSprite;
protected var repairing:Boolean;
protected var deployed:Boolean;
protected var unitData:UnitData;
protected var baseUnitData:UnitData;
protected var health:Number;
protected var fired:Boolean;
protected var cloaked:Boolean;
protected var x:int;
protected var y:int;
protected var m_textField:TextField;
protected var disabled:Boolean;
public function Unit(_arg1:GameUnit, _arg2:UnitData, _arg3:int=0, _arg4:int=0, _arg5:Controller=null){
unitData = (baseUnitData = _arg2);
x = _arg3;
y = _arg4;
gameUnit = _arg1;
gameUnit.x = (x * TileManager.getInstance().getWidth());
gameUnit.y = (y * TileManager.getInstance().getHeight());
controller = _arg5;
disabled = false;
if (controller == null){
miniMapSprite = TileSheetManager.getInstance().get("minimap_overlay");
} else {
miniMapSprite = TileSheetManager.getInstance().getColorised("minimap_overlay", controller.getTeam().getColor());
};
miniMapSprite.playAnimation("minimap_unit");
miniMapSprite.x = (x * TileManager.getInstance().getMiniMapWidth());
miniMapSprite.y = (y * TileManager.getInstance().getMiniMapHeight());
health = unitData.getHealth();
moved = false;
fired = false;
deployed = false;
repairing = false;
gameUnit.setHealth(1);
if (Tile.k_allowDebugTextfield){
m_textField = new DefaultTextField();
m_textField.autoSize = "center";
m_textField.width = 50;
m_textField.multiline = true;
m_textField.y = (m_textField.y + 10);
m_textField.filters = [new DropShadowFilter()];
gameUnit.addChild(m_textField);
} else {
m_textField = null;
};
}
public function disable():void{
disabled = true;
}
public function getName():String{
return (unitData.getName());
}
public function hasFired():Boolean{
return (fired);
}
public function getArmorType():int{
return (unitData.getArmorType());
}
public function getRange():Number{
return (unitData.getRange());
}
public function enable():void{
disabled = false;
}
public function getWeaponRangeMin():Number{
return (unitData.getWeaponRangeMin());
}
public function isDeployed():Boolean{
return (deployed);
}
public function isRanged():Boolean{
if ((((unitData.getWeaponRangeMin() > 1)) || ((unitData.getWeaponRangeMax() > 1)))){
return (true);
};
return (false);
}
public function getController():Controller{
return (controller);
}
public function getGameUnit():GameUnit{
return (gameUnit);
}
public function getWeaponRangeMax():Number{
return (unitData.getWeaponRangeMax());
}
public function isInActionQueue():Boolean{
var _local1:ActionManager = ActionManager.getInstance();
if (_local1.hasActionWithUnit(this)){
return (true);
};
return (false);
}
public function setController(_arg1:Controller):void{
if (((((!((controller == null))) && (!((_arg1 == null))))) && (!((controller == _arg1))))){
throw (new Error("Unit::Setting controller to controlled unit"));
};
controller = _arg1;
}
public function darken():void{
if (isCloaked()){
if (getController() != null){
getGameUnit().transform.colorTransform = new ColorTransform(0.6, 0.6, 0.6, getController().getCloakVisibility());
} else {
getGameUnit().transform.colorTransform = new ColorTransform(0.6, 0.6, 0.6, 0);
};
} else {
getGameUnit().transform.colorTransform = new ColorTransform(0.6, 0.6, 0.6);
};
getGameUnit().setIdle(true);
}
public function isUpgraded():Boolean{
return (!((vehicle == null)));
}
public function getHealthPercentage():Number{
return ((health / unitData.getHealth()));
}
public function isRepairing():Boolean{
return (repairing);
}
public function setCloaked(_arg1:Boolean, _arg2:Boolean=false, _arg3:Boolean=true):void{
if (_arg2){
if (cloaked){
gameUnit.alpha = controller.getCloakVisibility();
miniMapSprite.alpha = controller.getCloakVisibility();
} else {
gameUnit.alpha = 1;
miniMapSprite.alpha = 1;
};
return;
};
var _local4:Boolean = cloaked;
cloaked = _arg1;
if (!cloaked){
if (_local4 != cloaked){
if (_arg3){
TweenManager.getInstance().add(new Tween(gameUnit, Quad.easeIn, ["alpha"], [controller.getCloakVisibility()], [1], 500), TweenManager.SEQUENTIAL);
SoundSystem.instance.playSound(SoundSystem.instance.createSound("Cloak"));
} else {
gameUnit.alpha = controller.getCloakVisibility();
};
miniMapSprite.alpha = 1;
};
} else {
if (controller != null){
if (((!((_local4 == cloaked))) || (!((gameUnit.alpha == controller.getCloakVisibility()))))){
if (_arg3){
TweenManager.getInstance().add(new Tween(gameUnit, Quad.easeIn, ["alpha"], [1], [controller.getCloakVisibility()], 500), TweenManager.SEQUENTIAL);
SoundSystem.instance.playSound(SoundSystem.instance.createSound("Decloak"));
} else {
gameUnit.alpha = controller.getCloakVisibility();
};
miniMapSprite.alpha = controller.getCloakVisibility();
};
};
};
}
public function getChunks(_arg1:int=4):int{
if (health < 1){
return (0);
};
var _local2:int = Math.ceil(((health / unitData.getHealth()) * _arg1));
return (_local2);
}
public function getBaseUnitData():UnitData{
return (baseUnitData);
}
public function setX(_arg1:int):void{
x = _arg1;
gameUnit.x = (x * TileManager.getInstance().getWidth());
miniMapSprite.x = (x * TileManager.getInstance().getMiniMapWidth());
}
public function setY(_arg1:int):void{
y = _arg1;
gameUnit.y = (y * TileManager.getInstance().getHeight());
miniMapSprite.y = (y * TileManager.getInstance().getMiniMapHeight());
}
public function hasMoved():Boolean{
return (moved);
}
public function upgrade(_arg1:GameSprite, _arg2:UnitData):void{
if (vehicle != null){
throw (new Error("Unit::Trying to upgrade a unit which is already upgraded"));
};
var _local3:GameSprite = this.getGameUnit().getSprite().clone();
vehicle = _arg1;
gameUnit.upgrade(vehicle);
var _local4:Number = (health / unitData.getHealth());
unitData = _arg2;
health = (unitData.getHealth() * _local4);
_local3.scaleX = 0.4;
_local3.scaleY = 0.4;
_local3.x = 0;
_local3.y = ((1 - _local3.scaleX) * BattalionMain.TILE_HEIGHT);
var _local5:Sprite = new Sprite();
_local5.name = "thumbnail";
_local5.graphics.lineStyle(1, 0, 0.85);
_local5.graphics.beginFill(0xF5F5F5, 0.85);
_local5.graphics.drawRect(_local3.x, _local3.y, _local3.width, _local3.height);
_local5.addChild(_local3);
_local5.filters = [new DropShadowFilter()];
gameUnit.addChild(_local5);
}
public function canMove():Boolean{
return ((getRange() > 0));
}
public function getX():int{
return (x);
}
public function getY():int{
return (y);
}
public function getUnitData():UnitData{
return (unitData);
}
public function setDeployed(_arg1:Boolean):void{
deployed = _arg1;
}
public function showText(_arg1:String, _arg2:uint=0xFFFFFF):void{
if (!Tile.k_allowDebugTextfield){
return;
};
m_textField.textColor = _arg2;
m_textField.text = _arg1;
m_textField.parent.setChildIndex(m_textField, (m_textField.parent.numChildren - 1));
}
public function getAttackDamage(_arg1:int):Number{
var _local2:Number = getUnitData().applyModifiers("damage", this, getUnitData().getDamage());
var _local3:Number = (getChunks(GameManager.UNIT_CHUNKS) / GameManager.UNIT_CHUNKS);
var _local4:Number = GameManager.getInstance().getBallisticsModifier(getUnitData().getWeaponType(), _arg1);
return (((_local2 * _local4) * _local3));
}
public function reset():void{
if (!disabled){
moved = false;
fired = false;
getGameUnit().setIdle(false);
} else {
moved = true;
fired = true;
getGameUnit().setIdle(true);
};
}
public function getHealth():Number{
return (health);
}
public function takeDamage(_arg1:Number):void{
health = (health - _arg1);
gameUnit.setHealth((health / unitData.getHealth()));
}
public function setFired(_arg1:Boolean):void{
fired = _arg1;
}
public function isAlive():Boolean{
if (Math.floor(health) > 0){
return (true);
};
return (false);
}
public function clone():Unit{
return (new Unit((gameUnit.clone() as GameUnit), unitData.clone(), x, y, controller));
}
public function isAvailable():Boolean{
return (((((((!(hasMoved())) && (!(hasFired())))) && (!(disabled)))) && (!(isInActionQueue()))));
}
public function isCloaked():Boolean{
return (cloaked);
}
public function setMiniMapSprite(_arg1:TileSheet):void{
miniMapSprite = _arg1;
miniMapSprite.x = (x * TileManager.getInstance().getMiniMapWidth());
miniMapSprite.y = (y * TileManager.getInstance().getMiniMapHeight());
}
public function toString():String{
var _local1:String = ((((("[" + baseUnitData.toString()) + ": ") + x) + ",") + y);
if (isUpgraded()){
_local1 = (_local1 + " (transported)");
};
_local1 = (_local1 + " ]");
return (_local1);
}
public function setHealth(_arg1:Number):void{
health = _arg1;
gameUnit.setHealth((health / unitData.getHealth()));
}
public function setMoved(_arg1:Boolean):void{
moved = _arg1;
}
public function setRepairing(_arg1:Boolean):void{
repairing = _arg1;
gameUnit.setRepair(_arg1);
}
public function getMiniMapSprite():TileSheet{
return (miniMapSprite);
}
public function downgrade():void{
if (vehicle == null){
throw (new Error("Unit::Trying to downgrade a unit which is not upgraded"));
};
var _local1:DisplayObject = gameUnit.getChildByName("thumbnail");
gameUnit.removeChild(_local1);
gameUnit.downgrade();
vehicle = null;
var _local2:Number = (health / unitData.getHealth());
unitData = baseUnitData;
health = (unitData.getHealth() * _local2);
}
public function healDamage(_arg1:Number):void{
health = (health + _arg1);
if (health > unitData.getHealth()){
health = unitData.getHealth();
};
gameUnit.setHealth((health / unitData.getHealth()));
}
}
}//package com.gamedozer.battalion.data
Section 19
//UnitData (com.gamedozer.battalion.data.UnitData)
package com.gamedozer.battalion.data {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.audio.*;
import com.gamedozer.battalion.game.*;
public class UnitData {
protected var description:String;
protected var movementType:int;
protected var name:String;
protected var weaponRangeMin:int;
protected var armorType:int;
protected var weaponRangeMax:int;
protected var temporaryModifiers:Array;
protected var range:Number;
protected var sprite:String;
protected var cost:int;
protected var health:Number;
protected var unitType:int;
protected var damage:Number;
protected var weaponType:int;
protected var audioProfile:String;
protected var modifiers:Array;
public static const titleWeaponTypes:Array = ["None", "Light", "Medium", "Heavy"];
public static const descriptionWeaponTypes:Array = ["This unit cannot fire.", "This unit's attack is effective against lightly armored targets, but is ineffective against heavily armored targets.", "This unit's attack is equally as effective against all types of armor.", "This unit's attack is effective against heavily armored targets, but is very ineffective against lightly armored targets."];
public static const movementTypes:Array = ["none", "feet", "wheeled", "tracked", "rudder", "wings"];
public static const descriptionMovementTypes:Array = ["This unit cannot move.", "Even though Foot based units can climb Mountains, they generally suffer from reduced mobility.", "Wheeled units do fine on Roads and Bridges, but tend to suffer from reduced mobility on other terrain types.", "Tracked units are the most versatile ground units. They can cross most types of terrain quickly.", "Rudder based units are generally restricted to Sea and Shore tiles.", "There are few terrain tiles that can inhibit the movement of aircraft."];
public static const titleMovementTypes:Array = ["None", "Feet", "Wheeled", "Tracked", "Rudder", "Wings"];
public static const unitTypes:Array = ["none", "ground", "sea", "air"];
public static const descriptionArmorTypes:Array = ["This unit has no armor.", "Light armor is effective at deflecting Heavy attacks, but is susceptible to Light attacks.", "Medium armor is equally effective at deflecting Light, Medium and Heavy weapons.", "Heavy armor is susceptible to Heavy attacks, but is effective at absorbing damage from Light attacks."];
public static const titleArmorTypes:Array = ["None", "Light", "Medium", "Heavy"];
public static const armorTypes:Array = ["none", "light", "medium", "heavy"];
public static const weaponTypes:Array = ["none", "light", "medium", "heavy"];
public function UnitData(_arg1:String, _arg2:String, _arg3:int, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:int, _arg8:int, _arg9:int, _arg10:int, _arg11:int, _arg12:int, _arg13:String, _arg14:String){
sprite = _arg2;
name = _arg1;
cost = _arg3;
range = _arg4;
health = _arg5;
damage = _arg6;
description = _arg14;
weaponRangeMin = _arg7;
weaponRangeMax = _arg8;
unitType = _arg9;
movementType = _arg10;
weaponType = _arg11;
armorType = _arg12;
audioProfile = _arg13;
modifiers = new Array();
temporaryModifiers = new Array();
}
public function getName():String{
return (name);
}
public function removeModifier(_arg1:Modifier):void{
var _local2:int = (modifiers.length - 1);
while (_local2 >= 0) {
if (modifiers[_local2] == _arg1){
modifiers.splice(_local2, 1);
return;
};
_local2--;
};
}
public function getRange():Number{
return (range);
}
public function getWeaponRangeMin():int{
return (weaponRangeMin);
}
public function addModifier(_arg1:Modifier):void{
modifiers.push(_arg1);
}
public function getWeaponRangeMax():int{
return (weaponRangeMax);
}
public function getTemporaryModifiers():Array{
return (temporaryModifiers);
}
public function removeTemporaryModifier(_arg1:Modifier):void{
var _local2:int = (temporaryModifiers.length - 1);
while (_local2 >= 0) {
if (temporaryModifiers[_local2] == _arg1){
temporaryModifiers.splice(_local2, 1);
return;
};
_local2--;
};
}
public function addTemporaryModifier(_arg1:Modifier):void{
temporaryModifiers.push(_arg1);
}
public function hasModifier(_arg1:String):Boolean{
var _local2:int;
while (_local2 < modifiers.length) {
if (modifiers[_local2].getName().toLowerCase() == _arg1.toLowerCase()){
return (true);
};
_local2++;
};
_local2 = 0;
while (_local2 < temporaryModifiers.length) {
if (temporaryModifiers[_local2].getName().toLowerCase() == _arg1.toLowerCase()){
return (true);
};
_local2++;
};
return (false);
}
public function applyModifiers(_arg1:String, _arg2:Unit, _arg3:Number):Number{
var _local4:int;
while (_local4 < modifiers.length) {
_arg3 = modifiers[_local4].apply(_arg1, _arg2, _arg3);
_local4++;
};
_local4 = 0;
while (_local4 < temporaryModifiers.length) {
_arg3 = temporaryModifiers[_local4].apply(_arg1, _arg2, _arg3);
_local4++;
};
return (_arg3);
}
public function getSprite():String{
return (sprite);
}
public function isAir():Boolean{
if (unitType == 3){
return (true);
};
return (false);
}
public function playSound(_arg1:String):void{
var _local2:AudioProfile = AudioProfile.getProfile(audioProfile);
if (_local2 != null){
_local2.playSound(_arg1);
};
}
public function getCost(_arg1:Controller=null):int{
var _local2:Number = cost;
if (_arg1 == null){
return (_local2);
};
if (isGround()){
_local2 = (_local2 * _arg1.getGroundCost());
} else {
if (isAir()){
_local2 = (_local2 * _arg1.getAirCost());
} else {
if (isSea()){
_local2 = (_local2 * _arg1.getSeaCost());
};
};
};
return (Math.round(_local2));
}
public function isSea():Boolean{
if (unitType == 2){
return (true);
};
return (false);
}
public function isGround():Boolean{
if (unitType == 1){
return (true);
};
return (false);
}
public function getHealth():Number{
return (health);
}
public function getUnitType():int{
return (unitType);
}
public function getDescription():String{
return (description);
}
public function clearTemporaryModifiers():void{
temporaryModifiers = new Array();
}
public function clone():UnitData{
var _local1:UnitData = new UnitData(name, sprite, cost, range, health, damage, weaponRangeMin, weaponRangeMax, unitType, movementType, weaponType, armorType, audioProfile, description);
var _local2:int;
while (_local2 < modifiers.length) {
_local1.addModifier(modifiers[_local2]);
_local2++;
};
return (_local1);
}
public function getAllModifiers():Array{
return (modifiers.concat(temporaryModifiers));
}
public function getArmorType():int{
return (armorType);
}
public function getModifiers():Array{
return (modifiers);
}
public function getWeaponType():int{
return (weaponType);
}
public function getDamage():Number{
return (damage);
}
public function toString():String{
return ((("<" + name) + ">"));
}
public function getMovementType():int{
return (movementType);
}
public static function unitTypeFromString(_arg1:String):int{
var _local2:int;
while (_local2 < unitTypes.length) {
if (_arg1.toLowerCase() == unitTypes[_local2].toLowerCase()){
return (_local2);
};
_local2++;
};
throw (new Error(("UnitData::Invalid unit type." + _arg1)));
}
public static function armorTypeFromString(_arg1:String):int{
var _local2:int;
while (_local2 < armorTypes.length) {
if (_arg1.toLowerCase() == armorTypes[_local2].toLowerCase()){
return (_local2);
};
_local2++;
};
throw (new Error(("UnitData::Invalid armor type." + _arg1)));
}
public static function movementTypeFromString(_arg1:String):int{
var _local2:int;
while (_local2 < movementTypes.length) {
if (_arg1.toLowerCase() == movementTypes[_local2].toLowerCase()){
return (_local2);
};
_local2++;
};
throw (new Error(("UnitData::Invalid movement type." + _arg1)));
}
public static function weaponTypeFromString(_arg1:String):int{
var _local2:int;
while (_local2 < weaponTypes.length) {
if (_arg1.toLowerCase() == weaponTypes[_local2].toLowerCase()){
return (_local2);
};
_local2++;
};
throw (new Error(("UnitData::Invalid weapon type. " + _arg1)));
}
}
}//package com.gamedozer.battalion.data
Section 20
//UnitManager (com.gamedozer.battalion.data.UnitManager)
package com.gamedozer.battalion.data {
import flash.display.*;
import flash.utils.*;
public class UnitManager {
protected var units:Dictionary;
private static var singleton:UnitManager;
public function UnitManager(){
singleton = this;
units = new Dictionary();
}
public function add(_arg1:UnitData):void{
units[_arg1.getName()] = _arg1;
}
public function importXML(_arg1:XML):void{
var _local4:UnitData;
var _local5:XMLList;
var _local6:int;
if (_arg1 == null){
return;
};
var _local2:XMLList = _arg1..unit;
var _local3:int;
while (_local3 < _local2.length()) {
_local4 = new UnitData(_local2[_local3].@name, _local2[_local3].sprite.@value, int(_local2[_local3].cost.@value), Number(_local2[_local3].range.@value), Number(_local2[_local3].health.@value), Number(_local2[_local3].damage.@value), int(_local2[_local3].weaponRangeMin.@value), int(_local2[_local3].weaponRangeMax.@value), UnitData.unitTypeFromString(_local2[_local3].unitType.@value), UnitData.movementTypeFromString(_local2[_local3].movementType.@value), UnitData.weaponTypeFromString(_local2[_local3].weaponType.@value), UnitData.armorTypeFromString(_local2[_local3].armorType.@value), _local2[_local3].audio.@value, _local2[_local3].description.@value);
_local5 = _local2[_local3]..modifier;
_local6 = 0;
while (_local6 < _local5.length()) {
if (_local5[_local6].@type != ""){
_local4.addModifier(ModifierManager.getInstance().get(_local5[_local6].@type));
};
_local6++;
};
units[_local4.getName()] = _local4;
_local3++;
};
}
public function remove(_arg1:UnitData):void{
delete units[_arg1.getName()];
}
public function get(_arg1:String):UnitData{
if (units[_arg1] == null){
trace(("UnitManager::Could not get unit: " + _arg1));
return (null);
};
return (units[_arg1].clone());
}
public function getAll():Array{
var _local2:UnitData;
var _local1:Array = new Array();
for each (_local2 in units) {
_local1.push(_local2);
};
return (_local1);
}
public function clear():void{
units = new Dictionary();
}
public static function getInstance():UnitManager{
if (singleton == null){
trace("UnitManager::No instance exists");
};
return (singleton);
}
}
}//package com.gamedozer.battalion.data
Section 21
//Tween (com.gamedozer.battalion.display.tween.Tween)
package com.gamedozer.battalion.display.tween {
import com.gamedozer.battalion.display.*;
public class Tween implements TweenInterface {
private var start:Array;
private var timer:uint;
private var decoyObject:Object;
private var tweenMethod:Function;
private var time:uint;
private var change:Array;
private var variable:Array;
private var object;
public function Tween(_arg1, _arg2:Function, _arg3:Array, _arg4:Array, _arg5:Array, _arg6:uint, _arg7:Object=null){
object = _arg1;
tweenMethod = _arg2;
variable = _arg3;
start = _arg4;
change = new Array();
var _local8:int;
while (_local8 < variable.length) {
change[_local8] = (_arg5[_local8] - start[_local8]);
_local8++;
};
time = _arg6;
timer = 0;
decoyObject = _arg7;
}
public function isCompleted():Boolean{
return ((timer >= time));
}
public function update(_arg1:uint=0):void{
timer = (timer + _arg1);
if (timer > time){
timer = time;
};
var _local2:int;
while (_local2 < variable.length) {
object[variable[_local2]] = tweenMethod(timer, start[_local2], change[_local2], time);
_local2++;
};
}
public function getObject():Object{
if (decoyObject != null){
return (decoyObject);
};
return (object);
}
}
}//package com.gamedozer.battalion.display.tween
Section 22
//TweenAnimation (com.gamedozer.battalion.display.tween.TweenAnimation)
package com.gamedozer.battalion.display.tween {
import com.gamedozer.battalion.display.*;
public class TweenAnimation implements TweenInterface {
var animation:String;
var animatedSprite:AnimatedSprite;
var completed:Boolean;
var decoyObject:Object;
var wait:Boolean;
var triggered:Boolean;
public function TweenAnimation(_arg1:AnimatedSprite, _arg2:String, _arg3:Boolean=false, _arg4:Object=null){
animatedSprite = _arg1;
animation = _arg2;
decoyObject = _arg4;
completed = false;
wait = _arg3;
triggered = false;
}
public function isCompleted():Boolean{
return (completed);
}
public function update(_arg1:uint=0):void{
if (!triggered){
animatedSprite.playAnimation(animation);
triggered = true;
};
if (wait){
completed = animatedSprite.getCurrentAnimation().isCompleted();
} else {
completed = true;
};
}
public function getObject():Object{
if (decoyObject != null){
return (decoyObject);
};
return (animatedSprite);
}
}
}//package com.gamedozer.battalion.display.tween
Section 23
//TweenDisplay (com.gamedozer.battalion.display.tween.TweenDisplay)
package com.gamedozer.battalion.display.tween {
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
public class TweenDisplay implements TweenInterface {
protected var add:Boolean;
protected var depth:int;
protected var completed:Boolean;
protected var decoyObject:Object;
protected var gameSprite:GameSprite;
public function TweenDisplay(_arg1:GameSprite, _arg2:Boolean, _arg3:int=0, _arg4:Object=null){
gameSprite = _arg1;
depth = _arg3;
add = _arg2;
decoyObject = _arg4;
completed = false;
}
public function isCompleted():Boolean{
return (completed);
}
public function update(_arg1:uint=0):void{
if (add){
GameManager.getInstance().getGameSpriteScroller().add(gameSprite, depth);
} else {
GameManager.getInstance().getGameSpriteScroller().remove(gameSprite);
};
completed = true;
}
public function getObject():Object{
if (decoyObject != null){
return (decoyObject);
};
return (gameSprite);
}
}
}//package com.gamedozer.battalion.display.tween
Section 24
//TweenFunction (com.gamedozer.battalion.display.tween.TweenFunction)
package com.gamedozer.battalion.display.tween {
import com.gamedozer.battalion.display.*;
public class TweenFunction implements TweenInterface {
private var func:Function;
private var decoyObject:Object;
private var completed:Boolean;
public function TweenFunction(_arg1:Function, _arg2:Object=null){
func = _arg1;
decoyObject = _arg2;
completed = false;
}
public function isCompleted():Boolean{
return (completed);
}
public function update(_arg1:uint=0):void{
func();
completed = true;
}
public function getObject():Object{
if (decoyObject != null){
return (decoyObject);
};
return ((func as Object));
}
}
}//package com.gamedozer.battalion.display.tween
Section 25
//AnimatedSprite (com.gamedozer.battalion.display.AnimatedSprite)
package com.gamedozer.battalion.display {
public interface AnimatedSprite {
function playAnimation(_arg1:String):void;
function getCurrentAnimation():Animation;
function addAnimation(_arg1:Animation):void;
function setFrame(_arg1:int):void;
function getAnimation(_arg1:String):Animation;
}
}//package com.gamedozer.battalion.display
Section 26
//Animation (com.gamedozer.battalion.display.Animation)
package com.gamedozer.battalion.display {
public class Animation {
protected var timer:int;
protected var maxLoops:int;
protected var loops:int;
protected var name:String;
protected var frames:Array;
protected var playing:Boolean;
protected var currentFrame:int;
public static const LOOP_ONCE:int = 0;
public static const LOOP_FOREVER:int = -1;
public function Animation(_arg1:String="", _arg2:int=-1){
name = _arg1;
frames = new Array();
loops = 0;
maxLoops = _arg2;
playing = true;
currentFrame = 0;
timer = 0;
}
public function getName():String{
return (name);
}
public function stop():void{
playing = false;
}
public function isCompleted():Boolean{
if (maxLoops == LOOP_FOREVER){
return (true);
};
if ((((loops == maxLoops)) && ((currentFrame == (frames.length - 1))))){
return (true);
};
return (false);
}
public function update(_arg1:int):Boolean{
if (!playing){
return (false);
};
timer = (timer + _arg1);
if (timer >= frames[currentFrame].wait){
timer = (timer - frames[currentFrame].wait);
return (nextFrame());
};
return (false);
}
public function addFrame(_arg1:int, _arg2:int=2147483647):void{
frames.push(new Frame(_arg1, _arg2));
}
public function gotoAndPlay(_arg1:int):void{
if ((((_arg1 >= 0)) && ((_arg1 < frames.length)))){
currentFrame = _arg1;
play();
};
}
public function clone():Animation{
var _local1:Animation = new Animation(name, maxLoops);
var _local2:int;
while (_local2 < frames.length) {
_local1.addFrame(frames[_local2].frame, frames[_local2].wait);
_local2++;
};
return (_local1);
}
public function gotoAndStop(_arg1:int):void{
gotoAndPlay(_arg1);
stop();
}
public function reset():void{
loops = 0;
currentFrame = 0;
timer = 0;
playing = true;
}
public function getCurrentFrame():int{
return (currentFrame);
}
public function isPlaying():Boolean{
return (playing);
}
public function play():void{
playing = true;
}
public function previousFrame():void{
currentFrame--;
if (currentFrame < 0){
currentFrame = (frames.length - 1);
};
}
public function getFrame():int{
if ((((((frames == null)) || ((frames.length == 0)))) || ((frames[currentFrame] == null)))){
trace("Animation.getFrame. Corrupt animation.");
return (0);
};
return (frames[currentFrame].frame);
}
public function nextFrame():Boolean{
currentFrame++;
if (currentFrame > (frames.length - 1)){
if (playing){
if ((((loops < maxLoops)) || ((maxLoops == LOOP_FOREVER)))){
if (!(maxLoops) == LOOP_FOREVER){
loops++;
};
currentFrame = 0;
return (true);
};
playing = false;
return (false);
} else {
currentFrame = 0;
};
};
return (true);
}
}
}//package com.gamedozer.battalion.display
class Frame {
public var wait:int;
public var frame:int;
private function Frame(_arg1:int, _arg2:int){
frame = _arg1;
wait = _arg2;
}
}
Section 27
//BitmapSprite (com.gamedozer.battalion.display.BitmapSprite)
package com.gamedozer.battalion.display {
import flash.display.*;
public class BitmapSprite extends GameSprite {
protected var image:Bitmap;
public function BitmapSprite(_arg1:BitmapData){
image = new Bitmap(_arg1);
addChild(image);
}
public function getImage():BitmapData{
return (image.bitmapData);
}
public function setImage(_arg1:BitmapData):void{
removeChild(image);
image = new Bitmap(_arg1);
addChild(image);
}
override public function clone():GameSprite{
var _local1:BitmapSprite = new BitmapSprite(image.bitmapData);
return (_local1);
}
}
}//package com.gamedozer.battalion.display
Section 28
//ColoredSprite (com.gamedozer.battalion.display.ColoredSprite)
package com.gamedozer.battalion.display {
import flash.display.*;
import flash.geom.*;
public class ColoredSprite extends GameSprite {
protected var imageData:BitmapData;
protected var imageMask:BitmapData;
protected var imageBase:BitmapData;
protected var imageBlendMode:String;
protected var image:Bitmap;
protected var imageArgb:uint;
public function ColoredSprite(_arg1:BitmapData, _arg2:BitmapData=null, _arg3:uint=4294967295, _arg4:String="overlay"){
image = new Bitmap();
setImage(_arg1, _arg2, _arg3, _arg4);
addChild(image);
}
public function setImage(_arg1:BitmapData, _arg2:BitmapData=null, _arg3:uint=4294967295, _arg4:String="overlay"):void{
imageBase = _arg1;
imageMask = _arg2;
imageArgb = _arg3;
imageBlendMode = _arg4;
imageData = colorise(imageBase, imageMask, imageArgb, imageBlendMode);
image.bitmapData = imageData;
}
public function setColor(_arg1:uint=4294967295):void{
imageArgb = _arg1;
imageData = colorise(imageBase, imageMask, imageArgb, imageBlendMode);
image.bitmapData = imageData;
}
public function getImage():BitmapData{
return (image.bitmapData);
}
override public function clone():GameSprite{
var _local1:ColoredSprite = new ColoredSprite(imageBase, imageMask, imageArgb, imageBlendMode);
return (_local1);
}
public static function colorise(_arg1:BitmapData, _arg2:BitmapData=null, _arg3:uint=4294967295, _arg4:String="overlay"):BitmapData{
var _local5:BitmapData = new BitmapData(_arg1.width, _arg1.height, _arg1.transparent);
_local5.copyPixels(_arg1, _arg1.rect, new Point(0, 0));
if (_arg2 == null){
_arg2 = new BitmapData(_arg1.width, _arg1.height, false, 4294967295);
};
var _local6:Number = (((_arg3 & 4278190080) >>> 24) / 0xFF);
var _local7:Number = (((_arg3 & 0xFF0000) >> 16) / 0xFF);
var _local8:Number = (((_arg3 & 0xFF00) >> 8) / 0xFF);
var _local9:Number = ((_arg3 & 0xFF) / 0xFF);
_local5.draw(_arg2, null, new ColorTransform(_local7, _local8, _local9, _local6, 0, 0, 0, 0), _arg4);
return (_local5);
}
}
}//package com.gamedozer.battalion.display
Section 29
//GameButton (com.gamedozer.battalion.display.GameButton)
package com.gamedozer.battalion.display {
import flash.events.*;
import com.gamedozer.battalion.*;
import flash.filters.*;
public class GameButton extends GameSprite {
public var release:Function;
protected var m_glowOnRollover:Boolean;
public var value;
protected var cursor:String;
public var mouseOver:Function;
public function GameButton(_arg1:GameSprite, _arg2:String="default", _arg3:Boolean=false){
cursor = _arg2;
m_glowOnRollover = _arg3;
addChild(_arg1);
addEventListener(MouseEvent.CLICK, clickHandler);
addEventListener(MouseEvent.MOUSE_OVER, overHandler);
addEventListener(MouseEvent.MOUSE_OUT, outHandler);
}
override public function clone():GameSprite{
var _local1:GameButton = new GameButton((getChildAt(0) as GameSprite));
_local1.value = value;
_local1.release = release;
_local1.mouseOver = mouseOver;
return (_local1);
}
function unglow():void{
this.filters = [];
}
function clickHandler(_arg1:Event):void{
if (release != null){
release();
};
}
function glow():void{
this.filters = [new GlowFilter(0)];
}
public function setCursor(_arg1:String):void{
cursor = _arg1;
}
function outHandler(_arg1:Event):void{
BattalionMain.getMouseCursor().setCursor("default");
if (m_glowOnRollover){
unglow();
};
}
function overHandler(_arg1:Event):void{
if (cursor != null){
BattalionMain.getMouseCursor().setCursor(cursor);
};
if (mouseOver != null){
mouseOver();
};
if (m_glowOnRollover){
glow();
};
}
public function turnOffGlow():void{
unglow();
m_glowOnRollover = false;
}
}
}//package com.gamedozer.battalion.display
Section 30
//GameSprite (com.gamedozer.battalion.display.GameSprite)
package com.gamedozer.battalion.display {
import flash.display.*;
public class GameSprite extends Sprite {
public function update(_arg1:int=0):void{
}
public function clone():GameSprite{
var _local1:GameSprite = new GameSprite();
return (_local1);
}
}
}//package com.gamedozer.battalion.display
Section 31
//GameSpriteScroller (com.gamedozer.battalion.display.GameSpriteScroller)
package com.gamedozer.battalion.display {
import flash.display.*;
import com.gamedozer.battalion.data.*;
import flash.geom.*;
import flash.utils.*;
public class GameSpriteScroller extends Sprite {
protected var layers:Array;
protected var oldX:Number;
protected var oldY:Number;
protected var screenHeight:int;
protected var screenWidth:int;
protected var gameSprites:Array;
public static const BELOW_UNITS:int = 2;
public static const TILES:int = 0;
public static const BUTTONS:int = 6;
public static const BOTTOM:int = 1;
public static const ABOVE_UNITS:int = 4;
public static const UNITS:int = 3;
public static const TOP:int = 5;
public static const LAYERS:int = 8;
public static const ABOVE_ALL:int = 7;
public function GameSpriteScroller(_arg1:Number, _arg2:Number){
screenWidth = _arg1;
screenHeight = _arg2;
oldX = Number.POSITIVE_INFINITY;
oldY = Number.POSITIVE_INFINITY;
gameSprites = new Array();
layers = new Array();
var _local3:int;
while (_local3 < LAYERS) {
gameSprites[_local3] = new Array();
layers[_local3] = new Sprite();
addChild(layers[_local3]);
_local3++;
};
layers[(LAYERS - 1)].mouseEnabled = false;
}
public function add(_arg1:GameSprite, _arg2:int):void{
gameSprites[_arg2].push(_arg1);
layers[_arg2].addChild(_arg1);
oldX = Number.POSITIVE_INFINITY;
oldY = Number.POSITIVE_INFINITY;
}
public function lock(_arg1:Number, _arg2:Number):void{
if (x < (-(_arg1) + screenWidth)){
x = (-(_arg1) + screenWidth);
};
if (y < (-(_arg2) + screenHeight)){
y = (-(_arg2) + screenHeight);
};
if (x > 0){
x = 0;
};
if (y > 0){
y = 0;
};
}
public function scroll(_arg1:Boolean=false):void{
var _local7:Array;
var _local8:GameSprite;
var _local9:Number;
var _local10:Number;
if ((((((x == oldX)) && ((y == oldY)))) && (!(_arg1)))){
return;
};
oldX = x;
oldY = y;
var _local2:Number = -(x);
var _local3:Number = -(y);
var _local4:Number = (_local2 + screenWidth);
var _local5:Number = ((_local3 + screenHeight) + TileManager.getInstance().getHeight());
var _local6:int;
for each (_local7 in gameSprites) {
for each (_local8 in _local7) {
_local9 = (_local8.x + _local8.width);
_local10 = (_local8.y + _local8.height);
if ((((((((_local9 > _local2)) && ((_local8.x < _local4)))) && ((_local10 > _local3)))) && ((_local8.y < _local5)))){
_local8.visible = true;
} else {
_local8.visible = false;
};
};
};
}
public function swapDepth(_arg1:GameSprite, _arg2:int):void{
remove(_arg1);
add(_arg1, _arg2);
}
public function update(_arg1:uint):void{
var _local2:Array;
var _local3:GameSprite;
for each (_local2 in gameSprites) {
for each (_local3 in _local2) {
_local3.update(_arg1);
};
};
}
public function remove(_arg1:GameSprite):void{
var _local3:Array;
var _local4:int;
var _local2:int;
while (_local2 < LAYERS) {
_local3 = gameSprites[_local2];
_local4 = (_local3.length - 1);
while (_local4 >= 0) {
if (_local3[_local4] == _arg1){
layers[_local2].removeChild(_arg1);
_local3.splice(_local4, 1);
return;
};
_local4--;
};
_local2++;
};
trace(("ERROR. GameSpriteScroller: Sprite not found: " + _arg1));
}
}
}//package com.gamedozer.battalion.display
Section 32
//GameTile (com.gamedozer.battalion.display.GameTile)
package com.gamedozer.battalion.display {
import com.gamedozer.battalion.data.*;
public class GameTile extends GameSprite {
protected var sprite:GameSprite;
protected var flag:GameSprite;
protected var structure:GameSprite;
public function GameTile(_arg1:GameSprite){
sprite = _arg1;
if (sprite.height > TileManager.getInstance().getHeight()){
sprite.y = -((sprite.height - TileManager.getInstance().getHeight()));
};
addChild(sprite);
}
override public function update(_arg1:int=0):void{
sprite.update(_arg1);
if (structure != null){
structure.update(_arg1);
};
if (flag != null){
flag.update(_arg1);
};
}
public function setFlag(_arg1:GameSprite):void{
if (flag != null){
removeChild(flag);
};
if (_arg1 != null){
flag = _arg1;
addChild(flag);
};
}
public function setStructure(_arg1:GameSprite):void{
if (structure != null){
removeChild(structure);
};
if (_arg1 != null){
structure = _arg1;
addChild(structure);
if (structure.height > TileManager.getInstance().getHeight()){
structure.y = (structure.y - (structure.height - TileManager.getInstance().getHeight()));
};
};
}
public function getSprite():GameSprite{
return (sprite);
}
override public function clone():GameSprite{
var _local1:GameTile = new GameTile(sprite.clone());
return (_local1);
}
}
}//package com.gamedozer.battalion.display
Section 33
//GameUnit (com.gamedozer.battalion.display.GameUnit)
package com.gamedozer.battalion.display {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
public class GameUnit extends GameSprite {
protected var bar:HealthBar;
protected var sprite:GameSprite;
protected var upgraded:GameSprite;
protected var repair:GameSprite;
protected var idle:Boolean;
public function GameUnit(_arg1:GameSprite){
sprite = _arg1;
if (sprite.height > TileManager.getInstance().getHeight()){
sprite.y = -((sprite.height - TileManager.getInstance().getHeight()));
};
addChild(sprite);
repair = new BitmapSprite(BitmapLibrary.loadBitmap("repairIcon"));
repair.y = (TileManager.getInstance().getHeight() - repair.height);
repair.visible = false;
addChild(repair);
var _local2:int;
var _local3 = 4;
var _local4 = 8;
bar = new HealthBar(_local3, _local4, _local2);
bar.x = 48;
bar.y = 50;
addChild(bar);
idle = false;
}
public function setRepair(_arg1:Boolean):void{
repair.visible = _arg1;
}
override public function update(_arg1:int=0):void{
if (!idle){
if (upgraded != null){
upgraded.update(_arg1);
} else {
sprite.update(_arg1);
};
};
}
public function downgrade():void{
if (upgraded != null){
removeChild(upgraded);
upgraded = null;
};
}
public function setIdle(_arg1:Boolean):void{
idle = _arg1;
}
public function getSprite():GameSprite{
if (upgraded != null){
return (upgraded);
};
return (sprite);
}
public function upgrade(_arg1:GameSprite):void{
if (upgraded == null){
_arg1.x = 0;
_arg1.y = 0;
if (_arg1.height > TileManager.getInstance().getHeight()){
_arg1.y = -((_arg1.height - TileManager.getInstance().getHeight()));
};
upgraded = _arg1;
addChildAt(upgraded, 1);
};
}
override public function clone():GameSprite{
var _local1:GameUnit = new GameUnit(sprite.clone());
return (_local1);
}
public function setHealth(_arg1:Number):void{
bar.setHealth(_arg1);
}
}
}//package com.gamedozer.battalion.display
Section 34
//HealthBar (com.gamedozer.battalion.display.HealthBar)
package com.gamedozer.battalion.display {
import flash.display.*;
public class HealthBar extends Sprite {
var m_chunkHeight:int;
var m_drawTarget:Sprite;
var m_chunkWidth:int;
var m_health:Number;
var m_chunkCount:int;
var m_padding:int;
public function HealthBar(_arg1:int, _arg2:int, _arg3:int, _arg4:int=4){
m_chunkCount = _arg4;
m_chunkWidth = _arg1;
m_chunkHeight = _arg2;
m_padding = _arg3;
m_health = 1;
m_drawTarget = new Sprite();
m_drawTarget.cacheAsBitmap = true;
addChild(m_drawTarget);
m_drawTarget.scaleX = -1;
m_drawTarget.y = (m_drawTarget.y - m_chunkHeight);
setHealth(m_health);
}
public function setHealth(_arg1:Number):void{
if (_arg1 > 1){
_arg1 = 1;
};
if (_arg1 < 0){
_arg1 = 0;
};
m_health = _arg1;
redraw();
}
public function dispose():void{
}
function draw():void{
var _local4:int;
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (m_health >= 1){
return;
};
var _local1:uint;
if (m_health > 0.75){
_local1 = 0xCE00;
} else {
if (m_health > 0.5){
_local1 = 0xF9F900;
} else {
if (m_health > 0.25){
_local1 = 16744964;
} else {
_local1 = 0xF20000;
};
};
};
var _local2:int = Math.ceil((m_health * m_chunkCount));
m_drawTarget.graphics.lineStyle(1);
m_drawTarget.graphics.beginFill(0);
var _local3:int;
while (_local3 < m_chunkCount) {
_local4 = ((m_chunkWidth + m_padding) * _local3);
m_drawTarget.graphics.drawRect(_local4, 0, m_chunkWidth, m_chunkHeight);
_local3++;
};
m_drawTarget.graphics.endFill();
m_drawTarget.graphics.lineStyle(0);
m_drawTarget.graphics.beginFill(_local1);
_local3 = 0;
while (_local3 < _local2) {
_local4 = ((m_chunkWidth + m_padding) * _local3);
if (_local3 == (_local2 - 1)){
_local5 = (1 / m_chunkCount);
_local6 = ((m_health % _local5) / _local5);
if (_local6 == 0){
_local6 = 1;
};
_local7 = (m_chunkHeight * _local6);
m_drawTarget.graphics.drawRect(_local4, (m_chunkHeight * (1 - _local6)), m_chunkWidth, _local7);
} else {
m_drawTarget.graphics.drawRect(_local4, 0, m_chunkWidth, m_chunkHeight);
};
_local3++;
};
m_drawTarget.graphics.endFill();
}
function redraw():void{
m_drawTarget.graphics.clear();
draw();
}
}
}//package com.gamedozer.battalion.display
Section 35
//TileSheet (com.gamedozer.battalion.display.TileSheet)
package com.gamedozer.battalion.display {
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class TileSheet extends GameSprite implements AnimatedSprite {
protected var display:Bitmap;
protected var currentAnimation:Animation;
protected var tileSheet:BitmapData;
protected var _noAnimation:Boolean;
protected var tileSheetMask:BitmapData;
protected var rectangles:Array;
protected var animations:Dictionary;
protected var currentFrame:int;// = -1
protected var tileHeight:int;
protected var tileWidth:int;
public function TileSheet(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:BitmapData=null){
var x:int;
var a_tileSheet = _arg1;
var a_width = _arg2;
var a_height = _arg3;
var a_tileSheetMask = _arg4;
super();
tileSheet = a_tileSheet;
tileWidth = a_width;
tileHeight = a_height;
tileSheetMask = a_tileSheetMask;
rectangles = new Array();
display = new Bitmap(tileSheet);
addChild(display);
var hit:Sprite = new Sprite();
var _local6 = hit.graphics;
with (_local6) {
beginFill(0, 0);
drawRect(0, 0, a_width, a_height);
endFill();
};
hit.mouseChildren = false;
hit.mouseEnabled = false;
addChild(hit);
hitArea = hit;
var y:int;
while (y < tileSheet.height) {
x = 0;
while (x < tileSheet.width) {
rectangles.push(new Rectangle(x, y, a_width, a_height));
x = (x + a_width);
};
y = (y + a_height);
};
if (rectangles.length < 1){
throw (new Error("TileSheet::Could not create tilesheet, image is too small"));
};
animations = new Dictionary();
var a:Animation = new Animation("default", Animation.LOOP_ONCE);
a.addFrame(0);
addAnimation(a);
currentAnimation = a;
setFrame(0);
}
public function getTileWidth():int{
return (tileWidth);
}
public function get noAnimation():Boolean{
return (_noAnimation);
}
override public function get width():Number{
return ((tileWidth * scaleX));
}
override public function clone():GameSprite{
var _local2:Animation;
var _local1:TileSheet = new TileSheet(tileSheet, tileWidth, tileHeight, tileSheetMask);
for each (_local2 in animations) {
_local1.addAnimation(_local2.clone());
};
return (_local1);
}
public function set noAnimation(_arg1:Boolean):void{
_noAnimation = _arg1;
}
public function getAnimation(_arg1:String):Animation{
return (animations[_arg1]);
}
public function getCurrentAnimation():Animation{
return (currentAnimation);
}
public function getTileSheet():BitmapData{
return (tileSheet);
}
public function getFrames():int{
return (rectangles.length);
}
override public function update(_arg1:int=0):void{
if (noAnimation){
return;
};
currentAnimation.update(_arg1);
if (currentFrame != currentAnimation.getFrame()){
setFrame(currentAnimation.getFrame());
};
}
public function addAnimation(_arg1:Animation):void{
animations[_arg1.getName()] = _arg1;
}
override public function get height():Number{
return ((tileHeight * scaleY));
}
public function getTileHeight():int{
return (tileHeight);
}
override public function toString():String{
return (((((("TileSheet:: " + rectangles.length) + ":") + currentAnimation.getName()) + " >currentFrame ") + currentFrame));
}
public function getTileSheetMask():BitmapData{
return (tileSheetMask);
}
public function setTileSheet(_arg1:BitmapData):void{
if ((((tileSheet.width == _arg1.width)) && ((tileSheet.height == _arg1.height)))){
tileSheet = _arg1;
display.bitmapData = tileSheet;
};
}
public function setFrame(_arg1:int):void{
if ((((_arg1 >= 0)) && ((_arg1 < rectangles.length)))){
display.scrollRect = rectangles[_arg1];
currentFrame = _arg1;
};
}
public function playAnimation(_arg1:String):void{
currentAnimation = getAnimation(_arg1);
if (currentAnimation == null){
trace(("TileSheet::Could not play Animation:" + _arg1));
currentAnimation = getAnimation("default");
};
currentAnimation.reset();
setFrame(currentAnimation.getFrame());
}
public function setTileSheetMask(_arg1:BitmapData):void{
if (_arg1 == null){
tileSheetMask = null;
return;
};
if ((((tileSheetMask.width == _arg1.width)) && ((tileSheetMask.height == _arg1.height)))){
tileSheetMask = _arg1;
};
}
}
}//package com.gamedozer.battalion.display
Section 36
//TileSheetManager (com.gamedozer.battalion.display.TileSheetManager)
package com.gamedozer.battalion.display {
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import flash.utils.*;
public class TileSheetManager {
protected var tileSheets:Dictionary;
protected var stockAnimations:Dictionary;
protected var stockTileSheets:Dictionary;
private static var singleton:TileSheetManager;
public function TileSheetManager(){
singleton = this;
tileSheets = new Dictionary();
stockAnimations = new Dictionary();
stockTileSheets = new Dictionary();
}
public function add(_arg1:String, _arg2:TileSheet):void{
if (tileSheets[_arg1] == null){
tileSheets[_arg1] = _arg2;
};
}
public function remove(_arg1:String):void{
delete tileSheets[_arg1];
}
public function clear():void{
tileSheets = new Dictionary();
stockAnimations = new Dictionary();
stockTileSheets = new Dictionary();
}
public function importXML(_arg1:XML):void{
var _local7:Animation;
var _local8:XMLList;
var _local9:int;
var _local10:int;
var _local11:String;
var _local12:String;
var _local13:StockTileSheet;
var _local14:XMLList;
var _local15:int;
var _local16:BitmapData;
var _local17:String;
var _local18:String;
var _local19:TileSheet;
if (_arg1 == null){
return;
};
var _local2:XMLList = _arg1.stockanimations..animation;
var _local3:int;
while (_local3 < _local2.length()) {
_local7 = new Animation(_local2[_local3].@name, int(_local2[_local3].@loops));
_local8 = _local2[_local3]..frame;
_local9 = int(_local2[_local3].@wait);
_local10 = 0;
while (_local10 < _local8.length()) {
_local12 = _local8[_local15].@wait;
if (_local12 != ""){
_local7.addFrame(int(_local8[_local10].@frame), int(_local12));
} else {
_local7.addFrame(int(_local8[_local10].@frame), int(_local9));
};
_local10++;
};
_local11 = _local2[_local3].@name;
stockAnimations[_local11] = _local7;
_local3++;
};
var _local4:XMLList = _arg1.stocktilesheets..tilesheet;
_local3 = 0;
while (_local3 < _local4.length()) {
_local13 = new StockTileSheet(_local4[_local3].@name, int(_local4[_local3].@width), int(_local4[_local3].@height));
_local2 = _local4[_local3]..stockanimation;
_local10 = 0;
while (_local10 < _local2.length()) {
_local11 = _local2[_local10].@name;
_local13.addAnimation(stockAnimations[_local11].clone());
_local10++;
};
_local14 = _local4[_local3]..animation;
_local10 = 0;
while (_local10 < _local14.length()) {
_local7 = new Animation(_local14[_local10].@name, parseInt(_local14[_local10].@loops));
_local8 = _local14[_local10]..frame;
_local9 = parseInt(_local14[_local10].@wait);
_local15 = 0;
while (_local15 < _local8.length()) {
_local12 = _local8[_local15].@wait;
if (_local12 != ""){
_local7.addFrame(int(_local8[_local15].@frame), int(_local12));
} else {
_local7.addFrame(int(_local8[_local15].@frame), int(_local9));
};
_local15++;
};
_local13.addAnimation(_local7);
_local10++;
};
stockTileSheets[_local13.getName()] = _local13;
_local3++;
};
var _local5:XMLList = _arg1.tilesheets..stocktilesheet;
_local3 = 0;
while (_local3 < _local5.length()) {
_local11 = _local5[_local3].@stockname;
_local13 = stockTileSheets[_local11];
_local16 = null;
_local17 = _local5[_local3].mask.@value;
if (_local17 != ""){
_local16 = BitmapLibrary.loadBitmap(_local17);
};
_local18 = _local5[_local3].@name;
tileSheets[_local18] = _local13.getTileSheet(BitmapLibrary.loadBitmap(_local5[_local3].image.@value), _local16);
_local3++;
};
var _local6:XMLList = _arg1.tilesheets..tilesheet;
_local3 = 0;
while (_local3 < _local6.length()) {
_local16 = null;
_local17 = _local6[_local3].mask.@value;
if (_local17 != ""){
_local16 = BitmapLibrary.loadBitmap(_local17);
};
_local19 = new TileSheet(BitmapLibrary.loadBitmap(_local6[_local3].image.@value), int(_local6[_local3].@width), int(_local6[_local3].@height), _local16);
_local2 = _local6[_local3]..stockanimation;
_local10 = 0;
while (_local10 < _local2.length()) {
_local11 = _local2[_local10].@name;
_local19.addAnimation(stockAnimations[_local11].clone());
_local10++;
};
_local14 = _local6[_local3]..animation;
_local10 = 0;
while (_local10 < _local14.length()) {
_local7 = new Animation(_local14[_local10].@name, int(_local14[_local10].@loops));
_local8 = _local14[_local10]..frame;
_local9 = int(_local14[_local10].@wait);
_local15 = 0;
while (_local15 < _local8.length()) {
_local12 = _local8[_local15].@wait;
if (_local12 != ""){
_local7.addFrame(int(_local8[_local15].@frame), int(_local12));
} else {
_local7.addFrame(int(_local8[_local15].@frame), int(_local9));
};
_local15++;
};
_local19.addAnimation(_local7);
_local10++;
};
_local11 = _local6[_local3].@name;
tileSheets[_local11] = _local19;
_local3++;
};
}
public function get(_arg1:String):TileSheet{
if (tileSheets[_arg1] == null){
trace(("TileSheetManager::Could not get sprite: " + _arg1));
if (tileSheets["error"] != null){
return ((tileSheets["error"].clone() as TileSheet));
};
throw (new Error("TileSheetManager::Could not get sprite, or default sprite"));
};
return ((tileSheets[_arg1].clone() as TileSheet));
}
public function getColorised(_arg1:String, _arg2:uint=4294967295):TileSheet{
var _local5:TileSheet;
var _local6:BitmapData;
var _local7:BitmapData;
var _local3:TileSheet = get(_arg1);
if (_local3 == null){
trace(("TileSheetManager::Could not get sprite: " + _arg1));
return (null);
};
var _local4:String = (_arg1 + _arg2);
if ((((tileSheets[_local4] == null)) && (!((_local3.getTileSheetMask() == null))))){
_local5 = (_local3.clone() as TileSheet);
_local6 = _local5.getTileSheet();
_local7 = _local5.getTileSheetMask();
_local5.setTileSheet(ColoredSprite.colorise(_local6, _local7, _arg2));
_local5.setTileSheetMask(null);
tileSheets[_local4] = _local5;
};
return (tileSheets[_local4].clone());
}
public static function getInstance():TileSheetManager{
if (singleton == null){
trace("TileSheetManager::No instance exists");
};
return (singleton);
}
}
}//package com.gamedozer.battalion.display
import flash.display.*;
class StockTileSheet {
private var width:int;
private var height:int;
private var name:String;
private var animations:Array;
private function StockTileSheet(_arg1:String, _arg2:int, _arg3:int){
name = _arg1;
width = _arg2;
height = _arg3;
animations = new Array();
}
private function getName():String{
return (name);
}
private function addAnimation(_arg1:Animation):void{
animations.push(_arg1);
}
private function getTileSheet(_arg1:BitmapData, _arg2:BitmapData):TileSheet{
var _local3:TileSheet = new TileSheet(_arg1, width, height, _arg2);
var _local4:int;
while (_local4 < animations.length) {
_local3.addAnimation(animations[_local4].clone());
_local4++;
};
return (_local3);
}
}
Section 37
//TileSwatch (com.gamedozer.battalion.display.TileSwatch)
package com.gamedozer.battalion.display {
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import flash.geom.*;
import com.gamedozer.battalion.game.*;
public class TileSwatch {
protected var bitmaps:Array;
protected var imageCode:String;
protected var name:String;
public function TileSwatch(_arg1:String, _arg2:String){
if (_arg1 == "Hunter"){
_arg1 = "Hunter Support";
};
if (_arg1 == "Corvette"){
_arg1 = "Corvette Fighter";
};
name = _arg1;
imageCode = _arg2;
generateTiles();
}
protected function generateMultipleTiles(_arg1:String):void{
var _local2:Array = _arg1.substring(2, (_arg1.length - 1)).split(";");
var _local3:int;
while (_local3 < _local2.length) {
generateTile(_local2[_local3]);
_local3++;
};
}
public function getName():String{
return (name);
}
public function getTeam():int{
if ((((imageCode.charAt(0) == "@")) || ((imageCode.charAt(0) == "%")))){
return (int(imageCode.charAt(2)));
};
return (0);
}
protected function generateTile(_arg1:String):void{
var _local2:String = _arg1.substring(0, _arg1.indexOf("."));
bitmaps.push(BitmapLibrary.loadBitmap(_local2));
}
protected function generateJoinedTile(_arg1:String):void{
var _local2:Array = _arg1.substring(2, (_arg1.length - 1)).split(";");
if (_local2.length != 4){
return;
};
var _local3:int;
while (_local3 < _local2.length) {
_local2[_local3] = _local2[_local3].substring(0, _local2[_local3].indexOf("."));
_local3++;
};
var _local4:BitmapData = BitmapLibrary.loadBitmap(_local2[0]);
var _local5:BitmapData = new BitmapData((_local4.width * 2), (_local4.height * 2), _local4.transparent);
var _local6:int = _local4.height;
_local3 = 0;
while (_local3 < _local4.width) {
_local5.copyPixels(_local4, new Rectangle(_local3, 0, _local6, _local6), new Point((_local3 * 2), 0));
_local3 = (_local3 + _local6);
};
_local4 = BitmapLibrary.loadBitmap(_local2[1]);
_local3 = 0;
while (_local3 < _local4.width) {
_local5.copyPixels(_local4, new Rectangle(_local3, 0, _local6, _local6), new Point(((_local3 * 2) + _local6), 0));
_local3 = (_local3 + _local6);
};
_local4 = BitmapLibrary.loadBitmap(_local2[2]);
_local3 = 0;
while (_local3 < _local4.width) {
_local5.copyPixels(_local4, new Rectangle(_local3, 0, _local6, _local6), new Point((_local3 * 2), _local6));
_local3 = (_local3 + _local6);
};
_local4 = BitmapLibrary.loadBitmap(_local2[3]);
_local3 = 0;
while (_local3 < _local4.width) {
_local5.copyPixels(_local4, new Rectangle(_local3, 0, _local6, _local6), new Point(((_local3 * 2) + _local6), _local6));
_local3 = (_local3 + _local6);
};
bitmaps.push(_local5);
}
public function getImageCode():String{
return (imageCode);
}
protected function generateTiles():void{
var _local1:String;
bitmaps = new Array();
_local1 = imageCode.charAt(0);
switch (_local1){
case "+":
generateJoinedTile(imageCode);
break;
case "?":
generateMultipleTiles(imageCode);
break;
case "@":
break;
case "%":
break;
default:
generateTile(imageCode);
break;
};
}
public function getSprite():GameSprite{
var _local2:TileSheet;
var _local3:Animation;
var _local4:int;
var _local5:int;
var _local1:BitmapData = bitmaps[Math.floor((Math.random() * bitmaps.length))];
if (_local1){
if (_local1.width > 56){
_local2 = new TileSheet(_local1, 56, _local1.height);
_local3 = new Animation("default", Animation.LOOP_FOREVER);
_local4 = 0;
while (_local4 < _local2.getFrames()) {
_local5 = 500;
_local3.addFrame(_local4, _local5);
_local4++;
};
_local2.addAnimation(_local3);
_local2.playAnimation("default");
return (_local2);
} else {
return (new BitmapSprite(_local1));
};
//unresolved jump
};
return (new GameSprite());
}
}
}//package com.gamedozer.battalion.display
Section 38
//TweenInterface (com.gamedozer.battalion.display.TweenInterface)
package com.gamedozer.battalion.display {
public interface TweenInterface {
function isCompleted():Boolean;
function update(_arg1:uint=0):void;
function getObject():Object;
}
}//package com.gamedozer.battalion.display
Section 39
//TweenManager (com.gamedozer.battalion.display.TweenManager)
package com.gamedozer.battalion.display {
import flash.events.*;
import flash.utils.*;
public class TweenManager {
protected var dispatcher:EventDispatcher;
protected var tweens:Array;
protected var lastTimer:uint;
public static const SEQUENTIAL_ALL:int = 2;
public static const PARALLEL:int = 0;
public static const SEQUENTIAL:int = 1;
private static var singleton:TweenManager;
public function TweenManager(_arg1:EventDispatcher){
singleton = this;
tweens = new Array();
setDispatcher(_arg1);
}
public function isTweened(_arg1):Boolean{
var _local2:int;
while (_local2 < tweens.length) {
if (tweens[_local2].tween.getObject() == _arg1){
return (true);
};
_local2++;
};
return (false);
}
public function add(_arg1:TweenInterface, _arg2:int=0):void{
tweens.push(new TweenHolder(_arg1, _arg2));
}
public function isEmpty():Boolean{
return ((tweens.length == 0));
}
public function setDispatcher(_arg1:EventDispatcher):void{
if (dispatcher != null){
dispatcher.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
};
dispatcher = _arg1;
dispatcher.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function removeTweens(_arg1):void{
var _local2:int = (tweens.length - 1);
while (_local2 >= 0) {
if (tweens[_local2].tween.getObject() == _arg1){
tweens.splice(_local2, 1);
};
_local2--;
};
}
public function clear():void{
tweens = new Array();
}
private function enterFrameHandler(_arg1:Event):void{
var _local2:int = getTimer();
var _local3:int = (_local2 - lastTimer);
lastTimer = _local2;
update(_local3);
}
public function update(_arg1:uint=0):void{
var _local5:TweenInterface;
var _local6:int;
var _local2:Dictionary = new Dictionary();
var _local3:Boolean;
var _local4:int;
for (;_local4 < tweens.length;_local4++) {
_local5 = tweens[_local4].tween;
_local6 = tweens[_local4].waitType;
if (!_local5.isCompleted()){
if ((((_local6 == SEQUENTIAL_ALL)) && (_local3))){
continue;
} else {
if (_local6 == SEQUENTIAL){
if (_local2[_local5.getObject()] != null){
continue;
};
};
};
_local3 = true;
_local2[_local5.getObject()] = true;
_local5.update(_arg1);
};
};
_local4 = (tweens.length - 1);
while (_local4 >= 0) {
if (tweens[_local4].tween.isCompleted()){
tweens.splice(_local4, 1);
};
_local4--;
};
}
public static function getInstance():TweenManager{
if (singleton == null){
trace("TweenManager::No instance exists");
};
return (singleton);
}
}
}//package com.gamedozer.battalion.display
class TweenHolder {
public var tween:TweenInterface;
public var waitType:int;
private function TweenHolder(_arg1:TweenInterface, _arg2:int){
tween = _arg1;
waitType = _arg2;
}
}
Section 40
//AttackUnitAction (com.gamedozer.battalion.game.actions.AttackUnitAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.audio.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
public class AttackUnitAction extends Action {
protected var targetX:int;
protected var targetY:int;
protected var unitX:int;
protected var unitY:int;
protected var phase:int;
protected static const ATTACKER_FIRE:int = 0;
protected static const DEFENDER_FIRE:int = 1;
protected static const DEFENDER_DIE:int = 2;
protected static const ATTACKER_DIE:int = 3;
protected static const COMPLETED:int = 4;
public function AttackUnitAction(_arg1:int, _arg2:int, _arg3:int, _arg4:int){
unitX = _arg1;
unitY = _arg2;
targetX = _arg3;
targetY = _arg4;
phase = ATTACKER_FIRE;
}
public function fireAttackerSound():void{
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(unitX, unitY);
_local2.getUnitData().playSound(AudioProfile.k_attackType);
}
public function fireDefenderSound():void{
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(targetX, targetY);
_local2.getUnitData().playSound(AudioProfile.k_attackType);
}
override public function update():void{
}
public function fireImplied():void{
var _local4:int;
var _local5:int;
var _local6:Boolean;
var _local7:TileSheet;
var _local8:GameUnit;
var _local9:GameUnit;
var _local10:TileSheet;
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(unitX, unitY);
var _local3:Unit = _local1.unitAt(targetX, targetY);
if (phase == ATTACKER_FIRE){
TriggerManager.getInstance().add(new AttackUnitTrigger(unitX, unitY, targetX, targetY, _local2, _local3));
_local4 = (unitX - targetX);
_local5 = (unitX - targetX);
phase = COMPLETED;
_local3.takeDamage(_local1.resolveAttack(_local2, _local3));
if (_local3.isAlive()){
if (!_local3.isRepairing()){
if (_local1.canAttack(_local3, _local2, true)){
_local6 = true;
if (_local3.isRanged()){
if (!_local3.getUnitData().hasModifier("Counter Battery")){
_local6 = false;
};
};
if (_local6){
phase = DEFENDER_FIRE;
_local7 = TileSheetManager.getInstance().get("Small Explosion");
_local8 = _local2.getGameUnit();
_local7.x = (_local8.x + ((_local8.width - _local7.width) / 2));
_local7.y = (_local8.y + ((_local8.height - _local7.height) / 2));
_local9 = _local3.getGameUnit();
_local10 = (_local9.getSprite() as TileSheet);
_local10.playAnimation(direction(targetX, targetY, unitX, unitY));
TweenManager.getInstance().add(new Tween(_local9, Quad.easeOut, ["y"], [_local9.y], [(_local9.y - 15)], 100, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new Tween(_local9, Quad.easeIn, ["y"], [(_local9.y - 15)], [_local9.y], 100, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(fireDefenderSound, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenDisplay(_local7, true, GameSpriteScroller.TOP, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenAnimation(_local7, "default", true, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenDisplay(_local7, false, GameSpriteScroller.TOP, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(fireImplied, this), TweenManager.SEQUENTIAL);
};
};
} else {
_local3.setRepairing(false);
};
} else {
phase = DEFENDER_DIE;
GameManager.getInstance().addExplosion("Explosion", _local3.getGameUnit());
SoundSystem.instance.playSound(SoundSystem.instance.createSound("ExplosionSound"));
TweenManager.getInstance().add(new Tween(_local3.getGameUnit(), Quad.easeIn, ["alpha"], [1], [0], 1000), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(fireImplied, _local3.getGameUnit()), TweenManager.SEQUENTIAL);
};
} else {
if (phase == DEFENDER_FIRE){
phase = COMPLETED;
_local2.takeDamage(_local1.resolveAttack(_local3, _local2, null, null, false));
if (!_local2.isAlive()){
phase = ATTACKER_DIE;
GameManager.getInstance().addExplosion("Explosion", _local2.getGameUnit());
SoundSystem.instance.playSound(SoundSystem.instance.createSound("ExplosionSound"));
TweenManager.getInstance().add(new Tween(_local2.getGameUnit(), Quad.easeIn, ["alpha"], [1], [0], 1000), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(fireImplied, _local2.getGameUnit()), TweenManager.SEQUENTIAL);
} else {
_local2.setCloaked(false);
};
} else {
if (phase == DEFENDER_DIE){
phase = COMPLETED;
TriggerManager.getInstance().add(new KillUnitTrigger(targetX, targetY, _local3));
_local3.getController().getTeam().addStatistic(Team.UNITS_LOST, 1);
_local2.getController().getTeam().addStatistic(Team.UNITS_KILLED, 1);
_local1.removeUnit(_local3);
} else {
if (phase == ATTACKER_DIE){
phase = COMPLETED;
TriggerManager.getInstance().add(new KillUnitTrigger(unitX, unitY, _local2));
_local2.getController().getTeam().addStatistic(Team.UNITS_LOST, 1);
_local3.getController().getTeam().addStatistic(Team.UNITS_KILLED, 1);
_local1.removeUnit(_local2);
};
};
};
};
if (phase == COMPLETED){
_local2.setMoved(true);
_local2.setFired(true);
_local2.darken();
super.update();
};
}
override public function usesUnit(_arg1:Unit):Boolean{
var _local2:GameManager = GameManager.getInstance();
var _local3:Unit = _local2.unitAt(unitX, unitY);
return ((_local3 == _arg1));
}
override public function fire():void{
var _local1:GameManager;
var _local4:TileSheet;
var _local5:GameUnit;
var _local6:GameUnit;
var _local7:TileSheet;
super.fire();
_local1 = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(unitX, unitY);
var _local3:Unit = _local1.unitAt(targetX, targetY);
if ((((_local2 == null)) || ((((_local3 == null)) && (!((_local2 == _local3))))))){
super.update();
throw (new Error("AttackUnitAction::Corrupt attack action"));
};
if (_local2.getController() != _local1.getActiveController()){
super.update();
throw (new Error("AttackUnitAction::Only the units controller may attack with the unit"));
};
if (_local2.hasFired()){
super.update();
throw (new Error(("AttackUnitAction::Unit cannot complete attack action. (Unit has fired)" + _local1.getCurrentController())));
};
if (((_local2.isRanged()) && (_local2.hasMoved()))){
super.update();
throw (new Error(("AttackUnitAction::Unit cannot complete attack action. (Ranged unit has already moved)" + _local1.getCurrentController())));
};
if (!_local2.hasMoved()){
if (_local2.getUnitData().hasModifier("Cloaking")){
if (_local2.isCloaked()){
_local2.setCloaked(false);
_local2.setCloaked(true);
} else {
_local2.setCloaked(true);
};
};
};
if (_local1.canAttack(_local2, _local3)){
phase = ATTACKER_FIRE;
_local4 = TileSheetManager.getInstance().get("Small Explosion");
_local5 = _local3.getGameUnit();
_local4.x = (_local5.x + ((_local5.width - _local4.width) / 2));
_local4.y = (_local5.y + ((_local5.height - _local4.height) / 2));
_local6 = _local2.getGameUnit();
_local7 = (_local6.getSprite() as TileSheet);
_local7.playAnimation(direction(unitX, unitY, targetX, targetY));
TweenManager.getInstance().add(new Tween(_local6, Quad.easeOut, ["y"], [_local6.y], [(_local6.y - 15)], 100, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new Tween(_local6, Quad.easeIn, ["y"], [(_local6.y - 15)], [_local6.y], 100, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(fireAttackerSound, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenDisplay(_local4, true, GameSpriteScroller.TOP, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenAnimation(_local4, "default", true, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenDisplay(_local4, false, GameSpriteScroller.TOP, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(fireImplied, this), TweenManager.SEQUENTIAL);
_local1.getCamera().setTarget(_local6, 500);
} else {
super.update();
throw (new Error(("AttackUnitAction::Unit cannot complete attack action. (Target not in range)" + _local1.getCurrentController())));
};
}
protected function direction(_arg1:int, _arg2:int, _arg3:int, _arg4:int):String{
if (_arg2 == _arg4){
if (_arg1 < _arg3){
return ("right_idle");
};
return ("left_idle");
};
if (_arg2 < _arg4){
return ("down_idle");
};
return ("up_idle");
}
}
}//package com.gamedozer.battalion.game.actions
Section 41
//BuildUnitAction (com.gamedozer.battalion.game.actions.BuildUnitAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
public class BuildUnitAction extends Action {
protected var unit:String;
protected var tileX:int;
protected var tileY:int;
protected var gu:GameUnit;
public function BuildUnitAction(_arg1:int, _arg2:int, _arg3:String){
tileX = _arg1;
tileY = _arg2;
unit = _arg3;
}
override public function update():void{
}
public function fireImplied():void{
super.update();
var _local1:GameManager = GameManager.getInstance();
var _local2:Tile = _local1.tileAt(tileX, tileY);
var _local3:Controller = _local2.getController();
var _local4:UnitData = UnitManager.getInstance().get(unit);
var _local5:Unit = new Unit(gu, _local4, tileX, tileY, _local2.getController());
_local5.setDeployed(true);
_local5.setMoved(true);
_local5.setFired(true);
var _local6:TileSheet = (_local5.getGameUnit().getSprite() as TileSheet);
if (_local5.getX() > (_local1.getMap().getWidth() / 2)){
_local6.playAnimation("left_idle");
} else {
_local6.playAnimation("right_idle");
};
_local1.addUnit(_local5.getController(), _local5);
_local2.setUnit(_local5);
_local5.darken();
trace(("Built " + _local5));
_local3.spendResources(_local4.getCost(_local3));
_local3.getTeam().addStatistic(Team.UNITS_BUILT, 1);
TriggerManager.getInstance().add(new BuildUnitTrigger(_local5));
}
override public function fire():void{
var _local9:TileSheet;
var _local10:AnimatedSprite;
super.fire();
var _local1:GameManager = GameManager.getInstance();
var _local2:Tile = _local1.tileAt(tileX, tileY);
var _local3:UnitData = UnitManager.getInstance().get(unit);
if ((((_local2 == null)) || ((_local3 == null)))){
super.update();
throw (new Error("BuildUnitAction::Corrupt build action"));
};
var _local4:Controller = _local2.getController();
if (_local4 != _local1.getActiveController()){
super.update();
throw (new Error("BuildUnitAction::Only the active controller may build"));
};
if (_local4.getResources() < _local3.getCost(_local4)){
super.update();
throw (new Error("BuildUnitAction::Controller cannot afford unit"));
};
var _local5:Boolean = _local4.controlsGround();
var _local6:Boolean = _local4.controlsSea();
var _local7:Boolean = _local4.controlsAir();
var _local8:Boolean;
if (_local3.isAir()){
if (!_local7){
_local8 = true;
};
} else {
if (_local3.isGround()){
if (!_local5){
_local8 = true;
};
} else {
if (_local3.isSea()){
if (((!(_local2.seaBordered())) || (!(_local6)))){
_local8 = true;
};
} else {
_local8 = true;
};
};
};
if (_local3.hasModifier("Unbuildable")){
_local8 = true;
};
if (_local8){
super.update();
throw (new Error("BuildUnitAction::Cannot build unit, non supported type"));
};
if (_local2.getUnit() != null){
super.update();
throw (new Error("BuildUnitAction::Build cannot complete (Unit is on structure)!"));
};
if (_local2.getTerrain().hasModifier("Construction")){
_local9 = TileSheetManager.getInstance().getColorised(_local3.getSprite(), _local2.getController().getTeam().getColor());
gu = new GameUnit(_local9);
_local1.getGameSpriteScroller().add(gu, GameSpriteScroller.UNITS);
gu.x = (tileX * TileManager.getInstance().getWidth());
gu.y = (tileY * TileManager.getInstance().getHeight());
gu.alpha = 0;
TweenManager.getInstance().add(new Tween(gu, Quad.easeOut, ["alpha"], [0], [1], 1000), TweenManager.SEQUENTIAL);
_local10 = (gu.getSprite() as TileSheet);
TweenManager.getInstance().add(new TweenAnimation(_local10, "right_idle", false, gu), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(fireImplied, gu), TweenManager.SEQUENTIAL);
_local1.getCamera().setTarget(gu, 500);
} else {
super.update();
throw (new Error("BuildUnitAction::Build cannot complete (Structure cannot build)!"));
};
}
}
}//package com.gamedozer.battalion.game.actions
Section 42
//CallbackAction (com.gamedozer.battalion.game.actions.CallbackAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.game.*;
public class CallbackAction extends Action {
var m_callback:Function;
var m_toStringData:String;
public function CallbackAction(_arg1:Function, _arg2:String=""){
m_callback = _arg1;
m_toStringData = _arg2;
}
override public function fire():void{
super.fire();
m_callback.call();
}
public function toString():String{
return ((("[ CallbackAction <" + m_toStringData) + "> ]"));
}
}
}//package com.gamedozer.battalion.game.actions
Section 43
//CaptureTerrainAction (com.gamedozer.battalion.game.actions.CaptureTerrainAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.audio.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
public class CaptureTerrainAction extends Action {
protected var unitX:int;
protected var unitY:int;
public function CaptureTerrainAction(_arg1:int, _arg2:int){
unitX = _arg1;
unitY = _arg2;
}
override public function usesUnit(_arg1:Unit):Boolean{
var _local2:GameManager = GameManager.getInstance();
var _local3:Unit = _local2.unitAt(unitX, unitY);
return ((_local3 == _arg1));
}
public function fireImplied():void{
super.update();
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(unitX, unitY);
var _local3:Tile = _local1.tileAt(unitX, unitY);
var _local4:int = GameManager.getInstance().getPlayer(_local3.getController());
_local3.setCapturer(_local2);
_local3.setChunks((_local3.getChunks() - _local2.getChunks(GameManager.UNIT_CHUNKS)));
trace(("Firing implied capture. Chunks are " + _local3.getChunks()));
if (_local3.getChunks() <= 0){
if (_local3.getController() != null){
_local3.getController().getTeam().addStatistic(Team.STRUCTURES_LOST, 1);
};
_local2.getController().getTeam().addStatistic(Team.STRUCTURES_CAPTURED, 1);
trace("Critical is about to go down");
if (!_local3.getTerrain().hasModifier("Mission Critical")){
if (_local3.getController() != null){
_local3.getController().removeStructure(_local3);
};
_local2.getController().addStructure(_local3);
};
_local3.setChunks(GameManager.TILE_CHUNKS);
TriggerManager.getInstance().add(new CaptureTerrainTrigger(_local3, _local4, GameManager.getInstance().getPlayer(_local2.getController()), true));
} else {
TriggerManager.getInstance().add(new CaptureTerrainTrigger(_local3, _local4, GameManager.getInstance().getPlayer(_local2.getController()), false));
};
}
override public function fire():void{
var _local5:GameUnit;
super.fire();
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(unitX, unitY);
var _local3:Tile = _local1.tileAt(unitX, unitY);
if ((((_local2 == null)) || ((_local3 == null)))){
super.update();
throw (new Error("CaptureTerrainAction::Corrupt capture action"));
};
if (_local2.getController() != _local1.getActiveController()){
super.update();
throw (new Error("CaptureTerrainAction::Only the units controller may capture with the unit"));
};
trace("This far");
var _local4:int = GameManager.getInstance().getPlayer(_local3.getController());
if (_local3.getCapturer() == null){
_local3.setChunks(GameManager.TILE_CHUNKS);
} else {
if (_local2.getController() != _local3.getCapturer().getController()){
_local3.setChunks(GameManager.TILE_CHUNKS);
};
};
trace("Does it think its ours already");
if (_local2.getController() == _local3.getController()){
_local3.setCapturer(null);
super.update();
return;
};
trace("Got here for the terrain action");
if (((_local2.getUnitData().hasModifier("Capture")) || (!(_local2.isDeployed())))){
_local5 = _local2.getGameUnit();
TweenManager.getInstance().add(new Tween(_local5, Circ.easeOut, ["y"], [_local5.y], [(_local5.y - 32)], 150), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new Tween(_local5, Circ.easeIn, ["y"], [(_local5.y - 32)], [_local5.y], 150), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(playCaptureSound), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new Tween(_local5, Circ.easeOut, ["y"], [_local5.y], [(_local5.y - 16)], 100), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new Tween(_local5, Circ.easeIn, ["y"], [(_local5.y - 16)], [_local5.y], 100), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new Tween(_local5, Circ.easeOut, ["y"], [_local5.y], [(_local5.y - 8)], 50), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new Tween(_local5, Circ.easeIn, ["y"], [(_local5.y - 8)], [_local5.y], 50), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(fireImplied, _local5), TweenManager.SEQUENTIAL);
_local1.getCamera().setTarget(_local5, 1500);
} else {
super.update();
throw (new Error("CaptureTerrainAction::Unit cannot complete action, can not capture!"));
};
}
override public function update():void{
}
private function playCaptureSound():void{
SoundSystem.instance.playSound(SoundSystem.instance.createSound("Capture"));
}
}
}//package com.gamedozer.battalion.game.actions
Section 44
//DelayedCallbackAction (com.gamedozer.battalion.game.actions.DelayedCallbackAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.game.*;
import flash.utils.*;
public class DelayedCallbackAction extends Action {
var m_callback:Function;
var m_toStringData:String;
var m_timeOfFire:int;
public function DelayedCallbackAction(_arg1:Function, _arg2:int, _arg3:String=""){
m_callback = _arg1;
m_toStringData = _arg3;
m_timeOfFire = (getTimer() + _arg2);
}
override public function update():void{
if (getTimer() >= m_timeOfFire){
m_callback.call();
completed = true;
};
}
public function toString():String{
return ((("[ DelayedCallbackAction <" + m_toStringData) + "> ]"));
}
}
}//package com.gamedozer.battalion.game.actions
Section 45
//EndGameAction (com.gamedozer.battalion.game.actions.EndGameAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
public class EndGameAction extends Action {
override public function update():void{
if (((((((TweenManager.getInstance().isEmpty()) && (TriggerManager.getInstance().isEmpty()))) && (GameEventManager.getInstance().isEmpty()))) && (ResponseManager.getInstance().isEmpty()))){
GameManager.getInstance().endGame();
super.update();
};
}
override public function fire():void{
super.fire();
var _local1:Array = GameManager.getInstance().getControllers();
var _local2:int;
while (_local2 < _local1.length) {
if (_local1[_local2].getTeam().getActive()){
TriggerManager.getInstance().add(new PlayerTrigger(PlayerTrigger.END_GAME, GameManager.getInstance().getPlayer(_local1[_local2])));
};
_local2++;
};
}
}
}//package com.gamedozer.battalion.game.actions
Section 46
//EndTurnAction (com.gamedozer.battalion.game.actions.EndTurnAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.data.*;
import flash.geom.*;
import com.gamedozer.battalion.game.*;
public class EndTurnAction extends Action {
override public function fire():void{
var _local5:Unit;
super.fire();
var _local1:GameManager = GameManager.getInstance();
var _local2:Controller = GameManager.getInstance().getActiveController();
var _local3:Array = _local2.getUnits();
var _local4:int;
while (_local4 < _local3.length) {
_local5 = _local3[_local4];
_local5.getUnitData().clearTemporaryModifiers();
_local5.getGameUnit().transform.colorTransform = new ColorTransform();
if (_local5.isCloaked()){
_local5.getGameUnit().alpha = _local5.getController().getCloakVisibility();
};
if (_local5.isDeployed()){
if (((_local5.getUnitData().hasModifier("Cloaking")) && (_local5.isAvailable()))){
_local5.setCloaked(true, false, false);
};
};
_local4++;
};
do {
_local1.setTurn((_local1.getTurn() + 1));
_local1.setCurrentController((_local1.getCurrentController() + 1));
if (_local1.getCurrentController() > (_local1.getControllers().length - 1)){
_local1.setRound((_local1.getRound() + 1));
_local1.setCurrentController(0);
};
if (_local1.getRound() > _local1.getMapSettings().getRounds()){
ActionManager.getInstance().add(new EndGameAction());
};
} while (!(_local1.getActiveController().getTeam().getActive()));
ActionManager.getInstance().add(new StartTurnAction());
}
}
}//package com.gamedozer.battalion.game.actions
Section 47
//MoveUnitAction (com.gamedozer.battalion.game.actions.MoveUnitAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.audio.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
public class MoveUnitAction extends Action {
protected var path:Array;
protected var unitX:int;
protected var unitY:int;
protected var uncloak:Unit;
protected var destination:Tile;
public function MoveUnitAction(_arg1:int, _arg2:int, _arg3:Array){
unitX = _arg1;
unitY = _arg2;
path = _arg3;
uncloak = null;
}
override public function update():void{
}
override public function usesUnit(_arg1:Unit):Boolean{
var _local2:GameManager = GameManager.getInstance();
var _local3:Unit = _local2.unitAt(unitX, unitY);
return ((_local3 == _arg1));
}
public function fireImplied():void{
var _local7:Boolean;
var _local8:Array;
var _local9:Array;
var _local10:int;
var _local11:int;
var _local12:Unit;
super.update();
var _local1:GameManager = GameManager.getInstance();
var _local2:Tile = _local1.tileAt(unitX, unitY);
var _local3:Unit = _local1.unitAt(unitX, unitY);
if (destination.getUnit() != _local3){
_local2.setUnit(null);
destination.setUnit(_local3);
_local3.setMoved(true);
_local3.setX(destination.getX());
_local3.setY(destination.getY());
};
if (_local3.getUnitData().hasModifier("Cloaking")){
_local7 = true;
_local8 = [-1, -1, 1, 1];
_local9 = [-1, 1, -1, 1];
_local10 = 0;
while (_local10 < _local8.length) {
_local11 = 0;
while (_local11 < _local9.length) {
_local12 = _local1.unitAt(_local8[_local10], _local9[_local11]);
if (_local12 != null){
if (_local12.getController().getTeam() != _local3.getController().getTeam()){
_local7 = false;
};
};
_local11++;
};
_local10++;
};
if (_local7){
_local3.setCloaked(true);
} else {
_local3.setCloaked(false);
};
};
TriggerManager.getInstance().add(new MoveUnitTrigger(_local3, path));
if (uncloak != null){
uncloak.setCloaked(false);
if (_local3.getUnitData().hasModifier("Tracking")){
ActionManager.getInstance().add(new AttackUnitAction(_local3.getX(), _local3.getY(), uncloak.getX(), uncloak.getY()));
};
_local3.darken();
};
var _local4:int = _local3.getUnitData().applyModifiers("radar", _local3, 1);
var _local5:Array = GameManager.getInstance().unitsInRange(_local3, true, -1, -1, 1, _local4);
var _local6:int;
while (_local6 < _local5.length) {
if (_local5[_local6].getUnitData().hasModifier("Cloaking")){
_local5[_local6].setCloaked(false);
};
_local6++;
};
}
override public function fire():void{
var _local5:int;
var _local6:Tile;
var _local7:Unit;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
var _local12:GameUnit;
var _local13:TileSheet;
var _local14:String;
var _local15:Boolean;
var _local16:int;
var _local17:int;
var _local18:int;
var _local19:int;
var _local20:String;
var _local21:String;
super.fire();
var _local1:GameManager = GameManager.getInstance();
var _local2:Tile = _local1.tileAt(unitX, unitY);
var _local3:Unit = _local1.unitAt(unitX, unitY);
var _local4:Array = _local1.nodePath(path);
if ((((((_local2 == null)) || ((_local3 == null)))) || ((_local4 == null)))){
super.update();
throw (new Error("MoveUnitAction::Corrupt movement action"));
};
if (_local3.getController() != _local1.getActiveController()){
super.update();
throw (new Error("MoveUnitAction::Only the units controller may move the unit"));
};
if (_local3.hasMoved()){
super.update();
throw (new Error("MoveUnitAction::Unit cannot complete movement action. (Already moved | Invalid path)"));
};
if (_local1.canMove(_local3, _local4)){
if (_local3.getUnitData().hasModifier("Cloaking")){
if (_local3.isCloaked()){
_local3.setCloaked(false);
_local3.setCloaked(true);
};
};
_local5 = 1;
while (_local5 < _local4.length) {
_local6 = _local4[_local5];
_local7 = _local6.getUnit();
if (_local7 != null){
if ((((_local5 == (_local4.length - 1))) || (!(_local7.getController().isAllied(_local3.getController()))))){
do {
_local4.splice(_local5, (_local4.length - _local5));
_local5--;
} while (((!((_local4[(_local4.length - 1)].getUnit() == null))) && (!((_local4[(_local4.length - 1)].getUnit() == _local3)))));
if (!_local7.getController().isAllied(_local3.getController())){
uncloak = _local7;
};
break;
};
};
_local5++;
};
destination = _local4[(_local4.length - 1)];
if (destination.getUnit() != _local3){
_local3.getUnitData().playSound(AudioProfile.k_moveType);
_local8 = _local3.getX();
_local9 = _local3.getY();
_local10 = _local3.getGameUnit().x;
_local11 = _local3.getGameUnit().y;
_local12 = _local3.getGameUnit();
_local13 = (_local3.getGameUnit().getSprite() as TileSheet);
_local14 = "";
if (_local4.length > 1){
_local5 = 1;
while (_local5 < _local4.length) {
_local16 = _local4[_local5].getGameTile().x;
_local17 = _local4[_local5].getGameTile().y;
_local18 = _local4[_local5].getX();
_local19 = _local4[_local5].getY();
if (((!((_local18 == _local8))) || (!((_local19 == _local9))))){
_local20 = direction(_local8, _local9, _local18, _local19);
if (_local20 != _local14){
TweenManager.getInstance().add(new TweenAnimation(_local13, _local20, false, _local12), TweenManager.SEQUENTIAL);
_local14 = _local20;
};
_local8 = _local18;
_local9 = _local19;
};
if ((((_local5 == 1)) && ((_local5 == (_local4.length - 1))))){
TweenManager.getInstance().add(new Tween(_local12, Quad.easeInOut, ["x", "y"], [_local10, _local11], [_local16, _local17], 400), TweenManager.SEQUENTIAL);
} else {
if (_local5 == 1){
TweenManager.getInstance().add(new Tween(_local12, Quad.easeIn, ["x", "y"], [_local10, _local11], [_local16, _local17], 400), TweenManager.SEQUENTIAL);
} else {
if (_local5 == (_local4.length - 1)){
TweenManager.getInstance().add(new Tween(_local12, Quad.easeOut, ["x", "y"], [_local10, _local11], [_local16, _local17], 400), TweenManager.SEQUENTIAL);
} else {
TweenManager.getInstance().add(new Tween(_local12, Linear.easeNone, ["x", "y"], [_local10, _local11], [_local16, _local17], 200), TweenManager.SEQUENTIAL);
};
};
};
_local10 = _local16;
_local11 = _local17;
_local5++;
};
TweenManager.getInstance().add(new TweenAnimation(_local13, (_local14 + "_idle"), false, _local12), TweenManager.SEQUENTIAL);
_local15 = false;
if (_local3.getController().getTeam().getControllerType() != "Human"){
_local15 = true;
};
if (((_local3.isCloaked()) && (!(_local3.getController().showCloak())))){
_local1.getCamera().setTarget(_local12, 500, _local15);
} else {
_local1.getCamera().setTarget(_local12, (_local4.length * 400), _local15);
};
_local1.getGameSpriteScroller().swapDepth(_local12, GameSpriteScroller.UNITS);
};
};
TweenManager.getInstance().add(new TweenFunction(fireImplied, _local12), TweenManager.SEQUENTIAL);
} else {
super.update();
_local21 = (((("MoveUnitAction::" + _local3) + " cannot complete movement action to ") + destination) + ". (Invalid path)");
throw (new Error(_local21));
};
}
protected function direction(_arg1:int, _arg2:int, _arg3:int, _arg4:int):String{
if (_arg2 == _arg4){
if (_arg1 < _arg3){
return ("right");
};
return ("left");
};
if (_arg2 < _arg4){
return ("down");
};
return ("up");
}
}
}//package com.gamedozer.battalion.game.actions
Section 48
//NoAttackAction (com.gamedozer.battalion.game.actions.NoAttackAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
public class NoAttackAction extends Action {
protected var unitX:int;
protected var unitY:int;
public function NoAttackAction(_arg1:int, _arg2:int){
unitX = _arg1;
unitY = _arg2;
}
override public function usesUnit(_arg1:Unit):Boolean{
var _local2:GameManager = GameManager.getInstance();
var _local3:Unit = _local2.unitAt(unitX, unitY);
if (_local3 == _arg1){
trace((("Unit " + _local3) + " is being used and must not be stolen."));
};
return ((_local3 == _arg1));
}
override public function fire():void{
super.fire();
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(unitX, unitY);
if (_local2 == null){
throw (new Error("NoAttackAction::Corrupt action"));
};
if (_local2.getController() != _local1.getActiveController()){
throw (new Error("NoAttackAction::Only the units controller may do this action"));
};
_local2.darken();
_local2.setMoved(true);
}
}
}//package com.gamedozer.battalion.game.actions
Section 49
//RepairUnitAction (com.gamedozer.battalion.game.actions.RepairUnitAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
public class RepairUnitAction extends Action {
protected var unitX:int;
protected var unitY:int;
public function RepairUnitAction(_arg1:int, _arg2:int){
unitX = _arg1;
unitY = _arg2;
}
override public function usesUnit(_arg1:Unit):Boolean{
var _local2:GameManager = GameManager.getInstance();
var _local3:Unit = _local2.unitAt(unitX, unitY);
return ((_local3 == _arg1));
}
override public function fire():void{
var _local3:Number;
super.fire();
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(unitX, unitY);
if (_local2 == null){
throw (new Error("RepairUnitAction::Corrupt repair action"));
};
if (_local2.getController() != _local1.getActiveController()){
throw (new Error("RepairUnitAction::Only the units controller may repair the unit"));
};
if (((((!(_local2.hasMoved())) && (!(_local2.hasFired())))) || (!(_local2.isDeployed())))){
if (_local2.getHealth() < _local2.getUnitData().getHealth()){
_local3 = GameManager.getInstance().healPercentage(_local2);
if (_local2.getController().getResources() >= (_local2.getUnitData().getCost(_local2.getController()) * _local3)){
_local2.getController().spendResources(Math.round((_local2.getUnitData().getCost(_local2.getController()) * _local3)));
_local2.setRepairing(true);
_local2.setMoved(true);
_local2.setFired(true);
_local2.darken();
} else {
throw (new Error("RepairUnitAction::Units controller cannot afford the repair."));
};
};
} else {
throw (new Error("RepairUnitAction::Unit cannot complete repair action. (Already moved)"));
};
TriggerManager.getInstance().add(new RepairUnitTrigger(_local2));
}
}
}//package com.gamedozer.battalion.game.actions
Section 50
//SendTriggerAction (com.gamedozer.battalion.game.actions.SendTriggerAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.game.*;
public class SendTriggerAction extends Action {
protected var trigger:Trigger;
public function SendTriggerAction(_arg1:Trigger){
trigger = _arg1;
}
override public function fire():void{
super.fire();
TriggerManager.getInstance().add(trigger);
}
}
}//package com.gamedozer.battalion.game.actions
Section 51
//StartGameAction (com.gamedozer.battalion.game.actions.StartGameAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.game.*;
public class StartGameAction extends Action {
override public function fire():void{
super.fire();
var _local1:GameManager = GameManager.getInstance();
_local1.setTurn(0);
_local1.setRound(0);
_local1.setCurrentController(0);
TriggerManager.getInstance().add(new Trigger(Trigger.START_GAME));
}
}
}//package com.gamedozer.battalion.game.actions
Section 52
//StartRoundAction (com.gamedozer.battalion.game.actions.StartRoundAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.game.*;
public class StartRoundAction extends Action {
override public function fire():void{
super.fire();
TriggerManager.getInstance().add(new Trigger(Trigger.START_ROUND));
}
}
}//package com.gamedozer.battalion.game.actions
Section 53
//StartTurnAction (com.gamedozer.battalion.game.actions.StartTurnAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
public class StartTurnAction extends Action {
override public function fire():void{
var _local6:Unit;
var _local7:int;
var _local8:Array;
var _local9:int;
var _local10:Number;
var _local11:Number;
var _local12:Array;
var _local13:int;
var _local14:Boolean;
super.fire();
var _local1:Controller = GameManager.getInstance().getActiveController();
var _local2:Array = _local1.getUnits();
var _local3:int;
while (_local3 < _local2.length) {
_local6 = _local2[_local3];
if (((_local6.isDeployed()) && (_local6.isAlive()))){
_local6.reset();
_local6.takeDamage(GameManager.getInstance().tileAt(_local6.getX(), _local6.getY()).getTerrain().applyModifiers("damage", _local6, 0));
if (!_local6.isAlive()){
TriggerManager.getInstance().add(new KillUnitTrigger(_local6.getX(), _local6.getY(), _local6));
GameManager.getInstance().removeUnit(_local6);
};
if (_local6.isRepairing()){
if (_local6.getHealth() < _local6.getUnitData().getHealth()){
_local10 = GameManager.getInstance().healPercentage(_local6);
_local6.healDamage((_local6.getUnitData().getHealth() * _local10));
_local6.setRepairing(false);
};
};
GameManager.getInstance().getCamera().setTarget(_local6.getGameUnit());
_local7 = _local6.getUnitData().applyModifiers("radar", _local6, 1);
_local8 = GameManager.getInstance().unitsInRange(_local6, true, -1, -1, 1, _local7);
_local9 = 0;
while (_local9 < _local8.length) {
if (_local8[_local9].getUnitData().hasModifier("Cloaking")){
_local8[_local9].setCloaked(false);
};
_local9++;
};
if (_local6.getUnitData().hasModifier("Cloaking")){
if (_local6.isCloaked()){
_local6.getUnitData().addTemporaryModifier(ModifierManager.getInstance().get("Cloak Damage"));
};
};
};
_local3++;
};
_local2 = GameManager.getInstance().getUnits();
_local3 = 0;
while (_local3 < _local2.length) {
_local6 = _local2[_local3];
if (((_local6.isDeployed()) && (_local6.isAlive()))){
_local11 = _local6.getUnitData().applyModifiers("heal", _local6, 0);
if (_local11 > 0){
if (_local6.getHealth() < _local6.getUnitData().getHealth()){
_local6.healDamage(_local11);
};
};
};
_local3++;
};
var _local4:Array = GameManager.getInstance().getControllers();
_local3 = 0;
while (_local3 < _local4.length) {
if (_local4[_local3] != null){
_local12 = _local4[_local3].getStructures();
_local13 = 0;
_local9 = 0;
while (_local9 < _local12.length) {
_local13 = (_local13 + _local12[_local9].takeResources((1 / _local4.length)));
_local9++;
};
if (_local4[_local3] == _local1){
_local9 = 0;
while (_local9 < _local12.length) {
if (_local12[_local9].getTerrain().hasModifier("Mission Critical")){
GameManager.getInstance().getCamera().setTarget(_local12[_local9].getGameTile());
};
_local9++;
};
};
_local13 = Math.round((_local13 * _local4[_local3].getDifficultyResourcesScale()));
_local4[_local3].addResources(_local13);
_local4[_local3].getTeam().addStatistic(Team.RESOURCES_COLLECTED, _local13);
TriggerManager.getInstance().add(new ResourcesAcquiredTrigger(GameManager.getInstance().getPlayer(_local4[_local3]), _local13));
};
_local3++;
};
var _local5:Array = GameManager.getInstance().getStructures();
_local3 = 0;
while (_local3 < _local5.length) {
_local6 = _local5[_local3].getUnit();
_local14 = false;
if (_local6 != null){
if (((_local6.isDeployed()) && (_local6.isAlive()))){
trace(("Checking unit " + _local6), ("; has capture? " + _local6.getUnitData().hasModifier("Capture")));
if (_local6.getUnitData().hasModifier("Capture")){
trace("Capture is true.");
_local14 = true;
if (_local1.controlsUnit(_local6)){
trace("Doing the capture");
ActionManager.getInstance().add(new CaptureTerrainAction(_local5[_local3].getX(), _local5[_local3].getY()));
};
};
};
};
if (!_local14){
_local5[_local3].setChunks(GameManager.TILE_CHUNKS);
_local5[_local3].setCapturer(null);
};
_local3++;
};
_local1.setCamera();
ActionManager.getInstance().add(new SendTriggerAction(new PlayerTrigger(PlayerTrigger.START_TURN, GameManager.getInstance().getCurrentController())));
}
}
}//package com.gamedozer.battalion.game.actions
Section 54
//SurrenderAction (com.gamedozer.battalion.game.actions.SurrenderAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
public class SurrenderAction extends Action {
protected var player:int;
public function SurrenderAction(_arg1:int){
player = _arg1;
}
public function fireImplied():void{
super.update();
GameManager.getInstance().surrender(player);
var _local1:Controller = GameManager.getInstance().getController(player);
var _local2:Array = _local1.getUnits();
var _local3:int = (_local2.length - 1);
while (_local3 >= 0) {
GameManager.getInstance().removeUnit(_local2[_local3]);
_local3--;
};
var _local4:Array = _local1.getStructures();
_local3 = (_local4.length - 1);
while (_local3 >= 0) {
if (_local4[_local3].getTerrain().hasModifier("Mission Critical")){
GameManager.getInstance().removeStructure(_local4[_local3]);
} else {
_local4[_local3].setController(null);
};
_local3--;
};
TriggerManager.getInstance().add(new PlayerTrigger(PlayerTrigger.SURRENDER, player));
}
override public function fire():void{
super.fire();
var _local1:Controller = GameManager.getInstance().getController(player);
var _local2:Array = _local1.getUnits();
var _local3:int = (_local2.length - 1);
while (_local3 >= 0) {
GameManager.getInstance().addExplosion("Explosion", _local2[_local3].getGameUnit());
TweenManager.getInstance().add(new Tween(_local2[_local3].getGameUnit(), Quad.easeIn, ["alpha"], [1], [0], 1000), TweenManager.SEQUENTIAL);
_local3--;
};
var _local4:Array = _local1.getStructures();
_local3 = (_local4.length - 1);
while (_local3 >= 0) {
GameManager.getInstance().addExplosion("Explosion", null, ((_local4[_local3].getX() + 0.5) * TileManager.getInstance().getWidth()), ((_local4[_local3].getY() + 1) * TileManager.getInstance().getHeight()));
_local3--;
};
fireImplied();
}
override public function update():void{
}
override public function toXML():XML{
return (new XML((("<action type=\"surrenderAction\"> <player value=\"" + (player + 1)) + "\"/> </action>")));
}
public static function getFromXML(_arg1:XML):Action{
var _local2:String = _arg1.player.@value;
return (new SurrenderAction((parseInt(_local2) - 1)));
}
}
}//package com.gamedozer.battalion.game.actions
Section 55
//UpgradeUnitAction (com.gamedozer.battalion.game.actions.UpgradeUnitAction)
package com.gamedozer.battalion.game.actions {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
public class UpgradeUnitAction extends Action {
protected var upgrade:Boolean;
protected var tileSheet:TileSheet;
protected var unitX:int;
protected var unitY:int;
protected var unitType:String;
public function UpgradeUnitAction(_arg1:int, _arg2:int, _arg3:Boolean, _arg4:String=""){
unitX = _arg1;
unitY = _arg2;
upgrade = _arg3;
unitType = _arg4;
}
override public function update():void{
}
override public function usesUnit(_arg1:Unit):Boolean{
var _local2:GameManager = GameManager.getInstance();
var _local3:Unit = _local2.unitAt(unitX, unitY);
return ((_local3 == _arg1));
}
public function fireImplied():void{
super.update();
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(unitX, unitY);
if (upgrade){
_local2.getController().spendResources(_local2.getUnitData().getCost());
};
TriggerManager.getInstance().add(new UpgradeUnitTrigger(_local2, upgrade));
_local2.setCloaked(false);
}
override public function fire():void{
var _local2:Unit;
var _local3:Tile;
var _local4:UnitData;
var _local5:UnitData;
super.fire();
var _local1:GameManager = GameManager.getInstance();
_local2 = _local1.unitAt(unitX, unitY);
if (_local2 == null){
super.update();
throw (new Error("UpgradeUnitAction::Corrupt upgrade action"));
};
if (_local2.getController() != _local1.getActiveController()){
super.update();
throw (new Error("UpgradeUnitAction::Only the units controller may upgrade the unit"));
};
if (((((!(_local2.hasMoved())) && (!(_local2.hasFired())))) || (!(_local2.isDeployed())))){
_local2.setCloaked(false);
if (!upgrade){
_local3 = _local1.tileAt(_local2.getX(), _local2.getY());
_local4 = _local2.getBaseUnitData();
if (_local3.getCost(new Unit(new GameUnit(new GameSprite()), _local4, 0, 0, _local2.getController())) != Number.POSITIVE_INFINITY){
tileSheet = (_local2.getGameUnit().getSprite() as TileSheet);
_local2.downgrade();
tileSheet.x = (_local2.getGameUnit().x + tileSheet.x);
tileSheet.y = (_local2.getGameUnit().y + tileSheet.y);
_local1.getGameSpriteScroller().add(tileSheet, GameSpriteScroller.ABOVE_UNITS);
TweenManager.getInstance().add(new Tween(_local2.getGameUnit().getSprite(), Linear.easeOut, ["alpha"], [0], [1], 1000), TweenManager.SEQUENTIAL_ALL);
TweenManager.getInstance().add(new Tween(tileSheet, Linear.easeIn, ["alpha"], [1], [0], 1000, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenDisplay(tileSheet, false, GameSpriteScroller.ABOVE_UNITS, this), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(fireImplied, this), TweenManager.SEQUENTIAL);
_local1.getCamera().setTarget(_local2.getGameUnit(), 500);
} else {
super.update();
};
} else {
_local5 = UnitManager.getInstance().get(unitType);
if (_local2.getController().getResources() < _local5.getCost()){
super.update();
throw (new Error("UpgradeUnitAction::Controller cannot afford unit"));
};
tileSheet = TileSheetManager.getInstance().getColorised(_local5.getSprite(), _local2.getController().getTeam().getColor());
tileSheet.alpha = 0;
TweenManager.getInstance().add(new Tween(_local2.getGameUnit().getSprite(), Linear.easeIn, ["alpha"], [1], [0], 1000, this));
_local2.upgrade(tileSheet, _local5);
TweenManager.getInstance().add(new Tween(_local2.getGameUnit().getSprite(), Linear.easeOut, ["alpha"], [0], [1], 1000, this));
TweenManager.getInstance().add(new TweenFunction(fireImplied, this), TweenManager.SEQUENTIAL);
_local1.getCamera().setTarget(_local2.getGameUnit(), 500);
};
} else {
super.update();
throw (new Error("MoveUnitAction::Unit cannot complete upgrade action. (Already moved | Fired)"));
};
}
}
}//package com.gamedozer.battalion.game.actions
Section 56
//AIEngine (com.gamedozer.battalion.game.ai.AIEngine)
package com.gamedozer.battalion.game.ai {
import com.gamedozer.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.controllers.*;
import com.gamedozer.battalion.game.actions.*;
public class AIEngine {
private var m_game:GameManager;
private var m_localInfluence:ControllerInfluence;
private var m_taskManager:AITaskManager;
private var m_unitBuilder:UnitBuilder;
private var m_controllerInfluences:Array;
private var m_controller:AIController;
public function AIEngine(_arg1:AIController){
m_controller = _arg1;
m_controllerInfluences = new Array();
m_taskManager = new AITaskManager(this);
m_unitBuilder = new UnitBuilder(this);
m_game = GameManager.getInstance();
}
public function startLoading():void{
var _local2:ControllerInfluence;
var _local1:int;
while (_local1 < m_controllerInfluences.length) {
_local2 = m_controllerInfluences[_local1];
_local2.initialize();
_local1++;
};
}
public function doNothing():void{
}
function getDangerToArmorType(_arg1:Tile, _arg2:int):Number{
var _local5:ControllerInfluence;
var _local6:InfluenceMapDangerToArmorType;
var _local3:Number = 0;
var _local4:int;
while (_local4 < m_controllerInfluences.length) {
_local5 = m_controllerInfluences[_local4];
_local6 = _local5.getDangerToArmorType(_arg2);
if (isLocalInfluence(_local5)){
_local3 = (_local3 + _local6.getWeight(_arg1));
} else {
_local3 = (_local3 - _local6.getWeight(_arg1));
};
_local4++;
};
return (_local3);
}
public function isStillInitializing():Boolean{
var _local2:ControllerInfluence;
if (m_controllerInfluences.length == 0){
return (true);
};
var _local1:int;
while (_local1 < m_controllerInfluences.length) {
_local2 = m_controllerInfluences[_local1];
if (_local2.isStillInitializing()){
return (true);
};
_local1++;
};
return (false);
}
public function getDangerForUnit(_arg1:Unit, _arg2:Tile):Number{
return (m_localInfluence.getDangerForUnit(_arg1, _arg2));
}
public function captureTerrain(_arg1:Tile, _arg2:int, _arg3:int, _arg4:Boolean):void{
var _local6:ControllerInfluence;
var _local5:int;
while (_local5 < m_controllerInfluences.length) {
_local6 = m_controllerInfluences[_local5];
_local6.captureTerrain(_arg1, _arg2, _arg3, _arg4);
_local5++;
};
}
public function initialize():void{
var _local3:ControllerInfluence;
var _local1:Array = GameManager.getInstance().getControllers();
var _local2:int;
while (_local2 < _local1.length) {
if (m_controller == m_controller){
_local3 = new ControllerInfluence(_local1[_local2]);
m_localInfluence = _local3;
m_controllerInfluences.push(_local3);
};
_local2++;
};
}
public function getController():AIController{
return (m_controller);
}
public function getCapturePriority(_arg1:Tile):Number{
return (m_localInfluence.getCapturePriority(_arg1));
}
public function parseUnitList():void{
var _local2:Unit;
var _local3:AITaskKillUnit;
var _local4:int;
var _local5:AITaskRepairUnit;
var _local6:ControllerInfluence;
var _local1:Array = m_game.getUnits();
for each (_local2 in _local1) {
if (m_controller.controlsUnit(_local2)){
_local5 = new AITaskRepairUnit(m_taskManager, _local2);
} else {
_local3 = new AITaskKillUnit(m_taskManager, _local2);
_local4 = 0;
while (_local4 < m_controllerInfluences.length) {
_local6 = m_controllerInfluences[_local4];
_local6.addUnit(_local2);
_local4++;
};
};
};
}
public function handleMovedUnit(_arg1:Unit, _arg2:Array):void{
var _local4:ControllerInfluence;
var _local3:int;
while (_local3 < m_controllerInfluences.length) {
_local4 = m_controllerInfluences[_local3];
_local4.moveUnit(_arg1, _arg2);
_local3++;
};
}
public function handleBuiltUnit(_arg1:Unit):void{
var _local3:AITaskKillUnit;
var _local4:AITaskRepairUnit;
var _local5:ControllerInfluence;
if (!m_controller.controlsUnit(_arg1)){
_local3 = new AITaskKillUnit(m_taskManager, _arg1);
} else {
_local4 = new AITaskRepairUnit(m_taskManager, _arg1);
};
var _local2:int;
while (_local2 < m_controllerInfluences.length) {
_local5 = m_controllerInfluences[_local2];
_local5.addUnit(_arg1);
_local2++;
};
}
public function parseTileMap():void{
var _local3:int;
var _local4:Tile;
var _local5:AITaskCapture;
var _local1:Array = m_game.getTileMap();
var _local2:int;
while (_local2 < _local1.length) {
_local3 = 0;
while (_local3 < _local1[_local2].length) {
_local4 = _local1[_local2][_local3];
if (_local4.isStructure()){
_local5 = new AITaskCapture(m_taskManager, _local4);
};
_local3++;
};
_local2++;
};
}
public function changeUpgradeStatus(_arg1:Unit, _arg2:String, _arg3:Boolean):void{
var _local5:ControllerInfluence;
var _local4:int;
while (_local4 < m_controllerInfluences.length) {
_local5 = m_controllerInfluences[_local4];
_local5.changeUpgradeStatus(_arg1, _arg2, _arg3);
_local4++;
};
}
public function getKillPriority(_arg1:Unit):Number{
return (m_localInfluence.getKillPriority(_arg1));
}
function buildUnits():void{
m_unitBuilder.build();
m_unitBuilder.flush();
}
function queueBuild(_arg1:AITask):void{
m_unitBuilder.queueBuild(_arg1);
}
public function isSafeToRepair(_arg1:Unit):Boolean{
return (m_localInfluence.isSafeToRepair(_arg1));
}
public function handleKilledUnit(_arg1:Unit, _arg2:Number, _arg3:Number):void{
var _local5:ControllerInfluence;
m_taskManager.handleKilledUnit(_arg1);
var _local4:int;
while (_local4 < m_controllerInfluences.length) {
_local5 = m_controllerInfluences[_local4];
_local5.removeUnit(_arg1);
_local4++;
};
}
public function getArmyFocalPoint():Tile{
var _local2:ControllerInfluence;
var _local3:InfluenceMapDangerToArmorType;
var _local4:Tile;
var _local1:int;
while (_local1 < m_controllerInfluences.length) {
_local2 = m_controllerInfluences[_local1];
_local3 = _local2.getDangerToArmorType(1);
if (isLocalInfluence(_local2)){
_local4 = _local3.getMinimumTile();
return (_local4);
};
_local1++;
};
return (null);
}
public function finishTurn():void{
try {
m_taskManager.cleanupThink();
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, buildUnits)));
ActionManager.getInstance().add(new EndTurnAction());
} catch(e:Error) {
trace("AIEngine", e, e.getStackTrace());
};
}
public function think():void{
try {
m_taskManager.think();
if (ActionManager.getInstance().isEmpty()){
ActionManager.getInstance().add(new CallbackAction(doNothing));
};
} catch(e:Error) {
trace("AIEngine", e, e.getStackTrace());
};
}
public function getTacticalPriority(_arg1:Tile):Number{
return (m_localInfluence.getTacticalPriority(_arg1));
}
function isLocalInfluence(_arg1:ControllerInfluence):Boolean{
return ((m_localInfluence == _arg1));
}
public function attackUnit(_arg1:Unit, _arg2:Unit, _arg3:Number):void{
}
public function startTurn():void{
trace("");
trace("");
trace(("START TURN " + this.getController().getTeam().getName()));
try {
m_taskManager.prepareThink();
} catch(e:Error) {
trace("AIEngine", e, e.getStackTrace());
};
}
}
}//package com.gamedozer.battalion.game.ai
Section 57
//AITask (com.gamedozer.battalion.game.ai.AITask)
package com.gamedozer.battalion.game.ai {
import com.gamedozer.battalion.data.*;
public class AITask {
var m_manager:AITaskManager;
var m_isCompleted:Boolean;
var m_priority:Number;// = 0
public function AITask(_arg1:AITaskManager){
m_manager = _arg1;
m_isCompleted = false;
m_manager.addTask(this);
}
public function assignUnits(_arg1:Array):void{
assignUnitsImpl(_arg1);
}
public function isComplete():Boolean{
return (m_isCompleted);
}
protected function executeImpl():void{
}
protected function assignUnitsImpl(_arg1:Array):void{
trace("AITask.assignUnitImpl: Implement this!!!!!!!!!!!!");
}
public function set priority(_arg1:Number):void{
this.m_priority = _arg1;
}
public function updatePriority():void{
updatePriorityImpl();
}
public function handleUnitDied(_arg1:Unit):void{
handleUnitDiedImpl(_arg1);
}
protected function updatePriorityImpl():void{
trace("AITask.updataePriority: Implement this!!!!!!!!!!!!");
}
protected function handleUnitDiedImpl(_arg1:Unit):void{
}
function dispose():void{
disposeImpl();
m_manager = null;
}
public function get priority():Number{
return (this.m_priority);
}
public function completeTask():void{
m_isCompleted = true;
}
function calculateMinimumResourcesRequiredToBuild():Number{
return (0);
}
public function marshallReinforcements(_arg1:Array):void{
marshallReinforcementsImpl(_arg1);
}
protected function buildImpl(_arg1:Array, _arg2:Number):Number{
trace("AITask.buildImpl: Implement this!!!!!!!!!!!!!");
return (0);
}
protected function marshallReinforcementsImpl(_arg1:Array):void{
}
public function build(_arg1:Array, _arg2:Number):Number{
return (buildImpl(_arg1, _arg2));
}
protected function disposeImpl():void{
}
public function toString():String{
return ((("[AITask: " + priority) + " ]"));
}
public function execute():void{
executeImpl();
}
}
}//package com.gamedozer.battalion.game.ai
Section 58
//AITaskCapture (com.gamedozer.battalion.game.ai.AITaskCapture)
package com.gamedozer.battalion.game.ai {
import com.gamedozer.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.controllers.*;
import com.gamedozer.battalion.game.actions.*;
public class AITaskCapture extends AITask {
private var m_captureTargetTile:Tile;
private var m_capturingUnit:Unit;
public function AITaskCapture(_arg1:AITaskManager, _arg2:Tile){
super(_arg1);
m_captureTargetTile = _arg2;
priority = 0.65;
}
override protected function assignUnitsImpl(_arg1:Array):void{
var _local9:int;
var _local10:Unit;
var _local11:Tile;
var _local12:int;
var _local13:AIEngine;
var _local14:Unit;
var _local15:Tile;
var _local16:int;
var _local17:Controller;
var _local18:UnitData;
var _local19:Unit;
var _local20:MovementCombiner;
var _local21:Tile;
var _local22:int;
var _local2:GameManager = GameManager.getInstance();
var _local3:Unit = m_captureTargetTile.getUnit();
if (((((!((_local3 == null))) && (_local3.getUnitData().hasModifier("Capture")))) && ((_local3.getController() == m_manager.getController())))){
_local9 = _arg1.indexOf(_local3);
if (_local9 >= 0){
_arg1.splice(_local9, 1);
} else {
trace("ISSUE WITH CAPTURE. COULD NOT FIND BEST UNIT.");
};
m_capturingUnit = _local3;
return;
};
m_capturingUnit = null;
var _local4:Unit;
var _local5 = 1000000;
var _local6 = -1;
var _local7:Boolean;
var _local8:int;
while (_local8 < _arg1.length) {
_local10 = _arg1[_local8];
if ((((m_captureTargetTile.getTerrain().getName() == "Oil Rig")) && ((_local10.getBaseUnitData().getName().indexOf("Commando") >= 0)))){
} else {
if (_local10.getUnitData().hasModifier("Capture")){
_local7 = true;
_local11 = _local2.tileAt(_local10.getX(), _local10.getY());
if (_local11 == m_captureTargetTile){
_local4 = _local10;
_local5 = _local12;
_local6 = _local8;
break;
};
_local12 = Astar.calculateTurnsToPath(_local11, m_captureTargetTile, _local10, Tile.k_astarFlagIgnoreLastNode);
if ((((_local12 >= 0)) && ((_local12 < _local5)))){
_local4 = _local10;
_local5 = _local12;
_local6 = _local8;
};
};
if (_local10.getBaseUnitData().hasModifier("Capture")){
_local7 = true;
};
};
_local8++;
};
if (_local4 != null){
_arg1.splice(_local6, 1);
m_capturingUnit = _local4;
return;
};
if (!_local7){
_local13 = m_manager.getEngine();
_local13.queueBuild(this);
return;
};
if (_local4 == null){
_local5 = 9999999999;
_local14 = null;
_local15 = null;
_local13 = m_manager.getEngine();
_local17 = _local13.getController();
if (_local17.controlsAir()){
_local8 = 0;
while (_local8 < _arg1.length) {
_local10 = _arg1[_local8];
if (!_local10.getBaseUnitData().hasModifier("Capture")){
} else {
if ((((m_captureTargetTile.getTerrain().getName() == "Oil Rig")) && ((_local10.getBaseUnitData().getName().indexOf("Commando") >= 0)))){
} else {
_local11 = _local2.tileAt(_local10.getX(), _local10.getY());
_local18 = UnitManager.getInstance().get("Albatross Transport");
_local19 = new Unit(new GameUnit(new GameSprite()), _local18);
_local12 = (Math.abs((_local11.getX() - m_captureTargetTile.getX())) + Math.abs((_local11.getY() - m_captureTargetTile.getY())));
if ((((_local12 >= 0)) && ((_local12 < _local5)))){
_local14 = _local10;
_local5 = _local12;
_local6 = _local8;
};
};
};
_local8++;
};
if (_local14 != null){
_local11 = _local2.tileAt(_local14.getX(), _local14.getY());
if (_local11 == m_captureTargetTile){
if (_local14.isUpgraded()){
ActionManager.getInstance().add(new UpgradeUnitAction(_local14.getX(), _local14.getY(), false));
};
} else {
if (!_local14.isUpgraded()){
ActionManager.getInstance().add(new UpgradeUnitAction(_local14.getX(), _local14.getY(), true, "Albatross Transport"));
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, delayedMove, _local14)));
} else {
moveTo(_local14, m_captureTargetTile);
};
};
_arg1.splice(_local16, 1);
return;
};
} else {
_local8 = 0;
while (_local8 < _arg1.length) {
_local10 = _arg1[_local8];
if ((((m_captureTargetTile.getTerrain().getName() == "Oil Rig")) && ((_local10.getBaseUnitData().getName().indexOf("Commando") >= 0)))){
} else {
_local11 = _local2.tileAt(_local10.getX(), _local10.getY());
if (_local10.getBaseUnitData().hasModifier("Capture")){
_local20 = _local2.getMovementCombiner();
_local21 = _local20.getInterimDestination(_local11, m_captureTargetTile, _local10);
if (_local21 != null){
_local22 = _local20.getTurnCount();
if (_local22 < _local5){
_local5 = _local22;
_local14 = _local10;
_local15 = _local21;
_local16 = _local8;
};
};
};
};
_local8++;
};
if (_local14 != null){
_local11 = _local2.tileAt(_local14.getX(), _local14.getY());
if (_local15 == m_captureTargetTile){
if (((((((m_captureTargetTile.getTerrain().hasModifier("Construction")) && (_local14.isUpgraded()))) && (m_captureTargetTile.seaBordered()))) && (!((m_captureTargetTile == _local11))))){
moveTo(_local14, m_captureTargetTile);
} else {
if (_local14.isUpgraded()){
ActionManager.getInstance().add(new UpgradeUnitAction(_local14.getX(), _local14.getY(), false));
};
};
} else {
if (_local15 == _local11){
if (!_local14.isUpgraded()){
ActionManager.getInstance().add(new UpgradeUnitAction(_local14.getX(), _local14.getY(), true, "Leviathan Barge"));
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, delayedMove, _local14)));
} else {
ActionManager.getInstance().add(new UpgradeUnitAction(_local14.getX(), _local14.getY(), false));
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, delayedMove, _local14)));
};
} else {
moveTo(_local14, _local15);
};
};
_arg1.splice(_local16, 1);
return;
};
};
};
}
public function delayedMove(_arg1:Unit):void{
var _local2:GameManager = GameManager.getInstance();
var _local3:Tile = _local2.tileAt(_arg1.getX(), _arg1.getY());
var _local4:MovementCombiner = _local2.getMovementCombiner();
var _local5:Tile = _local4.getInterimDestination(_local3, m_captureTargetTile, _arg1);
moveTo(_arg1, _local5, true);
}
private function showMessage(_arg1:String):void{
m_captureTargetTile.showText(_arg1);
}
override public function toString():String{
return ((((("[CAP " + priority) + ": ") + m_captureTargetTile) + " ]"));
}
override protected function updatePriorityImpl():void{
var _local1:Unit;
var _local2:AIEngine;
var _local4:Tile;
var _local5:String;
var _local6:UnitData;
var _local7:Unit;
var _local8:int;
var _local9:int;
showMessage("");
if (m_captureTargetTile.getController() == m_manager.getController()){
priority = 0;
return;
};
_local1 = m_captureTargetTile.getUnit();
if (((!((_local1 == null))) && (!((_local1.getController() == m_manager.getController()))))){
priority = 0;
return;
};
_local2 = m_manager.getEngine();
priority = _local2.getTacticalPriority(m_captureTargetTile);
var _local3:Number = (_local2.getDangerToArmorType(m_captureTargetTile, 1) / 25);
if (_local3 > 0){
priority = (priority - _local3);
};
if (((((!((_local1 == null))) && ((_local1.getController() == m_manager.getController())))) && (_local1.getUnitData().hasModifier("Capture")))){
priority = (priority * 5);
return;
};
_local4 = _local2.getArmyFocalPoint();
if (_local4 != null){
_local5 = "Strike Commando";
if (m_captureTargetTile.isSeaBased()){
_local5 = "Leviathan Barge";
};
_local6 = UnitManager.getInstance().get(_local5);
_local7 = new Unit(new GameUnit(new GameSprite()), _local6);
_local8 = Astar.calculateTurnsToPath(m_captureTargetTile, _local4, _local7, Tile.k_astarFlagIgnoreLastNode);
_local9 = 10;
if ((((_local8 > _local9)) || ((_local8 < 0)))){
_local8 = _local9;
};
if (_local8 > 0){
priority = (priority * (1 / (1.5 * _local8)));
};
};
if (priority > 0){
showMessage(("CP: " + Math.round((priority * 1000))));
};
}
override protected function buildImpl(_arg1:Array, _arg2:Number):Number{
var _local7:String;
var _local8:String;
var _local9:UnitData;
var _local10:Unit;
var _local11:Tile;
var _local12:int;
var _local13:int;
var _local14:int;
var _local15:Tile;
var _local16:int;
if (m_capturingUnit != null){
return (0);
};
var _local3:Array = new Array();
var _local4:AIEngine = m_manager.getEngine();
var _local5:Controller = _local4.getController();
if (m_captureTargetTile.isSeaBased()){
_local3.push("Intrepid");
};
if (m_captureTargetTile.getTerrain().getName() != "Oil Rig"){
_local7 = "Heavy Commando";
if (Math.random() > 0.35){
_local3.push("Heavy Commando");
};
_local3.push("Strike Commando");
};
var _local6:int;
while (_local6 < _local3.length) {
_local8 = _local3[_local6];
_local9 = UnitManager.getInstance().get(_local8);
if (_local9.getCost(_local5) > _arg2){
} else {
if (((!(_local5.controlsSea())) && (_local9.isSea()))){
} else {
_local10 = new Unit(new GameUnit(new GameSprite()), _local9);
_local11 = null;
_local12 = 9999999999999;
_local13 = -1;
_local14 = 0;
while (_local14 < _arg1.length) {
_local15 = _arg1[_local14];
_local16 = Astar.calculateTurnsToPath(_local15, m_captureTargetTile, _local10, Tile.k_astarFlagIgnoreLastNode);
if ((((_local16 >= 0)) && ((_local16 < _local12)))){
_local12 = _local16;
_local13 = _local14;
_local11 = _local15;
};
_local14++;
};
if (_local11 != null){
_arg1.splice(_local13, 1);
ActionManager.getInstance().add(new BuildUnitAction(_local11.getX(), _local11.getY(), _local8), true);
return (_local9.getCost(_local5));
};
};
};
_local6++;
};
return (0);
}
override protected function handleUnitDiedImpl(_arg1:Unit):void{
if (m_capturingUnit == _arg1){
m_capturingUnit = null;
};
}
override function calculateMinimumResourcesRequiredToBuild():Number{
var _local1:UnitData;
if (m_capturingUnit != null){
return (0);
};
if (m_captureTargetTile.getTerrain().getName() == "Oil Rig"){
_local1 = UnitManager.getInstance().get("Intrepid");
} else {
_local1 = UnitManager.getInstance().get("Strike Commando");
};
return (_local1.getCost(m_manager.getEngine().getController()));
}
public function willAttackTargetOfOpportunity(_arg1:Unit):Boolean{
var _local8:int;
var _local9:int;
var _local10:Tile;
var _local11:Unit;
var _local12:Number;
var _local2:GameManager = GameManager.getInstance();
var _local3:int = _arg1.getX();
var _local4:int = _arg1.getY();
var _local5:Unit;
var _local6:Number = 0;
var _local7:int;
while (_local7 < 4) {
_local8 = 0;
_local9 = 0;
if (_local7 == 0){
_local8 = -1;
_local9 = 0;
} else {
if (_local7 == 1){
_local8 = 1;
_local9 = 0;
} else {
if (_local7 == 2){
_local8 = 0;
_local9 = -1;
} else {
_local8 = 0;
_local9 = 1;
};
};
};
_local10 = _local2.tileAt((_local3 + _local8), (_local4 + _local9));
if (_local10 == null){
} else {
_local11 = _local10.getUnit();
if (_local11 == null){
} else {
if (_local11.getController() == _arg1.getController()){
} else {
_local12 = _local2.resolveAttackCycleInResources(_arg1, _local11);
if ((((_local5 == null)) || ((((_local12 > 0)) && ((_local12 > _local6)))))){
_local5 = _local11;
_local6 = _local12;
};
};
};
};
_local7++;
};
if (_local5 != null){
ActionManager.getInstance().add(new AttackUnitAction(_local3, _local4, _local5.getX(), _local5.getY()), true);
return (true);
};
return (false);
}
protected function moveTo(_arg1:Unit, _arg2:Tile, _arg3:Boolean=false):void{
var _local8:Array;
var _local4:GameManager = GameManager.getInstance();
var _local5:Tile = _local4.tileAt(_arg1.getX(), _arg1.getY());
var _local6:int;
_local6 = Tile.k_astarFlagIgnoreLastNode;
var _local7:Array = Astar.pathTrim(_local5, _arg2, _arg1, _local6);
if (_local7 == null){
trace("AITaskCapture.moveTo: We can't reach our target. This should not have happened because we should never let a unit be assigned to us that was useless.");
} else {
if (_local7.length == 0){
trace("AITaskCapture. moveTo Why is our path 0?");
};
if ((((_local7.length > 0)) && (!((_local7[(_local7.length - 1)].getUnit() == null))))){
if (!_local7[(_local7.length - 1)].getUnit().isCloaked()){
_local7.pop();
};
};
_local8 = _local4.pointPath(_local7);
ActionManager.getInstance().add(new MoveUnitAction(_arg1.getX(), _arg1.getY(), _local8), _arg3);
};
}
override protected function executeImpl():void{
var _local6:Boolean;
if ((((m_capturingUnit == null)) || ((m_captureTargetTile == null)))){
return;
};
var _local1:AIEngine = m_manager.getEngine();
var _local2:Number = _local1.getDangerToArmorType(m_captureTargetTile, 1);
var _local3:GameManager = GameManager.getInstance();
var _local4:Tile = _local3.tileAt(m_capturingUnit.getX(), m_capturingUnit.getY());
var _local5:Tile = m_captureTargetTile;
if (_local4 == _local5){
_local6 = willAttackTargetOfOpportunity(m_capturingUnit);
if (_local6){
} else {
if (m_capturingUnit.getHealthPercentage() < 1){
_local1 = m_manager.getEngine();
if (_local1.isSafeToRepair(m_capturingUnit)){
ActionManager.getInstance().add(new RepairUnitAction(m_capturingUnit.getX(), m_capturingUnit.getY()));
};
} else {
ActionManager.getInstance().add(new NoAttackAction(m_capturingUnit.getX(), m_capturingUnit.getY()));
};
};
return;
};
moveTo(m_capturingUnit, _local5);
}
override protected function disposeImpl():void{
m_capturingUnit = null;
m_captureTargetTile = null;
}
}
}//package com.gamedozer.battalion.game.ai
Section 59
//AITaskKillUnit (com.gamedozer.battalion.game.ai.AITaskKillUnit)
package com.gamedozer.battalion.game.ai {
import com.gamedozer.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.controllers.*;
import com.gamedozer.battalion.game.actions.*;
public class AITaskKillUnit extends AITask {
private var m_targetUnit:Unit;
private var m_attackingUnits:Array;
public function AITaskKillUnit(_arg1:AITaskManager, _arg2:Unit){
super(_arg1);
m_targetUnit = _arg2;
m_attackingUnits = new Array();
priority = 0.5;
}
override protected function assignUnitsImpl(_arg1:Array):void{
var _local10:Unit;
var _local11:Unit;
var _local12:Number;
var _local13:AIEngine;
if (m_targetUnit == null){
completeTask();
return;
};
m_attackingUnits.splice(0);
var _local2:GameManager = GameManager.getInstance();
var _local3:Number = m_targetUnit.getHealth();
var _local4:Array = _arg1.slice();
var _local5:int = (_local4.length - 1);
while (_local5 >= 0) {
_local10 = _local4[_local5];
if (_local10.isUpgraded()){
_local4.splice(_local5, 1);
};
_local5--;
};
var _local6:Unit;
var _local7:Number = -999999999999;
var _local8 = -1;
var _local9:int;
while (_local9 < _local4.length) {
_local11 = _local4[_local9];
if (((!(_local11.isUpgraded())) && (_local2.canAttack(_local11, m_targetUnit, false, -1, -1, true)))){
_local12 = _local2.resolveAttackCycleInResources(_local11, m_targetUnit);
if (_local12 > _local7){
_local6 = _local11;
_local7 = _local12;
_local8 = _local9;
};
};
_local9++;
};
if (_local6 == null){
} else {
_local4.splice(_local8, 1);
_local3 = (_local3 - _local2.resolveAttack(_local6, m_targetUnit));
m_attackingUnits.push(_local6);
_arg1.splice(_local8, 1);
};
if (_local3 > 0){
_local13 = m_manager.getEngine();
_local13.queueBuild(this);
return;
};
}
public function processRangedUnit(_arg1:Unit):void{
var _local8:Number;
var _local10:Tile;
var _local11:Array;
var _local12:Number;
var _local2:Unit = _arg1;
var _local3:GameManager = GameManager.getInstance();
var _local4:Tile = _local3.tileAt(_local2.getX(), _local2.getY());
var _local5:Tile = _local3.tileAt(m_targetUnit.getX(), m_targetUnit.getY());
if (_local3.canAttack(_local2, m_targetUnit, false)){
ActionManager.getInstance().add(new AttackUnitAction(_local2.getX(), _local2.getY(), m_targetUnit.getX(), m_targetUnit.getY()), true);
return;
};
var _local6:Array = getTilesThatThisUnitCanAttackFrom(_local2);
var _local7:Array;
while (_local6.length > 0) {
_local10 = _local6[0];
_local6.splice(0, 1);
if (_local10.getUnit() != null){
} else {
_local11 = Astar.pathTrim(_local4, _local10, _local2);
if (_local11 == null){
} else {
_local12 = _local4.getTerrain().applyModifiers("defense", _local2, 1);
if ((((_local7 == null)) || ((_local12 < _local8)))){
_local7 = _local11;
_local8 = _local12;
};
};
};
};
if (_local7 == null){
trace("No suitable path to attack our target. Should this even be able to happen? Possibly. If so, TODO: Use this unit for something else.");
return;
};
var _local9:Array = _local3.pointPath(_local7);
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, attemptAttack, _local2, _local9[(_local9.length - 2)], _local9[(_local9.length - 1)])), true);
if (_local2.canMove()){
ActionManager.getInstance().add(new MoveUnitAction(_local2.getX(), _local2.getY(), _local9), true);
};
}
function moveUnitCloserToTarget(_arg1:Unit, _arg2:Tile):void{
var _local6:Array;
if (!_arg1.canMove()){
return;
};
var _local3:GameManager = GameManager.getInstance();
var _local4:Tile = _local3.tileAt(_arg1.getX(), _arg1.getY());
var _local5:Array = Astar.pathTrim(_local4, _arg2, _arg1, Tile.k_astarFlagIgnoreLastNode);
if (_local5 == null){
trace(((((("AITaskKillUnit. moveUnitCloserToTarget: Can't find path from " + _local4) + " to ") + _arg2) + " using ") + _arg1));
} else {
if (_local5[(_local5.length - 1)].getUnit() != null){
if (!_local5[(_local5.length - 1)].getUnit().isCloaked()){
_local5.pop();
};
};
while (_local5[(_local5.length - 1)].getUnit() != null) {
_local5.pop();
};
if (_local5.length == 0){
return;
};
_local6 = _local3.pointPath(_local5);
if (!_arg1.isRanged()){
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, attemptAttack, _arg1, _local6[(_local6.length - 2)], _local6[(_local6.length - 1)])), true);
};
if (_arg1.canMove()){
ActionManager.getInstance().add(new MoveUnitAction(_arg1.getX(), _arg1.getY(), _local6), true);
};
};
}
override protected function executeImpl():void{
var _local3:Unit;
if (m_attackingUnits.length == 0){
return;
};
var _local1:GameManager = GameManager.getInstance();
var _local2:int = (m_attackingUnits.length - 1);
while (_local2 >= 0) {
_local3 = m_attackingUnits[_local2];
if (_local3.isRanged()){
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, processRangedUnit, _local3)), true);
};
_local2--;
};
_local2 = (m_attackingUnits.length - 1);
while (_local2 >= 0) {
_local3 = m_attackingUnits[_local2];
if (!_local3.isRanged()){
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, processUnrangedUnit, _local3)), true);
};
_local2--;
};
}
override protected function disposeImpl():void{
m_attackingUnits.splice(0);
m_targetUnit = null;
}
function getPriorityBumpForPropertyType(_arg1:Tile):Number{
var _local2:String = _arg1.getTerrain().getName();
if (_local2 == "Command Center"){
return (0.2);
};
if (_local2 == "Sea Control"){
return (0.05);
};
if (_local2 == "Air Control"){
return (0.05);
};
if (_local2 == "Ground Control"){
return (0.05);
};
if (_local2 == "Factory"){
return (0.1);
};
if (_local2 == "Oil Rig"){
return (0.05);
};
if (_local2 == "Oil Refinery"){
return (0.025);
};
if (_local2 == "Advanced Oil Refinery"){
return (0.05);
};
trace(("AITaskKillUnit. Unknown structure : " + _local2));
return (0.1);
}
function createBestKillersQueue():Array{
var _local1:AIEngine = m_manager.getEngine();
var _local2:Controller = _local1.getController();
var _local3:Array = new Array();
switch (m_targetUnit.getName()){
case "Heavy Commando":
_local3.push("Battlecruiser");
_local3.push("Raptor Fighter");
_local3.push("Flak Tank");
_local3.push("Strike Commando");
break;
case "Strike Commando":
_local3.push("Battlecruiser");
_local3.push("Raptor Fighter");
_local3.push("Flak Tank");
_local3.push("Strike Commando");
break;
case "Flak Tank":
_local3.push("Battlecruiser");
_local3.push("Scorpion Tank");
_local3.push("Condor Bomber");
_local3.push("Raptor Fighter");
break;
case "Scorpion Tank":
_local3.push("Condor Bomber");
_local3.push("Raptor Fighter");
_local3.push("Battlecruiser");
_local3.push("Annihilator Tank");
_local3.push("Scorpion Tank");
_local3.push("Heavy Commando");
break;
case "Mortar Truck":
_local3.push("Condor Bomber");
_local3.push("Raptor Fighter");
_local3.push("Battlecruiser");
_local3.push("Flak Tank");
_local3.push("Mortar Truck");
_local3.push("Strike Commando");
break;
case "Rocket Truck":
_local3.push("Condor Bomber");
_local3.push("Raptor Fighter");
_local3.push("Battlecruiser");
_local3.push("Flak Tank");
_local3.push("Strike Commando");
break;
case "Annihilator Tank":
_local3.push("Condor Bomber");
_local3.push("Raptor Fighter");
_local3.push("Battlecruiser");
_local3.push("Annihilator Tank");
_local3.push("Heavy Commando");
break;
case "Turret":
_local3.push("Battlecruiser");
_local3.push("Raptor Fighter");
_local3.push("Annihilator Tank");
_local3.push("Scorpion Tank");
_local3.push("Heavy Commando");
break;
case "Stealth Tank":
_local3.push("Condor Bomber");
_local3.push("Raptor Fighter");
_local3.push("Battlecruiser");
_local3.push("Scorpion Tank");
_local3.push("Heavy Commando");
break;
case "Albatross Transport":
_local3.push("Raptor Fighter");
_local3.push("Flak Tank");
_local3.push("Hunter Support");
break;
case "Raptor Fighter":
_local3.push("Raptor Fighter");
_local3.push("Flak Tank");
_local3.push("Hunter Support");
break;
case "Condor Bomber":
_local3.push("Raptor Fighter");
_local3.push("Flak Tank");
_local3.push("Hunter Support");
break;
case "Leviathan Barge":
_local3.push("Condor Bomber");
_local3.push("Corvette Fighter");
_local3.push("Raptor Fighter");
break;
case "Hunter Support":
_local3.push("Condor Bomber");
_local3.push("Battlecruiser");
_local3.push("Corvette Fighter");
break;
case "Corvette Fighter":
_local3.push("Condor Bomber");
_local3.push("U-Boat");
_local3.push("Corvette Fighter");
_local3.push("Battlecruiser");
break;
case "U-Boat":
_local3.push("Condor Bomber");
_local3.push("Hunter Support");
break;
case "Battlecruiser":
_local3.push("Condor Bomber");
_local3.push("Raptor Fighter");
_local3.push("Corvette Fighter");
_local3.push("Battlecruiser");
break;
case "Intrepid":
_local3.push("Condor Bomber");
_local3.push("Raptor Fighter");
_local3.push("Hunter Support");
_local3.push("Battlecruiser");
break;
default:
trace(("AIEngine: buildUnitToKill, unknown unit type: " + m_targetUnit.getName()));
break;
};
return (_local3);
}
private function getTilesThatThisUnitCanAttackFrom(_arg1:Unit, _arg2:Boolean=false):Array{
var _local3:Tile = GameManager.getInstance().tileAt(_arg1.getX(), _arg1.getY());
var _local4:Tile = GameManager.getInstance().tileAt(m_targetUnit.getX(), m_targetUnit.getY());
return (Astar.calculatePositionsToTargetEndNode(_local3, _local4, _arg1, _arg2));
}
public function processUnrangedUnit(_arg1:Unit):void{
var _local9:Number;
var _local11:Tile;
var _local12:Array;
var _local13:Number;
var _local2:Unit = _arg1;
var _local3:GameManager = GameManager.getInstance();
var _local4:Tile = _local3.tileAt(_local2.getX(), _local2.getY());
var _local5:Tile = _local3.tileAt(m_targetUnit.getX(), m_targetUnit.getY());
if (_local3.canAttack(_local2, m_targetUnit, false)){
ActionManager.getInstance().add(new AttackUnitAction(_local2.getX(), _local2.getY(), m_targetUnit.getX(), m_targetUnit.getY()), true);
return;
};
var _local6:Array = new Array();
var _local7:Tile = _local3.tileAt(_local5.getX(), (_local5.getY() - 1));
if (_local7 != null){
_local6.push(_local7);
};
_local7 = _local3.tileAt(_local5.getX(), (_local5.getY() + 1));
if (_local7 != null){
_local6.push(_local7);
};
_local7 = _local3.tileAt((_local5.getX() + 1), _local5.getY());
if (_local7 != null){
_local6.push(_local7);
};
_local7 = _local3.tileAt((_local5.getX() - 1), _local5.getY());
if (_local7 != null){
_local6.push(_local7);
};
var _local8:Array;
while (_local6.length > 0) {
_local11 = _local6[0];
_local6.splice(0, 1);
if (_local11.getUnit() != null){
} else {
_local12 = Astar.pathTrim(_local4, _local11, _local2);
if (_local12 == null){
} else {
_local13 = _local4.getTerrain().applyModifiers("defense", _local2, 1);
if ((((_local8 == null)) || ((_local13 < _local9)))){
_local8 = _local12;
_local9 = _local13;
};
};
};
};
if (_local8 == null){
trace("No suitable path to attack our target. Should this even be able to happen? Possibly. If so, TODO: Use this unit for something else.");
return;
};
var _local10:Array = _local3.pointPath(_local8);
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, attemptAttack, _local2, _local10[(_local10.length - 2)], _local10[(_local10.length - 1)])), true);
if (_local2.canMove()){
ActionManager.getInstance().add(new MoveUnitAction(_local2.getX(), _local2.getY(), _local10), true);
};
}
override public function toString():String{
return ((((("[KLL " + m_priority) + ": ") + m_targetUnit) + " ]"));
}
override protected function updatePriorityImpl():void{
var _local5:Number;
if (m_targetUnit == null){
completeTask();
priority = 0;
return;
};
if (m_targetUnit.isCloaked()){
priority = 0;
return;
};
priority = ((m_targetUnit.getHealth() / m_targetUnit.getUnitData().getHealth()) * (m_targetUnit.getUnitData().getCost(m_targetUnit.getController()) / 30000));
var _local1:GameManager = GameManager.getInstance();
var _local2:Tile = _local1.tileAt(m_targetUnit.getX(), m_targetUnit.getY());
if (m_targetUnit.getUnitData().hasModifier("Capture")){
if (_local2.isStructure()){
_local5 = getPriorityBumpForPropertyType(_local2);
if (_local2.getController() == null){
priority = (priority + (_local5 / 5));
} else {
if (_local2.getController() == m_manager.getController()){
priority = (priority + ((3 * ((1 + GameManager.TILE_CHUNKS) - _local2.getChunks())) * _local5));
};
};
};
};
var _local3:AIEngine = m_manager.getEngine();
priority = (priority + _local3.getKillPriority(m_targetUnit));
if (m_targetUnit.isRepairing()){
priority = (priority * 1.3);
};
var _local4:Number = 2.4;
priority = (priority * _local4);
if (priority <= 0){
priority = 0.0001;
};
m_targetUnit.showText(("KP: " + Math.round((priority * 1000))));
}
override protected function marshallReinforcementsImpl(_arg1:Array):void{
var anAttacker:Unit;
var possibleAttackLocations:Array;
var bestAttackerToMove:Unit;
var bestCostDamage:Number;
var bestIndex:int;
var bestTurns:int;
var bestTargetTile:Tile;
var i:int;
var unit:Unit;
var startTile:Tile;
var path:Array;
var a:int;
var costDamage:Number;
var turns:int;
var movementCombiner:MovementCombiner;
var tilesInRange:Array;
var bestAttackerIndex:int;
var bestDamage:Number;
var bestTurnCount:int;
var bestInterimTile:Tile;
var c:int;
var bestUnit:Unit;
var unitTile:Tile;
var interimDestination:Tile;
var turnCount:int;
var engine:AIEngine;
var a_activeUnits = _arg1;
if (m_targetUnit == null){
completeTask();
return;
};
var game:GameManager = GameManager.getInstance();
var potentialHealthRemaining:Number = m_targetUnit.getHealth();
var potentialAttackers:Array = a_activeUnits.slice();
var endTile:Tile = game.tileAt(m_targetUnit.getX(), m_targetUnit.getY());
var z:int = (potentialAttackers.length - 1);
for (;z >= 0;(z = (z - 1))) {
anAttacker = potentialAttackers[z];
if (!game.canWeaponsFireAtTarget(anAttacker, m_targetUnit)){
potentialAttackers.splice(z, 1);
} else {
if (endTile.isSeaBased()){
if (anAttacker.getBaseUnitData().isGround()){
possibleAttackLocations = getTilesThatThisUnitCanAttackFrom(anAttacker);
if ((((possibleAttackLocations == null)) || ((possibleAttackLocations.length == 0)))){
potentialAttackers.splice(z, 1);
continue;
};
};
};
};
};
var bestAttackerDestination:Tile;
while ((((potentialHealthRemaining > 0)) && ((potentialAttackers.length > 0)))) {
bestAttackerToMove = null;
bestCostDamage = -999999999999;
bestIndex = -1;
bestTurns = 0;
bestTargetTile = null;
i = (potentialAttackers.length - 1);
while (i >= 0) {
unit = potentialAttackers[i];
startTile = game.tileAt(unit.getX(), unit.getY());
path = getTilesThatThisUnitCanAttackFrom(unit, true);
if (path == null){
} else {
if (path.length == 0){
} else {
bestTurns = 0;
bestTargetTile = null;
a = (path.length - 1);
while (a >= 0) {
turns = Astar.calculateTurnsToPath(startTile, path[a], unit, Tile.k_astarFlagIgnoreUnits);
if (turns < -1){
} else {
if ((((bestTargetTile == null)) || ((turns < bestTurns)))){
bestTurns = turns;
bestTargetTile = path[a];
};
};
a = (a - 1);
};
if (bestTargetTile == null){
} else {
costDamage = game.resolveAttackCycleInResources(unit, m_targetUnit);
if (costDamage > bestCostDamage){
bestAttackerToMove = unit;
bestCostDamage = costDamage;
bestIndex = i;
bestAttackerDestination = bestTargetTile;
};
};
};
};
i = (i - 1);
};
if (bestAttackerToMove != null){
potentialHealthRemaining = (potentialHealthRemaining - game.resolveAttack(bestAttackerToMove, m_targetUnit));
potentialAttackers.splice(bestIndex, 1);
m_manager.useActiveUnit(bestAttackerToMove);
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, moveUnitCloserToTarget, bestAttackerToMove, bestAttackerDestination)));
} else {
break;
};
};
if (potentialHealthRemaining > 0){
potentialAttackers = new Array();
i = (a_activeUnits.length - 1);
while (i >= 0) {
unit = a_activeUnits[i];
if (!unit.isAvailable()){
} else {
if (unit.isUpgraded()){
unit = new Unit(new GameUnit(new GameSprite()), unit.getBaseUnitData());
};
if (game.canWeaponsFireAtTarget(unit, m_targetUnit)){
try {
costDamage = game.resolveAttackCycleInResources(unit, m_targetUnit);
} catch(e:Error) {
trace((((("Got a crash in AITaskKill unit off of " + unit) + " aiming at ") + m_targetUnit) + e));
costDamage = -1000000;
};
if (costDamage > 0){
tilesInRange = getTilesThatThisUnitCanAttackFrom(unit);
if (((!((tilesInRange == null))) && ((tilesInRange.length > 0)))){
potentialAttackers.push(a_activeUnits[i]);
};
};
};
};
i = (i - 1);
};
movementCombiner = game.getMovementCombiner();
while ((((potentialHealthRemaining > 0)) && ((potentialAttackers.length > 0)))) {
bestAttackerIndex = -1;
bestDamage = -1;
bestTurnCount = -1;
bestInterimTile = null;
c = (potentialAttackers.length - 1);
while (c >= 0) {
unit = potentialAttackers[c];
startTile = game.tileAt(unit.getX(), unit.getY());
interimDestination = movementCombiner.getInterimDestination(startTile, endTile, unit);
if (interimDestination != null){
turnCount = movementCombiner.getTurnCount();
if ((((bestAttackerIndex == -1)) || ((turnCount < bestTurnCount)))){
bestTurnCount = turnCount;
bestInterimTile = interimDestination;
bestAttackerIndex = c;
};
};
c = (c - 1);
};
if (bestAttackerIndex == -1){
break;
};
bestUnit = potentialAttackers[bestAttackerIndex];
m_manager.useActiveUnit(bestUnit);
potentialAttackers.splice(bestAttackerIndex, 1);
potentialHealthRemaining = (potentialHealthRemaining - game.resolveAttack(bestUnit, m_targetUnit));
unitTile = game.tileAt(bestUnit.getX(), bestUnit.getY());
movementCombiner = game.getMovementCombiner();
interimDestination = movementCombiner.getInterimDestination(unitTile, endTile, bestUnit);
if (interimDestination == unitTile){
if (bestUnit.isUpgraded()){
ActionManager.getInstance().add(new UpgradeUnitAction(bestUnit.getX(), bestUnit.getY(), false));
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, delayedAttack, bestUnit)));
} else {
ActionManager.getInstance().add(new UpgradeUnitAction(bestUnit.getX(), bestUnit.getY(), true, "Leviathan Barge"));
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, delayedAttack, bestUnit)));
};
return;
};
ActionManager.getInstance().add(new CallbackAction(Delegate.create(this, moveUnitCloserToTarget, bestUnit, interimDestination)));
};
};
if (potentialHealthRemaining > 0){
engine = m_manager.getEngine();
engine.queueBuild(this);
return;
};
}
public function delayedAttack(_arg1:Unit):void{
var _local2:GameManager = GameManager.getInstance();
var _local3:Tile = _local2.tileAt(_arg1.getX(), _arg1.getY());
var _local4:Tile = _local2.tileAt(m_targetUnit.getX(), m_targetUnit.getY());
var _local5:MovementCombiner = _local2.getMovementCombiner();
var _local6:Tile = _local5.getInterimDestination(_local3, _local4, _arg1);
if (_local6 == _local4){
if (_arg1.isRanged()){
processRangedUnit(_arg1);
} else {
processUnrangedUnit(_arg1);
};
} else {
moveTo(_arg1, _local6, true);
};
}
override function calculateMinimumResourcesRequiredToBuild():Number{
var _local1:Array = createCheapestKillersQueue();
if (_local1.length == 0){
throw (new Error(("KillUnit. Can't find a cheap unit to kill " + m_targetUnit.getName())));
};
var _local2:UnitData = UnitManager.getInstance().get(_local1[0]);
return (_local2.getCost(m_manager.getEngine().getController()));
}
public function attemptAttack(_arg1:Unit, _arg2:int, _arg3:int):void{
var _local8:int;
var _local9:int;
var _local10:Tile;
var _local11:Unit;
var _local12:Number;
var _local4:GameManager = GameManager.getInstance();
if (_local4.canAttack(_arg1, m_targetUnit, false, _arg2, _arg3)){
ActionManager.getInstance().add(new AttackUnitAction(_arg2, _arg3, m_targetUnit.getX(), m_targetUnit.getY()), true);
return;
};
var _local5:Unit;
var _local6:Number = 0;
var _local7:int;
while (_local7 < 4) {
_local8 = 0;
_local9 = 0;
if (_local7 == 0){
_local8 = -1;
_local9 = 0;
} else {
if (_local7 == 1){
_local8 = 1;
_local9 = 0;
} else {
if (_local7 == 2){
_local8 = 0;
_local9 = -1;
} else {
_local8 = 0;
_local9 = 1;
};
};
};
_local10 = _local4.tileAt((_arg2 + _local8), (_arg3 + _local9));
if (_local10 == null){
} else {
_local11 = _local10.getUnit();
if (_local11 == null){
} else {
if (_local11.getController() == _arg1.getController()){
} else {
_local12 = _local4.resolveAttackCycleInResources(_arg1, _local11);
if ((((_local5 == null)) || ((((_local12 > 0)) && ((_local12 > _local6)))))){
_local5 = _local11;
_local6 = _local12;
};
};
};
};
_local7++;
};
if (_local5 != null){
ActionManager.getInstance().add(new AttackUnitAction(_arg2, _arg3, _local5.getX(), _local5.getY()), true);
};
}
protected function moveTo(_arg1:Unit, _arg2:Tile, _arg3:Boolean=false):void{
var _local8:Array;
if (!_arg1.canMove()){
return;
};
var _local4:GameManager = GameManager.getInstance();
var _local5:Tile = _local4.tileAt(_arg1.getX(), _arg1.getY());
var _local6:int;
_local6 = Tile.k_astarFlagIgnoreLastNode;
var _local7:Array = Astar.pathTrim(_local5, _arg2, _arg1, _local6);
if (_local7 == null){
trace("AITaskKill.moveTo: We can't reach our target. This should not have happened because we should never let a unit be assigned to us that was useless.");
} else {
if (_local7.length == 0){
trace("AITaskKill. moveTo Why is our path 0?");
};
if ((((_local7.length > 0)) && (!((_local7[(_local7.length - 1)].getUnit() == null))))){
if (!_local7[(_local7.length - 1)].getUnit().isCloaked()){
_local7.pop();
};
};
_local8 = _local4.pointPath(_local7);
if (_arg1.canMove()){
ActionManager.getInstance().add(new MoveUnitAction(_arg1.getX(), _arg1.getY(), _local8), _arg3);
};
};
}
function createCheapestKillersQueue():Array{
var _local1:AIEngine = m_manager.getEngine();
var _local2:Controller = _local1.getController();
var _local3:Array = new Array();
var _local4:Tile = GameManager.getInstance().tileAt(m_targetUnit.getX(), m_targetUnit.getY());
switch (m_targetUnit.getName()){
case "Heavy Commando":
_local3.push("Strike Commando");
break;
case "Strike Commando":
_local3.push("Strike Commando");
break;
case "Flak Tank":
_local3.push("Scorpion Tank");
break;
case "Scorpion Tank":
_local3.push("Heavy Commando");
break;
case "Mortar Truck":
_local3.push("Strike Commando");
break;
case "Rocket Truck":
_local3.push("Strike Commando");
break;
case "Annihilator Tank":
_local3.push("Heavy Commando");
break;
case "Turret":
_local3.push("Heavy Commando");
break;
case "Stealth Tank":
_local3.push("Heavy Commando");
break;
case "Albatross Transport":
case "Raptor Fighter":
case "Condor Bomber":
if (((_local4.isSeaBased()) || (!(_local2.controlsGround())))){
if (_local2.controlsAir()){
_local3.push("Raptor Fighter");
} else {
if (_local2.controlsSea()){
_local3.push("Hunter Support");
} else {
_local3.push("Flak Tank");
};
};
} else {
_local3.push("Flak Tank");
};
break;
case "Leviathan Barge":
if (_local2.controlsAir()){
_local3.push("Raptor Fighter");
} else {
if (_local2.controlsSea()){
_local3.push("Corvette Fighter");
} else {
_local3.push("Rocket Truck");
};
};
break;
case "Hunter Support":
if (_local2.controlsSea()){
_local3.push("Corvette Fighter");
} else {
if (_local2.controlsGround()){
_local3.push("Rocket Truck");
} else {
_local3.push("Condor Bomber");
};
};
break;
case "Corvette Fighter":
if (_local2.controlsSea()){
_local3.push("U-Boat");
} else {
if (_local2.controlsGround()){
_local3.push("Rocket Truck");
} else {
_local3.push("Raptor Fighter");
};
};
break;
case "U-Boat":
if (_local2.controlsSea()){
_local3.push("Hunter Support");
} else {
if (_local2.controlsAir()){
_local3.push("Condor Bomber");
} else {
_local3.push("Rocket Truck");
};
};
break;
case "Battlecruiser":
if (_local2.controlsSea()){
_local3.push("U-Boat");
} else {
if (_local2.controlsAir()){
_local3.push("Raptor Fighter");
} else {
_local3.push("Rocket Truck");
};
};
break;
case "Intrepid":
if (_local2.controlsAir()){
_local3.push("Raptor Fighter");
} else {
if (_local2.controlsSea()){
_local3.push("Intrepid");
} else {
_local3.push("Rocket Truck");
};
};
break;
default:
trace(("AIEngine: cheapestKillersQueue, unknown unit type: " + m_targetUnit.getName()));
break;
};
return (_local3);
}
override protected function buildImpl(_arg1:Array, _arg2:Number):Number{
var _local9:String;
var _local10:UnitData;
var _local11:Unit;
var _local12:Tile;
var _local13:int;
var _local14:int;
var _local15:int;
var _local16:Tile;
var _local17:int;
var _local3:GameManager = GameManager.getInstance();
var _local4:Tile = _local3.tileAt(m_targetUnit.getX(), m_targetUnit.getY());
var _local5:AIEngine = m_manager.getEngine();
var _local6:Controller = _local5.getController();
var _local7:Array = createBestKillersQueue();
var _local8:int;
while (_local8 < _local7.length) {
_local9 = _local7[_local8];
_local10 = UnitManager.getInstance().get(_local9);
if (_local10.getCost(_local6) > _arg2){
} else {
if (((!(_local6.controlsGround())) && (_local10.isGround()))){
} else {
if (((!(_local6.controlsAir())) && (_local10.isAir()))){
} else {
if (((!(_local6.controlsSea())) && (_local10.isSea()))){
} else {
_local11 = new Unit(new GameUnit(new GameSprite()), _local10);
_local12 = null;
_local13 = 9999999999999;
_local14 = -1;
_local15 = 0;
while (_local15 < _arg1.length) {
_local16 = _arg1[_local15];
_local17 = Astar.calculateTurnsToPath(_local16, _local4, _local11, Tile.k_astarFlagIgnoreUnits);
if ((((_local17 >= 0)) && ((_local17 < _local13)))){
_local13 = _local17;
_local14 = _local15;
_local12 = _local16;
};
_local15++;
};
if (_local12 != null){
trace(((("Budget " + _arg2) + " using ") + _local10.getCost(_local6)));
trace((((((((((("KILL Building " + _local9) + " at ") + _local12.getX()) + ", ") + _local12.getY()) + " to kill ") + m_targetUnit) + " in ") + _local13) + " turns."));
_arg1.splice(_local14, 1);
ActionManager.getInstance().add(new BuildUnitAction(_local12.getX(), _local12.getY(), _local9), true);
return (_local10.getCost(_local6));
};
};
};
};
};
_local8++;
};
return (0);
}
override protected function handleUnitDiedImpl(_arg1:Unit):void{
var _local3:Unit;
if (m_targetUnit == _arg1){
m_targetUnit = null;
completeTask();
return;
};
var _local2:int;
while (_local2 < m_attackingUnits.length) {
_local3 = m_attackingUnits[_local2];
if (_local3 == _arg1){
m_attackingUnits.splice(_local2, 1);
return;
};
_local2++;
};
}
}
}//package com.gamedozer.battalion.game.ai
Section 60
//AITaskManager (com.gamedozer.battalion.game.ai.AITaskManager)
package com.gamedozer.battalion.game.ai {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.controllers.*;
import com.gamedozer.battalion.game.actions.*;
public class AITaskManager {
private var m_reinforcementAttemptCount:int;
private var m_activeTasks:Array;
private var m_aiEngine:AIEngine;
private var m_ignoredTasks:Array;
private var m_activeUnits:Array;
private var m_tasks:Array;
private static const MAXIMUM_REINFORCEMENT_ATTEMPTS:int = 5;
public function AITaskManager(_arg1:AIEngine){
m_aiEngine = _arg1;
m_tasks = new Array();
m_activeTasks = new Array();
m_activeUnits = new Array();
m_ignoredTasks = new Array();
m_reinforcementAttemptCount = MAXIMUM_REINFORCEMENT_ATTEMPTS;
}
private function assignUnits():void{
var _local1:AITask = popBestTask();
if (_local1 == null){
return;
};
var _local2:int = m_activeUnits.length;
_local1.assignUnits(m_activeUnits);
if (_local2 == m_activeUnits.length){
ActionManager.getInstance().add(new DelayedCallbackAction(assignUnits, 200, "assignUnits"));
} else {
trace(("EXECUTING: " + _local1));
_local1.execute();
};
}
public function addTask(_arg1:AITask):void{
m_tasks.push(_arg1);
}
public function compareTwoUnits(_arg1:Unit, _arg2:Unit):Number{
var _local3:Number = (_arg1.getUnitData().getHealth() * _arg1.getUnitData().getCost());
var _local4:Number = (_arg2.getUnitData().getHealth() * _arg2.getUnitData().getCost());
if (_local3 > _local4){
return (1);
};
if (_local3 < _local4){
return (-1);
};
return (0);
}
function nestThink():void{
regenerateNonIgnoredTasks();
think();
}
function cleanupTasks():void{
var _local2:AITask;
var _local1:int = (m_tasks.length - 1);
while (_local1 >= 0) {
_local2 = m_tasks[_local1];
if (_local2.isComplete()){
_local2.dispose();
m_tasks.splice(_local1, 1);
};
_local1--;
};
}
public function sortActiveUnits():void{
m_activeUnits.sort(compareTwoUnits);
}
public function regenerateNonIgnoredTasks():void{
cleanupTasks();
m_activeTasks.splice(0);
prepareThink();
}
function useActiveUnit(_arg1:Unit):void{
var _local3:Unit;
var _local2:int;
while (_local2 < m_activeUnits.length) {
_local3 = m_activeUnits[_local2];
if (_local3 == _arg1){
m_activeUnits.splice(_local2, 1);
return;
};
_local2++;
};
}
function getController():AIController{
return (m_aiEngine.getController());
}
function popBestTask():AITask{
if (m_activeTasks.length == 0){
return (null);
};
var _local1:AITask = m_activeTasks[0];
m_activeTasks.splice(0, 1);
return (_local1);
}
public function handleKilledUnit(_arg1:Unit):void{
var _local2:AITask;
for each (_local2 in m_tasks) {
_local2.handleUnitDied(_arg1);
};
}
function sortActiveTasks():void{
m_activeTasks.sortOn(["priority"], Array.DESCENDING);
}
public function prepareThink():void{
var _local2:AITask;
var _local1:int;
while (_local1 < m_tasks.length) {
_local2 = m_tasks[_local1];
_local2.updatePriority();
if (_local2.priority > 0){
m_activeTasks.push(_local2);
};
_local1++;
};
sortActiveTasks();
m_activeUnits = getAvailableUnits();
sortActiveUnits();
trace(("TASK LIST: " + m_activeTasks));
}
private function assignReinforcements():void{
var _local1:AITask = popBestTask();
if (_local1 == null){
return;
};
m_activeUnits = getAvailableUnits(false);
var _local2:int = m_activeUnits.length;
_local1.marshallReinforcements(m_activeUnits);
if (_local2 == m_activeUnits.length){
m_ignoredTasks.push(_local1);
ActionManager.getInstance().add(new DelayedCallbackAction(assignReinforcements, 250, "assignReinforcements"));
};
}
public function think():void{
if (m_reinforcementAttemptCount != MAXIMUM_REINFORCEMENT_ATTEMPTS){
assignReinforcements();
} else {
assignUnits();
};
if ((((((m_reinforcementAttemptCount >= 0)) && (!((m_activeUnits.length == 0))))) && ((m_activeTasks.length == 0)))){
m_reinforcementAttemptCount--;
ActionManager.getInstance().add(new DelayedCallbackAction(nestThink, 100, "nestThink"));
return;
};
if (m_activeTasks.length == 0){
if (m_activeUnits.length != 0){
trace(("AITaskManager. We didn't use all our units this turn. Left overs: " + m_activeUnits));
};
m_reinforcementAttemptCount = MAXIMUM_REINFORCEMENT_ATTEMPTS;
m_aiEngine.finishTurn();
};
}
function getAvailableUnits(_arg1:Boolean=true):Array{
var _local5:Unit;
var _local2:Array = new Array();
var _local3:Array = getController().getUnits();
var _local4:int;
while (_local4 < _local3.length) {
_local5 = _local3[_local4];
if (_local5.isAvailable()){
if (((_arg1) || (_local5.canMove()))){
_local2.push(_local5);
};
};
_local4++;
};
return (_local2);
}
function getEngine():AIEngine{
return (m_aiEngine);
}
public function cleanupThink():void{
cleanupTasks();
m_activeTasks.splice(0);
m_ignoredTasks.splice(0);
}
public function ignoreTask(_arg1:AITask):void{
m_ignoredTasks.push(_arg1);
}
}
}//package com.gamedozer.battalion.game.ai
Section 61
//AITaskRepairUnit (com.gamedozer.battalion.game.ai.AITaskRepairUnit)
package com.gamedozer.battalion.game.ai {
import com.gamedozer.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.controllers.*;
import com.gamedozer.battalion.game.actions.*;
public class AITaskRepairUnit extends AITask {
private var m_repairUnit:Unit;
private var m_canExecute:Boolean;// = false
public function AITaskRepairUnit(_arg1:AITaskManager, _arg2:Unit){
super(_arg1);
m_repairUnit = _arg2;
priority = 0.5;
}
override protected function assignUnitsImpl(_arg1:Array):void{
var _local3:Unit;
m_canExecute = false;
if (m_repairUnit.getHealthPercentage() == 1){
return;
};
var _local2:int = (_arg1.length - 1);
while (_local2 >= 0) {
_local3 = _arg1[_local2];
if (_local3 == m_repairUnit){
m_canExecute = true;
_arg1.splice(_local2, 1);
return;
};
_local2--;
};
}
override public function toString():String{
return ((((("[REP " + m_priority) + ": ") + m_repairUnit) + " ]"));
}
override protected function updatePriorityImpl():void{
if (m_repairUnit.getHealthPercentage() >= 1){
priority = 0;
return;
};
if (m_repairUnit.isUpgraded()){
priority = 0;
return;
};
var _local1:Number = Math.round((m_repairUnit.getUnitData().getCost(m_repairUnit.getController()) * GameManager.getInstance().healPercentage(m_repairUnit)));
var _local2:Number = m_repairUnit.getController().getResources();
if (_local2 < _local1){
priority = 0;
return;
};
priority = 0.1;
}
override protected function buildImpl(_arg1:Array, _arg2:Number):Number{
return (0);
}
override protected function handleUnitDiedImpl(_arg1:Unit):void{
if (m_repairUnit == _arg1){
completeTask();
return;
};
}
function moveUnitCloserToTarget(_arg1:Unit, _arg2:Tile):void{
var _local6:Array;
if (!_arg1.canMove()){
return;
};
var _local3:GameManager = GameManager.getInstance();
var _local4:Tile = _local3.tileAt(_arg1.getX(), _arg1.getY());
var _local5:Array = Astar.pathTrim(_local4, _arg2, _arg1, Tile.k_astarFlagIgnoreLastNode);
if (_local5 == null){
} else {
if (_local5[(_local5.length - 1)].getUnit() != null){
if (!_local5[(_local5.length - 1)].getUnit().isCloaked()){
_local5.pop();
};
};
_local6 = _local3.pointPath(_local5);
ActionManager.getInstance().add(new MoveUnitAction(_arg1.getX(), _arg1.getY(), _local6), true);
};
}
override protected function executeImpl():void{
var _local5:Array;
var _local6:Tile;
var _local7:Number;
var _local8:int;
var _local9:Tile;
var _local10:Number;
if (!m_canExecute){
return;
};
var _local1:GameManager = GameManager.getInstance();
var _local2:AIEngine = m_manager.getEngine();
var _local3:Tile = _local1.tileAt(m_repairUnit.getX(), m_repairUnit.getY());
var _local4:Number = _local2.getDangerForUnit(m_repairUnit, _local3);
if (_local2.isSafeToRepair(m_repairUnit)){
ActionManager.getInstance().add(new RepairUnitAction(m_repairUnit.getX(), m_repairUnit.getY()));
} else {
_local5 = Astar.search(_local3, null, m_repairUnit);
_local6 = null;
_local7 = _local4;
_local8 = 0;
while (_local8 < _local5.length) {
_local9 = _local5[_local8];
_local10 = _local2.getDangerForUnit(m_repairUnit, _local9);
if ((((_local6 == null)) || ((_local10 < _local7)))){
_local6 = _local9;
_local7 = _local10;
};
_local8++;
};
trace(("Safest tile : " + _local6));
if (((!((_local6 == null))) && (!((_local6 == _local3))))){
moveUnitCloserToTarget(m_repairUnit, _local6);
};
};
}
override protected function disposeImpl():void{
m_repairUnit = null;
}
}
}//package com.gamedozer.battalion.game.ai
Section 62
//ControllerInfluence (com.gamedozer.battalion.game.ai.ControllerInfluence)
package com.gamedozer.battalion.game.ai {
import flash.events.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
public class ControllerInfluence {
private var m_influenceMaps:Array;
private var m_dangerToMediumArmor:InfluenceMapDangerToArmorType;
private var m_dangerToHeavyArmor:InfluenceMapDangerToArmorType;
private var m_mapToLoad:int;// = -1
private var m_controller:Controller;
private var m_dangerToLightArmor:InfluenceMapDangerToArmorType;
private var m_mapControl:InfluenceMapControl;
private var m_tacticalValue:InfluenceMapTacticalValue;
public function ControllerInfluence(_arg1:Controller){
m_controller = _arg1;
m_influenceMaps = new Array();
m_dangerToLightArmor = new InfluenceMapDangerToArmorType(m_controller, 1);
addInfluenceMap(m_dangerToLightArmor);
m_dangerToMediumArmor = new InfluenceMapDangerToArmorType(m_controller, 2);
addInfluenceMap(m_dangerToMediumArmor);
m_dangerToHeavyArmor = new InfluenceMapDangerToArmorType(m_controller, 3);
addInfluenceMap(m_dangerToHeavyArmor);
m_tacticalValue = new InfluenceMapTacticalValue();
addInfluenceMap(m_tacticalValue);
m_mapControl = new InfluenceMapControl(m_controller, m_tacticalValue);
addInfluenceMap(m_mapControl);
}
public function addUnit(_arg1:Unit):void{
var _local3:InfluenceMap;
var _local2:int;
while (_local2 < m_influenceMaps.length) {
_local3 = m_influenceMaps[_local2];
_local3.addUnit(_arg1);
_local2++;
};
}
function doCapture(_arg1:InfluenceMap, _arg2:Tile, _arg3:int, _arg4:int, _arg5:Boolean):void{
_arg1.captureTerrain(_arg2, _arg3, _arg4, _arg5);
}
public function isStillInitializing():Boolean{
return ((m_mapToLoad < m_influenceMaps.length));
}
public function getDangerToArmorType(_arg1:int):InfluenceMapDangerToArmorType{
if (_arg1 == 1){
return (m_dangerToLightArmor);
};
if (_arg1 == 2){
return (m_dangerToMediumArmor);
};
if (_arg1 == 3){
return (m_dangerToHeavyArmor);
};
trace("Bad controller.");
return (null);
}
function captureTerrain(_arg1:Tile, _arg2:int, _arg3:int, _arg4:Boolean):void{
var _local6:InfluenceMap;
var _local5:int;
while (_local5 < m_influenceMaps.length) {
_local6 = m_influenceMaps[_local5];
doCapture(_local6, _arg1, _arg2, _arg3, _arg4);
_local5++;
};
}
function getController():Controller{
return (m_controller);
}
public function getDangerForUnit(_arg1:Unit, _arg2:Tile):Number{
var _local3:InfluenceMapDangerToArmorType = getDangerToArmorType(_arg1.getArmorType());
return (_local3.getWeight(_arg2));
}
public function initialize():void{
var _local1:Timer = new Timer(100);
_local1.addEventListener(TimerEvent.TIMER, loadMap);
_local1.start();
m_mapToLoad = 0;
}
public function getKillPriority(_arg1:Unit):Number{
var _local2:GameManager = GameManager.getInstance();
var _local3:Tile = _local2.tileAt(_arg1.getX(), _arg1.getY());
var _local4:Number = m_mapControl.getNormalizedWeight(_local3);
_local4 = (_local4 * getTacticalPriority(_local3));
return (_local4);
}
function getCapturePriority(_arg1:Tile):Number{
return ((1 - m_mapControl.getNormalizedWeight(_arg1)));
}
private function loadMap(_arg1:Event):void{
var _local3:Timer;
if (m_mapToLoad >= m_influenceMaps.length){
_local3 = (_arg1.target as Timer);
_local3.stop();
_local3.removeEventListener(TimerEvent.TIMER, loadMap);
_local3 = null;
return;
};
var _local2:InfluenceMap = m_influenceMaps[m_mapToLoad];
_local2.initialize();
m_mapToLoad++;
}
public function changeUpgradeStatus(_arg1:Unit, _arg2:String, _arg3:Boolean):void{
var _local5:InfluenceMap;
var _local4:int;
while (_local4 < m_influenceMaps.length) {
_local5 = m_influenceMaps[_local4];
_local5.changeUpgradeStatus(_arg1, _arg2, _arg3);
_local4++;
};
}
public function isSafeToRepair(_arg1:Unit):Boolean{
var _local2:InfluenceMapDangerToArmorType = getDangerToArmorType(_arg1.getArmorType());
var _local3:GameManager = GameManager.getInstance();
var _local4:Tile = _local3.tileAt(_arg1.getX(), _arg1.getY());
if (_local2.getWeight(_local4) < 0){
return (true);
};
return (false);
}
function getTacticalPriority(_arg1:Tile):Number{
return (m_tacticalValue.getNormalizedWeight(_arg1));
}
public function attackUnit(_arg1:Unit, _arg2:Unit):void{
}
public function addInfluenceMap(_arg1:InfluenceMap):void{
m_influenceMaps.push(_arg1);
}
public function moveUnit(_arg1:Unit, _arg2:Array):void{
var _local4:InfluenceMap;
var _local3:int;
while (_local3 < m_influenceMaps.length) {
_local4 = m_influenceMaps[_local3];
_local4.moveUnit(_arg1, _arg2);
_local3++;
};
}
public function removeUnit(_arg1:Unit):void{
var _local3:InfluenceMap;
var _local2:int;
while (_local2 < m_influenceMaps.length) {
_local3 = m_influenceMaps[_local2];
_local3.removeUnit(_arg1);
_local2++;
};
}
}
}//package com.gamedozer.battalion.game.ai
Section 63
//InfluenceMap (com.gamedozer.battalion.game.ai.InfluenceMap)
package com.gamedozer.battalion.game.ai {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
public class InfluenceMap {
private var m_maximumWeightNode:InfluenceNode;
private var m_minimumWeightNode:InfluenceNode;
private var m_influenceMap:Dictionary;
public function InfluenceMap(){
m_influenceMap = new Dictionary(false);
m_minimumWeightNode = null;
m_maximumWeightNode = null;
}
function getMaximumWeight():Number{
if (m_maximumWeightNode == null){
return (0);
};
return (m_maximumWeightNode.weight);
}
function draw():void{
var _local1:InfluenceNode;
var _local2:Tile;
var _local3:uint;
var _local4:Number;
for each (_local1 in m_influenceMap) {
_local2 = _local1.tile;
_local3 = 0xFFFFFF;
_local4 = _local1.weight;
if (Math.abs(_local4) < 0.0001){
_local2.showText("");
} else {
if (_local4 < 0){
_local3 = 0xFF0000;
};
_local2.showText(((Math.round((_local4 * 1000)) / 1000) + ""), _local3);
};
};
}
function getNormalizedWeight(_arg1:Tile):Number{
var _local2:Number = getMaximumWeight();
var _local3:Number = getMinimumWeight();
var _local4:Number = (_local2 - _local3);
var _local5:Number = getWeight(_arg1);
var _local6:Number = (_local5 - _local3);
if (_local4 == 0){
return (0);
};
var _local7:Number = (_local6 / _local4);
return (_local7);
}
public function addUnit(_arg1:Unit):void{
}
function reset():void{
var _local1:InfluenceNode;
for each (_local1 in m_influenceMap) {
_local1.weight = 0;
};
m_minimumWeightNode = null;
m_maximumWeightNode = null;
}
function recalculate():void{
reset();
initialize();
}
public function captureTerrain(_arg1:Tile, _arg2:int, _arg3:int, _arg4:Boolean):void{
}
function initialize():void{
initializeImpl();
}
function drawNormalized():void{
var _local1:InfluenceNode;
var _local2:Tile;
var _local3:uint;
var _local4:Number;
for each (_local1 in m_influenceMap) {
_local2 = _local1.tile;
_local3 = 0xFFFFFF;
_local4 = getNormalizedWeight(_local2);
if (_local4 < 0.5){
_local3 = 0;
};
_local2.showText(((Math.round((_local4 * 1000)) / 1000) + ""), _local3);
};
}
public function changeUpgradeStatus(_arg1:Unit, _arg2:String, _arg3:Boolean):void{
}
function initializeImpl():void{
}
function updateWeight(_arg1:InfluenceNode):void{
if (_arg1.weight < m_minimumWeightNode.weight){
m_minimumWeightNode = _arg1;
return;
};
if (_arg1.weight > m_maximumWeightNode.weight){
m_maximumWeightNode = _arg1;
return;
};
}
function getMinimumTile():Tile{
if (m_minimumWeightNode == null){
return (null);
};
return (m_minimumWeightNode.tile);
}
public function removeUnit(_arg1:Unit):void{
}
function propagate(_arg1:int, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int, _arg6:Boolean):void{
var _local11:Tile;
var _local12:InfluenceNode;
var _local13:int;
var _local14:int;
var _local15:int;
var _local16:Number;
var _local7:int = _arg5;
var _local8:Tile = GameManager.getInstance().tileAt(_arg1, _arg2);
var _local9:Array = Astar.search(_local8, null, null, _local7, false);
var _local10:int;
while (_local10 < _local9.length) {
_local11 = _local9[_local10];
if (!_arg6){
//unresolved if
} else {
_local12 = getNode(_local11);
_local13 = Math.abs((_local11.getX() - _local8.getX()));
_local14 = Math.abs((_local11.getY() - _local8.getY()));
_local15 = (_local13 + _local14);
_local16 = (_arg3 * Math.pow(_arg4, _local15));
_local12.weight = (_local12.weight + _local16);
};
_local10++;
};
}
function getWeight(_arg1:Tile):Number{
var _local2:InfluenceNode = getNode(_arg1);
return (_local2.weight);
}
function getMinimumWeight():Number{
if (m_minimumWeightNode == null){
return (0);
};
return (m_minimumWeightNode.weight);
}
public function moveUnit(_arg1:Unit, _arg2:Array):void{
}
function getNode(_arg1:Tile):InfluenceNode{
if (m_influenceMap[_arg1] == null){
m_influenceMap[_arg1] = new InfluenceNode(_arg1, this);
};
var _local2:InfluenceNode = m_influenceMap[_arg1];
if (m_minimumWeightNode == null){
m_minimumWeightNode = _local2;
m_maximumWeightNode = _local2;
};
return (_local2);
}
public function attackUnit(_arg1:Unit, _arg2:Unit):void{
}
function getMaximumTile():Tile{
if (m_maximumWeightNode == null){
return (null);
};
return (m_maximumWeightNode.tile);
}
}
}//package com.gamedozer.battalion.game.ai
Section 64
//InfluenceMapControl (com.gamedozer.battalion.game.ai.InfluenceMapControl)
package com.gamedozer.battalion.game.ai {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.controllers.*;
import com.gamedozer.battalion.game.actions.*;
public class InfluenceMapControl extends InfluenceMap {
private var m_tacticalValueMap:InfluenceMapTacticalValue;
private var m_controller:Controller;
public function InfluenceMapControl(_arg1:Controller, _arg2:InfluenceMapTacticalValue){
m_controller = _arg1;
m_tacticalValueMap = _arg2;
}
function calculateTileInfluence(_arg1:Tile):void{
var _local4:Number;
var _local5:Number;
var _local6:int;
var _local2:int = _arg1.getX();
var _local3:int = _arg1.getY();
if (_arg1.isStructure()){
_local4 = m_tacticalValueMap.getWeight(_arg1);
_local5 = 0.5;
_local6 = 6;
if (_arg1.getController() == m_controller){
_local4 = (_local4 * 2);
} else {
if (_arg1.getController() == null){
_local4 = (_local4 * 1);
} else {
if (_arg1.getController() != m_controller){
_local4 = (_local4 * -1);
};
};
};
propagate(_local2, _local3, _local4, _local5, _local6, false);
};
}
override public function captureTerrain(_arg1:Tile, _arg2:int, _arg3:int, _arg4:Boolean):void{
m_tacticalValueMap.recalculate();
ActionManager.getInstance().add(new CallbackAction(recalculate));
}
override function initializeImpl():void{
var _local3:int;
var _local4:Tile;
var _local1:Array = GameManager.getInstance().getTileMap();
var _local2:int;
while (_local2 < _local1.length) {
_local3 = 0;
while (_local3 < _local1[_local2].length) {
_local4 = _local1[_local2][_local3];
calculateTileInfluence(_local4);
_local3++;
};
_local2++;
};
if (m_controller.getTeam().getName() == "Blue Team"){
};
}
}
}//package com.gamedozer.battalion.game.ai
Section 65
//InfluenceMapDangerToArmorType (com.gamedozer.battalion.game.ai.InfluenceMapDangerToArmorType)
package com.gamedozer.battalion.game.ai {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.controllers.*;
public class InfluenceMapDangerToArmorType extends InfluenceMap {
private var m_influence:Dictionary;
private var m_againstArmorType:int;
private var m_controller:Controller;
public function InfluenceMapDangerToArmorType(_arg1:Controller, _arg2:int){
m_influence = new Dictionary(false);
super();
m_controller = _arg1;
m_againstArmorType = _arg2;
}
function calculateTileInfluence(_arg1:Tile):void{
var _local2:Unit = _arg1.getUnit();
if (_local2 == null){
return;
};
addUnit(_local2);
}
function display():void{
if (m_controller.getTeam().getName() == "Blue Team"){
if (m_againstArmorType == 1){
};
};
}
override public function addUnit(_arg1:Unit):void{
doInfluence(_arg1.getX(), _arg1.getY(), _arg1);
display();
}
function changeWeight(_arg1:Number, _arg2:Array):void{
var _local4:Tile;
var _local5:InfluenceNode;
var _local3:int;
while (_local3 < _arg2.length) {
_local4 = _arg2[_local3];
_local5 = getNode(_local4);
getNode(_local4).weight = (_local5.weight + _arg1);
_local3++;
};
}
override public function attackUnit(_arg1:Unit, _arg2:Unit):void{
}
override public function removeUnit(_arg1:Unit):void{
undoInfluence(_arg1.getX(), _arg1.getY(), _arg1);
if (m_influence[_arg1] != null){
if (m_influence[_arg1].nodes != null){
m_influence[_arg1].nodes.splice(0);
};
delete m_influence[_arg1];
};
display();
}
override function initializeImpl():void{
var _local3:int;
var _local4:Tile;
var _local1:Array = GameManager.getInstance().getTileMap();
var _local2:int;
while (_local2 < _local1.length) {
_local3 = 0;
while (_local3 < _local1[_local2].length) {
_local4 = _local1[_local2][_local3];
calculateTileInfluence(_local4);
_local3++;
};
_local2++;
};
display();
}
function doInfluence(_arg1:int, _arg2:int, _arg3:Unit):void{
var _local4:GameManager = GameManager.getInstance();
var _local5:Number = _arg3.getAttackDamage(m_againstArmorType);
if (m_controller.controlsUnit(_arg3)){
_local5 = (_local5 * -1);
};
if (m_influence[_arg3] == null){
m_influence[_arg3] = new Influences();
};
m_influence[_arg3].amount = _local5;
var _local6:Array = _local4.getNodesInAttackRange(_arg1, _arg2, _arg3);
m_influence[_arg3].nodes = _local6;
if (_local6 == null){
trace((("InfluenceMapDamageToArmorType: " + _arg3) + " cannot attack. It has no attackable nodes."));
return;
};
changeWeight(_local5, _local6);
}
override public function moveUnit(_arg1:Unit, _arg2:Array):void{
undoInfluence(_arg2[0], _arg2[1], _arg1);
doInfluence(_arg2[(_arg2.length - 2)], _arg2[(_arg2.length - 1)], _arg1);
display();
}
function undoInfluence(_arg1:int, _arg2:int, _arg3:Unit):void{
if (m_influence[_arg3] == null){
return;
};
if ((((m_influence[_arg3].nodes == null)) || ((m_influence[_arg3].nodes.length == 0)))){
return;
};
var _local4:GameManager = GameManager.getInstance();
var _local5:Number = m_influence[_arg3].amount;
var _local6:Array = m_influence[_arg3].nodes;
changeWeight(-(_local5), _local6);
m_influence[_arg3].nodes.splice(0);
}
override public function changeUpgradeStatus(_arg1:Unit, _arg2:String, _arg3:Boolean):void{
if (_arg3){
undoInfluence(_arg1.getX(), _arg1.getY(), _arg1);
} else {
doInfluence(_arg1.getX(), _arg1.getY(), _arg1);
};
display();
}
}
}//package com.gamedozer.battalion.game.ai
class Influences {
public var amount:Number;
public var nodes:Array;// = null
private function Influences(){
}
}
Section 66
//InfluenceMapTacticalValue (com.gamedozer.battalion.game.ai.InfluenceMapTacticalValue)
package com.gamedozer.battalion.game.ai {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.controllers.*;
public class InfluenceMapTacticalValue extends InfluenceMap {
private var m_commandCenterInfluence:Number;
private var m_oilRigControlInfluence:Number;
private var m_hasFactory:Boolean;// = false
private var m_oilRefineryControlInfluence:Number;
private var m_airControlInfluence:Number;
private var m_groundControlInfluence:Number;
private var m_seaControlInfluence:Number;
private var m_advancedOilRefineryControlInfluence:Number;
private var m_factoryControlInfluence:Number;
public function InfluenceMapTacticalValue(){
m_commandCenterInfluence = BattalionSettings.getSingleton().getNumber("ai_commandCenterInfluence", 9);
m_seaControlInfluence = BattalionSettings.getSingleton().getNumber("ai_seaControlInfluence", 6);
m_airControlInfluence = BattalionSettings.getSingleton().getNumber("ai_airControlInfluence", 6);
m_groundControlInfluence = BattalionSettings.getSingleton().getNumber("ai_groundControlInfluence", 6);
m_factoryControlInfluence = BattalionSettings.getSingleton().getNumber("ai_factoryControlInfluence", 7);
m_oilRigControlInfluence = BattalionSettings.getSingleton().getNumber("ai_oilRigControlInfluence", 6);
m_oilRefineryControlInfluence = BattalionSettings.getSingleton().getNumber("ai_oilRefineryControlInfluence", 8);
m_advancedOilRefineryControlInfluence = BattalionSettings.getSingleton().getNumber("ai_advancedOilRefineryControlInfluence", 7);
}
function isMissionCritical(_arg1:Tile):Boolean{
return ((_arg1.getTerrain().getName() == "Command Center"));
}
function calculateTileInfluence(_arg1:Tile):void{
var _local7:Number;
var _local8:Boolean;
var _local9:Number;
var _local10:int;
var _local2:int = _arg1.getX();
var _local3:int = _arg1.getY();
if (_arg1.isStructure()){
_local7 = 0;
_local8 = false;
if (_arg1.getTerrain().getName() == "Command Center"){
_local7 = m_commandCenterInfluence;
} else {
if (_arg1.getTerrain().getName() == "Sea Control"){
_local7 = m_seaControlInfluence;
} else {
if (_arg1.getTerrain().getName() == "Air Control"){
_local7 = m_airControlInfluence;
} else {
if (_arg1.getTerrain().getName() == "Ground Control"){
_local7 = m_groundControlInfluence;
} else {
if (_arg1.getTerrain().getName() == "Factory"){
_local7 = m_factoryControlInfluence;
} else {
if (_arg1.getTerrain().getName() == "Oil Rig"){
_local7 = m_oilRigControlInfluence;
_local8 = true;
} else {
if (_arg1.getTerrain().getName() == "Oil Refinery"){
_local7 = m_oilRefineryControlInfluence;
} else {
if (_arg1.getTerrain().getName() == "Advanced Oil Refinery"){
_local7 = m_advancedOilRefineryControlInfluence;
};
};
};
};
};
};
};
};
if (((!(m_hasFactory)) && (!(isMissionCritical(_arg1))))){
if (_arg1.getTerrain().getName().indexOf("Control") > 0){
return;
};
if (_arg1.getTerrain().getName().indexOf("Oil") > 0){
_local7 = (_local7 / 4);
};
};
_local9 = 0.5;
_local10 = 3;
propagate(_local2, _local3, _local7, _local9, _local10, _local8);
return;
};
var _local4:Number = 1;
var _local5:UnitData = new UnitData("fake", "", 0, 10, 100, 100, 1, 1, UnitData.unitTypeFromString("ground"), UnitData.movementTypeFromString("tracked"), 0, UnitData.armorTypeFromString("light"), "", "");
var _local6:Unit = new Unit(new GameUnit(new GameSprite()), _local5);
_local4 = _arg1.getTerrain().applyModifiers("defense", _local6, _local4);
if (_local4 < 1){
_local7 = (1 - _local4);
_local7 = (_local7 * 10);
_local9 = 0.3;
_local10 = 3;
propagate(_local2, _local3, _local7, _local9, _local10, false);
return;
};
}
function isFactory(_arg1:Tile):Boolean{
return ((_arg1.getTerrain().getName() == "Factory"));
}
override function initializeImpl():void{
var _local3:int;
var _local4:Tile;
var _local1:Array = GameManager.getInstance().getTileMap();
var _local2:int;
while (_local2 < _local1.length) {
_local3 = 0;
while (_local3 < _local1[_local2].length) {
_local4 = _local1[_local2][_local3];
if (isFactory(_local4)){
m_hasFactory = true;
};
_local3++;
};
_local2++;
};
_local2 = 0;
while (_local2 < _local1.length) {
_local3 = 0;
while (_local3 < _local1[_local2].length) {
_local4 = _local1[_local2][_local3];
calculateTileInfluence(_local4);
_local3++;
};
_local2++;
};
}
}
}//package com.gamedozer.battalion.game.ai
Section 67
//InfluenceNode (com.gamedozer.battalion.game.ai.InfluenceNode)
package com.gamedozer.battalion.game.ai {
import com.gamedozer.battalion.data.*;
public class InfluenceNode {
private var m_tile:Tile;
private var m_weight:Number;
private var m_map:InfluenceMap;
public function InfluenceNode(_arg1:Tile, _arg2:InfluenceMap){
m_map = _arg2;
m_tile = _arg1;
m_weight = 0;
}
public function set weight(_arg1:Number):void{
m_weight = _arg1;
m_map.updateWeight(this);
}
public function get weight():Number{
return (m_weight);
}
public function get tile():Tile{
return (m_tile);
}
public function dispose():void{
m_tile = null;
}
}
}//package com.gamedozer.battalion.game.ai
Section 68
//UnitBuilder (com.gamedozer.battalion.game.ai.UnitBuilder)
package com.gamedozer.battalion.game.ai {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.controllers.*;
public class UnitBuilder {
private var m_engine:AIEngine;
private var m_queue:Array;
public function UnitBuilder(_arg1:AIEngine){
m_engine = _arg1;
m_queue = new Array();
}
function processHighestPriorityBuildRequest(_arg1:Array, _arg2:Number):Number{
var _local3:AIController = m_engine.getController();
var _local4:BuildRequest = m_queue[0];
m_queue.splice(0, 1);
var _local5:AITask = _local4.task;
var _local6:Number = _local5.calculateMinimumResourcesRequiredToBuild();
trace(((((("Giving " + (_local6 + _arg2)) + " to ") + _local5) + ". Res left: ") + _local3.getResources()));
var _local7:Number = _local5.build(_arg1, (_local6 + _arg2));
if (_local7 > (_local6 + _arg2)){
throw (new Error((_local5 + " tried to use more resources than it was allocated.")));
};
var _local8:Number = (_arg2 - (_local7 - _local6));
return (_local8);
}
function build():void{
var _local10:Tile;
var _local11:BuildRequest;
var _local12:AITask;
var _local13:Number;
var _local14:Number;
var _local1:AIController = m_engine.getController();
var _local2:Array = _local1.getStructures();
var _local3:Array = new Array();
var _local4:int;
while (_local4 < _local2.length) {
_local10 = _local2[_local4];
if (!_local10.getTerrain().hasModifier("Construction")){
} else {
if (_local10.getUnit() != null){
} else {
if (_local10.getController() != _local1){
} else {
_local3.push(_local10);
};
};
};
_local4++;
};
if (_local3.length == 0){
trace("No possible build locations.");
return;
};
trace((((("Process building. [" + m_queue.length) + "] requests. Possible construction sites: [") + _local3.length) + "]"));
if (m_queue.length > _local3.length){
m_queue.splice(_local3.length);
};
var _local5:Number = m_engine.getController().getResources();
var _local6:Number = 0;
var _local7 = -1;
var _local8:int;
while (_local8 < m_queue.length) {
_local11 = m_queue[_local8];
_local12 = _local11.task;
_local13 = _local12.calculateMinimumResourcesRequiredToBuild();
if ((_local13 + _local6) > _local5){
_local7 = _local8;
break;
};
_local6 = (_local6 + _local13);
_local8++;
};
if (_local6 == 0){
trace("Not enough for highest priority task, quitting");
return;
};
if (_local7 > 0){
m_queue.splice(_local7);
};
var _local9:Number = (_local5 - _local6);
trace(((((("Overage available " + _local9) + ". MinTot: ") + _local6) + " , Pruned building tasks: ") + m_queue));
while ((((m_queue.length > 0)) && ((_local3.length > 0)))) {
_local14 = processHighestPriorityBuildRequest(_local3, _local9);
_local9 = (_local9 - _local14);
trace(((("Overage left: " + _local9) + " after subtracting overageUsed ") + _local14));
};
}
function flush():void{
m_queue.splice(0);
}
function queueBuild(_arg1:AITask):void{
var _local2:BuildRequest = new BuildRequest();
_local2.task = _arg1;
m_queue.push(_local2);
}
}
}//package com.gamedozer.battalion.game.ai
class BuildRequest {
public var task:AITask;
private function BuildRequest(){
}
public function toString():String{
return ((("<Build Request: " + task) + " >"));
}
}
Section 69
//BooleanVariableCondition (com.gamedozer.battalion.game.conditions.BooleanVariableCondition)
package com.gamedozer.battalion.game.conditions {
import com.gamedozer.battalion.game.*;
import flash.utils.*;
public class BooleanVariableCondition implements Condition {
protected var boolean:String;
protected var value:Boolean;
public var satisfied:Boolean;
protected static var booleans:Dictionary;
public function BooleanVariableCondition(_arg1:String, _arg2:Boolean, _arg3:Boolean=false){
if (booleans == null){
booleans = new Dictionary();
};
satisfied = _arg3;
boolean = _arg1;
value = _arg2;
if (booleans[boolean] == null){
booleans[boolean] = !(value);
};
}
public function toXML():XML{
return (new XML((((((("<condition type=\"booleanVariable\"><boolean value=\"" + boolean) + "\"/><value value=\"") + ((booleans[boolean] == true)) ? "true" : "false") + "\"/> <satisfied value=\"") + ((satisfied == true)) ? "true" : "false") + "\"/> </condition>")));
}
public function update():void{
if (booleans[boolean] == value){
satisfied = true;
};
}
public function reset():void{
satisfied = false;
booleans[boolean] = !(value);
}
public function isSatisfied():Boolean{
return (satisfied);
}
public function dispose():void{
}
public static function getBoolean(_arg1:String, _arg2:Boolean=false):Boolean{
if (booleans == null){
booleans = new Dictionary();
};
if (booleans[_arg1] == null){
booleans[_arg1] = _arg2;
};
return (booleans[_arg1]);
}
public static function setBoolean(_arg1:String, _arg2:Boolean):void{
if (booleans == null){
booleans = new Dictionary();
};
booleans[_arg1] = _arg2;
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:String = _arg1.boolean.@value;
var _local3:Boolean;
var _local4:String = _arg1.value.@value;
if (_local4.toLowerCase().charAt(0) == "t"){
_local3 = true;
};
var _local5:Boolean;
var _local6:String = _arg1.satistfied.@value;
if (_local6.toLowerCase().charAt(0) == "t"){
_local5 = true;
};
return (new BooleanVariableCondition(_local2, _local3, _local5));
}
}
}//package com.gamedozer.battalion.game.conditions
Section 70
//BuildUnitCondition (com.gamedozer.battalion.game.conditions.BuildUnitCondition)
package com.gamedozer.battalion.game.conditions {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
public class BuildUnitCondition implements Condition {
protected var y:int;
protected var player:int;
protected var name:String;
protected var x:int;
public var satisfied:Boolean;
public function BuildUnitCondition(_arg1:String="", _arg2:int=-1, _arg3:int=-1, _arg4:int=-1, _arg5:Boolean=false){
name = _arg1;
x = _arg3;
y = _arg4;
player = _arg2;
satisfied = _arg5;
TriggerManager.getInstance().addListener(BuildUnitTrigger.TRIGGER, buildUnitListener);
}
private function buildUnitListener(_arg1:BuildUnitTrigger):void{
var _local2:Unit = _arg1.getUnit();
if ((((name == "")) || ((_local2.getUnitData().getName().toLowerCase() == name.toLowerCase())))){
if ((((x == -1)) || ((x == _local2.getX())))){
if ((((y == -1)) || ((y == _local2.getY())))){
if ((((player == -1)) || ((GameManager.getInstance().getPlayer(_local2.getController()) == player)))){
satisfied = true;
};
};
};
};
}
public function isSatisfied():Boolean{
return (satisfied);
}
public function update():void{
}
public function toXML():XML{
return (new XML((((((((((("<condition type=\"buildUnit\"> <unitName value=\"" + name) + "\"/> <player value=\"") + (player + 1)) + "\"/> <x value=\"") + x) + "\"/> <y value=\"") + y) + "\"/> <satisfied value=\"") + ((satisfied == true)) ? "true" : "false") + "\"/> </condition>")));
}
public function reset():void{
satisfied = false;
}
public function dispose():void{
TriggerManager.getInstance().removeListener(BuildUnitTrigger.TRIGGER, buildUnitListener);
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:String = _arg1.unitName.@value;
var _local3:String = _arg1.player.@value;
if (_local3 == ""){
_local3 = "0";
};
var _local4:String = _arg1.x.@value;
if (_local4 == ""){
_local4 = "-1";
};
var _local5:String = _arg1.y.@value;
if (_local5 == ""){
_local5 = "-1";
};
var _local6:Boolean;
var _local7:String = _arg1.satistfied.@value;
if (_local7.toLowerCase().charAt(0) == "t"){
_local6 = true;
};
return (new BuildUnitCondition(_local2, (int(_local3) - 1), int(_local4), int(_local5), _local6));
}
}
}//package com.gamedozer.battalion.game.conditions
Section 71
//CaptureTerrainCondition (com.gamedozer.battalion.game.conditions.CaptureTerrainCondition)
package com.gamedozer.battalion.game.conditions {
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
public class CaptureTerrainCondition implements Condition {
protected var player:int;
protected var oldPlayer:int;
protected var name:String;
public var satisfied:Boolean;
public function CaptureTerrainCondition(_arg1:String="", _arg2:int=-1, _arg3:int=-1, _arg4:Boolean=false){
name = _arg1;
oldPlayer = _arg2;
player = _arg3;
satisfied = _arg4;
TriggerManager.getInstance().addListener(CaptureTerrainTrigger.TRIGGER, captureTerrainListener);
}
public function update():void{
}
private function captureTerrainListener(_arg1:CaptureTerrainTrigger):void{
if (_arg1.getComplete()){
trace("Capture Trigger is complete!");
if ((((name == "")) || ((_arg1.getTile().getTerrain().getName().toLowerCase() == name.toLowerCase())))){
if (oldPlayer != -1){
if (oldPlayer == _arg1.getOldPlayer()){
if (player != -1){
if (player == _arg1.getPlayer()){
satisfied = true;
};
} else {
satisfied = true;
};
};
} else {
satisfied = true;
};
};
};
}
public function isSatisfied():Boolean{
return (satisfied);
}
public function toXML():XML{
var _local1:XML = new XML((((((((("<condition type=\"captureTerrain\"> <terrainName value=\"" + name) + "\"/> <oldPlayer value=\"") + (oldPlayer + 1)) + "\"/> <player value=\"") + (player + 1)) + "\"/> <satisfied value=\"") + ((satisfied == true)) ? "true" : "false") + "\"/> </condition>"));
return (_local1);
}
public function reset():void{
satisfied = false;
}
public function dispose():void{
TriggerManager.getInstance().removeListener(CaptureTerrainTrigger.TRIGGER, captureTerrainListener);
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:String = _arg1.terrainName.@value;
var _local3:String = _arg1.player.@value;
if (_local3 == ""){
_local3 = "0";
};
var _local4:String = _arg1.oldPlayer.@value;
if (_local4 == ""){
_local4 = "0";
};
var _local5:Boolean;
var _local6:String = _arg1.satistfied.@value;
if (_local6.toLowerCase().charAt(0) == "t"){
_local5 = true;
};
trace(("From XML, satisfied = " + _local5));
return (new CaptureTerrainCondition(_local2, (int(_local4) - 1), (int(_local3) - 1), _local5));
}
}
}//package com.gamedozer.battalion.game.conditions
Section 72
//CounterVariableCondition (com.gamedozer.battalion.game.conditions.CounterVariableCondition)
package com.gamedozer.battalion.game.conditions {
import com.gamedozer.battalion.game.*;
import flash.utils.*;
public class CounterVariableCondition implements Condition {
protected var counter:String;
protected var defaultValue:int;
protected var value:int;
public var satisfied:Boolean;
protected static var counters:Dictionary;
public function CounterVariableCondition(_arg1:String, _arg2:int, _arg3:int=0, _arg4:Boolean=false){
if (counters == null){
counters = new Dictionary();
};
satisfied = _arg4;
counter = _arg1;
value = _arg2;
defaultValue = _arg3;
if (counters[counter] == null){
counters[counter] = defaultValue;
};
}
public function isSatisfied():Boolean{
return (satisfied);
}
public function update():void{
if (counters[counter] == value){
satisfied = true;
};
}
public function reset():void{
satisfied = false;
counters[counter] = defaultValue;
}
public function toXML():XML{
return (new XML((((((((("<condition type=\"counterVariable\"><counter value=\"" + counter) + "\"/> <value value=\"") + counters[counter]) + "\"/> <defaultValue value=\"") + defaultValue) + "\"/> <satisfied value=\"") + ((satisfied == true)) ? "true" : "false") + "\"/> </condition>")));
}
public function dispose():void{
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:String = _arg1.name.@value;
var _local3:String = _arg1.value.@value;
var _local4:String = _arg1.defaulValue.@value;
if (_local4 == ""){
_local4 = "0";
};
var _local5:Boolean;
var _local6:String = _arg1.satistfied.@value;
if (_local6.toLowerCase().charAt(0) == "t"){
_local5 = true;
};
return (new CounterVariableCondition(_local2, int(_local3), int(_local4), _local5));
}
public static function setCounter(_arg1:String, _arg2:int):void{
if (counters == null){
counters = new Dictionary();
};
counters[_arg1] = _arg2;
}
public static function getCounter(_arg1:String, _arg2:int=0):int{
if (counters == null){
counters = new Dictionary();
};
if (counters[_arg1] == null){
counters[_arg1] = _arg2;
};
return (counters[_arg1]);
}
}
}//package com.gamedozer.battalion.game.conditions
Section 73
//EndGameCondition (com.gamedozer.battalion.game.conditions.EndGameCondition)
package com.gamedozer.battalion.game.conditions {
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
public class EndGameCondition implements Condition {
protected var player:int;
public var satisfied:Boolean;
protected var victory:Boolean;
public function EndGameCondition(_arg1:int=-1, _arg2:Boolean=true, _arg3:Boolean=false){
player = _arg1;
victory = _arg2;
satisfied = _arg3;
TriggerManager.getInstance().addListener(PlayerTrigger.END_GAME, endGameListener);
TriggerManager.getInstance().addListener(PlayerTrigger.SURRENDER, surrenderListener);
}
private function endGameListener(_arg1:PlayerTrigger):void{
if (victory == true){
if ((((player == -1)) || ((player == _arg1.getPlayer())))){
satisfied = true;
};
};
}
private function surrenderListener(_arg1:PlayerTrigger):void{
if (victory == false){
if ((((player == -1)) || ((player == _arg1.getPlayer())))){
satisfied = true;
};
};
}
public function isSatisfied():Boolean{
return (satisfied);
}
public function update():void{
}
public function reset():void{
satisfied = false;
}
public function toXML():XML{
return (new XML((((((("<condition type=\"endGame\"><player value=\"" + (player + 1)) + "\"/> <victory value=\"") + ((victory == true)) ? "true" : "false") + "\"/> <satisfied value=\"") + ((satisfied == true)) ? "true" : "false") + "\"/> </condition>")));
}
public function dispose():void{
TriggerManager.getInstance().removeListener(PlayerTrigger.END_GAME, endGameListener);
TriggerManager.getInstance().removeListener(PlayerTrigger.SURRENDER, surrenderListener);
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:String = _arg1.player.@value;
if (_local2 == ""){
_local2 = "0";
};
var _local3:Boolean;
var _local4:String = _arg1.victory.@value;
if (_local4.toLowerCase().charAt(0) == "f"){
_local3 = false;
};
var _local5:Boolean;
var _local6:String = _arg1.satistfied.@value;
if (_local6.toLowerCase().charAt(0) == "t"){
_local5 = true;
};
return (new EndGameCondition((int(_local2) - 1), _local3, _local5));
}
}
}//package com.gamedozer.battalion.game.conditions
Section 74
//KillUnitCondition (com.gamedozer.battalion.game.conditions.KillUnitCondition)
package com.gamedozer.battalion.game.conditions {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.game.responses.*;
public class KillUnitCondition implements Condition {
protected var y:int;
protected var player:int;
protected var name:String;
protected var x:int;
public var satisfied:Boolean;
public function KillUnitCondition(_arg1:String="", _arg2:int=-1, _arg3:int=-1, _arg4:int=-1, _arg5:Boolean=false){
name = _arg1;
x = _arg3;
y = _arg4;
player = _arg2;
satisfied = _arg5;
TriggerManager.getInstance().addListener(KillUnitTrigger.TRIGGER, killUnitListener);
}
public function isSatisfied():Boolean{
return (satisfied);
}
public function update():void{
}
public function toXML():XML{
return (new XML((((((((((("<condition type=\"killUnit\"> <unitName value=\"" + name) + "\"/> <player value=\"") + (player + 1)) + "\"/> <x value=\"") + x) + "\"/> <y value=\"") + y) + "\"/> <satisfied value=\"") + ((satisfied == true)) ? "true" : "false") + "\"/> </condition>")));
}
private function killUnitListener(_arg1:KillUnitTrigger):void{
var _local2:Unit = _arg1.getUnit();
var _local3:UnitData = _local2.getUnitData();
var _local4:Boolean;
if (_local3 != null){
if (_local3.getName().toLowerCase() == name.toLowerCase()){
_local4 = true;
};
} else {
if (_local2 == NameUnitResponse.getNamedUnit(name)){
_local4 = true;
};
};
if ((((name == "")) || (_local4))){
if ((((x == -1)) || ((x == _arg1.getUnitX())))){
if ((((y == -1)) || ((y == _arg1.getUnitY())))){
if ((((player == -1)) || ((GameManager.getInstance().getPlayer(_local2.getController()) == player)))){
satisfied = true;
};
};
};
};
}
public function reset():void{
satisfied = false;
}
public function dispose():void{
TriggerManager.getInstance().removeListener(KillUnitTrigger.TRIGGER, killUnitListener);
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:String = _arg1.unitName.@value;
var _local3:String = _arg1.player.@value;
if (_local3 == ""){
_local3 = "0";
};
var _local4:String = _arg1.x.@value;
if (_local4 == ""){
_local4 = "-1";
};
var _local5:String = _arg1.y.@value;
if (_local5 == ""){
_local5 = "-1";
};
var _local6:Boolean;
var _local7:String = _arg1.satistfied.@value;
if (_local7.toLowerCase().charAt(0) == "t"){
_local6 = true;
};
return (new KillUnitCondition(_local2, (int(_local3) - 1), int(_local4), int(_local5), _local6));
}
}
}//package com.gamedozer.battalion.game.conditions
Section 75
//MoveUnitCondition (com.gamedozer.battalion.game.conditions.MoveUnitCondition)
package com.gamedozer.battalion.game.conditions {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.game.responses.*;
public class MoveUnitCondition implements Condition {
protected var y:int;
protected var player:int;
protected var name:String;
protected var x:int;
public var satisfied:Boolean;
public function MoveUnitCondition(_arg1:int=-1, _arg2:int=-1, _arg3:String="", _arg4:int=-1, _arg5:Boolean=false){
name = _arg3;
x = _arg1;
y = _arg2;
player = _arg4;
satisfied = _arg5;
TriggerManager.getInstance().addListener(MoveUnitTrigger.TRIGGER, moveUnitListener);
}
public function isSatisfied():Boolean{
return (satisfied);
}
private function moveUnitListener(_arg1:MoveUnitTrigger):void{
var _local2:Unit = _arg1.getUnit();
var _local3:UnitData = _local2.getUnitData();
var _local4:Boolean;
if (_local3 != null){
if (_local3.getName().toLowerCase() == name.toLowerCase()){
_local4 = true;
};
} else {
if (_local2 == NameUnitResponse.getNamedUnit(name)){
_local4 = true;
};
};
if ((((name == "")) || (_local4))){
if ((((x == -1)) || ((x == _local2.getX())))){
if ((((y == -1)) || ((y == _local2.getY())))){
if ((((player == -1)) || ((GameManager.getInstance().getPlayer(_local2.getController()) == player)))){
satisfied = true;
};
};
};
};
}
public function toXML():XML{
return (new XML((((((((((("<condition type=\"moveUnit\"> <x value=\"" + x) + "\"/> <y value=\"") + y) + "\"/> <unitName value=\"") + name) + "\"/> <player value=\"") + (player + 1)) + "\"/> <satisfied value=\"") + ((satisfied == true)) ? "true" : "false") + "\"/> </condition>")));
}
public function update():void{
}
public function reset():void{
satisfied = false;
}
public function dispose():void{
TriggerManager.getInstance().removeListener(MoveUnitTrigger.TRIGGER, moveUnitListener);
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:String = _arg1.unitName.@value;
var _local3:String = _arg1.player.@value;
if (_local3 == ""){
_local3 = "0";
};
var _local4:String = _arg1.x.@value;
if (_local4 == ""){
_local4 = "-1";
};
var _local5:String = _arg1.y.@value;
if (_local5 == ""){
_local5 = "-1";
};
var _local6:Boolean;
var _local7:String = _arg1.satistfied.@value;
if (_local7.toLowerCase().charAt(0) == "t"){
_local6 = true;
};
return (new MoveUnitCondition(int(_local4), int(_local5), _local2, (int(_local3) - 1), _local6));
}
}
}//package com.gamedozer.battalion.game.conditions
Section 76
//NoUnitsCondition (com.gamedozer.battalion.game.conditions.NoUnitsCondition)
package com.gamedozer.battalion.game.conditions {
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
public class NoUnitsCondition implements Condition {
protected var player:int;
protected var satisfied:Boolean;
public function NoUnitsCondition(_arg1:int, _arg2:Boolean=false){
player = _arg1;
TriggerManager.getInstance().addListener(PlayerTrigger.NO_UNITS, noUnitsListener);
}
public function toXML():XML{
return (new XML((((("<condition type=\"noUnits\"> <satisfied value=\"" + ((satisfied == true)) ? "true" : "false") + "\"/> <player value=\"") + (player + 1)) + "\"/> </condition>")));
}
public function update():void{
}
public function isSatisfied():Boolean{
return (satisfied);
}
public function noUnitsListener(_arg1:PlayerTrigger):void{
if (_arg1.getPlayer() == player){
satisfied = true;
};
}
public function reset():void{
satisfied = false;
}
public function dispose():void{
TriggerManager.getInstance().removeListener(PlayerTrigger.NO_UNITS, noUnitsListener);
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:Boolean;
var _local3:String = _arg1.satistfied.@value;
if (_local3.toLowerCase().charAt(0) == "t"){
_local2 = true;
};
var _local4:String = _arg1.player.@value;
if (_local4 == ""){
_local4 = "0";
};
return (new NoUnitsCondition((parseInt(_local4) - 1), _local2));
}
}
}//package com.gamedozer.battalion.game.conditions
Section 77
//ResourcesAcquiredCondition (com.gamedozer.battalion.game.conditions.ResourcesAcquiredCondition)
package com.gamedozer.battalion.game.conditions {
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
public class ResourcesAcquiredCondition implements Condition {
protected var player:int;
protected var resources:int;
protected var count:int;
public var satisfied:Boolean;
public function ResourcesAcquiredCondition(_arg1:int=-1, _arg2:int=-1, _arg3:int=0, _arg4:Boolean=false){
player = _arg2;
resources = _arg1;
count = _arg3;
satisfied = _arg4;
TriggerManager.getInstance().addListener(ResourcesAcquiredTrigger.TRIGGER, resourcesAcquiredListener);
}
public function toXML():XML{
return (new XML((((((((("<condition type=\"resourcesAcquired\"> <resources value=\"" + resources) + "\"/> <player value=\"") + (player + 1)) + "\"/> <count value=\"") + count) + "\"/> <satisfied value=\"") + ((satisfied == true)) ? "true" : "false") + "\"/> </condition>")));
}
private function resourcesAcquiredListener(_arg1:ResourcesAcquiredTrigger):void{
if ((((player == -1)) || ((player == _arg1.getPlayer())))){
count = (count + _arg1.getResources());
if (count >= resources){
satisfied = true;
};
};
}
public function isSatisfied():Boolean{
return (satisfied);
}
public function update():void{
}
public function reset():void{
satisfied = false;
count = 0;
}
public function dispose():void{
TriggerManager.getInstance().removeListener(ResourcesAcquiredTrigger.TRIGGER, resourcesAcquiredListener);
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:String = _arg1.resources.@value;
if (_local2 == ""){
_local2 = "-1";
};
var _local3:String = _arg1.player.@value;
if (_local3 == ""){
_local3 = "0";
};
var _local4:String = _arg1.count.@value;
if (_local4 == ""){
_local4 = "0";
};
var _local5:Boolean;
var _local6:String = _arg1.satistfied.@value;
if (_local6.toLowerCase().charAt(0) == "t"){
_local5 = true;
};
return (new ResourcesAcquiredCondition(int(_local2), (int(_local3) - 1), int(_local4), _local5));
}
}
}//package com.gamedozer.battalion.game.conditions
Section 78
//StartGameCondition (com.gamedozer.battalion.game.conditions.StartGameCondition)
package com.gamedozer.battalion.game.conditions {
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
public class StartGameCondition implements Condition {
public var satisfied:Boolean;
public function StartGameCondition(_arg1:Boolean=false){
satisfied = _arg1;
TriggerManager.getInstance().addListener(Trigger.START_GAME, startGameListener);
}
public function isSatisfied():Boolean{
return (satisfied);
}
public function reset():void{
satisfied = false;
}
public function update():void{
}
public function startGameListener(_arg1:Trigger):void{
satisfied = true;
}
public function toXML():XML{
return (new XML((("<condition type=\"startGame\"> <satisfied value=\"" + ((satisfied == true)) ? "true" : "false") + "\"/> </condition>")));
}
public function dispose():void{
TriggerManager.getInstance().removeListener(Trigger.START_GAME, startGameListener);
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:Boolean;
var _local3:String = _arg1.satistfied.@value;
if (_local3.toLowerCase().charAt(0) == "t"){
_local2 = true;
};
return (new StartGameCondition(_local2));
}
}
}//package com.gamedozer.battalion.game.conditions
Section 79
//StartTurnCondition (com.gamedozer.battalion.game.conditions.StartTurnCondition)
package com.gamedozer.battalion.game.conditions {
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
public class StartTurnCondition implements Condition {
protected var player:int;
protected var round:int;
public var satisfied:Boolean;
public function StartTurnCondition(_arg1:int=-1, _arg2:int=-1, _arg3:Boolean=false){
player = _arg1;
round = _arg2;
satisfied = _arg3;
TriggerManager.getInstance().addListener(PlayerTrigger.START_TURN, startTurnListener);
}
public function toXML():XML{
return (new XML((((((("<condition type=\"startTurn\"> <player value=\"" + (player + 1)) + "\"/> <round value=\"") + round) + "\"/> <satisfied value=\"") + ((satisfied == true)) ? "true" : "false") + "\"/> </condition>")));
}
public function isSatisfied():Boolean{
return (satisfied);
}
public function update():void{
}
private function startTurnListener(_arg1:PlayerTrigger):void{
if ((((player == -1)) || ((player == _arg1.getPlayer())))){
if ((((round == -1)) || ((round == GameManager.getInstance().getRound())))){
satisfied = true;
};
};
}
public function reset():void{
satisfied = false;
}
public function dispose():void{
TriggerManager.getInstance().removeListener(PlayerTrigger.START_TURN, startTurnListener);
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:String = _arg1.player.@value;
if (_local2 == ""){
_local2 = "0";
};
var _local3:String = _arg1.round.@value;
if (_local3 == ""){
_local3 = "-1";
};
var _local4:Boolean;
var _local5:String = _arg1.satistfied.@value;
if (_local5.toLowerCase().charAt(0) == "t"){
_local4 = true;
};
return (new StartTurnCondition((int(_local2) - 1), int(_local3), _local4));
}
}
}//package com.gamedozer.battalion.game.conditions
Section 80
//TimePassedCondition (com.gamedozer.battalion.game.conditions.TimePassedCondition)
package com.gamedozer.battalion.game.conditions {
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.triggers.*;
public class TimePassedCondition implements Condition {
protected var timer:uint;
protected var time:uint;
public var satisfied:Boolean;
public function TimePassedCondition(_arg1:uint=0, _arg2:uint=0, _arg3:Boolean=false){
time = _arg1;
timer = _arg2;
satisfied = _arg3;
TriggerManager.getInstance().addListener(TimePassedTrigger.TRIGGER, timePassedListener);
}
public function isSatisfied():Boolean{
return (satisfied);
}
public function update():void{
}
private function timePassedListener(_arg1:TimePassedTrigger):void{
timer = (timer + _arg1.getTime());
if (timer >= time){
satisfied = true;
};
}
public function reset():void{
satisfied = false;
timer = 0;
}
public function toXML():XML{
return (new XML((((((("<condition type=\"timePassed\"> <time value=\"" + time) + "\"/> <timer value=\"") + timer) + "\"/> <satisfied value=\"") + ((satisfied == true)) ? "true" : "false") + "\"/> </condition>")));
}
public function dispose():void{
TriggerManager.getInstance().removeListener(TimePassedTrigger.TRIGGER, timePassedListener);
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:String = _arg1.time.@value;
if (_local2 == ""){
_local2 = "0";
};
var _local3:String = _arg1.timer.@value;
if (_local3 == ""){
_local3 = "0";
};
var _local4:Boolean;
var _local5:String = _arg1.satistfied.@value;
if (_local5.toLowerCase().charAt(0) == "t"){
_local4 = true;
};
return (new TimePassedCondition(int(_local2), int(_local3), _local4));
}
}
}//package com.gamedozer.battalion.game.conditions
Section 81
//AIController (com.gamedozer.battalion.game.controllers.AIController)
package com.gamedozer.battalion.game.controllers {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.audio.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.ai.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
public class AIController extends Controller {
private var m_engine:AIEngine;
private var control:Boolean;// = false
private var m_aiThinkingIndicator:Bitmap;// = null
private var m_sponsorLogoButton:GameSprite;
public function AIController(_arg1:Team){
super(_arg1);
control = false;
m_engine = new AIEngine(this);
TriggerManager.getInstance().addListener(Trigger.CONTROL, controlListener);
}
override protected function killUnit(_arg1:int, _arg2:int, _arg3:Unit):void{
m_engine.handleKilledUnit(_arg3, _arg1, _arg2);
}
private function rolloverSponsor(_arg1:MouseEvent):void{
var _local2:DisplayObject = (_arg1.target as DisplayObject);
_local2.alpha = 1;
}
override public function isStillInitializing():Boolean{
return (m_engine.isStillInitializing());
}
override protected function startRound():void{
}
override protected function captureTerrain(_arg1:Tile, _arg2:int, _arg3:int, _arg4:Boolean):void{
m_engine.captureTerrain(_arg1, _arg2, _arg3, _arg4);
}
override public function initialize():void{
m_engine.parseTileMap();
m_engine.parseUnitList();
m_engine.initialize();
m_engine.startLoading();
}
override protected function buildUnit(_arg1:Unit):void{
m_engine.handleBuiltUnit(_arg1);
}
override protected function startCurrentTurn():void{
var _local1:GameSprite;
control = true;
m_aiThinkingIndicator = new Bitmap(BitmapLibrary.loadBitmap("ai_thinking"));
m_aiThinkingIndicator.x = 15;
m_aiThinkingIndicator.y = 15;
GameManager.getInstance().getParent().addChild(m_aiThinkingIndicator);
m_aiThinkingIndicator.alpha = 0;
tweenDown();
if (!BattalionMain.isKongregateWebsite()){
_local1 = new GameSprite();
_local1.addChild(new Bitmap(BitmapLibrary.loadBitmap("ingame_kong_logo")));
m_sponsorLogoButton = new GameButton(_local1, "select");
m_sponsorLogoButton.x = 430;
m_sponsorLogoButton.y = 380;
m_sponsorLogoButton.addEventListener(MouseEvent.CLICK, BattalionMain.visitSponsor);
m_sponsorLogoButton.addEventListener(MouseEvent.ROLL_OVER, rolloverSponsor);
m_sponsorLogoButton.addEventListener(MouseEvent.ROLL_OUT, rolloutSponsor);
m_sponsorLogoButton.alpha = 0.5;
GameManager.getInstance().getParent().addChild(m_sponsorLogoButton);
};
m_engine.startTurn();
SoundSystem.instance.destroyLoop("background");
SoundSystem.instance.createLoop("background", SoundSystem.instance.createSound("AILoopWAV"));
}
function receiveControl():void{
if (isStillInitializing()){
return;
};
m_engine.think();
}
override protected function changeUpgradeStatus(_arg1:Unit, _arg2:String, _arg3:Boolean):void{
m_engine.changeUpgradeStatus(_arg1, _arg2, _arg3);
}
override public function dispose():void{
super.dispose();
m_engine = null;
}
private function tweenUp():void{
if (m_aiThinkingIndicator == null){
return;
};
TweenManager.getInstance().add(new Tween(m_aiThinkingIndicator, Linear.easeIn, ["alpha"], [1], [0.2], 750), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(tweenDown, m_aiThinkingIndicator), TweenManager.SEQUENTIAL);
}
private function rolloutSponsor(_arg1:MouseEvent):void{
var _local2:DisplayObject = (_arg1.target as DisplayObject);
_local2.alpha = 0.5;
}
override protected function endGame():void{
removeGraphics();
}
private function removeGraphics():void{
if (m_aiThinkingIndicator == null){
return;
};
TweenManager.getInstance().removeTweens(m_aiThinkingIndicator);
m_aiThinkingIndicator.parent.removeChild(m_aiThinkingIndicator);
m_aiThinkingIndicator = null;
if (m_sponsorLogoButton != null){
m_sponsorLogoButton.parent.removeChild(m_sponsorLogoButton);
m_sponsorLogoButton = null;
};
}
protected function controlListener(_arg1:Trigger):void{
if (((control) && (enabled))){
receiveControl();
};
}
override protected function startGame():void{
}
override protected function moveUnit(_arg1:Unit, _arg2:Array):void{
m_engine.handleMovedUnit(_arg1, _arg2);
}
private function tweenDown():void{
if (m_aiThinkingIndicator == null){
return;
};
TweenManager.getInstance().add(new Tween(m_aiThinkingIndicator, Linear.easeIn, ["alpha"], [0.2], [1], 750), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(tweenUp, m_aiThinkingIndicator), TweenManager.SEQUENTIAL);
}
override protected function startTurn(_arg1:int):void{
control = false;
if (m_aiThinkingIndicator != null){
removeGraphics();
};
}
}
}//package com.gamedozer.battalion.game.controllers
Section 82
//HumanController (com.gamedozer.battalion.game.controllers.HumanController)
package com.gamedozer.battalion.game.controllers {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.ui.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.audio.*;
import flash.text.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.assets.*;
import com.gamedozer.battalion.game.actions.*;
import flash.ui.*;
public class HumanController extends Controller {
var buttons:Array;
var currentPathSprites:Array;
var currentPath:Array;
var uiButtons:Array;
var lastSelected:Unit;
var control:Boolean;
var camerax:int;
var cameray:int;
var buildMenu:BuildMenu;
public function HumanController(_arg1:Team){
super(_arg1);
buttons = new Array();
control = false;
uiButtons = new Array();
currentPath = new Array();
currentPathSprites = new Array();
TriggerManager.getInstance().addListener(Trigger.CONTROL, controlListener);
control = false;
camerax = (cameray = -1);
}
protected function clearButtons():void{
var _local1:GameSpriteScroller = GameManager.getInstance().getGameSpriteScroller();
var _local2:int;
while (_local2 < buttons.length) {
_local1.remove(buttons[_local2]);
_local2++;
};
buttons = new Array();
}
protected function direction(_arg1:int, _arg2:int, _arg3:int, _arg4:int):int{
if (_arg2 == _arg4){
if (_arg1 < _arg3){
return (0);
};
return (180);
};
if (_arg2 < _arg4){
return (90);
};
return (270);
}
protected function chooseMove(_arg1:MovePosition):void{
var _local7:Tile;
var _local8:Boolean;
var _local9:Array;
var _local10:int;
var _local11:Array;
var _local2:Unit = _arg1.unit;
var _local3:GameManager = GameManager.getInstance();
var _local4:Tile = _local3.tileAt(_local2.getX(), _local2.getY());
var _local5:Tile = _local3.tileAt(_arg1.x, _arg1.y);
if (_arg1.attack){
if (_local2.isRanged()){
chooseMove(new MovePosition(_local2.getX(), _local2.getY(), _local2));
return;
};
_local7 = _local3.tileAt(currentPath[(currentPath.length - 2)], currentPath[(currentPath.length - 1)]);
_local8 = false;
if (_local7.getUnit() != null){
if (!_local7.getUnit().isCloaked()){
_local8 = true;
};
};
if (((!(_local7.isConnected(_local5))) || (_local8))){
_local9 = Astar.search(_local4, null, _local2);
_local10 = 0;
while (_local10 < _local9.length) {
if (((_local9[_local10].isConnected(_local5)) && ((((_local9[_local10].getUnit() == null)) || ((_local9[_local10].getUnit() == _local2)))))){
chooseMove(new MovePosition(_local9[_local10].getX(), _local9[_local10].getY(), _local2));
return;
};
_local10++;
};
};
return;
};
var _local6:Boolean;
if (currentPath.length == 0){
_local6 = true;
} else {
_local7 = _local3.tileAt(currentPath[(currentPath.length - 2)], currentPath[(currentPath.length - 1)]);
if (_local7 == _local5){
return;
};
if (!_local7.isConnected(_local5)){
_local6 = true;
};
_local10 = 0;
while (_local10 < currentPath.length) {
if ((((currentPath[_local10] == _arg1.x)) && ((currentPath[(_local10 + 1)] == _arg1.y)))){
currentPath.splice(_local10, (currentPath.length - _local10));
break;
};
_local10 = (_local10 + 2);
};
currentPath.push(_arg1.x);
currentPath.push(_arg1.y);
if (_local3.moveCost(_local2, _local3.nodePath(currentPath)) > _local2.getRange()){
_local6 = true;
};
};
if (_local6){
clearPath();
_local11 = Astar.pathTrim(_local4, _local5, _local2);
currentPath = _local3.pointPath(_local11);
} else {
clearPath(true);
};
drawPath(_local2);
}
protected function drawPath(_arg1:Unit):void{
var _local4:int;
var _local5:int;
var _local6:String;
var _local7:int;
var _local8:Boolean;
var _local9:BitmapSprite;
var _local10:GameSprite;
var _local11:Tile;
var _local12:Boolean;
var _local13:Boolean;
var _local14:TileSheet;
var _local2:int;
var _local3:int;
while (_local3 < currentPath.length) {
_local4 = currentPath[_local3];
_local5 = currentPath[(_local3 + 1)];
_local6 = "";
_local7 = 0;
_local8 = false;
if (_local3 == 0){
if (currentPath.length < 3){
_local6 = "nomove";
} else {
_local6 = "start";
_local7 = direction(_local4, _local5, currentPath[(_local3 + 2)], currentPath[(_local3 + 3)]);
_local2 = _local7;
};
} else {
if (_local3 == (currentPath.length - 2)){
_local11 = GameManager.getInstance().tileAt(currentPath[_local3], currentPath[(_local3 + 1)]);
_local12 = false;
_local13 = false;
if (_local11.getUnit() != null){
_local12 = true;
if (_local11.getUnit().isCloaked()){
_local12 = false;
_local13 = true;
if (_local11.getUnit().getController() != _arg1.getController()){
_local13 = false;
};
};
};
if (((_local12) || (_local13))){
_local6 = "unmoveable";
} else {
_local6 = "end";
_local8 = true;
};
_local7 = _local2;
} else {
if (_local2 == direction(_local4, _local5, currentPath[(_local3 + 2)], currentPath[(_local3 + 3)])){
_local6 = "straight";
_local7 = _local2;
} else {
_local6 = "turn";
_local7 = _local2;
_local2 = direction(_local4, _local5, currentPath[(_local3 + 2)], currentPath[(_local3 + 3)]);
if (_local2 != ((_local7 + 90) % 360)){
_local7 = (_local7 + 90);
};
};
};
};
_local9 = new BitmapSprite(BitmapLibrary.loadBitmap(("movement_" + _local6)));
_local9.x = (-(TileManager.getInstance().getWidth()) / 2);
_local9.y = (-(TileManager.getInstance().getHeight()) / 2);
_local10 = new GameSprite();
_local10.addChild(_local9);
_local10.x = ((_local4 * TileManager.getInstance().getWidth()) + (TileManager.getInstance().getWidth() / 2));
_local10.y = ((_local5 * TileManager.getInstance().getHeight()) + (TileManager.getInstance().getHeight() / 2));
_local10.rotation = _local7;
GameManager.getInstance().getGameSpriteScroller().add(_local10, GameSpriteScroller.ABOVE_UNITS);
if (_local8){
_local14 = TileSheetManager.getInstance().getColorised(_arg1.getUnitData().getSprite(), _arg1.getController().getTeam().getColor());
_local14.alpha = 0.5;
if (_local7 == 0){
_local14.playAnimation("right_idle");
} else {
if (_local7 == 90){
_local14.playAnimation("down_idle");
} else {
if (_local7 == 180){
_local14.playAnimation("left_idle");
} else {
_local14.playAnimation("up_idle");
};
};
};
_local14.x = (_local4 * TileManager.getInstance().getWidth());
_local14.y = (_local5 * TileManager.getInstance().getHeight());
if (_local14.height > TileManager.getInstance().getHeight()){
_local14.y = (_local14.y - (_local14.height - TileManager.getInstance().getHeight()));
};
GameManager.getInstance().getGameSpriteScroller().add(_local14, GameSpriteScroller.ABOVE_UNITS);
currentPathSprites.push(_local14);
};
currentPathSprites.push(_local10);
_local3 = (_local3 + 2);
};
}
function unitMenu(_arg1:Unit):void{
var tile:Tile;
var leviathanCost:int;
var sea:TileSheet;
var albatrossCost:int;
var air:TileSheet;
var bUD:UnitData;
var drop:TileSheet;
var repairCost:int;
var repair:TileSheet;
var toolTipMessage:String;
var cancel:TileSheet;
var width:int;
var a_unit = _arg1;
var cancelOnly:Boolean;
createClearButton(a_unit);
selectUnits(new Array(a_unit));
var b:GameButton = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("marker")));
b.release = function ():void{
receiveControl();
};
b.x = a_unit.getGameUnit().x;
b.y = a_unit.getGameUnit().y;
GameManager.getInstance().getGameSpriteScroller().add(b, GameSpriteScroller.BUTTONS);
buttons.push(b);
var unitMenu:GameSprite = new GameSprite();
GameManager.getInstance().getGameSpriteScroller().add(unitMenu, GameSpriteScroller.BUTTONS);
buttons.push(unitMenu);
var startX:int;
var startY:int;
var flip:Boolean;
var map:Map = GameManager.getInstance().getMap();
if (!a_unit.isUpgraded()){
if (a_unit.getUnitData().isGround()){
if (a_unit.getUnitData().getMovementType() == UnitData.movementTypeFromString("feet")){
albatrossCost = UnitManager.getInstance().get("Albatross Transport").getCost(this);
air = TileSheetManager.getInstance().get("unitMenu");
air.playAnimation("air");
b = new GameButton(air, "option", true);
unitMenu.addChild(b);
if (((controlsAir()) && ((getResources() >= albatrossCost)))){
ToolTip.createToolTip(b, "Order Albatross", ("Order Albatross pickup for $" + albatrossCost));
b.value = a_unit;
b.release = function ():void{
upgradeUnits(this.value, true, "Albatross Transport");
};
} else {
if (((controlsAir()) && ((getResources() < albatrossCost)))){
ToolTip.createToolTip(b, "Albatross Unavailable", (("You need $" + albatrossCost) + " to order an Albatross pickup."));
b.value = a_unit;
b.turnOffGlow();
b.alpha = 0.7;
b.release = function ():void{
clear();
};
} else {
if (map.hasAirControl){
ToolTip.createToolTip(b, "Albatross Unavailable", "Capture an Air Control to enable Albatross pick up.");
b.value = a_unit;
b.turnOffGlow();
b.alpha = 0.7;
b.release = function ():void{
clear();
};
} else {
ToolTip.createToolTip(b, "Albatross Unavailable", "This map does not allow for an Albatross pickup.");
b.value = a_unit;
b.turnOffGlow();
b.alpha = 0.7;
b.release = function ():void{
clear();
};
};
};
};
b.x = startX;
b.y = startY;
startX = (startX + 54);
cancelOnly = false;
flip = false;
};
tile = GameManager.getInstance().tileAt(a_unit.getX(), a_unit.getY());
leviathanCost = UnitManager.getInstance().get("Leviathan Barge").getCost(this);
sea = TileSheetManager.getInstance().get("unitMenu");
sea.playAnimation("sea");
b = new GameButton(sea, "option", true);
unitMenu.addChild(b);
b.value = a_unit;
if (!map.hasSeaControl){
ToolTip.createToolTip(b, "Leviathan Unavailable", "This map does not allow for a Leviathan pickup.");
b.alpha = 0.7;
b.turnOffGlow();
b.release = function ():void{
clear();
};
} else {
if (((((controlsSea()) && (tile.seaBordered()))) && (tile.getTerrain().hasModifier("Shore")))){
if (getResources() >= leviathanCost){
ToolTip.createToolTip(b, "Order Leviathan", ("Order Leviathan pickup for $" + leviathanCost));
b.release = function ():void{
upgradeUnits(this.value, true, "Leviathan Barge");
};
} else {
ToolTip.createToolTip(b, "Leviathan Unavailable", (("You need $" + leviathanCost) + " to order a Leviathan pickup."));
b.alpha = 0.7;
b.turnOffGlow();
b.release = function ():void{
clear();
};
};
} else {
if (((!(controlsSea())) && (map.hasSeaControl))){
ToolTip.createToolTip(b, "Leviathan Unavailable", "Capture a Sea Control to enable Leviathan pick up.");
b.alpha = 0.7;
b.turnOffGlow();
b.release = function ():void{
clear();
};
} else {
if (!tile.getTerrain().hasModifier("Shore")){
ToolTip.createToolTip(b, "Leviathan Unavailable", "You must be standing on a Shore square to call a Leviathan pickup.");
b.alpha = 0.7;
b.turnOffGlow();
b.release = function ():void{
clear();
};
} else {
if (!tile.seaBordered()){
ToolTip.createToolTip(b, "Leviathan Unavailable", "You must be standing next to a Sea square to call a Leviathan pickup.");
b.alpha = 0.7;
b.turnOffGlow();
b.release = function ():void{
clear();
};
};
};
};
};
};
b.x = startX;
b.y = startY;
startX = (startX + 54);
cancelOnly = false;
flip = false;
};
} else {
tile = GameManager.getInstance().tileAt(a_unit.getX(), a_unit.getY());
bUD = a_unit.getBaseUnitData();
drop = TileSheetManager.getInstance().get("unitMenu");
drop.playAnimation("drop");
b = new GameButton(drop, "option", true);
unitMenu.addChild(b);
b.value = a_unit;
if (tile.getCost(new Unit(new GameUnit(new GameSprite()), bUD, 0, 0, a_unit.getController())) != Number.POSITIVE_INFINITY){
ToolTip.createToolTip(b, ("Unpack " + bUD.getName()), (("Unpack and deploy the " + bUD.getName()) + "."));
b.release = function ():void{
upgradeUnits(this.value, false);
};
} else {
ToolTip.createToolTip(b, "Unpack Unavailable", (("The " + bUD.getName()) + " cannot be unpacked on this square."));
b.turnOffGlow();
b.alpha = 0.7;
b.release = function ():void{
clear();
};
};
b.x = startX;
b.y = startY;
startX = (startX + 54);
cancelOnly = false;
flip = false;
};
if (!a_unit.isUpgraded()){
repairCost = Math.round((a_unit.getUnitData().getCost(this) * GameManager.getInstance().healPercentage(a_unit)));
repair = TileSheetManager.getInstance().get("unitMenu");
if (flip){
repair.playAnimation("repairFlip");
} else {
repair.playAnimation("repair");
};
b = new GameButton(repair, "option", true);
unitMenu.addChild(b);
if ((((getResources() >= repairCost)) && ((a_unit.getHealth() < a_unit.getUnitData().getHealth())))){
ToolTip.createToolTip(b, "Repair", ("Start repair for $" + repairCost));
b.value = a_unit;
b.release = function ():void{
repairUnits(this.value);
};
} else {
toolTipMessage = (("You need $" + repairCost) + " to repair this unit.");
if (a_unit.getHealth() >= a_unit.getUnitData().getHealth()){
toolTipMessage = "Unit is at full health.";
};
ToolTip.createToolTip(b, "Repair Unavailable", toolTipMessage);
b.turnOffGlow();
b.alpha = 0.7;
b.release = function ():void{
clear();
};
};
b.x = startX;
b.y = startY;
startX = (startX + 54);
cancelOnly = false;
};
if (cancelOnly){
receiveControl();
} else {
cancel = TileSheetManager.getInstance().get("unitMenu");
cancel.playAnimation("cancel");
b = new GameButton(cancel, "option", true);
unitMenu.addChild(b);
ToolTip.createToolTip(b, "Cancel", "Cancel unit selection");
b.release = function ():void{
receiveControl();
};
b.x = startX;
b.y = startY;
startX = (startX + 54);
unitMenu.y = ((a_unit.getY() * TileManager.getInstance().getHeight()) - 30);
if (unitMenu.y < 0){
unitMenu.y = 0;
};
unitMenu.x = (((a_unit.getX() + 0.5) * TileManager.getInstance().getWidth()) - (startX / 2));
if (unitMenu.x < 0){
unitMenu.x = 0;
};
width = (GameManager.getInstance().getMap().getWidth() * TileManager.getInstance().getWidth());
if ((unitMenu.x + startX) > width){
unitMenu.x = (width - startX);
};
};
}
override public function setEnabled(_arg1:Boolean):void{
super.setEnabled(_arg1);
if (enabled){
GameManager.getInstance().getCamera().setEnabled(true);
} else {
GameManager.getInstance().getCamera().setEnabled(false);
clearUIButtons();
clearButtons();
clearPath();
};
}
protected function selectEnemyUnit(_arg1:Unit):void{
var nodes:Array;
var b:GameButton;
var ranges:Array;
var i:int;
var index:int;
var r:Number;
var a_unit = _arg1;
clearButtons();
clearUIButtons();
clearPath();
var gameManager:GameManager = GameManager.getInstance();
gameManager.getCamera().setTarget(a_unit.getGameUnit(), 500);
var tile:Tile = gameManager.tileAt(a_unit.getX(), a_unit.getY());
if (a_unit.isRanged()){
nodes = Astar.search(tile, null, a_unit);
if (nodes == null){
nodes = new Array(tile);
};
ranges = Astar.range(tile, a_unit.getUnitData().getWeaponRangeMin(), tile.getTerrain().applyModifiers("attackRange", a_unit, a_unit.getUnitData().getWeaponRangeMax()));
i = (nodes.length - 1);
while (i >= 0) {
index = ranges.indexOf(nodes[i]);
if (index != -1){
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("selectMixed")));
ranges.splice(index, 1);
} else {
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("select")));
};
b.x = nodes[i].getGameTile().x;
b.y = nodes[i].getGameTile().y;
if (nodes[i].getUnit() == a_unit){
b.release = function ():void{
receiveControl();
};
};
gameManager.getGameSpriteScroller().add(b, GameSpriteScroller.BUTTONS);
buttons.push(b);
i = (i - 1);
};
i = (ranges.length - 1);
while (i >= 0) {
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("selectOrange")));
b.x = ranges[i].getGameTile().x;
b.y = ranges[i].getGameTile().y;
gameManager.getGameSpriteScroller().add(b, GameSpriteScroller.BUTTONS);
buttons.push(b);
i = (i - 1);
};
} else {
nodes = Astar.search(tile, null, a_unit, 0, true);
if (nodes == null){
nodes = new Array(tile);
};
r = a_unit.getRange();
i = (nodes.length - 1);
while (i >= 0) {
if (nodes[i].g > r){
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("selectOrange")));
} else {
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("select")));
};
b.x = nodes[i].getGameTile().x;
b.y = nodes[i].getGameTile().y;
if (nodes[i].getUnit() == a_unit){
b.release = function ():void{
receiveControl();
};
gameManager.getGameSpriteScroller().add(b, GameSpriteScroller.BUTTONS);
} else {
gameManager.getGameSpriteScroller().add(b, GameSpriteScroller.TOP);
};
buttons.push(b);
i = (i - 1);
};
};
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("marker2")));
b.x = a_unit.getGameUnit().x;
b.y = a_unit.getGameUnit().y;
GameManager.getInstance().getGameSpriteScroller().add(b, GameSpriteScroller.BUTTONS);
buttons.push(b);
createClearButton();
var ignoreMe:Array = new Array();
ignoreMe.push(a_unit);
selectUnits(null, ignoreMe);
selectBuildings();
}
protected function clearPath(_arg1:Boolean=false):void{
var _local2:GameSpriteScroller = GameManager.getInstance().getGameSpriteScroller();
var _local3:int;
while (_local3 < currentPathSprites.length) {
_local2.remove(currentPathSprites[_local3]);
_local3++;
};
currentPathSprites = new Array();
if (!_arg1){
currentPath = new Array();
};
}
override public function dispose():void{
super.dispose();
clearPath();
clearButtons();
clearUIButtons();
uiButtons = null;
buttons = null;
currentPath = null;
currentPathSprites = null;
}
protected function selectUnit(_arg1:Unit):void{
var nodes:Array;
var i:int;
var node:Tile;
var j:int;
var cNode:Tile;
var unit:Unit;
var r:Number;
var nodey:Tile;
var connections:Array;
var linked:Boolean;
var target:Unit;
var resources:Number;
var wrapper:NodeWrapper;
var b:GameButton;
var t:TileSheet;
var targetGraphic:TileSheet;
var at:Boolean;
var a_unit = _arg1;
clearButtons();
clearUIButtons();
clearPath();
lastSelected = a_unit;
var gameManager:GameManager = GameManager.getInstance();
gameManager.getGameSpriteScroller().swapDepth(a_unit.getGameUnit(), GameSpriteScroller.TOP);
var tile:Tile = gameManager.tileAt(a_unit.getX(), a_unit.getY());
var ranges:Array = new Array();
var rangeNodes:Array = new Array();
var attacks:Array = new Array();
var allNodes:Array = new Array();
var ignoreUnits:Array = new Array(a_unit);
var ignoreBuildings:Array = new Array();
if (a_unit.isRanged()){
nodes = Astar.search(tile, null, a_unit);
if (nodes == null){
nodes = new Array(tile);
};
ranges = Astar.range(tile, a_unit.getUnitData().getWeaponRangeMin(), tile.getTerrain().applyModifiers("attackRange", a_unit, a_unit.getUnitData().getWeaponRangeMax()));
i = (ranges.length - 1);
while (i >= 0) {
j = nodes.indexOf(ranges[i]);
if (j != -1){
nodes.splice(j, 1);
cNode = ranges.splice(i, 1)[0];
unit = cNode.getUnit();
rangeNodes.push(cNode);
if (unit != null){
if (((!(unit.getController().isAllied(a_unit.getController()))) && (!(unit.isCloaked())))){
attacks.push(rangeNodes.pop());
};
};
} else {
unit = ranges[i].getUnit();
if (unit != null){
if (((((!(unit.getController().isAllied(a_unit.getController()))) && (!(unit.isCloaked())))) && (gameManager.canWeaponsFireAtTarget(a_unit, unit, true)))){
attacks.push(ranges.splice(i, 1)[0]);
};
};
};
i = (i - 1);
};
} else {
nodes = Astar.search(tile, null, a_unit, 0, true);
if (nodes == null){
nodes = new Array(tile);
};
r = a_unit.getRange();
i = (nodes.length - 1);
while (i >= 0) {
if (nodes[i].g > r){
unit = nodes[i].getUnit();
ranges.push(nodes.splice(i, 1)[0]);
if (unit != null){
if (((((!(unit.getController().isAllied(a_unit.getController()))) && (!(unit.isCloaked())))) && (gameManager.canWeaponsFireAtTarget(a_unit, unit, true)))){
attacks.push(ranges.pop());
};
};
};
i = (i - 1);
};
};
var touched:Dictionary = new Dictionary();
var choices:Boolean;
i = 0;
while (i < nodes.length) {
nodey = nodes[i];
allNodes.push(new NodeWrapper(nodey, NodeWrapper.MOVE));
if ((((((nodey.getUnit() == null)) || (nodey.getUnit().isCloaked()))) || ((nodey.getUnit() == a_unit)))){
touched[((nodey.getX() + "_") + nodey.getY())] = true;
choices = true;
};
i = (i + 1);
};
if (a_unit.getUnitData().getWeaponType() != UnitData.weaponTypeFromString("none")){
i = 0;
while (i < rangeNodes.length) {
nodey = rangeNodes[i];
allNodes.push(new NodeWrapper(nodey, NodeWrapper.RANGE_MOVE));
if ((((((nodey.getUnit() == null)) || (nodey.getUnit().isCloaked()))) || ((nodey.getUnit() == a_unit)))){
touched[((nodey.getX() + "_") + nodey.getY())] = true;
choices = true;
};
i = (i + 1);
};
i = 0;
while (i < ranges.length) {
allNodes.push(new NodeWrapper(ranges[i], NodeWrapper.RANGE));
i = (i + 1);
};
i = 0;
while (i < attacks.length) {
connections = attacks[i].getConnections();
linked = false;
if (a_unit.isRanged()){
linked = true;
} else {
j = 0;
while (j < connections.length) {
nodey = connections[j];
if (touched[((nodey.getX() + "_") + nodey.getY())] == true){
linked = true;
break;
};
j = (j + 1);
};
};
if (linked){
target = attacks[i].getUnit();
resources = gameManager.resolveAttackCycleInResources(a_unit, target);
wrapper = new NodeWrapper(attacks[i], NodeWrapper.ATTACK, 2);
wrapper.resourceDamage = resources;
allNodes.push(wrapper);
} else {
wrapper = new NodeWrapper(attacks[i], NodeWrapper.RANGE);
allNodes.push(wrapper);
};
i = (i + 1);
};
} else {
i = 0;
while (i < rangeNodes.length) {
allNodes.push(new NodeWrapper(rangeNodes[i], NodeWrapper.MOVE));
if (rangeNodes[i].getUnit() == null){
choices = true;
};
i = (i + 1);
};
};
var attackTargets:Array = [];
i = 0;
while (i < allNodes.length) {
wrapper = allNodes[i];
if (wrapper.type == NodeWrapper.ATTACK){
attackTargets.push(wrapper);
};
i = (i + 1);
};
attackTargets.sortOn("resourceDamage");
var markerThreshold:int = Math.floor((attackTargets.length / 3));
var secondMarkerThreshold:int = Math.floor(((2 * attackTargets.length) / 3));
i = 0;
while (i < attackTargets.length) {
wrapper = attackTargets[i];
if (wrapper.resourceDamage < 17){
wrapper.sort = 2;
} else {
if (wrapper.resourceDamage < 42){
wrapper.sort = 1;
} else {
wrapper.sort = 0;
};
};
i = (i + 1);
};
createClearButton(a_unit);
var resortedNodes:Array = [];
i = 0;
while (i < allNodes.length) {
wrapper = allNodes[i];
node = allNodes[i].node;
unit = node.getUnit();
if ((((wrapper.type == NodeWrapper.ATTACK)) || ((wrapper.type == NodeWrapper.MOVE)))){
ignoreBuildings.push(node);
};
if ((((((((wrapper.type == NodeWrapper.ATTACK)) || ((wrapper.type == NodeWrapper.RANGE)))) || (choices))) || ((nodes[i] == tile)))){
if (wrapper.type == NodeWrapper.MOVE){
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("select")), "move");
b.value = new MovePosition(node.getX(), node.getY(), a_unit);
} else {
if (wrapper.type == NodeWrapper.ATTACK){
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("selectRed")), "attack");
targetGraphic = TileSheetManager.getInstance().get("attackTargets");
targetGraphic.noAnimation = true;
targetGraphic.setFrame(int(wrapper.sort));
targetGraphic.mouseEnabled = false;
targetGraphic.mouseChildren = false;
targetGraphic.x = (node.getGameTile().x - 40);
targetGraphic.y = (node.getGameTile().y - 40);
if (targetGraphic.x < 0){
targetGraphic.x = (targetGraphic.width + 40);
targetGraphic.scaleX = -1;
};
if (targetGraphic.y < 0){
targetGraphic.y = 0;
};
gameManager.getGameSpriteScroller().add(targetGraphic, GameSpriteScroller.ABOVE_ALL);
buttons.push(targetGraphic);
b.value = new MovePosition(node.getX(), node.getY(), a_unit, true);
} else {
if (wrapper.type == NodeWrapper.RANGE){
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("selectOrange")));
} else {
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("selectMixed")), "move");
b.value = new MovePosition(node.getX(), node.getY(), a_unit);
};
};
};
if (wrapper.type != NodeWrapper.RANGE){
b.mouseOver = function ():void{
chooseMove(this.value);
};
at = false;
if (node.getUnit() != null){
at = ((node.getUnit().isCloaked()) && (!((node.getUnit().getController() == a_unit.getController()))));
if (node.getUnit() == a_unit){
b.setCursor("option");
};
};
if ((((((((wrapper.type == NodeWrapper.ATTACK)) || ((node.getUnit() == null)))) || ((node == tile)))) || (at))){
b.release = function ():void{
GameManager.getInstance().getGameSpriteScroller().swapDepth(a_unit.getGameUnit(), GameSpriteScroller.UNITS);
selectMove(this.value);
};
if (node == tile){
b.addChild(new BitmapSprite(AssetLibrary.createBitmapData("marker")));
};
} else {
if (unit != null){
if ((((((((unit.getController() == a_unit.getController())) && (unit.isAlive()))) && (unit.isDeployed()))) && (unit.isAvailable()))){
b.value = new MovePositionClick(b.value.x, b.value.y, b.value.unit, unit);
b.release = function ():void{
GameManager.getInstance().getGameSpriteScroller().swapDepth(a_unit.getGameUnit(), GameSpriteScroller.UNITS);
selectUnit(this.value.other);
};
b.addChild(new BitmapSprite(AssetLibrary.createBitmapData("marker")));
ignoreUnits.push(unit);
b.setCursor("select");
};
};
};
} else {
if (unit != null){
if ((((((((unit.getController() == a_unit.getController())) && (unit.isAlive()))) && (unit.isDeployed()))) && (unit.isAvailable()))){
b.value = unit;
b.release = function ():void{
GameManager.getInstance().getGameSpriteScroller().swapDepth(a_unit.getGameUnit(), GameSpriteScroller.UNITS);
selectUnit(this.value);
};
b.addChild(new BitmapSprite(AssetLibrary.createBitmapData("marker")));
b.setCursor("select");
ignoreUnits.push(unit);
};
};
};
b.x = node.getGameTile().x;
b.y = node.getGameTile().y;
if ((((wrapper.type == NodeWrapper.RANGE)) && ((b.value == null)))){
gameManager.getGameSpriteScroller().add(b, GameSpriteScroller.TOP);
} else {
gameManager.getGameSpriteScroller().add(b, GameSpriteScroller.BUTTONS);
};
buttons.push(b);
};
i = (i + 1);
};
chooseMove(new MovePosition(a_unit.getX(), a_unit.getY(), a_unit));
selectUnits(ignoreUnits);
selectBuildings(ignoreBuildings);
}
public function buildUnits(_arg1:UnitData, _arg2:Tile):void{
ActionManager.getInstance().add(new BuildUnitAction(_arg2.getX(), _arg2.getY(), _arg1.getName()));
clearUIButtons();
}
protected function selectBuildings(_arg1:Array=null):void{
var b:GameButton;
var a_ignore = _arg1;
if (a_ignore == null){
a_ignore = new Array();
};
var i:int;
while (i < structures.length) {
if (a_ignore.indexOf(structures[i]) == -1){
if (structures[i].getUnit() == null){
if (structures[i].getTerrain().hasModifier("Construction")){
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("marker")), "select");
b.value = structures[i];
b.release = function ():void{
selectBuilding(this.value);
};
b.x = structures[i].getGameTile().x;
b.y = structures[i].getGameTile().y;
GameManager.getInstance().getGameSpriteScroller().add(b, GameSpriteScroller.BUTTONS);
buttons.push(b);
};
};
};
i = (i + 1);
};
}
override public function setCamera():void{
if (camerax != -1){
GameManager.getInstance().getCamera().setLocation(camerax, cameray);
};
}
function clearUI():void{
clearUIButtons();
clearButtons();
clearPath();
}
protected function clearUIButtons():void{
if (buildMenu != null){
GameManager.getInstance().getParent().removeChild(buildMenu);
buildMenu = null;
};
}
protected function controlListener(_arg1:Trigger):void{
if (((control) && (enabled))){
receiveControl();
};
}
protected function endTurnHandler(_arg1:Event):void{
endTurn();
}
protected function nextUnitHandler(_arg1:Event):void{
selectNextUnit();
}
function labelledGameButton(_arg1:GameSprite, _arg2:String):GameButton{
var _local3:GameButton = new GameButton(_arg1, "select");
var _local4:TextField = new DefaultTextField();
new DefaultTextField().width = (_local4.height = 500);
_local4.text = _arg2;
_local4.width = (_local4.textWidth + 5);
_local4.height = (_local4.textHeight + 5);
_local4.x = _arg1.width;
_local3.addChild(_local4);
return (_local3);
}
protected function createClearButton(_arg1:Unit=null):void{
var a_unit = _arg1;
var gs:GameSprite = new GameSprite();
gs.graphics.beginFill(0xFFFFFF, 0);
gs.graphics.drawRect(0, 0, (GameManager.getInstance().getMap().getWidth() * TileManager.getInstance().getWidth()), (GameManager.getInstance().getMap().getHeight() * TileManager.getInstance().getHeight()));
gs.graphics.endFill();
var b:GameButton = new GameButton(gs);
if (a_unit){
b.release = function ():void{
GameManager.getInstance().getGameSpriteScroller().swapDepth(a_unit.getGameUnit(), GameSpriteScroller.UNITS);
receiveControl();
};
} else {
b.release = function ():void{
receiveControl();
};
};
GameManager.getInstance().getGameSpriteScroller().add(b, GameSpriteScroller.BUTTONS);
buttons.push(b);
}
override public function update(_arg1:uint=0):void{
if (buildMenu != null){
buildMenu.update(_arg1);
};
}
protected function selectNextUnit():void{
var _local1:int;
var _local2:int;
while (_local2 < units.length) {
if (units[_local2] == lastSelected){
_local1 = _local2;
break;
};
_local2++;
};
_local2 = (_local1 + 1);
while (_local2 < units.length) {
if (units[_local2].isAvailable()){
selectUnit(units[_local2]);
GameManager.getInstance().getCamera().setTarget(units[_local2].getGameUnit(), 500);
return;
};
_local2++;
};
_local2 = 0;
while (_local2 < _local1) {
if (units[_local2].isAvailable()){
selectUnit(units[_local2]);
GameManager.getInstance().getCamera().setTarget(units[_local2].getGameUnit(), 500);
return;
};
_local2++;
};
}
protected function selectBuilding(_arg1:Tile):void{
clearButtons();
createClearButton();
GameManager.getInstance().getCamera().setTarget(_arg1.getGameTile(), 500);
buildMenu = new BuildMenu(this, _arg1);
buildMenu.x = (GameManager.getInstance().getSprite().x + ((GameManager.GAME_WIDTH - BuildMenu.WIDTH) / 2));
buildMenu.y = (GameManager.getInstance().getSprite().y + ((GameManager.GAME_HEIGHT - BuildMenu.HEIGHT) / 2));
GameManager.getInstance().getCamera().setEnabled(false);
GameManager.getInstance().getParent().addChild(buildMenu);
}
override public function showCloak():Boolean{
return (true);
}
override protected function startCurrentTurn():void{
control = true;
cloakVisibility = 0.5;
var _local1:int;
while (_local1 < units.length) {
if (units[_local1].isCloaked()){
units[_local1].setCloaked(false, true);
};
_local1++;
};
SoundSystem.instance.destroyLoop("background");
SoundSystem.instance.createLoop("background", SoundSystem.instance.createSound("PlayerLoopWAV"));
}
function upgradeUnits(_arg1:Unit, _arg2:Boolean, _arg3:String=""):void{
ActionManager.getInstance().add(new UpgradeUnitAction(_arg1.getX(), _arg1.getY(), _arg2, _arg3));
clearUI();
}
public function clear():void{
clearUIButtons();
receiveControl();
}
protected function selectUnits(_arg1:Array=null, _arg2:Array=null):void{
var b:GameButton;
var allUnits:Array;
var a_ignoreUnits = _arg1;
var a_ignoreEnemies = _arg2;
if (a_ignoreUnits == null){
a_ignoreUnits = new Array();
};
if (a_ignoreEnemies == null){
a_ignoreEnemies = new Array();
};
var done:int;
var i:int;
while (i < units.length) {
if (a_ignoreUnits.indexOf(units[i]) == -1){
if (((((units[i].isAlive()) && (units[i].isDeployed()))) && (units[i].isAvailable()))){
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("marker")), "select");
b.value = units[i];
b.release = function ():void{
selectUnit(this.value);
};
b.x = units[i].getGameUnit().x;
b.y = units[i].getGameUnit().y;
GameManager.getInstance().getGameSpriteScroller().add(b, GameSpriteScroller.BUTTONS);
buttons.push(b);
done = (done + 1);
};
};
i = (i + 1);
};
if (a_ignoreUnits.length == 0){
allUnits = GameManager.getInstance().getUnits();
i = 0;
while (i < allUnits.length) {
if (a_ignoreEnemies.indexOf(allUnits[i]) == -1){
if (allUnits[i].getController() != this){
if (((((allUnits[i].isAlive()) && (allUnits[i].isDeployed()))) && (!(allUnits[i].isCloaked())))){
b = new GameButton(new BitmapSprite(AssetLibrary.createBitmapData("marker2")), "select");
b.value = allUnits[i];
b.release = function ():void{
selectEnemyUnit(this.value);
};
b.x = allUnits[i].getGameUnit().x;
b.y = allUnits[i].getGameUnit().y;
GameManager.getInstance().getGameSpriteScroller().add(b, GameSpriteScroller.BUTTONS);
buttons.push(b);
};
};
};
i = (i + 1);
};
};
if (done == 0){
};
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.CONTROL){
if (GameManager.getInstance().getCamera().isEnabled()){
selectNextUnit();
};
};
}
override protected function endGame():void{
var _local1:TileSheetButton;
var _local2:TileSheetButton;
clearPath();
clearButtons();
clearUIButtons();
if (control){
_local1 = GameManager.getInstance().getEndTurnButton();
_local1.removeEventListener(MouseEvent.CLICK, endTurnHandler);
_local1.disable();
_local2 = GameManager.getInstance().getNextUnitButton();
_local2.removeEventListener(MouseEvent.CLICK, nextUnitHandler);
BattalionMain.getStage().removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
_local2.disable();
GameManager.getInstance().getParent().mainMenuButton.disable();
control = false;
camerax = GameManager.getInstance().getCamera().getX();
cameray = GameManager.getInstance().getCamera().getY();
GameManager.getInstance().getCamera().setEnabled(false);
};
}
function repairUnits(_arg1:Unit):void{
ActionManager.getInstance().add(new RepairUnitAction(_arg1.getX(), _arg1.getY()));
clearUI();
}
protected function selectMove(_arg1:MovePosition):void{
GameManager.getInstance().getCamera().setEnabled(false);
chooseMove(_arg1);
clearButtons();
if (((((!(_arg1.attack)) && ((currentPath[(currentPath.length - 2)] == _arg1.unit.getX())))) && ((currentPath[(currentPath.length - 1)] == _arg1.unit.getY())))){
unitMenu(_arg1.unit);
} else {
ActionManager.getInstance().add(new MoveUnitAction(_arg1.unit.getX(), _arg1.unit.getY(), currentPath));
if (_arg1.attack){
ActionManager.getInstance().add(new AttackUnitAction(currentPath[(currentPath.length - 2)], currentPath[(currentPath.length - 1)], _arg1.x, _arg1.y));
};
ActionManager.getInstance().add(new NoAttackAction(currentPath[(currentPath.length - 2)], currentPath[(currentPath.length - 1)]));
clearUIButtons();
};
clearPath();
}
protected function endTurn():void{
clearPath();
clearButtons();
clearUIButtons();
var _local1:TileSheetButton = GameManager.getInstance().getEndTurnButton();
_local1.removeEventListener(MouseEvent.CLICK, endTurnHandler);
_local1.disable();
var _local2:TileSheetButton = GameManager.getInstance().getNextUnitButton();
_local2.removeEventListener(MouseEvent.CLICK, nextUnitHandler);
BattalionMain.getStage().removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
_local2.disable();
GameManager.getInstance().getParent().mainMenuButton.disable();
control = false;
camerax = GameManager.getInstance().getCamera().getX();
cameray = GameManager.getInstance().getCamera().getY();
GameManager.getInstance().getCamera().setEnabled(false);
ActionManager.getInstance().add(new EndTurnAction());
}
protected function receiveControl():void{
clearPath();
clearButtons();
clearUIButtons();
GameManager.getInstance().getCamera().setEnabled(true);
var _local1:TileSheetButton = GameManager.getInstance().getEndTurnButton();
_local1.addEventListener(MouseEvent.CLICK, endTurnHandler);
_local1.enable();
var _local2:TileSheetButton = GameManager.getInstance().getNextUnitButton();
_local2.addEventListener(MouseEvent.CLICK, nextUnitHandler);
BattalionMain.getStage().addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
_local2.enable();
GameManager.getInstance().getParent().mainMenuButton.enable();
selectUnits();
selectBuildings();
}
override protected function startTurn(_arg1:int):void{
control = false;
cloakVisibility = 0;
var _local2:int;
while (_local2 < units.length) {
if (units[_local2].isCloaked()){
units[_local2].setCloaked(false, true);
};
_local2++;
};
}
}
}//package com.gamedozer.battalion.game.controllers
import com.gamedozer.battalion.data.*;
class NodeWrapper {
public var node:Node;
public var type:int;
public var resourceDamage:Number;// = 0
public var sort:Number;
public static const MOVE:int = 0;
public static const RANGE_MOVE:int = 2;
public static const ATTACK:int = 3;
public static const RANGE:int = 1;
private function NodeWrapper(_arg1:Node, _arg2:int, _arg3:Number=0){
node = _arg1;
type = _arg2;
sort = _arg3;
}
}
class MovePosition {
public var unit:Unit;
public var attack:Boolean;
public var x:int;
public var y:int;
private function MovePosition(_arg1:int=-1, _arg2:int=-1, _arg3:Unit=null, _arg4:Boolean=false){
x = _arg1;
y = _arg2;
unit = _arg3;
attack = _arg4;
}
}
class MovePositionClick extends MovePosition {
public var other:Unit;
private function MovePositionClick(_arg1:int=-1, _arg2:int=-1, _arg3:Unit=null, _arg4:Unit=null){
super(_arg1, _arg2, _arg3, false);
other = _arg4;
}
}
class BuildPosition {
public var unit:UnitData;
public var x:int;
public var y:int;
private function BuildPosition(_arg1:int=-1, _arg2:int=-1, _arg3:UnitData=null){
x = _arg1;
y = _arg2;
unit = _arg3;
}
}
Section 83
//ChatResponse (com.gamedozer.battalion.game.responses.ChatResponse)
package com.gamedozer.battalion.game.responses {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.ui.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
public class ChatResponse extends Response {
protected var color:String;
protected var message:String;
protected var chatWindow:ChatWindow;
protected var sender:String;
protected var avatar:String;
protected static var lastWindow:ChatWindow;
public function ChatResponse(_arg1:String, _arg2:String, _arg3:String, _arg4:String){
sender = _arg1;
message = _arg2;
avatar = _arg3;
color = _arg4;
}
public function clickHandler(_arg1:Event):void{
if (chatWindow.isDisplayed()){
remove();
} else {
chatWindow.display();
};
}
public function remove():void{
chatWindow.removeEventListener(MouseEvent.CLICK, clickHandler);
if ((((ResponseManager.getInstance().peek(this) is ChatResponse)) || ((ResponseManager.getInstance().peek(this) is HighlightResponse)))){
lastWindow = chatWindow;
chatWindow = null;
super.update();
} else {
TweenManager.getInstance().add(new Tween(chatWindow, Sine.easeIn, ["y"], [chatWindow.y], [(chatWindow.y + ChatWindow.PANEL_HEIGHT)], 500));
TweenManager.getInstance().add(new TweenFunction(finish, chatWindow), TweenManager.SEQUENTIAL);
};
}
override public function update():void{
}
public function finish():void{
GameManager.getInstance().getSprite().removeChild(chatWindow);
chatWindow = null;
super.update();
}
public function buttonClickHandler(_arg1:Event):void{
remove();
}
override public function fire():void{
super.fire();
var _local1:Boolean = BattalionMain.getStorage().getBoolean("dialog", true);
if (!_local1){
chatWindow = null;
super.update();
return;
};
if (lastWindow != null){
chatWindow = lastWindow;
lastWindow = null;
chatWindow.setDisplay(BBCode.parseBBCode(sender), BBCode.parseBBCode(message), BBCode.parseAvatarCode(avatar), parseInt(BBCode.parseColorCode(color), 16));
(chatWindow.y - ChatWindow.PANEL_HEIGHT);
} else {
chatWindow = new ChatWindow(BBCode.parseBBCode(sender), BBCode.parseBBCode(message), BBCode.parseAvatarCode(avatar), parseInt(BBCode.parseColorCode(color), 16));
chatWindow.y = GameManager.GAME_HEIGHT;
TweenManager.getInstance().add(new Tween(chatWindow, Sine.easeOut, ["y"], [chatWindow.y], [(chatWindow.y - ChatWindow.PANEL_HEIGHT)], 500));
};
GameManager.getInstance().getSprite().addChild(chatWindow);
chatWindow.addEventListener(MouseEvent.CLICK, clickHandler);
}
override public function toXML():XML{
return (new XML((((((((("<response type=\"chat\"><sender value=\"" + sender) + "\"/><message value=\"") + message) + "\"/><avatar value=\"") + avatar) + "\"/><color value=\"") + color) + "\"/></response>")));
}
override public function globalQueue():Boolean{
return (true);
}
public static function getFromXML(_arg1:XML):Response{
return (new ChatResponse(_arg1.sender.@value, _arg1.message.@value, _arg1.avatar.@value, _arg1.color.@value));
}
}
}//package com.gamedozer.battalion.game.responses
Section 84
//CreateTransportedUnitResponse (com.gamedozer.battalion.game.responses.CreateTransportedUnitResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
public class CreateTransportedUnitResponse extends Response {
protected var player:int;
protected var transportType:String;
protected var transporterType:String;
protected var x:int;
protected var y:int;
public function CreateTransportedUnitResponse(_arg1:int, _arg2:int, _arg3:String, _arg4:String, _arg5:int){
x = _arg1;
y = _arg2;
transportType = _arg3;
transporterType = _arg4;
player = _arg5;
}
override public function fire():void{
var _local1:GameManager = GameManager.getInstance();
var _local2:UnitData = UnitManager.getInstance().get(transportType);
var _local3:UnitData = UnitManager.getInstance().get(transporterType);
if ((((_local2 == null)) || ((_local3 == null)))){
trace("CreateTransportedUnitResponse::Invalid transportee or transporter name");
super.fire();
return;
};
var _local4:Unit = _local1.unitAt(x, y);
if (_local4 != null){
trace(((((("CreateTransportedUnitResponse::Can't create a transport there because a unit [" + _local4) + "] at ") + x) + ",") + y));
super.fire();
return;
};
var _local5:Controller = _local1.getController((player - 1));
var _local6:Tile = _local1.tileAt(x, y);
var _local7:GameUnit = new GameUnit(TileSheetManager.getInstance().getColorised(_local2.getSprite(), _local5.getTeam().getColor()));
var _local8:Unit = new Unit(_local7, _local2, x, y, _local5);
_local8.setDeployed(true);
_local1.getGameSpriteScroller().add(_local7, GameSpriteScroller.UNITS);
_local1.addUnit(_local5, _local8);
_local6.setUnit(_local8);
_local8.getGameUnit().getSprite().alpha = 0;
var _local9:TileSheet = TileSheetManager.getInstance().getColorised(_local3.getSprite(), _local5.getTeam().getColor());
_local8.upgrade(_local9, _local3);
var _local10:TileSheet = (_local8.getGameUnit().getSprite() as TileSheet);
if (_local8.getX() > (_local1.getMap().getWidth() / 2)){
_local10.playAnimation("left_idle");
} else {
_local10.playAnimation("right_idle");
};
super.fire();
}
override public function toXML():XML{
return (new XML((((((((((("<response type=\"createTransportedUnit\"><x value=\"" + x) + "\"/><y value=\"") + y) + "\"/><transportType value=\"") + transportType) + "\"/><transporterType value=\"") + transporterType) + "\"/><player value=\"") + player) + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
return (new CreateTransportedUnitResponse(int(_arg1.x.@value), int(_arg1.y.@value), _arg1.transportType.@value, _arg1.transporterType.@value, _arg1.player.@value));
}
}
}//package com.gamedozer.battalion.game.responses
Section 85
//CreateUnitResponse (com.gamedozer.battalion.game.responses.CreateUnitResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
public class CreateUnitResponse extends Response {
protected var player:int;
protected var parallel:Boolean;
protected var fadeIn:Boolean;
protected var x:int;
protected var y:int;
protected var type:String;
public function CreateUnitResponse(_arg1:int, _arg2:int, _arg3:String, _arg4:int, _arg5:Boolean, _arg6:Boolean){
x = _arg1;
y = _arg2;
type = _arg3;
player = _arg4;
fadeIn = _arg5;
parallel = _arg6;
}
override public function update():void{
}
private function execute():void{
super.update();
}
override public function fire():void{
var _local9:int;
var _local1:GameManager = GameManager.getInstance();
var _local2:UnitData = UnitManager.getInstance().get(type);
super.fire();
if (_local2 == null){
trace("CreateUnitResponse::Invalid unit type");
execute();
return;
};
var _local3:Unit = _local1.unitAt(x, y);
if (_local3 != null){
trace("CreateUnitResponse::Can't create a transport there because a unit is in that location");
execute();
return;
};
var _local4:Controller = _local1.getController((player - 1));
var _local5:Tile = _local1.tileAt(x, y);
var _local6:GameUnit = new GameUnit(TileSheetManager.getInstance().getColorised(_local2.getSprite(), _local4.getTeam().getColor()));
var _local7:Unit = new Unit(_local6, _local2, x, y, _local4);
_local7.setDeployed(true);
_local1.addUnit(_local4, _local7);
_local5.setUnit(_local7);
_local1.getGameSpriteScroller().add(_local6, GameSpriteScroller.UNITS);
var _local8:TileSheet = (_local7.getGameUnit().getSprite() as TileSheet);
if (_local7.getX() > (_local1.getMap().getWidth() / 2)){
_local8.playAnimation("left_idle");
} else {
_local8.playAnimation("right_idle");
};
if (fadeIn){
_local7.getGameUnit().alpha = 0;
_local9 = TweenManager.SEQUENTIAL_ALL;
if (parallel){
_local9 = TweenManager.PARALLEL;
} else {
_local9 = TweenManager.SEQUENTIAL_ALL;
};
TweenManager.getInstance().add(new Tween(_local7.getGameUnit(), Quad.easeIn, ["alpha"], [0], [1], 1000), _local9);
TweenManager.getInstance().add(new TweenFunction(execute), _local9);
} else {
execute();
};
}
override public function toXML():XML{
return (new XML((((((((((((("<response type=\"createUnit\"><x value=\"" + x) + "\"/><y value=\"") + y) + "\"/><type value=\"") + type) + "\"/><player value=\"") + player) + "\"/><fadeIn value=\"") + fadeIn) + "\"/><parallel value=\"") + parallel) + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
var _local2 = (String(_arg1.fadeIn.@value).toLowerCase() == "true");
var _local3 = (String(_arg1.parallel.@value).toLowerCase() == "true");
return (new CreateUnitResponse(int(_arg1.x.@value), int(_arg1.y.@value), _arg1.type.@value, _arg1.player.@value, _local2, _local3));
}
}
}//package com.gamedozer.battalion.game.responses
Section 86
//DamageUnitResponse (com.gamedozer.battalion.game.responses.DamageUnitResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
import com.gamedozer.battalion.game.actions.*;
public class DamageUnitResponse extends Response {
protected var x:int;
protected var y:int;
protected var amount:Number;
public function DamageUnitResponse(_arg1:int, _arg2:int, _arg3:Number){
x = _arg1;
y = _arg2;
amount = _arg3;
}
override public function fire():void{
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(x, y);
if (_local2 != null){
if (_local2.getHealth() <= amount){
TweenManager.getInstance().add(new Tween(_local2.getGameUnit(), Quad.easeIn, ["alpha"], [1], [0], 1000), TweenManager.SEQUENTIAL);
TriggerManager.getInstance().add(new KillUnitTrigger(x, y, _local2));
_local2.getController().getTeam().addStatistic(Team.UNITS_LOST, 1);
_local1.removeUnit(_local2);
} else {
_local2.takeDamage(amount);
};
} else {
trace("DamageUnitResponse::No unit to destroy");
};
super.fire();
}
override public function toXML():XML{
return (new XML((((((("<response type=\"damageUnit\"><x value=\"" + x) + "\"/><y value=\"") + y) + "\"/><amount value=\"") + amount) + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
return (new DamageUnitResponse(int(_arg1.x.@value), int(_arg1.y.@value), Number(_arg1.amount.@value)));
}
}
}//package com.gamedozer.battalion.game.responses
Section 87
//DecrementCounterVariableResponse (com.gamedozer.battalion.game.responses.DecrementCounterVariableResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.conditions.*;
public class DecrementCounterVariableResponse extends Response {
var counter:String;
public function DecrementCounterVariableResponse(_arg1:String){
counter = _arg1;
}
override public function fire():void{
CounterVariableCondition.setCounter(counter, (CounterVariableCondition.getCounter(counter) - 1));
super.fire();
}
override public function toXML():XML{
return (new XML((("<response type=\"decrementCounterVariable\"><counter value=\"" + counter) + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
return (new DecrementCounterVariableResponse(_arg1.counter.@value));
}
}
}//package com.gamedozer.battalion.game.responses
Section 88
//DestroyUnitResponse (com.gamedozer.battalion.game.responses.DestroyUnitResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
import com.gamedozer.battalion.game.actions.*;
public class DestroyUnitResponse extends Response {
protected var x:int;
protected var y:int;
public function DestroyUnitResponse(_arg1:int, _arg2:int){
x = _arg1;
y = _arg2;
}
override public function fire():void{
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(x, y);
if (_local2 != null){
GameManager.getInstance().addExplosion("Explosion", _local2.getGameUnit());
TweenManager.getInstance().add(new Tween(_local2.getGameUnit(), Quad.easeIn, ["alpha"], [1], [0], 1000), TweenManager.SEQUENTIAL);
TriggerManager.getInstance().add(new KillUnitTrigger(x, y, _local2));
_local2.getController().getTeam().addStatistic(Team.UNITS_LOST, 1);
_local1.removeUnit(_local2);
} else {
trace("DestroyUnitResponse::No unit to destroy");
};
super.fire();
}
override public function toXML():XML{
return (new XML((((("<response type=\"destroyUnit\"><x value=\"" + x) + "\"/><y value=\"") + y) + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
return (new DestroyUnitResponse(int(_arg1.x.@value), int(_arg1.y.@value)));
}
}
}//package com.gamedozer.battalion.game.responses
Section 89
//DisableControllersResponse (com.gamedozer.battalion.game.responses.DisableControllersResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.game.*;
public class DisableControllersResponse extends Response {
protected var disable:Boolean;
public function DisableControllersResponse(_arg1:Boolean=true){
disable = _arg1;
}
override public function toXML():XML{
return (new XML((("<response type=\"disableControllers\"><disable value=\"" + ((disable == true)) ? "true" : "false") + "\"/></response>")));
}
override public function fire():void{
var _local1:Array = GameManager.getInstance().getControllers();
var _local2:int;
while (_local2 < _local1.length) {
if (_local1[_local2] != null){
_local1[_local2].setEnabled(!(disable));
};
_local2++;
};
GameManager.getInstance().getCamera().setEnabled(!(disable));
TriggerManager.getInstance().add(new Trigger(Trigger.CONTROL));
super.fire();
}
public static function getFromXML(_arg1:XML):Response{
var _local2:Boolean;
var _local3:String = _arg1.disable.@value;
if (_local3.toLowerCase().charAt(0) == "f"){
_local2 = false;
};
return (new DisableControllersResponse(_local2));
}
}
}//package com.gamedozer.battalion.game.responses
Section 90
//DisableUnitResponse (com.gamedozer.battalion.game.responses.DisableUnitResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
import com.gamedozer.battalion.game.actions.*;
public class DisableUnitResponse extends Response {
protected var player:int;
protected var unit:String;
protected var disable:Boolean;
public function DisableUnitResponse(_arg1:Boolean, _arg2:int, _arg3:String){
disable = _arg1;
player = _arg2;
unit = _arg3;
}
override public function fire():void{
var _local1:Array;
var _local2:int;
var _local3:Controller;
if (player == 0){
_local1 = GameManager.getInstance().getControllers();
_local2 = 0;
while (_local2 < _local1.length) {
if (_local1[_local2] != null){
if (!disable){
_local1[_local2].enableUnit(unit);
} else {
_local1[_local2].disableUnit(unit);
};
};
_local2++;
};
} else {
if (player > 0){
player--;
_local3 = GameManager.getInstance().getController(player);
if (_local3 != null){
if (!disable){
_local3.enableUnit(unit);
} else {
_local3.disableUnit(unit);
};
};
};
};
super.fire();
}
override public function toXML():XML{
return (new XML((((((("<response type=\"disableUnit\"><disable value=\"" + disable) + "\"/><player value=\"") + player) + "\"/><unit value=\"") + unit) + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
return (new DisableUnitResponse((_arg1.disable.@value.toLowerCase().charAt(0) == "t"), parseInt(_arg1.player.@value), _arg1.unit.@value));
}
}
}//package com.gamedozer.battalion.game.responses
Section 91
//HighlightResponse (com.gamedozer.battalion.game.responses.HighlightResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
public class HighlightResponse extends Response {
protected var x:int;
protected var y:int;
protected var show:Boolean;
protected static var highlights:Dictionary;
public function HighlightResponse(_arg1:int, _arg2:int, _arg3:Boolean){
x = _arg1;
y = _arg2;
show = _arg3;
highlights = new Dictionary();
}
private function tweenUp():void{
var _local1:GameSprite = highlights[((x + "_") + y)];
if (_local1 == null){
return;
};
TweenManager.getInstance().add(new Tween(_local1, Linear.easeIn, ["alpha"], [1], [0.2], 750), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(tweenDown, _local1), TweenManager.SEQUENTIAL);
}
private function tweenDown():void{
var _local1:GameSprite = highlights[((x + "_") + y)];
if (_local1 == null){
return;
};
TweenManager.getInstance().add(new Tween(_local1, Linear.easeIn, ["alpha"], [0.2], [1], 750), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenFunction(tweenUp, _local1), TweenManager.SEQUENTIAL);
}
public function get willShow():Boolean{
return (show);
}
public function get willHide():Boolean{
return (!(show));
}
override public function fire():void{
var _local1:GameSprite;
_local1 = highlights[((x + "_") + y)];
if (show){
if (_local1 == null){
_local1 = new BitmapSprite(BitmapLibrary.loadBitmap("highlight"));
_local1.x = (((x + 0.5) * TileManager.getInstance().getWidth()) - (_local1.width / 2));
_local1.y = (((y + 0.5) * TileManager.getInstance().getHeight()) - (_local1.height / 2));
GameManager.getInstance().getGameSpriteScroller().add(_local1, GameSpriteScroller.TOP);
GameManager.getInstance().getCamera().setTarget(_local1, 100);
highlights[((x + "_") + y)] = _local1;
_local1.alpha = 0.2;
tweenDown();
};
} else {
if (_local1 != null){
TweenManager.getInstance().removeTweens(_local1);
GameManager.getInstance().getGameSpriteScroller().remove(_local1);
};
};
super.fire();
}
override public function toXML():XML{
return (new XML((((((("<response type=\"highlight\"><x value=\"" + x) + "\"/><y value=\"") + y) + "\"/><show value=\"") + ((show == true)) ? "true" : "false") + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
var _local2:Boolean;
var _local3:String = _arg1.show.@value;
if (_local3.toLowerCase().charAt(0) == "t"){
_local2 = true;
};
return (new HighlightResponse(int(_arg1.x.@value), int(_arg1.y.@value), _local2));
}
}
}//package com.gamedozer.battalion.game.responses
Section 92
//IncrementCounterVariableResponse (com.gamedozer.battalion.game.responses.IncrementCounterVariableResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.conditions.*;
public class IncrementCounterVariableResponse extends Response {
var counter:String;
public function IncrementCounterVariableResponse(_arg1:String){
counter = _arg1;
}
override public function fire():void{
CounterVariableCondition.setCounter(counter, (CounterVariableCondition.getCounter(counter) + 1));
super.fire();
}
override public function toXML():XML{
return (new XML((("<response type=\"incrementCounterVariable\"><counter value=\"" + counter) + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
return (new IncrementCounterVariableResponse(_arg1.counter.@value));
}
}
}//package com.gamedozer.battalion.game.responses
Section 93
//NameUnitResponse (com.gamedozer.battalion.game.responses.NameUnitResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
public class NameUnitResponse extends Response {
protected var x:int;
protected var y:int;
protected var name:String;
protected static var units:Dictionary;
public function NameUnitResponse(_arg1:int, _arg2:int, _arg3:String){
x = _arg1;
y = _arg2;
name = _arg3;
units = new Dictionary(true);
}
override public function toXML():XML{
return (new XML((((((("<response type=\"nameUnit\"><x value=\"" + x) + "\"/><y value=\"") + y) + "\"/><name value=\"") + name) + "\"/></response>")));
}
override public function fire():void{
var _local2:Unit;
var _local1:GameManager = GameManager.getInstance();
if (UnitManager.getInstance().get(name) == null){
_local2 = _local1.unitAt(x, y);
if (_local2 != null){
units[name] = _local2;
};
} else {
trace("NamedUnitResponse::Cannot name a unit to a stock unit name");
};
super.fire();
}
public static function getFromXML(_arg1:XML):Response{
return (new NameUnitResponse(int(_arg1.x.@value), int(_arg1.y.@value), _arg1.name));
}
public static function getNamedUnit(_arg1:String):Unit{
return (units[_arg1]);
}
}
}//package com.gamedozer.battalion.game.responses
Section 94
//RemoveUnitResponse (com.gamedozer.battalion.game.responses.RemoveUnitResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
import com.gamedozer.battalion.game.actions.*;
public class RemoveUnitResponse extends Response {
protected var fadeOut:Boolean;
protected var x:int;
protected var y:int;
public function RemoveUnitResponse(_arg1:int, _arg2:int, _arg3:Boolean){
x = _arg1;
y = _arg2;
fadeOut = _arg3;
}
private function execute():void{
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(x, y);
_local1.removeUnit(_local2);
super.update();
}
override public function fire():void{
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(x, y);
if (_local2 != null){
if (fadeOut){
TweenManager.getInstance().add(new Tween(_local2.getGameUnit(), Quad.easeIn, ["alpha"], [1], [0], 1000), TweenManager.SEQUENTIAL_ALL);
TweenManager.getInstance().add(new TweenFunction(execute, this), TweenManager.SEQUENTIAL_ALL);
} else {
execute();
};
} else {
trace("RemoveUnitResponse::No unit to remove");
};
super.fire();
}
override public function update():void{
}
override public function toXML():XML{
return (new XML((((((("<response type=\"removeUnit\"><x value=\"" + x) + "\"/><y value=\"") + y) + "\"/><fadeOut value=\"") + fadeOut) + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
var _local2:Boolean = Boolean(_arg1.fadeOut.@value);
return (new RemoveUnitResponse(int(_arg1.x.@value), int(_arg1.y.@value), _local2));
}
}
}//package com.gamedozer.battalion.game.responses
Section 95
//ResourcesResponse (com.gamedozer.battalion.game.responses.ResourcesResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
import com.gamedozer.battalion.game.actions.*;
public class ResourcesResponse extends Response {
protected var player:int;
protected var amount:int;
public function ResourcesResponse(_arg1:int, _arg2:int){
player = _arg1;
amount = _arg2;
}
override public function fire():void{
var _local1:Array;
var _local2:int;
var _local3:Controller;
if (player == 0){
_local1 = GameManager.getInstance().getControllers();
_local2 = 0;
while (_local2 < _local1.length) {
if (_local1[_local2] != null){
_local1[_local2].addResources(amount);
};
_local2++;
};
} else {
if (player > 0){
player--;
_local3 = GameManager.getInstance().getController(player);
if (_local3 != null){
_local3.addResources(amount);
};
};
};
super.fire();
}
override public function toXML():XML{
return (new XML((((("<response type=\"resources\"><player value=\"" + player) + "\"/><amount value=\"") + amount) + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
return (new ResourcesResponse(int(_arg1.player.@value), parseInt(_arg1.amount.@value)));
}
}
}//package com.gamedozer.battalion.game.responses
Section 96
//ScrollResponse (com.gamedozer.battalion.game.responses.ScrollResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
import com.gamedozer.battalion.game.actions.*;
public class ScrollResponse extends Response {
protected var x:int;
protected var y:int;
public function ScrollResponse(_arg1:int, _arg2:int){
x = _arg1;
y = _arg2;
}
override public function fire():void{
var _local1:GameManager = GameManager.getInstance();
TweenManager.getInstance().add(new TweenFunction(doScroll, this), TweenManager.SEQUENTIAL);
}
override public function toXML():XML{
return (new XML((((("<response type=\"scroll\"><x value=\"" + x) + "\"/><y value=\"") + y) + "\"/></response>")));
}
private function doScroll():void{
GameManager.getInstance().getCamera().setLocation(((-1 * (x - 6)) * BattalionMain.TILE_WIDTH), ((-1 * (y - 5)) * BattalionMain.TILE_HEIGHT));
super.fire();
}
public static function getFromXML(_arg1:XML):Response{
return (new ScrollResponse(int(_arg1.x.@value), int(_arg1.y.@value)));
}
}
}//package com.gamedozer.battalion.game.responses
Section 97
//SendActionResponse (com.gamedozer.battalion.game.responses.SendActionResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.game.*;
public class SendActionResponse extends Response {
var action:Action;
public function SendActionResponse(_arg1:Action){
action = _arg1;
}
override public function toXML():XML{
return (new XML((("<response type=\"sendAction\">" + action.toXML()) + "</response>")));
}
override public function fire():void{
ActionManager.getInstance().add(action);
super.fire();
}
public static function getFromXML(_arg1:XML):Response{
return (new SendActionResponse(ActionFactory.get(_arg1..action[0])));
}
}
}//package com.gamedozer.battalion.game.responses
Section 98
//SendTriggerResponse (com.gamedozer.battalion.game.responses.SendTriggerResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.game.*;
public class SendTriggerResponse extends Response {
var trigger:Trigger;
public function SendTriggerResponse(_arg1:Trigger){
trigger = _arg1;
}
override public function toXML():XML{
return (new XML((("<response type=\"sendTrigger\">" + trigger.toXML()) + "</response>")));
}
override public function fire():void{
TriggerManager.getInstance().add(trigger);
super.fire();
}
public static function getFromXML(_arg1:XML):Response{
return (new SendTriggerResponse(TriggerFactory.get(_arg1.trigger)));
}
}
}//package com.gamedozer.battalion.game.responses
Section 99
//SetBooleanVariableResponse (com.gamedozer.battalion.game.responses.SetBooleanVariableResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.conditions.*;
public class SetBooleanVariableResponse extends Response {
var value:Boolean;
var boolean:String;
public function SetBooleanVariableResponse(_arg1:String, _arg2:Boolean){
boolean = _arg1;
value = _arg2;
}
override public function fire():void{
BooleanVariableCondition.setBoolean(boolean, value);
super.fire();
}
override public function toXML():XML{
return (new XML((((("<response type=\"setBooleanVariable\"><boolean value=\"" + boolean) + "\"/><value value=\"") + ((value == true)) ? "true" : "false") + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
var _local2:Boolean;
var _local3:String = _arg1.value.@value;
if (_local3.toLowerCase().charAt(0) == "t"){
_local2 = true;
};
return (new SetBooleanVariableResponse(_arg1.boolean.@value, _local2));
}
}
}//package com.gamedozer.battalion.game.responses
Section 100
//StructureResourcesResponse (com.gamedozer.battalion.game.responses.StructureResourcesResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
import com.gamedozer.battalion.game.actions.*;
public class StructureResourcesResponse extends Response {
protected var x:int;
protected var y:int;
protected var amount:int;
public function StructureResourcesResponse(_arg1:int, _arg2:int, _arg3:int){
x = _arg1;
y = _arg2;
amount = _arg3;
}
override public function fire():void{
var _local1:GameManager = GameManager.getInstance();
var _local2:Tile = _local1.tileAt(x, y);
if (_local2 != null){
_local2.setResources((_local2.getResources() + amount));
} else {
trace("StructureResourcesResponse::No tile to add resources");
};
super.fire();
}
override public function toXML():XML{
return (new XML((((((("<response type=\"structureResources\"><x value=\"" + x) + "\"/><y value=\"") + y) + "\"/><amount value=\"") + amount) + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
return (new StructureResourcesResponse(int(_arg1.x.@value), int(_arg1.y.@value), parseInt(_arg1.amount.@value)));
}
}
}//package com.gamedozer.battalion.game.responses
Section 101
//TraceResponse (com.gamedozer.battalion.game.responses.TraceResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.game.*;
public class TraceResponse extends Response {
var message:String;
public function TraceResponse(_arg1:String){
message = _arg1;
}
override public function toXML():XML{
return (new XML((("<response type=\"trace\"><message value=\"" + message) + "\"/></response>")));
}
override public function fire():void{
trace(message);
super.fire();
}
public static function getFromXML(_arg1:XML):Response{
return (new TraceResponse(_arg1.message.@value));
}
}
}//package com.gamedozer.battalion.game.responses
Section 102
//UnitDisableResponse (com.gamedozer.battalion.game.responses.UnitDisableResponse)
package com.gamedozer.battalion.game.responses {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
import com.gamedozer.battalion.game.actions.*;
public class UnitDisableResponse extends Response {
protected var x:int;
protected var y:int;
protected var disable:Boolean;
public function UnitDisableResponse(_arg1:int, _arg2:int, _arg3:Boolean){
x = _arg1;
y = _arg2;
disable = _arg3;
}
override public function fire():void{
var _local1:GameManager = GameManager.getInstance();
var _local2:Unit = _local1.unitAt(x, y);
if (_local2 != null){
if (disable){
_local2.disable();
} else {
_local2.enable();
};
} else {
trace("UnitDisableResponse::No unit to destroy");
};
super.fire();
}
override public function toXML():XML{
return (new XML((((((("<response type=\"unitDisable\"><x value=\"" + x) + "\"/><y value=\"") + y) + "\"/><disable value=\"") + disable) + "\"/></response>")));
}
public static function getFromXML(_arg1:XML):Response{
return (new UnitDisableResponse(int(_arg1.x.@value), int(_arg1.y.@value), Boolean(_arg1.disable.@value)));
}
}
}//package com.gamedozer.battalion.game.responses
Section 103
//AttackUnitTrigger (com.gamedozer.battalion.game.triggers.AttackUnitTrigger)
package com.gamedozer.battalion.game.triggers {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
public class AttackUnitTrigger extends Trigger {
protected var unit:Unit;
protected var targetX:int;
protected var targetY:int;
protected var target:Unit;
protected var unitX:int;
protected var unitY:int;
public static const TRIGGER:String = "attackUnit";
public function AttackUnitTrigger(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:Unit, _arg6:Unit){
super(TRIGGER);
unit = _arg5;
targetX = _arg3;
targetY = _arg4;
target = _arg6;
}
public function getUnit():Unit{
return (unit);
}
public function getTargetY():int{
return (targetY);
}
public function getTarget():Unit{
return (target);
}
public function getTargetX():int{
return (targetX);
}
public function getUnitX():int{
return (unitX);
}
public function getUnitY():int{
return (unitY);
}
}
}//package com.gamedozer.battalion.game.triggers
Section 104
//BuildUnitTrigger (com.gamedozer.battalion.game.triggers.BuildUnitTrigger)
package com.gamedozer.battalion.game.triggers {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
public class BuildUnitTrigger extends Trigger {
protected var unit:Unit;
public static const TRIGGER:String = "buildUnit";
public function BuildUnitTrigger(_arg1:Unit){
super(TRIGGER);
unit = _arg1;
}
public function getUnit():Unit{
return (unit);
}
}
}//package com.gamedozer.battalion.game.triggers
Section 105
//CaptureTerrainTrigger (com.gamedozer.battalion.game.triggers.CaptureTerrainTrigger)
package com.gamedozer.battalion.game.triggers {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
public class CaptureTerrainTrigger extends Trigger {
protected var player:int;
protected var oldPlayer:int;
protected var tile:Tile;
protected var complete:Boolean;
public static const TRIGGER:String = "captureTerrain";
public function CaptureTerrainTrigger(_arg1:Tile, _arg2:int, _arg3:int, _arg4:Boolean){
super(TRIGGER);
tile = _arg1;
player = _arg3;
oldPlayer = _arg2;
complete = _arg4;
}
public function getTile():Tile{
return (tile);
}
public function getOldPlayer():int{
return (oldPlayer);
}
public function getComplete():Boolean{
return (complete);
}
public function getPlayer():int{
return (player);
}
}
}//package com.gamedozer.battalion.game.triggers
Section 106
//KillUnitTrigger (com.gamedozer.battalion.game.triggers.KillUnitTrigger)
package com.gamedozer.battalion.game.triggers {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
public class KillUnitTrigger extends Trigger {
protected var unit:Unit;
protected var unitY:int;
protected var unitX:int;
public static const TRIGGER:String = "killUnit";
public function KillUnitTrigger(_arg1:int, _arg2:int, _arg3:Unit){
super(TRIGGER);
unitX = _arg1;
unitY = _arg2;
unit = _arg3;
}
public function getUnit():Unit{
return (unit);
}
public function getUnitY():int{
return (unitY);
}
public function getUnitX():int{
return (unitX);
}
}
}//package com.gamedozer.battalion.game.triggers
Section 107
//MoveUnitTrigger (com.gamedozer.battalion.game.triggers.MoveUnitTrigger)
package com.gamedozer.battalion.game.triggers {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
public class MoveUnitTrigger extends Trigger {
protected var unit:Unit;
protected var path:Array;
public static const TRIGGER:String = "moveUnit";
public function MoveUnitTrigger(_arg1:Unit, _arg2:Array){
super(TRIGGER);
unit = _arg1;
path = _arg2;
}
public function getUnit():Unit{
return (unit);
}
public function getPath():Array{
return (path);
}
}
}//package com.gamedozer.battalion.game.triggers
Section 108
//PlayerTrigger (com.gamedozer.battalion.game.triggers.PlayerTrigger)
package com.gamedozer.battalion.game.triggers {
import com.gamedozer.battalion.game.*;
public class PlayerTrigger extends Trigger {
protected var player:int;
public static const NO_UNITS:String = "noUnits";
public static const END_GAME:String = "endGame";
public static const START_TURN:String = "startTurn";
public static const SURRENDER:String = "surrender";
public function PlayerTrigger(_arg1:String, _arg2:int){
super(_arg1);
player = _arg2;
}
public function setPlayer(_arg1:int):void{
player = _arg1;
}
public function getPlayer():int{
return (player);
}
}
}//package com.gamedozer.battalion.game.triggers
Section 109
//RepairUnitTrigger (com.gamedozer.battalion.game.triggers.RepairUnitTrigger)
package com.gamedozer.battalion.game.triggers {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
public class RepairUnitTrigger extends Trigger {
protected var unit:Unit;
public static const TRIGGER:String = "repairUnit";
public function RepairUnitTrigger(_arg1:Unit){
super(TRIGGER);
unit = _arg1;
}
public function getUnit():Unit{
return (unit);
}
}
}//package com.gamedozer.battalion.game.triggers
Section 110
//ResourcesAcquiredTrigger (com.gamedozer.battalion.game.triggers.ResourcesAcquiredTrigger)
package com.gamedozer.battalion.game.triggers {
import com.gamedozer.battalion.game.*;
public class ResourcesAcquiredTrigger extends Trigger {
protected var player:int;
protected var resources:int;
public static const TRIGGER:String = "resourcesAcquired";
public function ResourcesAcquiredTrigger(_arg1:int, _arg2:int){
super(TRIGGER);
resources = _arg2;
player = _arg1;
}
public function getPlayer():int{
return (player);
}
public function getResources():int{
return (resources);
}
}
}//package com.gamedozer.battalion.game.triggers
Section 111
//TimePassedTrigger (com.gamedozer.battalion.game.triggers.TimePassedTrigger)
package com.gamedozer.battalion.game.triggers {
import com.gamedozer.battalion.game.*;
public class TimePassedTrigger extends Trigger {
protected var time:uint;
public static const TRIGGER:String = "timePassed";
public function TimePassedTrigger(_arg1:uint){
super(TRIGGER);
time = _arg1;
}
public function getTime():uint{
return (time);
}
}
}//package com.gamedozer.battalion.game.triggers
Section 112
//UpgradeUnitTrigger (com.gamedozer.battalion.game.triggers.UpgradeUnitTrigger)
package com.gamedozer.battalion.game.triggers {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.game.*;
public class UpgradeUnitTrigger extends Trigger {
protected var unit:Unit;
protected var upgrade:Boolean;
public static const TRIGGER:String = "upgradeUnit";
public function UpgradeUnitTrigger(_arg1:Unit, _arg2:Boolean){
super(TRIGGER);
unit = _arg1;
upgrade = _arg2;
}
public function getUnit():Unit{
return (unit);
}
public function getUpgrade():Boolean{
return (upgrade);
}
}
}//package com.gamedozer.battalion.game.triggers
Section 113
//Action (com.gamedozer.battalion.game.Action)
package com.gamedozer.battalion.game {
import com.gamedozer.battalion.data.*;
public class Action {
protected var completed:Boolean;
protected var fired:Boolean;
public function Action(){
fired = false;
completed = false;
}
public function isCompleted():Boolean{
return (completed);
}
public function isFired():Boolean{
return (fired);
}
public function update():void{
completed = true;
}
public function usesUnit(_arg1:Unit):Boolean{
return (false);
}
public function toXML():XML{
return (new XML());
}
public function fire():void{
fired = true;
}
public function dispose():void{
}
}
}//package com.gamedozer.battalion.game
Section 114
//ActionFactory (com.gamedozer.battalion.game.ActionFactory)
package com.gamedozer.battalion.game {
import com.gamedozer.battalion.game.actions.*;
public class ActionFactory {
public static function get(_arg1:XML):Action{
var _local2:String = _arg1.@type;
switch (_local2){
case "surrenderAction":
return (SurrenderAction.getFromXML(_arg1));
};
return (new Action());
}
}
}//package com.gamedozer.battalion.game
Section 115
//ActionManager (com.gamedozer.battalion.game.ActionManager)
package com.gamedozer.battalion.game {
import com.gamedozer.battalion.data.*;
public class ActionManager {
protected var actions:Array;
private static var singleton:ActionManager;
public function ActionManager(){
singleton = this;
actions = new Array();
}
public function add(_arg1:Action, _arg2:Boolean=false):void{
if (_arg2){
actions.splice(1, 0, _arg1);
} else {
actions.push(_arg1);
};
}
public function update():void{
var action:Action;
if (actions.length > 0){
action = actions[0];
try {
if (!action.isFired()){
action.fire();
} else {
action.update();
};
} catch(e:Error) {
trace("ActionManager::", e);
TriggerManager.getInstance().add(new Trigger(Trigger.ERROR));
};
if (action.isCompleted()){
action.dispose();
actions.shift();
if (actions.length == 0){
TriggerManager.getInstance().add(new Trigger(Trigger.CONTROL));
};
};
};
}
public function hasActionWithUnit(_arg1:Unit):Boolean{
var _local3:Action;
var _local2:int;
while (_local2 < actions.length) {
_local3 = actions[_local2];
if (_local3.usesUnit(_arg1)){
return (true);
};
_local2++;
};
return (false);
}
public function isEmpty():Boolean{
return ((actions.length == 0));
}
public static function getInstance():ActionManager{
if (singleton == null){
throw (new Error("ActionManager::No instance exists"));
};
return (singleton);
}
}
}//package com.gamedozer.battalion.game
Section 116
//Condition (com.gamedozer.battalion.game.Condition)
package com.gamedozer.battalion.game {
public interface Condition {
function reset():void;
function isSatisfied():Boolean;
function update():void;
function toXML():XML;
function dispose():void;
}
}//package com.gamedozer.battalion.game
Section 117
//ConditionFactory (com.gamedozer.battalion.game.ConditionFactory)
package com.gamedozer.battalion.game {
import com.gamedozer.battalion.game.conditions.*;
public class ConditionFactory {
public static function get(_arg1:XML):Condition{
var _local2:String = _arg1.@type;
trace(("Type " + _local2));
switch (_local2){
case "not":
return (NotCondition.getFromXML(_arg1));
case "and":
return (LogicalAndCondition.getFromXML(_arg1));
case "or":
trace("OR!");
return (LogicalOrCondition.getFromXML(_arg1));
case "xor":
return (LogicalXorCondition.getFromXML(_arg1));
case "startGame":
return (StartGameCondition.getFromXML(_arg1));
case "startTurn":
return (StartTurnCondition.getFromXML(_arg1));
case "counterVariable":
return (CounterVariableCondition.getFromXML(_arg1));
case "booleanVariable":
return (BooleanVariableCondition.getFromXML(_arg1));
case "timePassed":
return (TimePassedCondition.getFromXML(_arg1));
case "endGame":
return (EndGameCondition.getFromXML(_arg1));
case "moveUnit":
return (MoveUnitCondition.getFromXML(_arg1));
case "killUnit":
return (KillUnitCondition.getFromXML(_arg1));
case "resourcesAcquired":
return (ResourcesAcquiredCondition.getFromXML(_arg1));
case "buildUnit":
return (BuildUnitCondition.getFromXML(_arg1));
case "captureTerrain":
return (CaptureTerrainCondition.getFromXML(_arg1));
case "noUnits":
return (NoUnitsCondition.getFromXML(_arg1));
};
return (new LogicalAndCondition());
}
}
}//package com.gamedozer.battalion.game
Section 118
//Controller (com.gamedozer.battalion.game.Controller)
package com.gamedozer.battalion.game {
import com.gamedozer.battalion.data.*;
import flash.utils.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.game.actions.*;
public class Controller {
protected var cloakVisibility:Number;
protected var resources:int;
protected var difficulty:int;
protected var enabled:Boolean;
protected var disabledUnits:Dictionary;
protected var team:Team;
protected var structures:Array;
protected var units:Array;
public static const EASY:int = 2;
public static const MEDIUM:int = 1;
public static const HARD:int = 0;
public function Controller(_arg1:Team){
team = _arg1;
units = new Array();
structures = new Array();
TriggerManager.getInstance().addListener(Trigger.ERROR, errorListener);
TriggerManager.getInstance().addListener(Trigger.START_GAME, startGameListener);
TriggerManager.getInstance().addListener(Trigger.START_ROUND, startRoundListener);
TriggerManager.getInstance().addListener(PlayerTrigger.START_TURN, startTurnListener);
TriggerManager.getInstance().addListener(PlayerTrigger.END_GAME, endGameListener);
TriggerManager.getInstance().addListener(MoveUnitTrigger.TRIGGER, moveUnitListener);
TriggerManager.getInstance().addListener(AttackUnitTrigger.TRIGGER, attackUnitListener);
TriggerManager.getInstance().addListener(KillUnitTrigger.TRIGGER, killUnitListener);
TriggerManager.getInstance().addListener(BuildUnitTrigger.TRIGGER, buildUnitListener);
TriggerManager.getInstance().addListener(CaptureTerrainTrigger.TRIGGER, captureTerrainListener);
TriggerManager.getInstance().addListener(UpgradeUnitTrigger.TRIGGER, upgradeUnitListener);
resources = 0;
cloakVisibility = 0;
enabled = true;
difficulty = _arg1.getDifficulty();
disabledUnits = new Dictionary();
}
public function getAirCost():Number{
var _local4:Number;
var _local1:Number = 1;
var _local2:Boolean;
var _local3:int;
while (_local3 < structures.length) {
_local4 = structures[_local3].getTerrain().applyModifiers("airCost", null, _local1);
if ((((_local4 < _local1)) && (!(_local2)))){
_local2 = true;
} else {
_local1 = _local4;
};
_local3++;
};
return (_local1);
}
private function repairUnitListener(_arg1:RepairUnitTrigger):void{
repairUnit(_arg1.getUnit());
}
public function getSeaCost():Number{
var _local4:Number;
var _local1:Number = 1;
var _local2:Boolean;
var _local3:int;
while (_local3 < structures.length) {
_local4 = structures[_local3].getTerrain().applyModifiers("seaCost", null, _local1);
if ((((_local4 < _local1)) && (!(_local2)))){
_local2 = true;
} else {
_local1 = _local4;
};
_local3++;
};
return (_local1);
}
protected function error():void{
}
public function isStillInitializing():Boolean{
return (false);
}
public function disableUnit(_arg1:String):void{
disabledUnits[_arg1] = true;
}
protected function startTurn(_arg1:int):void{
}
protected function captureTerrain(_arg1:Tile, _arg2:int, _arg3:int, _arg4:Boolean):void{
if (_arg4){
};
}
public function initialize():void{
}
protected function killUnit(_arg1:int, _arg2:int, _arg3:Unit):void{
}
protected function buildUnit(_arg1:Unit):void{
}
public function addResources(_arg1:int):void{
resources = (resources + _arg1);
}
private function upgradeUnitListener(_arg1:UpgradeUnitTrigger):void{
changeUpgradeStatus(_arg1.getUnit(), _arg1.getName(), _arg1.getUpgrade());
}
public function isUnitEnabled(_arg1:String):Boolean{
return (!((disabledUnits[_arg1] == true)));
}
public function dispose():void{
team = null;
units = null;
structures = null;
TriggerManager.getInstance().removeListener(Trigger.ERROR, errorListener);
TriggerManager.getInstance().removeListener(Trigger.START_GAME, startGameListener);
TriggerManager.getInstance().removeListener(Trigger.START_ROUND, startRoundListener);
TriggerManager.getInstance().removeListener(PlayerTrigger.START_TURN, startTurnListener);
TriggerManager.getInstance().removeListener(MoveUnitTrigger.TRIGGER, moveUnitListener);
TriggerManager.getInstance().removeListener(AttackUnitTrigger.TRIGGER, attackUnitListener);
TriggerManager.getInstance().removeListener(KillUnitTrigger.TRIGGER, killUnitListener);
TriggerManager.getInstance().removeListener(CaptureTerrainTrigger.TRIGGER, captureTerrainListener);
}
private function startRoundListener(_arg1:Trigger):void{
startRound();
}
public function enableUnit(_arg1:String):void{
delete disabledUnits[_arg1];
}
public function removeUnit(_arg1:Unit):void{
var _local2:int = (units.length - 1);
while (_local2 >= 0) {
if (_arg1 == units[_local2]){
units.splice(_local2, 1);
};
_local2--;
};
}
public function setCamera():void{
}
public function getDifficulty():int{
return (difficulty);
}
public function controlsAir():Boolean{
var _local3:Number;
var _local1:Number = 1;
var _local2:int;
while (_local2 < structures.length) {
_local3 = structures[_local2].getTerrain().applyModifiers("airCost", null, _local1);
if (_local3 < _local1){
return (true);
};
_local2++;
};
return (false);
}
public function getDifficultyResourcesScale():Number{
if (difficulty == EASY){
return (1.25);
};
if (difficulty == HARD){
return (0.75);
};
return (1);
}
public function isEnabled():Boolean{
return (enabled);
}
protected function repairUnit(_arg1:Unit):void{
}
public function controlsSea():Boolean{
var _local3:Number;
var _local1:Number = 1;
var _local2:int;
while (_local2 < structures.length) {
_local3 = structures[_local2].getTerrain().applyModifiers("seaCost", null, _local1);
if (_local3 < _local1){
return (true);
};
_local2++;
};
return (false);
}
public function setDifficulty(_arg1:int):void{
difficulty = _arg1;
}
public function addUnit(_arg1:Unit):void{
_arg1.setController(this);
units.push(_arg1);
}
private function attackUnitListener(_arg1:AttackUnitTrigger):void{
attackUnit(_arg1.getUnitX(), _arg1.getUnitY(), _arg1.getTargetX(), _arg1.getTargetY(), _arg1.getUnit(), _arg1.getTarget());
}
public function getUnits():Array{
return (units);
}
public function update(_arg1:uint=0):void{
}
public function getCloakVisibility():Number{
return (cloakVisibility);
}
public function removeStructure(_arg1:Tile):void{
var _local2:int = (structures.length - 1);
while (_local2 >= 0) {
if (_arg1 == structures[_local2]){
structures.splice(_local2, 1);
};
_local2--;
};
}
public function canAfford(_arg1:String):Boolean{
var _local2:int = UnitManager.getInstance().get(_arg1).getCost(this);
if (_local2 <= resources){
return (true);
};
return (false);
}
public function isAllied(_arg1:Controller):Boolean{
if (_arg1 == this){
return (true);
};
if (_arg1 == null){
return (false);
};
return (team.isAllied(GameManager.getInstance().getPlayer(_arg1)));
}
public function addStructure(_arg1:Tile):void{
_arg1.setController(this);
structures.push(_arg1);
}
protected function startCurrentTurn():void{
ActionManager.getInstance().add(new EndTurnAction());
}
public function getStructures():Array{
return (structures);
}
private function startGameListener(_arg1:Trigger):void{
startGame();
}
private function moveUnitListener(_arg1:MoveUnitTrigger):void{
moveUnit(_arg1.getUnit(), _arg1.getPath());
}
private function endGameListener(_arg1:PlayerTrigger):void{
endGame();
}
public function getTeam():Team{
return (team);
}
protected function startRound():void{
}
private function errorListener(_arg1:Trigger):void{
error();
}
public function controlsUnit(_arg1:Unit):Boolean{
if (_arg1.getController() == this){
return (true);
};
return (false);
}
public function showCloak():Boolean{
return (false);
}
private function captureTerrainListener(_arg1:CaptureTerrainTrigger):void{
captureTerrain(_arg1.getTile(), _arg1.getOldPlayer(), _arg1.getPlayer(), _arg1.getComplete());
}
public function controlsGround():Boolean{
var _local3:Number;
var _local1:Number = 1;
var _local2:int;
while (_local2 < structures.length) {
_local3 = structures[_local2].getTerrain().applyModifiers("groundCost", null, _local1);
if (_local3 < _local1){
return (true);
};
_local2++;
};
return (false);
}
private function killUnitListener(_arg1:KillUnitTrigger):void{
killUnit(_arg1.getUnitX(), _arg1.getUnitY(), _arg1.getUnit());
}
private function buildUnitListener(_arg1:BuildUnitTrigger):void{
buildUnit(_arg1.getUnit());
}
public function spendResources(_arg1:int):void{
resources = (resources - _arg1);
}
public function getGroundCost():Number{
var _local4:Number;
var _local1:Number = 1;
var _local2:Boolean;
var _local3:int;
while (_local3 < structures.length) {
_local4 = structures[_local3].getTerrain().applyModifiers("groundCost", null, _local1);
if ((((_local4 < _local1)) && (!(_local2)))){
_local2 = true;
} else {
_local1 = _local4;
};
_local3++;
};
return (_local1);
}
private function startTurnListener(_arg1:PlayerTrigger):void{
startTurn(_arg1.getPlayer());
if (GameManager.getInstance().getController(_arg1.getPlayer()) == this){
startCurrentTurn();
};
}
public function controlsStructure(_arg1:Tile):Boolean{
if (_arg1.getController() == this){
return (true);
};
return (false);
}
protected function changeUpgradeStatus(_arg1:Unit, _arg2:String, _arg3:Boolean):void{
}
public function getDifficultyAttackScale():Number{
if (difficulty == EASY){
return (1.25);
};
if (difficulty == HARD){
return (0.75);
};
return (1);
}
public function getDisabled():Dictionary{
return (disabledUnits);
}
protected function attackUnit(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:Unit, _arg6:Unit):void{
}
protected function startGame():void{
}
protected function moveUnit(_arg1:Unit, _arg2:Array):void{
}
public function getResources():int{
return (resources);
}
protected function endGame():void{
}
public function setEnabled(_arg1:Boolean):void{
enabled = _arg1;
}
}
}//package com.gamedozer.battalion.game
Section 119
//GameCamera (com.gamedozer.battalion.game.GameCamera)
package com.gamedozer.battalion.game {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.ui.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.*;
import flash.ui.*;
public class GameCamera {
protected var enabled:Boolean;
protected var tx:int;
protected var ty:int;
protected var time:uint;
protected var target:GameSprite;
protected var targetWaitTime:uint;
protected var force:Boolean;
protected var cx:int;
protected var cy:int;
protected var x:int;
protected var y:int;
protected var defCursor:Boolean;
protected var targetTime:uint;
protected static const SCROLL_SPEED:int = 25;
protected static const SCROLL_DISTANCE:int = 84;
protected static const WAIT_TIME:uint = 2000;
protected static const TARGET_WAIT_TIME:uint = 1500;
protected static const BUFFER_TIME:uint = 200;
public function GameCamera(){
x = (y = (cx = (cy = (tx = (ty = 0)))));
time = 0;
enabled = false;
defCursor = false;
force = false;
}
public function setTarget(_arg1:GameSprite=null, _arg2:uint=1500, _arg3:Boolean=false):void{
target = _arg1;
force = _arg3;
if (target != null){
tx = (-(target.x) + (GameManager.GAME_WIDTH / 2));
ty = (-(target.y) + (GameManager.GAME_HEIGHT / 2));
time = WAIT_TIME;
};
targetTime = 0;
targetWaitTime = _arg2;
}
public function getY():int{
return (y);
}
public function setLocation(_arg1:int, _arg2:int):void{
cx = _arg1;
cy = _arg2;
time = 0;
target = null;
}
public function update(_arg1:uint=0):void{
var _local6:int;
var _local7:int;
var _local11:int;
var _local12:int;
var _local13:TileSheetButton;
var _local14:Boolean;
var _local15:MiniMap;
var _local16:Number;
var _local17:String;
var _local2:GameManager = GameManager.getInstance();
var _local3:GameSpriteScroller = _local2.getGameSpriteScroller();
var _local4:int = (_local2.getMap().getWidth() * TileManager.getInstance().getWidth());
var _local5:int = (_local2.getMap().getHeight() * TileManager.getInstance().getHeight());
time = (time + _arg1);
targetTime = (targetTime + _arg1);
if (targetTime < targetWaitTime){
if (target != null){
tx = (-(target.x) + (GameManager.GAME_WIDTH / 2));
ty = (-(target.y) + (GameManager.GAME_HEIGHT / 2));
};
} else {
target = null;
};
if (((enabled) && (!(force)))){
if (KeyboardHandler.getInstance().isDown(Keyboard.UP)){
cy = (cy + SCROLL_SPEED);
time = 0;
};
if (KeyboardHandler.getInstance().isDown(Keyboard.DOWN)){
cy = (cy - SCROLL_SPEED);
time = 0;
};
if (KeyboardHandler.getInstance().isDown(Keyboard.LEFT)){
cx = (cx + SCROLL_SPEED);
time = 0;
};
if (KeyboardHandler.getInstance().isDown(Keyboard.RIGHT)){
cx = (cx - SCROLL_SPEED);
time = 0;
};
if (MouseHandler.getInstance().isEnabled()){
_local11 = MouseHandler.getInstance().getX();
_local12 = MouseHandler.getInstance().getY();
_local13 = GameManager.getInstance().getEndTurnButton();
_local14 = true;
if (_local11 > _local13.x){
if (_local11 < (_local13.x + _local13.width)){
if (_local12 > _local13.y){
if (_local12 < (_local13.y + _local13.height)){
_local14 = false;
};
};
};
};
_local13 = GameManager.getInstance().getNextUnitButton();
if (_local11 > _local13.x){
if (_local11 < (_local13.x + _local13.width)){
if (_local12 > _local13.y){
if (_local12 < (_local13.y + _local13.height)){
_local14 = false;
};
};
};
};
_local15 = GameManager.getInstance().getMiniMap();
if (_local11 > _local15.x){
if (_local11 < (_local15.x + _local15.width)){
if (_local12 > _local15.y){
if (_local12 < ((_local15.y + _local15.height) - 100)){
_local14 = false;
};
};
};
};
if (GameManager.getInstance().isMousingOverInfo()){
return;
};
if (_local14){
if ((((_local11 >= 0)) && ((_local11 < SCROLL_DISTANCE)))){
if ((((_local12 >= 0)) && ((_local12 < BattalionMain.HEIGHT)))){
_local16 = ((1 - (_local11 / SCROLL_DISTANCE)) * SCROLL_SPEED);
cx = (cx + _local16);
time = 0;
};
};
if ((((_local11 > (BattalionMain.WIDTH - SCROLL_DISTANCE))) && ((_local11 < BattalionMain.WIDTH)))){
if ((((_local12 >= 0)) && ((_local12 < BattalionMain.HEIGHT)))){
_local16 = ((((_local11 - BattalionMain.WIDTH) + SCROLL_DISTANCE) / SCROLL_DISTANCE) * SCROLL_SPEED);
cx = (cx - _local16);
time = 0;
};
};
if ((((_local12 >= 0)) && ((_local12 < SCROLL_DISTANCE)))){
if ((((_local11 >= 0)) && ((_local11 < BattalionMain.WIDTH)))){
_local16 = ((1 - (_local12 / SCROLL_DISTANCE)) * SCROLL_SPEED);
cy = (cy + _local16);
time = 0;
};
};
if ((((_local12 > (BattalionMain.HEIGHT - SCROLL_DISTANCE))) && ((_local12 < BattalionMain.HEIGHT)))){
if ((((_local11 >= 0)) && ((_local11 < BattalionMain.WIDTH)))){
_local16 = ((((_local12 - BattalionMain.HEIGHT) + SCROLL_DISTANCE) / SCROLL_DISTANCE) * SCROLL_SPEED);
cy = (cy - _local16);
time = 0;
};
};
};
};
} else {
time = (WAIT_TIME + 1);
};
lock(_local4, _local5);
var _local8:Boolean;
if ((((time > WAIT_TIME)) && (!((target == null))))){
_local6 = (cx = tx);
_local7 = (cy = ty);
} else {
_local6 = cx;
_local7 = cy;
_local8 = true;
force = false;
};
var _local9:Number = x;
var _local10:Number = y;
x = (x + ((_local6 - x) / 2));
y = (y + ((_local7 - y) / 2));
GameManager.getInstance().getMiniMap().setDrag(-(x), -(y));
_local3.x = x;
_local3.y = y;
_local3.lock(_local4, _local5);
_local3.scroll();
_local9 = (x - _local9);
_local10 = (y - _local10);
if (_local8){
_local17 = "";
if (_local9 < 0){
_local17 = (_local17 + "right");
};
if (_local9 > 0){
_local17 = (_local17 + "left");
};
if (_local10 < 0){
_local17 = (_local17 + "down");
};
if (_local10 > 0){
_local17 = (_local17 + "up");
};
if (_local17 != ""){
BattalionMain.getMouseCursor().setCursor(_local17);
defCursor = true;
} else {
if (defCursor){
BattalionMain.getMouseCursor().setCursor("default");
defCursor = false;
};
};
};
}
public function move(_arg1:int=0, _arg2:int=0):void{
cx = (cx + _arg1);
cy = (cy + _arg2);
time = 0;
}
public function getX():int{
return (x);
}
public function isEnabled():Boolean{
return (enabled);
}
public function lock(_arg1:int, _arg2:int):void{
if (tx < (-(_arg1) + GameManager.GAME_WIDTH)){
tx = (-(_arg1) + GameManager.GAME_WIDTH);
};
if (ty < (-(_arg2) + GameManager.GAME_HEIGHT)){
ty = (-(_arg2) + GameManager.GAME_HEIGHT);
};
if (tx > 0){
tx = 0;
};
if (ty > 0){
ty = 0;
};
if (cx < (-(_arg1) + GameManager.GAME_WIDTH)){
cx = (-(_arg1) + GameManager.GAME_WIDTH);
};
if (cy < (-(_arg2) + GameManager.GAME_HEIGHT)){
cy = (-(_arg2) + GameManager.GAME_HEIGHT);
};
if (cx > 0){
cx = 0;
};
if (cy > 0){
cy = 0;
};
}
public function setEnabled(_arg1:Boolean):void{
enabled = _arg1;
}
}
}//package com.gamedozer.battalion.game
Section 120
//GameEvent (com.gamedozer.battalion.game.GameEvent)
package com.gamedozer.battalion.game {
public class GameEvent {
protected var fired:Boolean;
protected var responses:Array;
protected var conditions:LogicalAndCondition;
protected var repeats:int;
public static const REPEAT_FOREVER:int = -1;
public static const REPEAT_ONCE:int = 1;
public function GameEvent(_arg1:int=1){
repeats = _arg1;
conditions = new LogicalAndCondition();
responses = new Array();
fired = false;
}
public function isCompleted():Boolean{
return ((repeats == 0));
}
public function toXML():XML{
var _local1 = (("<event repeats=\"" + ((repeats == GameEvent.REPEAT_FOREVER)) ? "infinity" : repeats) + "\">");
var _local2:Array = conditions.getConditions();
var _local3:int;
while (_local3 < _local2.length) {
_local1 = (_local1 + _local2[_local3].toXML());
_local3++;
};
_local3 = 0;
while (_local3 < responses.length) {
_local1 = (_local1 + responses[_local3].toXML());
_local3++;
};
_local1 = (_local1 + "</event>");
return (new XML(_local1));
}
public function dispose():void{
conditions.dispose();
var _local1:int;
while (_local1 < responses.length) {
responses[_local1].dispose();
_local1++;
};
}
public function isSatisfied():Boolean{
return (conditions.isSatisfied());
}
public function addResponse(_arg1:Response):void{
responses.push(_arg1);
}
public function isFired():Boolean{
return (fired);
}
public function toString():String{
var _local1 = "";
var _local2:Array = conditions.getConditions();
var _local3:int;
while (_local3 < _local2.length) {
_local1 = (_local1 + ("c: " + _local2[_local3].toXML()));
_local3++;
};
_local3 = 0;
while (_local3 < responses.length) {
_local1 = (_local1 + ("r: " + responses[_local3].toXML()));
_local3++;
};
return (_local1);
}
public function update():void{
var _local1:int;
var _local2:Boolean;
if (!isFired()){
conditions.update();
if (isSatisfied()){
fired = true;
_local1 = 0;
while (_local1 < responses.length) {
ResponseManager.getInstance().add(responses[_local1], this);
_local1++;
};
};
} else {
_local2 = true;
_local1 = 0;
while (_local1 < responses.length) {
if (!responses[_local1].isCompleted()){
_local2 = false;
break;
};
_local1++;
};
if (_local2){
reset();
};
};
}
public function setRepeats(_arg1:int):void{
repeats = _arg1;
}
public function addCondition(_arg1:Condition):void{
conditions.add(_arg1);
}
public function reset():void{
fired = false;
repeats--;
if (repeats == 0){
return;
};
conditions.reset();
var _local1:int;
while (_local1 < responses.length) {
responses[_local1].reset();
_local1++;
};
}
public static function getFromXML(_arg1:XML):GameEvent{
var _local2:String = _arg1.@repeats;
if (_local2 == ""){
_local2 = ("" + GameEvent.REPEAT_ONCE);
};
if (_local2.toLowerCase().charAt(0) == "i"){
_local2 = ("" + GameEvent.REPEAT_FOREVER);
};
var _local3:GameEvent = new GameEvent(int(_local2));
var _local4:XMLList = _arg1.child("condition");
var _local5:int;
while (_local5 < _local4.length()) {
_local3.addCondition(ConditionFactory.get(_local4[_local5]));
_local5++;
};
var _local6:XMLList = _arg1.child("response");
_local5 = 0;
while (_local5 < _local6.length()) {
_local3.addResponse(ResponseFactory.get(_local6[_local5]));
_local5++;
};
return (_local3);
}
}
}//package com.gamedozer.battalion.game
Section 121
//GameEventManager (com.gamedozer.battalion.game.GameEventManager)
package com.gamedozer.battalion.game {
public class GameEventManager {
protected var gameEvents:Array;
private static var singleton:GameEventManager;
public function GameEventManager(){
singleton = this;
gameEvents = new Array();
}
public function add(_arg1:GameEvent):void{
gameEvents.push(_arg1);
}
public function isEmpty():Boolean{
var _local1:int = (gameEvents.length - 1);
while (_local1 >= 0) {
if (gameEvents[_local1].isFired()){
return (false);
};
_local1--;
};
return (true);
}
public function update():void{
var _local1:int = (gameEvents.length - 1);
while (_local1 >= 0) {
gameEvents[_local1].update();
if (gameEvents[_local1].isCompleted()){
gameEvents[_local1].dispose();
gameEvents.splice(_local1, 1);
};
_local1--;
};
}
public function toXML():String{
var _local1:String = new String();
var _local2:int;
while (_local2 < gameEvents.length) {
_local1 = (_local1 + gameEvents[_local2].toXML());
_local2++;
};
return (_local1);
}
public static function getInstance():GameEventManager{
if (singleton == null){
throw (new Error("GameEventManager::No instance exists"));
};
return (singleton);
}
}
}//package com.gamedozer.battalion.game
Section 122
//GameManager (com.gamedozer.battalion.game.GameManager)
package com.gamedozer.battalion.game {
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.ui.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.audio.*;
import flash.text.*;
import flash.utils.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.game.controllers.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.display.tween.*;
import com.robertpenner.easing.*;
import com.gamedozer.battalion.game.responses.*;
import com.gamedozer.battalion.game.actions.*;
import com.gamedozer.battalion.game.conditions.*;
import flash.ui.*;
public class GameManager {
protected var camera:GameCamera;
protected var nextUnitButton:TileSheetButton;
protected var infoMenu:InfoMenu;
protected var endTurnButton:TileSheetButton;
protected var controllers:Array;
protected var structures:Array;
protected var units:Array;
protected var turn:int;
protected var miniMap:MiniMap;
protected var round:int;
protected var mapSettings:MapSettings;
protected var playerPanel:AllPlayerPanel;
protected var parent:GameMenu;
protected var mDown:Boolean;
protected var gameSpriteScroller:GameSpriteScroller;
protected var m_loadingPanel:LoadingPanel;
protected var sprite:Sprite;
protected var tileMap:Array;
protected var ballisticsTable:Array;
protected var movementCombiner:MovementCombiner;
protected var currentController:int;
protected var m_wasLoadedFromSavedGame:Boolean;// = false
public static const GAME_WIDTH:int = 560;
public static const UNIT_CHUNKS:int = 4;
public static const GAME_HEIGHT:int = 560;
public static const TILE_CHUNKS:int = 8;
private static var singleton:GameManager;
public function GameManager(_arg1:GameMenu, _arg2:MapSettings, _arg3:XML=null){
var _local8:int;
var _local9:Controller;
var _local10:Array;
var _local11:Array;
var _local12:Tile;
var _local13:Unit;
var _local14:GameEvent;
var _local15:LogicalOrCondition;
super();
singleton = this;
parent = _arg1;
sprite = new Sprite();
new TriggerManager();
new ActionManager();
new GameEventManager();
new ResponseManager();
mapSettings = _arg2;
var _local4:Map = mapSettings.getMap();
tileMap = _local4.generateTileMap();
gameSpriteScroller = new GameSpriteScroller(GAME_WIDTH, GAME_HEIGHT);
sprite.addChild(gameSpriteScroller);
var _local5:int;
while (_local5 < _local4.getHeight()) {
_local8 = 0;
while (_local8 < _local4.getWidth()) {
gameSpriteScroller.add(tileMap[_local5][_local8].getGameTile(), GameSpriteScroller.TILES);
_local8++;
};
_local5++;
};
gameSpriteScroller.scroll();
miniMap = new MiniMap(_local4.generateMiniMap());
controllers = new Array();
units = new Array();
structures = new Array();
var _local6:Array = mapSettings.getTeams();
var _local7:int;
while (_local7 < _local6.length) {
_local9 = _local6[_local7].createController();
_local9.addResources(mapSettings.getResources());
controllers.push(_local9);
_local7++;
};
playerPanel = new AllPlayerPanel(_local6);
infoMenu = new InfoMenu();
infoMenu.x = (BattalionMain.WIDTH - InfoMenu.WIDTH);
infoMenu.y = ((playerPanel.y + AllPlayerPanel.HEIGHT) + 4);
endTurnButton = new TileSheetButton("endTurnButton");
endTurnButton.x = ((BattalionMain.WIDTH - endTurnButton.width) + 3);
endTurnButton.y = ((BattalionMain.HEIGHT - endTurnButton.height) + 3);
nextUnitButton = new TileSheetButton("nextUnitButton");
nextUnitButton.x = ((GAME_WIDTH - nextUnitButton.width) - 3);
nextUnitButton.y = (BattalionMain.HEIGHT - nextUnitButton.height);
if (_arg3 == null){
_local10 = _local4.generateStructures(tileMap, controllers);
_local7 = 0;
while (_local7 < _local10.length) {
_local12 = _local10[_local7];
addStructure(_local12.getController(), _local12);
_local7++;
};
_local11 = _local4.generateUnits(controllers);
_local7 = 0;
while (_local7 < _local11.length) {
_local13 = _local11[_local7];
_local13.setDeployed(true);
if (_local13.getUnitData().hasModifier("Cloaking")){
_local13.setCloaked(true, false, false);
};
addUnit(_local13.getController(), _local13);
tileMap[_local13.getY()][_local13.getX()].setUnit(_local13);
gameSpriteScroller.add(_local13.getGameUnit(), GameSpriteScroller.UNITS);
_local7++;
};
ScriptManager.parseScript(_local4.getScript());
_local7 = 0;
while (_local7 < controllers.length) {
_local14 = new GameEvent(GameEvent.REPEAT_FOREVER);
_local15 = new LogicalOrCondition();
_local15.add(new CaptureTerrainCondition("Command Center", _local7));
_local15.add(new NoUnitsCondition(_local7));
_local14.addCondition(_local15);
_local14.addResponse(new SendActionResponse(new SurrenderAction(_local7)));
GameEventManager.getInstance().add(_local14);
_local7++;
};
} else {
trace("");
trace("");
trace("");
trace("");
trace(getTimer());
trace(_arg3);
ScriptManager.parseScript(_arg3);
m_wasLoadedFromSavedGame = true;
};
resetBallisticsTable();
camera = new GameCamera();
movementCombiner = new MovementCombiner();
m_loadingPanel = new LoadingPanel();
parent.stage.addChild(m_loadingPanel);
_local7 = 0;
while (_local7 < controllers.length) {
if (controllers[_local7] != null){
controllers[_local7].initialize();
};
_local7++;
};
}
public function isStillInitializing():Boolean{
var _local2:Controller;
var _local1:int;
while (_local1 < controllers.length) {
_local2 = controllers[_local1];
if (_local2.isStillInitializing()){
return (true);
};
_local1++;
};
return (false);
}
public function getCamera():GameCamera{
return (camera);
}
public function updateUI(_arg1:uint):void{
var _local8:Tile;
playerPanel.setResources(controllers);
playerPanel.setActive(currentController);
miniMap.setString(("Round " + (round + 1)));
infoMenu.update();
var _local2:int = MouseHandler.getInstance().getX();
var _local3:int = MouseHandler.getInstance().getY();
var _local4:int = ((_local2 - GameManager.getInstance().getSprite().x) - GameManager.getInstance().getGameSpriteScroller().x);
var _local5:int = ((_local3 - GameManager.getInstance().getSprite().y) - GameManager.getInstance().getGameSpriteScroller().y);
var _local6:int = Math.floor((_local4 / TileManager.getInstance().getWidth()));
var _local7:int = Math.floor((_local5 / TileManager.getInstance().getHeight()));
if ((((((((_local2 > 0)) && ((_local3 > 0)))) && ((_local2 < GAME_WIDTH)))) && ((_local3 < GAME_HEIGHT)))){
if (MouseHandler.getInstance().isDown()){
if ((ResponseManager.getInstance().peek() is ChatResponse)){
if (_local3 > 405){
mDown = false;
return;
};
};
if (!mDown){
_local8 = tileAt(_local6, _local7);
if (_local8 != null){
if (_local8.getUnit() != null){
if (infoMenu.getActive() == _local8.getUnit()){
infoMenu.setTile(_local8, false, true);
} else {
infoMenu.setTile(_local8);
};
} else {
infoMenu.setTile(_local8);
};
};
};
mDown = true;
} else {
mDown = false;
};
};
}
public function getNextUnitButton():TileSheetButton{
return (nextUnitButton);
}
public function getControllers():Array{
return (controllers);
}
public function getMap():Map{
return (mapSettings.getMap());
}
public function removeUnit(_arg1:Unit):void{
_arg1.getController().removeUnit(_arg1);
if (_arg1.isDeployed()){
tileMap[_arg1.getY()][_arg1.getX()].setUnit(null);
};
_arg1.setDeployed(false);
gameSpriteScroller.remove(_arg1.getGameUnit());
miniMap.getMap().removeChild(_arg1.getMiniMapSprite());
var _local2:int = (units.length - 1);
while (_local2 >= 0) {
if (_arg1 == units[_local2]){
units.splice(_local2, 1);
};
_local2--;
};
if (((_arg1.getController().getTeam().getActive()) && ((_arg1.getController().getUnits().length < 1)))){
TriggerManager.getInstance().add(new PlayerTrigger(PlayerTrigger.NO_UNITS, getPlayer(_arg1.getController())));
};
}
public function dispose():void{
SoundSystem.instance.destroyLoop("background");
var _local1:int;
while (_local1 < controllers.length) {
if (controllers[_local1] != null){
controllers[_local1].dispose();
};
_local1++;
};
controllers = null;
miniMap = null;
playerPanel = null;
mapSettings = null;
tileMap = null;
units = null;
structures = null;
gameSpriteScroller = null;
ballisticsTable = null;
parent.removeChild(sprite);
TweenManager.getInstance().clear();
singleton = null;
BattalionMain.getMouseCursor().setCursor("default");
camera = null;
}
public function getNodesInAttackRange(_arg1:int, _arg2:int, _arg3:Unit):Array{
var _local4:int;
var _local5:int;
var _local6:int = _arg1;
var _local7:int = _arg2;
var _local8:Tile = tileAt(_local6, _local7);
if (_arg3.isRanged()){
_local4 = _arg3.getBaseUnitData().getWeaponRangeMin();
_local5 = _arg3.getBaseUnitData().getWeaponRangeMax();
_local5 = _local8.getTerrain().applyModifiers("attackRange", _arg3, _local5);
return (Astar.range(tileMap[_local7][_local6], _local4, _local5));
};
return (Astar.search(_local8, null, _arg3, 0, true));
}
public function canAttack(_arg1:Unit, _arg2:Unit, _arg3:Boolean=false, _arg4:int=-1, _arg5:int=-1, _arg6:Boolean=false):Boolean{
var _local7:Array;
if (!canWeaponsFireAtTarget(_arg1, _arg2, true)){
return (false);
};
if (!_arg1.isAlive()){
return (false);
};
if (!_arg1.isDeployed()){
return (false);
};
if (!_arg3){
if (_arg1.hasFired()){
return (false);
};
if (((_arg1.isRanged()) && (_arg1.hasMoved()))){
return (false);
};
};
if (_arg1.getController() == _arg2.getController()){
return (false);
};
if (_arg6){
_local7 = unitsInMoveRange(_arg1, true, _arg4, _arg5);
} else {
_local7 = unitsInRange(_arg1, true, _arg4, _arg5);
};
var _local8:int;
while (_local8 < _local7.length) {
if (_local7[_local8] == _arg2){
return (true);
};
_local8++;
};
return (false);
}
public function resolveAttackCycleInResources(_arg1:Unit, _arg2:Unit):Number{
var _local4:Number;
var _local5:Unit;
var _local6:Boolean;
var _local3:Number = 0;
if (canWeaponsFireAtTarget(_arg1, _arg2)){
_local4 = resolveAttack(_arg1, _arg2, null, null, true, false);
_local3 = (_local3 + ((_local4 / _arg2.getUnitData().getHealth()) * _arg2.getUnitData().getCost()));
if ((_arg2.getHealth() - _local4) > 0){
_local5 = _arg2.clone();
_local5.takeDamage(_local4);
_local6 = true;
if (_local5.isRanged()){
if (!_local5.getUnitData().hasModifier("Counter-Battery")){
_local6 = false;
};
} else {
if (_arg1.isRanged()){
_local6 = false;
};
};
if (_local6){
_local3 = (_local3 - resolveAttackInResources(_local5, _arg1, false));
};
};
};
return (_local3);
}
public function getCurrentController():int{
return (currentController);
}
public function moveCost(_arg1:Unit, _arg2:Array):Number{
var _local5:Tile;
if (!canMove(_arg1, _arg2, true)){
return (Number.POSITIVE_INFINITY);
};
var _local3:Tile = _arg2[0];
var _local4:Number = 0;
var _local6 = 1;
while (_local6 < _arg2.length) {
_local5 = _arg2[_local6];
_local4 = (_local4 + _local5.getCost(_arg1));
_local3 = _local5;
_local6++;
};
return (_local4);
}
public function nodePath(_arg1:Array):Array{
var _local2:Array = new Array();
var _local3:int;
while (_local3 < _arg1.length) {
_local2.push(tileAt(_arg1[_local3], _arg1[(_local3 + 1)]));
_local3 = (_local3 + 2);
};
return (_local2);
}
public function setRound(_arg1:int):void{
round = _arg1;
}
public function getMiniMap():MiniMap{
return (miniMap);
}
public function removeStructure(_arg1:Tile):void{
if (_arg1.getController() != null){
_arg1.getController().removeStructure(_arg1);
};
_arg1.downgrade();
var _local2:int = (structures.length - 1);
while (_local2 >= 0) {
if (_arg1 == structures[_local2]){
structures.splice(_local2, 1);
};
_local2--;
};
}
public function getMovementCombiner():MovementCombiner{
return (movementCombiner);
}
public function resolveAttack(_arg1:Unit, _arg2:Unit, _arg3:Tile=null, _arg4:Tile=null, _arg5:Boolean=true, _arg6:Boolean=true):Number{
if (_arg6){
if (_arg3 == null){
_arg3 = tileAt(_arg2.getX(), _arg2.getY());
};
if (_arg4 == null){
_arg4 = tileAt(_arg1.getX(), _arg1.getY());
};
};
var _local7:Number = _arg1.getUnitData().applyModifiers("damage", _arg2, _arg1.getUnitData().getDamage());
if (_arg6){
if (_arg4.isStructure()){
_local7 = _arg1.getUnitData().applyModifiers("structureBonus", _arg2, _local7);
};
};
if (_arg5){
_local7 = _arg1.getUnitData().applyModifiers("attackBonus", _arg2, _local7);
} else {
_local7 = _arg1.getUnitData().applyModifiers("returnAttackBonus", _arg2, _local7);
};
var _local8:Number = (_arg1.getChunks(UNIT_CHUNKS) / UNIT_CHUNKS);
var _local9:Number = ballisticsTable[_arg1.getUnitData().getWeaponType()][_arg2.getUnitData().getArmorType()];
var _local10:Number = 1;
if (_arg6){
_local10 = _arg3.getTerrain().applyModifiers("defense", _arg2, _local10);
if (_arg1.isRanged()){
_local10 = _arg3.getTerrain().applyModifiers("rangedDefense", _arg2, _local10);
};
};
return (((((_local7 * _local9) * _local8) * _local10) * _arg1.getController().getDifficultyAttackScale()));
}
public function controlsStructure(_arg1:Controller, _arg2:Tile):Boolean{
if (_arg2.getController() == _arg1){
return (true);
};
return (false);
}
public function unitsInMoveRange(_arg1:Unit, _arg2:Boolean=false, _arg3:int=-1, _arg4:int=-1):Array{
var _local9:Boolean;
var _local10:Array;
var _local11:int;
if (_arg3 == -1){
_arg3 = _arg1.getX();
};
if (_arg4 == -1){
_arg4 = _arg1.getY();
};
if (_arg1.isRanged()){
return (unitsInRange(_arg1, _arg2, _arg3, _arg4));
};
var _local5:Tile = tileAt(_arg3, _arg4);
var _local6:Array = Astar.search(_local5, null, _arg1, 0, true);
var _local7:Array = new Array();
var _local8:int;
while (_local8 < _local6.length) {
_local9 = false;
if (_local6[_local8].getUnit() != null){
_local10 = _local6[_local8].getConnections();
_local11 = 0;
while (_local11 < _local10.length) {
if (_local6.indexOf(_local10[_local11]) != -1){
if ((((_local10[_local11].getUnit() == null)) || ((_local10[_local11].getUnit() == _arg1)))){
_local9 = true;
break;
};
};
_local11++;
};
if (_local9){
if (_arg2){
if (_local6[_local8].getUnit().getController() != _arg1.getController()){
_local7.push(_local6[_local8].getUnit());
};
} else {
_local7.push(_local6[_local8].getUnit());
};
};
};
_local8++;
};
return (_local7);
}
public function isMousingOverInfo():Boolean{
return (infoMenu.isMousingOverInfo());
}
public function getStructures():Array{
return (structures);
}
public function getMapSettings():MapSettings{
return (mapSettings);
}
public function getPlayerPanel():AllPlayerPanel{
return (playerPanel);
}
public function controlsUnit(_arg1:Controller, _arg2:Unit):Boolean{
if (_arg2.getController() == _arg1){
return (true);
};
return (false);
}
public function startGame():void{
ActionManager.getInstance().add(new StartGameAction());
ActionManager.getInstance().add(new StartRoundAction());
ActionManager.getInstance().add(new StartTurnAction());
}
public function importBallisticsTable(_arg1:XML):void{
var _local4:int;
var _local5:XMLList;
var _local6:int;
var _local7:int;
resetBallisticsTable();
if (_arg1 == null){
return;
};
var _local2:XMLList = _arg1..attack;
var _local3:int;
while (_local3 < _local2.length()) {
_local4 = UnitData.weaponTypeFromString(_local2[_local3].@type);
_local5 = _local2[_local3]..defense;
_local6 = 0;
while (_local6 < _local5.length()) {
_local7 = UnitData.armorTypeFromString(_local5[_local6].@type);
ballisticsTable[_local4][_local7] = Number(_local5[_local6].@value);
_local6++;
};
_local3++;
};
}
public function endGame():void{
parent.endGame(true);
}
public function isOneActiveTeam():Boolean{
var _local4:int;
var _local1:Array = new Array();
var _local2:int;
while (_local2 < controllers.length) {
if (controllers[_local2].getTeam().getActive()){
_local1.push(controllers[_local2].getTeam());
};
_local2++;
};
if (_local1.length < 2){
return (true);
};
var _local3:int;
while (_local3 < _local1.length) {
_local4 = _local3;
while (_local4 < _local1.length) {
if (!_local1[_local3].isAllied(_local1[_local4])){
return (false);
};
_local3++;
};
_local3++;
};
return (true);
}
public function tileAt(_arg1:int, _arg2:int):Tile{
if ((((((((_arg1 < 0)) || ((_arg2 < 0)))) || ((_arg1 > (mapSettings.getMap().getWidth() - 1))))) || ((_arg2 > (mapSettings.getMap().getHeight() - 1))))){
return (null);
};
return (tileMap[_arg2][_arg1]);
}
public function getBallisticsModifier(_arg1:int, _arg2:int):Number{
return (ballisticsTable[_arg1][_arg1]);
}
public function canWeaponsFireAtTarget(_arg1:Unit, _arg2:Unit, _arg3:Boolean=false):Boolean{
var _local4:Tile;
if (_arg3){
if (_arg1.isRanged()){
_local4 = tileAt(_arg1.getX(), _arg1.getY());
if (_local4.getTerrain().hasModifier("Canopy")){
return (false);
};
_local4 = tileAt(_arg2.getX(), _arg2.getY());
if (_local4.getTerrain().hasModifier("Shielded")){
return (false);
};
};
};
if (_arg2.isCloaked()){
return (false);
};
if (_arg2.getUnitData().isAir()){
if (_arg1.getUnitData().hasModifier("Skysweeper")){
return (true);
};
return (false);
} else {
if (_arg1.getUnitData().hasModifier("Air Bound")){
return (false);
};
};
if (((!(_arg2.getUnitData().isGround())) && (_arg1.getUnitData().hasModifier("Ground Bound")))){
return (false);
};
if (((!(_arg2.getUnitData().isSea())) && (_arg1.getUnitData().hasModifier("Sea Bound")))){
return (false);
};
if (((_arg2.getUnitData().hasModifier("Submerged")) && (!(_arg1.getUnitData().hasModifier("Anti-Sub"))))){
return (false);
};
return (true);
}
public function resolveAttackInResources(_arg1:Unit, _arg2:Unit, _arg3:Boolean=true):Number{
var _local5:Number;
var _local4:Number = 0;
if (canWeaponsFireAtTarget(_arg1, _arg2)){
_local5 = resolveAttack(_arg1, _arg2, null, null, _arg3, false);
_local4 = ((_local5 / _arg2.getUnitData().getHealth()) * _arg2.getUnitData().getCost());
};
return (_local4);
}
public function resetBallisticsTable():void{
var _local2:int;
ballisticsTable = new Array();
var _local1:int;
while (_local1 < UnitData.weaponTypes.length) {
ballisticsTable[_local1] = new Array();
_local2 = 0;
while (_local2 < UnitData.armorTypes.length) {
ballisticsTable[_local1][_local2] = 0;
_local2++;
};
_local1++;
};
}
public function getController(_arg1:int):Controller{
return (controllers[_arg1]);
}
public function addExplosion(_arg1:String, _arg2:GameSprite=null, _arg3:int=0, _arg4:int=0):void{
var _local5:TileSheet = TileSheetManager.getInstance().get("Explosion");
if (_arg2 != null){
_local5.x = (_arg2.x + ((_arg2.width - _local5.width) / 2));
_local5.y = ((_arg2.y - _local5.height) + _arg2.height);
} else {
_local5.x = (_arg3 - (_local5.width / 2));
_local5.y = (_arg4 - _local5.height);
};
TweenManager.getInstance().add(new TweenDisplay(_local5, true, GameSpriteScroller.TOP, _local5), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenAnimation(_local5, "default", true, _local5), TweenManager.SEQUENTIAL);
TweenManager.getInstance().add(new TweenDisplay(_local5, false, GameSpriteScroller.TOP, _local5), TweenManager.SEQUENTIAL);
}
public function getTileMap():Array{
return (tileMap);
}
public function getEndTurnButton():TileSheetButton{
return (endTurnButton);
}
public function toXML():XML{
var _local3:Dictionary;
var _local4:String;
var _local5:Unit;
var _local6:Array;
var _local7:int;
var _local8:Tile;
var _local9:int;
var _local10:int;
var _local1 = (((((("<gamestate turn=\"" + turn) + "\" round=\"") + round) + "\" controller=\"") + currentController) + "\"/>");
var _local2:int;
while (_local2 < controllers.length) {
if (controllers[_local2] != null){
_local1 = (_local1 + (((("<resources controller=\"" + _local2) + "\" value=\"") + controllers[_local2].getResources()) + "\"/>"));
_local3 = controllers[_local2].getDisabled();
for (_local4 in _local3) {
_local1 = (_local1 + (((("<disableUnit controller=\"" + _local2) + "\" unit=\"") + _local4) + "\"/>"));
};
};
_local2++;
};
_local2 = 0;
while (_local2 < units.length) {
_local5 = units[_local2];
_local1 = (_local1 + (((((((("<unit name=\"" + _local5.getBaseUnitData().getName()) + "\" x=\"") + _local5.getX()) + "\" y=\"") + _local5.getY()) + "\" controller=\"") + getPlayer(_local5.getController())) + "\">"));
_local1 = (_local1 + (((((((((("<status deployed=\"" + _local5.isDeployed()) + "\" moved=\"") + _local5.hasMoved()) + "\" fired=\"") + _local5.hasFired()) + "\" cloaked=\"") + _local5.isCloaked()) + "\" repairing=\"") + _local5.isRepairing()) + "\" />"));
if (_local5.isUpgraded()){
_local1 = (_local1 + (("<upgrade name=\"" + _local5.getUnitData().getName()) + "\"/>"));
};
if (_local5.getHealth() != _local5.getUnitData().getHealth()){
_local1 = (_local1 + (("<health value=\"" + _local5.getHealth()) + "\"/>"));
};
_local6 = _local5.getUnitData().getTemporaryModifiers();
_local7 = 0;
while (_local7 < _local6.length) {
_local1 = (_local1 + (("<modifier value=\"" + _local6[_local7].getName()) + "\"/>"));
_local7++;
};
_local1 = (_local1 + "</unit>");
_local2++;
};
_local2 = 0;
while (_local2 < structures.length) {
_local8 = structures[_local2];
_local9 = -1;
_local10 = -1;
if (_local8.getCapturer() != null){
_local9 = _local8.getCapturer().getX();
_local10 = _local8.getCapturer().getY();
};
_local1 = (_local1 + (((((((((((((("<structure name=\"" + _local8.getTerrain().getName()) + "\" x=\"") + _local8.getX()) + "\" y=\"") + _local8.getY()) + "\" controller=\"") + getPlayer(_local8.getController())) + "\" chunks=\"") + _local8.getChunks()) + "\" capturerx=\"") + _local9) + "\" capturery=\"") + _local10) + "\"/>"));
if (_local8.getResources() > 0){
_local1 = (_local1 + (((((("<structureresources x=\"" + _local8.getX()) + "\" y=\"") + _local8.getY()) + "\" value=\"") + _local8.getResources()) + "\"/>"));
};
_local2++;
};
return (new XML(((((((((("<game mapurl=\"" + mapSettings.getMap().getMapURL()) + "\" mapname=\"") + mapSettings.getMap().getMapName()) + "\">") + mapSettings.toXML()) + "<script>") + GameEventManager.getInstance().toXML()) + _local1) + "</script> </game>")));
}
public function getParent():GameMenu{
return (parent);
}
public function healPercentage(_arg1:Unit):Number{
var _local2:Number = ((_arg1.getUnitData().getHealth() - _arg1.getHealth()) / _arg1.getUnitData().getHealth());
if (_local2 > 0.25){
_local2 = 0.25;
};
return (_local2);
}
public function getGameSpriteScroller():GameSpriteScroller{
return (gameSpriteScroller);
}
public function unitsInRange(_arg1:Unit, _arg2:Boolean=false, _arg3:int=-1, _arg4:int=-1, _arg5:int=-1, _arg6:int=-1):Array{
var _local8:int;
var _local9:int;
var _local12:Tile;
if (_arg3 == -1){
_arg3 = _arg1.getX();
};
if (_arg4 == -1){
_arg4 = _arg1.getY();
};
var _local7:Array = new Array();
if (((!((_arg5 == -1))) && (!((_arg6 == -1))))){
_local8 = _arg5;
_local9 = _arg6;
} else {
_local8 = _arg1.getUnitData().getWeaponRangeMin();
_local9 = _arg1.getUnitData().getWeaponRangeMax();
if (_arg1.isRanged()){
_local12 = tileAt(_arg1.getX(), _arg1.getY());
_local9 = _local12.getTerrain().applyModifiers("attackRange", _arg1, _local9);
};
};
var _local10:Array = Astar.range(tileMap[_arg4][_arg3], _local8, _local9);
var _local11:int;
while (_local11 < _local10.length) {
if (_local10[_local11].getUnit() != null){
if (_arg2){
if (_local10[_local11].getUnit().getController() != _arg1.getController()){
_local7.push(_local10[_local11].getUnit());
};
} else {
_local7.push(_local10[_local11].getUnit());
};
};
_local11++;
};
return (_local7);
}
public function getInfoMenu():InfoMenu{
return (infoMenu);
}
public function setCurrentController(_arg1:int):void{
currentController = _arg1;
}
public function getActiveController():Controller{
return (controllers[currentController]);
}
public function getUnits():Array{
return (units);
}
public function getSprite():Sprite{
return (sprite);
}
public function canMove(_arg1:Unit, _arg2:Array, _arg3:Boolean=false):Boolean{
var _local4:Tile;
var _local5:Number;
var _local6:Tile;
var _local7:int;
if (!_arg1.isAlive()){
return (false);
};
if (!_arg1.isDeployed()){
return (false);
};
if (_arg1.hasMoved()){
return (false);
};
if (_arg2.length < 1){
return (false);
};
if (_arg2[0] == null){
return (false);
};
if (!_arg3){
if (_arg2[(_arg2.length - 1)].getUnit() != null){
if (((!((_arg2[(_arg2.length - 1)].getUnit() == _arg1))) && (!(_arg2[(_arg2.length - 1)].getUnit().isCloaked())))){
return (false);
};
};
};
if (_arg2[0].getUnit() == _arg1){
_local4 = _arg2[0];
_local5 = 0;
_local7 = 1;
while (_local7 < _arg2.length) {
_local6 = _arg2[_local7];
if (_local6 == null){
return (false);
};
if (!_local4.isConnected(_local6)){
return (false);
};
_local5 = (_local5 + _local6.getCost(_arg1));
_local4 = _local6;
_local7++;
};
if (_local5 > _arg1.getRange()){
return (false);
};
} else {
return (false);
};
return (true);
}
public function update(_arg1:uint=0):void{
if (m_loadingPanel != null){
if (!isStillInitializing()){
m_loadingPanel.stop();
m_loadingPanel = null;
if (!m_wasLoadedFromSavedGame){
startGame();
} else {
ActionManager.getInstance().add(new SendTriggerAction(new PlayerTrigger(PlayerTrigger.START_TURN, GameManager.getInstance().getCurrentController())));
};
};
return;
};
TriggerManager.getInstance().add(new TimePassedTrigger(_arg1));
TriggerManager.getInstance().update();
GameEventManager.getInstance().update();
ResponseManager.getInstance().update();
ActionManager.getInstance().update();
camera.update(_arg1);
var _local2:int;
while (_local2 < controllers.length) {
if (controllers[_local2].getTeam().getActive()){
controllers[_local2].update(_arg1);
controllers[_local2].getTeam().addStatistic(Team.TIME_TAKEN, null);
};
_local2++;
};
if (!TweenManager.getInstance().isEmpty()){
gameSpriteScroller.scroll(true);
};
gameSpriteScroller.update(_arg1);
updateUI(_arg1);
if (BattalionMain.ALLOW_DEBUG){
if (KeyboardHandler.getInstance().isDown(Keyboard.HOME)){
_local2 = 0;
while (_local2 < controllers.length) {
if (controllers[_local2].getTeam().getControllerType() != "Human"){
ActionManager.getInstance().add(new SurrenderAction(_local2));
};
_local2++;
};
};
if (KeyboardHandler.getInstance().isDown(Keyboard.END)){
_local2 = 0;
while (_local2 < controllers.length) {
if (controllers[_local2].getTeam().getControllerType() == "Human"){
ActionManager.getInstance().add(new SurrenderAction(_local2));
};
_local2++;
};
};
};
}
public function activePlayers():int{
var _local1:int;
var _local2:int;
while (_local2 < controllers.length) {
if (controllers[_local2].getTeam().getActive()){
_local1++;
};
_local2++;
};
return (_local1);
}
public function addStructure(_arg1:Controller, _arg2:Tile):void{
if (_arg1 != null){
_arg1.addStructure(_arg2);
};
structures.push(_arg2);
}
public function addUnit(_arg1:Controller, _arg2:Unit):void{
_arg1.addUnit(_arg2);
units.push(_arg2);
miniMap.getMap().addChild(_arg2.getMiniMapSprite());
}
public function pointPath(_arg1:Array):Array{
var _local2:Array = new Array();
var _local3:int;
while (_local3 < _arg1.length) {
_local2.push(_arg1[_local3].getX());
_local2.push(_arg1[_local3].getY());
_local3++;
};
return (_local2);
}
public function unitAt(_arg1:int, _arg2:int):Unit{
var _local3:Tile = tileAt(_arg1, _arg2);
if (_local3 == null){
return (null);
};
return (_local3.getUnit());
}
public function getRound():int{
return (round);
}
public function surrender(_arg1:int):void{
controllers[_arg1].getTeam().setActive(false);
if (isOneActiveTeam()){
ActionManager.getInstance().add(new EndGameAction());
};
}
public function getPlayer(_arg1:Controller):int{
var _local2:int;
while (_local2 < controllers.length) {
if (controllers[_local2] == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
public function getTurn():int{
return (turn);
}
public function setTurn(_arg1:int):void{
turn = _arg1;
}
public static function getInstance():GameManager{
if (singleton == null){
return (null);
};
return (singleton);
}
}
}//package com.gamedozer.battalion.game
Section 123
//GameManagerHelper (com.gamedozer.battalion.game.GameManagerHelper)
package com.gamedozer.battalion.game {
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.*;
public class GameManagerHelper {
private static var initialised:Boolean = false;
public function GameManagerHelper(){
if (initialised){
return;
};
initialised = true;
new ModifierManager();
new TileManager(BattalionMain.TILE_WIDTH, BattalionMain.TILE_HEIGHT, 6, 6);
new UnitManager();
new TileSheetManager();
new TweenManager(BattalionMain.getStage());
}
public static function isInitialised():Boolean{
return (initialised);
}
}
}//package com.gamedozer.battalion.game
Section 124
//LogicalAndCondition (com.gamedozer.battalion.game.LogicalAndCondition)
package com.gamedozer.battalion.game {
public class LogicalAndCondition extends LogicalCondition {
override public function isSatisfied():Boolean{
var _local1:int;
while (_local1 < conditions.length) {
if (!conditions[_local1].isSatisfied()){
return (false);
};
_local1++;
};
return (true);
}
override public function toXML():XML{
var _local1 = "<condition type=\"and\"> ";
var _local2:int;
while (_local2 < conditions.length) {
_local1 = (_local1 + conditions[_local2].toXML());
_local2++;
};
_local1 = (_local1 + "</condition>");
return (new XML(_local1));
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:XMLList = _arg1.child("condition");
var _local3:LogicalAndCondition = new (LogicalAndCondition);
var _local4:int;
while (_local4 < _local2.length) {
_local3.add(ConditionFactory.get(_local2[_local4]));
_local4++;
};
return (_local3);
}
}
}//package com.gamedozer.battalion.game
Section 125
//LogicalCondition (com.gamedozer.battalion.game.LogicalCondition)
package com.gamedozer.battalion.game {
public class LogicalCondition implements Condition {
protected var conditions:Array;
public function LogicalCondition(){
conditions = new Array();
}
public function add(_arg1:Condition):void{
conditions.push(_arg1);
}
public function update():void{
var _local1:int;
while (_local1 < conditions.length) {
conditions[_local1].update();
_local1++;
};
}
public function getConditions():Array{
return (conditions);
}
public function reset():void{
var _local1:int;
while (_local1 < conditions.length) {
conditions[_local1].reset();
_local1++;
};
}
public function isSatisfied():Boolean{
if (conditions.length > 0){
return (conditions[0].isSatistfied());
};
return (false);
}
public function toXML():XML{
var _local1 = "<condition type=\"logical\"> ";
var _local2:int;
while (_local2 < conditions.length) {
_local1 = (_local1 + conditions[_local2].toXML());
_local2++;
};
_local1 = (_local1 + "</condition>");
return (new XML(_local1));
}
public function dispose():void{
var _local1:int;
while (_local1 < conditions.length) {
conditions[_local1].dispose();
_local1++;
};
}
}
}//package com.gamedozer.battalion.game
Section 126
//LogicalOrCondition (com.gamedozer.battalion.game.LogicalOrCondition)
package com.gamedozer.battalion.game {
public class LogicalOrCondition extends LogicalCondition {
override public function isSatisfied():Boolean{
var _local1:int;
while (_local1 < conditions.length) {
if (conditions[_local1].isSatisfied()){
return (true);
};
_local1++;
};
return (false);
}
override public function toXML():XML{
var _local1 = "<condition type=\"or\"> ";
var _local2:int;
while (_local2 < conditions.length) {
_local1 = (_local1 + conditions[_local2].toXML());
_local2++;
};
_local1 = (_local1 + "</condition>");
return (new XML(_local1));
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:LogicalOrCondition = new (LogicalOrCondition);
var _local3:XMLList = _arg1.child("condition");
trace(("LOC #" + _local3.length()));
var _local4:int;
while (_local4 < _local3.length()) {
_local2.add(ConditionFactory.get(_local3[_local4]));
_local4++;
};
return (_local2);
}
}
}//package com.gamedozer.battalion.game
Section 127
//LogicalXorCondition (com.gamedozer.battalion.game.LogicalXorCondition)
package com.gamedozer.battalion.game {
public class LogicalXorCondition extends LogicalCondition {
override public function isSatisfied():Boolean{
var _local1:Boolean;
var _local2:Boolean;
var _local3:int;
while (_local3 < conditions.length) {
if (conditions[_local3].isSatisfied()){
if (_local2 == false){
_local1 = true;
} else {
return (false);
};
};
_local3++;
};
return (_local1);
}
override public function toXML():XML{
var _local1 = "<condition type=\"xor\"> ";
var _local2:int;
while (_local2 < conditions.length) {
_local1 = (_local1 + conditions[_local2].toXML());
_local2++;
};
_local1 = (_local1 + "</condition>");
return (new XML(_local1));
}
public static function getFromXML(_arg1:XML):Condition{
var _local2:XMLList = _arg1.child("condition");
var _local3:LogicalXorCondition = new (LogicalXorCondition);
var _local4:int;
while (_local4 < _local2.length) {
_local3.add(ConditionFactory.get(_local2[_local4]));
_local4++;
};
return (_local3);
}
}
}//package com.gamedozer.battalion.game
Section 128
//MovementCombiner (com.gamedozer.battalion.game.MovementCombiner)
package com.gamedozer.battalion.game {
import com.gamedozer.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.controllers.*;
import com.gamedozer.battalion.game.ai.*;
import com.gamedozer.battalion.game.actions.*;
public class MovementCombiner {
var m_turnCount:int;
var m_tankIslands:MovementIslands;
var m_commandoIslands:MovementIslands;
var m_leviathanIslands:MovementIslands;
public function MovementCombiner(){
initialize();
}
public function getInterimDestination(_arg1:Tile, _arg2:Tile, _arg3:Unit):Tile{
var _local6:Set;
var _local7:Set;
var _local8:Set;
var _local9:Array;
var _local10:int;
var _local11:int;
var _local12:int;
var _local13:InterimResult;
m_turnCount = 0;
var _local4:UnitData = _arg3.getUnitData();
if (_local4.isAir()){
return (_arg2);
};
var _local5:MovementIslands = lookupMovementIslands(_arg3);
if (((_local4.isGround()) && (_arg3.getController().controlsSea()))){
if (_local5.areSharingAnIsland(_arg1, _arg2)){
return (_arg2);
};
_local6 = _local5.getIsland(_arg1);
_local7 = m_leviathanIslands.intersect(_local6);
_local8 = new Set();
_local8 = _local8.union(_local6);
_local9 = drillIntersectionSet(_arg3, _arg2, _local8, _local7, _local5, m_leviathanIslands);
if (_local9 == null){
return (null);
};
if (_local9.length == 0){
return (null);
};
if (_local9.length == 1){
if (_local9[0].intersection.getTerrain().getName() == "High Bridge"){
return (null);
};
return (_local9[0].intersection);
};
_local10 = 100000000000;
_local11 = -1;
_local12 = 0;
while (_local12 < _local9.length) {
_local13 = _local9[_local12];
if (_local13.intersection.getTerrain().getName() == "High Bridge"){
} else {
if (_local13.turns < _local10){
_local11 = _local12;
};
};
_local12++;
};
if (_local11 == -1){
return (null);
};
if (_local9[_local11].intersection.getTerrain().getName() == "High Bridge"){
throw (new Error("Cant have a high bridge intersection"));
};
return (_local9[_local11].intersection);
} else {
//unresolved if
if (m_leviathanIslands.areSharingAnIsland(_arg1, _arg2)){
return (_arg2);
};
_local6 = m_leviathanIslands.getIsland(_arg1);
_local7 = _local5.intersect(_local6);
_local8 = new Set();
_local8 = _local8.union(_local6);
_local9 = drillIntersectionSet(_arg3, _arg2, _local8, _local7, m_leviathanIslands, _local5);
if (_local9 == null){
return (null);
};
if (_local9.length == 0){
return (null);
};
if (_local9.length == 1){
return (_local9[0].intersection);
};
_local10 = 100000000000;
_local11 = -1;
_local12 = 0;
while (_local12 < _local9.length) {
_local13 = _local9[_local12];
if (_local13.turns < _local10){
_local11 = _local12;
};
_local12++;
};
if (_local11 == -1){
return (null);
};
return (_local9[_local11].intersection);
};
//unresolved jump
return (null);
}
public function getAppropriateFakeUnit(_arg1:Unit, _arg2:MovementIslands):Unit{
var _local3:UnitManager = UnitManager.getInstance();
if (_arg2 == m_leviathanIslands){
return (new Unit(new GameUnit(new GameSprite()), _local3.get("Leviathan Barge")));
};
if (_arg1.getName().indexOf("Commando") == -1){
return (new Unit(new GameUnit(new GameSprite()), _local3.get("Scorpion Tank")));
};
return (new Unit(new GameUnit(new GameSprite()), _local3.get("Strike Commando")));
}
private function lookupMovementIslands(_arg1:Unit):MovementIslands{
var _local2:UnitData = _arg1.getBaseUnitData();
if (_local2.isGround()){
if (_local2.getMovementType() == 1){
return (m_commandoIslands);
};
return (m_tankIslands);
};
return (null);
}
private function initialize():void{
m_leviathanIslands = new MovementIslands("Leviathan Barge");
m_commandoIslands = new MovementIslands("Strike Commando");
m_tankIslands = new MovementIslands("Scorpion Tank");
}
public function getTurnCount():int{
return (m_turnCount);
}
private function drillIntersectionSet(_arg1:Unit, _arg2:Tile, _arg3:Set, _arg4:Set, _arg5:MovementIslands, _arg6:MovementIslands):Array{
var _local10:Tile;
var _local11:Set;
var _local12:int;
var _local13:InterimResult;
var _local14:Set;
var _local15:Array;
var _local16:int;
var _local17:int;
var _local18:InterimResult;
var _local7:Array;
var _local8:Array = _arg4.getArrayCopy();
var _local9:int;
while (_local9 < _local8.length) {
_local10 = _local8[_local9];
if (((!((_local10.getUnit() == null))) && (!((_local10.getUnit() == _arg1))))){
} else {
_local11 = _arg6.getIsland(_local10);
if (_arg3.containsSet(_local11)){
} else {
_arg3 = _arg3.union(_local11);
if (_local11.containsObject(_arg2)){
if (_local7 == null){
_local7 = new Array();
};
_local12 = Astar.calculateTurnsToPath(_local10, _arg2, getAppropriateFakeUnit(_arg1, _arg6), Tile.k_astarFlagIgnoreLastNode);
_local13 = new InterimResult();
_local13.turns = (_local12 + 1);
_local13.intersection = _local10;
_local7.push(_local13);
};
if (_local7 == null){
_local14 = _arg5.intersect(_local11);
_local15 = drillIntersectionSet(_arg1, _arg2, _arg3, _local14, _arg6, _arg5);
if (_local15 != null){
if (_local7 == null){
_local7 = new Array();
};
_local16 = 100000000000;
_local17 = -1;
_local9 = 0;
while (_local9 < _local15.length) {
_local13 = _local15[_local9];
if (_local13.turns < _local16){
_local17 = _local9;
};
_local9++;
};
_local18 = _local15[_local17];
_local12 = Astar.calculateTurnsToPath(_local10, _local18.intersection, getAppropriateFakeUnit(_arg1, _arg6), Tile.k_astarFlagIgnoreLastNode);
_local13 = new InterimResult();
_local13.turns = (_local18.turns + _local12);
_local13.intersection = _local10;
_local7.push(_local13);
};
};
};
};
_local9++;
};
return (_local7);
}
}
}//package com.gamedozer.battalion.game
import com.gamedozer.battalion.data.*;
class InterimResult {
public var intersection:Tile;// = null
public var turns:int;// = 0
private function InterimResult(){
}
}
Section 129
//MovementIslands (com.gamedozer.battalion.game.MovementIslands)
package com.gamedozer.battalion.game {
import com.gamedozer.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.game.controllers.*;
import com.gamedozer.battalion.game.ai.*;
import com.gamedozer.battalion.game.actions.*;
public class MovementIslands {
private var m_unitData:UnitData;
private var m_islands:Array;
public function MovementIslands(_arg1:String){
m_unitData = UnitManager.getInstance().get(_arg1);
m_islands = new Array();
initialize();
}
private function initialize():void{
var _local6:int;
var _local7:Tile;
var _local8:Array;
var _local9:int;
var _local10:Set;
var _local11:Tile;
var _local12:int;
var _local13:Tile;
var _local1:Unit = new Unit(new GameUnit(new GameSprite()), m_unitData);
var _local2:GameManager = GameManager.getInstance();
var _local3:Array = _local2.getTileMap();
var _local4:Array = new Array();
var _local5:int;
while (_local5 < _local3.length) {
_local6 = 0;
while (_local6 < _local3[_local5].length) {
_local7 = _local3[_local5][_local6];
if (_local7.canBeMovedOnBy(_local1)){
_local4.push(_local7);
};
_local6++;
};
_local5++;
};
while (_local4.length > 0) {
_local7 = _local4[0];
_local4.splice(0, 1);
_local8 = new Array();
_local8.push(_local7);
_local9 = 0;
while (_local9 < _local4.length) {
_local11 = _local4[_local9];
_local12 = 0;
while (_local12 < _local8.length) {
_local13 = _local8[_local12];
if (_local13.isAdjacentTo(_local11)){
_local8.push(_local11);
_local4.splice(_local9, 1);
_local9 = -1;
break;
};
_local12++;
};
_local9++;
};
_local10 = new Set();
_local10.addArray(_local8);
m_islands.push(_local10);
};
}
private function getIslandFromTile(_arg1:Tile):Set{
var _local4:Set;
var _local2:int = m_islands.length;
var _local3:int;
while (_local3 < _local2) {
_local4 = m_islands[_local3];
if (_local4.containsObject(_arg1)){
return (_local4);
};
_local3++;
};
return (null);
}
public function accumulate(_arg1:MovementIslands):void{
}
public function areSharingAnIsland(_arg1:Tile, _arg2:Tile):Boolean{
var _local3:Set = getIslandFromTile(_arg1);
var _local4:Set = getIslandFromTile(_arg2);
if ((((_local3 == null)) || ((_local4 == null)))){
return (false);
};
if (_local3 == _local4){
return (true);
};
return (false);
}
public function getIsland(_arg1:Tile):Set{
var _local3:Set;
var _local2:int;
while (_local2 < m_islands.length) {
_local3 = m_islands[_local2];
if (_local3.containsObject(_arg1)){
return (_local3);
};
_local2++;
};
return (null);
}
public function intersect(_arg1:Set):Set{
var _local4:Set;
var _local2:Set = new Set();
var _local3:int;
while (_local3 < m_islands.length) {
_local4 = m_islands[_local3];
_local2 = _local2.union(_arg1.intersect(_local4));
_local3++;
};
return (_local2);
}
}
}//package com.gamedozer.battalion.game
Section 130
//NotCondition (com.gamedozer.battalion.game.NotCondition)
package com.gamedozer.battalion.game {
public class NotCondition implements Condition {
protected var condition:Condition;
public function NotCondition(_arg1:Condition){
condition = _arg1;
}
public function isSatisfied():Boolean{
return (!(condition.isSatisfied()));
}
public function update():void{
condition.update();
}
public function toXML():XML{
return (new XML((("<condition type=\"not\"> " + condition.toXML()) + "</condition>")));
}
public function reset():void{
condition.reset();
}
public function dispose():void{
condition.dispose();
}
public static function getFromXML(_arg1:XML):Condition{
return (new NotCondition(ConditionFactory.get(_arg1..condition[0])));
}
}
}//package com.gamedozer.battalion.game
Section 131
//Response (com.gamedozer.battalion.game.Response)
package com.gamedozer.battalion.game {
public class Response {
protected var completed:Boolean;
protected var fired:Boolean;
public function Response(){
fired = false;
completed = false;
}
public function isCompleted():Boolean{
return (completed);
}
public function toXML():XML{
return (new XML());
}
public function isFired():Boolean{
return (fired);
}
public function update():void{
completed = true;
}
public function reset():void{
fired = false;
completed = false;
}
public function globalQueue():Boolean{
return (false);
}
public function fire():void{
fired = true;
}
public function dispose():void{
}
}
}//package com.gamedozer.battalion.game
Section 132
//ResponseFactory (com.gamedozer.battalion.game.ResponseFactory)
package com.gamedozer.battalion.game {
import com.gamedozer.battalion.game.responses.*;
public class ResponseFactory {
public static function get(_arg1:XML):Response{
var _local2:String = _arg1.@type;
switch (_local2){
case "incrementCounterVariable":
return (IncrementCounterVariableResponse.getFromXML(_arg1));
case "decrementCounterVariable":
return (DecrementCounterVariableResponse.getFromXML(_arg1));
case "setBooleanVariable":
return (SetBooleanVariableResponse.getFromXML(_arg1));
case "chat":
return (ChatResponse.getFromXML(_arg1));
case "highlight":
return (HighlightResponse.getFromXML(_arg1));
case "disableControllers":
return (DisableControllersResponse.getFromXML(_arg1));
case "trace":
return (TraceResponse.getFromXML(_arg1));
case "sendAction":
return (SendActionResponse.getFromXML(_arg1));
case "sendTrigger":
return (SendTriggerResponse.getFromXML(_arg1));
case "nameUnit":
return (NameUnitResponse.getFromXML(_arg1));
case "createTransportedUnit":
return (CreateTransportedUnitResponse.getFromXML(_arg1));
case "createUnit":
return (CreateUnitResponse.getFromXML(_arg1));
case "destroyUnit":
return (DestroyUnitResponse.getFromXML(_arg1));
case "removeUnit":
return (RemoveUnitResponse.getFromXML(_arg1));
case "scroll":
return (ScrollResponse.getFromXML(_arg1));
case "damageUnit":
return (DamageUnitResponse.getFromXML(_arg1));
case "unitDisable":
return (UnitDisableResponse.getFromXML(_arg1));
case "structureResources":
return (StructureResourcesResponse.getFromXML(_arg1));
case "resources":
return (ResourcesResponse.getFromXML(_arg1));
case "disableUnit":
return (DisableUnitResponse.getFromXML(_arg1));
};
return (new Response());
}
}
}//package com.gamedozer.battalion.game
Section 133
//ResponseManager (com.gamedozer.battalion.game.ResponseManager)
package com.gamedozer.battalion.game {
import flash.utils.*;
public class ResponseManager {
protected var responses:Array;
protected var objects:Array;
private static var singleton:ResponseManager;
public function ResponseManager(){
singleton = this;
responses = new Array();
objects = new Array();
}
public function add(_arg1:Response, _arg2:Object):void{
responses.push(_arg1);
objects.push(_arg2);
}
public function isEmpty():Boolean{
return ((responses.length == 0));
}
public function update():void{
var response:Response;
var object:Dictionary = new Dictionary();
var i:int;
for (;i < responses.length;(i = (i + 1))) {
response = responses[i];
if (response.globalQueue()){
if (object[this] != null){
continue;
};
object[this] = true;
};
if (object[objects[i]] != null){
} else {
object[objects[i]] = true;
if (!response.isFired()){
response.fire();
} else {
response.update();
};
continue;
var _slot1 = e;
trace("ResponseManager::", _slot1.getStackTrace());
};
};
i = (responses.length - 1);
while (i >= 0) {
if (responses[i].isCompleted()){
responses.splice(i, 1);
objects.splice(i, 1);
};
i = (i - 1);
};
}
public function peek(_arg1:Response=null):Response{
var _local2:int;
if (_arg1 != null){
_local2 = responses.indexOf(_arg1);
if (_local2 == -1){
return (null);
};
};
var _local3:int = (_local2 + 1);
while (_local3 < responses.length) {
if (!responses[_local3].isCompleted()){
return (responses[_local3]);
};
_local3++;
};
return (null);
}
public static function getInstance():ResponseManager{
if (singleton == null){
throw (new Error("ResponseManager::No instance exists"));
};
return (singleton);
}
}
}//package com.gamedozer.battalion.game
Section 134
//ScriptManager (com.gamedozer.battalion.game.ScriptManager)
package com.gamedozer.battalion.game {
import com.gamedozer.battalion.utils.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
public class ScriptManager {
public static function parseScript(_arg1:XML):void{
var _local11:int;
var _local12:Controller;
var _local13:UnitData;
var _local14:GameUnit;
var _local15:Unit;
var _local16:TileSheet;
var _local17:XMLList;
var _local18:String;
var _local19:int;
var _local20:String;
var _local21:UnitData;
var _local22:TileSheet;
var _local23:Tile;
var _local24:uint;
var _local25:*;
var _local26:GameSprite;
var _local27:GameEvent;
var _local2:GameManager = GameManager.getInstance();
var _local3:XMLList = _arg1..gamestate;
_local11 = 0;
while (_local11 < _local3.length()) {
_local2.setTurn(_local3[_local11].@turn);
_local2.setRound(_local3[_local11].@round);
_local2.setCurrentController(_local3[_local11].@controller);
_local11++;
};
var _local4:XMLList = _arg1..resources;
_local11 = 0;
while (_local11 < _local4.length()) {
_local2.getController(_local4[_local11].@controller).addResources(_local4[_local11].@value);
_local11++;
};
var _local5:XMLList = _arg1..unit;
_local11 = 0;
while (_local11 < _local5.length()) {
_local12 = _local2.getController(_local5[_local11].@controller);
if (_local12 == null){
} else {
_local13 = UnitManager.getInstance().get(_local5[_local11].@name);
if (_local13 != null){
_local14 = new GameUnit(TileSheetManager.getInstance().getColorised(_local13.getSprite(), _local12.getTeam().getColor()));
_local15 = new Unit(_local14, _local13, parseInt(_local5[_local11].@x), parseInt(_local5[_local11].@y), _local12);
_local16 = (_local15.getGameUnit().getSprite() as TileSheet);
_local16.playAnimation("right_idle");
_local15.setDeployed((_local5[_local11].status.@deployed.charAt(0) == "t"));
_local15.setMoved((_local5[_local11].status.@moved.charAt(0) == "t"));
_local15.setFired((_local5[_local11].status.@fired.charAt(0) == "t"));
if ((((_local5[_local11].status.@moved.charAt(0) == "t")) || ((_local5[_local11].status.@fired.charAt(0) == "t")))){
_local15.darken();
};
_local15.setCloaked((_local5[_local11].status.@cloaked.charAt(0) == "t"), false, false);
_local15.setRepairing((_local5[_local11].status.@repairing.charAt(0) == "t"));
_local17 = _local5[_local11]..modifier;
_local18 = _local5[_local11].upgrade.@name;
if (_local18 != ""){
trace("Upgrade stuffs");
_local21 = UnitManager.getInstance().get(_local5[_local11].upgrade.@name);
_local22 = TileSheetManager.getInstance().getColorised(_local21.getSprite(), _local12.getTeam().getColor());
_local15.getGameUnit().getSprite().alpha = 0;
_local15.upgrade(_local22, _local21);
};
_local19 = 0;
while (_local19 < _local17.length()) {
_local13.addTemporaryModifier(ModifierManager.getInstance().get(_local17[_local19].@value));
_local19++;
};
_local20 = _local5[_local11].health.@value;
if (_local20 != ""){
_local15.setHealth(parseFloat(_local5[_local11].health.@value));
};
_local2.addUnit(_local12, _local15);
_local2.getTileMap()[_local15.getY()][_local15.getX()].setUnit(_local15);
_local2.getGameSpriteScroller().add(_local15.getGameUnit(), GameSpriteScroller.UNITS);
};
};
_local11++;
};
var _local6:XMLList = _arg1..structure;
_local11 = 0;
while (_local11 < _local6.length()) {
_local12 = _local2.getController(parseInt(_local6[_local11].@controller));
_local23 = _local2.tileAt(parseInt(_local6[_local11].@x), parseInt(_local6[_local11].@y));
_local24 = 4294967295;
if (_local12 != null){
_local24 = _local12.getTeam().getColor();
};
_local25 = TileManager.getInstance().get(_local6[_local11].@name);
if (_local25 != null){
if (_local25.getSprite() == "oilrig"){
_local26 = TileSheetManager.getInstance().getColorised("oilrig", _local24);
(_local26 as TileSheet).playAnimation("default");
} else {
_local26 = new ColoredSprite(BitmapLibrary.loadBitmap(_local25.getSprite()), BitmapLibrary.loadBitmap((_local25.getSprite() + "_mask")), _local24, "overlay");
};
_local23.upgrade(_local26, _local25, _local12);
_local23.setChunks(parseInt(_local6[_local11].@chunks));
if (parseInt(_local6[_local11].@capturerx) != -1){
_local23.setCapturer(_local2.unitAt(parseInt(_local6[_local11].@capturerx), parseInt(_local6[_local11].@capturery)));
};
_local2.addStructure(_local12, _local23);
};
_local11++;
};
var _local7:XMLList = _arg1..structureresources;
_local11 = 0;
while (_local11 < _local7.length()) {
_local23 = _local2.tileAt(parseInt(_local7[_local11].@x), parseInt(_local7[_local11].@y));
if (_local23 != null){
_local23.setResources(parseInt(_local7[_local11].@value));
};
_local11++;
};
var _local8:XMLList = _arg1..camera;
_local11 = 0;
while (_local11 < _local8.length()) {
_local2.getCamera().setLocation(parseInt(_local8[_local11].@x), parseInt(_local8[_local11].@y));
_local11++;
};
var _local9:XMLList = _arg1.disableUnit;
_local11 = 0;
while (_local11 < _local9.length()) {
_local2.getController(parseInt(_local9[_local11].@controller)).disableUnit(_local9[_local11].@unit);
_local11++;
};
var _local10:XMLList = _arg1..event;
_local11 = 0;
while (_local11 < _local10.length()) {
_local27 = GameEvent.getFromXML(_local10[_local11]);
GameEventManager.getInstance().add(_local27);
_local11++;
};
}
}
}//package com.gamedozer.battalion.game
Section 135
//Trigger (com.gamedozer.battalion.game.Trigger)
package com.gamedozer.battalion.game {
public class Trigger {
protected var name:String;
public static const START_ROUND:String = "startRound";
public static const END_GAME:String = "endGame";
public static const ERROR:String = "error";
public static const CONTROL:String = "control";
public static const START_GAME:String = "startGame";
public function Trigger(_arg1:String=""){
name = _arg1;
}
public function getName():String{
return (name);
}
public function toXML():XML{
return (new XML());
}
public function setName(_arg1:String):void{
name = _arg1;
}
}
}//package com.gamedozer.battalion.game
Section 136
//TriggerFactory (com.gamedozer.battalion.game.TriggerFactory)
package com.gamedozer.battalion.game {
import com.gamedozer.battalion.game.triggers.*;
public class TriggerFactory {
public static function get(_arg1:XML):Trigger{
var _local2:String = _arg1.@type;
switch (_local2){
case "":
break;
};
return (new Trigger());
}
}
}//package com.gamedozer.battalion.game
Section 137
//TriggerManager (com.gamedozer.battalion.game.TriggerManager)
package com.gamedozer.battalion.game {
import com.gamedozer.battalion.game.triggers.*;
public class TriggerManager {
protected var triggers:Array;
protected var listeners:Array;
private static var singleton:TriggerManager;
public function TriggerManager(){
singleton = this;
triggers = new Array();
listeners = new Array();
}
public function add(_arg1:Trigger):void{
triggers.push(_arg1);
}
public function isEmpty():Boolean{
return ((triggers.length == 0));
}
public function addListener(_arg1:String, _arg2:Function):void{
var _local3:TriggerHelper = new TriggerHelper();
_local3.name = _arg1;
_local3.func = _arg2;
listeners.push(_local3);
}
public function removeListener(_arg1:String, _arg2:Function):void{
var _local3:int = (listeners.length - 1);
while (_local3 >= 0) {
if ((((listeners[_local3].name == _arg1)) && ((listeners[_local3].func == _arg2)))){
listeners.splice(_local3, 1);
};
_local3--;
};
}
public function update():void{
var _local1:*;
var _local2:*;
do {
_local1 = triggers.shift();
_local2 = 0;
while (_local2 < listeners.length) {
if (listeners[_local2].name == _local1.getName()){
listeners[_local2].func.call(null, _local1);
};
_local2++;
};
} while (triggers.length > 0);
}
public static function getInstance():TriggerManager{
if (singleton == null){
throw (new Error("TriggerManager::No instance exists"));
};
return (singleton);
}
}
}//package com.gamedozer.battalion.game
class TriggerHelper {
public var name:String;
public var func:Function;
private function TriggerHelper(){
}
}
Section 138
//AllPlayerPanel (com.gamedozer.battalion.ui.AllPlayerPanel)
package com.gamedozer.battalion.ui {
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import flash.text.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.*;
public class AllPlayerPanel extends Sprite {
var arrow:Sprite;
var panels:Array;
public static var WIDTH:int = 130;
public static var HEIGHT:int = 148;
public function AllPlayerPanel(_arg1:Array){
var _local4:PlayerPanel;
super();
addChild(new Bitmap(BitmapLibrary.loadBitmap("playerboxbehind")));
panels = new Array();
var _local2:int;
while (_local2 < 4) {
if (_local2 < _arg1.length){
_local4 = new PlayerPanel(_arg1[_local2]);
_local4.y = (_local2 * PlayerPanel.HEIGHT);
addChild(_local4);
panels.push(_local4);
};
_local2++;
};
var _local3:Bitmap = new Bitmap(FrameMaker.createFrame(BitmapLibrary.loadBitmap("frame2"), (WIDTH + 30), (HEIGHT + 30), 39, 39));
_local3.x = -15;
_local3.y = -15;
addChild(_local3);
arrow = new Sprite();
arrow.addChild(new Bitmap(BitmapLibrary.loadBitmap("playerpointer")));
arrow.x = (-(arrow.width) + 16);
addChild(arrow);
setActive(0);
x = (BattalionMain.WIDTH - WIDTH);
y = (MiniMap.HEIGHT + 15);
}
public function setActive(_arg1:int):void{
arrow.y = (((_arg1 * PlayerPanel.HEIGHT) + (PlayerPanel.HEIGHT / 2)) - (arrow.height / 2));
}
public function setResources(_arg1:Array):void{
var _local2:int;
while (_local2 < _arg1.length) {
if (_arg1[_local2] != null){
panels[_local2].setResources(_arg1[_local2].getResources());
} else {
panels[_local2].setResources(0);
};
_local2++;
};
}
}
}//package com.gamedozer.battalion.ui
Section 139
//BattalionButton (com.gamedozer.battalion.ui.BattalionButton)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import flash.text.*;
import com.gamedozer.battalion.*;
public class BattalionButton extends SimpleButton {
protected static const OVER_BITMAP:String = "buttonUp";
protected static const DOWN_BITMAP:String = "buttonDown";
protected static const UP_BITMAP:String = "button";
protected static var downBitmapData:BitmapData;
protected static var overBitmapData:BitmapData;
protected static var upBitmapData:BitmapData;
public function BattalionButton(_arg1:int=-1, _arg2:int=-1, _arg3:String=""){
if (upBitmapData == null){
upBitmapData = BitmapLibrary.loadBitmap(UP_BITMAP);
overBitmapData = BitmapLibrary.loadBitmap(OVER_BITMAP);
downBitmapData = BitmapLibrary.loadBitmap(DOWN_BITMAP);
};
upState = new Sprite();
(upState as Sprite).addChild(new Bitmap(FrameMaker.createFrame(upBitmapData, _arg1, _arg2, 8, 8)));
overState = new Sprite();
(overState as Sprite).addChild(new Bitmap(FrameMaker.createFrame(overBitmapData, _arg1, _arg2, 8, 8)));
downState = new Sprite();
(downState as Sprite).addChild(new Bitmap(FrameMaker.createFrame(downBitmapData, _arg1, _arg2, 8, 8)));
hitTestState = upState;
if (_arg3 != ""){
labelButton((upState as DisplayObjectContainer), _arg3);
labelButton((downState as DisplayObjectContainer), _arg3);
labelButton((overState as DisplayObjectContainer), _arg3);
};
tabEnabled = false;
addEventListener(MouseEvent.MOUSE_OVER, overHandler);
addEventListener(MouseEvent.MOUSE_OUT, outHandler);
}
function outHandler(_arg1:Event):void{
BattalionMain.getMouseCursor().setCursor("default");
}
function overHandler(_arg1:Event):void{
if (enabled){
BattalionMain.getMouseCursor().setCursor("select");
};
}
private function labelButton(_arg1:DisplayObjectContainer, _arg2:String):void{
var _local3:TextField;
_local3 = new DefaultTextField();
_local3.x = 0;
_local3.y = 0;
var _local4:TextFormat = new DefaultTextFormat();
_local4.align = TextFormatAlign.CENTER;
_local3.defaultTextFormat = _local4;
_local3.htmlText = BBCode.parseBBCode(_arg2);
_local3.width = _arg1.width;
_local3.height = (_local3.textHeight + 5);
_local3.y = ((_arg1.height - _local3.height) / 2);
_arg1.addChild(_local3);
}
}
}//package com.gamedozer.battalion.ui
Section 140
//BattalionPanel (com.gamedozer.battalion.ui.BattalionPanel)
package com.gamedozer.battalion.ui {
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import flash.text.*;
public class BattalionPanel extends MovieClip {
public var rHeight:int;
public var rWidth:int;
public static const SPOTTED:String = "spotted_texture";
public static const FRAME1:String = "frame1";
public static const FRAME2:String = "frame2";
public static const WOOD:String = "wood_texture";
protected static var bitmapData:BitmapData;
public function BattalionPanel(_arg1:int=-1, _arg2:int=-1, _arg3:String="wood_texture", _arg4:String="frame1", _arg5:String=""){
var _local7:DisplayObject;
var _local8:TextField;
var _local9:Sprite;
var _local10:Bitmap;
var _local11:Bitmap;
super();
if (bitmapData == null){
bitmapData = BitmapLibrary.loadBitmap(_arg3);
};
if (_arg1 == -1){
rWidth = Math.ceil(width);
rHeight = Math.ceil(height);
_local7 = getChildAt(0);
_local7.visible = false;
_local7.scaleX = 0;
_local7.scaleY = 0;
_local7.width = 1;
_local7.height = 1;
scaleX = 1;
scaleY = 1;
} else {
rWidth = _arg1;
rHeight = _arg2;
};
var _local6:Sprite = FrameMaker.createBlock(BitmapLibrary.loadBitmap(_arg3), rWidth, rHeight);
addChild(_local6);
if (_arg5 != ""){
_local8 = new DefaultTextField(0xFFFFFF, TextFormatAlign.CENTER);
_local8.text = _arg5;
_local8.width = rWidth;
_local8.height = (_local8.textHeight + 5);
_local9 = new Sprite();
_local9.graphics.lineStyle(1, 0, 0);
_local9.graphics.beginFill(0, 0.5);
_local9.graphics.drawRect(0, 0, rWidth, _local8.height);
addChild(_local9);
addChild(_local8);
};
if (_arg4 == FRAME1){
_local10 = new Bitmap(FrameMaker.createFrame(BitmapLibrary.loadBitmap(FRAME1), (rWidth + 16), (rHeight + 16), 43, 43));
new Bitmap(FrameMaker.createFrame(BitmapLibrary.loadBitmap(FRAME1), (rWidth + 16), (rHeight + 16), 43, 43)).x = (_local10.y = -8);
addChild(_local10);
} else {
if (_arg4 == FRAME2){
_local11 = new Bitmap(FrameMaker.createFrame(BitmapLibrary.loadBitmap(FRAME2), (rWidth + 30), (rHeight + 30), 39, 39));
new Bitmap(FrameMaker.createFrame(BitmapLibrary.loadBitmap(FRAME2), (rWidth + 30), (rHeight + 30), 39, 39)).x = (_local11.y = -15);
addChild(_local11);
};
};
}
}
}//package com.gamedozer.battalion.ui
Section 141
//BuildMenu (com.gamedozer.battalion.ui.BuildMenu)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import flash.geom.*;
import flash.text.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.controllers.*;
public class BuildMenu extends Sprite {
protected var tileSheets:Array;
protected var groundText:Bitmap;
protected var airText:Bitmap;
protected var groundIcon:Bitmap;
protected var airIcon:Bitmap;
protected var controller:HumanController;
protected var infoMenu:InfoMenu;
protected var seaText:Bitmap;
protected var seaIcon:Bitmap;
public var backButton:TileSheetButton;
protected var groundHeader:Bitmap;
protected var seaHeader:Bitmap;
protected var tile:Tile;
protected var airHeader:Bitmap;
public static const WIDTH:int = 560;
public static const HEIGHT:int = 565;
public function BuildMenu(_arg1:HumanController, _arg2:Tile){
var _local9:UnitData;
var _local20:Boolean;
var _local21:BuildMenuUnit;
var _local22:Sprite;
var _local23:TextField;
var _local24:Sprite;
var _local25:TextField;
var _local26:Sprite;
var _local27:TextField;
super();
controller = _arg1;
tile = _arg2;
var _local3:Sprite = FrameMaker.createBlock(BitmapLibrary.loadBitmap("wood_texture"), WIDTH, HEIGHT);
var _local4:Bitmap = new Bitmap(FrameMaker.createFrame(BitmapLibrary.loadBitmap("frame1"), (WIDTH + 16), (HEIGHT + 16), 43, 43));
_local4.x = -8;
_local4.y = -8;
_local3.addChild(_local4);
addChild(_local3);
var _local5:Array = new Array();
var _local6:Array = new Array();
var _local7:Array = new Array();
var _local8:Array = UnitManager.getInstance().getAll();
var _local10:int;
while (_local10 < _local8.length) {
_local9 = _local8[_local10];
if (_local9.hasModifier("Unbuildable")){
} else {
if (!_arg1.isUnitEnabled(_local9.getName())){
} else {
if (_local9.isGround()){
_local5.push(_local9);
} else {
if (_local9.isAir()){
_local6.push(_local9);
} else {
if (_local9.isSea()){
_local7.push(_local9);
};
};
};
};
};
_local10++;
};
_local5.sort(sortOnCost);
_local6.sort(sortOnCost);
_local7.sort(sortOnCost);
tileSheets = new Array();
var _local11 = 14;
var _local12 = 204;
var _local13 = 125;
var _local14:int = _local11;
var _local15:int = _local12;
_local10 = 0;
while (_local10 < _local5.length) {
_local9 = _local5[_local10];
_local20 = (_arg1.getResources() >= _local9.getCost(_arg1));
_local21 = new BuildMenuUnit(this, _arg1, _local9, _local20, groundHeaderShow);
tileSheets.push(_local21.getTileSheet());
_local21.x = _local14;
_local21.y = _local15;
_local14 = (_local14 + 68);
if (_local14 > WIDTH){
_local14 = 14;
_local15 = (_local15 + _local13);
_local21.x = _local14;
_local21.y = _local15;
};
addChild(_local21);
_local10++;
};
var _local16 = 95;
var _local17 = 530;
var _local18:Map = GameManager.getInstance().getMap();
if (!_arg1.controlsGround()){
_local22 = createBlockingImage(_local17, _local16);
_local22.x = _local11;
_local22.y = (_local15 + 5);
addChild(_local22);
_local23 = new DefaultTextField(0, TextFormatAlign.LEFT, true);
_local22.addChild(_local23);
_local23.width = 500;
if (_local18.hasGroundControl){
_local23.text = "You cannot build ground units unless you control at least one Ground Control.";
} else {
_local23.text = "You cannot build ground units on this map.";
};
_local23.x = 10;
_local23.y = 10;
_local22.addEventListener(MouseEvent.CLICK, clickHandler);
};
_local14 = _local11;
_local15 = (_local12 + _local13);
_local10 = 0;
while (_local10 < _local6.length) {
_local9 = _local6[_local10];
_local20 = (_arg1.getResources() >= _local9.getCost(_arg1));
_local21 = new BuildMenuUnit(this, _arg1, _local9, _local20, airHeaderShow);
tileSheets.push(_local21.getTileSheet());
_local21.x = _local14;
_local21.y = _local15;
_local14 = (_local14 + 68);
addChild(_local21);
_local10++;
};
if (!_arg1.controlsAir()){
_local24 = createBlockingImage(_local17, _local16);
_local24.x = _local11;
_local24.y = (_local15 + 5);
addChild(_local24);
_local25 = new DefaultTextField(0, TextFormatAlign.LEFT, true);
_local24.addChild(_local25);
_local25.width = 500;
if (_local18.hasAirControl){
_local25.text = "You cannot build air units unless you control at least one Air Control.";
} else {
_local25.text = "You cannot build air units on this map.";
};
_local25.x = 10;
_local25.y = 10;
_local24.addEventListener(MouseEvent.CLICK, clickHandler);
};
_local14 = _local11;
_local15 = (_local12 + (_local13 * 2));
_local10 = 0;
while (_local10 < _local7.length) {
_local9 = _local7[_local10];
_local20 = (_arg1.getResources() >= _local9.getCost(_arg1));
_local21 = new BuildMenuUnit(this, _arg1, _local9, _local20, seaHeaderShow);
tileSheets.push(_local21.getTileSheet());
_local21.x = _local14;
_local21.y = _local15;
_local14 = (_local14 + 68);
addChild(_local21);
_local10++;
};
if (((!(_arg1.controlsSea())) || (!(_arg2.seaBordered())))){
_local26 = createBlockingImage((_local17 - 100), _local16);
_local26.x = _local11;
_local26.y = (_local15 + 5);
addChild(_local26);
_local27 = new DefaultTextField(0, TextFormatAlign.LEFT, true);
_local26.addChild(_local27);
_local27.width = 500;
if (((_local18.hasSeaControl) && (!(_arg2.seaBordered())))){
_local27.text = "You can only build sea units from Factories that border the sea.";
} else {
if (_local18.hasSeaControl){
_local27.text = "You cannot build sea units unless you control at least one Sea Control.";
} else {
_local27.text = "You cannot build sea units on this map.";
};
};
_local27.x = 10;
_local27.y = 10;
_local26.addEventListener(MouseEvent.CLICK, clickHandler);
};
groundText = new Bitmap(BitmapLibrary.loadBitmap("build_text_ground"));
airText = new Bitmap(BitmapLibrary.loadBitmap("build_text_air"));
seaText = new Bitmap(BitmapLibrary.loadBitmap("build_text_sea"));
groundText.x = 48;
groundText.y = 186;
airText.x = groundText.x;
airText.y = (186 + _local13);
seaText.x = groundText.x;
seaText.y = (186 + (_local13 * 2));
addChild(groundText);
addChild(airText);
addChild(seaText);
groundIcon = new Bitmap(BitmapLibrary.loadBitmap("build_icon_ground"));
airIcon = new Bitmap(BitmapLibrary.loadBitmap("build_icon_air"));
seaIcon = new Bitmap(BitmapLibrary.loadBitmap("build_icon_sea"));
groundIcon.y = 170;
airIcon.y = (airText.y - 7);
seaIcon.y = (seaText.y - 7);
seaIcon.x = 5;
addChild(groundIcon);
addChild(airIcon);
addChild(seaIcon);
groundHeader = new Bitmap(BitmapLibrary.loadBitmap("build_header_ground"));
airHeader = new Bitmap(BitmapLibrary.loadBitmap("build_header_air"));
seaHeader = new Bitmap(BitmapLibrary.loadBitmap("build_header_sea"));
groundHeader.x = (airHeader.x = (seaHeader.x = 47));
groundHeader.y = (airHeader.y = (seaHeader.y = 22));
addChild(groundHeader);
addChild(airHeader);
addChild(seaHeader);
var _local19:Bitmap = new Bitmap(FrameMaker.createFrame(BitmapLibrary.loadBitmap("frame2"), (groundHeader.width + 30), (InfoMenu.HEIGHT + 30), 39, 39));
_local19.x = (groundHeader.x - 15);
_local19.y = (groundHeader.y - 15);
addChild(_local19);
infoMenu = new InfoMenu();
infoMenu.x = seaHeader.x;
infoMenu.y = seaHeader.y;
addChild(infoMenu);
infoMenu.visible = (seaHeader.visible = (airHeader.visible = false));
groundHeader.visible = true;
_local3.addEventListener(MouseEvent.CLICK, clickHandler);
backButton = new TileSheetButton("closeButton");
backButton.enable();
backButton.x = ((WIDTH - backButton.width) - 8);
backButton.y = ((HEIGHT - backButton.height) - 10);
backButton.addEventListener(MouseEvent.CLICK, clickHandler);
addChild(backButton);
}
public function complete(_arg1:UnitData):void{
controller.buildUnits(_arg1, tile);
}
public function update(_arg1:uint=0):void{
var _local2:int;
while (_local2 < tileSheets.length) {
tileSheets[_local2].update(_arg1);
_local2++;
};
}
public function createBlockingImage(_arg1:Number, _arg2:Number):Sprite{
var _local3:Sprite = new Sprite();
_local3.graphics.beginBitmapFill(BitmapLibrary.loadBitmap("spotted_texture"));
_local3.graphics.drawRect(0, 0, _arg1, _arg2);
var _local4:Bitmap = new Bitmap(FrameMaker.createFrame(BitmapLibrary.loadBitmap("frame1"), (_arg1 + 16), (_arg2 + 16), 43, 43));
_local4.x = -8;
_local4.y = -8;
_local3.addChild(_local4);
addChild(_local3);
return (_local3);
}
public function sortOnCost(_arg1:UnitData, _arg2:UnitData):Number{
var _local3:Number = _arg1.getCost();
var _local4:Number = _arg2.getCost();
if (_local3 > _local4){
return (1);
};
if (_local3 < _local4){
return (-1);
};
return (0);
}
protected function groundHeaderShow(_arg1:Event, _arg2:UnitData=null):void{
groundHeader.visible = true;
airHeader.visible = false;
seaHeader.visible = false;
if (_arg2 != null){
infoMenu.setUnitData(_arg2, controller);
infoMenu.visible = true;
} else {
infoMenu.visible = false;
};
}
protected function seaHeaderShow(_arg1:Event, _arg2:UnitData=null):void{
groundHeader.visible = false;
airHeader.visible = false;
seaHeader.visible = true;
if (_arg2 != null){
infoMenu.setUnitData(_arg2, controller);
infoMenu.visible = true;
} else {
infoMenu.visible = false;
};
}
protected function airHeaderShow(_arg1:Event, _arg2:UnitData=null):void{
groundHeader.visible = false;
airHeader.visible = true;
seaHeader.visible = false;
if (_arg2 != null){
infoMenu.setUnitData(_arg2, controller);
infoMenu.visible = true;
} else {
infoMenu.visible = false;
};
}
function clickHandler(_arg1:Event):void{
controller.clear();
}
}
}//package com.gamedozer.battalion.ui
Section 142
//BuildMenuUnit (com.gamedozer.battalion.ui.BuildMenuUnit)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import flash.geom.*;
import flash.text.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.*;
public class BuildMenuUnit extends Sprite {
protected var unit:UnitData;
protected var sprite:TileSheet;
protected var func:Function;
protected var canAfford:Boolean;
protected var isOver:Boolean;
protected var menu:BuildMenu;
public function BuildMenuUnit(_arg1:BuildMenu, _arg2:Controller, _arg3:UnitData, _arg4:Boolean, _arg5:Function){
menu = _arg1;
func = _arg5;
unit = _arg3;
canAfford = _arg4;
var _local6:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("build_unit_box_bg"));
_local6.x = 10;
_local6.y = 11;
addChild(_local6);
sprite = TileSheetManager.getInstance().getColorised(_arg3.getName(), _arg2.getTeam().getColor());
sprite.x = (sprite.y = 10);
sprite.mouseEnabled = false;
sprite.mouseChildren = false;
var _local7:Sprite = new Sprite();
_local7.graphics.beginFill(0);
var _local8:int = (TileManager.getInstance().getWidth() / 2);
_local7.graphics.drawCircle(_local8, _local8, _local8);
sprite.addChild(_local7);
sprite.mask = _local7;
if (!_arg4){
sprite.transform.colorTransform = new ColorTransform(0.25, 0.25, 0.25);
};
addChild(sprite);
var _local9:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("build_unit_box"));
addChild(_local9);
var _local10:TextField = new DefaultTextField();
_local10.x = 14;
_local10.y = 69;
_local10.width = 49;
_local10.height = 19;
_local10.mouseEnabled = false;
var _local11:TextFormat = new DefaultTextFormat();
_local11.align = TextFormatAlign.CENTER;
if (!canAfford){
_local11.color = 4294901760;
};
_local10.defaultTextFormat = _local11;
var _local12:Number = _arg3.getCost(_arg2);
_local10.text = Math.round(_local12).toString();
addChild(_local10);
addEventListener(MouseEvent.MOUSE_OVER, overHandler);
addEventListener(MouseEvent.MOUSE_OUT, outHandler);
if (_arg4){
addEventListener(MouseEvent.CLICK, clickHandler);
};
}
protected function clickHandler(_arg1:Event):void{
menu.complete(unit);
}
protected function outHandler(_arg1:Event):void{
if (isOver){
if (canAfford){
BattalionMain.getMouseCursor().setCursor("default");
sprite.playAnimation("default");
};
};
isOver = false;
}
protected function overHandler(_arg1:Event):void{
if (!isOver){
if (canAfford){
BattalionMain.getMouseCursor().setCursor("select");
sprite.playAnimation("spin");
sprite.getCurrentAnimation().nextFrame();
};
func(null, unit);
};
isOver = true;
}
public function getTileSheet():TileSheet{
return (sprite);
}
}
}//package com.gamedozer.battalion.ui
Section 143
//CampaignMenu (com.gamedozer.battalion.ui.CampaignMenu)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.ui.modes.*;
import com.gamedozer.battalion.audio.*;
import flash.text.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.assets.*;
import flash.filters.*;
public class CampaignMenu extends Sprite implements ModeInterface {
protected const WIDTH:int = 184;
protected const HEIGHT:int = 184;
protected var mainMenuButton:TileSheetButton;
protected var header:Bitmap;
protected var xmlLoader:XMLLoader;
protected var resources:TextField;
protected var groundUnits:TextField;
protected var minimapBitmap:Bitmap;
protected var difficulty:int;// = 1
protected var minimap:BitmapData;
protected var airUnits:TextField;
protected var chapter:TextField;
protected var levelButton:TileSheetButton;
protected var missionText:TextField;
protected var seaUnits:TextField;
protected var startButton:TileSheetButton;
protected var campaignMenuData:CampaignMenuData;
protected var icon:Bitmap;
public function CampaignMenu(){
var _local7:BattalionPanel;
super();
xmlLoader = BattalionMain.getXMLLoader();
header = new Bitmap(BitmapLibrary.loadBitmap("campaign_header_jungle"));
addChild(header);
var _local1:BattalionPanel = new BattalionPanel(350, 100, BattalionPanel.SPOTTED, BattalionPanel.FRAME1);
_local1.x = 20;
_local1.y = -60;
addChild(_local1);
chapter = new DefaultTextField();
chapter.embedFonts = true;
chapter.filters = [new DropShadowFilter(2)];
var _local2:TextFormat = new ChatTextFormat();
_local2.size = 16;
_local2.color = 0xFFFFFF;
_local2.bold = true;
_local2.align = TextFormatAlign.CENTER;
chapter.defaultTextFormat = _local2;
chapter.x = _local1.x;
chapter.width = _local1.rWidth;
chapter.height = 40;
chapter.text = "";
addChild(chapter);
icon = new Bitmap(BitmapLibrary.loadBitmap("campaign_shield_NF"));
icon.x = 540;
icon.y = 25;
addChild(icon);
var _local3 = 140;
var _local4:MovieClip = new BattalionPanel(BattalionMain.WIDTH, (BattalionMain.HEIGHT - _local3));
_local4.y = _local3;
addChild(_local4);
var _local5:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("campaign_bg_icons"));
_local5.height = 250;
_local5.width = (_local5.width + 25);
_local5.x = 15;
_local5.y = (_local4.y + 15);
addChild(_local5);
var _local6 = 30;
groundUnits = drawIcon("build_icon_ground", (_local5.x + _local6), (_local5.y + 30));
airUnits = drawIcon("build_icon_air", (_local5.x + _local6), (_local5.y + 90));
seaUnits = drawIcon("build_icon_sea", (_local5.x + _local6), (_local5.y + 150));
resources = drawIcon("campaign_icon_money", (_local5.x + _local6), (_local5.y + 200));
_local7 = new BattalionPanel(330, 360, BattalionPanel.SPOTTED, BattalionPanel.FRAME2, "Mission Brief");
_local7.x = ((_local5.x + _local5.width) + 25);
_local7.y = (_local5.y + 8);
addChild(_local7);
missionText = new DefaultTextField(0);
var _local8:TextFormat = new ChatTextFormat();
_local8.size = 16;
missionText.defaultTextFormat = _local8;
missionText.width = 320;
missionText.height = 350;
missionText.x = (_local7.x + 5);
missionText.y = (_local7.y + 20);
missionText.embedFonts = true;
missionText.filters = [new DropShadowFilter(2)];
addChild(missionText);
missionText.text = "";
var _local9:DifficultyPanel = new DifficultyPanel(difficultyChangedCallback);
addChild(_local9);
_local9.x = 28;
_local9.y = 440;
mainMenuButton = new TileSheetButton("menuButton");
mainMenuButton.x = 30;
mainMenuButton.y = (BattalionMain.HEIGHT - mainMenuButton.height);
addChild(mainMenuButton);
levelButton = new TileSheetButton("button_levelselect");
levelButton.x = ((mainMenuButton.x + mainMenuButton.width) + 10);
levelButton.y = (BattalionMain.HEIGHT - levelButton.height);
addChild(levelButton);
startButton = new TileSheetButton("button_startgame");
startButton.x = ((BattalionMain.WIDTH - startButton.width) + 3);
startButton.y = ((BattalionMain.HEIGHT - startButton.height) + 3);
addChild(startButton);
createMinimap(_local4.y);
}
private function mainMenuHandler(_arg1:Event):void{
MenuManager.getInstance().switchMode(MenuManager.mainMenu, null);
}
private function startHandler(_arg1:Event):void{
var _local2:CampaignManager = CampaignManager.getInstance(campaignMenuData.getCampaign());
var _local3:int = BattalionMain.getStorage().getInt(_local2.getLevelName(), 0);
var _local4:XML = _local2.getMapSettings(_local3);
_local4.@difficulty = difficulty;
var _local5:MapSettings = MapSettings.getFromXML(_local4);
_local5.setCampaignName(campaignMenuData.getCampaign());
_local5.setCampaign(_local3);
var _local6:GameMenuData = new GameMenuData(_local2.getMapURL(_local3), _local2.getMapName(_local3), _local5);
MenuManager.getInstance().createSwitchMode(new GameMenu(), _local6);
}
private function createMinimap(_arg1:int):void{
var _local2:BattalionPanel = new BattalionPanel((WIDTH - 16), 50, BattalionPanel.SPOTTED, BattalionPanel.FRAME2, "Mission Preview");
_local2.x = 504;
_local2.y = (_arg1 + 22);
addChild(_local2);
var _local3:Sprite = new Sprite();
_local3.graphics.beginFill(0);
_local3.graphics.drawRect(0, 0, WIDTH, HEIGHT);
minimapBitmap = new Bitmap();
_local3.addChild(minimapBitmap);
var _local4:Bitmap = new Bitmap(FrameMaker.createFrame(BitmapLibrary.loadBitmap("frame1"), (WIDTH + 16), (HEIGHT + 16), 43, 43));
_local4.x = -8;
_local4.y = -8;
_local3.addChild(_local4);
_local3.x = (_local2.x - 9);
_local3.y = (_local2.y + 18);
addChild(_local3);
}
public function gainFocus():void{
mainMenuButton.enable();
startButton.enable();
levelButton.enable();
update();
}
public function popped():void{
if (campaignMenuData.restart){
return;
};
mainMenuButton.removeEventListener(MouseEvent.CLICK, mainMenuHandler);
mainMenuButton.disable();
startButton.removeEventListener(MouseEvent.CLICK, startHandler);
startButton.disable();
levelButton.removeEventListener(MouseEvent.CLICK, levelHandler);
levelButton.disable();
parent.removeChild(this);
}
private function xmlHandler(_arg1:Event):void{
var _local5:Map;
var _local6:Object;
xmlLoader.removeEventListener(Event.COMPLETE, xmlHandler);
var _local2:CampaignManager = CampaignManager.getInstance(campaignMenuData.getCampaign());
var _local3:int = BattalionMain.getStorage().getInt(_local2.getLevelName(), 0);
var _local4:XML = xmlLoader.get(_local2.getMapName(_local3));
if (_local4 != null){
_local5 = new Map(_local4, _local2.getMapURL(_local3), _local2.getMapName(_local3));
minimap = _local5.generateMiniMap();
minimapBitmap.bitmapData = minimap;
minimapBitmap.x = ((WIDTH - minimapBitmap.width) / 2);
minimapBitmap.y = ((HEIGHT - minimapBitmap.height) / 2);
_local6 = _local5.getNums();
groundUnits.text = _local6.ground.toString();
airUnits.text = _local6.air.toString();
seaUnits.text = _local6.sea.toString();
resources.text = parseInt(_local2.getMapSettings(_local3).@resources).toString();
};
}
private function levelHandler(_arg1:Event):void{
MenuManager.getInstance().pushMode(MenuManager.campaignSelectMenu, campaignMenuData);
}
public function pushed(_arg1:DisplayObjectContainer, _arg2:ModeData):void{
campaignMenuData = (_arg2 as CampaignMenuData);
if (!SoundSystem.instance.isPlaying("background")){
SoundSystem.instance.createLoop("background", AssetLibrary.createSound("UIWAV"));
};
if (campaignMenuData.restart){
startHandler(null);
} else {
update();
mainMenuButton.addEventListener(MouseEvent.CLICK, mainMenuHandler);
mainMenuButton.enable();
startButton.addEventListener(MouseEvent.CLICK, startHandler);
startButton.enable();
levelButton.addEventListener(MouseEvent.CLICK, levelHandler);
levelButton.enable();
_arg1.addChild(this);
};
}
public function loseFocus():void{
mainMenuButton.disable();
startButton.disable();
levelButton.disable();
}
public function update():void{
var _local1:CampaignManager = CampaignManager.getInstance(campaignMenuData.getCampaign());
var _local2:int = BattalionMain.getStorage().getInt(_local1.getLevelName(), 0);
var _local3:String = _local1.getBG(_local2);
header.bitmapData = BitmapLibrary.loadBitmap(_local1.getBG(_local2));
icon.bitmapData = BitmapLibrary.loadBitmap(("campaign_shield_" + _local1.getTeamIcon(_local2)));
chapter.text = _local1.getName(_local2);
missionText.text = _local1.getBrief(_local2);
minimapBitmap.bitmapData = null;
if (minimap != null){
minimap.dispose();
};
minimap = null;
groundUnits.text = "..";
airUnits.text = "..";
seaUnits.text = "..";
resources.text = "..";
xmlLoader.addEventListener(Event.COMPLETE, xmlHandler);
xmlLoader.add(_local1.getMapURL(_local2), _local1.getMapName(_local2));
xmlLoader.load();
}
protected function drawIcon(_arg1:String, _arg2:int, _arg3:int):TextField{
var _local4:Bitmap = new Bitmap(BitmapLibrary.loadBitmap(_arg1));
_local4.x = (_arg2 - (_local4.width / 2));
_local4.y = (_arg3 - (_local4.width / 2));
var _local5:TextField = new DefaultTextField();
var _local6:TextFormat = new ChatTextFormat();
_local6.size = 16;
_local5.defaultTextFormat = _local6;
_local5.embedFonts = true;
_local5.filters = [new DropShadowFilter(2)];
_local5.x = (_arg2 + 25);
_local5.y = _arg3;
addChild(_local4);
addChild(_local5);
return (_local5);
}
private function difficultyChangedCallback(_arg1:int):void{
difficulty = _arg1;
}
}
}//package com.gamedozer.battalion.ui
Section 144
//CampaignMenuData (com.gamedozer.battalion.ui.CampaignMenuData)
package com.gamedozer.battalion.ui {
import com.gamedozer.ui.modes.*;
public class CampaignMenuData extends ModeData {
protected var campaign:String;
public var restart:Boolean;
public function CampaignMenuData(_arg1:String, _arg2:Boolean=false){
this.restart = _arg2;
campaign = _arg1;
}
public function getCampaign():String{
return (campaign);
}
}
}//package com.gamedozer.battalion.ui
Section 145
//CampaignSelectMenu (com.gamedozer.battalion.ui.CampaignSelectMenu)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.ui.modes.*;
import flash.text.*;
import com.gamedozer.battalion.*;
public class CampaignSelectMenu extends Sprite implements ModeInterface {
public var buttons:Array;
public var frame:BattalionPanel;
public var backButton:TileSheetButton;
protected var campaignMenuData:CampaignMenuData;
public static const WIDTH:int = 230;
public static const HEIGHT:int = 375;
public function CampaignSelectMenu(){
graphics.beginFill(0, 0.5);
graphics.drawRect(0, 0, BattalionMain.WIDTH, BattalionMain.HEIGHT);
}
public function loseFocus():void{
}
public function gainFocus():void{
}
public function pushed(_arg1:DisplayObjectContainer, _arg2:ModeData):void{
var _local7:BattalionButton;
campaignMenuData = (_arg2 as CampaignMenuData);
_arg1.addChild(this);
var _local3:CampaignManager = CampaignManager.getInstance(campaignMenuData.getCampaign());
var _local4:int = BattalionMain.getStorage().getInt(_local3.getCompleteName(), 0);
buttons = new Array();
var _local5:int = (80 + ((Math.min(_local4, (_local3.numLevels() - 1)) + 1) * 35));
if (frame != null){
removeChild(frame);
};
frame = new BattalionPanel(WIDTH, _local5);
frame.x = ((BattalionMain.WIDTH / 2) - (WIDTH / 2));
frame.y = ((BattalionMain.HEIGHT / 2) - (_local5 / 2));
addChild(frame);
backButton = new TileSheetButton("closeButton");
backButton.x = ((WIDTH - backButton.width) - 5);
backButton.y = ((-(backButton.height) / 2) + 10);
backButton.enable();
frame.addChild(backButton);
backButton.addEventListener(MouseEvent.CLICK, backHandler);
var _local6:int;
while ((((_local6 <= _local4)) && ((_local6 < _local3.numLevels())))) {
_local7 = new BattalionButton((WIDTH - 30), 25, _local3.getName(_local6));
_local7.addEventListener(MouseEvent.CLICK, buttonPressHandler);
_local7.x = 15;
_local7.y = (65 + (_local6 * 35));
frame.addChild(_local7);
buttons.push(_local7);
_local6++;
};
}
public function backHandler(_arg1:Event):void{
MenuManager.getInstance().popMode();
}
public function buttonPressHandler(_arg1:Event):void{
var _local2:BattalionButton = (_arg1.target as BattalionButton);
var _local3:CampaignManager = CampaignManager.getInstance(campaignMenuData.getCampaign());
var _local4:int;
while (_local4 < buttons.length) {
if (buttons[_local4] == _local2){
BattalionMain.getStorage().setInt(_local3.getLevelName(), _local4);
break;
};
_local4++;
};
MenuManager.getInstance().popMode();
}
public function popped():void{
backButton.removeEventListener(MouseEvent.CLICK, backHandler);
parent.removeChild(this);
var _local1:int;
while (_local1 < buttons.length) {
buttons[_local1].removeEventListener(MouseEvent.CLICK, buttonPressHandler);
frame.removeChild(buttons[_local1]);
_local1++;
};
buttons = null;
}
}
}//package com.gamedozer.battalion.ui
Section 146
//ChatTextFormat (com.gamedozer.battalion.ui.ChatTextFormat)
package com.gamedozer.battalion.ui {
import flash.text.*;
public class ChatTextFormat extends TextFormat {
public function ChatTextFormat(){
super("TahomaEmbedded", 15, 0xFFFFFF);
}
}
}//package com.gamedozer.battalion.ui
Section 147
//ChatWindow (com.gamedozer.battalion.ui.ChatWindow)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.display.*;
import flash.text.*;
import com.gamedozer.battalion.game.*;
import flash.filters.*;
public class ChatWindow extends Sprite {
protected var message:TextField;
protected var messageIndex:int;
protected var closed:Boolean;// = false
protected var colorBar:Bitmap;
protected var continueButton:TileSheetButton;
protected var messageText:String;
protected var format:TextFormat;
protected var avatar:TileSheet;
public static var PANEL_HEIGHT:int = 154;
public function ChatWindow(_arg1:String, _arg2:String, _arg3:String, _arg4:uint){
var _local5:BattalionPanel = new BattalionPanel(GameManager.GAME_WIDTH, PANEL_HEIGHT);
_local5.alpha = 0.65;
addChild(_local5);
avatar = TileSheetManager.getInstance().get("avatars");
avatar.playAnimation(_arg3);
avatar.x = 2;
avatar.y = 2;
addChild(avatar);
colorBar = new Bitmap(ColoredSprite.colorise(BitmapLibrary.loadBitmap("colorBarLong"), null, _arg4));
colorBar.x = ((avatar.x + avatar.width) + 2);
colorBar.y = avatar.y;
addChild(colorBar);
message = new DefaultTextField();
message.embedFonts = true;
message.x = ((colorBar.x + colorBar.width) + 2);
message.y = 2;
message.width = ((GameManager.GAME_WIDTH - message.x) - 5);
message.height = (PANEL_HEIGHT - 4);
format = new ChatTextFormat();
message.defaultTextFormat = format;
messageText = ((_arg1 + ":\n") + insertNewLines(_arg2));
message.htmlText = "";
message.defaultTextFormat = format;
messageIndex = 0;
message.filters = [new DropShadowFilter(2)];
addChild(message);
continueButton = new TileSheetButton("continueButton");
continueButton.x = (GameManager.GAME_WIDTH - 160);
continueButton.y = (PANEL_HEIGHT - 45);
continueButton.enable();
addChild(continueButton);
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function display():void{
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
messageIndex = (messageText.length + 1);
message.htmlText = messageText;
message.defaultTextFormat = format;
}
public function setDisplay(_arg1:String, _arg2:String, _arg3:String, _arg4:uint):void{
avatar.playAnimation(_arg3);
removeChild(colorBar);
colorBar = new Bitmap(ColoredSprite.colorise(BitmapLibrary.loadBitmap("colorBarLong"), null, _arg4));
colorBar.x = ((avatar.x + avatar.width) + 2);
colorBar.y = avatar.y;
addChild(colorBar);
if (messageIndex > messageText.length){
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
};
messageText = ((_arg1 + ":\n") + insertNewLines(_arg2));
message.htmlText = "";
message.defaultTextFormat = format;
messageIndex = 0;
}
public function enterFrameHandler(_arg1:Event):void{
messageIndex++;
if (messageIndex > messageText.length){
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
} else {
message.htmlText = messageText.substring(0, messageIndex);
message.defaultTextFormat = format;
};
}
public function isDisplayed():Boolean{
return ((messageIndex > messageText.length));
}
private function insertNewLines(_arg1:String):String{
var _local7:String;
var _local8:Number;
var _local2 = "";
_arg1 = _arg1.split("\r").join("");
_arg1 = _arg1.split("\\n").join("\n");
var _local3:Array = _arg1.split("\n");
var _local4:String = _local3.join(" <br>");
var _local5:Array = _local4.split(" ");
_local2 = (_local2 + _local5[0]);
message.htmlText = _local2;
message.defaultTextFormat = format;
var _local6 = 1;
while (_local6 < _local5.length) {
_local7 = _local5[_local6];
_local8 = message.numLines;
message.appendText((" " + _local7));
message.defaultTextFormat = format;
if (message.numLines > _local8){
_local7 = ("<br>" + _local7);
} else {
_local7 = (" " + _local7);
};
_local2 = (_local2 + _local7);
message.htmlText = _local2;
message.defaultTextFormat = format;
_local6++;
};
message.htmlText = "";
message.defaultTextFormat = format;
return (_local2);
}
}
}//package com.gamedozer.battalion.ui
Section 148
//ConfirmMenu (com.gamedozer.battalion.ui.ConfirmMenu)
package com.gamedozer.battalion.ui {
import flash.events.*;
import flash.display.*;
import com.gamedozer.ui.modes.*;
import flash.text.*;
import com.gamedozer.battalion.*;
public class ConfirmMenu extends Sprite implements ModeInterface {
public var backButton:TileSheetButton;
private var functionData:ConfirmMenuData;
public var text:TextField;
public var frame:BattalionPanel;
public var yesButton:TileSheetButton;
public static const WIDTH:int = 250;
public static const HEIGHT:int = 200;
public function ConfirmMenu(){
var _local1:BattalionPanel;
super();
graphics.beginFill(0, 0.5);
graphics.drawRect(0, 0, BattalionMain.WIDTH, BattalionMain.HEIGHT);
frame = new BattalionPanel(WIDTH, HEIGHT);
frame.x = ((BattalionMain.WIDTH / 2) - (WIDTH / 2));
frame.y = ((BattalionMain.HEIGHT / 2) - (HEIGHT / 2));
addChild(frame);
backButton = new TileSheetButton("noButton");
backButton.x = (((frame.x + WIDTH) - backButton.width) - 5);
backButton.y = ((frame.y - (backButton.height / 2)) + 10);
addChild(backButton);
yesButton = new TileSheetButton("yesButton");
yesButton.x = (frame.x + 5);
yesButton.y = ((frame.y - (yesButton.height / 2)) + 10);
addChild(yesButton);
_local1 = new BattalionPanel(200, 75, BattalionPanel.SPOTTED, BattalionPanel.FRAME2);
_local1.x = (frame.x + 25);
_local1.y = (frame.y + 100);
addChild(_local1);
text = new DefaultTextField(0);
text.width = 190;
text.x = (_local1.x + 5);
text.y = (_local1.y + 5);
addChild(text);
}
private function yesHandler(_arg1:MouseEvent):void{
MenuManager.getInstance().popMode();
if (functionData.yes != null){
functionData.yes();
};
}
public function gainFocus():void{
}
public function pushed(_arg1:DisplayObjectContainer, _arg2:ModeData):void{
functionData = (_arg2 as ConfirmMenuData);
_arg1.addChild(this);
backButton.addEventListener(MouseEvent.CLICK, backHandler);
backButton.enable();
yesButton.addEventListener(MouseEvent.CLICK, yesHandler);
yesButton.enable();
text.text = functionData.text;
}
public function loseFocus():void{
}
public function backHandler(_arg1:Event):void{
MenuManager.getInstance().popMode();
if (functionData.no != null){
functionData.no();
};
}
public function popped():void{
backButton.removeEventListener(MouseEvent.CLICK, backHandler);
backButton.disable();
yesButton.removeEventListener(MouseEvent.CLICK, yesHandler);
yesButton.disable();
parent.removeChild(this);
}
}
}//package com.gamedozer.battalion.ui
Section 149
//ConfirmMenuData (com.gamedozer.battalion.ui.ConfirmMenuData)
package com.gamedozer.battalion.ui {
import com.gamedozer.ui.modes.*;
public class ConfirmMenuData extends ModeData {
public var no:Function;
public var yes:Function;
public var text:String;
public function ConfirmMenuData(_arg1:String, _arg2:Function=null, _arg3:Function=null){
this.text = _arg1;
this.yes = _arg2;
this.no = _arg3;
}
}
}//package com.gamedozer.battalion.ui
Section 150
//CreditsMenu (com.gamedozer.battalion.ui.CreditsMenu)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.ui.modes.*;
import flash.text.*;
public class CreditsMenu extends Sprite implements ModeInterface {
public var message:TextField;
public var backButton:TileSheetButton;
public var frame:BattalionPanel;
private var textBox:BattalionPanel;
public function CreditsMenu(){
var _local1:BitmapData = BitmapLibrary.loadBitmap("title");
addChild(new Bitmap(_local1));
frame = new BattalionPanel(400, 300);
frame.x = 200;
frame.y = 150;
addChild(frame);
var _local2:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("creditsLabel"));
_local2.x = (frame.x + 15);
_local2.y = (frame.y + 15);
addChild(_local2);
textBox = new BattalionPanel(350, 200, BattalionPanel.SPOTTED, BattalionPanel.FRAME2);
textBox.x = (frame.x + 25);
textBox.y = (frame.y + 75);
addChild(textBox);
backButton = new TileSheetButton("closeButton");
backButton.x = (((frame.x + 400) - backButton.width) - 5);
backButton.y = ((frame.y - (backButton.height / 2)) + 10);
addChild(backButton);
message = new DefaultTextField(0, TextFormatAlign.CENTER);
message.x = (textBox.x + 5);
message.y = (textBox.y + 5);
message.width = 340;
var _local3:Array = [];
_local3.push("Battalion Nemesis");
_local3.push("");
_local3.push("");
_local3.push("An Urbansquall production");
_local3.push("");
_local3.push("");
_local3.push("");
_local3.push("");
_local3.push("Programming:");
_local3.push("");
_local3.push("");
_local3.push("Christopher Rhodes");
_local3.push("Panayoti Haritatos");
_local3.push("");
_local3.push("");
_local3.push("Art:");
_local3.push("Christian Hildenbrand");
_local3.push("Tim Wendorf");
_local3.push("Anthony Blinco");
_local3.push("Christopher Rhodes");
_local3.push("");
_local3.push("");
_local3.push("Game Design:");
_local3.push("Panayoti Haritatos");
_local3.push("Andrew Pellerano");
_local3.push("");
_local3.push("");
_local3.push("Writing:");
_local3.push("Michael Scarpelli");
_local3.push("");
_local3.push("");
_local3.push("Level Design:");
_local3.push("Forest Go");
_local3.push("Panayoti Haritatos");
_local3.push("");
_local3.push("");
_local3.push("Sound & Music:");
_local3.push("Matt Sayre");
_local3.push("Zack Parrish");
_local3.push("");
_local3.push("");
_local3.push("Additional Programming:");
_local3.push("Andrew Pellerano");
_local3.push("");
_local3.push("");
_local3.push("Special Thanks:");
_local3.push("Hans Lemurson");
_local3.push("firehawk");
_local3.push("squarecircleco.");
_local3.push("Sprite Attack");
message.text = _local3.join("\n");
message.height = (message.textHeight + 5);
addChild(message);
var _local4:Shape = new Shape();
_local4.graphics.beginFill(0, 1);
_local4.graphics.drawRect((textBox.x + 5), (textBox.y + 5), 340, 190);
_local4.graphics.endFill();
addChild(_local4);
message.mask = _local4;
}
public function loseFocus():void{
}
public function popped():void{
backButton.removeEventListener(MouseEvent.CLICK, backHandler);
backButton.disable();
parent.removeChild(this);
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function backHandler(_arg1:Event):void{
MenuManager.getInstance().switchMode(MenuManager.mainMenu, null);
}
public function gainFocus():void{
}
private function enterFrameHandler(_arg1:Event):void{
message.y = (message.y - 0.2);
if ((message.y + message.height) < (textBox.y + 5)){
message.y = ((textBox.y + 5) + 200);
};
}
public function pushed(_arg1:DisplayObjectContainer, _arg2:ModeData):void{
_arg1.addChild(this);
backButton.addEventListener(MouseEvent.CLICK, backHandler);
backButton.enable();
message.y = ((textBox.y + 5) + 200);
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
}
}//package com.gamedozer.battalion.ui
Section 151
//DefaultTextField (com.gamedozer.battalion.ui.DefaultTextField)
package com.gamedozer.battalion.ui {
import flash.text.*;
public class DefaultTextField extends TextField {
public function DefaultTextField(_arg1:uint=4294967295, _arg2:String="left", _arg3:Boolean=false){
var _local4:TextFormat = new DefaultTextFormat();
_local4.color = _arg1;
_local4.align = _arg2;
_local4.bold = _arg3;
defaultTextFormat = _local4;
selectable = false;
multiline = true;
wordWrap = true;
antiAliasType = AntiAliasType.ADVANCED;
}
}
}//package com.gamedozer.battalion.ui
Section 152
//DefaultTextFormat (com.gamedozer.battalion.ui.DefaultTextFormat)
package com.gamedozer.battalion.ui {
import flash.text.*;
public class DefaultTextFormat extends TextFormat {
public function DefaultTextFormat(){
super("Tahoma", 10, 4278190080);
}
}
}//package com.gamedozer.battalion.ui
Section 153
//DifficultyOption (com.gamedozer.battalion.ui.DifficultyOption)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.display.*;
import flash.text.*;
import com.gamedozer.battalion.*;
public class DifficultyOption extends Sprite {
var avatar:TileSheet;
var playerName:TextField;
var colorBar:Bitmap;
public var index:int;
var rankBadge:TileSheet;
public static var WIDTH:int = 80;
public static var HEIGHT:int = 37;
public function DifficultyOption(_arg1:int, _arg2:uint, _arg3:String, _arg4:String){
index = _arg1;
var _local5:Sprite = new Sprite();
_local5.graphics.beginBitmapFill(BitmapLibrary.loadBitmap("spotted_texture"));
_local5.graphics.drawRect(0, 0, WIDTH, HEIGHT);
addChild(_local5);
colorBar = new Bitmap(ColoredSprite.colorise(BitmapLibrary.loadBitmap("colorBar"), null, _arg2));
colorBar.x = 0;
colorBar.y = 2;
addChild(colorBar);
rankBadge = TileSheetManager.getInstance().get("rankBadges");
var _local6 = 1;
if (index == 1){
_local6 = 2;
};
if (index == 2){
_local6 = 6;
};
rankBadge.setFrame(_local6);
rankBadge.x = 15;
rankBadge.y = 9;
addChild(rankBadge);
playerName = new DefaultTextField();
playerName.x = 38;
playerName.y = 9;
playerName.width = 106;
var _local7:TextFormat = new DefaultTextFormat();
_local7.color = 0;
playerName.defaultTextFormat = _local7;
playerName.text = _arg3;
addChild(playerName);
addEventListener(MouseEvent.MOUSE_OVER, overHandler);
addEventListener(MouseEvent.MOUSE_OUT, outHandler);
}
protected function overHandler(_arg1:Event):void{
BattalionMain.getMouseCursor().setCursor("select");
}
protected function outHandler(_arg1:Event):void{
BattalionMain.getMouseCursor().setCursor("default");
}
}
}//package com.gamedozer.battalion.ui
Section 154
//DifficultyPanel (com.gamedozer.battalion.ui.DifficultyPanel)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.*;
public class DifficultyPanel extends Sprite {
var callback:Function;
var arrow:Sprite;
var panels:Array;
public static var WIDTH:int = DifficultyOption.WIDTH;
public static var HEIGHT:int = 111;
public function DifficultyPanel(_arg1:Function){
var _local9:DifficultyOption;
super();
callback = _arg1;
var _local2:BattalionPanel = new BattalionPanel((WIDTH - 8), 50, BattalionPanel.SPOTTED, BattalionPanel.FRAME2, "AI Difficulty");
_local2.x = 5;
_local2.y = -25;
addChild(_local2);
var _local3:Array = ["Easy", "Normal", "Hard"];
var _local4:Array = [4278255360, 3435973632, 4294901760];
var _local5:Array = ["tucker", "mullen", "evil_durand_dark"];
panels = new Array();
var _local6:int;
while (_local6 < 3) {
_local9 = new DifficultyOption(_local6, _local4[_local6], _local3[_local6], _local5[_local6]);
_local9.y = (_local6 * PlayerPanel.HEIGHT);
addChild(_local9);
panels.push(_local9);
_local9.addEventListener(MouseEvent.CLICK, clickPanel);
_local6++;
};
var _local7:Bitmap = new Bitmap(FrameMaker.createFrame(BitmapLibrary.loadBitmap("frame1"), (WIDTH + 30), (HEIGHT + 30), 39, 39));
_local7.x = -15;
_local7.y = -15;
addChild(_local7);
arrow = new Sprite();
arrow.addChild(new Bitmap(BitmapLibrary.loadBitmap("playerpointer")));
arrow.x = (-(arrow.width) + 16);
addChild(arrow);
var _local8:int = BattalionMain.getStorage().getInt("aidifficulty", 1);
changeSelection(_local8);
}
public function changeSelection(_arg1:int):void{
arrow.y = (((_arg1 * DifficultyOption.HEIGHT) + (DifficultyOption.HEIGHT / 2)) - (arrow.height / 2));
callback(_arg1);
BattalionMain.getStorage().setInt("aidifficulty", _arg1);
}
public function clickPanel(_arg1:Event):void{
var _local2:int = (_arg1.currentTarget as DifficultyOption).index;
changeSelection(_local2);
}
}
}//package com.gamedozer.battalion.ui
Section 155
//FrameMaker (com.gamedozer.battalion.ui.FrameMaker)
package com.gamedozer.battalion.ui {
import flash.display.*;
import flash.geom.*;
public class FrameMaker {
public static function fillArea(_arg1:BitmapData, _arg2:BitmapData, _arg3:Rectangle, _arg4:Rectangle):void{
var _local8:int;
var _local5:int = (_arg3.x + _arg3.width);
var _local6:int = (_arg3.y + _arg3.height);
var _local7:int = _arg3.y;
while (_local7 < _local6) {
_local8 = _arg3.x;
while (_local8 < _local5) {
_arg1.copyPixels(_arg2, _arg4, new Point(_local8, _local7));
_local8 = (_local8 + _arg4.width);
};
_local7 = (_local7 + _arg4.width);
};
}
public static function createBlock(_arg1:BitmapData, _arg2:int, _arg3:int):Sprite{
var _local5:Bitmap;
var _local6:Sprite;
var _local4:Sprite = new Sprite();
_local5 = new Bitmap(_arg1);
_local6 = new Sprite();
_local6.graphics.beginFill(0);
_local6.graphics.drawRect(0, 0, _arg2, _arg3);
_local5.mask = _local6;
_local5.x = (-(Math.random()) * (_local5.width - _arg2));
_local5.y = (-(Math.random()) * (_local5.height - _arg3));
_local4.addChild(_local6);
_local4.addChild(_local5);
return (_local4);
}
public static function createFrame(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:Boolean=true):BitmapData{
if (((_arg4 * 2) + 1) > _arg1.width){
return (null);
};
if (((_arg5 * 2) + 1) > _arg1.height){
return (null);
};
if ((_arg4 * 2) > _arg2){
return (null);
};
if ((_arg5 * 2) > _arg3){
return (null);
};
var _local7:BitmapData = new BitmapData(_arg2, _arg3, _arg1.transparent, _arg1.getPixel32(0, 0));
fillArea(_local7, _arg1, new Rectangle(_arg4, 0, (_arg2 - _arg4), _arg5), new Rectangle(_arg4, 0, (_arg1.width - (_arg4 * 2)), _arg5));
fillArea(_local7, _arg1, new Rectangle(0, _arg5, _arg4, (_arg3 - _arg5)), new Rectangle(0, _arg4, _arg4, (_arg1.height - (_arg5 * 2))));
fillArea(_local7, _arg1, new Rectangle(_arg4, _arg5, (_arg2 - _arg4), (_arg3 - _arg5)), new Rectangle(_arg4, _arg5, (_arg1.width - (_arg4 * 2)), (_arg1.height - (_arg5 * 2))));
fillArea(_local7, _arg1, new Rectangle((_arg2 - _arg4), _arg5, _arg4, (_arg3 - _arg5)), new Rectangle((_arg1.width - _arg4), _arg4, _arg4, (_arg1.height - (_arg5 * 2))));
fillArea(_local7, _arg1, new Rectangle(_arg4, (_arg3 - _arg5), (_arg2 - _arg4), _arg5), new Rectangle(_arg4, (_arg1.height - _arg5), (_arg1.width - (_arg4 * 2)), _arg5));
_local7.copyPixels(_arg1, new Rectangle(0, 0, _arg4, _arg5), new Point(0, 0));
_local7.copyPixels(_arg1, new Rectangle((_arg1.width - _arg4), 0, _arg4, _arg5), new Point((_arg2 - _arg4), 0));
_local7.copyPixels(_arg1, new Rectangle(0, (_arg1.height - _arg5), _arg4, _arg5), new Point(0, (_arg3 - _arg5)));
_local7.copyPixels(_arg1, new Rectangle((_arg1.width - _arg4), (_arg1.height - _arg5), _arg4, _arg5), new Point((_arg2 - _arg4), (_arg3 - _arg5)));
return (_local7);
}
}
}//package com.gamedozer.battalion.ui
Section 156
//GameMenu (com.gamedozer.battalion.ui.GameMenu)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.ui.modes.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
import com.gamedozer.battalion.game.triggers.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.game.actions.*;
import flash.ui.*;
public class GameMenu extends Sprite implements ModeInterface {
protected var active:Boolean;
public var mainMenuButton:TileSheetButton;
protected var restart:Boolean;// = false
protected var lastTimer:int;// = 0
protected var cleanUpGame:Boolean;// = false
protected var earlyQuit:Boolean;// = false
public var gameMenuData:GameMenuData;
public function GameMenu(){
active = false;
TweenManager.getInstance().clear();
mainMenuButton = new TileSheetButton("optionsButton");
mainMenuButton.x = 30;
mainMenuButton.y = (BattalionMain.HEIGHT - mainMenuButton.height);
mainMenuButton.disable();
}
public function pushed(_arg1:DisplayObjectContainer, _arg2:ModeData):void{
active = false;
gameMenuData = (_arg2 as GameMenuData);
_arg1.addChild(this);
var _local3:XMLLoader = BattalionMain.getXMLLoader();
var _local4:XML = gameMenuData.getLoadData();
_local3.addEventListener(Event.COMPLETE, startGame);
if (_local4 == null){
_local3.add(gameMenuData.getURL(), gameMenuData.getName());
} else {
_local3.add(_local4.@mapurl, _local4.@mapname);
};
_local3.load();
}
public function loseFocus():void{
}
public function cleanUp():void{
active = false;
var _local1:GameManager = GameManager.getInstance();
if (_local1 != null){
_local1.dispose();
};
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
gameMenuData.setComplete(!(earlyQuit));
if (!earlyQuit){
BattalionMain.getStorage().setXML("saveGame", null);
MenuManager.getInstance().switchMode(MenuManager.gameOverMenu, gameMenuData);
} else {
if (restart){
MenuManager.getInstance().switchMode(MenuManager.campaignMenu, new CampaignMenuData(gameMenuData.getMapSettings().getCampaignName(), restart));
} else {
MenuManager.getInstance().switchMode(MenuManager.mainMenu, null);
};
};
}
private function enterFrameHandler(_arg1:Event):void{
var game:GameManager;
var e:String;
var a_event = _arg1;
if (!active){
return;
};
var timer:int = getTimer();
var time:int = (timer - lastTimer);
lastTimer = timer;
try {
game = GameManager.getInstance();
if (game != null){
game.update(time);
};
if (cleanUpGame){
cleanUp();
};
} catch(a_error:Error) {
e = a_error.getStackTrace();
endGame(false);
throw (new Error(e));
};
}
public function gainFocus():void{
}
public function popped():void{
parent.removeChild(this);
}
private function mainMenuHandler(_arg1:Event):void{
if (mainMenuButton.enabled){
MenuManager.getInstance().pushMode(MenuManager.ingameOptionsMenu, null);
};
}
private function startGame(_arg1:Event):void{
var _local7:Map;
var _local8:String;
var _local9:String;
var _local10:Map;
var _local11:MapSettings;
active = true;
cleanUpGame = false;
var _local2:XMLLoader = BattalionMain.getXMLLoader();
_local2.removeEventListener(Event.COMPLETE, startGame);
var _local3:XML = _local2.get(BattalionMain.XML_NAME);
var _local4:XML = gameMenuData.getLoadData();
if (_local4 == null){
_local7 = new Map(_local2.get(gameMenuData.getName()), gameMenuData.getURL(), gameMenuData.getName());
gameMenuData.getMapSettings().setMap(_local7);
new GameManager(this, gameMenuData.getMapSettings());
GameManager.getInstance().importBallisticsTable(_local2.get(_local3..ballisticstable.@name));
} else {
_local8 = _local4.@mapname;
_local9 = _local4.@mapurl;
_local10 = new Map(_local2.get(_local8), _local9, _local8);
_local11 = MapSettings.getFromXML(_local4..mapsettings[0]);
gameMenuData.setMapSettings(_local11);
_local11.setMap(_local10);
new GameManager(this, _local11, _local4..script[0]);
GameManager.getInstance().importBallisticsTable(_local2.get(_local3..ballisticstable.@name));
};
var _local5:Sprite = GameManager.getInstance().getSprite();
_local5.y = 9;
addChild(GameManager.getInstance().getSprite());
var _local6:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("mainframe"));
addChild(_local6);
addChild(GameManager.getInstance().getPlayerPanel());
addChild(GameManager.getInstance().getMiniMap());
addChild(GameManager.getInstance().getInfoMenu());
addChild(GameManager.getInstance().getEndTurnButton());
addChild(GameManager.getInstance().getNextUnitButton());
addChild(mainMenuButton);
mainMenuButton.addEventListener(MouseEvent.CLICK, mainMenuHandler);
mainMenuButton.disable();
lastTimer = getTimer();
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
public function endGame(_arg1:Boolean, _arg2:Boolean=false):void{
if (!active){
return;
};
this.restart = _arg2;
cleanUpGame = true;
earlyQuit = !(_arg1);
}
}
}//package com.gamedozer.battalion.ui
Section 157
//GameMenuData (com.gamedozer.battalion.ui.GameMenuData)
package com.gamedozer.battalion.ui {
import com.gamedozer.battalion.data.*;
import com.gamedozer.ui.modes.*;
public class GameMenuData extends ModeData {
protected var name:String;
protected var url:String;
protected var loadData:XML;
protected var complete:Boolean;
protected var mapSettings:MapSettings;
public function GameMenuData(_arg1:String, _arg2:String, _arg3:MapSettings=null, _arg4:XML=null){
name = _arg2;
url = _arg1;
mapSettings = _arg3;
loadData = _arg4;
complete = false;
}
public function getName():String{
return (name);
}
public function getLoadData():XML{
return (loadData);
}
public function reset():void{
complete = false;
}
public function getURL():String{
return (url);
}
public function getMapSettings():MapSettings{
return (mapSettings);
}
public function toString():String{
return (((name + " ") + url));
}
public function getComplete():Boolean{
return (complete);
}
public function setComplete(_arg1:Boolean):void{
complete = _arg1;
}
public function setMapSettings(_arg1:MapSettings):void{
mapSettings = _arg1;
}
}
}//package com.gamedozer.battalion.ui
Section 158
//GameOverMenu (com.gamedozer.battalion.ui.GameOverMenu)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.ui.modes.*;
import com.gamedozer.battalion.audio.*;
import com.kongregate.as3.client.*;
import flash.text.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.assets.*;
import flash.filters.*;
public class GameOverMenu extends Sprite implements ModeInterface {
protected var sprite:Sprite;
protected var mainMenuButton:TileSheetButton;
protected var header:Bitmap;
protected var top:BattalionPanel;
protected var icon:Bitmap;
protected var chapter:TextField;
protected var result:TextField;
protected var finalVictoryDisplay:Sprite;
protected var gameMenuData:GameMenuData;
public function GameOverMenu(){
header = new Bitmap(BitmapLibrary.loadBitmap("campaign_header_jungle"));
addChild(header);
top = new BattalionPanel(350, 100, BattalionPanel.SPOTTED, BattalionPanel.FRAME1);
top.x = 20;
top.y = -60;
addChild(top);
chapter = new DefaultTextField();
chapter.embedFonts = true;
var _local1:TextFormat = new ChatTextFormat();
_local1.align = "center";
chapter.defaultTextFormat = _local1;
var _local2:TextFormat = new DefaultTextFormat();
_local2.size = 16;
_local2.color = 0xFFFFFF;
_local2.bold = true;
_local2.align = TextFormatAlign.CENTER;
chapter.x = top.x;
chapter.width = top.rWidth;
chapter.height = 40;
chapter.text = "";
chapter.filters = [new DropShadowFilter(2)];
addChild(chapter);
var _local3:MovieClip = new BattalionPanel(BattalionMain.WIDTH, (BattalionMain.HEIGHT - header.height));
_local3.y = header.height;
addChild(_local3);
icon = new Bitmap(BitmapLibrary.loadBitmap("campaign_shield_NF"));
icon.x = 540;
icon.y = 25;
addChild(icon);
result = new DefaultTextField();
_local2 = new ChatTextFormat();
_local2.size = 70;
result.width = 600;
result.autoSize = TextFieldAutoSize.LEFT;
result.x = ((BattalionMain.WIDTH / 2) - (result.width / 2));
result.y = 60;
result.defaultTextFormat = _local2;
result.embedFonts = true;
result.filters = [new DropShadowFilter(2)];
addChild(result);
mainMenuButton = new TileSheetButton("button_finish");
mainMenuButton.x = ((BattalionMain.WIDTH - mainMenuButton.width) + 3);
mainMenuButton.y = ((BattalionMain.HEIGHT - mainMenuButton.height) - 3);
addChild(mainMenuButton);
}
public function loseFocus():void{
}
private function hideFinalVictoryDisplay(_arg1:Event):void{
removeChild(finalVictoryDisplay);
finalVictoryDisplay = null;
MenuManager.getInstance().switchMode(MenuManager.mainMenu, null);
}
private function playUI():void{
if (!SoundSystem.instance.isPlaying("background")){
SoundSystem.instance.createLoop("background", AssetLibrary.createSound("UIWAV"));
};
}
public function gainFocus():void{
}
private function mainMenuHandler(_arg1:Event):void{
var _local2:String = gameMenuData.getMapSettings().getCampaignName();
var _local3:CampaignManager = CampaignManager.getInstance(_local2);
var _local4:int = gameMenuData.getMapSettings().getCampaign();
if (((((!((_local4 == -1))) && (((_local4 + 1) >= _local3.numLevels())))) && (!((_local3.getFinalVictoryImage() == ""))))){
KongregateAPI.getInstance().stats.submit("Completed Campaign", 1);
} else {
if (((((!((_local4 == -1))) && (((_local4 + 1) >= _local3.numLevels())))) && ((_local2 == "Bootcamp")))){
KongregateAPI.getInstance().stats.submit("Completed Bootcamp", 1);
};
};
if (((!((_local4 == -1))) && ((_local4 < (_local3.numLevels() - 1))))){
MenuManager.getInstance().switchMode(MenuManager.campaignMenu, new CampaignMenuData(gameMenuData.getMapSettings().getCampaignName()));
} else {
if (((((!((_local4 == -1))) && (((_local4 + 1) >= _local3.numLevels())))) && (!((_local3.getFinalVictoryImage() == ""))))){
finalVictoryDisplay = new Sprite();
finalVictoryDisplay.addChild(new Bitmap(BitmapLibrary.loadBitmap(_local3.getFinalVictoryImage())));
addChild(finalVictoryDisplay);
finalVictoryDisplay.addEventListener(MouseEvent.CLICK, hideFinalVictoryDisplay);
} else {
MenuManager.getInstance().switchMode(MenuManager.mainMenu, null);
};
};
}
public function popped():void{
mainMenuButton.removeEventListener(MouseEvent.CLICK, mainMenuHandler);
mainMenuButton.disable();
removeChild(sprite);
parent.removeChild(this);
}
protected function drawBox(_arg1:uint, _arg2:Number, _arg3:String, _arg4:int, _arg5:int, _arg6:int):Sprite{
var _local7:Sprite = new Sprite();
var _local8:TextField = new DefaultTextField();
var _local9:TextFormat = _local8.defaultTextFormat;
_local9.size = 14;
_local8.defaultTextFormat = _local9;
_local8.text = _arg3;
_local8.width = _arg6;
_local8.height = (_local8.textHeight + 5);
_local7.graphics.beginFill(_arg1, _arg2);
_local7.graphics.drawRect(0, 0, _local8.width, _local8.height);
_local7.addChild(_local8);
_local7.x = _arg4;
_local7.y = _arg5;
return (_local7);
}
public function pushed(_arg1:DisplayObjectContainer, _arg2:ModeData):void{
var _local3:BattalionPanel;
var _local16:int;
var _local17:int;
var _local18:int;
sprite = new Sprite();
gameMenuData = (_arg2 as GameMenuData);
if (!gameMenuData.getComplete()){
MenuManager.getInstance().switchMode(MenuManager.mainMenu, null);
return;
};
_local3 = new BattalionPanel(480, 0xFF, BattalionPanel.SPOTTED, BattalionPanel.FRAME2);
_local3.x = 135;
_local3.y = 200;
addChild(_local3);
mainMenuButton.addEventListener(MouseEvent.CLICK, mainMenuHandler);
mainMenuButton.enable();
var _local4:Boolean;
var _local5:int;
var _local6:Array = gameMenuData.getMapSettings().getTeams();
var _local7:int;
while (_local7 < _local6.length) {
if (_local6[_local7].getActive()){
if (_local6[_local7].getControllerType() == "Human"){
_local4 = true;
_local5 = _local7;
};
};
_local7++;
};
if (_local4){
KongregateAPI.getInstance().stats.submit("Games Won", 1);
SoundSystem.instance.playSound(SoundSystem.instance.createSound("VictoryWAV"), 1);
result.text = "You Win!";
} else {
KongregateAPI.getInstance().stats.submit("Games Lost", 1);
SoundSystem.instance.playSound(SoundSystem.instance.createSound("DefeatWAV"), 1);
result.text = "You Lose!";
};
chapter.text = "";
top.visible = false;
var _local8:String = gameMenuData.getMapSettings().getCampaignName();
var _local9:CampaignManager = CampaignManager.getInstance(_local8);
var _local10:int = gameMenuData.getMapSettings().getCampaign();
if (_local10 != -1){
if (_local4){
_local16 = BattalionMain.getStorage().getInt(_local9.getCompleteName(), -1);
_local17 = _local10;
if ((_local10 + 1) > _local16){
BattalionMain.getStorage().setInt(_local9.getCompleteName(), (_local10 + 1));
_local17 = _local16;
};
if ((_local10 + 1) < _local9.numLevels()){
BattalionMain.getStorage().setInt(_local9.getLevelName(), (_local10 + 1));
_local17 = (_local10 + 1);
};
if (_local8 == "Bootcamp"){
KongregateAPI.getInstance().stats.submit("Bootcamp Progress", (_local17 + 1));
} else {
if (_local8 == "Campaign"){
KongregateAPI.getInstance().stats.submit("Campaign Progress", (_local17 + 1));
};
};
};
header.bitmapData = BitmapLibrary.loadBitmap(_local9.getBG(_local10));
icon.bitmapData = BitmapLibrary.loadBitmap(("campaign_shield_" + _local9.getTeamIcon(_local10)));
chapter.text = _local9.getName(_local10);
top.visible = true;
} else {
if (_local4){
KongregateAPI.getInstance().stats.submit("Completed Bonus Map", 1);
};
};
var _local11:Array = ["Team", "Units Built", "Units Killed", "Units Lost", "Structures Captured", "Structures Lost", "Resources Collected", "Final Score"];
var _local12:Sprite = drawBox(0, 0, "HEIGHT TESTy", 0, 0, 100);
var _local13 = 150;
var _local14:int = _local12.height;
_local7 = 0;
while (_local7 < _local11.length) {
_local12 = drawBox(0, (((_local7 % 2))==0) ? 0.4 : 0.5, _local11[_local7], 50, ((header.height + 50) + (_local7 * _local14)), _local13);
sprite.addChild(_local12);
_local7++;
};
var _local15:int = BattalionMain.getStorage().getInt((gameMenuData.getURL() + "_bestScore"), 0);
_local7 = 0;
while (_local7 < _local6.length) {
_local6[_local7].calculateFinalScore();
_local12 = drawBox(0, (((_local7 % 2))==0) ? 0.3 : 0.4, _local6[_local7].getName(), (50 + ((_local7 + 1) * _local13)), (header.height + 50), _local13);
sprite.addChild(_local12);
_local18 = 0;
while (_local18 < (Team.STATISTICS - 1)) {
_local12 = drawBox(0, ((((_local7 + _local18) % 2))==0) ? 0.1 : 0.2, _local6[_local7].getStatistic(_local18), (50 + ((_local7 + 1) * _local13)), ((header.height + 50) + ((_local18 + 1) * _local14)), _local13);
sprite.addChild(_local12);
_local18++;
};
if (_local6[_local7].getStatistic(Team.FINAL_SCORE) > _local15){
_local15 = _local6[_local7].getStatistic(Team.FINAL_SCORE);
};
_local7++;
};
BattalionMain.getStorage().setInt((gameMenuData.getURL() + "_bestScore"), _local15);
_local12 = drawBox(0, 0.6, ("Best Score: " + _local15.toString()), 50, ((header.height + 50) + ((Team.STATISTICS + 1) * _local14)), ((_local6.length + 1) * _local13));
sprite.addChild(_local12);
sprite.x = (sprite.x + 100);
addChild(sprite);
_arg1.addChild(this);
}
}
}//package com.gamedozer.battalion.ui
Section 159
//InfoIcon (com.gamedozer.battalion.ui.InfoIcon)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.display.*;
import flash.geom.*;
import flash.text.*;
import com.gamedozer.battalion.game.*;
public class InfoIcon extends Sprite {
protected var description:String;
protected var info:Sprite;
protected var icon:TileSheet;
protected var image:String;
public function InfoIcon(_arg1:String, _arg2:String, _arg3:String){
image = _arg1;
name = _arg2;
description = _arg3;
icon = TileSheetManager.getInstance().get("info_icons");
icon.playAnimation(image);
addChild(icon);
icon.addEventListener(MouseEvent.MOUSE_OVER, overHandler);
icon.addEventListener(MouseEvent.MOUSE_OUT, outHandler);
}
override public function get width():Number{
return (icon.width);
}
override public function get height():Number{
return (icon.height);
}
function outHandler(_arg1:Event):void{
if (info != null){
info.visible = false;
};
}
function overHandler(_arg1:Event):void{
var _local3:Sprite;
var _local4:TextField;
var _local5:TextField;
var _local6:Sprite;
var _local7:Sprite;
var _local8:Point;
if (info == null){
info = new Sprite();
_local3 = new Sprite();
_local4 = new DefaultTextField(0xFFFFFF, TextFormatAlign.CENTER);
_local4.text = name;
_local4.width = 150;
_local4.height = (_local4.textHeight + 5);
_local5 = new DefaultTextField(0);
_local5.text = description;
_local5.width = 150;
_local5.width = Math.min(150, (_local5.textWidth + 5));
_local5.height = (_local5.textHeight + 5);
_local5.y = _local4.height;
_local3.addChild(_local4);
_local3.addChild(_local5);
_local6 = FrameMaker.createBlock(BitmapLibrary.loadBitmap("spotted_texture"), _local3.width, _local3.height);
_local7 = new Sprite();
_local7.graphics.lineStyle(1, 0, 0.75);
_local7.graphics.drawRect(0, 0, _local3.width, _local3.height);
_local7.graphics.lineStyle(1, 0, 0);
_local7.graphics.beginFill(0, 0.5);
_local7.graphics.drawRect(0, 0, _local4.width, _local4.height);
_local6.addChild(_local7);
info.addChild(_local6);
info.addChild(_local3);
addChild(info);
info.y = (-(_local3.height) - 5);
info.x = (-(_local3.width) + icon.width);
_local8 = info.localToGlobal(new Point(0, 0));
if (_local8.y < GameManager.getInstance().getSprite().y){
info.y = (icon.height + 5);
};
if (_local8.x < GameManager.getInstance().getSprite().x){
info.x = 0;
};
} else {
info.visible = true;
};
var _local2:DisplayObjectContainer = parent;
parent.removeChild(this);
_local2.addChild(this);
}
}
}//package com.gamedozer.battalion.ui
Section 160
//InfoMenu (com.gamedozer.battalion.ui.InfoMenu)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import flash.geom.*;
import flash.text.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.game.controllers.*;
public class InfoMenu extends Sprite {
var bg:Sprite;
var active;
var rangeText:TextField;
var sprite:GameSprite;
var title:TextField;
var controller:Controller;// = null
var weaponText:TextField;
var lock:Boolean;
var info:Sprite;
var healthText:TextField;
var icons:Array;
public static const ICONY:int = 16;
public static const ICONW:int = 56;
public static const WIDTH:int = 130;
public static const HEIGHT:int = 153;
public function InfoMenu(_arg1:Boolean=true){
var _local4:Bitmap;
icons = new Array();
super();
bg = new Sprite();
var _local2:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("playerboxbehind"));
_local2.height = HEIGHT;
_local2.width = WIDTH;
bg.addChild(_local2);
if (_arg1){
_local4 = new Bitmap(FrameMaker.createFrame(BitmapLibrary.loadBitmap("frame2"), (WIDTH + 30), (HEIGHT + 30), 39, 39));
_local4.x = -15;
_local4.y = -15;
bg.addChild(_local4);
};
addChild(bg);
title = new DefaultTextField();
title.width = WIDTH;
title.height = ICONY;
var _local3:TextFormat = new DefaultTextFormat();
_local3.align = TextFormatAlign.CENTER;
_local3.bold = true;
title.defaultTextFormat = _local3;
addChild(title);
lock = false;
active = null;
}
public function update():void{
var _local1:Unit;
var _local2:String;
var _local3:String;
var _local4:String;
var _local5:String;
var _local6:Tile;
if ((active is Unit)){
if (active.isAlive()){
_local1 = (active as Unit);
_local2 = ((Math.floor(_local1.getHealth()) + "/") + _local1.getUnitData().getHealth());
_local3 = (((("[" + _local1.getUnitData().getWeaponRangeMin()) + "-") + _local1.getUnitData().getWeaponRangeMax()) + "]");
if ((((_local1.getUnitData().getWeaponRangeMin() == 1)) && ((_local1.getUnitData().getWeaponRangeMax() == 1)))){
_local3 = "";
};
_local4 = ((_local1.getUnitData().getDamage() + " ") + _local3);
if (_local1.getUnitData().getDamage() <= 0){
_local4 = "N/A";
};
_local5 = _local1.getUnitData().getRange().toString();
healthText.text = _local2;
weaponText.text = _local4;
rangeText.text = _local5;
} else {
if (info != null){
if (info.parent != null){
removeChild(info);
};
info = null;
};
if (sprite != null){
if (sprite.parent != null){
bg.removeChild(sprite);
};
sprite = null;
};
title.text = "";
};
} else {
if ((active is Tile)){
_local6 = (active as Tile);
if (controller != _local6.getController()){
active = null;
setTile(_local6, false, true);
};
};
};
}
public function clear():void{
active = null;
}
public function setUnitData(_arg1:UnitData, _arg2:Controller, _arg3:Boolean=false):void{
var _local4:GameUnit = new GameUnit(TileSheetManager.getInstance().getColorised(_arg1.getSprite(), _arg2.getTeam().getColor()));
var _local5:Unit = new Unit(_local4, _arg1);
setUnit(_local5, _arg3);
}
public function setUnit(_arg1:Unit, _arg2:Boolean=false):void{
if (lock){
return;
};
lock = _arg2;
if (_arg1 == null){
return;
};
if (_arg1 == active){
return;
};
active = _arg1;
icons.splice(0);
if (sprite != null){
bg.removeChild(sprite);
sprite = null;
};
if (info != null){
removeChild(info);
info = null;
};
sprite = _arg1.getGameUnit().getSprite().clone();
sprite.y = (ICONY + ((ICONW - sprite.height) / 2));
sprite.x = (((ICONW - sprite.width) / 2) + 1);
bg.addChildAt(sprite, 1);
title.text = _arg1.getUnitData().getName();
info = new Sprite();
addChild(info);
var _local3 = 2;
var _local4:String = ("Armor: " + UnitData.titleArmorTypes[_arg1.getUnitData().getArmorType()]);
var _local5:String = UnitData.descriptionArmorTypes[_arg1.getUnitData().getArmorType()];
var _local6:String = ((Math.floor(_arg1.getHealth()) + "/") + _arg1.getUnitData().getHealth());
healthText = drawIcon((ICONW + _local3), (ICONY + 1), ("armor_" + UnitData.armorTypes[_arg1.getUnitData().getArmorType()]), "Health:", _local6, _local4, _local5);
var _local7:String = ("Weapon: " + UnitData.titleWeaponTypes[_arg1.getUnitData().getWeaponType()]);
var _local8 = "This unit cannot fire.";
if (_arg1.getUnitData().getDamage() > 0){
_local8 = (((("This unit does " + _arg1.getUnitData().getDamage()) + " damage against normal armor. ") + UnitData.descriptionWeaponTypes[_arg1.getUnitData().getWeaponType()]) + "\n\n");
if (_arg1.getUnitData().getWeaponRangeMax() > 1){
_local8 = (_local8 + (((("This unit can fire on enemy units that are " + _arg1.getUnitData().getWeaponRangeMin()) + " to ") + _arg1.getUnitData().getWeaponRangeMax()) + " squares away."));
} else {
_local8 = (_local8 + "This unit can only fire on neighboring enemy units.");
};
};
var _local9 = (((((_arg1.getUnitData().getDamage() + " (") + _arg1.getUnitData().getWeaponRangeMin()) + "-") + _arg1.getUnitData().getWeaponRangeMax()) + ")");
weaponText = drawIcon((ICONW + _local3), (ICONY + 22), ("weapon_" + UnitData.weaponTypes[_arg1.getUnitData().getWeaponType()]), "Damage:", _local9, _local7, _local8);
var _local10:String = _arg1.getUnitData().getRange().toString();
var _local11:String = ("Movement: " + UnitData.titleMovementTypes[_arg1.getUnitData().getMovementType()]);
var _local12:String = UnitData.descriptionMovementTypes[_arg1.getUnitData().getMovementType()];
rangeText = drawIcon((ICONW + _local3), (ICONY + 43), UnitData.movementTypes[_arg1.getUnitData().getMovementType()], "Move:", _local10, _local11, _local12);
var _local13:TextField = createDescription();
_local13.text = _arg1.getUnitData().getDescription();
_local13.y = ((54 + 16) + 5);
info.addChild(_local13);
drawModifiers(_arg1.getUnitData().getAllModifiers());
}
public function isMousingOverInfo():Boolean{
var _local4:DisplayObject;
if (info == null){
return (false);
};
if (icons == null){
return (false);
};
var _local1:int = info.mouseX;
var _local2:int = info.mouseY;
var _local3:int;
while (_local3 < icons.length) {
_local4 = icons[_local3];
if (_local1 > _local4.x){
if (_local1 < (_local4.x + _local4.width)){
if (_local2 > _local4.y){
if (_local2 < (_local4.y + _local4.height)){
return (true);
};
};
};
};
_local3++;
};
return (false);
}
protected function drawIcon(_arg1:int, _arg2:int, _arg3:String, _arg4:String, _arg5:String, _arg6:String, _arg7:String):TextField{
var _local8:InfoIcon = new InfoIcon(_arg3, _arg6, _arg7);
_local8.x = _arg1;
_local8.y = _arg2;
var _local9:TextField = new DefaultTextField(0, TextFormatAlign.LEFT, true);
_local9.x = ((_arg1 + _local8.width) + 2);
_local9.y = (_arg2 - 4);
_local9.text = _arg4;
var _local10:TextField = new DefaultTextField(0);
_local10.x = ((_arg1 + _local8.width) + 2);
_local10.y = (_arg2 + 6);
_local10.text = _arg5;
info.addChild(_local9);
info.addChild(_local10);
info.addChild(_local8);
icons.push(_local8);
return (_local10);
}
protected function drawModifiers(_arg1:Array):void{
var _local3:Modifier;
var _local7:InfoIcon;
var _local2 = 1;
var _local4 = -5;
var _local5 = -5;
var _local6:int;
while (_local6 < _arg1.length) {
_local3 = _arg1[_local6];
if (_local3.getVisible()){
_local7 = new InfoIcon(_local3.getImage(), _local3.getName(), _local3.getDescription());
_local7.y = ((HEIGHT - _local7.height) + _local4);
_local7.x = ((WIDTH - (_local2 * (1 + _local7.width))) + _local5);
info.addChild(_local7);
icons.push(_local7);
_local2++;
};
_local6++;
};
}
private function createDescription():TextField{
var _local1 = 2;
var _local2:TextField = new DefaultTextField(4278190080);
_local2.x = _local1;
_local2.y = 16;
_local2.width = (WIDTH - (_local1 * 2));
_local2.height = 75;
return (_local2);
}
public function setLock(_arg1:Boolean):void{
lock = _arg1;
}
public function getActive(){
return (active);
}
public function setTile(_arg1:Tile, _arg2:Boolean=false, _arg3:Boolean=false):void{
if (lock){
return;
};
lock = _arg2;
if (_arg1 == null){
return;
};
if (((!((_arg1.getUnit() == null))) && (!(_arg3)))){
if (((!(_arg1.getUnit().isCloaked())) || ((_arg1.getUnit().getController() == GameManager.getInstance().getActiveController())))){
setUnit(_arg1.getUnit());
return;
};
};
if (_arg1 == active){
return;
};
icons.splice(0);
active = _arg1;
if (sprite != null){
bg.removeChild(sprite);
sprite = null;
};
if (info != null){
removeChild(info);
info = null;
};
if (_arg1.isStructure()){
sprite = _arg1.getStructure().clone();
} else {
sprite = _arg1.getGameTile().getSprite().clone();
};
sprite.y = (HEIGHT - TileManager.getInstance().getHeight());
if (sprite.height > TileManager.getInstance().getHeight()){
sprite.y = (sprite.y - (sprite.height - TileManager.getInstance().getHeight()));
};
sprite.y = (sprite.y - 5);
sprite.x = (((ICONW - TileManager.getInstance().getWidth()) / 2) + 3);
bg.addChildAt(sprite, 1);
var _local4:String = _arg1.getTerrain().getName();
if (_local4 == "Factory"){
_local4 = "Warfactory";
};
title.text = _local4;
info = new Sprite();
addChild(info);
var _local5:TextField = createDescription();
_local5.text = _arg1.getTerrain().getDescription();
info.addChild(_local5);
drawModifiers(_arg1.getTerrain().getModifiers());
controller = _arg1.getController();
}
}
}//package com.gamedozer.battalion.ui
Section 161
//IngameOptionsMenu (com.gamedozer.battalion.ui.IngameOptionsMenu)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import com.gamedozer.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.ui.modes.*;
import com.gamedozer.battalion.audio.*;
import flash.text.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.*;
public class IngameOptionsMenu extends Sprite implements ModeInterface {
public var backButton:TileSheetButton;
public var saveButton:TileSheetButton;
public var quitAndNoSaveButton:TileSheetButton;
public var restartButton:TileSheetButton;
public var soundButton:ToggleableTileSheetButton;
public var dialogButton:ToggleableTileSheetButton;
public var frame:BattalionPanel;
public var musicButton:ToggleableTileSheetButton;
public static const WIDTH:int = 560;
public static const HEIGHT:int = 230;
public function IngameOptionsMenu(){
var _local1:int;
super();
graphics.beginFill(0, 0.5);
graphics.drawRect(0, 0, BattalionMain.WIDTH, BattalionMain.HEIGHT);
frame = new BattalionPanel(WIDTH, HEIGHT);
frame.x = ((BattalionMain.WIDTH / 2) - (WIDTH / 2));
frame.y = ((BattalionMain.HEIGHT / 2) - (HEIGHT / 2));
addChild(frame);
backButton = new TileSheetButton("closeButton");
backButton.x = (((frame.x + WIDTH) - backButton.width) - 5);
backButton.y = (((frame.y + HEIGHT) - backButton.height) - 5);
addChild(backButton);
_local1 = 110;
restartButton = new TileSheetButton("restartButton");
restartButton.x = (frame.x + 5);
restartButton.y = ((frame.y - restartButton.height) + _local1);
addChild(restartButton);
saveButton = new TileSheetButton("saveButton");
saveButton.x = ((restartButton.x + restartButton.width) + 5);
saveButton.y = ((frame.y - saveButton.height) + _local1);
addChild(saveButton);
quitAndNoSaveButton = new TileSheetButton("quitAndNoSaveButton");
quitAndNoSaveButton.x = (saveButton.x + saveButton.width);
quitAndNoSaveButton.y = ((frame.y - quitAndNoSaveButton.height) + _local1);
addChild(quitAndNoSaveButton);
var _local2:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("SoundLabel"));
_local2.x = (frame.x + 20);
_local2.y = ((restartButton.y + restartButton.height) + 15);
addChild(_local2);
soundButton = new ToggleableTileSheetButton("soundButton");
soundButton.x = _local2.x;
soundButton.y = (_local2.y + 25);
addChild(soundButton);
var _local3:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("MusicLabel"));
_local3.x = ((soundButton.x + soundButton.width) + 25);
_local3.y = _local2.y;
addChild(_local3);
musicButton = new ToggleableTileSheetButton("musicButton");
musicButton.x = _local3.x;
musicButton.y = (_local3.y + 25);
addChild(musicButton);
var _local4:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("dialogLabel"));
_local4.x = ((musicButton.x + musicButton.width) + 25);
_local4.y = _local3.y;
addChild(_local4);
dialogButton = new ToggleableTileSheetButton("dialogButton");
dialogButton.x = _local4.x;
dialogButton.y = (_local4.y + 25);
addChild(dialogButton);
update();
}
public function loseFocus():void{
}
private function scheduleStorageIncrease():void{
this.addEventListener(Event.ENTER_FRAME, tickIncreaseStorage);
}
private function quitAndNoSaveConfirm():void{
GameManager.getInstance().getParent().endGame(false);
}
private function saveHandler(_arg1:MouseEvent):void{
var _local2:int = BattalionMain.getStorage().getInt("increasedStorage", 0);
if (_local2 == 0){
MenuManager.getInstance().pushMode(MenuManager.confirmMenu, new ConfirmMenuData("In order to save your game, we need more game storage. Please click \"Yes\" to open the storage increase popup or \"No\" to cancel and return to the options menu.", scheduleStorageIncrease));
return;
};
MenuManager.getInstance().pushMode(MenuManager.confirmMenu, new ConfirmMenuData("Are you sure you want to save and quit? You can continue from this point in the main menu when you return.", saveConfirm));
}
private function update():void{
soundButton.toggled = BattalionMain.getStorage().getBoolean("sound", true);
musicButton.toggled = BattalionMain.getStorage().getBoolean("music", true);
dialogButton.toggled = BattalionMain.getStorage().getBoolean("dialog", true);
}
private function saveConfirm():void{
BattalionMain.getStorage().setXML("saveGame", GameManager.getInstance().toXML());
GameManager.getInstance().getParent().endGame(false);
}
private function restartHandler(_arg1:MouseEvent):void{
MenuManager.getInstance().pushMode(MenuManager.confirmMenu, new ConfirmMenuData("Are you sure you want to restart?", restartConfirm));
}
public function gainFocus():void{
}
public function popped():void{
BattalionMain.setMusicButtonVisibility(true);
backButton.removeEventListener(MouseEvent.CLICK, backHandler);
backButton.disable();
restartButton.removeEventListener(MouseEvent.CLICK, restartHandler);
restartButton.disable();
quitAndNoSaveButton.removeEventListener(MouseEvent.CLICK, quitAndNoSaveHandler);
quitAndNoSaveButton.disable();
saveButton.removeEventListener(MouseEvent.CLICK, saveHandler);
saveButton.disable();
soundButton.removeEventListener(Event.CHANGE, soundHandler);
musicButton.removeEventListener(Event.CHANGE, musicHandler);
dialogButton.removeEventListener(Event.CHANGE, dialogHandler);
parent.removeChild(this);
}
private function dialogHandler(_arg1:Event):void{
var _local2:Storage = BattalionMain.getStorage();
_local2.setBoolean("dialog", _arg1.target.toggled);
}
public function backHandler(_arg1:Event):void{
MenuManager.getInstance().popMode();
}
private function quitAndNoSaveHandler(_arg1:MouseEvent):void{
MenuManager.getInstance().pushMode(MenuManager.confirmMenu, new ConfirmMenuData("Are you sure you want to quit without saving? You will have to restart this mission when you return.", quitAndNoSaveConfirm));
}
private function musicHandler(_arg1:Event):void{
var _local2:Boolean = _arg1.target.toggled;
var _local3:Storage = BattalionMain.getStorage();
_local3.setBoolean("music", _local2);
BattalionMain.updateSoundSystem();
}
private function restartConfirm():void{
GameManager.getInstance().getParent().endGame(false, true);
}
public function pushed(_arg1:DisplayObjectContainer, _arg2:ModeData):void{
BattalionMain.setMusicButtonVisibility(false);
_arg1.addChild(this);
backButton.addEventListener(MouseEvent.CLICK, backHandler);
backButton.enable();
restartButton.addEventListener(MouseEvent.CLICK, restartHandler);
restartButton.enable();
quitAndNoSaveButton.addEventListener(MouseEvent.CLICK, quitAndNoSaveHandler);
quitAndNoSaveButton.enable();
saveButton.addEventListener(MouseEvent.CLICK, saveHandler);
saveButton.enable();
soundButton.addEventListener(Event.CHANGE, soundHandler);
soundButton.enable();
musicButton.addEventListener(Event.CHANGE, musicHandler);
musicButton.enable();
dialogButton.addEventListener(Event.CHANGE, dialogHandler);
dialogButton.enable();
update();
}
private function soundHandler(_arg1:Event):void{
var _local2:Boolean = _arg1.target.toggled;
var _local3:Storage = BattalionMain.getStorage();
_local3.setBoolean("sound", _local2);
BattalionMain.updateSoundSystem();
}
private function tickIncreaseStorage(_arg1:Event):void{
if (!BattalionMain.getStorage().hasAllocatedSpace(500000)){
return;
};
BattalionMain.getStorage().setInt("increasedStorage", 1);
this.removeEventListener(Event.ENTER_FRAME, tickIncreaseStorage);
saveConfirm();
}
}
}//package com.gamedozer.battalion.ui
Section 162
//LoadingPanel (com.gamedozer.battalion.ui.LoadingPanel)
package com.gamedozer.battalion.ui {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.assets.*;
public class LoadingPanel extends Sprite {
var m_ticksBeforeHighlightChange:int;// = 0
var m_yHighlight:int;// = 0
var m_xHighlight:int;// = 0
var m_timer:Timer;
var m_yDirection:int;// = 1
var m_loadingPanels:Array;
private static const MAX_DISTANCE:int = 5;
private static const TILE_SIZE:Number = 56;
private static const PANEL_X_COUNT:int = Math.ceil((BattalionMain.WIDTH / TILE_SIZE));
private static const PANEL_Y_COUNT:int = Math.ceil((600 / TILE_SIZE));
public function LoadingPanel(){
var _local2:int;
var _local5:int;
var _local6:Bitmap;
super();
this.graphics.beginFill(0);
this.graphics.drawRect(0, 0, BattalionMain.WIDTH, 600);
m_timer = new Timer(60);
m_timer.addEventListener(TimerEvent.TIMER, tick);
m_timer.start();
var _local1:BitmapData = AssetLibrary.createBitmapData("selectRed");
m_loadingPanels = new Array();
_local2 = 0;
while (_local2 < PANEL_X_COUNT) {
m_loadingPanels.push(new Array());
_local5 = 0;
while (_local5 < PANEL_Y_COUNT) {
_local6 = new Bitmap(_local1);
_local6.x = (TILE_SIZE * _local2);
_local6.y = (TILE_SIZE * _local5);
_local6.alpha = 0;
addChild(_local6);
m_loadingPanels[_local2].push(_local6);
_local5++;
};
_local2++;
};
var _local3:TextField = new DefaultTextField(0xFFFFFF);
var _local4:TextFormat = new ChatTextFormat();
_local3.embedFonts = true;
_local4.size = 26;
_local3.defaultTextFormat = _local4;
_local3.text = "Loading";
_local3.autoSize = TextFieldAutoSize.LEFT;
_local3.x = (BattalionMain.WIDTH - _local3.width);
_local3.y = (600 - _local3.height);
this.addChild(_local3);
}
private function updateHighlight():void{
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:Bitmap;
if (m_xHighlight >= PANEL_X_COUNT){
m_xHighlight = 0;
};
if ((((m_yHighlight >= PANEL_X_COUNT)) || ((m_yHighlight < 0)))){
m_yDirection = (m_yDirection * -1);
};
var _local1:int;
while (_local1 < PANEL_X_COUNT) {
_local2 = 0;
while (_local2 < PANEL_Y_COUNT) {
_local3 = (Math.abs((m_xHighlight - _local1)) + Math.abs((m_yHighlight - _local2)));
_local4 = (_local3 / MAX_DISTANCE);
_local5 = m_loadingPanels[_local1][_local2];
_local5.alpha = (1 - _local4);
_local2++;
};
_local1++;
};
m_xHighlight++;
m_yHighlight = (m_yHighlight + m_yDirection);
}
public function stop():void{
m_timer.removeEventListener(TimerEvent.TIMER, tick);
m_timer.stop();
m_timer = null;
this.removeEventListener(Event.ENTER_FRAME, tick, false);
this.addEventListener(Event.ENTER_FRAME, fadeOut);
}
public function fadeOut(_arg1:Event):void{
this.alpha = (this.alpha - 0.07);
if (this.alpha <= 0.1){
this.removeEventListener(Event.ENTER_FRAME, fadeOut);
this.parent.removeChild(this);
};
}
private function tick(_arg1:TimerEvent):void{
if (this.parent.getChildIndex(this) < (this.parent.numChildren - 1)){
this.parent.setChildIndex(this, (this.parent.numChildren - 1));
};
updateHighlight();
}
}
}//package com.gamedozer.battalion.ui
Section 163
//MainMenu (com.gamedozer.battalion.ui.MainMenu)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import com.gamedozer.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.ui.modes.*;
import com.gamedozer.battalion.audio.*;
import com.kongregate.as3.client.*;
import flash.text.*;
import com.gamedozer.battalion.*;
import com.gamedozer.battalion.assets.*;
import flash.filters.*;
public class MainMenu extends Sprite implements ModeInterface {
public var bonusMapButton:TileSheetButton;
var menu:MainMenu;
public var restoreButton:TileSheetButton;
public var campaignButton:TileSheetButton;
public var bootCampButton:TileSheetButton;
public var frame:BattalionPanel;
public var optionsButton:TileSheetButton;
public function MainMenu(){
var _local6:Number;
super();
updateStats();
var _local1:BitmapData = BitmapLibrary.loadBitmap("title");
addChild(new Bitmap(_local1));
var _local2:GameSprite = new GameSprite();
_local2.addChild(new Bitmap(BitmapLibrary.loadBitmap("mainmenu_kong_logo")));
var _local3:GameButton = new GameButton(_local2, "select");
_local3.x = ((BattalionMain.WIDTH / 2) - (_local2.width / 2));
_local3.y = 300;
_local3.addEventListener(MouseEvent.CLICK, BattalionMain.visitSponsor);
_local3.addEventListener(MouseEvent.ROLL_OVER, rolloverSponsor);
_local3.addEventListener(MouseEvent.ROLL_OUT, rolloutSponsor);
addChild(_local3);
var _local4:Number = 172;
var _local5:Number = 140;
_local6 = 10;
var _local7:Number = ((4 * _local4) + (2 * _local6));
var _local8:Number = (_local5 + (2 * _local6));
frame = new BattalionPanel(_local7, _local8);
frame.x = ((BattalionMain.WIDTH - _local7) / 2);
frame.y = 380;
addChild(frame);
restoreButton = new TileSheetButton("restoreButton");
restoreButton.x = ((392 - (restoreButton.width / 2)) + 12);
restoreButton.y = (600 - restoreButton.height);
addChild(restoreButton);
bootCampButton = new TileSheetButton("bootCampButton");
bootCampButton.x = (_local6 + 14);
bootCampButton.y = (_local6 + 15);
frame.addChild(bootCampButton);
campaignButton = new TileSheetButton("campaignButton");
campaignButton.x = ((bootCampButton.x + bootCampButton.width) + _local6);
campaignButton.y = _local6;
frame.addChild(campaignButton);
optionsButton = new TileSheetButton("optionsMainButton");
optionsButton.x = ((campaignButton.x + campaignButton.width) + _local6);
optionsButton.y = (((_local6 + campaignButton.height) - optionsButton.height) + 2);
frame.addChild(optionsButton);
bonusMapButton = new TileSheetButton("bonusMapButton");
bonusMapButton.x = ((optionsButton.x + optionsButton.width) + _local6);
bonusMapButton.y = ((_local6 + bonusMapButton.height) - bonusMapButton.height);
frame.addChild(bonusMapButton);
menu = this;
}
public function loseFocus():void{
}
public function pushed(_arg1:DisplayObjectContainer, _arg2:ModeData):void{
if (!SoundSystem.instance.isPlaying("background")){
SoundSystem.instance.createLoop("background", AssetLibrary.createSound("UIWAV"));
};
var _local3:XML = BattalionMain.getStorage().getXML("saveGame", null);
if (_local3 != null){
restoreButton.addEventListener(MouseEvent.CLICK, continueHandler);
restoreButton.enabled = true;
restoreButton.alpha = 1;
restoreButton.enable();
restoreButton.visible = true;
} else {
restoreButton.visible = false;
restoreButton.enabled = false;
restoreButton.disable();
};
campaignButton.enable();
bootCampButton.enable();
optionsButton.enable();
bonusMapButton.enable();
campaignButton.addEventListener(MouseEvent.CLICK, campaignButtonHandler);
bonusMapButton.addEventListener(MouseEvent.CLICK, bonusMapButtonHandler);
bootCampButton.addEventListener(MouseEvent.CLICK, bootCampHandler);
optionsButton.addEventListener(MouseEvent.CLICK, optionsHandler);
_arg1.addChild(menu);
}
private function rolloverSponsor(_arg1:MouseEvent):void{
var _local2:DisplayObject = (_arg1.target as DisplayObject);
_local2.filters = [new GlowFilter(0xBF0000, 1, 10, 10)];
}
private function optionsHandler(_arg1:MouseEvent):void{
MenuManager.getInstance().pushMode(MenuManager.optionsMenu, null);
}
private function updateStats():void{
var _local3:String;
var _local4:CampaignManager;
var _local5:int;
var _local6:int;
var _local1:Array = ["Bootcamp", "Campaign"];
var _local2:int;
while (_local2 < _local1.length) {
_local3 = _local1[_local2];
_local4 = CampaignManager.getInstance(_local3);
if (_local4 != null){
_local5 = BattalionMain.getStorage().getInt(_local4.getLevelName(), 0);
_local6 = BattalionMain.getStorage().getInt(_local4.getCompleteName(), -1);
trace(("Complete " + _local6));
trace(("Num levels " + _local4.numLevels()));
if (_local6 >= _local4.numLevels()){
if (_local3 == "Bootcamp"){
KongregateAPI.getInstance().stats.submit("Completed Bootcamp", 1);
} else {
if (_local3 == "Campaign"){
KongregateAPI.getInstance().stats.submit("Completed Campaign", 1);
};
};
};
};
_local2++;
};
}
function campaignButtonHandler(_arg1:MouseEvent):void{
var _local3:ConfirmMenuData;
var _local2:Storage = BattalionMain.getStorage();
if (!_local2.getBoolean("attemptedBootcamp", false)){
_local3 = new ConfirmMenuData("Boot Camp has a lot of tactical information that will make it easier to tackle the Campaign. Are you sure you want to do the Campaign without doing Boot Camp first? ", startCampaign);
MenuManager.getInstance().pushMode(MenuManager.confirmMenu, _local3);
return;
};
startCampaign();
}
public function gainFocus():void{
}
function startCampaign():void{
var _local1:Storage = BattalionMain.getStorage();
_local1.setBoolean("attemptedBootcamp", true);
var _local2:XMLLoader = BattalionMain.getXMLLoader();
var _local3:XML = _local2.get(BattalionMain.XML_NAME);
MenuManager.getInstance().switchMode(MenuManager.campaignMenu, new CampaignMenuData("Campaign"));
}
private function continueHandler(_arg1:MouseEvent):void{
MenuManager.getInstance().createSwitchMode(new GameMenu(), new GameMenuData("", "", null, BattalionMain.getStorage().getXML("saveGame", null)));
BattalionMain.getStorage().setXML("saveGame", null);
}
private function rolloutSponsor(_arg1:MouseEvent):void{
var _local2:DisplayObject = (_arg1.target as DisplayObject);
_local2.filters = [];
}
public function popped():void{
campaignButton.removeEventListener(MouseEvent.CLICK, campaignButtonHandler);
bonusMapButton.removeEventListener(MouseEvent.CLICK, bonusMapButtonHandler);
bootCampButton.removeEventListener(MouseEvent.CLICK, bootCampHandler);
optionsButton.removeEventListener(MouseEvent.CLICK, optionsHandler);
restoreButton.removeEventListener(MouseEvent.CLICK, continueHandler);
menu.parent.removeChild(menu);
campaignButton.disable();
restoreButton.disable();
bootCampButton.disable();
optionsButton.disable();
}
function bootCampHandler(_arg1:MouseEvent):void{
var _local2:Storage = BattalionMain.getStorage();
_local2.setBoolean("attemptedBootcamp", true);
var _local3:XMLLoader = BattalionMain.getXMLLoader();
var _local4:XML = _local3.get(BattalionMain.XML_NAME);
MenuManager.getInstance().switchMode(MenuManager.campaignMenu, new CampaignMenuData("Bootcamp"));
}
function bonusMapButtonHandler(_arg1:MouseEvent):void{
var _local6:ConfirmMenuData;
if (((!(BattalionMain.isKongregateWebsite())) && ((this.stage.root.loaderInfo.url.indexOf("file://") == -1)))){
_local6 = new ConfirmMenuData("The bonus level is available only on Kongregate. Click \"Yes\" to open Battalion on Kongregate in a new window, or click \"No\" to return to the main menu.", BattalionMain.visitKongregatesBattalionPage);
MenuManager.getInstance().pushMode(MenuManager.confirmMenu, _local6);
return;
};
var _local2:XMLLoader = BattalionMain.getXMLLoader();
var _local3:XML = _local2.get(BattalionMain.XML_NAME);
var _local4:MapSettings = new MapSettings(int.MAX_VALUE, 500, 1);
_local4.addTeam(new Team("Red Team", "Red Federation", "tucker", 6, 4294901760, _local3.player1.@type, 0));
_local4.addTeam(new Team("Blue Team", "Blue Constitution", "durand", 1, 4278190335, _local3.player2.@type, 0));
var _local5:GameMenuData = new GameMenuData(_local3.loadmap.@url, _local3.loadmap.@name, _local4);
MenuManager.getInstance().createSwitchMode(new GameMenu(), _local5);
}
}
}//package com.gamedozer.battalion.ui
Section 164
//MenuManager (com.gamedozer.battalion.ui.MenuManager)
package com.gamedozer.battalion.ui {
import flash.display.*;
import com.gamedozer.ui.modes.*;
public class MenuManager extends ModeManager {
public static const gameOverMenu:String = "gameOverMenu";
public static const ingameOptionsMenu:String = "ingameOptionsMenu";
public static const campaignSelectMenu:String = "campaignSelectMenu";
public static const campaignMenu:String = "campaignMenu";
public static const mainMenu:String = "mainMenu";
public static const creditsMenu:String = "creditsMenu";
public static const optionsMenu:String = "optionsMenu";
public static const confirmMenu:String = "confirmMenu";
static var singleton:MenuManager;
public function MenuManager(_arg1:DisplayObjectContainer){
super(_arg1);
singleton = this;
createModes();
}
public function createModes():void{
registerMode(mainMenu, new MainMenu());
registerMode(campaignMenu, new CampaignMenu());
registerMode(gameOverMenu, new GameOverMenu());
registerMode(campaignSelectMenu, new CampaignSelectMenu());
registerMode(optionsMenu, new OptionsMenu());
registerMode(ingameOptionsMenu, new IngameOptionsMenu());
registerMode(confirmMenu, new ConfirmMenu());
registerMode(creditsMenu, new CreditsMenu());
}
public static function getInstance():MenuManager{
if (singleton == null){
throw (new Error("MenuManager::No instance exists"));
};
return (singleton);
}
}
}//package com.gamedozer.battalion.ui
Section 165
//MiniMap (com.gamedozer.battalion.ui.MiniMap)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import flash.text.*;
import com.gamedozer.battalion.game.*;
import com.gamedozer.battalion.*;
public class MiniMap extends Sprite {
protected var ratio:Number;
protected var dragging:Boolean;
var string:TextField;
protected var drag:Sprite;
protected var invRatio:Number;
var map:Sprite;
public static const HEIGHT:int = 184;
public static const MIN_WIDTH_FOOTPRINT:int = 132;
private static var WIDTH:int = 184;
public function MiniMap(_arg1:BitmapData){
var _local2:Bitmap;
super();
WIDTH = _arg1.width;
WIDTH = Math.max(MIN_WIDTH_FOOTPRINT, WIDTH);
graphics.beginFill(0);
graphics.drawRect(0, 0, WIDTH, HEIGHT);
map = new Sprite();
map.addChild(new Bitmap(_arg1));
map.x = ((WIDTH - map.width) / 2);
map.y = (((HEIGHT - map.height) / 2) - 4);
_local2 = new Bitmap(FrameMaker.createFrame(BitmapLibrary.loadBitmap("frame1"), (WIDTH + 16), (HEIGHT + 16), 43, 43));
_local2.x = -8;
_local2.y = -8;
addChild(map);
string = new DefaultTextField(4294967295, TextFormatAlign.CENTER);
string.width = WIDTH;
string.text = "WWW";
string.y = ((HEIGHT - string.textHeight) - 8);
graphics.beginFill(0xFF0000, 0.25);
graphics.drawRect(0, ((HEIGHT - string.textHeight) - 8), WIDTH, (string.textHeight + 8));
string.text = "";
addChild(string);
addChildAt(_local2, 0);
var _local3:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("minimapembelishment"));
_local3.y = (HEIGHT - 6);
_local3.x = (WIDTH - 55);
addChild(_local3);
x = (BattalionMain.WIDTH - WIDTH);
ratio = (6 / BattalionMain.TILE_WIDTH);
invRatio = (BattalionMain.TILE_WIDTH / 6);
drag = new Sprite();
drag.graphics.lineStyle(1, 0xFFFF00, 1);
drag.graphics.beginFill(0, 0);
drag.graphics.drawRect(0, 0, Math.min(map.width, (GameManager.GAME_WIDTH * ratio)), Math.min(map.height, (GameManager.GAME_HEIGHT * ratio)));
drag.graphics.endFill();
drag.x = map.x;
drag.y = map.y;
addChild(drag);
drag.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
map.addEventListener(MouseEvent.CLICK, clickHandler);
MouseHandler.getInstance().getStage().addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
dragging = false;
}
public function setString(_arg1:String):void{
string.text = _arg1;
}
private function mouseMoveHandler(_arg1:MouseEvent):void{
if (dragging){
if (MouseHandler.getInstance().isDown()){
doScroll(true);
} else {
dragging = false;
};
};
}
public function getMap():Sprite{
return (map);
}
private function clickHandler(_arg1:MouseEvent):void{
if (GameManager.getInstance().getCamera().isEnabled()){
doScroll(false);
};
}
private function mouseDownHandler(_arg1:MouseEvent):void{
if (GameManager.getInstance().getCamera().isEnabled()){
dragging = true;
};
}
public function setDrag(_arg1:int, _arg2:int):void{
if (!dragging){
drag.x = (map.x + (_arg1 * ratio));
drag.y = (map.y + (_arg2 * ratio));
};
}
private function doScroll(_arg1:Boolean):void{
var _local2:Number = drag.x;
var _local3:Number = drag.y;
drag.x = ((MouseHandler.getInstance().getX() - x) - (drag.width / 2));
drag.y = ((MouseHandler.getInstance().getY() - y) - (drag.height / 2));
if (drag.x < map.x){
drag.x = map.x;
};
if (drag.y < map.y){
drag.y = map.y;
};
if ((drag.x + drag.width) > ((map.x + map.width) + 2)){
drag.x = (((map.x + map.width) - drag.width) + 2);
};
if ((drag.y + drag.height) > ((map.y + map.height) + 2)){
drag.y = (((map.y + map.height) - drag.height) + 2);
};
var _local4:int = ((map.x - drag.x) * invRatio);
var _local5:int = ((map.y - drag.y) * invRatio);
GameManager.getInstance().getCamera().setLocation(_local4, _local5);
if (!_arg1){
drag.x = _local2;
drag.y = _local3;
};
}
}
}//package com.gamedozer.battalion.ui
Section 166
//MouseCursor (com.gamedozer.battalion.ui.MouseCursor)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.*;
import flash.ui.*;
public class MouseCursor extends Sprite {
protected var cursor:TileSheet;
public function MouseCursor(_arg1:TileSheet){
cursor = _arg1;
addChild(cursor);
cursor.x = -24;
cursor.y = -24;
BattalionMain.getStage().addEventListener(Event.MOUSE_LEAVE, cursorHide);
BattalionMain.getStage().addEventListener(MouseEvent.MOUSE_MOVE, cursorFollow);
Mouse.hide();
mouseEnabled = false;
mouseChildren = false;
}
public function cursorFollow(_arg1:MouseEvent):void{
if (!visible){
visible = true;
};
x = MouseHandler.getInstance().getX();
y = MouseHandler.getInstance().getY();
_arg1.updateAfterEvent();
}
public function setCursor(_arg1:String):void{
cursor.playAnimation(_arg1);
}
public function cursorHide(_arg1:Event):void{
visible = false;
}
}
}//package com.gamedozer.battalion.ui
Section 167
//OptionsMenu (com.gamedozer.battalion.ui.OptionsMenu)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import com.gamedozer.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.ui.modes.*;
import com.gamedozer.battalion.audio.*;
import flash.text.*;
import com.gamedozer.battalion.*;
public class OptionsMenu extends Sprite implements ModeInterface {
public var backButton:TileSheetButton;
public var soundButton:ToggleableTileSheetButton;
public var clearDataButton:TileSheetButton;
public var creditsButton:TileSheetButton;
public var frame:BattalionPanel;
public var musicButton:ToggleableTileSheetButton;
public var dialogButton:ToggleableTileSheetButton;
public static const WIDTH:int = 590;
public static const HEIGHT:int = 125;
public function OptionsMenu(){
var _local1:Bitmap;
super();
graphics.beginFill(0, 0.5);
graphics.drawRect(0, 0, BattalionMain.WIDTH, BattalionMain.HEIGHT);
frame = new BattalionPanel(WIDTH, HEIGHT);
frame.x = ((BattalionMain.WIDTH / 2) - (WIDTH / 2));
frame.y = ((BattalionMain.HEIGHT / 2) - (HEIGHT / 2));
addChild(frame);
backButton = new TileSheetButton("closeButton");
backButton.x = (((frame.x + WIDTH) - backButton.width) - 5);
backButton.y = ((frame.y - (backButton.height / 2)) + 10);
addChild(backButton);
_local1 = new Bitmap(BitmapLibrary.loadBitmap("SoundLabel"));
_local1.x = (frame.x + 20);
_local1.y = (frame.y + 20);
addChild(_local1);
soundButton = new ToggleableTileSheetButton("soundButton");
soundButton.x = _local1.x;
soundButton.y = (_local1.y + 25);
addChild(soundButton);
var _local2:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("MusicLabel"));
_local2.x = ((soundButton.x + soundButton.width) + 25);
_local2.y = _local1.y;
addChild(_local2);
musicButton = new ToggleableTileSheetButton("musicButton");
musicButton.x = _local2.x;
musicButton.y = (_local2.y + 25);
addChild(musicButton);
var _local3:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("dialogLabel"));
_local3.x = ((musicButton.x + musicButton.width) + 25);
_local3.y = _local2.y;
addChild(_local3);
dialogButton = new ToggleableTileSheetButton("dialogButton");
dialogButton.x = _local3.x;
dialogButton.y = (_local3.y + 25);
addChild(dialogButton);
var _local4:Bitmap = new Bitmap(BitmapLibrary.loadBitmap("clearDataLabel"));
_local4.x = ((_local3.x + _local3.width) + 25);
_local4.y = _local3.y;
addChild(_local4);
clearDataButton = new TileSheetButton("clearDataButton");
clearDataButton.x = _local4.x;
clearDataButton.y = (_local4.y + 25);
addChild(clearDataButton);
creditsButton = new TileSheetButton("creditsButton");
creditsButton.x = ((frame.x + WIDTH) - creditsButton.width);
creditsButton.y = ((frame.y + HEIGHT) - creditsButton.height);
addChild(creditsButton);
update();
}
public function loseFocus():void{
}
private function update():void{
soundButton.toggled = BattalionMain.getStorage().getBoolean("sound", true);
musicButton.toggled = BattalionMain.getStorage().getBoolean("music", true);
dialogButton.toggled = BattalionMain.getStorage().getBoolean("dialog", true);
}
private function clearConfirm():void{
BattalionMain.getStorage().clear();
update();
}
private function unlockAllLevels():void{
BattalionMain.getStorage().setInt("campaign_level", 9);
BattalionMain.getStorage().setInt("campaign_complete", 9);
BattalionMain.getStorage().setInt("bootcamp_level", 5);
BattalionMain.getStorage().setInt("bootcamp_complete", 5);
}
private function creditsHandler(_arg1:MouseEvent):void{
MenuManager.getInstance().switchMode(MenuManager.creditsMenu, null);
}
public function gainFocus():void{
}
public function popped():void{
BattalionMain.setMusicButtonVisibility(true);
backButton.removeEventListener(MouseEvent.CLICK, backHandler);
backButton.disable();
clearDataButton.removeEventListener(MouseEvent.CLICK, clearHandler);
clearDataButton.disable();
soundButton.removeEventListener(Event.CHANGE, soundHandler);
musicButton.removeEventListener(Event.CHANGE, musicHandler);
dialogButton.removeEventListener(Event.CHANGE, dialogHandler);
creditsButton.disable();
creditsButton.removeEventListener(MouseEvent.CLICK, creditsHandler);
parent.removeChild(this);
}
private function dialogHandler(_arg1:Event):void{
var _local2:Storage = BattalionMain.getStorage();
_local2.setBoolean("dialog", _arg1.target.toggled);
}
public function backHandler(_arg1:Event):void{
MenuManager.getInstance().popMode();
}
private function musicHandler(_arg1:Event):void{
var _local2:Boolean = _arg1.target.toggled;
var _local3:Storage = BattalionMain.getStorage();
_local3.setBoolean("music", _local2);
BattalionMain.updateSoundSystem();
}
public function pushed(_arg1:DisplayObjectContainer, _arg2:ModeData):void{
BattalionMain.setMusicButtonVisibility(false);
_arg1.addChild(this);
backButton.addEventListener(MouseEvent.CLICK, backHandler);
backButton.enable();
clearDataButton.addEventListener(MouseEvent.CLICK, clearHandler);
clearDataButton.enable();
soundButton.addEventListener(Event.CHANGE, soundHandler);
soundButton.enable();
musicButton.addEventListener(Event.CHANGE, musicHandler);
musicButton.enable();
dialogButton.addEventListener(Event.CHANGE, dialogHandler);
dialogButton.enable();
creditsButton.addEventListener(MouseEvent.CLICK, creditsHandler);
creditsButton.enable();
update();
}
private function soundHandler(_arg1:Event):void{
var _local2:Boolean = _arg1.target.toggled;
var _local3:Storage = BattalionMain.getStorage();
_local3.setBoolean("sound", _local2);
BattalionMain.updateSoundSystem();
}
private function clearHandler(_arg1:MouseEvent):void{
if (((BattalionMain.ALLOW_DEBUG) && (_arg1.altKey))){
unlockAllLevels();
return;
};
MenuManager.getInstance().pushMode(MenuManager.confirmMenu, new ConfirmMenuData("Are you sure you want to clear your saved game data?", clearConfirm));
}
}
}//package com.gamedozer.battalion.ui
Section 168
//PlayerPanel (com.gamedozer.battalion.ui.PlayerPanel)
package com.gamedozer.battalion.ui {
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import flash.text.*;
public class PlayerPanel extends Sprite {
var resources:TextField;
var playerName:TextField;
var selectedArrow:Bitmap;
var colorBar:Bitmap;
var resourcesBar:Bitmap;
var avatar:TileSheet;
var team:Team;
public static var WIDTH:int = 143;
public static var HEIGHT:int = 37;
public function PlayerPanel(_arg1:Team){
addChild(new Bitmap(BitmapLibrary.loadBitmap("playerbox")));
team = _arg1;
colorBar = new Bitmap(ColoredSprite.colorise(BitmapLibrary.loadBitmap("colorBar"), null, team.getColor()));
colorBar.x = 0;
colorBar.y = 2;
addChild(colorBar);
avatar = TileSheetManager.getInstance().get("avatarsSmall");
avatar.playAnimation(team.getAvatar());
avatar.y = 2;
avatar.x = 11;
addChild(avatar);
playerName = new DefaultTextField();
playerName.x = 41;
playerName.y = 2;
playerName.width = 106;
playerName.height = 14;
var _local2:TextFormat = new DefaultTextFormat();
_local2.color = 0;
playerName.defaultTextFormat = _local2;
playerName.text = team.getName();
addChild(playerName);
resources = new DefaultTextField();
resources.x = 57;
resources.y = 18;
resources.width = 70;
resources.height = 14;
_local2 = new DefaultTextFormat();
_local2.align = TextFormatAlign.RIGHT;
_local2.color = 0;
resources.defaultTextFormat = _local2;
resources.text = "$0";
addChild(resources);
}
public function setResources(_arg1:int):void{
resources.text = ("$" + _arg1);
}
}
}//package com.gamedozer.battalion.ui
Section 169
//TileSheetButton (com.gamedozer.battalion.ui.TileSheetButton)
package com.gamedozer.battalion.ui {
import flash.events.*;
import flash.display.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.*;
public class TileSheetButton extends SimpleButton {
var disabledFrame:TileSheet;
var upFrame:TileSheet;
public function TileSheetButton(_arg1:String){
disabledFrame = TileSheetManager.getInstance().get(_arg1);
disabledFrame.setFrame(0);
upFrame = TileSheetManager.getInstance().get(_arg1);
upFrame.setFrame(1);
var _local2:TileSheet = TileSheetManager.getInstance().get(_arg1);
_local2.setFrame(2);
var _local3:TileSheet = TileSheetManager.getInstance().get(_arg1);
_local3.setFrame(3);
var _local4:Sprite = new Sprite();
_local4.graphics.beginFill(0);
_local4.graphics.drawRect(0, 0, upFrame.width, upFrame.height);
upState = disabledFrame;
overState = _local2;
downState = _local3;
hitTestState = _local4;
enabled = false;
tabEnabled = false;
addEventListener(MouseEvent.MOUSE_OVER, overHandler);
addEventListener(MouseEvent.MOUSE_OUT, outHandler);
}
override public function get width():Number{
return (upState.width);
}
public function disable():void{
enabled = false;
upState = disabledFrame;
}
public function enable():void{
enabled = true;
upState = upFrame;
}
protected function outHandler(_arg1:Event):void{
BattalionMain.getMouseCursor().setCursor("default");
}
protected function overHandler(_arg1:Event):void{
if (enabled){
BattalionMain.getMouseCursor().setCursor("select");
};
}
}
}//package com.gamedozer.battalion.ui
Section 170
//ToggleableTileSheetButton (com.gamedozer.battalion.ui.ToggleableTileSheetButton)
package com.gamedozer.battalion.ui {
import flash.events.*;
import flash.display.*;
public class ToggleableTileSheetButton extends Sprite {
private var active:Boolean;// = true
private var activeButton:TileSheetButton;
private var inactiveButton:TileSheetButton;
public function ToggleableTileSheetButton(_arg1:String){
activeButton = new TileSheetButton(_arg1);
addChild(activeButton);
inactiveButton = new TileSheetButton((_arg1 + "Toggled"));
addChild(inactiveButton);
inactiveButton.visible = false;
this.addEventListener(MouseEvent.CLICK, clicked);
}
public function set toggled(_arg1:Boolean):void{
if (_arg1){
showActive();
} else {
showInactive();
};
}
public function showActive():void{
active = true;
activeButton.visible = true;
inactiveButton.visible = false;
}
private function clicked(_arg1:Event):void{
toggled = !(toggled);
dispatchEvent(new Event(Event.CHANGE));
}
public function showInactive():void{
active = false;
activeButton.visible = false;
inactiveButton.visible = true;
}
public function enable():void{
activeButton.enable();
inactiveButton.enable();
}
override public function get width():Number{
return (activeButton.width);
}
public function disable():void{
activeButton.disable();
inactiveButton.disable();
}
public function get toggled():Boolean{
return (active);
}
}
}//package com.gamedozer.battalion.ui
Section 171
//ToolTip (com.gamedozer.battalion.ui.ToolTip)
package com.gamedozer.battalion.ui {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import flash.display.*;
import com.gamedozer.battalion.display.*;
import flash.text.*;
import com.gamedozer.battalion.game.*;
public class ToolTip extends GameSprite {
private var m_target:DisplayObject;
private static var s_activeToolTip:ToolTip = null;
public function ToolTip(){
this.visible = false;
this.mouseChildren = false;
this.mouseEnabled = false;
}
private function hide():void{
removeEventListener(Event.ENTER_FRAME, tick);
removeEventListener(Event.ENTER_FRAME, fadeOut);
this.visible = false;
}
private function tick(_arg1:Event):void{
if (((!(this.hitTestPoint(this.stage.mouseX, this.stage.mouseY, true))) && (!(m_target.hitTestPoint(this.stage.mouseX, this.stage.mouseY, true))))){
addEventListener(Event.ENTER_FRAME, fadeOut);
removeEventListener(Event.ENTER_FRAME, tick);
};
}
private function showToolTip(_arg1:MouseEvent):void{
if (this.stage == null){
return;
};
if (s_activeToolTip != null){
s_activeToolTip.hide();
};
removeEventListener(Event.ENTER_FRAME, fadeOut);
this.visible = true;
this.alpha = 1;
this.x = this.stage.mouseX;
this.y = this.stage.mouseY;
addEventListener(Event.ENTER_FRAME, tick);
s_activeToolTip = this;
}
private function fadeOut(_arg1:Event):void{
this.alpha = (this.alpha - 0.03);
if (this.alpha < 0.1){
removeEventListener(Event.ENTER_FRAME, fadeOut);
this.visible = false;
s_activeToolTip = null;
};
}
public function listenForMouseEvents(_arg1:DisplayObject):void{
if (_arg1.stage == null){
throw (new Error("ToolTip. You cannot attach a tool tip to an object that has not yet been attached to the stage."));
};
m_target = _arg1;
m_target.addEventListener(MouseEvent.MOUSE_OVER, showToolTip);
GameManager.getInstance().getSprite().parent.addChild(this);
}
public static function createToolTip(_arg1:DisplayObject, _arg2:String, _arg3:String):void{
var _local8:TextField;
var _local4:ToolTip = new (ToolTip);
var _local5:Sprite = new Sprite();
var _local6:Sprite = new Sprite();
var _local7:TextField = new DefaultTextField(0xFFFFFF, TextFormatAlign.CENTER);
_local7.text = _arg2;
_local7.width = 150;
_local7.height = (_local7.textHeight + 5);
_local8 = new DefaultTextField(0);
_local8.text = _arg3;
_local8.width = 150;
_local8.width = Math.min(150, (_local8.textWidth + 5));
_local8.height = (_local8.textHeight + 5);
_local8.y = _local7.height;
_local6.addChild(_local7);
_local6.addChild(_local8);
var _local9:Sprite = FrameMaker.createBlock(BitmapLibrary.loadBitmap("spotted_texture"), _local6.width, _local6.height);
var _local10:Sprite = new Sprite();
_local10.graphics.lineStyle(1, 0, 0.75);
_local10.graphics.drawRect(0, 0, _local6.width, _local6.height);
_local10.graphics.lineStyle(1, 0, 0);
_local10.graphics.beginFill(11296285, 1);
_local10.graphics.drawRect(1, 1, (_local7.width - 1), (_local7.height - 1));
_local9.addChild(_local10);
_local5.addChild(_local9);
_local5.addChild(_local6);
_local4.addChild(_local5);
_local4.listenForMouseEvents(_arg1);
}
}
}//package com.gamedozer.battalion.ui
Section 172
//BBCode (com.gamedozer.battalion.utils.BBCode)
package com.gamedozer.battalion.utils {
import com.gamedozer.battalion.game.*;
public class BBCode {
public static function parseBBCode(_arg1:String):String{
var _local2:Array;
_arg1 = _arg1.replace(/\[b\](.*?)\[\/b\]/gi, "<b>$1</b>");
_arg1 = _arg1.replace(/\[i\](.*?)\[\/i\]/gi, "<i>$1</i>");
_arg1 = _arg1.replace(/\[u\](.*?)\[\/u\]/gi, "<u>$1</u>");
_arg1 = _arg1.replace(/\[color=(.*?)\](.*?)\[\/color\]/gi, "<font color=\"$1\">$2</font>");
if (GameManager.getInstance() != null){
_local2 = GameManager.getInstance().getMapSettings().getTeams();
if (_local2[0] != null){
_arg1 = _arg1.replace("^1", _local2[0].getName());
_arg1 = _arg1.replace("$1", _local2[0].getTeamName());
};
if (_local2[1] != null){
_arg1 = _arg1.replace("^2", _local2[1].getName());
_arg1 = _arg1.replace("$2", _local2[1].getTeamName());
};
if (_local2[2] != null){
_arg1 = _arg1.replace("^3", _local2[2].getName());
_arg1 = _arg1.replace("$3", _local2[2].getTeamName());
};
if (_local2[3] != null){
_arg1 = _arg1.replace("^4", _local2[3].getName());
_arg1 = _arg1.replace("$4", _local2[3].getTeamName());
};
};
return (_arg1);
}
public static function parseAvatarCode(_arg1:String):String{
var _local2:Array;
if (GameManager.getInstance() != null){
_local2 = GameManager.getInstance().getMapSettings().getTeams();
if (_local2[0] != null){
_arg1 = _arg1.replace("@1", _local2[0].getAvatar());
} else {
_arg1 = _arg1.replace("@1", "default");
};
if (_local2[1] != null){
_arg1 = _arg1.replace("@2", _local2[1].getAvatar());
} else {
_arg1 = _arg1.replace("@2", "default");
};
if (_local2[2] != null){
_arg1 = _arg1.replace("@3", _local2[2].getAvatar());
} else {
_arg1 = _arg1.replace("@3", "default");
};
if (_local2[3] != null){
_arg1 = _arg1.replace("@4", _local2[3].getAvatar());
} else {
_arg1 = _arg1.replace("@4", "default");
};
} else {
_arg1 = _arg1.replace("@1", "default");
_arg1 = _arg1.replace("@2", "default");
_arg1 = _arg1.replace("@3", "default");
_arg1 = _arg1.replace("@4", "default");
};
return (_arg1);
}
public static function parseColorCode(_arg1:String):String{
var _local2:Array;
if (GameManager.getInstance() != null){
_local2 = GameManager.getInstance().getMapSettings().getTeams();
if (_local2[0] != null){
_arg1 = _arg1.replace("%1", _local2[0].getColor().toString(16));
} else {
_arg1 = _arg1.replace("%1", "FF000000");
};
if (_local2[1] != null){
_arg1 = _arg1.replace("%2", _local2[1].getColor().toString(16));
} else {
_arg1 = _arg1.replace("%2", "FF000000");
};
if (_local2[2] != null){
_arg1 = _arg1.replace("%3", _local2[2].getColor().toString(16));
} else {
_arg1 = _arg1.replace("%3", "FF000000");
};
if (_local2[3] != null){
_arg1 = _arg1.replace("%4", _local2[3].getColor().toString(16));
} else {
_arg1 = _arg1.replace("%4", "FF000000");
};
} else {
_arg1 = _arg1.replace("%1", "FF000000");
_arg1 = _arg1.replace("%2", "FF000000");
_arg1 = _arg1.replace("%3", "FF000000");
_arg1 = _arg1.replace("%4", "FF000000");
};
return (_arg1);
}
}
}//package com.gamedozer.battalion.utils
Section 173
//BitmapLibrary (com.gamedozer.battalion.utils.BitmapLibrary)
package com.gamedozer.battalion.utils {
import flash.display.*;
import flash.utils.*;
public class BitmapLibrary {
private static var bitmaps:Dictionary;
public function BitmapLibrary(){
if (bitmaps == null){
bitmaps = new Dictionary();
};
}
public static function loadBitmap(_arg1:String):BitmapData{
var ClassReference:Class;
var bitmap:BitmapData;
var className = _arg1;
if (bitmaps == null){
bitmaps = new Dictionary();
};
try {
if (bitmaps[className] != null){
return (bitmaps[className]);
};
ClassReference = (getDefinitionByName(className) as Class);
bitmap = new ClassReference(0, 0);
bitmaps[className] = bitmap;
return (bitmap);
} catch(e:Error) {
trace("BitmapLibrary::Could not load", className, "as bitmapData");
return (null);
};
return (null);
}
}
}//package com.gamedozer.battalion.utils
Section 174
//EmbeddedURLLoader (com.gamedozer.battalion.utils.EmbeddedURLLoader)
package com.gamedozer.battalion.utils {
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class EmbeddedURLLoader extends URLLoader {
private var m_forceEmbedded:Boolean;
private var m_request:URLRequest;
private static var s_embeddedContent:Dictionary = new Dictionary();
public function EmbeddedURLLoader(_arg1:Boolean=false){
m_forceEmbedded = _arg1;
this.addEventListener(IOErrorEvent.IO_ERROR, handleError);
this.addEventListener(Event.COMPLETE, handleCompleteLoad);
}
private function handleError(_arg1:Event):void{
var _local3:String;
var _local2:String = m_request.url;
if (doesContentExist(_local2)){
_arg1.stopImmediatePropagation();
loadEmbedded(_local2);
} else {
_local3 = ("EmbeddedURLLoader. Could not find embedded or external asset with URL " + _local2);
trace(_local3);
throw (new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, _local3));
};
}
override public function load(_arg1:URLRequest):void{
m_request = _arg1;
var _local2:String = m_request.url;
if (!m_forceEmbedded){
super.load(m_request);
} else {
if (doesContentExist(_local2)){
loadEmbedded(_local2);
} else {
throw (new Error((("EmbeddedURLLoader. No content defined for " + m_request.url) + " and it required embedding.")));
};
};
}
private function handleCompleteLoad(_arg1:Event):void{
var _local2:String = m_request.url;
if (!m_forceEmbedded){
trace(("EmbeddedURLLoader loaded an external asset for " + _local2));
};
}
override public function toString():String{
if (m_request != null){
return ((("[EmbeddedURLLoader " + m_request.url) + " ]"));
};
return (super.toString());
}
private function loadEmbedded(_arg1:String):void{
this.data = getContent(_arg1);
var _local2:Event = new Event(Event.COMPLETE);
dispatchEvent(_local2);
}
private static function getContent(_arg1:String):Object{
return (s_embeddedContent[_arg1]);
}
public static function registerContent(_arg1:String, _arg2:Object):void{
s_embeddedContent[_arg1] = _arg2;
}
private static function doesContentExist(_arg1:String):Boolean{
return (!((s_embeddedContent[_arg1] == null)));
}
}
}//package com.gamedozer.battalion.utils
Section 175
//KeyboardHandler (com.gamedozer.battalion.utils.KeyboardHandler)
package com.gamedozer.battalion.utils {
import flash.events.*;
public class KeyboardHandler {
protected var keys:Array;
protected var dispatcher:EventDispatcher;
private static var singleton:KeyboardHandler;
public function KeyboardHandler(_arg1:EventDispatcher){
singleton = this;
setDispatcher(_arg1);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
keys[_arg1.keyCode] = true;
}
private function deactivateHandler(_arg1:Event):void{
keys = new Array();
}
public function setDispatcher(_arg1:EventDispatcher):void{
if (dispatcher == null){
keys = new Array();
} else {
dispatcher.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
dispatcher.removeEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
dispatcher.removeEventListener(Event.DEACTIVATE, deactivateHandler);
dispatcher.removeEventListener(FocusEvent.FOCUS_OUT, deactivateHandler);
};
dispatcher = _arg1;
dispatcher.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
dispatcher.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
dispatcher.addEventListener(Event.DEACTIVATE, deactivateHandler);
dispatcher.addEventListener(FocusEvent.FOCUS_OUT, deactivateHandler);
}
public function isDown(_arg1:uint):Boolean{
return ((keys[_arg1] == true));
}
private function keyUpHandler(_arg1:KeyboardEvent):void{
keys[_arg1.keyCode] = false;
}
public static function getInstance():KeyboardHandler{
if (singleton == null){
throw (new Error("KeyboardHandler::No instance exists"));
};
return (singleton);
}
}
}//package com.gamedozer.battalion.utils
Section 176
//MouseHandler (com.gamedozer.battalion.utils.MouseHandler)
package com.gamedozer.battalion.utils {
import flash.events.*;
import flash.display.*;
public class MouseHandler {
protected var enabled:Boolean;// = false
protected var dispatcher:EventDispatcher;
protected var buttonDown:Boolean;
protected var x:int;
protected var y:int;
protected var stage:Stage;
private static var singleton:MouseHandler;
public function MouseHandler(_arg1:Stage){
this.stage = _arg1;
singleton = this;
setDispatcher(_arg1);
}
public function getY():int{
return (y);
}
public function setDispatcher(_arg1:EventDispatcher):void{
if (dispatcher == null){
buttonDown = false;
x = 0;
y = 0;
} else {
dispatcher.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
dispatcher.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
dispatcher.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
dispatcher.removeEventListener(Event.DEACTIVATE, deactivateHandler);
dispatcher.removeEventListener(FocusEvent.FOCUS_OUT, deactivateHandler);
dispatcher.removeEventListener(Event.MOUSE_LEAVE, deactivateHandler);
};
dispatcher = _arg1;
dispatcher.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
dispatcher.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
dispatcher.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
dispatcher.addEventListener(Event.DEACTIVATE, deactivateHandler);
dispatcher.addEventListener(FocusEvent.FOCUS_OUT, deactivateHandler);
dispatcher.addEventListener(Event.MOUSE_LEAVE, deactivateHandler);
}
private function mouseDownHandler(_arg1:MouseEvent):void{
enabled = true;
buttonDown = true;
}
public function isDown():Boolean{
return (buttonDown);
}
private function mouseUpHandler(_arg1:MouseEvent):void{
enabled = true;
buttonDown = false;
}
public function getStage():Stage{
return (stage);
}
public function getX():int{
return (x);
}
private function deactivateHandler(_arg1:Event):void{
enabled = false;
buttonDown = false;
}
public function isEnabled():Boolean{
return (enabled);
}
private function mouseMoveHandler(_arg1:MouseEvent):void{
enabled = true;
x = stage.mouseX;
y = stage.mouseY;
}
public static function getInstance():MouseHandler{
if (singleton == null){
throw (new Error("MouseHandler::No instance exists"));
};
return (singleton);
}
}
}//package com.gamedozer.battalion.utils
Section 177
//XMLLoader (com.gamedozer.battalion.utils.XMLLoader)
package com.gamedozer.battalion.utils {
import flash.events.*;
import flash.net.*;
public class XMLLoader extends EventDispatcher {
protected var xml:Array;
public function XMLLoader(_arg1:IEventDispatcher=null){
super(_arg1);
xml = new Array();
}
protected function completeHandler(_arg1:Event):void{
var _local2:EmbeddedURLLoader = (_arg1.target as EmbeddedURLLoader);
var _local3:int;
while (_local3 < xml.length) {
if (xml[_local3].urlLoader == _local2){
xml[_local3].xml = new XML(_local2.data);
delete xml[_local3].urlLoader;
delete xml[_local3].urlRequest;
break;
};
_local3++;
};
checkComplete();
}
public function add(_arg1:String, _arg2:String, _arg3:Boolean=false):void{
if (exists(_arg2)){
if (_arg3){
remove(_arg2);
} else {
checkComplete();
return;
};
};
var _local4:XMLLoaderHelper = new XMLLoaderHelper();
_local4.name = _arg2;
_local4.url = _arg1;
_local4.urlRequest = new URLRequest(_arg1);
_local4.urlLoader = new EmbeddedURLLoader();
_local4.urlLoader.addEventListener(Event.COMPLETE, completeHandler);
_local4.urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
xml.push(_local4);
}
protected function remove(_arg1:String):void{
var _local2:int;
_local2 = (xml.length - _local2);
while (_local2 >= 0) {
if (xml[_local2].name == _arg1){
xml.splice(_local2, 1);
};
_local2--;
};
}
public function get(_arg1:String):XML{
var _local2:int;
while (_local2 < xml.length) {
if (xml[_local2].name == _arg1){
return (xml[_local2].xml);
};
_local2++;
};
return (null);
}
protected function checkComplete():void{
var _local1:int;
while (_local1 < xml.length) {
if (xml[_local1].xml == null){
return;
};
_local1++;
};
dispatchEvent(new Event(Event.COMPLETE));
}
public function exists(_arg1:String):Boolean{
var _local2:int;
while (_local2 < xml.length) {
if (xml[_local2].name == _arg1){
return (true);
};
_local2++;
};
return (false);
}
public function load():void{
var _local1:int;
while (_local1 < xml.length) {
if (xml[_local1].xml == null){
xml[_local1].urlLoader.load(xml[_local1].urlRequest);
};
_local1++;
};
checkComplete();
}
protected function ioErrorHandler(_arg1:Event):void{
var _local2:URLLoader = (_arg1.target as URLLoader);
var _local3:int;
while (_local3 < xml.length) {
if (xml[_local3].urlLoader == _local2){
trace("XMLLoader::Error loading", xml[_local3].url);
xml.splice(_local3, 1);
break;
};
_local3++;
};
dispatchEvent(new Event(IOErrorEvent.IO_ERROR));
checkComplete();
}
}
}//package com.gamedozer.battalion.utils
import flash.net.*;
class XMLLoaderHelper {
public var urlRequest:URLRequest;
public var urlLoader:EmbeddedURLLoader;
public var url:String;
public var xml:XML;
public var name:String;
private function XMLLoaderHelper(){
}
}
Section 178
//BattalionMain (com.gamedozer.battalion.BattalionMain)
package com.gamedozer.battalion {
import flash.events.*;
import com.gamedozer.battalion.utils.*;
import com.gamedozer.utils.*;
import flash.display.*;
import com.gamedozer.battalion.ui.*;
import com.gamedozer.battalion.data.*;
import com.gamedozer.battalion.display.*;
import com.gamedozer.battalion.audio.*;
import com.kongregate.as3.client.*;
import flash.net.*;
import com.gamedozer.battalion.game.*;
import flash.utils.*;
public class BattalionMain extends Sprite {
public static const XML_URL:String = "xml/battalion.xml";
public static const XML_NAME:String = "Battalion1.0";
public static const TILE_WIDTH:int = 56;
public static const TILE_HEIGHT:int = 56;
public static const ALLOW_DEBUG:Boolean = false;
public static const WIDTH:int = 700;
public static const HEIGHT:int = 600;
protected static var currentStage:Stage;
protected static var xmlLoader:XMLLoader;
protected static var mouseCursor:MouseCursor;
protected static var soundButton:ToggleableTileSheetButton;
private static var Tahoma:Class = BattalionMain_Tahoma;
protected static var screen:Sprite;
protected static var musicButton:ToggleableTileSheetButton;
protected static var storage:Storage;
public function BattalionMain(){
addEventListener(Event.ADDED, addedToStage);
}
private function createMasterMuteButtons():void{
var _local1:Number = 0.3;
soundButton = new ToggleableTileSheetButton("soundButton");
soundButton.scaleX = _local1;
soundButton.scaleY = _local1;
soundButton.x = 0;
soundButton.y = 0;
soundButton.enable();
soundButton.addEventListener(Event.CHANGE, soundHandler);
addChild(soundButton);
musicButton = new ToggleableTileSheetButton("musicButton");
musicButton.scaleX = _local1;
musicButton.scaleY = _local1;
musicButton.x = (WIDTH - (musicButton.width * _local1));
musicButton.y = 0;
musicButton.enable();
musicButton.addEventListener(Event.CHANGE, musicHandler);
addChild(musicButton);
}
private function musicHandler(_arg1:Event):void{
var _local2:Boolean = _arg1.target.toggled;
var _local3:Storage = BattalionMain.getStorage();
_local3.setBoolean("music", _local2);
BattalionMain.updateSoundSystem();
}
public function addedToStage(_arg1:Event):void{
removeEventListener(Event.ADDED, addedToStage);
currentStage = stage;
stage.scaleMode = StageScaleMode.NO_SCALE;
var _local2:KongregateAPI = new KongregateAPI();
this.addChild(_local2);
new KeyboardHandler(stage);
new MouseHandler(stage);
BattalionXMLs.registerEmbeddedXMLs();
xmlLoader = new XMLLoader();
xmlLoader.addEventListener(Event.COMPLETE, initHandler);
xmlLoader.add(XML_URL, XML_NAME);
xmlLoader.load();
}
private function completeHandler(_arg1:Event):void{
xmlLoader.removeEventListener(Event.COMPLETE, completeHandler);
var _local2:XML = xmlLoader.get(BattalionMain.XML_NAME);
BattalionSettings.createSingleton(xmlLoader.get(_local2.settings.@name));
storage = new Storage(_local2.storage.@storagename);
storage.loadFromXML(xmlLoader.get(_local2.storage.@name));
var _local3:XMLList = _local2.modifierlist;
var _local4:int;
while (_local4 < _local3.length()) {
ModifierManager.getInstance().importXML(xmlLoader.get(_local3[_local4].@name));
_local4++;
};
var _local5:XMLList = _local2..terrainlist;
var _local6:int;
while (_local6 < _local5.length()) {
TileManager.getInstance().importXML(xmlLoader.get(_local5[_local6].@name));
_local6++;
};
var _local7:XMLList = _local2..unitlist;
var _local8:int;
while (_local8 < _local7.length()) {
UnitManager.getInstance().importXML(xmlLoader.get(_local7[_local8].@name));
_local8++;
};
var _local9:XMLList = _local2..tilesheetlist;
var _local10:int;
while (_local10 < _local9.length()) {
TileSheetManager.getInstance().importXML(xmlLoader.get(_local9[_local10].@name));
_local10++;
};
var _local11:XMLList = _local2..campaign;
var _local12:int;
while (_local12 < _local11.length()) {
new CampaignManager(_local11[_local12].@name, xmlLoader.get(_local11[_local12].@name));
_local12++;
};
screen = new Sprite();
addChild(screen);
new MenuManager(screen);
MenuManager.getInstance().pushMode(MenuManager.mainMenu, null);
createMasterMuteButtons();
updateSoundSystem();
mouseCursor = new MouseCursor(TileSheetManager.getInstance().get("cursor"));
this.stage.addChild(mouseCursor);
}
private function initHandler(_arg1:Event):void{
xmlLoader.removeEventListener(Event.COMPLETE, initHandler);
new GameManagerHelper();
preloadResources(xmlLoader.get(BattalionMain.XML_NAME));
}
private function soundHandler(_arg1:Event):void{
var _local2:Boolean = _arg1.target.toggled;
var _local3:Storage = BattalionMain.getStorage();
_local3.setBoolean("sound", _local2);
BattalionMain.updateSoundSystem();
}
private function preloadResources(_arg1:XML):void{
var _local2:XMLList = _arg1.resources..xml;
xmlLoader.addEventListener(Event.COMPLETE, completeHandler);
var _local3:int;
while (_local3 < _local2.length()) {
xmlLoader.add(_local2[_local3].@url, _local2[_local3].@name);
_local3++;
};
xmlLoader.load();
}
public static function getXMLLoader():XMLLoader{
return (xmlLoader);
}
public static function getStage():Stage{
return (currentStage);
}
public static function visitSponsor(_arg1:Event=null):void{
navigateToURL(new URLRequest("http://www.kongregate.com/?gamereferral=battalion-nemesis"), "_blank");
}
public static function updateSoundSystem():void{
var _local1:Boolean = storage.getBoolean("sound", true);
if (_local1){
soundButton.toggled = true;
SoundSystem.instance.setMasterEffectVolume(1);
} else {
soundButton.toggled = false;
SoundSystem.instance.setMasterEffectVolume(0);
};
var _local2:Boolean = storage.getBoolean("music", true);
if (_local2){
musicButton.toggled = true;
SoundSystem.instance.setMasterLoopVolume(1);
} else {
musicButton.toggled = false;
SoundSystem.instance.setMasterLoopVolume(0);
};
}
public static function visitKongregatesBattalionPage():void{
navigateToURL(new URLRequest("http://www.kongregate.com/games/urbansquall/battalion-nemesis/?gamereferral=battalion-nemesis"), "_blank");
}
public static function isKongregateWebsite():Boolean{
return ((currentStage.root.loaderInfo.url.indexOf("http://chat.kongregate.com") >= 0));
}
public static function getMouseCursor():MouseCursor{
return (mouseCursor);
}
public static function getScreen():Sprite{
return (screen);
}
public static function getStorage():Storage{
return (storage);
}
public static function setMusicButtonVisibility(_arg1:Boolean):void{
soundButton.visible = _arg1;
musicButton.visible = _arg1;
}
}
}//package com.gamedozer.battalion
Section 179
//BattalionMain_Tahoma (com.gamedozer.battalion.BattalionMain_Tahoma)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionMain_Tahoma extends FontAsset {
}
}//package com.gamedozer.battalion
Section 180
//BattalionPreloader (com.gamedozer.battalion.BattalionPreloader)
package com.gamedozer.battalion {
import flash.events.*;
import com.gamedozer.utils.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
import flash.ui.*;
public class BattalionPreloader extends AbstractPreloader {
private var m_textfield:TextField;
private var m_logo:MovieClip;
public function BattalionPreloader(){
var _local1:ContextMenu = new ContextMenu();
_local1.hideBuiltInItems();
this.contextMenu = _local1;
}
override protected function endLoading():void{
this.stage.frameRate = 120;
removeChild(m_textfield);
m_textfield = null;
m_logo.stop();
removeChild(m_logo);
m_logo = null;
}
override protected function beginLoading():void{
this.stage.frameRate = 30;
m_textfield = new TextField();
m_textfield.textColor = 0xFFFFFF;
addChild(m_textfield);
m_textfield.text = "0%";
m_logo = new splash_kong();
m_logo.x = (700 / 2);
m_logo.y = (600 / 2);
m_logo.buttonMode = true;
addChild(m_logo);
m_logo.addEventListener(MouseEvent.CLICK, visitSponsor);
m_logo.addFrameScript(128, stopLogoAnimation);
}
override protected function updateLoading(_arg1:Number):void{
m_textfield.text = (Math.round((_arg1 * 100)) + "%");
}
private function stopLogoAnimation():void{
if (m_logo != null){
m_logo.stop();
};
}
override protected function get mainClassName():String{
return ("com.gamedozer.battalion.BattalionMain");
}
public static function visitSponsor(_arg1:Event=null):void{
navigateToURL(new URLRequest("http://www.kongregate.com/?gamereferral=battalion-nemesis"), "_blank");
}
}
}//package com.gamedozer.battalion
Section 181
//BattalionXMLs (com.gamedozer.battalion.BattalionXMLs)
package com.gamedozer.battalion {
import com.gamedozer.battalion.utils.*;
import flash.utils.*;
public class BattalionXMLs {
private static const Mission_8_yimf:Class = BattalionXMLs_Mission_8_yimf;
private static const Mission_4_yimf:Class = BattalionXMLs_Mission_4_yimf;
private static const terrain_xml:Class = BattalionXMLs_terrain_xml;
private static const battalionStorage_xml:Class = BattalionXMLs_battalionStorage_xml;
private static const batut_5_yimf:Class = BattalionXMLs_batut_5_yimf;
private static const terrainModifiers_xml:Class = BattalionXMLs_terrainModifiers_xml;
private static const tileSheets_xml:Class = BattalionXMLs_tileSheets_xml;
private static const batut_1_yimf:Class = BattalionXMLs_batut_1_yimf;
private static const Mission_5_yimf:Class = BattalionXMLs_Mission_5_yimf;
private static const Mission_1_yimf:Class = BattalionXMLs_Mission_1_yimf;
private static const unitModifiers_xml:Class = BattalionXMLs_unitModifiers_xml;
private static const Mission_9_yimf:Class = BattalionXMLs_Mission_9_yimf;
private static const battalion_xml:Class = BattalionXMLs_battalion_xml;
private static const ballisticsTable_xml:Class = BattalionXMLs_ballisticsTable_xml;
private static const batut_6_yimf:Class = BattalionXMLs_batut_6_yimf;
private static const batut_2_yimf:Class = BattalionXMLs_batut_2_yimf;
private static const Mission_6_yimf:Class = BattalionXMLs_Mission_6_yimf;
private static const units_xml:Class = BattalionXMLs_units_xml;
private static const Mission_2_yimf:Class = BattalionXMLs_Mission_2_yimf;
private static const Kongregate_Bonus_Map_yimf:Class = BattalionXMLs_Kongregate_Bonus_Map_yimf;
private static const bootcamp_xml:Class = BattalionXMLs_bootcamp_xml;
private static const BattalionSettings_xml:Class = BattalionXMLs_BattalionSettings_xml;
private static const batut_3_yimf:Class = BattalionXMLs_batut_3_yimf;
private static const Mission_7_yimf:Class = BattalionXMLs_Mission_7_yimf;
private static const Mission_3_yimf:Class = BattalionXMLs_Mission_3_yimf;
private static const campaign_xml:Class = BattalionXMLs_campaign_xml;
private static const Mission_10_yimf:Class = BattalionXMLs_Mission_10_yimf;
private static const batut_4_yimf:Class = BattalionXMLs_batut_4_yimf;
public static function registerEmbeddedXMLs():void{
EmbeddedURLLoader.registerContent("maps/Kongregate_Bonus_Map.yimf", parseXML(Kongregate_Bonus_Map_yimf));
EmbeddedURLLoader.registerContent("maps/bootcamp/batut_1.yimf", parseXML(batut_1_yimf));
EmbeddedURLLoader.registerContent("maps/bootcamp/batut_2.yimf", parseXML(batut_2_yimf));
EmbeddedURLLoader.registerContent("maps/bootcamp/batut_3.yimf", parseXML(batut_3_yimf));
EmbeddedURLLoader.registerContent("maps/bootcamp/batut_4.yimf", parseXML(batut_4_yimf));
EmbeddedURLLoader.registerContent("maps/bootcamp/batut_5.yimf", parseXML(batut_5_yimf));
EmbeddedURLLoader.registerContent("maps/bootcamp/batut_6.yimf", parseXML(batut_6_yimf));
EmbeddedURLLoader.registerContent("maps/Mission_1.yimf", parseXML(Mission_1_yimf));
EmbeddedURLLoader.registerContent("maps/Mission_2.yimf", parseXML(Mission_2_yimf));
EmbeddedURLLoader.registerContent("maps/Mission_3.yimf", parseXML(Mission_3_yimf));
EmbeddedURLLoader.registerContent("maps/Mission_4.yimf", parseXML(Mission_4_yimf));
EmbeddedURLLoader.registerContent("maps/Mission_5.yimf", parseXML(Mission_5_yimf));
EmbeddedURLLoader.registerContent("maps/Mission_6.yimf", parseXML(Mission_6_yimf));
EmbeddedURLLoader.registerContent("maps/Mission_7.yimf", parseXML(Mission_7_yimf));
EmbeddedURLLoader.registerContent("maps/Mission_8.yimf", parseXML(Mission_8_yimf));
EmbeddedURLLoader.registerContent("maps/Mission_9.yimf", parseXML(Mission_9_yimf));
EmbeddedURLLoader.registerContent("maps/Mission_10.yimf", parseXML(Mission_10_yimf));
EmbeddedURLLoader.registerContent("xml/ballisticsTable.xml", parseXML(ballisticsTable_xml));
EmbeddedURLLoader.registerContent("xml/battalion.xml", parseXML(battalion_xml));
EmbeddedURLLoader.registerContent("xml/BattalionSettings.xml", parseXML(BattalionSettings_xml));
EmbeddedURLLoader.registerContent("xml/battalionStorage.xml", parseXML(battalionStorage_xml));
EmbeddedURLLoader.registerContent("xml/bootcamp.xml", parseXML(bootcamp_xml));
EmbeddedURLLoader.registerContent("xml/campaign.xml", parseXML(campaign_xml));
EmbeddedURLLoader.registerContent("xml/terrain.xml", parseXML(terrain_xml));
EmbeddedURLLoader.registerContent("xml/terrainModifiers.xml", parseXML(terrainModifiers_xml));
EmbeddedURLLoader.registerContent("xml/tileSheets.xml", parseXML(tileSheets_xml));
EmbeddedURLLoader.registerContent("xml/unitModifiers.xml", parseXML(unitModifiers_xml));
EmbeddedURLLoader.registerContent("xml/units.xml", parseXML(units_xml));
}
private static function parseXML(_arg1:Class):String{
var _local2:ByteArray = (new (_arg1) as ByteArray);
var _local3:String = _local2.readUTFBytes(_local2.length);
return (_local3);
}
}
}//package com.gamedozer.battalion
Section 182
//BattalionXMLs_ballisticsTable_xml (com.gamedozer.battalion.BattalionXMLs_ballisticsTable_xml)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_ballisticsTable_xml extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 183
//BattalionXMLs_battalion_xml (com.gamedozer.battalion.BattalionXMLs_battalion_xml)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_battalion_xml extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 184
//BattalionXMLs_BattalionSettings_xml (com.gamedozer.battalion.BattalionXMLs_BattalionSettings_xml)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_BattalionSettings_xml extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 185
//BattalionXMLs_battalionStorage_xml (com.gamedozer.battalion.BattalionXMLs_battalionStorage_xml)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_battalionStorage_xml extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 186
//BattalionXMLs_batut_1_yimf (com.gamedozer.battalion.BattalionXMLs_batut_1_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_batut_1_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 187
//BattalionXMLs_batut_2_yimf (com.gamedozer.battalion.BattalionXMLs_batut_2_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_batut_2_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 188
//BattalionXMLs_batut_3_yimf (com.gamedozer.battalion.BattalionXMLs_batut_3_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_batut_3_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 189
//BattalionXMLs_batut_4_yimf (com.gamedozer.battalion.BattalionXMLs_batut_4_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_batut_4_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 190
//BattalionXMLs_batut_5_yimf (com.gamedozer.battalion.BattalionXMLs_batut_5_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_batut_5_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 191
//BattalionXMLs_batut_6_yimf (com.gamedozer.battalion.BattalionXMLs_batut_6_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_batut_6_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 192
//BattalionXMLs_bootcamp_xml (com.gamedozer.battalion.BattalionXMLs_bootcamp_xml)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_bootcamp_xml extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 193
//BattalionXMLs_campaign_xml (com.gamedozer.battalion.BattalionXMLs_campaign_xml)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_campaign_xml extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 194
//BattalionXMLs_Kongregate_Bonus_Map_yimf (com.gamedozer.battalion.BattalionXMLs_Kongregate_Bonus_Map_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_Kongregate_Bonus_Map_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 195
//BattalionXMLs_Mission_1_yimf (com.gamedozer.battalion.BattalionXMLs_Mission_1_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_Mission_1_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 196
//BattalionXMLs_Mission_10_yimf (com.gamedozer.battalion.BattalionXMLs_Mission_10_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_Mission_10_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 197
//BattalionXMLs_Mission_2_yimf (com.gamedozer.battalion.BattalionXMLs_Mission_2_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_Mission_2_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 198
//BattalionXMLs_Mission_3_yimf (com.gamedozer.battalion.BattalionXMLs_Mission_3_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_Mission_3_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 199
//BattalionXMLs_Mission_4_yimf (com.gamedozer.battalion.BattalionXMLs_Mission_4_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_Mission_4_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 200
//BattalionXMLs_Mission_5_yimf (com.gamedozer.battalion.BattalionXMLs_Mission_5_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_Mission_5_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 201
//BattalionXMLs_Mission_6_yimf (com.gamedozer.battalion.BattalionXMLs_Mission_6_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_Mission_6_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 202
//BattalionXMLs_Mission_7_yimf (com.gamedozer.battalion.BattalionXMLs_Mission_7_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_Mission_7_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 203
//BattalionXMLs_Mission_8_yimf (com.gamedozer.battalion.BattalionXMLs_Mission_8_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_Mission_8_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 204
//BattalionXMLs_Mission_9_yimf (com.gamedozer.battalion.BattalionXMLs_Mission_9_yimf)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_Mission_9_yimf extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 205
//BattalionXMLs_terrain_xml (com.gamedozer.battalion.BattalionXMLs_terrain_xml)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_terrain_xml extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 206
//BattalionXMLs_terrainModifiers_xml (com.gamedozer.battalion.BattalionXMLs_terrainModifiers_xml)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_terrainModifiers_xml extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 207
//BattalionXMLs_tileSheets_xml (com.gamedozer.battalion.BattalionXMLs_tileSheets_xml)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_tileSheets_xml extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 208
//BattalionXMLs_unitModifiers_xml (com.gamedozer.battalion.BattalionXMLs_unitModifiers_xml)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_unitModifiers_xml extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 209
//BattalionXMLs_units_xml (com.gamedozer.battalion.BattalionXMLs_units_xml)
package com.gamedozer.battalion {
import mx.core.*;
public class BattalionXMLs_units_xml extends ByteArrayAsset {
}
}//package com.gamedozer.battalion
Section 210
//ModeData (com.gamedozer.ui.modes.ModeData)
package com.gamedozer.ui.modes {
public class ModeData {
}
}//package com.gamedozer.ui.modes
Section 211
//ModeInterface (com.gamedozer.ui.modes.ModeInterface)
package com.gamedozer.ui.modes {
import flash.display.*;
public interface ModeInterface {
function pushed(_arg1:DisplayObjectContainer, _arg2:ModeData):void;
function gainFocus():void;
function loseFocus():void;
function popped():void;
}
}//package com.gamedozer.ui.modes
Section 212
//ModeManager (com.gamedozer.ui.modes.ModeManager)
package com.gamedozer.ui.modes {
import flash.display.*;
import flash.utils.*;
public class ModeManager {
private var m_modeLookup:Dictionary;
private var m_modeStack:Array;
private var m_container:DisplayObjectContainer;
public function ModeManager(_arg1:DisplayObjectContainer){
m_modeLookup = new Dictionary(false);
m_modeStack = new Array();
super();
m_container = _arg1;
}
public function createMode(_arg1:ModeInterface, _arg2:ModeData):void{
var _local3:ModeInterface = getTop();
if (_local3 != null){
_local3.loseFocus();
};
m_modeStack.push(_arg1);
_arg1.pushed(m_container, _arg2);
var _local4:ModeInterface = getTop();
_local4.gainFocus();
}
public function createSwitchMode(_arg1:ModeInterface, _arg2:ModeData):void{
popMode();
createMode(_arg1, _arg2);
}
public function registerMode(_arg1:String, _arg2:ModeInterface):void{
if (m_modeLookup[_arg1] != null){
trace(("ModeManager.registerMode: There already is a mode with " + _arg1));
return;
};
m_modeLookup[_arg1] = _arg2;
}
public function getTop():ModeInterface{
if (m_modeStack.length == 0){
return (null);
};
return (m_modeStack[(m_modeStack.length - 1)]);
}
public function popMode():void{
var _local1:ModeInterface = getTop();
if (_local1 == null){
trace("NO CURRENT TOP");
return;
};
m_modeStack.splice((m_modeStack.length - 1), 1);
_local1.popped();
var _local2:ModeInterface = getTop();
if (_local2 != null){
_local2.gainFocus();
};
}
public function switchMode(_arg1:String, _arg2:ModeData):void{
popMode();
pushMode(_arg1, _arg2);
}
public function pushMode(_arg1:String, _arg2:ModeData):void{
var _local3:ModeInterface = m_modeLookup[_arg1];
if (_local3 == null){
trace(("ModeManager.pushMode: There is no mode with the key " + _arg1));
return;
};
var _local4:ModeInterface = getTop();
if (_local4 != null){
_local4.loseFocus();
};
m_modeStack.push(_local3);
_local3.pushed(m_container, _arg2);
var _local5:ModeInterface = getTop();
_local5.gainFocus();
}
public function dispose():void{
trace("ModeManager.dispose:: TODO, implement.");
}
}
}//package com.gamedozer.ui.modes
Section 213
//AbstractPreloader (com.gamedozer.utils.AbstractPreloader)
package com.gamedozer.utils {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class AbstractPreloader extends MovieClip {
private var m_firstEnterFrame:Boolean;
public function AbstractPreloader(){
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stop();
m_firstEnterFrame = true;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function initialize():void{
var _local1:Class = (getDefinitionByName(mainClassName) as Class);
if (_local1 == null){
throw (new Error("AbstractPreloader:initialize. There was no class matching that name. Did you remember to override mainClassName?"));
};
var _local2:DisplayObject = (new (_local1) as DisplayObject);
if (_local2 == null){
throw (new Error("AbstractPreloader:initialize. Main class needs to inherit from Sprite or MovieClip."));
};
addChildAt(_local2, 0);
}
protected function endLoading():void{
}
protected function beginLoading():void{
}
private function onEnterFrame(_arg1:Event):void{
var _local2:Number;
if (m_firstEnterFrame){
m_firstEnterFrame = false;
if (root.loaderInfo.bytesLoaded >= root.loaderInfo.bytesTotal){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
nextFrame();
initialize();
} else {
beginLoading();
};
return;
};
if (root.loaderInfo.bytesLoaded >= root.loaderInfo.bytesTotal){
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
nextFrame();
initialize();
endLoading();
} else {
_local2 = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal);
updateLoading(_local2);
};
}
protected function get mainClassName():String{
return ("Main");
}
protected function updateLoading(_arg1:Number):void{
}
}
}//package com.gamedozer.utils
Section 214
//Delegate (com.gamedozer.utils.Delegate)
package com.gamedozer.utils {
public class Delegate {
public static function create(_arg1, _arg2:Function, ... _args):Function{
var target = _arg1;
var handler = _arg2;
var rest = _args;
var delegate:Function = function (... _args){
var _local2:Array = _args.concat(rest);
return (handler.apply(target, _local2));
};
return (delegate);
}
}
}//package com.gamedozer.utils
Section 215
//Set (com.gamedozer.utils.Set)
package com.gamedozer.utils {
import flash.utils.*;
public class Set {
var m_membersArray:Array;
var m_membersMap:Dictionary;
public function Set(){
m_membersMap = new Dictionary(true);
m_membersArray = new Array();
}
public function addObject(_arg1:Object):void{
if (containsObject(_arg1)){
return;
};
m_membersArray.push(_arg1);
m_membersMap[_arg1] = _arg1;
}
public function size():int{
return (m_membersArray.length);
}
public function isEmpty():Boolean{
return ((m_membersArray.length == 0));
}
public function removeObject(_arg1:Object):void{
if (!containsObject(_arg1)){
return;
};
m_membersMap[_arg1] = null;
var _local2:int = m_membersArray.length;
var _local3:int;
while (_local3 < _local2) {
if (m_membersArray[_local3] == _arg1){
m_membersArray.splice(_local3, 1);
break;
};
_local3++;
};
}
public function equals(_arg1:Set):Boolean{
if (size() != _arg1.size()){
return (false);
};
if (containsSet(_arg1)){
return (true);
};
return (false);
}
public function getArrayCopy():Array{
return (m_membersArray.slice());
}
public function toString():String{
return ((((("<Set[" + size()) + "],") + m_membersArray) + ">"));
}
public function clear():void{
var _local1:int = m_membersArray.length;
var _local2:int;
while (_local2 < _local1) {
m_membersMap[m_membersArray[_local2]] = null;
_local2++;
};
m_membersArray.splice(0);
}
public function union(_arg1:Set):Set{
var _local2:Array = m_membersArray.concat(_arg1.m_membersArray);
var _local3:Set = new Set();
_local3.addArray(_local2);
return (_local3);
}
public function minus(_arg1:Set):Set{
var _local6:Object;
var _local2:Array = new Array();
var _local3:int = m_membersArray.length;
var _local4:int;
while (_local4 < _local3) {
_local6 = m_membersArray[_local4];
if (!_arg1.containsObject(_local6)){
_local2.push(_local6);
};
_local4++;
};
var _local5:Set = new Set();
_local5.addArray(_local2);
return (_local5);
}
public function addArray(_arg1:Array):void{
var _local2:int = _arg1.length;
var _local3:int;
while (_local3 < _local2) {
addObject(_arg1[_local3]);
_local3++;
};
}
public function containsSet(_arg1:Set):Boolean{
var _local5:Object;
var _local2:Array = _arg1.m_membersArray;
var _local3:int = _local2.length;
var _local4:int;
while (_local4 < _local3) {
_local5 = _local2[_local4];
if (!containsObject(_local5)){
return (false);
};
_local4++;
};
return (true);
}
public function clone():Set{
var _local1:Set = new Set();
_local1.addArray(m_membersArray);
return (_local1);
}
public function containsObject(_arg1:Object):Boolean{
return (!((m_membersMap[_arg1] == null)));
}
public function intersect(_arg1:Set):Set{
var _local7:Object;
var _local2:Array = new Array();
var _local3:Array = _arg1.m_membersArray;
var _local4:int = _local3.length;
var _local5:int;
while (_local5 < _local4) {
_local7 = _local3[_local5];
if (containsObject(_local7)){
_local2.push(_local7);
};
_local5++;
};
var _local6:Set = new Set();
_local6.addArray(_local2);
return (_local6);
}
}
}//package com.gamedozer.utils
Section 216
//Settings (com.gamedozer.utils.Settings)
package com.gamedozer.utils {
import flash.events.*;
import flash.net.*;
import flash.utils.*;
public class Settings {
private var m_keyValueMap:Dictionary;
public function Settings(){
m_keyValueMap = new Dictionary(true);
}
function dispose():void{
m_keyValueMap = null;
}
public function getString(_arg1:String, _arg2:String):String{
if (!exists(_arg1)){
return (_arg2);
};
return (String(m_keyValueMap[_arg1]));
}
function error(_arg1:String):void{
trace(_arg1);
}
function handleFileLoad(_arg1:Event):void{
loadFromXML(new XML(_arg1.target.data));
}
function loadFromXML(_arg1:XML):void{
var _local3:XML;
var _local4:String;
var _local5:String;
var _local2:XMLList = _arg1.descendants("setting");
for each (_local3 in _local2) {
_local4 = _local3.attribute("key");
_local5 = _local3.attribute("value");
if (_local4 == ""){
} else {
m_keyValueMap[_local4] = _local5;
};
};
}
public function getBoolean(_arg1:String, _arg2:Boolean):Boolean{
if (!exists(_arg1)){
return (_arg2);
};
return (Boolean(m_keyValueMap[_arg1]));
}
public function getInt(_arg1:String, _arg2:int):int{
if (!exists(_arg1)){
return (_arg2);
};
return (int(m_keyValueMap[_arg1]));
}
public function exists(_arg1:String):Boolean{
if (m_keyValueMap[_arg1] == null){
error((("Settings:exists. Key not found " + _arg1) + "."));
return (false);
};
return (true);
}
public function getNumber(_arg1:String, _arg2:Number):Number{
if (!exists(_arg1)){
return (_arg2);
};
var _local3:Number = Number(m_keyValueMap[_arg1]);
if (isNaN(_local3)){
error((("Settings:getNumber. Key " + _arg1) + " is not a number."));
return (0);
};
return (_local3);
}
public static function createSettingsFromURL(_arg1:String):Settings{
var _local2:Settings = new (Settings);
var _local3:URLLoader = new URLLoader();
var _local4:URLRequest = new URLRequest(_arg1);
_local3.load(_local4);
_local3.addEventListener(Event.COMPLETE, _local2.handleFileLoad);
return (_local2);
}
public static function createSettingsFromXML(_arg1:XML):Settings{
var _local2:Settings = new (Settings);
_local2.loadFromXML(_arg1);
return (_local2);
}
}
}//package com.gamedozer.utils
Section 217
//Storage (com.gamedozer.utils.Storage)
package com.gamedozer.utils {
import flash.net.*;
public class Storage {
var m_sharedObject:SharedObject;
var xml:Array;
public function Storage(_arg1:String){
m_sharedObject = SharedObject.getLocal(_arg1);
}
public function getInt(_arg1:String, _arg2:int):int{
if (m_sharedObject.data[_arg1] == null){
m_sharedObject.data[_arg1] = _arg2;
return (_arg2);
};
var _local3:Number = Number(m_sharedObject.data[_arg1]);
if (isNaN(_local3)){
trace((("Storage:getInt. Key " + _arg1) + " is not an integer."));
return (0);
};
return (_local3);
}
public function getXML(_arg1:String, _arg2:XML):XML{
if (m_sharedObject.data[_arg1] == null){
m_sharedObject.data[_arg1] = _arg2;
return (_arg2);
};
return (m_sharedObject.data[_arg1]);
}
public function setBoolean(_arg1:String, _arg2:Boolean):void{
m_sharedObject.data[_arg1] = _arg2;
}
public function getString(_arg1:String, _arg2:String):String{
if (m_sharedObject.data[_arg1] == null){
m_sharedObject.data[_arg1] = _arg2;
return (_arg2);
};
return (String(m_sharedObject.data[_arg1]));
}
public function loadFromXML(_arg1:XML, _arg2:Boolean=true):void{
var _local4:XML;
var _local5:String;
var _local6:String;
if (_arg2){
if (xml == null){
xml = new Array();
};
xml.push(_arg1);
};
var _local3:XMLList = _arg1.descendants("storage");
for each (_local4 in _local3) {
_local5 = _local4.attribute("key");
_local6 = _local4.attribute("value");
if (_local5 == ""){
} else {
if (m_sharedObject.data[_local5] == null){
m_sharedObject.data[_local5] = _local6;
};
};
};
}
public function setNumber(_arg1:String, _arg2:Number):void{
m_sharedObject.data[_arg1] = _arg2;
}
public function clear():void{
var _local1:int;
m_sharedObject.clear();
if (xml != null){
_local1 = 0;
while (_local1 < xml.length) {
loadFromXML(xml[_local1], false);
_local1++;
};
};
}
public function getBoolean(_arg1:String, _arg2:Boolean):Boolean{
if (m_sharedObject.data[_arg1] == null){
m_sharedObject.data[_arg1] = _arg2;
return (_arg2);
};
return (Boolean(m_sharedObject.data[_arg1]));
}
public function setInt(_arg1:String, _arg2:int):void{
m_sharedObject.data[_arg1] = _arg2;
}
public function setXML(_arg1:String, _arg2:XML):void{
m_sharedObject.data[_arg1] = _arg2;
}
public function hasAllocatedSpace(_arg1:int):Boolean{
return ((m_sharedObject.flush(_arg1) == SharedObjectFlushStatus.FLUSHED));
}
public function setString(_arg1:String, _arg2:String):void{
m_sharedObject.data[_arg1] = _arg2;
}
public function getNumber(_arg1:String, _arg2:Number):Number{
if (m_sharedObject.data[_arg1] == null){
m_sharedObject.data[_arg1] = _arg2;
return (_arg2);
};
var _local3:Number = Number(m_sharedObject.data[_arg1]);
if (isNaN(_local3)){
trace((("Storage:getNumber. Key " + _arg1) + " is not a number."));
return (0);
};
return (_local3);
}
}
}//package com.gamedozer.utils
Section 218
//KongregateEvent (com.kongregate.as3.client.events.KongregateEvent)
package com.kongregate.as3.client.events {
import flash.events.*;
public class KongregateEvent extends Event {
public static const COMPLETE:String = "component_api_available";
public function KongregateEvent(_arg1:String){
super(_arg1);
}
}
}//package com.kongregate.as3.client.events
Section 219
//AbstractShadowService (com.kongregate.as3.client.services.AbstractShadowService)
package com.kongregate.as3.client.services {
import flash.events.*;
public class AbstractShadowService extends EventDispatcher {
protected function alert(_arg1:String, _arg2:String, _arg3="", _arg4:String=""):void{
trace(((((((("Kongregate API: " + _arg1) + ".") + _arg2) + "(") + _arg3) + ") ") + _arg4));
}
}
}//package com.kongregate.as3.client.services
Section 220
//HighScoreServiceShadow (com.kongregate.as3.client.services.HighScoreServiceShadow)
package com.kongregate.as3.client.services {
public class HighScoreServiceShadow extends AbstractShadowService implements IHighScoreServices {
private var mode:String;
public function HighScoreServiceShadow(){
mode = "";
}
public function submit(_arg1:Number, _arg2:String=null):void{
alert("IHighScoreServices", "submit", arguments);
}
public function connect():Boolean{
alert("IKongregateServices", "connect");
return (true);
}
public function requestList(_arg1:Function):void{
alert("IHighScoreServices", "requestList", "", (("[Mode: " + mode) + "]"));
_arg1({success:false});
}
public function setMode(_arg1:String):void{
alert("IHighScoreServices", "setMode", arguments);
this.mode = _arg1;
}
}
}//package com.kongregate.as3.client.services
Section 221
//IHighScoreServices (com.kongregate.as3.client.services.IHighScoreServices)
package com.kongregate.as3.client.services {
public interface IHighScoreServices {
function setMode(_arg1:String):void;
function submit(_arg1:Number, _arg2:String=null):void;
function requestList(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 222
//IKongregateServices (com.kongregate.as3.client.services.IKongregateServices)
package com.kongregate.as3.client.services {
import flash.events.*;
public interface IKongregateServices extends IEventDispatcher {
function getPlayerInfo(_arg1:Function):void;
function connect(_arg1:Number=-1):Boolean;
}
}//package com.kongregate.as3.client.services
Section 223
//IStatServices (com.kongregate.as3.client.services.IStatServices)
package com.kongregate.as3.client.services {
public interface IStatServices {
function submitArray(_arg1:Array):void;
function submit(_arg1:String, _arg2:Number):void;
}
}//package com.kongregate.as3.client.services
Section 224
//IUserServices (com.kongregate.as3.client.services.IUserServices)
package com.kongregate.as3.client.services {
public interface IUserServices {
function getName():String;
function getPlayerInfo(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 225
//KongregateServiceShadow (com.kongregate.as3.client.services.KongregateServiceShadow)
package com.kongregate.as3.client.services {
public class KongregateServiceShadow extends AbstractShadowService implements IKongregateServices {
public function getName():String{
alert("IKongregateServices", "getName");
return ("Guest");
}
public function connect(_arg1:Number=-1):Boolean{
alert("IKongregateServices", "connect", arguments);
return (true);
}
public function getPlayerInfo(_arg1:Function):void{
alert("IKongregateServices", "getPlayerInfo");
_arg1(new Object());
}
}
}//package com.kongregate.as3.client.services
Section 226
//StatServiceShadow (com.kongregate.as3.client.services.StatServiceShadow)
package com.kongregate.as3.client.services {
public class StatServiceShadow extends AbstractShadowService implements IStatServices {
public function submitArray(_arg1:Array):void{
alert("IStatServices", "submitArray", arguments);
}
public function submit(_arg1:String, _arg2:Number):void{
alert("IStatServices", "submitStat", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 227
//UserServiceShadow (com.kongregate.as3.client.services.UserServiceShadow)
package com.kongregate.as3.client.services {
public class UserServiceShadow extends AbstractShadowService implements IUserServices {
public function getName():String{
alert("UserService", "getName");
return ("Guest");
}
public function getPlayerInfo(_arg1:Function):void{
alert("UserService", "getPlayerInfo");
_arg1({isGuest:true, name:"Guest", points:0, level:0, isMode:false, isAdmin:false, isDeveloper:false, avatarPath:"", chatAvatarPath:""});
}
}
}//package com.kongregate.as3.client.services
Section 228
//IAPIBootstrap (com.kongregate.as3.client.IAPIBootstrap)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
public interface IAPIBootstrap {
function init(_arg1:Event=null, _arg2:Stage=null):void;
function hideLog():void;
function showLog(_arg1:int=0):void;
}
}//package com.kongregate.as3.client
Section 229
//KongregateAPI (com.kongregate.as3.client.KongregateAPI)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
import com.kongregate.as3.client.services.*;
import flash.system.*;
import flash.net.*;
import flash.utils.*;
import com.kongregate.as3.client.events.*;
import flash.errors.*;
public class KongregateAPI extends Sprite {
private const VERSION:Number = 1;
private var loader:Loader;
private var loadedDomain:ApplicationDomain;
private static const CLASS_USER:String = "com.kongregate.as3.client.services.UserServices";
private static const CLASS_STATS:String = "com.kongregate.as3.client.services.StatServices";
private static const CLASS_SERVICES:String = "com.kongregate.as3.client.services.KongregateServices";
private static const CLASS_SCORES:String = "com.kongregate.as3.client.services.HighScoreServices";
private static const DEBUG_API_URL:String = "//Linuxpc/kongregate/public/flash/API_AS3.swf";
private static var _connected:Boolean;
private static var kUser:IUserServices;
private static var _loaded:Boolean;
private static var kServices:IKongregateServices;
private static var kScores:IHighScoreServices;
private static var mInstance:KongregateAPI;
private static var kStats:IStatServices;
private static var kAPI:IAPIBootstrap;
public function KongregateAPI(){
if (mInstance != null){
throw (new Error("Warning: KongregateAPI has been added to stage more than once or accessed improperly. Use getInstance() or a stage reference to access."));
};
mInstance = this;
this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
public function get loaded():Boolean{
return (_loaded);
}
public function get connected():Boolean{
return (_connected);
}
private function alertConnected(_arg1:TimerEvent=null):void{
var _local2:KongregateEvent;
var _local3:Boolean;
_local2 = new KongregateEvent(KongregateEvent.COMPLETE);
_local3 = this.dispatchEvent(_local2);
}
private function init(_arg1:Event):void{
var _local2:Object;
var _local3:String;
var _local4:URLRequest;
var _local5:LoaderContext;
this.removeEventListener(Event.ADDED_TO_STAGE, init);
_loaded = false;
_connected = false;
_local2 = LoaderInfo(root.loaderInfo).parameters;
_local3 = _local2.api_path;
if (_local3 == null){
trace("Alert: Kongregate API could not be loaded, due to local testing. API will load when the game is uploaded.");
createShadowServices();
return;
};
Security.allowDomain("*.kongregate.com");
Security.allowDomain("kongregatetrunk.com");
_local4 = new URLRequest(_local3);
_local5 = new LoaderContext(false);
_local5.applicationDomain = ApplicationDomain.currentDomain;
_local5.securityDomain = SecurityDomain.currentDomain;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.load(_local4, _local5);
}
public function get api():IAPIBootstrap{
return (kAPI);
}
private function loadComplete(_arg1:Event):void{
getServices();
}
public function get scores():IHighScoreServices{
return (kScores);
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
throw (new IOError(("API file not found. " + _arg1)));
}
public function get services():IKongregateServices{
return (kServices);
}
public function get stats():IStatServices{
return (kStats);
}
private function createShadowServices():void{
var _local1:Timer;
trace(">>> Kongregate Shadow Services instantiated for local development..");
kServices = new KongregateServiceShadow();
kScores = new HighScoreServiceShadow();
kStats = new StatServiceShadow();
kUser = new UserServiceShadow();
_local1 = new Timer(200, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, alertConnected);
_local1.start();
_connected = true;
}
public function get user():IUserServices{
return (kUser);
}
private function getServices():void{
var _local1:ApplicationDomain;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = ApplicationDomain.currentDomain;
kAPI = IAPIBootstrap(loader.getChildAt(0));
this.addChild(loader);
_local2 = _local1.getDefinition(CLASS_SERVICES);
trace(_local2);
kServices = _local2.getInstance();
_local3 = _local1.getDefinition(CLASS_SCORES);
kScores = _local3.getInstance();
_local4 = _local1.getDefinition(CLASS_STATS);
kStats = _local4.getInstance();
_local5 = _local1.getDefinition(CLASS_USER);
kUser = _local5.getInstance();
kServices.connect(VERSION);
_loaded = true;
_connected = true;
alertConnected();
}
public static function getInstance():KongregateAPI{
if (!mInstance){
throw (new IllegalOperationError("You must add the Kongregate API component to the stage before attempting to access it."));
};
return (mInstance);
}
}
}//package com.kongregate.as3.client
Section 230
//Circ (com.robertpenner.easing.Circ)
package com.robertpenner.easing {
public class Circ {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2));
}
}
}//package com.robertpenner.easing
Section 231
//Linear (com.robertpenner.easing.Linear)
package com.robertpenner.easing {
public class Linear {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package com.robertpenner.easing
Section 232
//Quad (com.robertpenner.easing.Quad)
package com.robertpenner.easing {
public class Quad {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
}
}//package com.robertpenner.easing
Section 233
//Sine (com.robertpenner.easing.Sine)
package com.robertpenner.easing {
public class Sine {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2));
}
}
}//package com.robertpenner.easing
Section 234
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 235
//EdgeMetrics (mx.core.EdgeMetrics)
package mx.core {
public class EdgeMetrics {
public var top:Number;
public var left:Number;
public var bottom:Number;
public var right:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
;
public function EdgeMetrics(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
this.left = _arg1;
this.top = _arg2;
this.right = _arg3;
this.bottom = _arg4;
}
public function clone():EdgeMetrics{
return (new EdgeMetrics(left, top, right, bottom));
}
}
}//package mx.core
Section 236
//FlexLoader (mx.core.FlexLoader)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexLoader extends Loader {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexLoader(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 237
//FlexShape (mx.core.FlexShape)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexShape extends Shape {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexShape(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 238
//FlexVersion (mx.core.FlexVersion)
package mx.core {
import mx.resources.*;
public class FlexVersion {
public static const VERSION_2_0_1:uint = 33554433;
public static const CURRENT_VERSION:uint = 50331648;
public static const VERSION_3_0:uint = 50331648;
public static const VERSION_2_0:uint = 33554432;
public static const VERSION_ALREADY_READ:String = "versionAlreadyRead";
public static const VERSION_ALREADY_SET:String = "versionAlreadySet";
mx_internal static const VERSION:String = "3.0.0.0";
private static var compatibilityVersionChanged:Boolean = false;
private static var _compatibilityErrorFunction:Function;
private static var _compatibilityVersion:uint = 50331648;
private static var compatibilityVersionRead:Boolean = false;
mx_internal static function changeCompatibilityVersionString(_arg1:String):void{
var _local2:Array = _arg1.split(".");
var _local3:uint = parseInt(_local2[0]);
var _local4:uint = parseInt(_local2[1]);
var _local5:uint = parseInt(_local2[2]);
_compatibilityVersion = (((_local3 << 24) + (_local4 << 16)) + _local5);
}
public static function set compatibilityVersion(_arg1:uint):void{
var _local2:String;
if (_arg1 == _compatibilityVersion){
return;
};
if (compatibilityVersionChanged){
if (compatibilityErrorFunction == null){
_local2 = ResourceManager.getInstance().getString("core", VERSION_ALREADY_SET);
throw (new Error(_local2));
};
compatibilityErrorFunction(_arg1, VERSION_ALREADY_SET);
};
if (compatibilityVersionRead){
if (compatibilityErrorFunction == null){
_local2 = ResourceManager.getInstance().getString("core", VERSION_ALREADY_READ);
throw (new Error(_local2));
};
compatibilityErrorFunction(_arg1, VERSION_ALREADY_READ);
};
_compatibilityVersion = _arg1;
compatibilityVersionChanged = true;
}
public static function get compatibilityVersion():uint{
compatibilityVersionRead = true;
return (_compatibilityVersion);
}
public static function set compatibilityErrorFunction(_arg1:Function):void{
_compatibilityErrorFunction = _arg1;
}
public static function set compatibilityVersionString(_arg1:String):void{
var _local2:Array = _arg1.split(".");
var _local3:uint = parseInt(_local2[0]);
var _local4:uint = parseInt(_local2[1]);
var _local5:uint = parseInt(_local2[2]);
compatibilityVersion = (((_local3 << 24) + (_local4 << 16)) + _local5);
}
public static function get compatibilityErrorFunction():Function{
return (_compatibilityErrorFunction);
}
public static function get compatibilityVersionString():String{
var _local1:uint = ((compatibilityVersion >> 24) & 0xFF);
var _local2:uint = ((compatibilityVersion >> 16) & 0xFF);
var _local3:uint = (compatibilityVersion & 0xFFFF);
return (((((_local1.toString() + ".") + _local2.toString()) + ".") + _local3.toString()));
}
}
}//package mx.core
Section 239
//FontAsset (mx.core.FontAsset)
package mx.core {
import flash.text.*;
public class FontAsset extends Font implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 240
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 241
//IButton (mx.core.IButton)
package mx.core {
public interface IButton extends IUIComponent {
function get emphasized():Boolean;
function set emphasized(_arg1:Boolean):void;
function callLater(_arg1:Function, _arg2:Array=null):void;
}
}//package mx.core
Section 242
//IChildList (mx.core.IChildList)
package mx.core {
import flash.display.*;
import flash.geom.*;
public interface IChildList {
function get numChildren():int;
function removeChild(_arg1:DisplayObject):DisplayObject;
function getChildByName(_arg1:String):DisplayObject;
function removeChildAt(_arg1:int):DisplayObject;
function getChildIndex(_arg1:DisplayObject):int;
function addChildAt(_arg1:DisplayObject, _arg2:int):DisplayObject;
function getObjectsUnderPoint(_arg1:Point):Array;
function setChildIndex(_arg1:DisplayObject, _arg2:int):void;
function getChildAt(_arg1:int):DisplayObject;
function addChild(_arg1:DisplayObject):DisplayObject;
function contains(_arg1:DisplayObject):Boolean;
}
}//package mx.core
Section 243
//IContainer (mx.core.IContainer)
package mx.core {
import flash.display.*;
import flash.media.*;
import flash.geom.*;
import flash.text.*;
import mx.managers.*;
public interface IContainer extends IUIComponent {
function set hitArea(_arg1:Sprite):void;
function swapChildrenAt(_arg1:int, _arg2:int):void;
function getChildByName(_arg1:String):DisplayObject;
function get doubleClickEnabled():Boolean;
function get graphics():Graphics;
function get useHandCursor():Boolean;
function addChildAt(_arg1:DisplayObject, _arg2:int):DisplayObject;
function set mouseChildren(_arg1:Boolean):void;
function set creatingContentPane(_arg1:Boolean):void;
function get textSnapshot():TextSnapshot;
function getChildIndex(_arg1:DisplayObject):int;
function set doubleClickEnabled(_arg1:Boolean):void;
function getObjectsUnderPoint(_arg1:Point):Array;
function get creatingContentPane():Boolean;
function setChildIndex(_arg1:DisplayObject, _arg2:int):void;
function get soundTransform():SoundTransform;
function set useHandCursor(_arg1:Boolean):void;
function get numChildren():int;
function contains(_arg1:DisplayObject):Boolean;
function get verticalScrollPosition():Number;
function set defaultButton(_arg1:IFlexDisplayObject):void;
function swapChildren(_arg1:DisplayObject, _arg2:DisplayObject):void;
function set horizontalScrollPosition(_arg1:Number):void;
function get focusManager():IFocusManager;
function startDrag(_arg1:Boolean=false, _arg2:Rectangle=null):void;
function set mouseEnabled(_arg1:Boolean):void;
function getChildAt(_arg1:int):DisplayObject;
function set soundTransform(_arg1:SoundTransform):void;
function get tabChildren():Boolean;
function get tabIndex():int;
function set focusRect(_arg1:Object):void;
function get hitArea():Sprite;
function get mouseChildren():Boolean;
function removeChildAt(_arg1:int):DisplayObject;
function get defaultButton():IFlexDisplayObject;
function stopDrag():void;
function set tabEnabled(_arg1:Boolean):void;
function get horizontalScrollPosition():Number;
function get focusRect():Object;
function get viewMetrics():EdgeMetrics;
function set verticalScrollPosition(_arg1:Number):void;
function get dropTarget():DisplayObject;
function get mouseEnabled():Boolean;
function set tabChildren(_arg1:Boolean):void;
function set buttonMode(_arg1:Boolean):void;
function get tabEnabled():Boolean;
function get buttonMode():Boolean;
function removeChild(_arg1:DisplayObject):DisplayObject;
function set tabIndex(_arg1:int):void;
function addChild(_arg1:DisplayObject):DisplayObject;
function areInaccessibleObjectsUnderPoint(_arg1:Point):Boolean;
}
}//package mx.core
Section 244
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 245
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(_arg1:Point):Point;
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(_arg1:String):void;
function set scaleX(_arg1:Number):void;
function set scaleY(_arg1:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(_arg1:Point):Point;
function get height():Number;
function set blendMode(_arg1:String):void;
function get parent():DisplayObjectContainer;
function getBounds(_arg1:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(_arg1:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(_arg1:Number):void;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(_arg1:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(_arg1:Number):void;
function set mask(_arg1:DisplayObject):void;
function getRect(_arg1:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(_arg1:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(_arg1:DisplayObject):Boolean;
function set opaqueBackground(_arg1:Object):void;
function set visible(_arg1:Boolean):void;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function get transform():Transform;
function set filters(_arg1:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(_arg1:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 246
//IFlexModuleFactory (mx.core.IFlexModuleFactory)
package mx.core {
public interface IFlexModuleFactory {
function create(... _args):Object;
function info():Object;
}
}//package mx.core
Section 247
//IInvalidating (mx.core.IInvalidating)
package mx.core {
public interface IInvalidating {
function validateNow():void;
function invalidateSize():void;
function invalidateDisplayList():void;
function invalidateProperties():void;
}
}//package mx.core
Section 248
//IProgrammaticSkin (mx.core.IProgrammaticSkin)
package mx.core {
public interface IProgrammaticSkin {
function validateNow():void;
function validateDisplayList():void;
}
}//package mx.core
Section 249
//IRawChildrenContainer (mx.core.IRawChildrenContainer)
package mx.core {
public interface IRawChildrenContainer {
function get rawChildren():IChildList;
}
}//package mx.core
Section 250
//IRectangularBorder (mx.core.IRectangularBorder)
package mx.core {
import flash.geom.*;
public interface IRectangularBorder extends IBorder {
function get backgroundImageBounds():Rectangle;
function get hasBackgroundImage():Boolean;
function set backgroundImageBounds(_arg1:Rectangle):void;
function layoutBackgroundImage():void;
}
}//package mx.core
Section 251
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 252
//IUIComponent (mx.core.IUIComponent)
package mx.core {
import flash.display.*;
import mx.managers.*;
public interface IUIComponent extends IFlexDisplayObject {
function set focusPane(_arg1:Sprite):void;
function get enabled():Boolean;
function set enabled(_arg1:Boolean):void;
function set isPopUp(_arg1:Boolean):void;
function get explicitMinHeight():Number;
function get percentWidth():Number;
function get isPopUp():Boolean;
function get owner():DisplayObjectContainer;
function get percentHeight():Number;
function get baselinePosition():Number;
function owns(_arg1:DisplayObject):Boolean;
function initialize():void;
function get maxWidth():Number;
function get minWidth():Number;
function getExplicitOrMeasuredWidth():Number;
function get explicitMaxWidth():Number;
function get explicitMaxHeight():Number;
function set percentHeight(_arg1:Number):void;
function get minHeight():Number;
function set percentWidth(_arg1:Number):void;
function get document():Object;
function get focusPane():Sprite;
function getExplicitOrMeasuredHeight():Number;
function set tweeningProperties(_arg1:Array):void;
function set explicitWidth(_arg1:Number):void;
function set measuredMinHeight(_arg1:Number):void;
function get explicitMinWidth():Number;
function get tweeningProperties():Array;
function get maxHeight():Number;
function set owner(_arg1:DisplayObjectContainer):void;
function set includeInLayout(_arg1:Boolean):void;
function setVisible(_arg1:Boolean, _arg2:Boolean=false):void;
function parentChanged(_arg1:DisplayObjectContainer):void;
function get explicitWidth():Number;
function get measuredMinHeight():Number;
function set measuredMinWidth(_arg1:Number):void;
function set explicitHeight(_arg1:Number):void;
function get includeInLayout():Boolean;
function get measuredMinWidth():Number;
function get explicitHeight():Number;
function set systemManager(_arg1:ISystemManager):void;
function set document(_arg1:Object):void;
function get systemManager():ISystemManager;
}
}//package mx.core
Section 253
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 254
//Singleton (mx.core.Singleton)
package mx.core {
public class Singleton {
mx_internal static const VERSION:String = "3.0.0.0";
private static var classMap:Object = {};
public static function registerClass(_arg1:String, _arg2:Class):void{
var _local3:Class = classMap[_arg1];
if (!_local3){
classMap[_arg1] = _arg2;
};
}
public static function getClass(_arg1:String):Class{
return (classMap[_arg1]);
}
public static function getInstance(_arg1:String):Object{
var _local2:Class = classMap[_arg1];
if (!_local2){
throw (new Error((("No class registered for interface '" + _arg1) + "'.")));
};
return (_local2["getInstance"]());
}
}
}//package mx.core
Section 255
//UIComponentGlobals (mx.core.UIComponentGlobals)
package mx.core {
import flash.display.*;
import flash.geom.*;
import mx.managers.*;
public class UIComponentGlobals {
mx_internal static var callLaterSuspendCount:int = 0;
mx_internal static var layoutManager:ILayoutManager;
mx_internal static var nextFocusObject:InteractiveObject;
mx_internal static var designTime:Boolean = false;
mx_internal static var tempMatrix:Matrix = new Matrix();
mx_internal static var callLaterDispatcherCount:int = 0;
private static var _catchCallLaterExceptions:Boolean = false;
public static function set catchCallLaterExceptions(_arg1:Boolean):void{
_catchCallLaterExceptions = _arg1;
}
public static function get designMode():Boolean{
return (designTime);
}
public static function set designMode(_arg1:Boolean):void{
designTime = _arg1;
}
public static function get catchCallLaterExceptions():Boolean{
return (_catchCallLaterExceptions);
}
}
}//package mx.core
Section 256
//ModuleEvent (mx.events.ModuleEvent)
package mx.events {
import flash.events.*;
import mx.core.*;
import mx.modules.*;
public class ModuleEvent extends ProgressEvent {
public var errorText:String;
private var _module:IModuleInfo;
public static const READY:String = "ready";
public static const ERROR:String = "error";
public static const PROGRESS:String = "progress";
mx_internal static const VERSION:String = "3.0.0.0";
public static const SETUP:String = "setup";
public static const UNLOAD:String = "unload";
public function ModuleEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:uint=0, _arg5:uint=0, _arg6:String=null, _arg7:IModuleInfo=null){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
this.errorText = _arg6;
this._module = _arg7;
}
public function get module():IModuleInfo{
if (_module){
return (_module);
};
return ((target as IModuleInfo));
}
override public function clone():Event{
return (new ModuleEvent(type, bubbles, cancelable, bytesLoaded, bytesTotal, errorText, module));
}
}
}//package mx.events
Section 257
//ResourceEvent (mx.events.ResourceEvent)
package mx.events {
import flash.events.*;
import mx.core.*;
public class ResourceEvent extends ProgressEvent {
public var errorText:String;
mx_internal static const VERSION:String = "3.0.0.0";
public static const COMPLETE:String = "complete";
public static const PROGRESS:String = "progress";
public static const ERROR:String = "error";
public function ResourceEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:uint=0, _arg5:uint=0, _arg6:String=null){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
this.errorText = _arg6;
}
override public function clone():Event{
return (new ResourceEvent(type, bubbles, cancelable, bytesLoaded, bytesTotal, errorText));
}
}
}//package mx.events
Section 258
//StyleEvent (mx.events.StyleEvent)
package mx.events {
import flash.events.*;
import mx.core.*;
public class StyleEvent extends ProgressEvent {
public var errorText:String;
mx_internal static const VERSION:String = "3.0.0.0";
public static const COMPLETE:String = "complete";
public static const PROGRESS:String = "progress";
public static const ERROR:String = "error";
public function StyleEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:uint=0, _arg5:uint=0, _arg6:String=null){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
this.errorText = _arg6;
}
override public function clone():Event{
return (new StyleEvent(type, bubbles, cancelable, bytesLoaded, bytesTotal, errorText));
}
}
}//package mx.events
Section 259
//RectangularDropShadow (mx.graphics.RectangularDropShadow)
package mx.graphics {
import flash.display.*;
import mx.core.*;
import flash.geom.*;
import mx.utils.*;
import flash.filters.*;
public class RectangularDropShadow {
private var leftShadow:BitmapData;
private var _tlRadius:Number;// = 0
private var _trRadius:Number;// = 0
private var _angle:Number;// = 45
private var topShadow:BitmapData;
private var _distance:Number;// = 4
private var rightShadow:BitmapData;
private var _alpha:Number;// = 0.4
private var shadow:BitmapData;
private var _brRadius:Number;// = 0
private var _blRadius:Number;// = 0
private var _color:int;// = 0
private var bottomShadow:BitmapData;
private var changed:Boolean;// = true
mx_internal static const VERSION:String = "3.0.0.0";
public function get blRadius():Number{
return (_blRadius);
}
public function set brRadius(_arg1:Number):void{
if (_brRadius != _arg1){
_brRadius = _arg1;
changed = true;
};
}
public function set color(_arg1:int):void{
if (_color != _arg1){
_color = _arg1;
changed = true;
};
}
public function drawShadow(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
if (changed){
createShadowBitmaps();
changed = false;
};
_arg4 = Math.ceil(_arg4);
_arg5 = Math.ceil(_arg5);
var _local6:int = (leftShadow) ? leftShadow.width : 0;
var _local7:int = (rightShadow) ? rightShadow.width : 0;
var _local8:int = (topShadow) ? topShadow.height : 0;
var _local9:int = (bottomShadow) ? bottomShadow.height : 0;
var _local10:int = (_local6 + _local7);
var _local11:int = (_local8 + _local9);
var _local12:Number = ((_arg5 + _local11) / 2);
var _local13:Number = ((_arg4 + _local10) / 2);
var _local14:Matrix = new Matrix();
if (((leftShadow) || (topShadow))){
_local15 = Math.min((tlRadius + _local10), _local13);
_local16 = Math.min((tlRadius + _local11), _local12);
_local14.tx = (_arg2 - _local6);
_local14.ty = (_arg3 - _local8);
_arg1.beginBitmapFill(shadow, _local14);
_arg1.drawRect((_arg2 - _local6), (_arg3 - _local8), _local15, _local16);
_arg1.endFill();
};
if (((rightShadow) || (topShadow))){
_local17 = Math.min((trRadius + _local10), _local13);
_local18 = Math.min((trRadius + _local11), _local12);
_local14.tx = (((_arg2 + _arg4) + _local7) - shadow.width);
_local14.ty = (_arg3 - _local8);
_arg1.beginBitmapFill(shadow, _local14);
_arg1.drawRect((((_arg2 + _arg4) + _local7) - _local17), (_arg3 - _local8), _local17, _local18);
_arg1.endFill();
};
if (((leftShadow) || (bottomShadow))){
_local19 = Math.min((blRadius + _local10), _local13);
_local20 = Math.min((blRadius + _local11), _local12);
_local14.tx = (_arg2 - _local6);
_local14.ty = (((_arg3 + _arg5) + _local9) - shadow.height);
_arg1.beginBitmapFill(shadow, _local14);
_arg1.drawRect((_arg2 - _local6), (((_arg3 + _arg5) + _local9) - _local20), _local19, _local20);
_arg1.endFill();
};
if (((rightShadow) || (bottomShadow))){
_local21 = Math.min((brRadius + _local10), _local13);
_local22 = Math.min((brRadius + _local11), _local12);
_local14.tx = (((_arg2 + _arg4) + _local7) - shadow.width);
_local14.ty = (((_arg3 + _arg5) + _local9) - shadow.height);
_arg1.beginBitmapFill(shadow, _local14);
_arg1.drawRect((((_arg2 + _arg4) + _local7) - _local21), (((_arg3 + _arg5) + _local9) - _local22), _local21, _local22);
_arg1.endFill();
};
if (leftShadow){
_local14.tx = (_arg2 - _local6);
_local14.ty = 0;
_arg1.beginBitmapFill(leftShadow, _local14);
_arg1.drawRect((_arg2 - _local6), ((_arg3 - _local8) + _local16), _local6, ((((_arg5 + _local8) + _local9) - _local16) - _local20));
_arg1.endFill();
};
if (rightShadow){
_local14.tx = (_arg2 + _arg4);
_local14.ty = 0;
_arg1.beginBitmapFill(rightShadow, _local14);
_arg1.drawRect((_arg2 + _arg4), ((_arg3 - _local8) + _local18), _local7, ((((_arg5 + _local8) + _local9) - _local18) - _local22));
_arg1.endFill();
};
if (topShadow){
_local14.tx = 0;
_local14.ty = (_arg3 - _local8);
_arg1.beginBitmapFill(topShadow, _local14);
_arg1.drawRect(((_arg2 - _local6) + _local15), (_arg3 - _local8), ((((_arg4 + _local6) + _local7) - _local15) - _local17), _local8);
_arg1.endFill();
};
if (bottomShadow){
_local14.tx = 0;
_local14.ty = (_arg3 + _arg5);
_arg1.beginBitmapFill(bottomShadow, _local14);
_arg1.drawRect(((_arg2 - _local6) + _local19), (_arg3 + _arg5), ((((_arg4 + _local6) + _local7) - _local19) - _local21), _local9);
_arg1.endFill();
};
}
public function get brRadius():Number{
return (_brRadius);
}
public function get angle():Number{
return (_angle);
}
private function createShadowBitmaps():void{
var _local1:Number = ((Math.max(tlRadius, blRadius) + (2 * distance)) + Math.max(trRadius, brRadius));
var _local2:Number = ((Math.max(tlRadius, trRadius) + (2 * distance)) + Math.max(blRadius, brRadius));
if ((((_local1 < 0)) || ((_local2 < 0)))){
return;
};
var _local3:Shape = new FlexShape();
var _local4:Graphics = _local3.graphics;
_local4.beginFill(0xFFFFFF);
GraphicsUtil.drawRoundRectComplex(_local4, 0, 0, _local1, _local2, tlRadius, trRadius, blRadius, brRadius);
_local4.endFill();
var _local5:BitmapData = new BitmapData(_local1, _local2, true, 0);
_local5.draw(_local3, new Matrix());
var _local6:DropShadowFilter = new DropShadowFilter(distance, angle, color, alpha);
_local6.knockout = true;
var _local7:Rectangle = new Rectangle(0, 0, _local1, _local2);
var _local8:Rectangle = _local5.generateFilterRect(_local7, _local6);
var _local9:Number = (_local7.left - _local8.left);
var _local10:Number = (_local8.right - _local7.right);
var _local11:Number = (_local7.top - _local8.top);
var _local12:Number = (_local8.bottom - _local7.bottom);
shadow = new BitmapData(_local8.width, _local8.height);
shadow.applyFilter(_local5, _local7, new Point(_local9, _local11), _local6);
var _local13:Point = new Point(0, 0);
var _local14:Rectangle = new Rectangle();
if (_local9 > 0){
_local14.x = 0;
_local14.y = ((tlRadius + _local11) + _local12);
_local14.width = _local9;
_local14.height = 1;
leftShadow = new BitmapData(_local9, 1);
leftShadow.copyPixels(shadow, _local14, _local13);
} else {
leftShadow = null;
};
if (_local10 > 0){
_local14.x = (shadow.width - _local10);
_local14.y = ((trRadius + _local11) + _local12);
_local14.width = _local10;
_local14.height = 1;
rightShadow = new BitmapData(_local10, 1);
rightShadow.copyPixels(shadow, _local14, _local13);
} else {
rightShadow = null;
};
if (_local11 > 0){
_local14.x = ((tlRadius + _local9) + _local10);
_local14.y = 0;
_local14.width = 1;
_local14.height = _local11;
topShadow = new BitmapData(1, _local11);
topShadow.copyPixels(shadow, _local14, _local13);
} else {
topShadow = null;
};
if (_local12 > 0){
_local14.x = ((blRadius + _local9) + _local10);
_local14.y = (shadow.height - _local12);
_local14.width = 1;
_local14.height = _local12;
bottomShadow = new BitmapData(1, _local12);
bottomShadow.copyPixels(shadow, _local14, _local13);
} else {
bottomShadow = null;
};
}
public function get alpha():Number{
return (_alpha);
}
public function get color():int{
return (_color);
}
public function set angle(_arg1:Number):void{
if (_angle != _arg1){
_angle = _arg1;
changed = true;
};
}
public function set trRadius(_arg1:Number):void{
if (_trRadius != _arg1){
_trRadius = _arg1;
changed = true;
};
}
public function set tlRadius(_arg1:Number):void{
if (_tlRadius != _arg1){
_tlRadius = _arg1;
changed = true;
};
}
public function get trRadius():Number{
return (_trRadius);
}
public function set distance(_arg1:Number):void{
if (_distance != _arg1){
_distance = _arg1;
changed = true;
};
}
public function get distance():Number{
return (_distance);
}
public function get tlRadius():Number{
return (_tlRadius);
}
public function set alpha(_arg1:Number):void{
if (_alpha != _arg1){
_alpha = _arg1;
changed = true;
};
}
public function set blRadius(_arg1:Number):void{
if (_blRadius != _arg1){
_blRadius = _arg1;
changed = true;
};
}
}
}//package mx.graphics
Section 260
//IFocusManager (mx.managers.IFocusManager)
package mx.managers {
import flash.display.*;
import mx.core.*;
public interface IFocusManager {
function get focusPane():Sprite;
function getFocus():IFocusManagerComponent;
function deactivate():void;
function set defaultButton(_arg1:IButton):void;
function set focusPane(_arg1:Sprite):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function findFocusManagerComponent(_arg1:InteractiveObject):IFocusManagerComponent;
function get nextTabIndex():int;
function get defaultButton():IButton;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:IFocusManagerComponent):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function getNextFocusManagerComponent(_arg1:Boolean=false):IFocusManagerComponent;
}
}//package mx.managers
Section 261
//IFocusManagerComponent (mx.managers.IFocusManagerComponent)
package mx.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package mx.managers
Section 262
//IFocusManagerContainer (mx.managers.IFocusManagerContainer)
package mx.managers {
import flash.events.*;
import flash.display.*;
public interface IFocusManagerContainer extends IEventDispatcher {
function set focusManager(_arg1:IFocusManager):void;
function get focusManager():IFocusManager;
function get systemManager():ISystemManager;
function contains(_arg1:DisplayObject):Boolean;
}
}//package mx.managers
Section 263
//ILayoutManager (mx.managers.ILayoutManager)
package mx.managers {
import flash.events.*;
public interface ILayoutManager extends IEventDispatcher {
function validateNow():void;
function validateClient(_arg1:ILayoutManagerClient, _arg2:Boolean=false):void;
function isInvalid():Boolean;
function invalidateDisplayList(_arg1:ILayoutManagerClient):void;
function set usePhasedInstantiation(_arg1:Boolean):void;
function invalidateSize(_arg1:ILayoutManagerClient):void;
function get usePhasedInstantiation():Boolean;
function invalidateProperties(_arg1:ILayoutManagerClient):void;
}
}//package mx.managers
Section 264
//ILayoutManagerClient (mx.managers.ILayoutManagerClient)
package mx.managers {
import flash.events.*;
public interface ILayoutManagerClient extends IEventDispatcher {
function get updateCompletePendingFlag():Boolean;
function set updateCompletePendingFlag(_arg1:Boolean):void;
function set initialized(_arg1:Boolean):void;
function validateProperties():void;
function validateDisplayList():void;
function get nestLevel():int;
function get initialized():Boolean;
function get processedDescriptors():Boolean;
function validateSize(_arg1:Boolean=false):void;
function set nestLevel(_arg1:int):void;
function set processedDescriptors(_arg1:Boolean):void;
}
}//package mx.managers
Section 265
//ISystemManager (mx.managers.ISystemManager)
package mx.managers {
import flash.events.*;
import flash.display.*;
import mx.core.*;
import flash.geom.*;
import flash.text.*;
public interface ISystemManager extends IEventDispatcher, IChildList, IFlexModuleFactory {
function get focusPane():Sprite;
function get loaderInfo():LoaderInfo;
function get toolTipChildren():IChildList;
function set focusPane(_arg1:Sprite):void;
function isTopLevel():Boolean;
function get popUpChildren():IChildList;
function get screen():Rectangle;
function isFontFaceEmbedded(_arg1:TextFormat):Boolean;
function get rawChildren():IChildList;
function get topLevelSystemManager():ISystemManager;
function getDefinitionByName(_arg1:String):Object;
function activate(_arg1:IFocusManagerContainer):void;
function deactivate(_arg1:IFocusManagerContainer):void;
function get cursorChildren():IChildList;
function set document(_arg1:Object):void;
function get embeddedFontList():Object;
function set numModalWindows(_arg1:int):void;
function removeFocusManager(_arg1:IFocusManagerContainer):void;
function get document():Object;
function get numModalWindows():int;
function addFocusManager(_arg1:IFocusManagerContainer):void;
function get stage():Stage;
}
}//package mx.managers
Section 266
//SystemManagerGlobals (mx.managers.SystemManagerGlobals)
package mx.managers {
public class SystemManagerGlobals {
public static var topLevelSystemManagers:Array = [];
public static var bootstrapLoaderInfoURL:String;
}
}//package mx.managers
Section 267
//IModuleInfo (mx.modules.IModuleInfo)
package mx.modules {
import flash.events.*;
import mx.core.*;
import flash.system.*;
public interface IModuleInfo extends IEventDispatcher {
function get ready():Boolean;
function get loaded():Boolean;
function load(_arg1:ApplicationDomain=null, _arg2:SecurityDomain=null):void;
function release():void;
function get error():Boolean;
function get data():Object;
function publish(_arg1:IFlexModuleFactory):void;
function get factory():IFlexModuleFactory;
function set data(_arg1:Object):void;
function get url():String;
function get setup():Boolean;
function unload():void;
}
}//package mx.modules
Section 268
//ModuleManager (mx.modules.ModuleManager)
package mx.modules {
import mx.core.*;
public class ModuleManager {
mx_internal static const VERSION:String = "3.0.0.0";
public static function getModule(_arg1:String):IModuleInfo{
return (getSingleton().getModule(_arg1));
}
private static function getSingleton():Object{
if (!ModuleManagerGlobals.managerSingleton){
ModuleManagerGlobals.managerSingleton = new ModuleManagerImpl();
};
return (ModuleManagerGlobals.managerSingleton);
}
public static function getAssociatedFactory(_arg1:Object):IFlexModuleFactory{
return (getSingleton().getAssociatedFactory(_arg1));
}
}
}//package mx.modules
import flash.events.*;
import flash.display.*;
import mx.core.*;
import flash.system.*;
import flash.net.*;
import mx.events.*;
import flash.utils.*;
class ModuleInfoProxy extends EventDispatcher implements IModuleInfo {
private var _data:Object;
private var info:ModuleInfo;
private var referenced:Boolean;// = false
private function ModuleInfoProxy(_arg1:ModuleInfo){
this.info = _arg1;
_arg1.addEventListener(ModuleEvent.SETUP, moduleEventHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.PROGRESS, moduleEventHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.READY, moduleEventHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.ERROR, moduleEventHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.UNLOAD, moduleEventHandler, false, 0, true);
}
public function get loaded():Boolean{
return (info.loaded);
}
public function release():void{
if (referenced){
info.removeReference();
referenced = false;
};
}
public function get error():Boolean{
return (info.error);
}
public function get factory():IFlexModuleFactory{
return (info.factory);
}
public function publish(_arg1:IFlexModuleFactory):void{
info.publish(_arg1);
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
public function get ready():Boolean{
return (info.ready);
}
public function load(_arg1:ApplicationDomain=null, _arg2:SecurityDomain=null):void{
var _local3:ModuleEvent;
info.resurrect();
if (!referenced){
info.addReference();
referenced = true;
};
if (info.error){
dispatchEvent(new ModuleEvent(ModuleEvent.ERROR));
} else {
if (info.loaded){
if (info.setup){
dispatchEvent(new ModuleEvent(ModuleEvent.SETUP));
if (info.ready){
_local3 = new ModuleEvent(ModuleEvent.PROGRESS);
_local3.bytesLoaded = info.size;
_local3.bytesTotal = info.size;
dispatchEvent(_local3);
dispatchEvent(new ModuleEvent(ModuleEvent.READY));
};
};
} else {
info.load(_arg1, _arg2);
};
};
}
private function moduleEventHandler(_arg1:ModuleEvent):void{
dispatchEvent(_arg1);
}
public function get url():String{
return (info.url);
}
public function get data():Object{
return (_data);
}
public function get setup():Boolean{
return (info.setup);
}
public function unload():void{
info.unload();
info.removeEventListener(ModuleEvent.SETUP, moduleEventHandler);
info.removeEventListener(ModuleEvent.PROGRESS, moduleEventHandler);
info.removeEventListener(ModuleEvent.READY, moduleEventHandler);
info.removeEventListener(ModuleEvent.ERROR, moduleEventHandler);
info.removeEventListener(ModuleEvent.UNLOAD, moduleEventHandler);
}
}
class ModuleManagerImpl extends EventDispatcher {
private var moduleList:Object;
private function ModuleManagerImpl(){
moduleList = {};
super();
}
public function getModule(_arg1:String):IModuleInfo{
var _local2:ModuleInfo = (moduleList[_arg1] as ModuleInfo);
if (!_local2){
_local2 = new ModuleInfo(_arg1);
moduleList[_arg1] = _local2;
};
return (new ModuleInfoProxy(_local2));
}
public function getAssociatedFactory(_arg1:Object):IFlexModuleFactory{
var m:Object;
var info:ModuleInfo;
var domain:ApplicationDomain;
var cls:Class;
var object = _arg1;
var className:String = getQualifiedClassName(object);
for each (m in moduleList) {
info = (m as ModuleInfo);
if (!info.ready){
} else {
domain = info.applicationDomain;
try {
cls = Class(domain.getDefinition(className));
if ((object is cls)){
return (info.factory);
};
} catch(error:Error) {
};
};
};
return (null);
}
}
class ModuleInfo extends EventDispatcher {
private var _error:Boolean;// = false
private var loader:Loader;
private var factoryInfo:FactoryInfo;
private var limbo:Dictionary;
private var _loaded:Boolean;// = false
private var _ready:Boolean;// = false
private var numReferences:int;// = 0
private var _url:String;
private var _setup:Boolean;// = false
private function ModuleInfo(_arg1:String){
_url = _arg1;
}
private function clearLoader():void{
if (loader){
if (loader.contentLoaderInfo){
loader.contentLoaderInfo.removeEventListener(Event.INIT, initHandler);
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, completeHandler);
loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, progressHandler);
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
loader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
};
try {
if (loader.content){
loader.content.removeEventListener("ready", readyHandler);
};
} catch(error:Error) {
};
if (_loaded){
try {
loader.close();
} catch(error:Error) {
};
};
try {
loader.unload();
} catch(error:Error) {
};
loader = null;
};
}
public function get size():int{
return ((((!(limbo)) && (factoryInfo))) ? factoryInfo.bytesTotal : 0);
}
public function get loaded():Boolean{
return ((limbo) ? false : _loaded);
}
public function release():void{
if (((_ready) && (!(limbo)))){
limbo = new Dictionary(true);
limbo[factoryInfo] = 1;
factoryInfo = null;
} else {
unload();
};
}
public function get error():Boolean{
return ((limbo) ? false : _error);
}
public function get factory():IFlexModuleFactory{
return ((((!(limbo)) && (factoryInfo))) ? factoryInfo.factory : null);
}
public function completeHandler(_arg1:Event):void{
var _local2:ModuleEvent = new ModuleEvent(ModuleEvent.PROGRESS, _arg1.bubbles, _arg1.cancelable);
_local2.bytesLoaded = loader.contentLoaderInfo.bytesLoaded;
_local2.bytesTotal = loader.contentLoaderInfo.bytesTotal;
dispatchEvent(_local2);
}
public function publish(_arg1:IFlexModuleFactory):void{
if (factoryInfo){
return;
};
if (_url.indexOf("published://") != 0){
return;
};
factoryInfo = new FactoryInfo();
factoryInfo.factory = _arg1;
_loaded = true;
_setup = true;
_ready = true;
_error = false;
dispatchEvent(new ModuleEvent(ModuleEvent.SETUP));
dispatchEvent(new ModuleEvent(ModuleEvent.PROGRESS));
dispatchEvent(new ModuleEvent(ModuleEvent.READY));
}
public function initHandler(_arg1:Event):void{
var moduleEvent:ModuleEvent;
var event = _arg1;
factoryInfo = new FactoryInfo();
try {
factoryInfo.factory = (loader.content as IFlexModuleFactory);
} catch(error:Error) {
};
if (!factoryInfo.factory){
moduleEvent = new ModuleEvent(ModuleEvent.ERROR, event.bubbles, event.cancelable);
moduleEvent.bytesLoaded = 0;
moduleEvent.bytesTotal = 0;
moduleEvent.errorText = "SWF is not a loadable module";
dispatchEvent(moduleEvent);
return;
};
loader.content.addEventListener("ready", readyHandler);
try {
factoryInfo.applicationDomain = loader.contentLoaderInfo.applicationDomain;
} catch(error:Error) {
};
_setup = true;
dispatchEvent(new ModuleEvent(ModuleEvent.SETUP));
}
public function resurrect():void{
var _local1:Object;
if (((!(factoryInfo)) && (limbo))){
for (_local1 in limbo) {
factoryInfo = (_local1 as FactoryInfo);
break;
};
limbo = null;
};
if (!factoryInfo){
if (_loaded){
dispatchEvent(new ModuleEvent(ModuleEvent.UNLOAD));
};
loader = null;
_loaded = false;
_setup = false;
_ready = false;
_error = false;
};
}
public function errorHandler(_arg1:ErrorEvent):void{
_error = true;
var _local2:ModuleEvent = new ModuleEvent(ModuleEvent.ERROR, _arg1.bubbles, _arg1.cancelable);
_local2.bytesLoaded = 0;
_local2.bytesTotal = 0;
_local2.errorText = _arg1.text;
dispatchEvent(_local2);
}
public function get ready():Boolean{
return ((limbo) ? false : _ready);
}
public function removeReference():void{
numReferences--;
if (numReferences == 0){
release();
};
}
public function addReference():void{
numReferences++;
}
public function progressHandler(_arg1:ProgressEvent):void{
var _local2:ModuleEvent = new ModuleEvent(ModuleEvent.PROGRESS, _arg1.bubbles, _arg1.cancelable);
_local2.bytesLoaded = _arg1.bytesLoaded;
_local2.bytesTotal = _arg1.bytesTotal;
dispatchEvent(_local2);
}
public function load(_arg1:ApplicationDomain=null, _arg2:SecurityDomain=null):void{
if (_loaded){
return;
};
_loaded = true;
limbo = null;
if (_url.indexOf("published://") == 0){
return;
};
var _local3:URLRequest = new URLRequest(_url);
var _local4:LoaderContext = new LoaderContext();
_local4.applicationDomain = (_arg1) ? _arg1 : new ApplicationDomain(ApplicationDomain.currentDomain);
_local4.securityDomain = _arg2;
if ((((_arg2 == null)) && ((Security.sandboxType == Security.REMOTE)))){
_local4.securityDomain = SecurityDomain.currentDomain;
};
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
loader.load(_local3, _local4);
}
public function get url():String{
return (_url);
}
public function get applicationDomain():ApplicationDomain{
return ((((!(limbo)) && (factoryInfo))) ? factoryInfo.applicationDomain : null);
}
public function readyHandler(_arg1:Event):void{
_ready = true;
factoryInfo.bytesTotal = loader.contentLoaderInfo.bytesTotal;
clearLoader();
dispatchEvent(new ModuleEvent(ModuleEvent.READY));
}
public function get setup():Boolean{
return ((limbo) ? false : _setup);
}
public function unload():void{
clearLoader();
if (_loaded){
dispatchEvent(new ModuleEvent(ModuleEvent.UNLOAD));
};
limbo = null;
factoryInfo = null;
_loaded = false;
_setup = false;
_ready = false;
_error = false;
}
}
class FactoryInfo {
public var bytesTotal:int;// = 0
public var factory:IFlexModuleFactory;
public var applicationDomain:ApplicationDomain;
private function FactoryInfo(){
}
}
Section 269
//ModuleManagerGlobals (mx.modules.ModuleManagerGlobals)
package mx.modules {
public class ModuleManagerGlobals {
public static var managerSingleton:Object = null;
}
}//package mx.modules
Section 270
//IResourceBundle (mx.resources.IResourceBundle)
package mx.resources {
public interface IResourceBundle {
function get content():Object;
function get locale():String;
function get bundleName():String;
}
}//package mx.resources
Section 271
//IResourceManager (mx.resources.IResourceManager)
package mx.resources {
import flash.events.*;
import flash.system.*;
public interface IResourceManager extends IEventDispatcher {
function loadResourceModule(_arg1:String, _arg2:Boolean=true, _arg3:ApplicationDomain=null, _arg4:SecurityDomain=null):IEventDispatcher;
function getBoolean(_arg1:String, _arg2:String, _arg3:String=null):Boolean;
function getClass(_arg1:String, _arg2:String, _arg3:String=null):Class;
function getLocales():Array;
function removeResourceBundlesForLocale(_arg1:String):void;
function getResourceBundle(_arg1:String, _arg2:String):IResourceBundle;
function get localeChain():Array;
function getInt(_arg1:String, _arg2:String, _arg3:String=null):int;
function update():void;
function set localeChain(_arg1:Array):void;
function getUint(_arg1:String, _arg2:String, _arg3:String=null):uint;
function addResourceBundle(_arg1:IResourceBundle):void;
function getStringArray(_arg1:String, _arg2:String, _arg3:String=null):Array;
function getBundleNamesForLocale(_arg1:String):Array;
function removeResourceBundle(_arg1:String, _arg2:String):void;
function getObject(_arg1:String, _arg2:String, _arg3:String=null);
function getString(_arg1:String, _arg2:String, _arg3:Array=null, _arg4:String=null):String;
function installCompiledResourceBundles(_arg1:ApplicationDomain, _arg2:Array, _arg3:Array):void;
function unloadResourceModule(_arg1:String, _arg2:Boolean=true):void;
function findResourceBundleWithResource(_arg1:String, _arg2:String):IResourceBundle;
function getNumber(_arg1:String, _arg2:String, _arg3:String=null):Number;
}
}//package mx.resources
Section 272
//IResourceModule (mx.resources.IResourceModule)
package mx.resources {
public interface IResourceModule {
function get resourceBundles():Array;
}
}//package mx.resources
Section 273
//ResourceBundle (mx.resources.ResourceBundle)
package mx.resources {
import mx.core.*;
import flash.system.*;
import mx.utils.*;
public class ResourceBundle implements IResourceBundle {
mx_internal var _locale:String;
private var _content:Object;
mx_internal var _bundleName:String;
mx_internal static const VERSION:String = "3.0.0.0";
mx_internal static var backupApplicationDomain:ApplicationDomain;
mx_internal static var locale:String;
public function ResourceBundle(_arg1:String=null, _arg2:String=null){
_content = {};
super();
mx_internal::_locale = _arg1;
mx_internal::_bundleName = _arg2;
_content = getContent();
}
protected function getContent():Object{
return ({});
}
public function getString(_arg1:String):String{
return (String(_getObject(_arg1)));
}
public function get content():Object{
return (_content);
}
public function getBoolean(_arg1:String, _arg2:Boolean=true):Boolean{
var _local3:String = _getObject(_arg1).toLowerCase();
if (_local3 == "false"){
return (false);
};
if (_local3 == "true"){
return (true);
};
return (_arg2);
}
public function getStringArray(_arg1:String):Array{
var _local2:Array = _getObject(_arg1).split(",");
var _local3:int = _local2.length;
var _local4:int;
while (_local4 < _local3) {
_local2[_local4] = StringUtil.trim(_local2[_local4]);
_local4++;
};
return (_local2);
}
public function getObject(_arg1:String):Object{
return (_getObject(_arg1));
}
private function _getObject(_arg1:String):Object{
var _local2:Object = content[_arg1];
if (!_local2){
throw (new Error(((("Key " + _arg1) + " was not found in resource bundle ") + bundleName)));
};
return (_local2);
}
public function get locale():String{
return (mx_internal::_locale);
}
public function get bundleName():String{
return (mx_internal::_bundleName);
}
public function getNumber(_arg1:String):Number{
return (Number(_getObject(_arg1)));
}
private static function getClassByName(_arg1:String, _arg2:ApplicationDomain):Class{
var _local3:Class;
if (_arg2.hasDefinition(_arg1)){
_local3 = (_arg2.getDefinition(_arg1) as Class);
};
return (_local3);
}
public static function getResourceBundle(_arg1:String, _arg2:ApplicationDomain=null):ResourceBundle{
var _local3:String;
var _local4:Class;
var _local5:Object;
var _local6:ResourceBundle;
if (!_arg2){
_arg2 = ApplicationDomain.currentDomain;
};
_local3 = (((mx_internal::locale + "$") + _arg1) + "_properties");
_local4 = getClassByName(_local3, _arg2);
if (!_local4){
_local3 = (_arg1 + "_properties");
_local4 = getClassByName(_local3, _arg2);
};
if (!_local4){
_local3 = _arg1;
_local4 = getClassByName(_local3, _arg2);
};
if (((!(_local4)) && (mx_internal::backupApplicationDomain))){
_local3 = (_arg1 + "_properties");
_local4 = getClassByName(_local3, mx_internal::backupApplicationDomain);
if (!_local4){
_local3 = _arg1;
_local4 = getClassByName(_local3, mx_internal::backupApplicationDomain);
};
};
if (_local4){
_local5 = new (_local4);
if ((_local5 is ResourceBundle)){
_local6 = ResourceBundle(_local5);
return (_local6);
};
};
throw (new Error(("Could not find resource bundle " + _arg1)));
}
}
}//package mx.resources
Section 274
//ResourceManager (mx.resources.ResourceManager)
package mx.resources {
import mx.core.*;
public class ResourceManager {
mx_internal static const VERSION:String = "3.0.0.0";
private static var implClassDependency:ResourceManagerImpl;
private static var instance:IResourceManager;
public static function getInstance():IResourceManager{
if (!instance){
instance = IResourceManager(Singleton.getInstance("mx.resources::IResourceManager"));
};
return (instance);
}
}
}//package mx.resources
Section 275
//ResourceManagerImpl (mx.resources.ResourceManagerImpl)
package mx.resources {
import flash.events.*;
import mx.core.*;
import flash.system.*;
import mx.modules.*;
import mx.events.*;
import flash.utils.*;
import mx.utils.*;
public class ResourceManagerImpl extends EventDispatcher implements IResourceManager {
private var resourceModules:Object;
private var initializedForNonFrameworkApp:Boolean;// = false
private var localeMap:Object;
private var _localeChain:Array;
mx_internal static const VERSION:String = "3.0.0.0";
private static var instance:IResourceManager;
public function ResourceManagerImpl(){
localeMap = {};
resourceModules = {};
super();
}
public function get localeChain():Array{
return (_localeChain);
}
public function set localeChain(_arg1:Array):void{
_localeChain = _arg1;
update();
}
public function getStringArray(_arg1:String, _arg2:String, _arg3:String=null):Array{
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (null);
};
var _local5:* = _local4.content[_arg2];
var _local6:Array = String(_local5).split(",");
var _local7:int = _local6.length;
var _local8:int;
while (_local8 < _local7) {
_local6[_local8] = StringUtil.trim(_local6[_local8]);
_local8++;
};
return (_local6);
}
mx_internal function installCompiledResourceBundle(_arg1:ApplicationDomain, _arg2:String, _arg3:String):void{
var _local4:String;
var _local5:String = _arg3;
var _local6:int = _arg3.indexOf(":");
if (_local6 != -1){
_local4 = _arg3.substring(0, _local6);
_local5 = _arg3.substring((_local6 + 1));
};
if (getResourceBundle(_arg2, _arg3)){
return;
};
var _local7 = (((_arg2 + "$") + _local5) + "_properties");
if (_local4 != null){
_local7 = ((_local4 + ".") + _local7);
};
var _local8:Class;
if (_arg1.hasDefinition(_local7)){
_local8 = Class(_arg1.getDefinition(_local7));
};
if (!_local8){
_local7 = _arg3;
if (_arg1.hasDefinition(_local7)){
_local8 = Class(_arg1.getDefinition(_local7));
};
};
if (!_local8){
_local7 = (_arg3 + "_properties");
if (_arg1.hasDefinition(_local7)){
_local8 = Class(_arg1.getDefinition(_local7));
};
};
if (!_local8){
throw (new Error((((("Could not find compiled resource bundle '" + _arg3) + "' for locale '") + _arg2) + "'.")));
};
var _local9:ResourceBundle = ResourceBundle(new (_local8));
_local9.mx_internal::_locale = _arg2;
_local9.mx_internal::_bundleName = _arg3;
addResourceBundle(_local9);
}
public function getString(_arg1:String, _arg2:String, _arg3:Array=null, _arg4:String=null):String{
var _local5:IResourceBundle = findBundle(_arg1, _arg2, _arg4);
if (!_local5){
return (null);
};
var _local6:String = String(_local5.content[_arg2]);
if (_arg3){
_local6 = StringUtil.substitute(_local6, _arg3);
};
return (_local6);
}
public function loadResourceModule(_arg1:String, _arg2:Boolean=true, _arg3:ApplicationDomain=null, _arg4:SecurityDomain=null):IEventDispatcher{
var moduleInfo:IModuleInfo;
var resourceEventDispatcher:ResourceEventDispatcher;
var timer:Timer;
var timerHandler:Function;
var url = _arg1;
var updateFlag = _arg2;
var applicationDomain = _arg3;
var securityDomain = _arg4;
moduleInfo = ModuleManager.getModule(url);
resourceEventDispatcher = new ResourceEventDispatcher(moduleInfo);
var readyHandler:Function = function (_arg1:ModuleEvent):void{
var _local2:* = _arg1.module.factory.create();
resourceModules[_arg1.module.url].resourceModule = _local2;
if (updateFlag){
update();
};
};
moduleInfo.addEventListener(ModuleEvent.READY, readyHandler, false, 0, true);
var errorHandler:Function = function (_arg1:ModuleEvent):void{
var _local3:ResourceEvent;
var _local2:String = ("Unable to load resource module from " + url);
if (resourceEventDispatcher.willTrigger(ResourceEvent.ERROR)){
_local3 = new ResourceEvent(ResourceEvent.ERROR, _arg1.bubbles, _arg1.cancelable);
_local3.bytesLoaded = 0;
_local3.bytesTotal = 0;
_local3.errorText = _local2;
resourceEventDispatcher.dispatchEvent(_local3);
} else {
throw (new Error(_local2));
};
};
moduleInfo.addEventListener(ModuleEvent.ERROR, errorHandler, false, 0, true);
resourceModules[url] = new ResourceModuleInfo(moduleInfo, readyHandler, errorHandler);
timer = new Timer(0);
timerHandler = function (_arg1:TimerEvent):void{
timer.removeEventListener(TimerEvent.TIMER, timerHandler);
timer.stop();
moduleInfo.load(applicationDomain, securityDomain);
};
timer.addEventListener(TimerEvent.TIMER, timerHandler, false, 0, true);
timer.start();
return (resourceEventDispatcher);
}
public function getLocales():Array{
var _local2:String;
var _local1:Array = [];
for (_local2 in localeMap) {
_local1.push(_local2);
};
return (_local1);
}
public function removeResourceBundlesForLocale(_arg1:String):void{
delete localeMap[_arg1];
}
public function getResourceBundle(_arg1:String, _arg2:String):IResourceBundle{
var _local3:Object = localeMap[_arg1];
if (!_local3){
return (null);
};
return (_local3[_arg2]);
}
private function dumpResourceModule(_arg1):void{
var _local2:ResourceBundle;
var _local3:String;
for each (_local2 in _arg1.resourceBundles) {
trace(_local2.locale, _local2.bundleName);
for (_local3 in _local2.content) {
};
};
}
public function getObject(_arg1:String, _arg2:String, _arg3:String=null){
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (undefined);
};
return (_local4.content[_arg2]);
}
public function addResourceBundle(_arg1:IResourceBundle):void{
var _local2:String = _arg1.locale;
var _local3:String = _arg1.bundleName;
if (!localeMap[_local2]){
localeMap[_local2] = {};
};
localeMap[_local2][_local3] = _arg1;
}
private function findBundle(_arg1:String, _arg2:String, _arg3:String):IResourceBundle{
supportNonFrameworkApps();
return (((_arg3)!=null) ? getResourceBundle(_arg3, _arg1) : findResourceBundleWithResource(_arg1, _arg2));
}
public function getInt(_arg1:String, _arg2:String, _arg3:String=null):int{
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (0);
};
var _local5:* = _local4.content[_arg2];
return (int(_local5));
}
private function supportNonFrameworkApps():void{
if (initializedForNonFrameworkApp){
return;
};
initializedForNonFrameworkApp = true;
if (getLocales().length > 0){
return;
};
var _local1:ApplicationDomain = ApplicationDomain.currentDomain;
if (!_local1.hasDefinition("_CompiledResourceBundleInfo")){
return;
};
var _local2:Class = Class(_local1.getDefinition("_CompiledResourceBundleInfo"));
var _local3:Array = _local2.compiledLocales;
var _local4:Array = _local2.compiledResourceBundleNames;
installCompiledResourceBundles(_local1, _local3, _local4);
localeChain = _local3;
}
public function getClass(_arg1:String, _arg2:String, _arg3:String=null):Class{
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (null);
};
var _local5:* = _local4.content[_arg2];
return ((_local5 as Class));
}
public function getNumber(_arg1:String, _arg2:String, _arg3:String=null):Number{
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (NaN);
};
var _local5:* = _local4.content[_arg2];
return (Number(_local5));
}
public function update():void{
dispatchEvent(new Event(Event.CHANGE));
}
public function getBundleNamesForLocale(_arg1:String):Array{
var _local3:String;
var _local2:Array = [];
for (_local3 in localeMap[_arg1]) {
_local2.push(_local3);
};
return (_local2);
}
public function removeResourceBundle(_arg1:String, _arg2:String):void{
delete localeMap[_arg1][_arg2];
if (getBundleNamesForLocale(_arg1).length == 0){
delete localeMap[_arg1];
};
}
public function installCompiledResourceBundles(_arg1:ApplicationDomain, _arg2:Array, _arg3:Array):void{
var _local7:String;
var _local8:int;
var _local9:String;
var _local4:int = (_arg2) ? _arg2.length : 0;
var _local5:int = (_arg3) ? _arg3.length : 0;
var _local6:int;
while (_local6 < _local4) {
_local7 = _arg2[_local6];
_local8 = 0;
while (_local8 < _local5) {
_local9 = _arg3[_local8];
mx_internal::installCompiledResourceBundle(_arg1, _local7, _local9);
_local8++;
};
_local6++;
};
}
public function findResourceBundleWithResource(_arg1:String, _arg2:String):IResourceBundle{
var _local5:String;
var _local6:Object;
var _local7:ResourceBundle;
if (!_localeChain){
return (null);
};
var _local3:int = _localeChain.length;
var _local4:int;
while (_local4 < _local3) {
_local5 = localeChain[_local4];
_local6 = localeMap[_local5];
if (!_local6){
} else {
_local7 = _local6[_arg1];
if (!_local7){
} else {
if ((_arg2 in _local7.content)){
return (_local7);
};
};
};
_local4++;
};
return (null);
}
public function getUint(_arg1:String, _arg2:String, _arg3:String=null):uint{
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (0);
};
var _local5:* = _local4.content[_arg2];
return (uint(_local5));
}
public function getBoolean(_arg1:String, _arg2:String, _arg3:String=null):Boolean{
var _local4:IResourceBundle = findBundle(_arg1, _arg2, _arg3);
if (!_local4){
return (false);
};
var _local5:* = _local4.content[_arg2];
return ((String(_local5).toLowerCase() == "true"));
}
public function unloadResourceModule(_arg1:String, _arg2:Boolean=true):void{
throw (new Error("unloadResourceModule() is not yet implemented."));
}
public static function getInstance():IResourceManager{
if (!instance){
instance = new (ResourceManagerImpl);
};
return (instance);
}
}
}//package mx.resources
import flash.events.*;
import mx.modules.*;
import mx.events.*;
class ResourceModuleInfo {
public var resourceModule:IResourceModule;
public var errorHandler:Function;
public var readyHandler:Function;
public var moduleInfo:IModuleInfo;
private function ResourceModuleInfo(_arg1:IModuleInfo, _arg2:Function, _arg3:Function){
this.moduleInfo = _arg1;
this.readyHandler = _arg2;
this.errorHandler = _arg3;
}
}
class ResourceEventDispatcher extends EventDispatcher {
private function ResourceEventDispatcher(_arg1:IModuleInfo){
_arg1.addEventListener(ModuleEvent.ERROR, moduleInfo_errorHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.PROGRESS, moduleInfo_progressHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.READY, moduleInfo_readyHandler, false, 0, true);
}
private function moduleInfo_progressHandler(_arg1:ModuleEvent):void{
var _local2:ResourceEvent = new ResourceEvent(ResourceEvent.PROGRESS, _arg1.bubbles, _arg1.cancelable);
_local2.bytesLoaded = _arg1.bytesLoaded;
_local2.bytesTotal = _arg1.bytesTotal;
dispatchEvent(_local2);
}
private function moduleInfo_readyHandler(_arg1:ModuleEvent):void{
var _local2:ResourceEvent = new ResourceEvent(ResourceEvent.COMPLETE);
dispatchEvent(_local2);
}
private function moduleInfo_errorHandler(_arg1:ModuleEvent):void{
var _local2:ResourceEvent = new ResourceEvent(ResourceEvent.ERROR, _arg1.bubbles, _arg1.cancelable);
_local2.bytesLoaded = _arg1.bytesLoaded;
_local2.bytesTotal = _arg1.bytesTotal;
_local2.errorText = _arg1.errorText;
dispatchEvent(_local2);
}
}
Section 276
//HaloBorder (mx.skins.halo.HaloBorder)
package mx.skins.halo {
import flash.display.*;
import mx.core.*;
import mx.styles.*;
import mx.skins.*;
import mx.graphics.*;
import mx.utils.*;
public class HaloBorder extends RectangularBorder {
mx_internal var radiusObj:Object;
mx_internal var backgroundHole:Object;
mx_internal var radius:Number;
mx_internal var bRoundedCorners:Boolean;
mx_internal var backgroundColor:Object;
private var dropShadow:RectangularDropShadow;
protected var _borderMetrics:EdgeMetrics;
mx_internal var backgroundAlphaName:String;
mx_internal static const VERSION:String = "3.0.0.0";
private static var BORDER_WIDTHS:Object = {none:0, solid:1, inset:2, outset:2, alert:3, dropdown:2, menuBorder:1, comboNonEdit:2};
public function HaloBorder(){
BORDER_WIDTHS["default"] = 3;
}
override public function styleChanged(_arg1:String):void{
if ((((((((((_arg1 == null)) || ((_arg1 == "styleName")))) || ((_arg1 == "borderStyle")))) || ((_arg1 == "borderThickness")))) || ((_arg1 == "borderSides")))){
_borderMetrics = null;
};
invalidateDisplayList();
}
override protected function updateDisplayList(_arg1:Number, _arg2:Number):void{
if (((isNaN(_arg1)) || (isNaN(_arg2)))){
return;
};
super.updateDisplayList(_arg1, _arg2);
backgroundColor = getBackgroundColor();
bRoundedCorners = false;
backgroundAlphaName = "backgroundAlpha";
backgroundHole = null;
radius = 0;
radiusObj = null;
drawBorder(_arg1, _arg2);
drawBackground(_arg1, _arg2);
}
mx_internal function drawBorder(_arg1:Number, _arg2:Number):void{
var _local5:Number;
var _local6:uint;
var _local7:uint;
var _local8:String;
var _local9:Number;
var _local10:uint;
var _local11:Boolean;
var _local12:uint;
var _local13:Array;
var _local14:Array;
var _local15:uint;
var _local16:uint;
var _local17:uint;
var _local18:uint;
var _local19:Boolean;
var _local20:Object;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Object;
var _local27:Number;
var _local28:Number;
var _local29:IContainer;
var _local30:EdgeMetrics;
var _local31:Boolean;
var _local32:Number;
var _local33:Array;
var _local34:uint;
var _local35:Boolean;
var _local36:Number;
var _local3:String = getStyle("borderStyle");
var _local4:Array = getStyle("highlightAlphas");
var _local21:Boolean;
var _local26:Graphics = graphics;
_local26.clear();
if (_local3){
switch (_local3){
case "none":
break;
case "inset":
_local7 = getStyle("borderColor");
_local22 = ColorUtil.adjustBrightness2(_local7, -40);
_local23 = ColorUtil.adjustBrightness2(_local7, 25);
_local24 = ColorUtil.adjustBrightness2(_local7, 40);
_local25 = backgroundColor;
if ((((_local25 === null)) || ((_local25 === "")))){
_local25 = _local7;
};
draw3dBorder(_local23, _local22, _local24, Number(_local25), Number(_local25), Number(_local25));
break;
case "outset":
_local7 = getStyle("borderColor");
_local22 = ColorUtil.adjustBrightness2(_local7, -40);
_local23 = ColorUtil.adjustBrightness2(_local7, -25);
_local24 = ColorUtil.adjustBrightness2(_local7, 40);
_local25 = backgroundColor;
if ((((_local25 === null)) || ((_local25 === "")))){
_local25 = _local7;
};
draw3dBorder(_local23, _local24, _local22, Number(_local25), Number(_local25), Number(_local25));
break;
case "alert":
case "default":
if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0){
_local27 = getStyle("backgroundAlpha");
_local5 = getStyle("borderAlpha");
backgroundAlphaName = "borderAlpha";
radius = getStyle("cornerRadius");
bRoundedCorners = (getStyle("roundedBottomCorners").toString().toLowerCase() == "true");
_local28 = (bRoundedCorners) ? radius : 0;
drawDropShadow(0, 0, _arg1, _arg2, radius, radius, _local28, _local28);
if (!bRoundedCorners){
radiusObj = {};
};
_local29 = (parent as IContainer);
if (_local29){
_local30 = _local29.viewMetrics;
backgroundHole = {x:_local30.left, y:_local30.top, w:Math.max(0, ((_arg1 - _local30.left) - _local30.right)), h:Math.max(0, ((_arg2 - _local30.top) - _local30.bottom)), r:0};
if ((((backgroundHole.w > 0)) && ((backgroundHole.h > 0)))){
if (_local27 != _local5){
drawDropShadow(backgroundHole.x, backgroundHole.y, backgroundHole.w, backgroundHole.h, 0, 0, 0, 0);
};
_local26.beginFill(Number(backgroundColor), _local27);
_local26.drawRect(backgroundHole.x, backgroundHole.y, backgroundHole.w, backgroundHole.h);
_local26.endFill();
};
};
backgroundColor = getStyle("borderColor");
};
break;
case "dropdown":
_local12 = getStyle("dropdownBorderColor");
drawDropShadow(0, 0, _arg1, _arg2, 4, 0, 0, 4);
drawRoundRect(0, 0, _arg1, _arg2, {tl:4, tr:0, br:0, bl:4}, 5068126, 1);
drawRoundRect(0, 0, _arg1, _arg2, {tl:4, tr:0, br:0, bl:4}, [0xFFFFFF, 0xFFFFFF], [0.7, 0], verticalGradientMatrix(0, 0, _arg1, _arg2));
drawRoundRect(1, 1, (_arg1 - 1), (_arg2 - 2), {tl:3, tr:0, br:0, bl:3}, 0xFFFFFF, 1);
drawRoundRect(1, 2, (_arg1 - 1), (_arg2 - 3), {tl:3, tr:0, br:0, bl:3}, [0xEEEEEE, 0xFFFFFF], 1, verticalGradientMatrix(0, 0, (_arg1 - 1), (_arg2 - 3)));
if (!isNaN(_local12)){
drawRoundRect(0, 0, (_arg1 + 1), _arg2, {tl:4, tr:0, br:0, bl:4}, _local12, 0.5);
drawRoundRect(1, 1, (_arg1 - 1), (_arg2 - 2), {tl:3, tr:0, br:0, bl:3}, 0xFFFFFF, 1);
drawRoundRect(1, 2, (_arg1 - 1), (_arg2 - 3), {tl:3, tr:0, br:0, bl:3}, [0xEEEEEE, 0xFFFFFF], 1, verticalGradientMatrix(0, 0, (_arg1 - 1), (_arg2 - 3)));
};
backgroundColor = null;
break;
case "menuBorder":
_local7 = getStyle("borderColor");
drawRoundRect(0, 0, _arg1, _arg2, 0, _local7, 1);
drawDropShadow(1, 1, (_arg1 - 2), (_arg2 - 2), 0, 0, 0, 0);
break;
case "comboNonEdit":
break;
case "controlBar":
if ((((_arg1 == 0)) || ((_arg2 == 0)))){
backgroundColor = null;
break;
};
_local14 = getStyle("footerColors");
_local31 = !((_local14 == null));
_local32 = getStyle("borderAlpha");
if (_local31){
_local26.lineStyle(0, ((_local14.length > 0)) ? _local14[1] : _local14[0], _local32);
_local26.moveTo(0, 0);
_local26.lineTo(_arg1, 0);
_local26.lineStyle(0, 0, 0);
if (((((parent) && (parent.parent))) && ((parent.parent is IStyleClient)))){
radius = IStyleClient(parent.parent).getStyle("cornerRadius");
_local32 = IStyleClient(parent.parent).getStyle("borderAlpha");
};
if (isNaN(radius)){
radius = 0;
};
if (IStyleClient(parent.parent).getStyle("roundedBottomCorners").toString().toLowerCase() != "true"){
radius = 0;
};
drawRoundRect(0, 1, _arg1, (_arg2 - 1), {tl:0, tr:0, bl:radius, br:radius}, _local14, _local32, verticalGradientMatrix(0, 0, _arg1, _arg2));
if ((((_local14.length > 1)) && (!((_local14[0] == _local14[1]))))){
drawRoundRect(0, 1, _arg1, (_arg2 - 1), {tl:0, tr:0, bl:radius, br:radius}, [0xFFFFFF, 0xFFFFFF], _local4, verticalGradientMatrix(0, 0, _arg1, _arg2));
drawRoundRect(1, 2, (_arg1 - 2), (_arg2 - 3), {tl:0, tr:0, bl:(radius - 1), br:(radius - 1)}, _local14, _local32, verticalGradientMatrix(0, 0, _arg1, _arg2));
};
};
backgroundColor = null;
break;
case "applicationControlBar":
_local13 = getStyle("fillColors");
_local5 = getStyle("backgroundAlpha");
_local4 = getStyle("highlightAlphas");
_local33 = getStyle("fillAlphas");
_local11 = getStyle("docked");
_local34 = uint(backgroundColor);
radius = getStyle("cornerRadius");
if (!radius){
radius = 0;
};
drawDropShadow(0, 1, _arg1, (_arg2 - 1), radius, radius, radius, radius);
if (((!((backgroundColor === null))) && (StyleManager.isValidStyleValue(backgroundColor)))){
drawRoundRect(0, 1, _arg1, (_arg2 - 1), radius, _local34, _local5, verticalGradientMatrix(0, 0, _arg1, _arg2));
};
drawRoundRect(0, 1, _arg1, (_arg2 - 1), radius, _local13, _local33, verticalGradientMatrix(0, 0, _arg1, _arg2));
drawRoundRect(0, 1, _arg1, ((_arg2 / 2) - 1), {tl:radius, tr:radius, bl:0, br:0}, [0xFFFFFF, 0xFFFFFF], _local4, verticalGradientMatrix(0, 0, _arg1, ((_arg2 / 2) - 1)));
drawRoundRect(0, 1, _arg1, (_arg2 - 1), {tl:radius, tr:radius, bl:0, br:0}, 0xFFFFFF, 0.3, null, GradientType.LINEAR, null, {x:0, y:2, w:_arg1, h:(_arg2 - 2), r:{tl:radius, tr:radius, bl:0, br:0}});
backgroundColor = null;
break;
default:
_local7 = getStyle("borderColor");
_local9 = getStyle("borderThickness");
_local8 = getStyle("borderSides");
_local35 = true;
radius = getStyle("cornerRadius");
bRoundedCorners = (getStyle("roundedBottomCorners").toString().toLowerCase() == "true");
_local36 = Math.max((radius - _local9), 0);
_local20 = {x:_local9, y:_local9, w:(_arg1 - (_local9 * 2)), h:(_arg2 - (_local9 * 2)), r:_local36};
if (!bRoundedCorners){
radiusObj = {tl:radius, tr:radius, bl:0, br:0};
_local20.r = {tl:_local36, tr:_local36, bl:0, br:0};
};
if (_local8 != "left top right bottom"){
_local20.r = {tl:_local36, tr:_local36, bl:(bRoundedCorners) ? _local36 : 0, br:(bRoundedCorners) ? _local36 : 0};
radiusObj = {tl:radius, tr:radius, bl:(bRoundedCorners) ? radius : 0, br:(bRoundedCorners) ? radius : 0};
_local8 = _local8.toLowerCase();
if (_local8.indexOf("left") == -1){
_local20.x = 0;
_local20.w = (_local20.w + _local9);
_local20.r.tl = 0;
_local20.r.bl = 0;
radiusObj.tl = 0;
radiusObj.bl = 0;
_local35 = false;
};
if (_local8.indexOf("top") == -1){
_local20.y = 0;
_local20.h = (_local20.h + _local9);
_local20.r.tl = 0;
_local20.r.tr = 0;
radiusObj.tl = 0;
radiusObj.tr = 0;
_local35 = false;
};
if (_local8.indexOf("right") == -1){
_local20.w = (_local20.w + _local9);
_local20.r.tr = 0;
_local20.r.br = 0;
radiusObj.tr = 0;
radiusObj.br = 0;
_local35 = false;
};
if (_local8.indexOf("bottom") == -1){
_local20.h = (_local20.h + _local9);
_local20.r.bl = 0;
_local20.r.br = 0;
radiusObj.bl = 0;
radiusObj.br = 0;
_local35 = false;
};
};
if ((((radius == 0)) && (_local35))){
drawDropShadow(0, 0, _arg1, _arg2, 0, 0, 0, 0);
_local26.beginFill(_local7);
_local26.drawRect(0, 0, _arg1, _arg2);
_local26.drawRect(_local9, _local9, (_arg1 - (2 * _local9)), (_arg2 - (2 * _local9)));
_local26.endFill();
} else {
if (radiusObj){
drawDropShadow(0, 0, _arg1, _arg2, radiusObj.tl, radiusObj.tr, radiusObj.br, radiusObj.bl);
drawRoundRect(0, 0, _arg1, _arg2, radiusObj, _local7, 1, null, null, null, _local20);
radiusObj.tl = Math.max((radius - _local9), 0);
radiusObj.tr = Math.max((radius - _local9), 0);
radiusObj.bl = (bRoundedCorners) ? Math.max((radius - _local9), 0) : 0;
radiusObj.br = (bRoundedCorners) ? Math.max((radius - _local9), 0) : 0;
} else {
drawDropShadow(0, 0, _arg1, _arg2, radius, radius, radius, radius);
drawRoundRect(0, 0, _arg1, _arg2, radius, _local7, 1, null, null, null, _local20);
radius = Math.max((getStyle("cornerRadius") - _local9), 0);
};
};
};
};
}
mx_internal function drawBackground(_arg1:Number, _arg2:Number):void{
var _local4:Number;
var _local5:Number;
var _local6:EdgeMetrics;
var _local7:Graphics;
var _local8:Number;
var _local9:Number;
var _local10:Array;
var _local11:Number;
if (((((((!((backgroundColor === null))) && (!((backgroundColor === ""))))) || (getStyle("mouseShield")))) || (getStyle("mouseShieldChildren")))){
_local4 = Number(backgroundColor);
_local5 = 1;
_local6 = getBackgroundColorMetrics();
_local7 = graphics;
if (((((isNaN(_local4)) || ((backgroundColor === "")))) || ((backgroundColor === null)))){
_local5 = 0;
_local4 = 0xFFFFFF;
} else {
_local5 = getStyle(backgroundAlphaName);
};
if (((!((radius == 0))) || (backgroundHole))){
_local8 = _local6.bottom;
if (radiusObj){
_local9 = (bRoundedCorners) ? radius : 0;
radiusObj = {tl:radius, tr:radius, bl:_local9, br:_local9};
drawRoundRect(_local6.left, _local6.top, (width - (_local6.left + _local6.right)), (height - (_local6.top + _local8)), radiusObj, _local4, _local5, null, GradientType.LINEAR, null, backgroundHole);
} else {
drawRoundRect(_local6.left, _local6.top, (width - (_local6.left + _local6.right)), (height - (_local6.top + _local8)), radius, _local4, _local5, null, GradientType.LINEAR, null, backgroundHole);
};
} else {
_local7.beginFill(_local4, _local5);
_local7.drawRect(_local6.left, _local6.top, ((_arg1 - _local6.right) - _local6.left), ((_arg2 - _local6.bottom) - _local6.top));
_local7.endFill();
};
};
var _local3:String = getStyle("borderStyle");
if ((((((FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)) && ((((_local3 == "alert")) || ((_local3 == "default")))))) && ((getStyle("headerColors") == null)))){
_local10 = getStyle("highlightAlphas");
_local11 = (_local10) ? _local10[0] : 0.3;
drawRoundRect(0, 0, _arg1, _arg2, {tl:radius, tr:radius, bl:0, br:0}, 0xFFFFFF, _local11, null, GradientType.LINEAR, null, {x:0, y:1, w:_arg1, h:(_arg2 - 1), r:{tl:radius, tr:radius, bl:0, br:0}});
};
}
mx_internal function drawDropShadow(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):void{
var _local11:Number;
var _local12:Boolean;
if ((((((((getStyle("dropShadowEnabled") == false)) || ((getStyle("dropShadowEnabled") == "false")))) || ((_arg3 == 0)))) || ((_arg4 == 0)))){
return;
};
var _local9:Number = getStyle("shadowDistance");
var _local10:String = getStyle("shadowDirection");
if (getStyle("borderStyle") == "applicationControlBar"){
_local12 = getStyle("docked");
_local11 = (_local12) ? 90 : getDropShadowAngle(_local9, _local10);
_local9 = Math.abs(_local9);
} else {
_local11 = getDropShadowAngle(_local9, _local10);
_local9 = (Math.abs(_local9) + 2);
};
if (!dropShadow){
dropShadow = new RectangularDropShadow();
};
dropShadow.distance = _local9;
dropShadow.angle = _local11;
dropShadow.color = getStyle("dropShadowColor");
dropShadow.alpha = 0.4;
dropShadow.tlRadius = _arg5;
dropShadow.trRadius = _arg6;
dropShadow.blRadius = _arg8;
dropShadow.brRadius = _arg7;
dropShadow.drawShadow(graphics, _arg1, _arg2, _arg3, _arg4);
}
mx_internal function getBackgroundColor():Object{
var _local2:Object;
var _local1:IUIComponent = (parent as IUIComponent);
if (((_local1) && (!(_local1.enabled)))){
_local2 = getStyle("backgroundDisabledColor");
if (((!((_local2 === null))) && (StyleManager.isValidStyleValue(_local2)))){
return (_local2);
};
};
return (getStyle("backgroundColor"));
}
mx_internal function draw3dBorder(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):void{
var _local7:Number = width;
var _local8:Number = height;
drawDropShadow(0, 0, width, height, 0, 0, 0, 0);
var _local9:Graphics = graphics;
_local9.beginFill(_arg1);
_local9.drawRect(0, 0, _local7, _local8);
_local9.drawRect(1, 0, (_local7 - 2), _local8);
_local9.endFill();
_local9.beginFill(_arg2);
_local9.drawRect(1, 0, (_local7 - 2), 1);
_local9.endFill();
_local9.beginFill(_arg3);
_local9.drawRect(1, (_local8 - 1), (_local7 - 2), 1);
_local9.endFill();
_local9.beginFill(_arg4);
_local9.drawRect(1, 1, (_local7 - 2), 1);
_local9.endFill();
_local9.beginFill(_arg5);
_local9.drawRect(1, (_local8 - 2), (_local7 - 2), 1);
_local9.endFill();
_local9.beginFill(_arg6);
_local9.drawRect(1, 2, (_local7 - 2), (_local8 - 4));
_local9.drawRect(2, 2, (_local7 - 4), (_local8 - 4));
_local9.endFill();
}
mx_internal function getBackgroundColorMetrics():EdgeMetrics{
return (borderMetrics);
}
mx_internal function getDropShadowAngle(_arg1:Number, _arg2:String):Number{
if (_arg2 == "left"){
return (((_arg1 >= 0)) ? 135 : 225);
//unresolved jump
};
if (_arg2 == "right"){
return (((_arg1 >= 0)) ? 45 : 315);
//unresolved jump
};
return (((_arg1 >= 0)) ? 90 : 270);
}
override public function get borderMetrics():EdgeMetrics{
var _local1:Number;
var _local3:String;
if (_borderMetrics){
return (_borderMetrics);
};
var _local2:String = getStyle("borderStyle");
if ((((_local2 == "default")) || ((_local2 == "alert")))){
if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0){
_borderMetrics = new EdgeMetrics(0, 0, 0, 0);
} else {
return (EdgeMetrics.EMPTY);
};
} else {
if ((((_local2 == "controlBar")) || ((_local2 == "applicationControlBar")))){
_borderMetrics = new EdgeMetrics(1, 1, 1, 1);
} else {
if (_local2 == "solid"){
_local1 = getStyle("borderThickness");
if (isNaN(_local1)){
_local1 = 0;
};
_borderMetrics = new EdgeMetrics(_local1, _local1, _local1, _local1);
_local3 = getStyle("borderSides");
if (_local3 != "left top right bottom"){
if (_local3.indexOf("left") == -1){
_borderMetrics.left = 0;
};
if (_local3.indexOf("top") == -1){
_borderMetrics.top = 0;
};
if (_local3.indexOf("right") == -1){
_borderMetrics.right = 0;
};
if (_local3.indexOf("bottom") == -1){
_borderMetrics.bottom = 0;
};
};
} else {
_local1 = BORDER_WIDTHS[_local2];
if (isNaN(_local1)){
_local1 = 0;
};
_borderMetrics = new EdgeMetrics(_local1, _local1, _local1, _local1);
};
};
};
return (_borderMetrics);
}
}
}//package mx.skins.halo
Section 277
//HaloFocusRect (mx.skins.halo.HaloFocusRect)
package mx.skins.halo {
import flash.display.*;
import mx.core.*;
import mx.styles.*;
import mx.skins.*;
import mx.utils.*;
public class HaloFocusRect extends ProgrammaticSkin implements IStyleClient {
private var _focusColor:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public function get inheritingStyles():Object{
return (styleName.inheritingStyles);
}
public function set inheritingStyles(_arg1:Object):void{
}
public function notifyStyleChangeInChildren(_arg1:String, _arg2:Boolean):void{
}
public function registerEffects(_arg1:Array):void{
}
public function regenerateStyleCache(_arg1:Boolean):void{
}
public function get styleDeclaration():CSSStyleDeclaration{
return (CSSStyleDeclaration(styleName));
}
public function getClassStyleDeclarations():Array{
return ([]);
}
public function get className():String{
return ("HaloFocusRect");
}
public function clearStyle(_arg1:String):void{
if (_arg1 == "focusColor"){
_focusColor = NaN;
};
}
public function setStyle(_arg1:String, _arg2):void{
if (_arg1 == "focusColor"){
_focusColor = _arg2;
};
}
public function set nonInheritingStyles(_arg1:Object):void{
}
public function get nonInheritingStyles():Object{
return (styleName.nonInheritingStyles);
}
override protected function updateDisplayList(_arg1:Number, _arg2:Number):void{
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
super.updateDisplayList(_arg1, _arg2);
var _local3:String = getStyle("focusBlendMode");
var _local4:Number = getStyle("focusAlpha");
var _local5:Number = getStyle("focusColor");
var _local6:Number = getStyle("cornerRadius");
var _local7:Number = getStyle("focusThickness");
var _local8:String = getStyle("focusRoundedCorners");
var _local9:Number = getStyle("themeColor");
var _local10:Number = _local5;
if (isNaN(_local10)){
_local10 = _local9;
};
var _local11:Graphics = graphics;
_local11.clear();
blendMode = _local3;
if (((!((_local8 == "tl tr bl br"))) && ((_local6 > 0)))){
_local12 = 0;
_local13 = 0;
_local14 = 0;
_local15 = 0;
_local16 = (_local6 + _local7);
if (_local8.indexOf("tl") >= 0){
_local12 = _local16;
};
if (_local8.indexOf("tr") >= 0){
_local14 = _local16;
};
if (_local8.indexOf("bl") >= 0){
_local13 = _local16;
};
if (_local8.indexOf("br") >= 0){
_local15 = _local16;
};
_local11.beginFill(_local10, _local4);
GraphicsUtil.drawRoundRectComplex(_local11, 0, 0, _arg1, _arg2, _local12, _local14, _local13, _local15);
_local12 = (_local12) ? _local6 : 0;
_local14 = (_local14) ? _local6 : 0;
_local13 = (_local13) ? _local6 : 0;
_local15 = (_local15) ? _local6 : 0;
GraphicsUtil.drawRoundRectComplex(_local11, _local7, _local7, (_arg1 - (2 * _local7)), (_arg2 - (2 * _local7)), _local12, _local14, _local13, _local15);
_local11.endFill();
_local16 = (_local6 + (_local7 / 2));
_local12 = (_local12) ? _local16 : 0;
_local14 = (_local14) ? _local16 : 0;
_local13 = (_local13) ? _local16 : 0;
_local15 = (_local15) ? _local16 : 0;
_local11.beginFill(_local10, _local4);
GraphicsUtil.drawRoundRectComplex(_local11, (_local7 / 2), (_local7 / 2), (_arg1 - _local7), (_arg2 - _local7), _local12, _local14, _local13, _local15);
_local12 = (_local12) ? _local6 : 0;
_local14 = (_local14) ? _local6 : 0;
_local13 = (_local13) ? _local6 : 0;
_local15 = (_local15) ? _local6 : 0;
GraphicsUtil.drawRoundRectComplex(_local11, _local7, _local7, (_arg1 - (2 * _local7)), (_arg2 - (2 * _local7)), _local12, _local14, _local13, _local15);
_local11.endFill();
} else {
_local11.beginFill(_local10, _local4);
_local17 = (((_local6 > 0)) ? (_local6 + _local7) : 0 * 2);
_local11.drawRoundRect(0, 0, _arg1, _arg2, _local17, _local17);
_local17 = (_local6 * 2);
_local11.drawRoundRect(_local7, _local7, (_arg1 - (2 * _local7)), (_arg2 - (2 * _local7)), _local17, _local17);
_local11.endFill();
_local11.beginFill(_local10, _local4);
_local17 = (((_local6 > 0)) ? (_local6 + (_local7 / 2)) : 0 * 2);
_local11.drawRoundRect((_local7 / 2), (_local7 / 2), (_arg1 - _local7), (_arg2 - _local7), _local17, _local17);
_local17 = (_local6 * 2);
_local11.drawRoundRect(_local7, _local7, (_arg1 - (2 * _local7)), (_arg2 - (2 * _local7)), _local17, _local17);
_local11.endFill();
};
}
override public function getStyle(_arg1:String){
return (((_arg1 == "focusColor")) ? _focusColor : super.getStyle(_arg1));
}
public function set styleDeclaration(_arg1:CSSStyleDeclaration):void{
}
}
}//package mx.skins.halo
Section 278
//ToolTipBorder (mx.skins.halo.ToolTipBorder)
package mx.skins.halo {
import flash.display.*;
import mx.core.*;
import mx.skins.*;
import mx.graphics.*;
import flash.filters.*;
public class ToolTipBorder extends RectangularBorder {
private var _borderMetrics:EdgeMetrics;
private var dropShadow:RectangularDropShadow;
mx_internal static const VERSION:String = "3.0.0.0";
override public function get borderMetrics():EdgeMetrics{
if (_borderMetrics){
return (_borderMetrics);
};
var _local1:String = getStyle("borderStyle");
switch (_local1){
case "errorTipRight":
_borderMetrics = new EdgeMetrics(15, 1, 3, 3);
break;
case "errorTipAbove":
_borderMetrics = new EdgeMetrics(3, 1, 3, 15);
break;
case "errorTipBelow":
_borderMetrics = new EdgeMetrics(3, 13, 3, 3);
break;
default:
_borderMetrics = new EdgeMetrics(3, 1, 3, 3);
break;
};
return (_borderMetrics);
}
override protected function updateDisplayList(_arg1:Number, _arg2:Number):void{
super.updateDisplayList(_arg1, _arg2);
var _local3:String = getStyle("borderStyle");
var _local4:uint = getStyle("backgroundColor");
var _local5:Number = getStyle("backgroundAlpha");
var _local6:uint = getStyle("borderColor");
var _local7:Number = getStyle("cornerRadius");
var _local8:uint = getStyle("shadowColor");
var _local9:Number = 0.1;
var _local10:Graphics = graphics;
_local10.clear();
filters = [];
switch (_local3){
case "toolTip":
drawRoundRect(3, 1, (_arg1 - 6), (_arg2 - 4), _local7, _local4, _local5);
if (!dropShadow){
dropShadow = new RectangularDropShadow();
};
dropShadow.distance = 3;
dropShadow.angle = 90;
dropShadow.color = 0;
dropShadow.alpha = 0.4;
dropShadow.tlRadius = (_local7 + 2);
dropShadow.trRadius = (_local7 + 2);
dropShadow.blRadius = (_local7 + 2);
dropShadow.brRadius = (_local7 + 2);
dropShadow.drawShadow(graphics, 3, 0, (_arg1 - 6), (_arg2 - 4));
break;
case "errorTipRight":
drawRoundRect(11, 0, (_arg1 - 11), (_arg2 - 2), 3, _local6, _local5);
_local10.beginFill(_local6, _local5);
_local10.moveTo(11, 7);
_local10.lineTo(0, 13);
_local10.lineTo(11, 19);
_local10.moveTo(11, 7);
_local10.endFill();
filters = [new DropShadowFilter(2, 90, 0, 0.4)];
break;
case "errorTipAbove":
drawRoundRect(0, 0, _arg1, (_arg2 - 13), 3, _local6, _local5);
_local10.beginFill(_local6, _local5);
_local10.moveTo(9, (_arg2 - 13));
_local10.lineTo(15, (_arg2 - 2));
_local10.lineTo(21, (_arg2 - 13));
_local10.moveTo(9, (_arg2 - 13));
_local10.endFill();
filters = [new DropShadowFilter(2, 90, 0, 0.4)];
break;
case "errorTipBelow":
drawRoundRect(0, 11, _arg1, (_arg2 - 13), 3, _local6, _local5);
_local10.beginFill(_local6, _local5);
_local10.moveTo(9, 11);
_local10.lineTo(15, 0);
_local10.lineTo(21, 11);
_local10.moveTo(10, 11);
_local10.endFill();
filters = [new DropShadowFilter(2, 90, 0, 0.4)];
break;
};
}
override public function styleChanged(_arg1:String):void{
if ((((((_arg1 == "borderStyle")) || ((_arg1 == "styleName")))) || ((_arg1 == null)))){
_borderMetrics = null;
};
invalidateDisplayList();
}
}
}//package mx.skins.halo
Section 279
//Border (mx.skins.Border)
package mx.skins {
import mx.core.*;
public class Border extends ProgrammaticSkin implements IBorder {
mx_internal static const VERSION:String = "3.0.0.0";
public function get borderMetrics():EdgeMetrics{
return (EdgeMetrics.EMPTY);
}
}
}//package mx.skins
Section 280
//ProgrammaticSkin (mx.skins.ProgrammaticSkin)
package mx.skins {
import flash.display.*;
import mx.core.*;
import mx.styles.*;
import flash.geom.*;
import mx.managers.*;
import mx.utils.*;
public class ProgrammaticSkin extends FlexShape implements IFlexDisplayObject, IInvalidating, ILayoutManagerClient, ISimpleStyleClient, IProgrammaticSkin {
private var _initialized:Boolean;// = false
private var _height:Number;
private var invalidateDisplayListFlag:Boolean;// = false
private var _styleName:IStyleClient;
private var _nestLevel:int;// = 0
private var _processedDescriptors:Boolean;// = false
private var _updateCompletePendingFlag:Boolean;// = true
private var _width:Number;
mx_internal static const VERSION:String = "3.0.0.0";
private static var tempMatrix:Matrix = new Matrix();
public function ProgrammaticSkin(){
_width = measuredWidth;
_height = measuredHeight;
}
public function getStyle(_arg1:String){
return (_styleName.getStyle(_arg1));
}
protected function updateDisplayList(_arg1:Number, _arg2:Number):void{
}
public function get nestLevel():int{
return (_nestLevel);
}
public function set nestLevel(_arg1:int):void{
_nestLevel = _arg1;
invalidateDisplayList();
}
override public function get height():Number{
return (_height);
}
public function get updateCompletePendingFlag():Boolean{
return (_updateCompletePendingFlag);
}
protected function verticalGradientMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Matrix{
return (rotatedGradientMatrix(_arg1, _arg2, _arg3, _arg4, 90));
}
public function validateSize(_arg1:Boolean=false):void{
}
public function invalidateDisplayList():void{
if (((!(invalidateDisplayListFlag)) && ((nestLevel > 0)))){
invalidateDisplayListFlag = true;
UIComponentGlobals.layoutManager.invalidateDisplayList(this);
};
}
public function set updateCompletePendingFlag(_arg1:Boolean):void{
_updateCompletePendingFlag = _arg1;
}
protected function horizontalGradientMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Matrix{
return (rotatedGradientMatrix(_arg1, _arg2, _arg3, _arg4, 0));
}
override public function set height(_arg1:Number):void{
_height = _arg1;
invalidateDisplayList();
}
public function set processedDescriptors(_arg1:Boolean):void{
_processedDescriptors = _arg1;
}
public function validateDisplayList():void{
invalidateDisplayListFlag = false;
updateDisplayList(width, height);
}
public function get measuredWidth():Number{
return (0);
}
override public function set width(_arg1:Number):void{
_width = _arg1;
invalidateDisplayList();
}
public function get measuredHeight():Number{
return (0);
}
public function set initialized(_arg1:Boolean):void{
_initialized = _arg1;
}
protected function drawRoundRect(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null, _arg6:Object=null, _arg7:Object=null, _arg8:Matrix=null, _arg9:String="linear", _arg10:Array=null, _arg11:Object=null):void{
var _local13:Number;
var _local14:Array;
var _local15:Object;
var _local12:Graphics = graphics;
if ((((_arg3 == 0)) || ((_arg4 == 0)))){
return;
};
if (_arg6 !== null){
if ((_arg6 is uint)){
_local12.beginFill(uint(_arg6), Number(_arg7));
} else {
if ((_arg6 is Array)){
_local14 = ((_arg7 is Array)) ? (_arg7 as Array) : [_arg7, _arg7];
if (!_arg10){
_arg10 = [0, 0xFF];
};
_local12.beginGradientFill(_arg9, (_arg6 as Array), _local14, _arg10, _arg8);
};
};
};
if (!_arg5){
_local12.drawRect(_arg1, _arg2, _arg3, _arg4);
} else {
if ((_arg5 is Number)){
_local13 = (Number(_arg5) * 2);
_local12.drawRoundRect(_arg1, _arg2, _arg3, _arg4, _local13, _local13);
} else {
GraphicsUtil.drawRoundRectComplex(_local12, _arg1, _arg2, _arg3, _arg4, _arg5.tl, _arg5.tr, _arg5.bl, _arg5.br);
};
};
if (_arg11){
_local15 = _arg11.r;
if ((_local15 is Number)){
_local13 = (Number(_local15) * 2);
_local12.drawRoundRect(_arg11.x, _arg11.y, _arg11.w, _arg11.h, _local13, _local13);
} else {
GraphicsUtil.drawRoundRectComplex(_local12, _arg11.x, _arg11.y, _arg11.w, _arg11.h, _local15.tl, _local15.tr, _local15.bl, _local15.br);
};
};
if (_arg6 !== null){
_local12.endFill();
};
}
public function get processedDescriptors():Boolean{
return (_processedDescriptors);
}
public function set styleName(_arg1:Object):void{
if (_styleName != _arg1){
_styleName = (_arg1 as IStyleClient);
invalidateDisplayList();
};
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
var _local3:Boolean;
if (_width != _arg1){
_width = _arg1;
_local3 = true;
};
if (_height != _arg2){
_height = _arg2;
_local3 = true;
};
if (_local3){
invalidateDisplayList();
};
}
public function styleChanged(_arg1:String):void{
invalidateDisplayList();
}
override public function get width():Number{
return (_width);
}
public function invalidateProperties():void{
}
public function get initialized():Boolean{
return (_initialized);
}
protected function rotatedGradientMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Matrix{
tempMatrix.createGradientBox(_arg3, _arg4, ((_arg5 * Math.PI) / 180), _arg1, _arg2);
return (tempMatrix);
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function get styleName():Object{
return (_styleName);
}
public function validateNow():void{
if (invalidateDisplayListFlag){
validateDisplayList();
};
}
public function invalidateSize():void{
}
public function validateProperties():void{
}
}
}//package mx.skins
Section 281
//RectangularBorder (mx.skins.RectangularBorder)
package mx.skins {
import flash.events.*;
import flash.display.*;
import mx.core.*;
import mx.styles.*;
import flash.system.*;
import flash.geom.*;
import flash.net.*;
import mx.resources.*;
import flash.utils.*;
public class RectangularBorder extends Border implements IRectangularBorder {
private var backgroundImage:DisplayObject;
private var backgroundImageHeight:Number;
private var _backgroundImageBounds:Rectangle;
private var backgroundImageStyle:Object;
private var backgroundImageWidth:Number;
private var resourceManager:IResourceManager;
mx_internal static const VERSION:String = "3.0.0.0";
public function RectangularBorder(){
resourceManager = ResourceManager.getInstance();
super();
addEventListener(Event.REMOVED, removedHandler);
}
public function layoutBackgroundImage():void{
var _local4:Number;
var _local5:Number;
var _local7:Number;
var _local8:Number;
var _local14:Number;
var _local15:Graphics;
var _local1:DisplayObject = parent;
var _local2:EdgeMetrics = ((_local1 is IContainer)) ? IContainer(_local1).viewMetrics : borderMetrics;
var _local3 = !((getStyle("backgroundAttachment") == "fixed"));
if (_backgroundImageBounds){
_local4 = _backgroundImageBounds.width;
_local5 = _backgroundImageBounds.height;
} else {
_local4 = ((width - _local2.left) - _local2.right);
_local5 = ((height - _local2.top) - _local2.bottom);
};
var _local6:Number = getBackgroundSize();
if (isNaN(_local6)){
_local7 = 1;
_local8 = 1;
} else {
_local14 = (_local6 * 0.01);
_local7 = ((_local14 * _local4) / backgroundImageWidth);
_local8 = ((_local14 * _local5) / backgroundImageHeight);
};
backgroundImage.scaleX = _local7;
backgroundImage.scaleY = _local8;
var _local9:Number = Math.round((0.5 * (_local4 - (backgroundImageWidth * _local7))));
var _local10:Number = Math.round((0.5 * (_local5 - (backgroundImageHeight * _local8))));
backgroundImage.x = _local2.left;
backgroundImage.y = _local2.top;
var _local11:Shape = Shape(backgroundImage.mask);
_local11.x = _local2.left;
_local11.y = _local2.top;
if (((_local3) && ((_local1 is IContainer)))){
_local9 = (_local9 - IContainer(_local1).horizontalScrollPosition);
_local10 = (_local10 - IContainer(_local1).verticalScrollPosition);
};
backgroundImage.alpha = getStyle("backgroundAlpha");
backgroundImage.x = (backgroundImage.x + _local9);
backgroundImage.y = (backgroundImage.y + _local10);
var _local12:Number = ((width - _local2.left) - _local2.right);
var _local13:Number = ((height - _local2.top) - _local2.bottom);
if (((!((_local11.width == _local12))) || (!((_local11.height == _local13))))){
_local15 = _local11.graphics;
_local15.clear();
_local15.beginFill(0xFFFFFF);
_local15.drawRect(0, 0, _local12, _local13);
_local15.endFill();
};
}
public function set backgroundImageBounds(_arg1:Rectangle):void{
_backgroundImageBounds = _arg1;
invalidateDisplayList();
}
private function getBackgroundSize():Number{
var _local3:int;
var _local1:Number = NaN;
var _local2:Object = getStyle("backgroundSize");
if (((_local2) && ((_local2 is String)))){
_local3 = _local2.indexOf("%");
if (_local3 != -1){
_local1 = Number(_local2.substr(0, _local3));
};
};
return (_local1);
}
private function removedHandler(_arg1:Event):void{
var _local2:IChildList;
if (backgroundImage){
_local2 = ((parent is IRawChildrenContainer)) ? IRawChildrenContainer(parent).rawChildren : IChildList(parent);
_local2.removeChild(backgroundImage.mask);
_local2.removeChild(backgroundImage);
backgroundImage = null;
};
}
private function initBackgroundImage(_arg1:DisplayObject):void{
backgroundImage = _arg1;
if ((_arg1 is Loader)){
backgroundImageWidth = Loader(_arg1).contentLoaderInfo.width;
backgroundImageHeight = Loader(_arg1).contentLoaderInfo.height;
} else {
backgroundImageWidth = backgroundImage.width;
backgroundImageHeight = backgroundImage.height;
if ((_arg1 is ISimpleStyleClient)){
ISimpleStyleClient(_arg1).styleName = styleName;
};
};
var _local2:IChildList = ((parent is IRawChildrenContainer)) ? IRawChildrenContainer(parent).rawChildren : IChildList(parent);
var _local3:Shape = new FlexShape();
_local3.name = "backgroundMask";
_local3.x = 0;
_local3.y = 0;
_local2.addChild(_local3);
var _local4:int = _local2.getChildIndex(this);
_local2.addChildAt(backgroundImage, (_local4 + 1));
backgroundImage.mask = _local3;
}
public function get backgroundImageBounds():Rectangle{
return (_backgroundImageBounds);
}
public function get hasBackgroundImage():Boolean{
return (!((backgroundImage == null)));
}
private function completeEventHandler(_arg1:Event):void{
if (!parent){
return;
};
var _local2:DisplayObject = DisplayObject(LoaderInfo(_arg1.target).loader);
initBackgroundImage(_local2);
layoutBackgroundImage();
dispatchEvent(_arg1.clone());
}
override protected function updateDisplayList(_arg1:Number, _arg2:Number):void{
var cls:Class;
var newStyleObj:DisplayObject;
var loader:Loader;
var loaderContext:LoaderContext;
var message:String;
var unscaledWidth = _arg1;
var unscaledHeight = _arg2;
if (!parent){
return;
};
var newStyle:Object = getStyle("backgroundImage");
if (newStyle != backgroundImageStyle){
removedHandler(null);
backgroundImageStyle = newStyle;
if (((newStyle) && ((newStyle as Class)))){
cls = Class(newStyle);
initBackgroundImage(new (cls));
} else {
if (((newStyle) && ((newStyle is String)))){
try {
cls = Class(getDefinitionByName(String(newStyle)));
} catch(e:Error) {
};
if (cls){
newStyleObj = new (cls);
initBackgroundImage(newStyleObj);
} else {
loader = new FlexLoader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeEventHandler);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorEventHandler);
loader.contentLoaderInfo.addEventListener(ErrorEvent.ERROR, errorEventHandler);
loaderContext = new LoaderContext();
loaderContext.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
loader.load(new URLRequest(String(newStyle)), loaderContext);
};
} else {
if (newStyle){
message = resourceManager.getString("skins", "notLoaded", [newStyle]);
throw (new Error(message));
};
};
};
};
if (backgroundImage){
layoutBackgroundImage();
};
}
private function errorEventHandler(_arg1:Event):void{
}
}
}//package mx.skins
Section 282
//CSSStyleDeclaration (mx.styles.CSSStyleDeclaration)
package mx.styles {
import flash.events.*;
import flash.display.*;
import mx.core.*;
import mx.managers.*;
import flash.utils.*;
public class CSSStyleDeclaration extends EventDispatcher {
mx_internal var effects:Array;
protected var overrides:Object;
public var defaultFactory:Function;
public var factory:Function;
mx_internal var selectorRefCount:int;// = 0
private var styleManager:IStyleManager2;
private var clones:Dictionary;
mx_internal static const VERSION:String = "3.0.0.0";
private static const NOT_A_COLOR:uint = 4294967295;
private static const FILTERMAP_PROP:String = "__reserved__filterMap";
public function CSSStyleDeclaration(_arg1:String=null){
clones = new Dictionary(true);
super();
if (_arg1){
styleManager = (Singleton.getInstance("mx.styles::IStyleManager2") as IStyleManager2);
styleManager.setStyleDeclaration(_arg1, this, false);
};
}
mx_internal function addStyleToProtoChain(_arg1:Object, _arg2:DisplayObject, _arg3:Object=null):Object{
var p:String;
var emptyObjectFactory:Function;
var filteredChain:Object;
var filterObjectFactory:Function;
var i:String;
var chain = _arg1;
var target = _arg2;
var filterMap = _arg3;
var nodeAddedToChain:Boolean;
var originalChain:Object = chain;
if (filterMap){
chain = {};
};
if (defaultFactory != null){
defaultFactory.prototype = chain;
chain = new defaultFactory();
nodeAddedToChain = true;
};
if (factory != null){
factory.prototype = chain;
chain = new factory();
nodeAddedToChain = true;
};
if (overrides){
if ((((defaultFactory == null)) && ((factory == null)))){
emptyObjectFactory = function ():void{
};
emptyObjectFactory.prototype = chain;
chain = new (emptyObjectFactory);
nodeAddedToChain = true;
};
for (p in overrides) {
if (overrides[p] === undefined){
delete chain[p];
} else {
chain[p] = overrides[p];
};
};
};
if (filterMap){
if (nodeAddedToChain){
filteredChain = {};
filterObjectFactory = function ():void{
};
filterObjectFactory.prototype = originalChain;
filteredChain = new (filterObjectFactory);
for (i in chain) {
if (filterMap[i] != null){
filteredChain[filterMap[i]] = chain[i];
};
};
chain = filteredChain;
chain[FILTERMAP_PROP] = filterMap;
} else {
chain = originalChain;
};
};
if (nodeAddedToChain){
clones[chain] = 1;
};
return (chain);
}
public function getStyle(_arg1:String){
var _local2:*;
var _local3:*;
if (overrides){
if ((((_arg1 in overrides)) && ((overrides[_arg1] === undefined)))){
return (undefined);
};
_local3 = overrides[_arg1];
if (_local3 !== undefined){
return (_local3);
};
};
if (factory != null){
factory.prototype = {};
_local2 = new factory();
_local3 = _local2[_arg1];
if (_local3 !== undefined){
return (_local3);
};
};
if (defaultFactory != null){
defaultFactory.prototype = {};
_local2 = new defaultFactory();
_local3 = _local2[_arg1];
if (_local3 !== undefined){
return (_local3);
};
};
return (undefined);
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, undefined);
}
public function setStyle(_arg1:String, _arg2):void{
var _local7:int;
var _local8:Object;
var _local3:Object = getStyle(_arg1);
var _local4:Boolean;
if ((((((((((selectorRefCount > 0)) && ((factory == null)))) && ((defaultFactory == null)))) && (!(overrides)))) && (!((_local3 === _arg2))))){
_local4 = true;
};
if (_arg2 !== undefined){
setStyle(_arg1, _arg2);
} else {
if (_arg2 == _local3){
return;
};
setStyle(_arg1, _arg2);
};
var _local5:Array = SystemManagerGlobals.topLevelSystemManagers;
var _local6:int = _local5.length;
if (_local4){
_local7 = 0;
while (_local7 < _local6) {
_local8 = _local5[_local7];
_local8.regenerateStyleCache(true);
_local7++;
};
};
_local7 = 0;
while (_local7 < _local6) {
_local8 = _local5[_local7];
_local8.notifyStyleChangeInChildren(_arg1, true);
_local7++;
};
}
private function clearStyleAttr(_arg1:String):void{
var _local2:*;
if (!overrides){
overrides = {};
};
overrides[_arg1] = undefined;
for (_local2 in clones) {
delete _local2[_arg1];
};
}
mx_internal function createProtoChainRoot():Object{
var _local1:Object = {};
if (defaultFactory != null){
defaultFactory.prototype = _local1;
_local1 = new defaultFactory();
};
if (factory != null){
factory.prototype = _local1;
_local1 = new factory();
};
clones[_local1] = 1;
return (_local1);
}
mx_internal function clearOverride(_arg1:String):void{
if (((overrides) && (overrides[_arg1]))){
delete overrides[_arg1];
};
}
mx_internal function setStyle(_arg1:String, _arg2):void{
var _local3:Object;
var _local4:*;
var _local5:Number;
var _local6:Object;
if (_arg2 === undefined){
clearStyleAttr(_arg1);
return;
};
if ((_arg2 is String)){
if (!styleManager){
styleManager = (Singleton.getInstance("mx.styles::IStyleManager2") as IStyleManager2);
};
_local5 = styleManager.getColorName(_arg2);
if (_local5 != NOT_A_COLOR){
_arg2 = _local5;
};
};
if (defaultFactory != null){
_local3 = new defaultFactory();
if (_local3[_arg1] !== _arg2){
if (!overrides){
overrides = {};
};
overrides[_arg1] = _arg2;
} else {
if (overrides){
delete overrides[_arg1];
};
};
};
if (factory != null){
_local3 = new factory();
if (_local3[_arg1] !== _arg2){
if (!overrides){
overrides = {};
};
overrides[_arg1] = _arg2;
} else {
if (overrides){
delete overrides[_arg1];
};
};
};
if ((((defaultFactory == null)) && ((factory == null)))){
if (!overrides){
overrides = {};
};
overrides[_arg1] = _arg2;
};
for (_local4 in clones) {
_local6 = _local4[FILTERMAP_PROP];
if (_local6){
if (_local6[_arg1] != null){
_local4[_local6[_arg1]] = _arg2;
};
} else {
_local4[_arg1] = _arg2;
};
};
}
}
}//package mx.styles
Section 283
//ISimpleStyleClient (mx.styles.ISimpleStyleClient)
package mx.styles {
public interface ISimpleStyleClient {
function set styleName(_arg1:Object):void;
function styleChanged(_arg1:String):void;
function get styleName():Object;
}
}//package mx.styles
Section 284
//IStyleClient (mx.styles.IStyleClient)
package mx.styles {
public interface IStyleClient extends ISimpleStyleClient {
function regenerateStyleCache(_arg1:Boolean):void;
function get className():String;
function clearStyle(_arg1:String):void;
function getClassStyleDeclarations():Array;
function get inheritingStyles():Object;
function set nonInheritingStyles(_arg1:Object):void;
function setStyle(_arg1:String, _arg2):void;
function get styleDeclaration():CSSStyleDeclaration;
function set styleDeclaration(_arg1:CSSStyleDeclaration):void;
function get nonInheritingStyles():Object;
function set inheritingStyles(_arg1:Object):void;
function getStyle(_arg1:String);
function notifyStyleChangeInChildren(_arg1:String, _arg2:Boolean):void;
function registerEffects(_arg1:Array):void;
}
}//package mx.styles
Section 285
//IStyleManager (mx.styles.IStyleManager)
package mx.styles {
import flash.events.*;
public interface IStyleManager {
function isColorName(_arg1:String):Boolean;
function registerParentDisplayListInvalidatingStyle(_arg1:String):void;
function registerInheritingStyle(_arg1:String):void;
function set stylesRoot(_arg1:Object):void;
function get typeSelectorCache():Object;
function styleDeclarationsChanged():void;
function setStyleDeclaration(_arg1:String, _arg2:CSSStyleDeclaration, _arg3:Boolean):void;
function isParentDisplayListInvalidatingStyle(_arg1:String):Boolean;
function isSizeInvalidatingStyle(_arg1:String):Boolean;
function get inheritingStyles():Object;
function isValidStyleValue(_arg1):Boolean;
function isParentSizeInvalidatingStyle(_arg1:String):Boolean;
function getColorName(_arg1:Object):uint;
function set typeSelectorCache(_arg1:Object):void;
function unloadStyleDeclarations(_arg1:String, _arg2:Boolean=true):void;
function getColorNames(_arg1:Array):void;
function loadStyleDeclarations(_arg1:String, _arg2:Boolean=true, _arg3:Boolean=false):IEventDispatcher;
function isInheritingStyle(_arg1:String):Boolean;
function set inheritingStyles(_arg1:Object):void;
function get stylesRoot():Object;
function initProtoChainRoots():void;
function registerColorName(_arg1:String, _arg2:uint):void;
function registerParentSizeInvalidatingStyle(_arg1:String):void;
function registerSizeInvalidatingStyle(_arg1:String):void;
function clearStyleDeclaration(_arg1:String, _arg2:Boolean):void;
function isInheritingTextFormatStyle(_arg1:String):Boolean;
function getStyleDeclaration(_arg1:String):CSSStyleDeclaration;
}
}//package mx.styles
Section 286
//IStyleManager2 (mx.styles.IStyleManager2)
package mx.styles {
import flash.events.*;
import flash.system.*;
public interface IStyleManager2 extends IStyleManager {
function get selectors():Array;
function loadStyleDeclarations2(_arg1:String, _arg2:Boolean=true, _arg3:ApplicationDomain=null, _arg4:SecurityDomain=null):IEventDispatcher;
}
}//package mx.styles
Section 287
//IStyleModule (mx.styles.IStyleModule)
package mx.styles {
public interface IStyleModule {
function unload():void;
}
}//package mx.styles
Section 288
//StyleManager (mx.styles.StyleManager)
package mx.styles {
import flash.events.*;
import mx.core.*;
import flash.system.*;
public class StyleManager {
mx_internal static const VERSION:String = "3.0.0.0";
public static const NOT_A_COLOR:uint = 4294967295;
private static var _impl:IStyleManager2;
private static var implClassDependency:StyleManagerImpl;
public static function isParentSizeInvalidatingStyle(_arg1:String):Boolean{
return (impl.isParentSizeInvalidatingStyle(_arg1));
}
public static function registerInheritingStyle(_arg1:String):void{
impl.registerInheritingStyle(_arg1);
}
mx_internal static function set stylesRoot(_arg1:Object):void{
impl.stylesRoot = _arg1;
}
mx_internal static function get inheritingStyles():Object{
return (impl.inheritingStyles);
}
mx_internal static function styleDeclarationsChanged():void{
impl.styleDeclarationsChanged();
}
public static function setStyleDeclaration(_arg1:String, _arg2:CSSStyleDeclaration, _arg3:Boolean):void{
impl.setStyleDeclaration(_arg1, _arg2, _arg3);
}
public static function registerParentDisplayListInvalidatingStyle(_arg1:String):void{
impl.registerParentDisplayListInvalidatingStyle(_arg1);
}
mx_internal static function get typeSelectorCache():Object{
return (impl.typeSelectorCache);
}
mx_internal static function set inheritingStyles(_arg1:Object):void{
impl.inheritingStyles = _arg1;
}
public static function isColorName(_arg1:String):Boolean{
return (impl.isColorName(_arg1));
}
public static function isParentDisplayListInvalidatingStyle(_arg1:String):Boolean{
return (impl.isParentDisplayListInvalidatingStyle(_arg1));
}
public static function isSizeInvalidatingStyle(_arg1:String):Boolean{
return (impl.isSizeInvalidatingStyle(_arg1));
}
public static function getColorName(_arg1:Object):uint{
return (impl.getColorName(_arg1));
}
mx_internal static function set typeSelectorCache(_arg1:Object):void{
impl.typeSelectorCache = _arg1;
}
public static function unloadStyleDeclarations(_arg1:String, _arg2:Boolean=true):void{
impl.unloadStyleDeclarations(_arg1, _arg2);
}
public static function getColorNames(_arg1:Array):void{
impl.getColorNames(_arg1);
}
public static function loadStyleDeclarations(_arg1:String, _arg2:Boolean=true, _arg3:Boolean=false, _arg4:ApplicationDomain=null, _arg5:SecurityDomain=null):IEventDispatcher{
return (impl.loadStyleDeclarations2(_arg1, _arg2, _arg4, _arg5));
}
private static function get impl():IStyleManager2{
if (!_impl){
_impl = IStyleManager2(Singleton.getInstance("mx.styles::IStyleManager2"));
};
return (_impl);
}
public static function isValidStyleValue(_arg1):Boolean{
return (impl.isValidStyleValue(_arg1));
}
mx_internal static function get stylesRoot():Object{
return (impl.stylesRoot);
}
public static function isInheritingStyle(_arg1:String):Boolean{
return (impl.isInheritingStyle(_arg1));
}
mx_internal static function initProtoChainRoots():void{
impl.initProtoChainRoots();
}
public static function registerParentSizeInvalidatingStyle(_arg1:String):void{
impl.registerParentSizeInvalidatingStyle(_arg1);
}
public static function get selectors():Array{
return (impl.selectors);
}
public static function registerSizeInvalidatingStyle(_arg1:String):void{
impl.registerSizeInvalidatingStyle(_arg1);
}
public static function clearStyleDeclaration(_arg1:String, _arg2:Boolean):void{
impl.clearStyleDeclaration(_arg1, _arg2);
}
public static function registerColorName(_arg1:String, _arg2:uint):void{
impl.registerColorName(_arg1, _arg2);
}
public static function isInheritingTextFormatStyle(_arg1:String):Boolean{
return (impl.isInheritingTextFormatStyle(_arg1));
}
public static function getStyleDeclaration(_arg1:String):CSSStyleDeclaration{
return (impl.getStyleDeclaration(_arg1));
}
}
}//package mx.styles
Section 289
//StyleManagerImpl (mx.styles.StyleManagerImpl)
package mx.styles {
import flash.events.*;
import mx.core.*;
import flash.system.*;
import mx.modules.*;
import mx.events.*;
import mx.resources.*;
import mx.managers.*;
import flash.utils.*;
public class StyleManagerImpl implements IStyleManager2 {
private var _stylesRoot:Object;
private var _selectors:Object;
private var styleModules:Object;
private var _inheritingStyles:Object;
private var resourceManager:IResourceManager;
private var _typeSelectorCache:Object;
mx_internal static const VERSION:String = "3.0.0.0";
private static var parentSizeInvalidatingStyles:Object = {bottom:true, horizontalCenter:true, left:true, right:true, top:true, verticalCenter:true, baseline:true};
private static var colorNames:Object = {transparent:"transparent", black:0, blue:0xFF, green:0x8000, gray:0x808080, silver:0xC0C0C0, lime:0xFF00, olive:0x808000, white:0xFFFFFF, yellow:0xFFFF00, maroon:0x800000, navy:128, red:0xFF0000, purple:0x800080, teal:0x8080, fuchsia:0xFF00FF, aqua:0xFFFF, magenta:0xFF00FF, cyan:0xFFFF, halogreen:8453965, haloblue:40447, haloorange:0xFFB600, halosilver:11455193};
private static var inheritingTextFormatStyles:Object = {align:true, bold:true, color:true, font:true, indent:true, italic:true, size:true};
private static var instance:IStyleManager2;
private static var parentDisplayListInvalidatingStyles:Object = {bottom:true, horizontalCenter:true, left:true, right:true, top:true, verticalCenter:true, baseline:true};
private static var sizeInvalidatingStyles:Object = {borderStyle:true, borderThickness:true, fontAntiAliasType:true, fontFamily:true, fontGridFitType:true, fontSharpness:true, fontSize:true, fontStyle:true, fontThickness:true, fontWeight:true, headerHeight:true, horizontalAlign:true, horizontalGap:true, kerning:true, leading:true, letterSpacing:true, paddingBottom:true, paddingLeft:true, paddingRight:true, paddingTop:true, strokeWidth:true, tabHeight:true, tabWidth:true, verticalAlign:true, verticalGap:true};
public function StyleManagerImpl(){
_selectors = {};
styleModules = {};
resourceManager = ResourceManager.getInstance();
_inheritingStyles = {};
_typeSelectorCache = {};
super();
}
public function setStyleDeclaration(_arg1:String, _arg2:CSSStyleDeclaration, _arg3:Boolean):void{
_arg2.selectorRefCount++;
_selectors[_arg1] = _arg2;
typeSelectorCache = {};
if (_arg3){
styleDeclarationsChanged();
};
}
public function registerParentDisplayListInvalidatingStyle(_arg1:String):void{
parentDisplayListInvalidatingStyles[_arg1] = true;
}
public function getStyleDeclaration(_arg1:String):CSSStyleDeclaration{
var _local2:int;
if (_arg1.charAt(0) != "."){
_local2 = _arg1.lastIndexOf(".");
if (_local2 != -1){
_arg1 = _arg1.substr((_local2 + 1));
};
};
return (_selectors[_arg1]);
}
public function set typeSelectorCache(_arg1:Object):void{
_typeSelectorCache = _arg1;
}
public function isColorName(_arg1:String):Boolean{
return (!((colorNames[_arg1.toLowerCase()] === undefined)));
}
public function set inheritingStyles(_arg1:Object):void{
_inheritingStyles = _arg1;
}
public function getColorNames(_arg1:Array):void{
var _local4:uint;
if (!_arg1){
return;
};
var _local2:int = _arg1.length;
var _local3:int;
while (_local3 < _local2) {
if (((!((_arg1[_local3] == null))) && (isNaN(_arg1[_local3])))){
_local4 = getColorName(_arg1[_local3]);
if (_local4 != StyleManager.NOT_A_COLOR){
_arg1[_local3] = _local4;
};
};
_local3++;
};
}
public function isInheritingTextFormatStyle(_arg1:String):Boolean{
return ((inheritingTextFormatStyles[_arg1] == true));
}
public function registerParentSizeInvalidatingStyle(_arg1:String):void{
parentSizeInvalidatingStyles[_arg1] = true;
}
public function registerColorName(_arg1:String, _arg2:uint):void{
colorNames[_arg1.toLowerCase()] = _arg2;
}
public function isParentSizeInvalidatingStyle(_arg1:String):Boolean{
return ((parentSizeInvalidatingStyles[_arg1] == true));
}
public function registerInheritingStyle(_arg1:String):void{
inheritingStyles[_arg1] = true;
}
public function set stylesRoot(_arg1:Object):void{
_stylesRoot = _arg1;
}
public function get typeSelectorCache():Object{
return (_typeSelectorCache);
}
public function isParentDisplayListInvalidatingStyle(_arg1:String):Boolean{
return ((parentDisplayListInvalidatingStyles[_arg1] == true));
}
public function isSizeInvalidatingStyle(_arg1:String):Boolean{
return ((sizeInvalidatingStyles[_arg1] == true));
}
public function styleDeclarationsChanged():void{
var _local4:Object;
var _local1:Array = SystemManagerGlobals.topLevelSystemManagers;
var _local2:int = _local1.length;
var _local3:int;
while (_local3 < _local2) {
_local4 = _local1[_local3];
_local4.regenerateStyleCache(true);
_local4.notifyStyleChangeInChildren(null, true);
_local3++;
};
}
public function isValidStyleValue(_arg1):Boolean{
return (!((_arg1 === undefined)));
}
public function loadStyleDeclarations(_arg1:String, _arg2:Boolean=true, _arg3:Boolean=false):IEventDispatcher{
return (loadStyleDeclarations2(_arg1, _arg2));
}
public function get inheritingStyles():Object{
return (_inheritingStyles);
}
public function unloadStyleDeclarations(_arg1:String, _arg2:Boolean=true):void{
var _local4:IModuleInfo;
var _local3:StyleModuleInfo = styleModules[_arg1];
if (_local3){
_local3.styleModule.unload();
_local4 = _local3.module;
_local4.unload();
_local4.removeEventListener(ModuleEvent.READY, _local3.readyHandler);
_local4.removeEventListener(ModuleEvent.ERROR, _local3.errorHandler);
styleModules[_arg1] = null;
};
if (_arg2){
styleDeclarationsChanged();
};
}
public function getColorName(_arg1:Object):uint{
var _local2:Number;
var _local3:*;
if ((_arg1 is String)){
if (_arg1.charAt(0) == "#"){
_local2 = Number(("0x" + _arg1.slice(1)));
return ((isNaN(_local2)) ? StyleManager.NOT_A_COLOR : uint(_local2));
};
if ((((_arg1.charAt(1) == "x")) && ((_arg1.charAt(0) == "0")))){
_local2 = Number(_arg1);
return ((isNaN(_local2)) ? StyleManager.NOT_A_COLOR : uint(_local2));
};
_local3 = colorNames[_arg1.toLowerCase()];
if (_local3 === undefined){
return (StyleManager.NOT_A_COLOR);
};
return (uint(_local3));
};
return (uint(_arg1));
}
public function isInheritingStyle(_arg1:String):Boolean{
return ((inheritingStyles[_arg1] == true));
}
public function get stylesRoot():Object{
return (_stylesRoot);
}
public function initProtoChainRoots():void{
if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0){
delete _inheritingStyles["textDecoration"];
delete _inheritingStyles["leading"];
};
if (!stylesRoot){
stylesRoot = _selectors["global"].addStyleToProtoChain({}, null);
};
}
public function loadStyleDeclarations2(_arg1:String, _arg2:Boolean=true, _arg3:ApplicationDomain=null, _arg4:SecurityDomain=null):IEventDispatcher{
var module:IModuleInfo;
var styleEventDispatcher:StyleEventDispatcher;
var timer:Timer;
var timerHandler:Function;
var url = _arg1;
var update = _arg2;
var applicationDomain = _arg3;
var securityDomain = _arg4;
module = ModuleManager.getModule(url);
var readyHandler:Function = function (_arg1:ModuleEvent):void{
var _local2:IStyleModule = IStyleModule(_arg1.module.factory.create());
styleModules[_arg1.module.url].styleModule = _local2;
if (update){
styleDeclarationsChanged();
};
};
module.addEventListener(ModuleEvent.READY, readyHandler, false, 0, true);
styleEventDispatcher = new StyleEventDispatcher(module);
var errorHandler:Function = function (_arg1:ModuleEvent):void{
var _local3:StyleEvent;
var _local2:String = resourceManager.getString("styles", "unableToLoad", [_arg1.errorText, url]);
if (styleEventDispatcher.willTrigger(StyleEvent.ERROR)){
_local3 = new StyleEvent(StyleEvent.ERROR, _arg1.bubbles, _arg1.cancelable);
_local3.bytesLoaded = 0;
_local3.bytesTotal = 0;
_local3.errorText = _local2;
styleEventDispatcher.dispatchEvent(_local3);
} else {
throw (new Error(_local2));
};
};
module.addEventListener(ModuleEvent.ERROR, errorHandler, false, 0, true);
styleModules[url] = new StyleModuleInfo(module, readyHandler, errorHandler);
timer = new Timer(0);
timerHandler = function (_arg1:TimerEvent):void{
timer.removeEventListener(TimerEvent.TIMER, timerHandler);
timer.stop();
module.load(applicationDomain, securityDomain);
};
timer.addEventListener(TimerEvent.TIMER, timerHandler, false, 0, true);
timer.start();
return (styleEventDispatcher);
}
public function registerSizeInvalidatingStyle(_arg1:String):void{
sizeInvalidatingStyles[_arg1] = true;
}
public function clearStyleDeclaration(_arg1:String, _arg2:Boolean):void{
var _local3:CSSStyleDeclaration = getStyleDeclaration(_arg1);
if (((_local3) && ((_local3.selectorRefCount > 0)))){
_local3.selectorRefCount--;
};
delete _selectors[_arg1];
if (_arg2){
styleDeclarationsChanged();
};
}
public function get selectors():Array{
var _local2:String;
var _local1:Array = [];
for (_local2 in _selectors) {
_local1.push(_local2);
};
return (_local1);
}
public static function getInstance():IStyleManager2{
if (!instance){
instance = new (StyleManagerImpl);
};
return (instance);
}
}
}//package mx.styles
import flash.events.*;
import mx.modules.*;
import mx.events.*;
class StyleEventDispatcher extends EventDispatcher {
private function StyleEventDispatcher(_arg1:IModuleInfo){
_arg1.addEventListener(ModuleEvent.ERROR, moduleInfo_errorHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.PROGRESS, moduleInfo_progressHandler, false, 0, true);
_arg1.addEventListener(ModuleEvent.READY, moduleInfo_readyHandler, false, 0, true);
}
private function moduleInfo_progressHandler(_arg1:ModuleEvent):void{
var _local2:StyleEvent = new StyleEvent(StyleEvent.PROGRESS, _arg1.bubbles, _arg1.cancelable);
_local2.bytesLoaded = _arg1.bytesLoaded;
_local2.bytesTotal = _arg1.bytesTotal;
dispatchEvent(_local2);
}
private function moduleInfo_readyHandler(_arg1:ModuleEvent):void{
var _local2:StyleEvent = new StyleEvent(StyleEvent.COMPLETE);
dispatchEvent(_local2);
}
private function moduleInfo_errorHandler(_arg1:ModuleEvent):void{
var _local2:StyleEvent = new StyleEvent(StyleEvent.ERROR, _arg1.bubbles, _arg1.cancelable);
_local2.bytesLoaded = _arg1.bytesLoaded;
_local2.bytesTotal = _arg1.bytesTotal;
_local2.errorText = _arg1.errorText;
dispatchEvent(_local2);
}
}
class StyleModuleInfo {
public var errorHandler:Function;
public var readyHandler:Function;
public var module:IModuleInfo;
public var styleModule:IStyleModule;
private function StyleModuleInfo(_arg1:IModuleInfo, _arg2:Function, _arg3:Function){
this.module = _arg1;
this.readyHandler = _arg2;
this.errorHandler = _arg3;
}
}
Section 290
//ColorUtil (mx.utils.ColorUtil)
package mx.utils {
import mx.core.*;
public class ColorUtil {
mx_internal static const VERSION:String = "3.0.0.0";
public static function adjustBrightness2(_arg1:uint, _arg2:Number):uint{
var _local3:Number;
var _local4:Number;
var _local5:Number;
if (_arg2 == 0){
return (_arg1);
};
if (_arg2 < 0){
_arg2 = ((100 + _arg2) / 100);
_local3 = (((_arg1 >> 16) & 0xFF) * _arg2);
_local4 = (((_arg1 >> 8) & 0xFF) * _arg2);
_local5 = ((_arg1 & 0xFF) * _arg2);
} else {
_arg2 = (_arg2 / 100);
_local3 = ((_arg1 >> 16) & 0xFF);
_local4 = ((_arg1 >> 8) & 0xFF);
_local5 = (_arg1 & 0xFF);
_local3 = (_local3 + ((0xFF - _local3) * _arg2));
_local4 = (_local4 + ((0xFF - _local4) * _arg2));
_local5 = (_local5 + ((0xFF - _local5) * _arg2));
_local3 = Math.min(_local3, 0xFF);
_local4 = Math.min(_local4, 0xFF);
_local5 = Math.min(_local5, 0xFF);
};
return ((((_local3 << 16) | (_local4 << 8)) | _local5));
}
public static function rgbMultiply(_arg1:uint, _arg2:uint):uint{
var _local3:Number = ((_arg1 >> 16) & 0xFF);
var _local4:Number = ((_arg1 >> 8) & 0xFF);
var _local5:Number = (_arg1 & 0xFF);
var _local6:Number = ((_arg2 >> 16) & 0xFF);
var _local7:Number = ((_arg2 >> 8) & 0xFF);
var _local8:Number = (_arg2 & 0xFF);
return ((((((_local3 * _local6) / 0xFF) << 16) | (((_local4 * _local7) / 0xFF) << 8)) | ((_local5 * _local8) / 0xFF)));
}
public static function adjustBrightness(_arg1:uint, _arg2:Number):uint{
var _local3:Number = Math.max(Math.min((((_arg1 >> 16) & 0xFF) + _arg2), 0xFF), 0);
var _local4:Number = Math.max(Math.min((((_arg1 >> 8) & 0xFF) + _arg2), 0xFF), 0);
var _local5:Number = Math.max(Math.min(((_arg1 & 0xFF) + _arg2), 0xFF), 0);
return ((((_local3 << 16) | (_local4 << 8)) | _local5));
}
}
}//package mx.utils
Section 291
//GraphicsUtil (mx.utils.GraphicsUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
public class GraphicsUtil {
mx_internal static const VERSION:String = "3.0.0.0";
public static function drawRoundRectComplex(_arg1:Graphics, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number):void{
var _local10:Number = (_arg2 + _arg4);
var _local11:Number = (_arg3 + _arg5);
var _local12:Number = ((_arg4 < _arg5)) ? (_arg4 * 2) : (_arg5 * 2);
_arg6 = ((_arg6 < _local12)) ? _arg6 : _local12;
_arg7 = ((_arg7 < _local12)) ? _arg7 : _local12;
_arg8 = ((_arg8 < _local12)) ? _arg8 : _local12;
_arg9 = ((_arg9 < _local12)) ? _arg9 : _local12;
var _local13:Number = (_arg9 * 0.292893218813453);
var _local14:Number = (_arg9 * 0.585786437626905);
_arg1.moveTo(_local10, (_local11 - _arg9));
_arg1.curveTo(_local10, (_local11 - _local14), (_local10 - _local13), (_local11 - _local13));
_arg1.curveTo((_local10 - _local14), _local11, (_local10 - _arg9), _local11);
_local13 = (_arg8 * 0.292893218813453);
_local14 = (_arg8 * 0.585786437626905);
_arg1.lineTo((_arg2 + _arg8), _local11);
_arg1.curveTo((_arg2 + _local14), _local11, (_arg2 + _local13), (_local11 - _local13));
_arg1.curveTo(_arg2, (_local11 - _local14), _arg2, (_local11 - _arg8));
_local13 = (_arg6 * 0.292893218813453);
_local14 = (_arg6 * 0.585786437626905);
_arg1.lineTo(_arg2, (_arg3 + _arg6));
_arg1.curveTo(_arg2, (_arg3 + _local14), (_arg2 + _local13), (_arg3 + _local13));
_arg1.curveTo((_arg2 + _local14), _arg3, (_arg2 + _arg6), _arg3);
_local13 = (_arg7 * 0.292893218813453);
_local14 = (_arg7 * 0.585786437626905);
_arg1.lineTo((_local10 - _arg7), _arg3);
_arg1.curveTo((_local10 - _local14), _arg3, (_local10 - _local13), (_arg3 + _local13));
_arg1.curveTo(_local10, (_arg3 + _local14), _local10, (_arg3 + _arg7));
_arg1.lineTo(_local10, (_local11 - _arg9));
}
}
}//package mx.utils
Section 292
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.0.0.0";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var _local2:String;
var _local4:String;
var _local5:Array;
var _local3:DisplayObject = _arg1;
while (_local3 != null) {
if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
break;
};
_local4 = _local3.name;
if ((_local3 is IRepeaterClient)){
_local5 = IRepeaterClient(_local3).instanceIndices;
if (_local5){
_local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
};
};
_local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2);
_local3 = _local3.parent;
};
return (_local2);
}
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 293
//StringUtil (mx.utils.StringUtil)
package mx.utils {
import mx.core.*;
public class StringUtil {
mx_internal static const VERSION:String = "3.0.0.0";
public static function trim(_arg1:String):String{
if (_arg1 == null){
return ("");
};
var _local2:int;
while (isWhitespace(_arg1.charAt(_local2))) {
_local2++;
};
var _local3:int = (_arg1.length - 1);
while (isWhitespace(_arg1.charAt(_local3))) {
_local3--;
};
if (_local3 >= _local2){
return (_arg1.slice(_local2, (_local3 + 1)));
};
return ("");
}
public static function isWhitespace(_arg1:String):Boolean{
switch (_arg1){
case " ":
case "\t":
case "\r":
case "\n":
case "\f":
return (true);
default:
return (false);
};
}
public static function substitute(_arg1:String, ... _args):String{
var _local4:Array;
if (_arg1 == null){
return ("");
};
var _local3:uint = _args.length;
if ((((_local3 == 1)) && ((_args[0] is Array)))){
_local4 = (_args[0] as Array);
_local3 = _local4.length;
} else {
_local4 = _args;
};
var _local5:int;
while (_local5 < _local3) {
_arg1 = _arg1.replace(new RegExp((("\\{" + _local5) + "\\}"), "g"), _local4[_local5]);
_local5++;
};
return (_arg1);
}
public static function trimArrayElements(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:int;
var _local5:int;
if (((!((_arg1 == ""))) && (!((_arg1 == null))))){
_local3 = _arg1.split(_arg2);
_local4 = _local3.length;
_local5 = 0;
while (_local5 < _local4) {
_local3[_local5] = StringUtil.trim(_local3[_local5]);
_local5++;
};
if (_local4 > 0){
_arg1 = _local3.join(_arg2);
};
};
return (_arg1);
}
}
}//package mx.utils
Section 294
//_activeButtonStyleStyle (_activeButtonStyleStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _activeButtonStyleStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".activeButtonStyle");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".activeButtonStyle", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
};
};
}
}
}//package
Section 295
//_activeTabStyleStyle (_activeTabStyleStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _activeTabStyleStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".activeTabStyle");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".activeTabStyle", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.fontWeight = "bold";
};
};
}
}
}//package
Section 296
//_alertButtonStyleStyle (_alertButtonStyleStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _alertButtonStyleStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".alertButtonStyle");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".alertButtonStyle", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.color = 734012;
};
};
}
}
}//package
Section 297
//_comboDropdownStyle (_comboDropdownStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _comboDropdownStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".comboDropdown");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".comboDropdown", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.shadowDirection = "center";
this.fontWeight = "normal";
this.dropShadowEnabled = true;
this.leading = 0;
this.backgroundColor = 0xFFFFFF;
this.shadowDistance = 1;
this.cornerRadius = 0;
this.borderThickness = 0;
this.paddingLeft = 5;
this.paddingRight = 5;
};
};
}
}
}//package
Section 298
//_dataGridStylesStyle (_dataGridStylesStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _dataGridStylesStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".dataGridStyles");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".dataGridStyles", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.fontWeight = "bold";
};
};
}
}
}//package
Section 299
//_dateFieldPopupStyle (_dateFieldPopupStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _dateFieldPopupStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".dateFieldPopup");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".dateFieldPopup", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.dropShadowEnabled = true;
this.backgroundColor = 0xFFFFFF;
this.borderThickness = 0;
};
};
}
}
}//package
Section 300
//_errorTipStyle (_errorTipStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _errorTipStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".errorTip");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".errorTip", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.fontWeight = "bold";
this.borderStyle = "errorTipRight";
this.paddingTop = 4;
this.borderColor = 13510953;
this.color = 0xFFFFFF;
this.fontSize = 9;
this.shadowColor = 0;
this.paddingLeft = 4;
this.paddingBottom = 4;
this.paddingRight = 4;
};
};
}
}
}//package
Section 301
//_globalStyle (_globalStyle)
package {
import mx.core.*;
import mx.styles.*;
import mx.skins.halo.*;
public class _globalStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration("global");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration("global", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.fillColor = 0xFFFFFF;
this.kerning = false;
this.iconColor = 0x111111;
this.textRollOverColor = 2831164;
this.horizontalAlign = "left";
this.shadowCapColor = 14015965;
this.backgroundAlpha = 1;
this.filled = true;
this.textDecoration = "none";
this.roundedBottomCorners = true;
this.fontThickness = 0;
this.focusBlendMode = "normal";
this.fillColors = [0xFFFFFF, 0xCCCCCC, 0xFFFFFF, 0xEEEEEE];
this.horizontalGap = 8;
this.borderCapColor = 9542041;
this.buttonColor = 7305079;
this.indentation = 17;
this.selectionDisabledColor = 0xDDDDDD;
this.closeDuration = 250;
this.embedFonts = false;
this.paddingTop = 0;
this.letterSpacing = 0;
this.focusAlpha = 0.4;
this.bevel = true;
this.fontSize = 10;
this.shadowColor = 0xEEEEEE;
this.borderAlpha = 1;
this.paddingLeft = 0;
this.fontWeight = "normal";
this.indicatorGap = 14;
this.focusSkin = HaloFocusRect;
this.dropShadowEnabled = false;
this.leading = 2;
this.borderSkin = HaloBorder;
this.fontSharpness = 0;
this.modalTransparencyDuration = 100;
this.borderThickness = 1;
this.backgroundSize = "auto";
this.borderStyle = "inset";
this.borderColor = 12040892;
this.fontAntiAliasType = "advanced";
this.errorColor = 0xFF0000;
this.shadowDistance = 2;
this.horizontalGridLineColor = 0xF7F7F7;
this.stroked = false;
this.modalTransparencyColor = 0xDDDDDD;
this.cornerRadius = 0;
this.verticalAlign = "top";
this.textIndent = 0;
this.fillAlphas = [0.6, 0.4, 0.75, 0.65];
this.verticalGridLineColor = 14015965;
this.themeColor = 40447;
this.version = "3.0.0";
this.shadowDirection = "center";
this.modalTransparency = 0.5;
this.repeatInterval = 35;
this.openDuration = 250;
this.textAlign = "left";
this.fontFamily = "Verdana";
this.textSelectedColor = 2831164;
this.paddingBottom = 0;
this.strokeWidth = 1;
this.fontGridFitType = "pixel";
this.horizontalGridLines = false;
this.useRollOver = true;
this.verticalGridLines = true;
this.repeatDelay = 500;
this.fontStyle = "normal";
this.dropShadowColor = 0;
this.focusThickness = 2;
this.verticalGap = 6;
this.disabledColor = 11187123;
this.paddingRight = 0;
this.focusRoundedCorners = "tl tr bl br";
this.borderSides = "left top right bottom";
this.disabledIconColor = 0x999999;
this.modalTransparencyBlur = 3;
this.color = 734012;
this.selectionDuration = 250;
this.highlightAlphas = [0.3, 0];
};
};
}
}
}//package
Section 302
//_headerDateTextStyle (_headerDateTextStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _headerDateTextStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".headerDateText");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".headerDateText", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.fontWeight = "bold";
this.textAlign = "center";
};
};
}
}
}//package
Section 303
//_headerDragProxyStyleStyle (_headerDragProxyStyleStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _headerDragProxyStyleStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".headerDragProxyStyle");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".headerDragProxyStyle", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.fontWeight = "bold";
};
};
}
}
}//package
Section 304
//_linkButtonStyleStyle (_linkButtonStyleStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _linkButtonStyleStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".linkButtonStyle");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".linkButtonStyle", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.paddingTop = 2;
this.paddingLeft = 2;
this.paddingBottom = 2;
this.paddingRight = 2;
};
};
}
}
}//package
Section 305
//_opaquePanelStyle (_opaquePanelStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _opaquePanelStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".opaquePanel");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".opaquePanel", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.borderColor = 0xFFFFFF;
this.backgroundColor = 0xFFFFFF;
this.headerColors = [0xE7E7E7, 0xD9D9D9];
this.footerColors = [0xE7E7E7, 0xC7C7C7];
this.borderAlpha = 1;
};
};
}
}
}//package
Section 306
//_plainStyle (_plainStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _plainStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".plain");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".plain", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.paddingTop = 0;
this.backgroundColor = 0xFFFFFF;
this.backgroundImage = "";
this.horizontalAlign = "left";
this.paddingLeft = 0;
this.paddingBottom = 0;
this.paddingRight = 0;
};
};
}
}
}//package
Section 307
//_popUpMenuStyle (_popUpMenuStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _popUpMenuStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".popUpMenu");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".popUpMenu", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.fontWeight = "normal";
this.textAlign = "left";
};
};
}
}
}//package
Section 308
//_richTextEditorTextAreaStyleStyle (_richTextEditorTextAreaStyleStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _richTextEditorTextAreaStyleStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".richTextEditorTextAreaStyle");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".richTextEditorTextAreaStyle", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
};
};
}
}
}//package
Section 309
//_swatchPanelTextFieldStyle (_swatchPanelTextFieldStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _swatchPanelTextFieldStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".swatchPanelTextField");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".swatchPanelTextField", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.borderStyle = "inset";
this.borderColor = 14015965;
this.highlightColor = 12897484;
this.backgroundColor = 0xFFFFFF;
this.shadowCapColor = 14015965;
this.shadowColor = 14015965;
this.paddingLeft = 5;
this.buttonColor = 7305079;
this.borderCapColor = 9542041;
this.paddingRight = 5;
};
};
}
}
}//package
Section 310
//_textAreaHScrollBarStyleStyle (_textAreaHScrollBarStyleStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _textAreaHScrollBarStyleStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".textAreaHScrollBarStyle");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".textAreaHScrollBarStyle", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
};
};
}
}
}//package
Section 311
//_textAreaVScrollBarStyleStyle (_textAreaVScrollBarStyleStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _textAreaVScrollBarStyleStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".textAreaVScrollBarStyle");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".textAreaVScrollBarStyle", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
};
};
}
}
}//package
Section 312
//_todayStyleStyle (_todayStyleStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _todayStyleStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".todayStyle");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".todayStyle", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.color = 0xFFFFFF;
this.textAlign = "center";
};
};
}
}
}//package
Section 313
//_ToolTipStyle (_ToolTipStyle)
package {
import mx.core.*;
import mx.styles.*;
import mx.skins.halo.*;
public class _ToolTipStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration("ToolTip");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration("ToolTip", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.borderStyle = "toolTip";
this.paddingTop = 2;
this.borderColor = 9542041;
this.backgroundColor = 16777164;
this.borderSkin = ToolTipBorder;
this.cornerRadius = 2;
this.fontSize = 9;
this.shadowColor = 0;
this.paddingLeft = 4;
this.paddingBottom = 2;
this.backgroundAlpha = 0.95;
this.paddingRight = 4;
};
};
}
}
}//package
Section 314
//_weekDayStyleStyle (_weekDayStyleStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _weekDayStyleStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".weekDayStyle");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".weekDayStyle", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.fontWeight = "bold";
this.textAlign = "center";
};
};
}
}
}//package
Section 315
//_windowStatusStyle (_windowStatusStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _windowStatusStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".windowStatus");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".windowStatus", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.color = 0x666666;
};
};
}
}
}//package
Section 316
//_windowStylesStyle (_windowStylesStyle)
package {
import mx.core.*;
import mx.styles.*;
public class _windowStylesStyle {
public static function init(_arg1:IFlexModuleFactory):void{
var fbs = _arg1;
var style:CSSStyleDeclaration = StyleManager.getStyleDeclaration(".windowStyles");
if (!style){
style = new CSSStyleDeclaration();
StyleManager.setStyleDeclaration(".windowStyles", style, false);
};
if (style.defaultFactory == null){
style.defaultFactory = function ():void{
this.fontWeight = "bold";
};
};
}
}
}//package
Section 317
//ai_thinking (ai_thinking)
package {
import flash.display.*;
public dynamic class ai_thinking extends BitmapData {
public function ai_thinking(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 318
//AILoopWAV (AILoopWAV)
package {
import flash.media.*;
public dynamic class AILoopWAV extends Sound {
}
}//package
Section 319
//aircontrol (aircontrol)
package {
import flash.display.*;
public dynamic class aircontrol extends BitmapData {
public function aircontrol(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 320
//aircontrol_mask (aircontrol_mask)
package {
import flash.display.*;
public dynamic class aircontrol_mask extends BitmapData {
public function aircontrol_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 321
//AircraftMove (AircraftMove)
package {
import flash.media.*;
public dynamic class AircraftMove extends Sound {
}
}//package
Section 322
//albatross (albatross)
package {
import flash.display.*;
public dynamic class albatross extends BitmapData {
public function albatross(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 323
//albatross_mask (albatross_mask)
package {
import flash.display.*;
public dynamic class albatross_mask extends BitmapData {
public function albatross_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 324
//annihilator (annihilator)
package {
import flash.display.*;
public dynamic class annihilator extends BitmapData {
public function annihilator(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 325
//annihilator_mask (annihilator_mask)
package {
import flash.display.*;
public dynamic class annihilator_mask extends BitmapData {
public function annihilator_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 326
//archipelago_v1 (archipelago_v1)
package {
import flash.display.*;
public dynamic class archipelago_v1 extends BitmapData {
public function archipelago_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 327
//archipelago_v2 (archipelago_v2)
package {
import flash.display.*;
public dynamic class archipelago_v2 extends BitmapData {
public function archipelago_v2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 328
//archipelago_v3 (archipelago_v3)
package {
import flash.display.*;
public dynamic class archipelago_v3 extends BitmapData {
public function archipelago_v3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 329
//archipelago_v4 (archipelago_v4)
package {
import flash.display.*;
public dynamic class archipelago_v4 extends BitmapData {
public function archipelago_v4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 330
//attackTargets (attackTargets)
package {
import flash.display.*;
public dynamic class attackTargets extends BitmapData {
public function attackTargets(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 331
//avatars (avatars)
package {
import flash.display.*;
public dynamic class avatars extends BitmapData {
public function avatars(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 332
//avatarsSmall (avatarsSmall)
package {
import flash.display.*;
public dynamic class avatarsSmall extends BitmapData {
public function avatarsSmall(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 333
//battlecruiser (battlecruiser)
package {
import flash.display.*;
public dynamic class battlecruiser extends BitmapData {
public function battlecruiser(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 334
//battlecruiser_mask (battlecruiser_mask)
package {
import flash.display.*;
public dynamic class battlecruiser_mask extends BitmapData {
public function battlecruiser_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 335
//BlimpMove (BlimpMove)
package {
import flash.media.*;
public dynamic class BlimpMove extends Sound {
}
}//package
Section 336
//BoatMove (BoatMove)
package {
import flash.media.*;
public dynamic class BoatMove extends Sound {
}
}//package
Section 337
//bonusMapButton (bonusMapButton)
package {
import flash.display.*;
public dynamic class bonusMapButton extends BitmapData {
public function bonusMapButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 338
//bootCampButton (bootCampButton)
package {
import flash.display.*;
public dynamic class bootCampButton extends BitmapData {
public function bootCampButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 339
//border_bottom (border_bottom)
package {
import flash.display.*;
public dynamic class border_bottom extends BitmapData {
public function border_bottom(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 340
//border_left (border_left)
package {
import flash.display.*;
public dynamic class border_left extends BitmapData {
public function border_left(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 341
//border_right (border_right)
package {
import flash.display.*;
public dynamic class border_right extends BitmapData {
public function border_right(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 342
//border_top (border_top)
package {
import flash.display.*;
public dynamic class border_top extends BitmapData {
public function border_top(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 343
//bridge_1_v1 (bridge_1_v1)
package {
import flash.display.*;
public dynamic class bridge_1_v1 extends BitmapData {
public function bridge_1_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 344
//bridge_2_v1 (bridge_2_v1)
package {
import flash.display.*;
public dynamic class bridge_2_v1 extends BitmapData {
public function bridge_2_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 345
//bridge_3_v1 (bridge_3_v1)
package {
import flash.display.*;
public dynamic class bridge_3_v1 extends BitmapData {
public function bridge_3_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 346
//bridge_4_v1 (bridge_4_v1)
package {
import flash.display.*;
public dynamic class bridge_4_v1 extends BitmapData {
public function bridge_4_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 347
//bridge_5_v1 (bridge_5_v1)
package {
import flash.display.*;
public dynamic class bridge_5_v1 extends BitmapData {
public function bridge_5_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 348
//bridge_6_v1 (bridge_6_v1)
package {
import flash.display.*;
public dynamic class bridge_6_v1 extends BitmapData {
public function bridge_6_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 349
//bridge_7_v1 (bridge_7_v1)
package {
import flash.display.*;
public dynamic class bridge_7_v1 extends BitmapData {
public function bridge_7_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 350
//bridge_8_v1 (bridge_8_v1)
package {
import flash.display.*;
public dynamic class bridge_8_v1 extends BitmapData {
public function bridge_8_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 351
//bridge_canyon3_v1 (bridge_canyon3_v1)
package {
import flash.display.*;
public dynamic class bridge_canyon3_v1 extends BitmapData {
public function bridge_canyon3_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 352
//bridge_canyon7_v1 (bridge_canyon7_v1)
package {
import flash.display.*;
public dynamic class bridge_canyon7_v1 extends BitmapData {
public function bridge_canyon7_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 353
//build_header_air (build_header_air)
package {
import flash.display.*;
public dynamic class build_header_air extends BitmapData {
public function build_header_air(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 354
//build_header_ground (build_header_ground)
package {
import flash.display.*;
public dynamic class build_header_ground extends BitmapData {
public function build_header_ground(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 355
//build_header_sea (build_header_sea)
package {
import flash.display.*;
public dynamic class build_header_sea extends BitmapData {
public function build_header_sea(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 356
//build_icon_air (build_icon_air)
package {
import flash.display.*;
public dynamic class build_icon_air extends BitmapData {
public function build_icon_air(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 357
//build_icon_ground (build_icon_ground)
package {
import flash.display.*;
public dynamic class build_icon_ground extends BitmapData {
public function build_icon_ground(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 358
//build_icon_sea (build_icon_sea)
package {
import flash.display.*;
public dynamic class build_icon_sea extends BitmapData {
public function build_icon_sea(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 359
//build_text_air (build_text_air)
package {
import flash.display.*;
public dynamic class build_text_air extends BitmapData {
public function build_text_air(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 360
//build_text_ground (build_text_ground)
package {
import flash.display.*;
public dynamic class build_text_ground extends BitmapData {
public function build_text_ground(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 361
//build_text_sea (build_text_sea)
package {
import flash.display.*;
public dynamic class build_text_sea extends BitmapData {
public function build_text_sea(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 362
//build_unit_box (build_unit_box)
package {
import flash.display.*;
public dynamic class build_unit_box extends BitmapData {
public function build_unit_box(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 363
//build_unit_box_bg (build_unit_box_bg)
package {
import flash.display.*;
public dynamic class build_unit_box_bg extends BitmapData {
public function build_unit_box_bg(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 364
//button (button)
package {
import flash.display.*;
public dynamic class button extends BitmapData {
public function button(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 365
//button_finish (button_finish)
package {
import flash.display.*;
public dynamic class button_finish extends BitmapData {
public function button_finish(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 366
//button_levelselect (button_levelselect)
package {
import flash.display.*;
public dynamic class button_levelselect extends BitmapData {
public function button_levelselect(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 367
//button_startgame (button_startgame)
package {
import flash.display.*;
public dynamic class button_startgame extends BitmapData {
public function button_startgame(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 368
//buttonDown (buttonDown)
package {
import flash.display.*;
public dynamic class buttonDown extends BitmapData {
public function buttonDown(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 369
//buttonUp (buttonUp)
package {
import flash.display.*;
public dynamic class buttonUp extends BitmapData {
public function buttonUp(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 370
//campaign_bg_icons (campaign_bg_icons)
package {
import flash.display.*;
public dynamic class campaign_bg_icons extends BitmapData {
public function campaign_bg_icons(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 371
//campaign_header_jungle (campaign_header_jungle)
package {
import flash.display.*;
public dynamic class campaign_header_jungle extends BitmapData {
public function campaign_header_jungle(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 372
//campaign_icon_money (campaign_icon_money)
package {
import flash.display.*;
public dynamic class campaign_icon_money extends BitmapData {
public function campaign_icon_money(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 373
//campaign_shield_AE (campaign_shield_AE)
package {
import flash.display.*;
public dynamic class campaign_shield_AE extends BitmapData {
public function campaign_shield_AE(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 374
//campaign_shield_Dragoons (campaign_shield_Dragoons)
package {
import flash.display.*;
public dynamic class campaign_shield_Dragoons extends BitmapData {
public function campaign_shield_Dragoons(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 375
//campaign_shield_NF (campaign_shield_NF)
package {
import flash.display.*;
public dynamic class campaign_shield_NF extends BitmapData {
public function campaign_shield_NF(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 376
//campaign_tokens_holder (campaign_tokens_holder)
package {
import flash.display.*;
public dynamic class campaign_tokens_holder extends BitmapData {
public function campaign_tokens_holder(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 377
//campaign_victory (campaign_victory)
package {
import flash.display.*;
public dynamic class campaign_victory extends BitmapData {
public function campaign_victory(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 378
//campaignButton (campaignButton)
package {
import flash.display.*;
public dynamic class campaignButton extends BitmapData {
public function campaignButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 379
//canyon_0_v1 (canyon_0_v1)
package {
import flash.display.*;
public dynamic class canyon_0_v1 extends BitmapData {
public function canyon_0_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 380
//canyon_1_v1 (canyon_1_v1)
package {
import flash.display.*;
public dynamic class canyon_1_v1 extends BitmapData {
public function canyon_1_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 381
//canyon_10_v1 (canyon_10_v1)
package {
import flash.display.*;
public dynamic class canyon_10_v1 extends BitmapData {
public function canyon_10_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 382
//canyon_11_v1 (canyon_11_v1)
package {
import flash.display.*;
public dynamic class canyon_11_v1 extends BitmapData {
public function canyon_11_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 383
//canyon_12_v1 (canyon_12_v1)
package {
import flash.display.*;
public dynamic class canyon_12_v1 extends BitmapData {
public function canyon_12_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 384
//canyon_13_v1 (canyon_13_v1)
package {
import flash.display.*;
public dynamic class canyon_13_v1 extends BitmapData {
public function canyon_13_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 385
//canyon_14_v1 (canyon_14_v1)
package {
import flash.display.*;
public dynamic class canyon_14_v1 extends BitmapData {
public function canyon_14_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 386
//canyon_15_v1 (canyon_15_v1)
package {
import flash.display.*;
public dynamic class canyon_15_v1 extends BitmapData {
public function canyon_15_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 387
//canyon_16_v1 (canyon_16_v1)
package {
import flash.display.*;
public dynamic class canyon_16_v1 extends BitmapData {
public function canyon_16_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 388
//canyon_17_v1 (canyon_17_v1)
package {
import flash.display.*;
public dynamic class canyon_17_v1 extends BitmapData {
public function canyon_17_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 389
//canyon_18_v1 (canyon_18_v1)
package {
import flash.display.*;
public dynamic class canyon_18_v1 extends BitmapData {
public function canyon_18_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 390
//canyon_19_v1 (canyon_19_v1)
package {
import flash.display.*;
public dynamic class canyon_19_v1 extends BitmapData {
public function canyon_19_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 391
//canyon_2_v1 (canyon_2_v1)
package {
import flash.display.*;
public dynamic class canyon_2_v1 extends BitmapData {
public function canyon_2_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 392
//canyon_20_v1 (canyon_20_v1)
package {
import flash.display.*;
public dynamic class canyon_20_v1 extends BitmapData {
public function canyon_20_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 393
//canyon_21_v1 (canyon_21_v1)
package {
import flash.display.*;
public dynamic class canyon_21_v1 extends BitmapData {
public function canyon_21_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 394
//canyon_22_v1 (canyon_22_v1)
package {
import flash.display.*;
public dynamic class canyon_22_v1 extends BitmapData {
public function canyon_22_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 395
//canyon_23_v1 (canyon_23_v1)
package {
import flash.display.*;
public dynamic class canyon_23_v1 extends BitmapData {
public function canyon_23_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 396
//canyon_24_v1 (canyon_24_v1)
package {
import flash.display.*;
public dynamic class canyon_24_v1 extends BitmapData {
public function canyon_24_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 397
//canyon_25_v1 (canyon_25_v1)
package {
import flash.display.*;
public dynamic class canyon_25_v1 extends BitmapData {
public function canyon_25_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 398
//canyon_26_v1 (canyon_26_v1)
package {
import flash.display.*;
public dynamic class canyon_26_v1 extends BitmapData {
public function canyon_26_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 399
//canyon_27_v1 (canyon_27_v1)
package {
import flash.display.*;
public dynamic class canyon_27_v1 extends BitmapData {
public function canyon_27_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 400
//canyon_28_v1 (canyon_28_v1)
package {
import flash.display.*;
public dynamic class canyon_28_v1 extends BitmapData {
public function canyon_28_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 401
//canyon_29_v1 (canyon_29_v1)
package {
import flash.display.*;
public dynamic class canyon_29_v1 extends BitmapData {
public function canyon_29_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 402
//canyon_3_v1 (canyon_3_v1)
package {
import flash.display.*;
public dynamic class canyon_3_v1 extends BitmapData {
public function canyon_3_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 403
//canyon_30_v1 (canyon_30_v1)
package {
import flash.display.*;
public dynamic class canyon_30_v1 extends BitmapData {
public function canyon_30_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 404
//canyon_31_v1 (canyon_31_v1)
package {
import flash.display.*;
public dynamic class canyon_31_v1 extends BitmapData {
public function canyon_31_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 405
//canyon_32_v1 (canyon_32_v1)
package {
import flash.display.*;
public dynamic class canyon_32_v1 extends BitmapData {
public function canyon_32_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 406
//canyon_4_v1 (canyon_4_v1)
package {
import flash.display.*;
public dynamic class canyon_4_v1 extends BitmapData {
public function canyon_4_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 407
//canyon_5_v1 (canyon_5_v1)
package {
import flash.display.*;
public dynamic class canyon_5_v1 extends BitmapData {
public function canyon_5_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 408
//canyon_6_v1 (canyon_6_v1)
package {
import flash.display.*;
public dynamic class canyon_6_v1 extends BitmapData {
public function canyon_6_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 409
//canyon_7_v1 (canyon_7_v1)
package {
import flash.display.*;
public dynamic class canyon_7_v1 extends BitmapData {
public function canyon_7_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 410
//canyon_8_v1 (canyon_8_v1)
package {
import flash.display.*;
public dynamic class canyon_8_v1 extends BitmapData {
public function canyon_8_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 411
//canyon_9_v1 (canyon_9_v1)
package {
import flash.display.*;
public dynamic class canyon_9_v1 extends BitmapData {
public function canyon_9_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 412
//canyon_v1 (canyon_v1)
package {
import flash.display.*;
public dynamic class canyon_v1 extends BitmapData {
public function canyon_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 413
//capital (capital)
package {
import flash.display.*;
public dynamic class capital extends BitmapData {
public function capital(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 414
//capital_mask (capital_mask)
package {
import flash.display.*;
public dynamic class capital_mask extends BitmapData {
public function capital_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 415
//Capture (Capture)
package {
import flash.media.*;
public dynamic class Capture extends Sound {
}
}//package
Section 416
//chunks (chunks)
package {
import flash.display.*;
public dynamic class chunks extends BitmapData {
public function chunks(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 417
//clearDataButton (clearDataButton)
package {
import flash.display.*;
public dynamic class clearDataButton extends BitmapData {
public function clearDataButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 418
//clearDataLabel (clearDataLabel)
package {
import flash.display.*;
public dynamic class clearDataLabel extends BitmapData {
public function clearDataLabel(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 419
//Cloak (Cloak)
package {
import flash.media.*;
public dynamic class Cloak extends Sound {
}
}//package
Section 420
//closeButton (closeButton)
package {
import flash.display.*;
public dynamic class closeButton extends BitmapData {
public function closeButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 421
//colorBar (colorBar)
package {
import flash.display.*;
public dynamic class colorBar extends BitmapData {
public function colorBar(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 422
//colorBarLong (colorBarLong)
package {
import flash.display.*;
public dynamic class colorBarLong extends BitmapData {
public function colorBarLong(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 423
//commando (commando)
package {
import flash.display.*;
public dynamic class commando extends BitmapData {
public function commando(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 424
//commando_mask (commando_mask)
package {
import flash.display.*;
public dynamic class commando_mask extends BitmapData {
public function commando_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 425
//CommandoMove1 (CommandoMove1)
package {
import flash.media.*;
public dynamic class CommandoMove1 extends Sound {
}
}//package
Section 426
//CommandoMove2 (CommandoMove2)
package {
import flash.media.*;
public dynamic class CommandoMove2 extends Sound {
}
}//package
Section 427
//CommandoMove3 (CommandoMove3)
package {
import flash.media.*;
public dynamic class CommandoMove3 extends Sound {
}
}//package
Section 428
//condor (condor)
package {
import flash.display.*;
public dynamic class condor extends BitmapData {
public function condor(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 429
//condor_mask (condor_mask)
package {
import flash.display.*;
public dynamic class condor_mask extends BitmapData {
public function condor_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 430
//continueButton (continueButton)
package {
import flash.display.*;
public dynamic class continueButton extends BitmapData {
public function continueButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 431
//corvette (corvette)
package {
import flash.display.*;
public dynamic class corvette extends BitmapData {
public function corvette(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 432
//corvette_mask (corvette_mask)
package {
import flash.display.*;
public dynamic class corvette_mask extends BitmapData {
public function corvette_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 433
//creditsButton (creditsButton)
package {
import flash.display.*;
public dynamic class creditsButton extends BitmapData {
public function creditsButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 434
//creditsLabel (creditsLabel)
package {
import flash.display.*;
public dynamic class creditsLabel extends BitmapData {
public function creditsLabel(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 435
//cursor (cursor)
package {
import flash.display.*;
public dynamic class cursor extends BitmapData {
public function cursor(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 436
//Decloak (Decloak)
package {
import flash.media.*;
public dynamic class Decloak extends Sound {
}
}//package
Section 437
//DefeatWAV (DefeatWAV)
package {
import flash.media.*;
public dynamic class DefeatWAV extends Sound {
}
}//package
Section 438
//desert_v1 (desert_v1)
package {
import flash.display.*;
public dynamic class desert_v1 extends BitmapData {
public function desert_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 439
//desert_v2 (desert_v2)
package {
import flash.display.*;
public dynamic class desert_v2 extends BitmapData {
public function desert_v2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 440
//desert_v3 (desert_v3)
package {
import flash.display.*;
public dynamic class desert_v3 extends BitmapData {
public function desert_v3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 441
//dialogButton (dialogButton)
package {
import flash.display.*;
public dynamic class dialogButton extends BitmapData {
public function dialogButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 442
//dialogButtonToggled (dialogButtonToggled)
package {
import flash.display.*;
public dynamic class dialogButtonToggled extends BitmapData {
public function dialogButtonToggled(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 443
//dialogLabel (dialogLabel)
package {
import flash.display.*;
public dynamic class dialogLabel extends BitmapData {
public function dialogLabel(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 444
//en_US$core_properties (en_US$core_properties)
package {
import mx.resources.*;
public class en_US$core_properties extends ResourceBundle {
public function en_US$core_properties(){
super("en_US", "core");
}
override protected function getContent():Object{
var _local1:Object = {multipleChildSets_ClassAndInstance:"Multiple sets of visual children have been specified for this component (component definition and component instance).", truncationIndicator:"...", notExecuting:"Repeater is not executing.", versionAlreadyRead:"Compatibility version has already been read.", multipleChildSets_ClassAndSubclass:"Multiple sets of visual children have been specified for this component (base component definition and derived component definition).", viewSource:"View Source", badFile:"File does not exist.", stateUndefined:"Undefined state '{0}'.", versionAlreadySet:"Compatibility version has already been set."};
return (_local1);
}
}
}//package
Section 445
//en_US$skins_properties (en_US$skins_properties)
package {
import mx.resources.*;
public class en_US$skins_properties extends ResourceBundle {
public function en_US$skins_properties(){
super("en_US", "skins");
}
override protected function getContent():Object{
var _local1:Object = {notLoaded:"Unable to load '{0}'."};
return (_local1);
}
}
}//package
Section 446
//en_US$styles_properties (en_US$styles_properties)
package {
import mx.resources.*;
public class en_US$styles_properties extends ResourceBundle {
public function en_US$styles_properties(){
super("en_US", "styles");
}
override protected function getContent():Object{
var _local1:Object = {unableToLoad:"Unable to load style({0}): {1}."};
return (_local1);
}
}
}//package
Section 447
//endturnbutton (endturnbutton)
package {
import flash.display.*;
public dynamic class endturnbutton extends BitmapData {
public function endturnbutton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 448
//error (error)
package {
import flash.display.*;
public dynamic class error extends BitmapData {
public function error(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 449
//error_mask (error_mask)
package {
import flash.display.*;
public dynamic class error_mask extends BitmapData {
public function error_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 450
//explosion (explosion)
package {
import flash.display.*;
public dynamic class explosion extends BitmapData {
public function explosion(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 451
//ExplosionSound (ExplosionSound)
package {
import flash.media.*;
public dynamic class ExplosionSound extends Sound {
}
}//package
Section 452
//factory (factory)
package {
import flash.display.*;
public dynamic class factory extends BitmapData {
public function factory(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 453
//factory_mask (factory_mask)
package {
import flash.display.*;
public dynamic class factory_mask extends BitmapData {
public function factory_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 454
//FireAnnihilatorTank (FireAnnihilatorTank)
package {
import flash.media.*;
public dynamic class FireAnnihilatorTank extends Sound {
}
}//package
Section 455
//FireBattlecruiser (FireBattlecruiser)
package {
import flash.media.*;
public dynamic class FireBattlecruiser extends Sound {
}
}//package
Section 456
//FireCondorBomber (FireCondorBomber)
package {
import flash.media.*;
public dynamic class FireCondorBomber extends Sound {
}
}//package
Section 457
//FireCorvetteFighter (FireCorvetteFighter)
package {
import flash.media.*;
public dynamic class FireCorvetteFighter extends Sound {
}
}//package
Section 458
//FireFlakTank (FireFlakTank)
package {
import flash.media.*;
public dynamic class FireFlakTank extends Sound {
}
}//package
Section 459
//FireHeavyCommando (FireHeavyCommando)
package {
import flash.media.*;
public dynamic class FireHeavyCommando extends Sound {
}
}//package
Section 460
//FireHunterSupport (FireHunterSupport)
package {
import flash.media.*;
public dynamic class FireHunterSupport extends Sound {
}
}//package
Section 461
//FireIntrepid (FireIntrepid)
package {
import flash.media.*;
public dynamic class FireIntrepid extends Sound {
}
}//package
Section 462
//FireMortarTruck (FireMortarTruck)
package {
import flash.media.*;
public dynamic class FireMortarTruck extends Sound {
}
}//package
Section 463
//FireRaptorFighter (FireRaptorFighter)
package {
import flash.media.*;
public dynamic class FireRaptorFighter extends Sound {
}
}//package
Section 464
//FireRocketTruck (FireRocketTruck)
package {
import flash.media.*;
public dynamic class FireRocketTruck extends Sound {
}
}//package
Section 465
//FireScorpionTank (FireScorpionTank)
package {
import flash.media.*;
public dynamic class FireScorpionTank extends Sound {
}
}//package
Section 466
//FireStealthTank (FireStealthTank)
package {
import flash.media.*;
public dynamic class FireStealthTank extends Sound {
}
}//package
Section 467
//FireStrikeCommando (FireStrikeCommando)
package {
import flash.media.*;
public dynamic class FireStrikeCommando extends Sound {
}
}//package
Section 468
//FireTurret (FireTurret)
package {
import flash.media.*;
public dynamic class FireTurret extends Sound {
}
}//package
Section 469
//FireUboat (FireUboat)
package {
import flash.media.*;
public dynamic class FireUboat extends Sound {
}
}//package
Section 470
//flag (flag)
package {
import flash.display.*;
public dynamic class flag extends BitmapData {
public function flag(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 471
//flag_mask (flag_mask)
package {
import flash.display.*;
public dynamic class flag_mask extends BitmapData {
public function flag_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 472
//flak (flak)
package {
import flash.display.*;
public dynamic class flak extends BitmapData {
public function flak(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 473
//flak_mask (flak_mask)
package {
import flash.display.*;
public dynamic class flak_mask extends BitmapData {
public function flak_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 474
//forest_v1 (forest_v1)
package {
import flash.display.*;
public dynamic class forest_v1 extends BitmapData {
public function forest_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 475
//forest_v2 (forest_v2)
package {
import flash.display.*;
public dynamic class forest_v2 extends BitmapData {
public function forest_v2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 476
//frame1 (frame1)
package {
import flash.display.*;
public dynamic class frame1 extends BitmapData {
public function frame1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 477
//frame2 (frame2)
package {
import flash.display.*;
public dynamic class frame2 extends BitmapData {
public function frame2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 478
//groundcontrol (groundcontrol)
package {
import flash.display.*;
public dynamic class groundcontrol extends BitmapData {
public function groundcontrol(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 479
//groundcontrol_mask (groundcontrol_mask)
package {
import flash.display.*;
public dynamic class groundcontrol_mask extends BitmapData {
public function groundcontrol_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 480
//hcommando (hcommando)
package {
import flash.display.*;
public dynamic class hcommando extends BitmapData {
public function hcommando(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 481
//hcommando_mask (hcommando_mask)
package {
import flash.display.*;
public dynamic class hcommando_mask extends BitmapData {
public function hcommando_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 482
//header_bootcamp (header_bootcamp)
package {
import flash.display.*;
public dynamic class header_bootcamp extends BitmapData {
public function header_bootcamp(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 483
//header_campaign_1 (header_campaign_1)
package {
import flash.display.*;
public dynamic class header_campaign_1 extends BitmapData {
public function header_campaign_1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 484
//header_campaign_10 (header_campaign_10)
package {
import flash.display.*;
public dynamic class header_campaign_10 extends BitmapData {
public function header_campaign_10(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 485
//header_campaign_2 (header_campaign_2)
package {
import flash.display.*;
public dynamic class header_campaign_2 extends BitmapData {
public function header_campaign_2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 486
//header_campaign_3 (header_campaign_3)
package {
import flash.display.*;
public dynamic class header_campaign_3 extends BitmapData {
public function header_campaign_3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 487
//header_campaign_4 (header_campaign_4)
package {
import flash.display.*;
public dynamic class header_campaign_4 extends BitmapData {
public function header_campaign_4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 488
//header_campaign_5 (header_campaign_5)
package {
import flash.display.*;
public dynamic class header_campaign_5 extends BitmapData {
public function header_campaign_5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 489
//header_campaign_6 (header_campaign_6)
package {
import flash.display.*;
public dynamic class header_campaign_6 extends BitmapData {
public function header_campaign_6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 490
//header_campaign_7 (header_campaign_7)
package {
import flash.display.*;
public dynamic class header_campaign_7 extends BitmapData {
public function header_campaign_7(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 491
//header_campaign_8 (header_campaign_8)
package {
import flash.display.*;
public dynamic class header_campaign_8 extends BitmapData {
public function header_campaign_8(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 492
//header_campaign_9 (header_campaign_9)
package {
import flash.display.*;
public dynamic class header_campaign_9 extends BitmapData {
public function header_campaign_9(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 493
//high_bridge_1_v1 (high_bridge_1_v1)
package {
import flash.display.*;
public dynamic class high_bridge_1_v1 extends BitmapData {
public function high_bridge_1_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 494
//high_bridge_2_v1 (high_bridge_2_v1)
package {
import flash.display.*;
public dynamic class high_bridge_2_v1 extends BitmapData {
public function high_bridge_2_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 495
//high_bridge_3_v1 (high_bridge_3_v1)
package {
import flash.display.*;
public dynamic class high_bridge_3_v1 extends BitmapData {
public function high_bridge_3_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 496
//high_bridge_4_v1 (high_bridge_4_v1)
package {
import flash.display.*;
public dynamic class high_bridge_4_v1 extends BitmapData {
public function high_bridge_4_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 497
//high_bridge_5_v1 (high_bridge_5_v1)
package {
import flash.display.*;
public dynamic class high_bridge_5_v1 extends BitmapData {
public function high_bridge_5_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 498
//high_bridge_6_v1 (high_bridge_6_v1)
package {
import flash.display.*;
public dynamic class high_bridge_6_v1 extends BitmapData {
public function high_bridge_6_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 499
//high_bridge_7_v1 (high_bridge_7_v1)
package {
import flash.display.*;
public dynamic class high_bridge_7_v1 extends BitmapData {
public function high_bridge_7_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 500
//high_bridge_8_v1 (high_bridge_8_v1)
package {
import flash.display.*;
public dynamic class high_bridge_8_v1 extends BitmapData {
public function high_bridge_8_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 501
//highlight (highlight)
package {
import flash.display.*;
public dynamic class highlight extends BitmapData {
public function highlight(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 502
//hills_v1 (hills_v1)
package {
import flash.display.*;
public dynamic class hills_v1 extends BitmapData {
public function hills_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 503
//hills_v2 (hills_v2)
package {
import flash.display.*;
public dynamic class hills_v2 extends BitmapData {
public function hills_v2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 504
//hills_v3 (hills_v3)
package {
import flash.display.*;
public dynamic class hills_v3 extends BitmapData {
public function hills_v3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 505
//hills_v4 (hills_v4)
package {
import flash.display.*;
public dynamic class hills_v4 extends BitmapData {
public function hills_v4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 506
//hunter (hunter)
package {
import flash.display.*;
public dynamic class hunter extends BitmapData {
public function hunter(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 507
//hunter_mask (hunter_mask)
package {
import flash.display.*;
public dynamic class hunter_mask extends BitmapData {
public function hunter_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 508
//info_icons (info_icons)
package {
import flash.display.*;
public dynamic class info_icons extends BitmapData {
public function info_icons(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 509
//info_panel (info_panel)
package {
import flash.display.*;
public dynamic class info_panel extends BitmapData {
public function info_panel(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 510
//ingame_kong_logo (ingame_kong_logo)
package {
import flash.display.*;
public dynamic class ingame_kong_logo extends BitmapData {
public function ingame_kong_logo(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 511
//intrepid (intrepid)
package {
import flash.display.*;
public dynamic class intrepid extends BitmapData {
public function intrepid(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 512
//intrepid_mask (intrepid_mask)
package {
import flash.display.*;
public dynamic class intrepid_mask extends BitmapData {
public function intrepid_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 513
//leviathan (leviathan)
package {
import flash.display.*;
public dynamic class leviathan extends BitmapData {
public function leviathan(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 514
//leviathan_mask (leviathan_mask)
package {
import flash.display.*;
public dynamic class leviathan_mask extends BitmapData {
public function leviathan_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 515
//mainframe (mainframe)
package {
import flash.display.*;
public dynamic class mainframe extends BitmapData {
public function mainframe(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 516
//mainmenu_kong_logo (mainmenu_kong_logo)
package {
import flash.display.*;
public dynamic class mainmenu_kong_logo extends BitmapData {
public function mainmenu_kong_logo(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 517
//marker (marker)
package {
import flash.display.*;
public dynamic class marker extends BitmapData {
public function marker(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 518
//marker2 (marker2)
package {
import flash.display.*;
public dynamic class marker2 extends BitmapData {
public function marker2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 519
//menubutton (menubutton)
package {
import flash.display.*;
public dynamic class menubutton extends BitmapData {
public function menubutton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 520
//minimap_bridge (minimap_bridge)
package {
import flash.display.*;
public dynamic class minimap_bridge extends BitmapData {
public function minimap_bridge(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 521
//minimap_desert (minimap_desert)
package {
import flash.display.*;
public dynamic class minimap_desert extends BitmapData {
public function minimap_desert(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 522
//minimap_forest (minimap_forest)
package {
import flash.display.*;
public dynamic class minimap_forest extends BitmapData {
public function minimap_forest(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 523
//minimap_mountain (minimap_mountain)
package {
import flash.display.*;
public dynamic class minimap_mountain extends BitmapData {
public function minimap_mountain(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 524
//minimap_overlay (minimap_overlay)
package {
import flash.display.*;
public dynamic class minimap_overlay extends BitmapData {
public function minimap_overlay(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 525
//minimap_overlay_mask (minimap_overlay_mask)
package {
import flash.display.*;
public dynamic class minimap_overlay_mask extends BitmapData {
public function minimap_overlay_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 526
//minimap_plains (minimap_plains)
package {
import flash.display.*;
public dynamic class minimap_plains extends BitmapData {
public function minimap_plains(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 527
//minimap_reef (minimap_reef)
package {
import flash.display.*;
public dynamic class minimap_reef extends BitmapData {
public function minimap_reef(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 528
//minimap_road (minimap_road)
package {
import flash.display.*;
public dynamic class minimap_road extends BitmapData {
public function minimap_road(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 529
//minimap_sea (minimap_sea)
package {
import flash.display.*;
public dynamic class minimap_sea extends BitmapData {
public function minimap_sea(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 530
//minimap_shore (minimap_shore)
package {
import flash.display.*;
public dynamic class minimap_shore extends BitmapData {
public function minimap_shore(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 531
//minimapembelishment (minimapembelishment)
package {
import flash.display.*;
public dynamic class minimapembelishment extends BitmapData {
public function minimapembelishment(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 532
//moneyBar (moneyBar)
package {
import flash.display.*;
public dynamic class moneyBar extends BitmapData {
public function moneyBar(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 533
//mortar (mortar)
package {
import flash.display.*;
public dynamic class mortar extends BitmapData {
public function mortar(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 534
//mortar_mask (mortar_mask)
package {
import flash.display.*;
public dynamic class mortar_mask extends BitmapData {
public function mortar_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 535
//mountains_v1 (mountains_v1)
package {
import flash.display.*;
public dynamic class mountains_v1 extends BitmapData {
public function mountains_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 536
//mountains_v2 (mountains_v2)
package {
import flash.display.*;
public dynamic class mountains_v2 extends BitmapData {
public function mountains_v2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 537
//mountains_v3 (mountains_v3)
package {
import flash.display.*;
public dynamic class mountains_v3 extends BitmapData {
public function mountains_v3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 538
//mountains_v4 (mountains_v4)
package {
import flash.display.*;
public dynamic class mountains_v4 extends BitmapData {
public function mountains_v4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 539
//movement_end (movement_end)
package {
import flash.display.*;
public dynamic class movement_end extends BitmapData {
public function movement_end(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 540
//movement_nomove (movement_nomove)
package {
import flash.display.*;
public dynamic class movement_nomove extends BitmapData {
public function movement_nomove(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 541
//movement_start (movement_start)
package {
import flash.display.*;
public dynamic class movement_start extends BitmapData {
public function movement_start(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 542
//movement_straight (movement_straight)
package {
import flash.display.*;
public dynamic class movement_straight extends BitmapData {
public function movement_straight(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 543
//movement_turn (movement_turn)
package {
import flash.display.*;
public dynamic class movement_turn extends BitmapData {
public function movement_turn(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 544
//movement_unmoveable (movement_unmoveable)
package {
import flash.display.*;
public dynamic class movement_unmoveable extends BitmapData {
public function movement_unmoveable(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 545
//musicButton (musicButton)
package {
import flash.display.*;
public dynamic class musicButton extends BitmapData {
public function musicButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 546
//musicButtonToggled (musicButtonToggled)
package {
import flash.display.*;
public dynamic class musicButtonToggled extends BitmapData {
public function musicButtonToggled(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 547
//MusicLabel (MusicLabel)
package {
import flash.display.*;
public dynamic class MusicLabel extends BitmapData {
public function MusicLabel(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 548
//nextUnitButton (nextUnitButton)
package {
import flash.display.*;
public dynamic class nextUnitButton extends BitmapData {
public function nextUnitButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 549
//noButton (noButton)
package {
import flash.display.*;
public dynamic class noButton extends BitmapData {
public function noButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 550
//oiladvanced (oiladvanced)
package {
import flash.display.*;
public dynamic class oiladvanced extends BitmapData {
public function oiladvanced(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 551
//oiladvanced_mask (oiladvanced_mask)
package {
import flash.display.*;
public dynamic class oiladvanced_mask extends BitmapData {
public function oiladvanced_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 552
//oilrefinery (oilrefinery)
package {
import flash.display.*;
public dynamic class oilrefinery extends BitmapData {
public function oilrefinery(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 553
//oilrefinery_mask (oilrefinery_mask)
package {
import flash.display.*;
public dynamic class oilrefinery_mask extends BitmapData {
public function oilrefinery_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 554
//oilrig (oilrig)
package {
import flash.display.*;
public dynamic class oilrig extends BitmapData {
public function oilrig(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 555
//oilrig_mask (oilrig_mask)
package {
import flash.display.*;
public dynamic class oilrig_mask extends BitmapData {
public function oilrig_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 556
//optionsButton (optionsButton)
package {
import flash.display.*;
public dynamic class optionsButton extends BitmapData {
public function optionsButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 557
//optionsMainButton (optionsMainButton)
package {
import flash.display.*;
public dynamic class optionsMainButton extends BitmapData {
public function optionsMainButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 558
//panel (panel)
package {
import flash.display.*;
public dynamic class panel extends BitmapData {
public function panel(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 559
//plains_v1 (plains_v1)
package {
import flash.display.*;
public dynamic class plains_v1 extends BitmapData {
public function plains_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 560
//plains_v2 (plains_v2)
package {
import flash.display.*;
public dynamic class plains_v2 extends BitmapData {
public function plains_v2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 561
//plains_v3 (plains_v3)
package {
import flash.display.*;
public dynamic class plains_v3 extends BitmapData {
public function plains_v3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 562
//plains_v4 (plains_v4)
package {
import flash.display.*;
public dynamic class plains_v4 extends BitmapData {
public function plains_v4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 563
//plains_v5 (plains_v5)
package {
import flash.display.*;
public dynamic class plains_v5 extends BitmapData {
public function plains_v5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 564
//plains_v6 (plains_v6)
package {
import flash.display.*;
public dynamic class plains_v6 extends BitmapData {
public function plains_v6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 565
//plains_v7 (plains_v7)
package {
import flash.display.*;
public dynamic class plains_v7 extends BitmapData {
public function plains_v7(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 566
//playerbox (playerbox)
package {
import flash.display.*;
public dynamic class playerbox extends BitmapData {
public function playerbox(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 567
//playerboxbehind (playerboxbehind)
package {
import flash.display.*;
public dynamic class playerboxbehind extends BitmapData {
public function playerboxbehind(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 568
//PlayerLoopWAV (PlayerLoopWAV)
package {
import flash.media.*;
public dynamic class PlayerLoopWAV extends Sound {
}
}//package
Section 569
//playerpointer (playerpointer)
package {
import flash.display.*;
public dynamic class playerpointer extends BitmapData {
public function playerpointer(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 570
//quitAndNoSaveButton (quitAndNoSaveButton)
package {
import flash.display.*;
public dynamic class quitAndNoSaveButton extends BitmapData {
public function quitAndNoSaveButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 571
//quitButton (quitButton)
package {
import flash.display.*;
public dynamic class quitButton extends BitmapData {
public function quitButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 572
//rankBadges (rankBadges)
package {
import flash.display.*;
public dynamic class rankBadges extends BitmapData {
public function rankBadges(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 573
//raptor (raptor)
package {
import flash.display.*;
public dynamic class raptor extends BitmapData {
public function raptor(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 574
//raptor_mask (raptor_mask)
package {
import flash.display.*;
public dynamic class raptor_mask extends BitmapData {
public function raptor_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 575
//reef_v1 (reef_v1)
package {
import flash.display.*;
public dynamic class reef_v1 extends BitmapData {
public function reef_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 576
//reef_v2 (reef_v2)
package {
import flash.display.*;
public dynamic class reef_v2 extends BitmapData {
public function reef_v2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 577
//reef_v3 (reef_v3)
package {
import flash.display.*;
public dynamic class reef_v3 extends BitmapData {
public function reef_v3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 578
//reef_v4 (reef_v4)
package {
import flash.display.*;
public dynamic class reef_v4 extends BitmapData {
public function reef_v4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 579
//repairIcon (repairIcon)
package {
import flash.display.*;
public dynamic class repairIcon extends BitmapData {
public function repairIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 580
//restartButton (restartButton)
package {
import flash.display.*;
public dynamic class restartButton extends BitmapData {
public function restartButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 581
//restoreButton (restoreButton)
package {
import flash.display.*;
public dynamic class restoreButton extends BitmapData {
public function restoreButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 582
//road_1_v1 (road_1_v1)
package {
import flash.display.*;
public dynamic class road_1_v1 extends BitmapData {
public function road_1_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 583
//road_10_v1 (road_10_v1)
package {
import flash.display.*;
public dynamic class road_10_v1 extends BitmapData {
public function road_10_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 584
//road_11_v1 (road_11_v1)
package {
import flash.display.*;
public dynamic class road_11_v1 extends BitmapData {
public function road_11_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 585
//road_12_v1 (road_12_v1)
package {
import flash.display.*;
public dynamic class road_12_v1 extends BitmapData {
public function road_12_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 586
//road_13_v1 (road_13_v1)
package {
import flash.display.*;
public dynamic class road_13_v1 extends BitmapData {
public function road_13_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 587
//road_14_v1 (road_14_v1)
package {
import flash.display.*;
public dynamic class road_14_v1 extends BitmapData {
public function road_14_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 588
//road_15_v1 (road_15_v1)
package {
import flash.display.*;
public dynamic class road_15_v1 extends BitmapData {
public function road_15_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 589
//road_2_v1 (road_2_v1)
package {
import flash.display.*;
public dynamic class road_2_v1 extends BitmapData {
public function road_2_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 590
//road_3_v1 (road_3_v1)
package {
import flash.display.*;
public dynamic class road_3_v1 extends BitmapData {
public function road_3_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 591
//road_4_v1 (road_4_v1)
package {
import flash.display.*;
public dynamic class road_4_v1 extends BitmapData {
public function road_4_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 592
//road_5_v1 (road_5_v1)
package {
import flash.display.*;
public dynamic class road_5_v1 extends BitmapData {
public function road_5_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 593
//road_6_v1 (road_6_v1)
package {
import flash.display.*;
public dynamic class road_6_v1 extends BitmapData {
public function road_6_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 594
//road_7_v1 (road_7_v1)
package {
import flash.display.*;
public dynamic class road_7_v1 extends BitmapData {
public function road_7_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 595
//road_8_v1 (road_8_v1)
package {
import flash.display.*;
public dynamic class road_8_v1 extends BitmapData {
public function road_8_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 596
//road_9_v1 (road_9_v1)
package {
import flash.display.*;
public dynamic class road_9_v1 extends BitmapData {
public function road_9_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 597
//rock_formation_v1 (rock_formation_v1)
package {
import flash.display.*;
public dynamic class rock_formation_v1 extends BitmapData {
public function rock_formation_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 598
//rock_formation_v2 (rock_formation_v2)
package {
import flash.display.*;
public dynamic class rock_formation_v2 extends BitmapData {
public function rock_formation_v2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 599
//rock_formation_v3 (rock_formation_v3)
package {
import flash.display.*;
public dynamic class rock_formation_v3 extends BitmapData {
public function rock_formation_v3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 600
//rock_formation_v4 (rock_formation_v4)
package {
import flash.display.*;
public dynamic class rock_formation_v4 extends BitmapData {
public function rock_formation_v4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 601
//rocket (rocket)
package {
import flash.display.*;
public dynamic class rocket extends BitmapData {
public function rocket(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 602
//rocket_mask (rocket_mask)
package {
import flash.display.*;
public dynamic class rocket_mask extends BitmapData {
public function rocket_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 603
//saveButton (saveButton)
package {
import flash.display.*;
public dynamic class saveButton extends BitmapData {
public function saveButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 604
//scorpion (scorpion)
package {
import flash.display.*;
public dynamic class scorpion extends BitmapData {
public function scorpion(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 605
//scorpion_mask (scorpion_mask)
package {
import flash.display.*;
public dynamic class scorpion_mask extends BitmapData {
public function scorpion_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 606
//sea_0_v1 (sea_0_v1)
package {
import flash.display.*;
public dynamic class sea_0_v1 extends BitmapData {
public function sea_0_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 607
//sea_1_v1 (sea_1_v1)
package {
import flash.display.*;
public dynamic class sea_1_v1 extends BitmapData {
public function sea_1_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 608
//sea_10_v1 (sea_10_v1)
package {
import flash.display.*;
public dynamic class sea_10_v1 extends BitmapData {
public function sea_10_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 609
//sea_11_v1 (sea_11_v1)
package {
import flash.display.*;
public dynamic class sea_11_v1 extends BitmapData {
public function sea_11_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 610
//sea_12_v1 (sea_12_v1)
package {
import flash.display.*;
public dynamic class sea_12_v1 extends BitmapData {
public function sea_12_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 611
//sea_13_v1 (sea_13_v1)
package {
import flash.display.*;
public dynamic class sea_13_v1 extends BitmapData {
public function sea_13_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 612
//sea_14_v1 (sea_14_v1)
package {
import flash.display.*;
public dynamic class sea_14_v1 extends BitmapData {
public function sea_14_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 613
//sea_15_v1 (sea_15_v1)
package {
import flash.display.*;
public dynamic class sea_15_v1 extends BitmapData {
public function sea_15_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 614
//sea_16_v1 (sea_16_v1)
package {
import flash.display.*;
public dynamic class sea_16_v1 extends BitmapData {
public function sea_16_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 615
//sea_2_v1 (sea_2_v1)
package {
import flash.display.*;
public dynamic class sea_2_v1 extends BitmapData {
public function sea_2_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 616
//sea_3_v1 (sea_3_v1)
package {
import flash.display.*;
public dynamic class sea_3_v1 extends BitmapData {
public function sea_3_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 617
//sea_4_v1 (sea_4_v1)
package {
import flash.display.*;
public dynamic class sea_4_v1 extends BitmapData {
public function sea_4_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 618
//sea_5_v1 (sea_5_v1)
package {
import flash.display.*;
public dynamic class sea_5_v1 extends BitmapData {
public function sea_5_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 619
//sea_6_v1 (sea_6_v1)
package {
import flash.display.*;
public dynamic class sea_6_v1 extends BitmapData {
public function sea_6_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 620
//sea_7_v1 (sea_7_v1)
package {
import flash.display.*;
public dynamic class sea_7_v1 extends BitmapData {
public function sea_7_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 621
//sea_8_v1 (sea_8_v1)
package {
import flash.display.*;
public dynamic class sea_8_v1 extends BitmapData {
public function sea_8_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 622
//sea_9_v1 (sea_9_v1)
package {
import flash.display.*;
public dynamic class sea_9_v1 extends BitmapData {
public function sea_9_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 623
//sea_v1 (sea_v1)
package {
import flash.display.*;
public dynamic class sea_v1 extends BitmapData {
public function sea_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 624
//seacontrol (seacontrol)
package {
import flash.display.*;
public dynamic class seacontrol extends BitmapData {
public function seacontrol(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 625
//seacontrol_mask (seacontrol_mask)
package {
import flash.display.*;
public dynamic class seacontrol_mask extends BitmapData {
public function seacontrol_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 626
//select (select)
package {
import flash.display.*;
public dynamic class select extends BitmapData {
public function select(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 627
//selectedArrow (selectedArrow)
package {
import flash.display.*;
public dynamic class selectedArrow extends BitmapData {
public function selectedArrow(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 628
//selectMixed (selectMixed)
package {
import flash.display.*;
public dynamic class selectMixed extends BitmapData {
public function selectMixed(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 629
//selectOrange (selectOrange)
package {
import flash.display.*;
public dynamic class selectOrange extends BitmapData {
public function selectOrange(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 630
//selectRed (selectRed)
package {
import flash.display.*;
public dynamic class selectRed extends BitmapData {
public function selectRed(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 631
//ShipMove (ShipMove)
package {
import flash.media.*;
public dynamic class ShipMove extends Sound {
}
}//package
Section 632
//shore_1_v1 (shore_1_v1)
package {
import flash.display.*;
public dynamic class shore_1_v1 extends BitmapData {
public function shore_1_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 633
//shore_10_v1 (shore_10_v1)
package {
import flash.display.*;
public dynamic class shore_10_v1 extends BitmapData {
public function shore_10_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 634
//shore_11_v1 (shore_11_v1)
package {
import flash.display.*;
public dynamic class shore_11_v1 extends BitmapData {
public function shore_11_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 635
//shore_12_v1 (shore_12_v1)
package {
import flash.display.*;
public dynamic class shore_12_v1 extends BitmapData {
public function shore_12_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 636
//shore_2_v1 (shore_2_v1)
package {
import flash.display.*;
public dynamic class shore_2_v1 extends BitmapData {
public function shore_2_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 637
//shore_3_v1 (shore_3_v1)
package {
import flash.display.*;
public dynamic class shore_3_v1 extends BitmapData {
public function shore_3_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 638
//shore_4_v1 (shore_4_v1)
package {
import flash.display.*;
public dynamic class shore_4_v1 extends BitmapData {
public function shore_4_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 639
//shore_5_v1 (shore_5_v1)
package {
import flash.display.*;
public dynamic class shore_5_v1 extends BitmapData {
public function shore_5_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 640
//shore_6_v1 (shore_6_v1)
package {
import flash.display.*;
public dynamic class shore_6_v1 extends BitmapData {
public function shore_6_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 641
//shore_7_v1 (shore_7_v1)
package {
import flash.display.*;
public dynamic class shore_7_v1 extends BitmapData {
public function shore_7_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 642
//shore_8_v1 (shore_8_v1)
package {
import flash.display.*;
public dynamic class shore_8_v1 extends BitmapData {
public function shore_8_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 643
//shore_9_v1 (shore_9_v1)
package {
import flash.display.*;
public dynamic class shore_9_v1 extends BitmapData {
public function shore_9_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 644
//shore_v1 (shore_v1)
package {
import flash.display.*;
public dynamic class shore_v1 extends BitmapData {
public function shore_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 645
//small_explosion (small_explosion)
package {
import flash.display.*;
public dynamic class small_explosion extends BitmapData {
public function small_explosion(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 646
//smallIcon (smallIcon)
package {
import flash.display.*;
public dynamic class smallIcon extends BitmapData {
public function smallIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 647
//soundButton (soundButton)
package {
import flash.display.*;
public dynamic class soundButton extends BitmapData {
public function soundButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 648
//soundButtonToggled (soundButtonToggled)
package {
import flash.display.*;
public dynamic class soundButtonToggled extends BitmapData {
public function soundButtonToggled(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 649
//SoundLabel (SoundLabel)
package {
import flash.display.*;
public dynamic class SoundLabel extends BitmapData {
public function SoundLabel(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 650
//splash_kong (splash_kong)
package {
import flash.display.*;
public dynamic class splash_kong extends MovieClip {
}
}//package
Section 651
//spotted_texture (spotted_texture)
package {
import flash.display.*;
public dynamic class spotted_texture extends BitmapData {
public function spotted_texture(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 652
//stealth (stealth)
package {
import flash.display.*;
public dynamic class stealth extends BitmapData {
public function stealth(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 653
//stealth_mask (stealth_mask)
package {
import flash.display.*;
public dynamic class stealth_mask extends BitmapData {
public function stealth_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 654
//SubmarineMove (SubmarineMove)
package {
import flash.media.*;
public dynamic class SubmarineMove extends Sound {
}
}//package
Section 655
//TankMove1 (TankMove1)
package {
import flash.media.*;
public dynamic class TankMove1 extends Sound {
}
}//package
Section 656
//TankMove2 (TankMove2)
package {
import flash.media.*;
public dynamic class TankMove2 extends Sound {
}
}//package
Section 657
//TankMove3 (TankMove3)
package {
import flash.media.*;
public dynamic class TankMove3 extends Sound {
}
}//package
Section 658
//title (title)
package {
import flash.display.*;
public dynamic class title extends BitmapData {
public function title(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 659
//turret (turret)
package {
import flash.display.*;
public dynamic class turret extends BitmapData {
public function turret(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 660
//turret_mask (turret_mask)
package {
import flash.display.*;
public dynamic class turret_mask extends BitmapData {
public function turret_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 661
//uboat (uboat)
package {
import flash.display.*;
public dynamic class uboat extends BitmapData {
public function uboat(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 662
//uboat_mask (uboat_mask)
package {
import flash.display.*;
public dynamic class uboat_mask extends BitmapData {
public function uboat_mask(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 663
//UIWAV (UIWAV)
package {
import flash.media.*;
public dynamic class UIWAV extends Sound {
}
}//package
Section 664
//unitMenu (unitMenu)
package {
import flash.display.*;
public dynamic class unitMenu extends BitmapData {
public function unitMenu(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 665
//wasteland_v1 (wasteland_v1)
package {
import flash.display.*;
public dynamic class wasteland_v1 extends BitmapData {
public function wasteland_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 666
//VehicleMove (VehicleMove)
package {
import flash.media.*;
public dynamic class VehicleMove extends Sound {
}
}//package
Section 667
//VictoryWAV (VictoryWAV)
package {
import flash.media.*;
public dynamic class VictoryWAV extends Sound {
}
}//package
Section 668
//volcano_v1 (volcano_v1)
package {
import flash.display.*;
public dynamic class volcano_v1 extends BitmapData {
public function volcano_v1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 669
//wood_texture (wood_texture)
package {
import flash.display.*;
public dynamic class wood_texture extends BitmapData {
public function wood_texture(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 670
//yesButton (yesButton)
package {
import flash.display.*;
public dynamic class yesButton extends BitmapData {
public function yesButton(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package