STORY LOOP FURRY PORN GAMES C SERVICES [?] [R] RND POPULAR | Archived flashes: 229595 |
/disc/ · /res/ — /show/ · /fap/ · /gg/ · /swf/ | P0001 · P2595 · P5190 |
A Very Merry Christmas! |
This is the info page for Flash #65982 |
Section 1//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.eventsSection 2//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.servicesSection 3//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.servicesSection 4//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.servicesSection 5//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.servicesSection 6//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.servicesSection 7//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.servicesSection 8//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.servicesSection 9//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.servicesSection 10//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.servicesSection 11//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.clientSection 12//KongregateAPI (com.kongregate.as3.client.KongregateAPI) package com.kongregate.as3.client { import flash.events.*; import com.kongregate.as3.client.services.*; import flash.display.*; import com.kongregate.as3.client.events.*; import flash.utils.*; import flash.system.*; import flash.errors.*; import flash.net.*; 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.clientSection 13//ActorDefine (engine.asset.ActorDefine) package engine.asset { import flash.utils.*; import game.res.*; public class ActorDefine { public var mZOrder:int; public var mTemplate:ActorTemplate; public var mRotation:Number; public var mPosX:int; public var mPosY:int; public var mPropertyValues:Array; public var mAppearanceValues:Array; public var mScaleX:Number; public var mScaleY:Number; public function Load(_arg1:ByteArray, _arg2:DefineFile):void{ var _local8:Object; var _local9:Array; var _local3:Boolean = _arg1.readBoolean(); if (_local3){ return; }; var _local4:int = _arg1.readShort(); mTemplate = _arg2.GetActorTemplate(_local4); trace((" template: " + mTemplate.GetName())); mPosX = _arg1.readShort(); mPosY = _arg1.readShort(); mZOrder = _arg1.readShort(); mRotation = _arg1.readFloat(); mScaleX = _arg1.readFloat(); mScaleY = _arg1.readFloat(); mPropertyValues = ActorTemplate.LoadPropertyValues(_arg1, mTemplate.GetInstancePropertyDefines()); var _local5:Array = mTemplate.GetActorAppearanceDefines(); var _local6:int = _arg1.readByte(); mAppearanceValues = new Array(_local6); var _local7:int; while (_local7 < _local6) { _local8 = _local5[_local7]; switch (_local8.mTypeID){ case kDefines.AppearanceType_sprite2d: mAppearanceValues[_local7] = _arg1.readShort(); break; case kDefines.AppearanceType_background2d: mAppearanceValues[_local7] = _arg1.readShort(); break; case kDefines.AppearanceType_box2d: _local9 = new Array(4); _local9[0] = _arg1.readShort(); _local9[1] = _arg1.readShort(); _local9[2] = _arg1.readShort(); _local9[3] = _arg1.readShort(); mAppearanceValues[_local7] = _local9; break; }; _local7++; }; } } }//package engine.assetSection 14//ActorTemplate (engine.asset.ActorTemplate) package engine.asset { import flash.utils.*; import game.res.*; public class ActorTemplate { public var mInstancePropertyDefines:Array; public var mTemplateID:int; public var mInstanceActorType:int; public var mActorAppearanceDefines:Array; public var mInstanceZOrder:int; public var mName:String; public var mTemplatePropertyDefines:Array; public var mTemplatePropertyValues:Array; public function ActorTemplate(_arg1:int){ mTemplateID = _arg1; } public function GetInstancePropertyDefines():Array{ return (mInstancePropertyDefines); } public function Load(_arg1:ByteArray):void{ mName = _arg1.readUTF(); mInstanceActorType = _arg1.readShort(); mInstanceZOrder = _arg1.readShort(); trace((((((" template: " + mName) + ", actorType: ") + mInstanceActorType) + ", zOrder: ") + mInstanceZOrder)); mTemplatePropertyDefines = LoadPropertyDefines(_arg1); mTemplatePropertyValues = LoadPropertyValues(_arg1, mTemplatePropertyDefines); mInstancePropertyDefines = LoadPropertyDefines(_arg1); mActorAppearanceDefines = LoadActorAppearanceDefines(_arg1); } public function GetName():String{ return (mName); } public function GetProperty(_arg1:uint):Object{ return (mTemplatePropertyValues[_arg1]); } public function GetTemplatePropertyDefines():Array{ return (mTemplatePropertyDefines); } public function GetActorAppearanceDefines():Array{ return (mActorAppearanceDefines); } public static function LoadPropertyValues(_arg1:ByteArray, _arg2:Array):Array{ var _local6:PropertyDefine; var _local3:int = _arg1.readShort(); trace((" property count: " + _local3)); var _local4:Array = new Array(_local3); var _local5:int; for (;_local5 < _local3;_local5++) { _local6 = _arg2[_local5]; switch (_local6.mTypeID){ case kDefines.PropertyType_number: _local4[_local5] = _arg1.readInt(); break; case kDefines.PropertyType_string: _local4[_local5] = _arg1.readUTF(); break; case kDefines.PropertyType_items: _local4[_local5] = _arg1.readShort(); break; case kDefines.PropertyType_entity_ref: _local4[_local5] = _arg1.readShort(); break; case kDefines.PropertyType_boolean: _local4[_local5] = _arg1.readBoolean(); break; default: continue; }; trace((((" " + _local5) + "): ") + _local4[_local5])); }; return (_local4); } public static function LoadPropertyDefines(_arg1:ByteArray):Array{ var _local7:String; var _local8:int; var _local9:int; var _local10:String; var _local11:int; var _local2:int = _arg1.readShort(); var _local3:Array = new Array(_local2); var _local4:int = _arg1.readShort(); trace((" property define count: " + _local2)); var _local5:int; var _local6:int; while (_local6 < _local4) { _local7 = _arg1.readUTF(); _local8 = _arg1.readShort(); _local9 = 0; while (_local9 < _local8) { _local10 = _arg1.readUTF(); _local11 = _arg1.readShort(); trace((((((" group: " + _local7) + ", property: ") + _local10) + ", type: ") + _local11)); var _temp1 = _local5; _local5 = (_local5 + 1); var _local12 = _temp1; _local3[_local12] = new PropertyDefine(_local7, _local10, _local11); _local9++; }; _local6++; }; return (_local3); } public static function LoadActorAppearanceDefines(_arg1:ByteArray):Array{ var _local5:int; var _local6:Object; var _local2:int = _arg1.readByte(); trace((" appearance defines count: " + _local2)); var _local3:Array = new Array(_local2); var _local4:int; while (_local4 < _local2) { _local5 = _arg1.readShort(); _local6 = new Object(); _local6.mTypeID = _local5; switch (_local5){ case kDefines.AppearanceType_sprite2d: _local6.mFilePath = _arg1.readUTF(); _local6.mModelID = _arg1.readShort(); _local6.mAnimationID = _arg1.readShort(); break; case kDefines.AppearanceType_background2d: _local6.mFilePath = _arg1.readUTF(); _local6.mBackgroundID = _arg1.readShort(); break; case kDefines.AppearanceType_box2d: _local6.mColorValue = _arg1.readInt(); break; }; _local3[_local4] = _local6; _local4++; }; return (_local3); } } }//package engine.assetSection 15//AnimatedModule (engine.asset.AnimatedModule) package engine.asset { public class AnimatedModule { public var mModuleSequences:Array; public function AnimatedModule(_arg1:Array){ mModuleSequences = _arg1; } public function GetModuleSequence(_arg1:int):ModuleSequence{ return (mModuleSequences[_arg1]); } public function GetModuleSequencesCount():int{ return (((mModuleSequences == null)) ? 0 : mModuleSequences.length); } } }//package engine.assetSection 16//CompositedModule (engine.asset.CompositedModule) package engine.asset { import flash.display.*; public class CompositedModule extends Module { public var mModuleParts:Array; public function CompositedModule(_arg1:Array){ mModuleParts = _arg1; } override public function Render(_arg1:DisplayObjectContainer, _arg2:int, _arg3:int, _arg4:Boolean, _arg5:Boolean):void{ var _local7:ModulePart; var _local8:int; var _local9:int; if (mModuleParts == null){ return; }; var _local6:int; while (_local6 < mModuleParts.length) { _local7 = mModuleParts[_local6]; if (_local7.mModule == null){ return; }; _local8 = _arg2; _local9 = _arg3; if (_arg4){ _local8 = (_local8 - _local7.mOffsetX); } else { _local8 = (_local8 + _local7.mOffsetX); }; if (_arg5){ _local9 = (_local9 - _local7.mOffsetY); } else { _local9 = (_local9 + _local7.mOffsetY); }; _local7.mModule.Render(_arg1, _local8, _local9, !((_arg4 == _local7.mFlipX)), !((_arg5 == _local7.mFlipY))); _local6++; }; } } }//package engine.assetSection 17//DefineFile (engine.asset.DefineFile) package engine.asset { import flash.utils.*; public class DefineFile { private var mActorTemplates:Array; public var mFilePath:String; public function DefineFile(_arg1:String){ mFilePath = _arg1; } public function Load(_arg1:ByteArray):void{ var _local4:ActorTemplate; var _local2:int = _arg1.readShort(); trace(("template count: " + _local2)); mActorTemplates = new Array(_local2); var _local3:int; while (_local3 < _local2) { _local4 = new ActorTemplate(_local3); _local4.Load(_arg1); mActorTemplates[_local3] = _local4; _local3++; }; } public function GetActorTemplate(_arg1:int):ActorTemplate{ return (mActorTemplates[_arg1]); } } }//package engine.assetSection 18//LevelDefine (engine.asset.LevelDefine) package engine.asset { import flash.utils.*; import engine.*; import engine.util.*; public class LevelDefine { public var mPlayfieldHeight:int; public var mPathSearchJoints:Array; public var mDefineFile:DefineFile; public var mPathSearchZones:Array; public var mFilePath:String; public var mActorDefines:Array; public var mPlayfieldWidth:int; public var mPathSearchLinks:Array; public function LevelDefine(_arg1:String){ mFilePath = _arg1; } public function GetFieldWidth():int{ return (mPlayfieldWidth); } public function GetDefineFile():DefineFile{ return (mDefineFile); } public function GetFieldHeight():int{ return (mPlayfieldHeight); } public function Load(_arg1:ByteArray):void{ var _local6:Boolean; var _local7:ActorDefine; var _local8:int; var _local9:int; var _local10:int; var _local11:int; var _local12:int; var _local13:int; var _local14:Array; var _local15:Array; var _local16:Array; var _local2:String = _arg1.readUTF(); _local2 = Util.GetFullFilePath(_local2, mFilePath); mDefineFile = (Engine.GetDataAsset(_local2) as DefineFile); trace(((((" define file: " + mDefineFile) + " (") + _local2) + ")")); mPlayfieldWidth = _arg1.readShort(); mPlayfieldHeight = _arg1.readShort(); var _local3:int = _arg1.readShort(); trace((((((" width = " + mPlayfieldWidth) + ", height = ") + mPlayfieldHeight) + ", actor count = ") + _local3)); mActorDefines = new Array(_local3); var _local4:int; while (_local4 < _local3) { trace((" actor # " + _local4)); _local6 = _arg1.readBoolean(); if (!_local6){ } else { _local7 = new ActorDefine(); _local7.Load(_arg1, mDefineFile); mActorDefines[_local4] = _local7; }; _local4++; }; var _local5:Boolean = _arg1.readBoolean(); if (_local5){ _local8 = _arg1.readShort(); trace((" path search zones count: " + _local8)); mPathSearchZones = new Array(_local8); _local9 = 0; while (_local9 < _local8) { _local14 = new Array(4); _local14[0] = _arg1.readShort(); _local14[1] = _arg1.readShort(); _local14[2] = _arg1.readShort(); _local14[3] = _arg1.readShort(); mPathSearchZones[_local9] = _local14; _local9++; }; _local10 = _arg1.readShort(); trace((" path search joint count: " + _local10)); mPathSearchJoints = new Array(_local10); _local11 = 0; while (_local11 < _local10) { _local15 = new Array(6); _local15[0] = _arg1.readShort(); _local15[1] = _arg1.readShort(); _local15[2] = _arg1.readShort(); _local15[3] = _arg1.readShort(); _local15[4] = _arg1.readShort(); _local15[5] = _arg1.readShort(); mPathSearchJoints[_local11] = _local15; _local11++; }; _local12 = _arg1.readShort(); trace((" path search links count: " + _local12)); mPathSearchLinks = new Array(_local12); _local13 = 0; while (_local13 < _local12) { _local16 = new Array(3); _local16[0] = _arg1.readShort(); _local16[1] = _arg1.readShort(); _local16[2] = _arg1.readShort(); mPathSearchLinks[_local13] = _local16; _local13++; }; }; } } }//package engine.assetSection 19//Module (engine.asset.Module) package engine.asset { import flash.display.*; public class Module { public function Render(_arg1:DisplayObjectContainer, _arg2:int, _arg3:int, _arg4:Boolean, _arg5:Boolean):void{ } } }//package engine.assetSection 20//ModuleImage (engine.asset.ModuleImage) package engine.asset { import flash.display.*; import flash.geom.*; public class ModuleImage { public var mBitmapData:BitmapData; public function ModuleImage(_arg1:BitmapData){ mBitmapData = _arg1; } public function GetWidth():uint{ return (((mBitmapData == null)) ? 0 : mBitmapData.width); } public function GetRegionBitmapData(_arg1:Rectangle):BitmapData{ var _local2:BitmapData = new BitmapData(_arg1.width, _arg1.height); _local2.copyPixels(mBitmapData, _arg1, new Point(0, 0)); return (_local2); } public function GetHeight():uint{ return (((mBitmapData == null)) ? 0 : mBitmapData.height); } } }//package engine.assetSection 21//ModulePart (engine.asset.ModulePart) package engine.asset { public class ModulePart extends ModuleRef { public var mOffsetX:int; public var mOffsetY:int; public function ModulePart(_arg1:Module, _arg2:int, _arg3:int, _arg4:int){ super(_arg1, _arg2); mOffsetX = _arg3; mOffsetY = _arg4; } } }//package engine.assetSection 22//ModuleRef (engine.asset.ModuleRef) package engine.asset { public class ModuleRef { public var mFlipX:Boolean; public var mModule:Module; public var mFlipY:Boolean; public static const ModuleFlag_FlipX:int = 0x8000; public static const ModuleFlag_FlipY:int = 0x4000; public function ModuleRef(_arg1:Module, _arg2:int){ mModule = _arg1; mFlipX = !(((_arg2 & ModuleFlag_FlipX) == 0)); mFlipY = !(((_arg2 & ModuleFlag_FlipY) == 0)); } } }//package engine.assetSection 23//ModuleSequence (engine.asset.ModuleSequence) package engine.asset { public class ModuleSequence extends ModulePart { public var mDuration:int; public function ModuleSequence(_arg1:Module, _arg2:int, _arg3:int, _arg4:int, _arg5:int){ super(_arg1, _arg2, _arg3, _arg4); mDuration = _arg5; } } }//package engine.assetSection 24//PropertyDefine (engine.asset.PropertyDefine) package engine.asset { public class PropertyDefine { public var mTypeID:int; public var mName:String; public var mGroupName:String; public function PropertyDefine(_arg1:String, _arg2:String, _arg3:int){ mGroupName = _arg1; mName = _arg2; mTypeID = _arg3; } } }//package engine.assetSection 25//PureModule (engine.asset.PureModule) package engine.asset { import flash.display.*; import flash.geom.*; public class PureModule extends Module { private var mRegion:Rectangle; private var mModuleImage:ModuleImage; private var _BitmapData:BitmapData;// = null public function PureModule(_arg1:int, _arg2:int, _arg3:int, _arg4:int){ mRegion = new Rectangle(_arg1, _arg2, _arg3, _arg4); } override public function Render(_arg1:DisplayObjectContainer, _arg2:int, _arg3:int, _arg4:Boolean, _arg5:Boolean):void{ if (_BitmapData == null){ _BitmapData = mModuleImage.GetRegionBitmapData(mRegion); }; var _local6:Bitmap = new Bitmap(_BitmapData); _local6.x = _arg2; _local6.y = _arg3; _local6.scaleX = (_arg4) ? -1 : 1; _local6.scaleY = (_arg5) ? -1 : 1; _arg1.addChild(_local6); } public function SetModuleImage(_arg1:ModuleImage):void{ mModuleImage = _arg1; } } }//package engine.assetSection 26//Sprite2dFile (engine.asset.Sprite2dFile) package engine.asset { import flash.display.*; import flash.utils.*; import engine.*; import engine.util.*; public class Sprite2dFile { public var mPureModuleGroups:Array; public var mCompositedModuleGroups:Array; public var mTiled2dBackgrounds:Array; public var mFilePath:String; public var mAnimatedModuleGroups:Array; public var mModuleImages:Array; public var mTilePalettes:Array; public function Sprite2dFile(_arg1:String){ mFilePath = _arg1; } public function GetAnimatedModuleGroup(_arg1:uint):Array{ return (mAnimatedModuleGroups[_arg1]); } public function LoadGridModuleGroups(_arg1:ByteArray, _arg2:Boolean):Array{ var _local7:int; var _local8:int; var _local9:int; var _local10:int; var _local11:int; var _local12:Array; var _local13:int; var _local14:ModuleRef; var _local15:int; var _local16:int; var _local17:int; var _local3:int = _arg1.readShort(); var _local4:Array = new Array(_local3); var _local5:Array = new Array(_local3); if (_arg2){ _local4._tempInfo = _local5; }; trace(("grid group count: " + _local3)); var _local6:int; while (_local6 < _local3) { _local7 = _arg1.readShort(); _local8 = _arg1.readShort(); _local9 = _arg1.readShort(); _local10 = _arg1.readShort(); _local11 = (_local7 * _local8); _local12 = new Array(_local11); if (_arg2){ _local5[_local6] = new Array(_local11); }; _local13 = 0; while (_local13 < _local11) { _local14 = null; _local15 = _arg1.readShort(); _local16 = -1; if (_local15 < 0){ } else { _local16 = _arg1.readShort(); _local17 = _arg1.readShort(); _local14 = new ModuleRef(null, _local17); }; if (_arg2){ _local12[_local13] = new Tiled2dModule(_local14, _local13); _local5[_local6][_local13] = {groupID:_local15, moduleIndex:_local16}; } else { _local12[_local13] = _local14; EvalModuleRef(_local14, _local15, _local16); }; _local13++; }; _local4[_local6] = _local12; _local6++; }; return (_local4); } public function GetTiled2dBackground(_arg1:uint):Tiled2dBackground{ return (mTiled2dBackgrounds[_arg1]); } public function EvalModuleRefs(_arg1:Array):void{ var _local4:Array; var _local5:Array; var _local6:int; var _local7:Object; var _local8:Object; var _local9:Tiled2dModule; var _local10:CompositedModule; var _local11:int; var _local12:Object; var _local13:AnimatedModule; var _local14:int; var _local15:Object; var _local2:Array = _arg1._tempInfo; _arg1._tempInfo = null; if (_local2 == null){ return; }; var _local3:int; while (_local3 < _arg1.length) { _local4 = _arg1[_local3]; _local5 = _local2[_local3]; _local6 = 0; while (_local6 < _local4.length) { _local7 = _local4[_local6]; _local8 = _local5[_local6]; if ((_local7 is Tiled2dModule)){ _local9 = (_local7 as Tiled2dModule); EvalModuleRef(_local9.mModuleRef, _local8.groupID, _local8.moduleIndex); } else { if ((_local7 is CompositedModule)){ _local10 = (_local7 as CompositedModule); _local11 = 0; while (_local11 < _local10.mModuleParts.length) { _local12 = (_local8 as Array)[_local11]; EvalModuleRef(_local10.mModuleParts[_local11], _local12.groupID, _local12.moduleIndex); _local11++; }; } else { if ((_local7 is AnimatedModule)){ _local13 = (_local7 as AnimatedModule); _local14 = 0; while (_local14 < _local13.mModuleSequences.length) { _local15 = (_local8 as Array)[_local14]; EvalModuleRef(_local13.mModuleSequences[_local14], _local15.groupID, _local15.moduleIndex); _local14++; }; }; }; }; _local6++; }; _local3++; }; } public function EvalModuleRef(_arg1:ModuleRef, _arg2:int, _arg3:int):void{ var _local6:Array; if (_arg1 == null){ return; }; var _local4 = (_arg2 >> 12); var _local5 = (_arg2 & 4095); switch (_local4){ case 0: _local6 = mPureModuleGroups[_local5]; break; case 1: _local6 = mCompositedModuleGroups[_local5]; break; case 2: _local6 = mAnimatedModuleGroups[_local5]; break; case 3: _local6 = mTilePalettes[_local5]; break; }; _arg1.mModule = _local6[_arg3]; } public function Load(_arg1:ByteArray):void{ var _local4:int; var _local5:int; var _local6:int; var _local7:int; var _local8:Array; var _local9:Tiled2dBackground; mModuleImages = LoadModuleImages(_arg1, mFilePath); mPureModuleGroups = LoadPureModuleGroups(_arg1); mCompositedModuleGroups = LoadModuleGroups(_arg1, false); mAnimatedModuleGroups = LoadModuleGroups(_arg1, true); mTilePalettes = LoadGridModuleGroups(_arg1, true); var _local2:int = _arg1.readShort(); trace(("tile2d background count: " + _local2)); mTiled2dBackgrounds = new Array(_local2); var _local3:int; while (_local3 < _local2) { _local4 = _arg1.readShort(); _local5 = _arg1.readShort(); _local6 = _arg1.readShort(); _local7 = _arg1.readShort(); _local8 = LoadGridModuleGroups(_arg1, false); _local9 = new Tiled2dBackground(_local4, _local5, _local6, _local7, _local8); mTiled2dBackgrounds[_local3] = _local9; _local3++; }; EvalModuleRefs(mCompositedModuleGroups); EvalModuleRefs(mAnimatedModuleGroups); EvalModuleRefs(mTilePalettes); } public function LoadModuleGroups(_arg1:ByteArray, _arg2:Boolean):Array{ var _local8:int; var _local9:Array; var _local10:int; var _local11:int; var _local12:Array; var _local13:Array; var _local14:Array; var _local15:int; var _local16:int; var _local17:int; var _local18:ModulePart; var _local19:int; var _local20:int; var _local21:int; var _local22:int; var _local3:int = _arg1.position; var _local4:int = _arg1.readShort(); var _local5:Array = new Array(_local4); var _local6:Array = new Array(_local4); _local5._tempInfo = _local6; var _local7:int; while (_local7 < _local4) { _local8 = _arg1.readShort(); _local9 = new Array(_local8); _local6[_local7] = new Array(_local8); trace((((" " + _local7) + ") module count: ") + _local8)); _local10 = 0; while (_local10 < _local8) { _local11 = _arg1.readShort(); _local12 = new Array(_local11); _local6[_local7][_local10] = new Array(_local11); _local13 = new Array(_local11); _local14 = new Array(_local11); _local15 = 0; while (_local15 < _local11) { _local16 = _arg1.readShort(); _local17 = -1; _local18 = null; if (_local16 < 0){ } else { _local17 = _arg1.readShort(); _local19 = _arg1.readShort(); _local20 = _arg1.readShort(); _local21 = _arg1.readShort(); if (_arg2){ _local22 = _arg1.readShort(); _local18 = new ModuleSequence(null, _local19, _local20, _local21, _local22); } else { _local18 = new ModulePart(null, _local19, _local20, _local21); }; _local14[_local15] = _local17; }; _local12[_local15] = _local18; _local6[_local7][_local10][_local15] = {groupID:_local16, moduleIndex:_local17}; _local15++; }; if (_arg2){ _local9[_local10] = new AnimatedModule(_local12); } else { _local9[_local10] = new CompositedModule(_local12); }; _local9.groupIDs = _local13; _local9.moduleIDs = _local14; _local10++; }; _local5[_local7] = _local9; _local7++; }; return (_local5); } public function LoadModuleImages(_arg1:ByteArray, _arg2:String):Array{ var _local6:String; var _local3:int = _arg1.readShort(); var _local4:Array = new Array(_local3); trace(("module image count: " + _local3)); var _local5:int; while (_local5 < _local3) { _local6 = _arg1.readUTF(); _local6 = Util.GetFullFilePath(_local6, _arg2); trace((((" image " + _local5) + ": ") + _local6)); _local4[_local5] = new ModuleImage((Engine.GetDataAsset(_local6) as BitmapData)); _local5++; }; return (_local4); } public function LoadPureModuleGroups(_arg1:ByteArray):Array{ var _local5:int; var _local6:int; var _local7:Array; var _local8:int; var _local9:int; var _local10:int; var _local11:int; var _local12:int; var _local13:PureModule; var _local2:int = _arg1.readShort(); var _local3:Array = new Array(_local2); var _local4:int; while (_local4 < _local2) { _local5 = _arg1.readShort(); _local6 = _arg1.readShort(); _local7 = new Array(_local6); _local8 = 0; while (_local8 < _local6) { _local9 = _arg1.readShort(); _local10 = _arg1.readShort(); _local11 = _arg1.readShort(); _local12 = _arg1.readShort(); _local13 = new PureModule(_local9, _local10, _local11, _local12); _local13.SetModuleImage(((_local5 < 0)) ? null : mModuleImages[_local5]); _local7[_local8] = _local13; _local8++; }; _local3[_local4] = _local7; _local4++; }; return (_local3); } } }//package engine.assetSection 27//Tiled2dBackground (engine.asset.Tiled2dBackground) package engine.asset { public class Tiled2dBackground { public var mCellCols:int; public var mCellHeight:int; public var mCellWidth:int; public var mCellRows:int; public var mTiled2dLayers:Array; public function Tiled2dBackground(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:Array){ mCellRows = _arg1; mCellCols = _arg2; mCellWidth = _arg3; mCellHeight = _arg4; mTiled2dLayers = _arg5; } } }//package engine.assetSection 28//Tiled2dModule (engine.asset.Tiled2dModule) package engine.asset { import flash.display.*; public class Tiled2dModule extends Module { public var mModuleRef:ModuleRef; public var mIndex:uint; public function Tiled2dModule(_arg1:ModuleRef, _arg2:uint){ mModuleRef = _arg1; mIndex = _arg2; } override public function Render(_arg1:DisplayObjectContainer, _arg2:int, _arg3:int, _arg4:Boolean, _arg5:Boolean):void{ } } }//package engine.assetSection 29//GameDisplayObject (engine.display.GameDisplayObject) package engine.display { import flash.display.*; public class GameDisplayObject extends Sprite { private var _z:Number; public function get z():Number{ return (_z); } public function set z(_arg1:Number):void{ _z = _arg1; } } }//package engine.displaySection 30//Sprite2dModelInstance (engine.display.Sprite2dModelInstance) package engine.display { import flash.display.*; import engine.asset.*; public class Sprite2dModelInstance extends Sprite { private var mAnimatedModule:AnimatedModule; private var mLoopPlaying:Boolean; private var mSequenceTick:int; private var mLoopCycles:uint; private var mSprite2dFile:Sprite2dFile; private var mAnimatedModuleGroup:Array; private var mSequenceID:int; private var mAnimationID:int; private var mIgnoreSequenceOffset:Boolean; public function Sprite2dModelInstance(_arg1:Sprite2dFile, _arg2:uint){ mSprite2dFile = _arg1; mAnimatedModuleGroup = _arg1.GetAnimatedModuleGroup(_arg2); } public function SetIgnoreSequenceOffset(_arg1:Boolean):void{ mIgnoreSequenceOffset = _arg1; } public function GetAnimationID():int{ return (mAnimationID); } public function SetLoopPlaying(_arg1:Boolean):void{ mLoopPlaying = _arg1; } public function UpdateAnimation(_arg1:Number):void{ var _local2:ModuleSequence = mAnimatedModule.GetModuleSequence(mSequenceID); if (_local2 == null){ return; }; mSequenceTick++; if (mSequenceTick < _local2.mDuration){ return; }; mSequenceTick = 0; mSequenceID++; if (mSequenceID >= mAnimatedModule.GetModuleSequencesCount()){ if (mLoopPlaying){ mLoopCycles++; mSequenceID = 0; } else { mLoopCycles = 1; return; }; }; Rebuild(); } public function GetLoopCycles():uint{ return (mLoopCycles); } private function Rebuild():void{ while (numChildren > 0) { removeChildAt(0); }; var _local1:ModuleSequence = mAnimatedModule.GetModuleSequence(mSequenceID); if (_local1 == null){ return; }; var _local2:Module = _local1.mModule; if (_local2 != null){ _local2.Render(this, (mIgnoreSequenceOffset) ? 0 : _local1.mOffsetX, (mIgnoreSequenceOffset) ? 0 : _local1.mOffsetY, _local1.mFlipX, _local1.mFlipY); }; } public function SetAnimationID(_arg1:int):void{ mAnimationID = _arg1; mAnimatedModule = mAnimatedModuleGroup[_arg1]; mSequenceID = 0; mSequenceTick = 0; mLoopCycles = 0; mLoopPlaying = true; Rebuild(); } } }//package engine.displaySection 31//Tiled2dBackgroundInstance (engine.display.Tiled2dBackgroundInstance) package engine.display { import flash.display.*; import flash.utils.*; import engine.asset.*; import flash.geom.*; public class Tiled2dBackgroundInstance extends Sprite { private var mSprite2dFile:Sprite2dFile; private var mPresentRegion:Rectangle; private var mVisibleLayersCount:uint; private var mTiled2dBackground:Tiled2dBackground; private var mGridColor:int;// = 0x808080 private var mGridVisible:Boolean;// = false public function Tiled2dBackgroundInstance(_arg1:Sprite2dFile, _arg2:uint){ mPresentRegion = new Rectangle(); super(); mSprite2dFile = _arg1; mTiled2dBackground = _arg1.GetTiled2dBackground(_arg2); mVisibleLayersCount = mTiled2dBackground.mTiled2dLayers.length; } public function SetGridVisible(_arg1:Boolean):void{ mGridVisible = _arg1; } public function GetPhysicalInfoFromLayer(_arg1:uint):Object{ var _local11:int; var _local12:int; var _local13:ModuleRef; var _local14:Tiled2dModule; if (_arg1 >= mTiled2dBackground.mTiled2dLayers.length){ return (null); }; var _local2:int = mTiled2dBackground.mCellRows; var _local3:int = mTiled2dBackground.mCellCols; var _local4:int = mTiled2dBackground.mCellWidth; var _local5:int = mTiled2dBackground.mCellHeight; var _local6:Array = mTiled2dBackground.mTiled2dLayers[_arg1]; var _local7:ByteArray = new ByteArray(); _local7.length = (_local2 * _local3); var _local8:Object = new Object(); _local8.mCellRows = _local2; _local8.mCellCols = _local3; _local8.mCellWidth = _local4; _local8.mCellHeight = _local5; _local8.mCellValues = _local7; var _local9:int; var _local10:int; while (_local10 < _local2) { _local11 = 0; while (_local11 < _local3) { _local12 = -1; _local13 = _local6[_local9]; if (_local13 != null){ _local14 = (_local13.mModule as Tiled2dModule); if (_local14 != null){ _local12 = _local14.mIndex; }; }; _local7[_local9] = ((_local12 < 0)) ? 0 : _local12; _local9++; _local11++; }; _local10++; }; return (_local8); } public function SetPresentRegion(_arg1:Rectangle):void{ var _local14:int; var _local15:int; var _local16:int; var _local17:int; var _local19:int; var _local20:int; var _local21:Array; var _local22:int; var _local23:ModuleRef; var _local24:Tiled2dModule; var _local25:Boolean; var _local26:Boolean; var _local27:int; var _local28:int; var _local2:int = mTiled2dBackground.mCellRows; var _local3:int = mTiled2dBackground.mCellCols; var _local4:int = mTiled2dBackground.mCellWidth; var _local5:int = mTiled2dBackground.mCellHeight; var _local6:uint; var _local7:uint; var _local8:uint = _local2; var _local9:uint = _local3; var _local10:uint = (mPresentRegion.x / _local5); var _local11:uint = (mPresentRegion.y / _local4); var _local12:uint = ((mPresentRegion.y + mPresentRegion.height) / _local4); var _local13:uint = ((mPresentRegion.x + mPresentRegion.width) / _local5); mPresentRegion.x = 0; mPresentRegion.y = 0; mPresentRegion.width = (_local3 * _local4); mPresentRegion.height = (_local2 * _local5); if ((((((((_local6 == _local10)) && ((_local7 == _local11)))) && ((_local8 == _local12)))) && ((_local9 == _local13)))){ return; }; trace("rebuild tiled background ... "); trace((((((((("old = (" + _local10) + ", ") + _local11) + ", ") + _local12) + ", ") + _local13) + ")")); trace((((((((("new = (" + _local6) + ", ") + _local7) + ", ") + _local8) + ", ") + _local9) + ")")); while (numChildren > 0) { removeChildAt(0); }; graphics.clear(); if (mGridVisible){ graphics.lineStyle(1, mGridColor); _local19 = (_local4 * _local3); _local20 = (_local5 * _local2); _local17 = 0; _local14 = 0; while (_local14 <= _local2) { graphics.moveTo(0, _local17); graphics.lineTo(_local19, _local17); _local17 = (_local17 + _local5); _local14++; }; _local16 = 0; _local15 = 0; while (_local15 < _local3) { graphics.moveTo(_local16, 0); graphics.lineTo(_local16, _local20); _local16 = (_local16 + _local4); _local15++; }; }; var _local18:int; while (_local18 < mVisibleLayersCount) { _local21 = mTiled2dBackground.mTiled2dLayers[_local18]; _local22 = 0; _local17 = 0; _local14 = 0; while (_local14 < _local2) { _local16 = 0; _local15 = 0; while (_local15 < _local3) { var _temp1 = _local22; _local22 = (_local22 + 1); _local23 = _local21[_temp1]; if (_local23 != null){ _local24 = (_local23.mModule as Tiled2dModule); if (_local24 != null){ if (_local24.mModuleRef.mModule != null){ _local25 = !((_local23.mFlipX == _local24.mModuleRef.mFlipX)); _local26 = !((_local23.mFlipY == _local24.mModuleRef.mFlipY)); _local27 = (_local25) ? (_local16 + _local4) : _local16; _local28 = (_local26) ? (_local17 + _local5) : _local17; _local24.mModuleRef.mModule.Render(this, _local27, _local28, _local25, _local26); }; }; }; _local16 = (_local16 + _local4); _local15++; }; _local17 = (_local17 + _local5); _local14++; }; _local18++; }; } public function SetGridColor(_arg1:int):void{ mGridColor = _arg1; } public function SetVisibleLayersCount(_arg1:uint):void{ if (_arg1 > mTiled2dBackground.mTiled2dLayers.length){ _arg1 = mTiled2dBackground.mTiled2dLayers.length; }; mVisibleLayersCount = _arg1; } } }//package engine.displaySection 32//ResFileDescription (engine.io.ResFileDescription) package engine.io { import flash.utils.*; public class ResFileDescription { public var mDataSource:ByteArray; public var mFileType:int; public var mDataOffset:int; public var mDataLength:int; public var mFilePath:String; } }//package engine.ioSection 33//Util (engine.util.Util) package engine.util { public class Util { public static function GetFullFilePath(_arg1:String, _arg2:String):String{ return (_arg1); } } }//package engine.utilSection 34//Engine (engine.Engine) package engine { import flash.utils.*; public class Engine { private static var mAssetDict:Dictionary = new Dictionary(); public static function Initialize():void{ } public static function RegisterDataAsset(_arg1:String, _arg2:Object):void{ mAssetDict[_arg1] = _arg2; } public static function GetDataAsset(_arg1:String):Object{ return (mAssetDict[_arg1]); } public static function UnregisterDataAsset(_arg1:String):void{ delete mAssetDict[_arg1]; } } }//package engineSection 35//LivePreviewParent (fl.livepreview.LivePreviewParent) package fl.livepreview { import flash.display.*; import flash.utils.*; import flash.external.*; public class LivePreviewParent extends MovieClip { public var myInstance:DisplayObject; public function LivePreviewParent(){ super(); try { stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; myInstance = getChildAt(0); onResize(stage.width, stage.height); if (ExternalInterface.available){ ExternalInterface.addCallback("onResize", onResize); ExternalInterface.addCallback("onUpdate", onUpdate); }; } catch(e) { }; } private function updateCollection(_arg1:Object, _arg2:String):void{ var _local3:Class; var _local4:Class; var _local5:Object; var _local6:int; var _local7:Object; var _local8:Object; var _local9:*; _local3 = Class(getDefinitionByName(_arg1.collectionClass)); _local4 = Class(getDefinitionByName(_arg1.collectionItemClass)); _local5 = new (_local3); _local6 = 0; while (_local6 < _arg1.collectionArray.length) { _local7 = new (_local4); _local8 = _arg1.collectionArray[_local6]; for (_local9 in _local8) { _local7[_local9] = _local8[_local9]; }; _local5.addItem(_local7); _local6++; }; myInstance[_arg2] = (_local5 as _local3); } public function onResize(_arg1:Number, _arg2:Number):void{ var setSizeFn:Function; var width = _arg1; var height = _arg2; setSizeFn = null; try { setSizeFn = myInstance["setSize"]; } catch(e:Error) { setSizeFn = null; }; if (setSizeFn != null){ setSizeFn(width, height); } else { myInstance.width = width; myInstance.height = height; }; } public function onUpdate(... _args):void{ var i:int; var name:String; var value:*; var updateArray = _args; i = 0; while ((i + 1) < updateArray.length) { try { name = String(updateArray[i]); value = updateArray[(i + 1)]; if ((((typeof(value) == "object")) && (value.__treatAsCollectionSpecialSauce__))){ updateCollection(value, name); } else { myInstance[name] = value; }; } catch(e:Error) { }; i = (i + 2); }; } } }//package fl.livepreviewSection 36//Actor (game.actor.Actor) package game.actor { import game.*; import engine.asset.*; import game.level.*; import engine.display.*; public class Actor extends GameDisplayObject implements GameEntity { protected var mIndex:int; protected var mTemplate:ActorTemplate; protected var mCustomProperties:Array; protected var mLevel:Level; public function Actor(_arg1:Level){ mLevel = _arg1; } public function Update(_arg1:Number):void{ } protected function LoadAppearance(_arg1:int, _arg2:Object, _arg3:Object):void{ } public function LoadFromDefine(_arg1:ActorDefine):void{ mTemplate = _arg1.mTemplate; x = _arg1.mPosX; y = _arg1.mPosY; z = _arg1.mZOrder; rotation = _arg1.mRotation; scaleX = _arg1.mScaleX; scaleY = _arg1.mScaleY; mCustomProperties = _arg1.mPropertyValues; var _local2:Array = _arg1.mAppearanceValues; var _local3:Array = mTemplate.mActorAppearanceDefines; var _local4:int = _local2.length; var _local5:int; while (_local5 < _local4) { LoadAppearance(_local5, _local3[_local5], _local2[_local5]); _local5++; }; } public function SetIndex(_arg1:int):void{ mIndex = _arg1; } public function Destroy():void{ } public function Initialize():void{ } } }//package game.actorSection 37//BackgroundActor (game.actor.BackgroundActor) package game.actor { import engine.asset.*; import game.level.*; import engine.*; import game.res.*; import engine.display.*; import game.general.*; public class BackgroundActor extends Actor { private var mBackground:Tiled2dBackgroundInstance; public function BackgroundActor(_arg1:Level){ super(_arg1); } override public function Initialize():void{ mLevel.AddDisplayObject(Level.LayerID_Background, this); } override protected function LoadAppearance(_arg1:int, _arg2:Object, _arg3:Object):void{ var _local4:Sprite2dFile; if (_arg2.mTypeID == kDefines.AppearanceType_background2d){ _local4 = (Engine.GetDataAsset(_arg2.mFilePath) as Sprite2dFile); mBackground = new Tiled2dBackgroundInstance(_local4, (_arg3 as int)); mBackground.SetGridVisible(true); mBackground.SetGridColor(0xE0E0E0); mBackground.SetPresentRegion(null); addChild(mBackground); MapAnalyzer.SetMapInfo(mBackground.GetPhysicalInfoFromLayer(0)); }; } } }//package game.actorSection 38//BoxActor (game.actor.BoxActor) package game.actor { import flash.events.*; import game.*; import flash.geom.*; import game.level.*; import game.display.*; import game.res.*; import game.general.*; public class BoxActor extends ModelActor { private var mRemainingRollingDegrees:int; private var mFallingSpeed:int; public var mCellCol:int; public var mCanBePushed:Boolean; private var mClockWiseRolling:Boolean; public var mCellIndex:int; public var mState:int; public var mIsTelport:Boolean; private var mEndRollingShiftY:int; private var mEndRollingShiftX:int; public var mTargetStar:TargetStar; protected var mDeltaAlpha:Number;// = 0.05 private var mDeltaRollingDegrees:int; public var mDir:int; public var mCellRow:int; public static const State_Resting:int = 0; public static const State_Rolling:int = 1; public static const State_Falling:int = 2; protected static var sAllBoxesAreResting:Boolean = true; public static var sTargetBoxActor:BoxActor = null; public static var sDeltaRow:Array = [0, 1, 0, -1]; public static var sDeltaCol:Array = [1, 0, -1, 0]; public function BoxActor(_arg1:Level){ super(_arg1); } public function GetPhyValuInvAtGravityDir():int{ return (0); } public function SetPhyRowCol(_arg1:int, _arg2:int):void{ SetPhyPos((_arg2 * MapAnalyzer.mCellWidth), (_arg1 * MapAnalyzer.mCellHeight)); } public function SetDisplayRowCol(_arg1:int, _arg2:int):void{ SetDisplayPos((_arg2 * MapAnalyzer.mCellWidth), (_arg1 * MapAnalyzer.mCellHeight)); } protected function EndRolling():void{ mLevel.IncFlipSteps(); ShiftDisplayOrigin(mEndRollingShiftX, mEndRollingShiftY); SyncPhyPosWithDisplayPos(); SyncDirWithRotation(); ChangeState(State_Resting); } public function SetDisplayPos(_arg1:int, _arg2:int):void{ x = _arg1; y = _arg2; } public function GetPhyValuAtGravityDir():int{ return (0); } public function TryToStartRolling():Boolean{ return (_TryToStartRolling(false)); } protected function OnMouseUp(_arg1:MouseEvent):void{ SetTargetBoxActor(this); if (sTargetBoxActor != this){ _arg1.stopPropagation(); _arg1.stopImmediatePropagation(); }; } protected function OnMouseDown(_arg1:MouseEvent):void{ if (!KeyInput.sIsDeactived){ _arg1.stopPropagation(); _arg1.stopImmediatePropagation(); }; } public function SyncDisplayPosWithPhyPos():void{ SetDisplayPos((mCellCol * MapAnalyzer.mCellWidth), (mCellRow * MapAnalyzer.mCellHeight)); } override public function Initialize():void{ mTargetStar = new TargetStar((width * 0.3)); UpdateTargetStar(); mTargetStar.visible = false; mTargetStar.x = (width / 2); mTargetStar.y = (height / 2); mTargetStar.alpha = 0.8; addChild(mTargetStar); mIsTelport = mCustomProperties[kTemplate.ICP_square_general_0_IsTelport]; if (mIsTelport){ mLevel.AddDisplayObject(Level.LayerID_TelportBoxActors, this); } else { mLevel.AddDisplayObject(Level.LayerID_BoxActors, this); }; mCellIndex = -1; var _local1:int; var _local2:int; var _local3:int = rotation; if (_local3 < 0){ _local3 = (_local3 + 360); }; if (_local3 == 0){ } else { if (_local3 == 90){ _local1 = -(MapAnalyzer.mCellWidth); _local2 = 0; } else { if (_local3 == 180){ _local1 = -(MapAnalyzer.mCellWidth); _local2 = -(MapAnalyzer.mCellHeight); } else { if (_local3 == 270){ _local1 = 0; _local2 = -(MapAnalyzer.mCellHeight); } else { trace(((("angle must be 0 / 90 / 180 / 270, actor id = " + mIndex) + ", angle = ") + _local3)); }; }; }; }; ShiftDisplayOrigin(_local1, _local2); var _local4:int = ((y + (MapAnalyzer.mCellHeight / 2)) / MapAnalyzer.mCellHeight); var _local5:int = ((x + (MapAnalyzer.mCellWidth / 2)) / MapAnalyzer.mCellWidth); if (_local4 < 0){ _local4 = 0; }; if (_local4 >= MapAnalyzer.mCellRows){ _local4 = (MapAnalyzer.mCellRows - 1); }; if (_local5 < 0){ _local5 = 0; }; if (_local5 >= MapAnalyzer.mCellCols){ _local5 = (MapAnalyzer.mCellCols - 1); }; SetDisplayPos((_local5 * MapAnalyzer.mCellWidth), (_local4 * MapAnalyzer.mCellHeight)); SyncPhyPosWithDisplayPos(); SyncDirWithRotation(); if (Rolledable()){ SetTargetBoxActor(this); }; ChangeState(State_Resting); addEventListener(MouseEvent.MOUSE_UP, OnMouseUp); addEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown); } public function _TryToStartRolling(_arg1:Boolean):Boolean{ if (!_arg1){ if (sTargetBoxActor != this){ return (false); }; }; var _local2:Matrix = mLevel.transform.concatenatedMatrix; _local2.invert(); var _local3:Point = new Point(KeyInput.mMouseStageX, KeyInput.mMouseStageY); var _local4:Point = _local2.transformPoint(_local3); _local4.x = _local3.x; var _local5:Boolean = (((((((_local4.x >= 0)) && ((_local4.x < mLevel.GetPlayfieldWidth())))) && ((_local4.y >= 0)))) && ((_local4.y < mLevel.GetPlayfieldHeight()))); var _local6:Boolean = ((KeyInput.mLeftKeyPressed) || (((((KeyInput.mMouseLeftButtonHold) && (_local5))) && ((_local4.x < BoxActor.sTargetBoxActor.x))))); var _local7:Boolean = ((KeyInput.mRightKeyPressed) || (((((KeyInput.mMouseLeftButtonHold) && (_local5))) && ((_local4.x > (BoxActor.sTargetBoxActor.x + BoxActor.sTargetBoxActor.width)))))); var _local8:Boolean = ((KeyInput.mUpKeyPressed) || (((((((((!(_local6)) && (!(_local7)))) && (KeyInput.mMouseLeftButtonHold))) && (_local5))) && ((_local4.y < BoxActor.sTargetBoxActor.y))))); if (!_arg1){ if (((((!(_local6)) && (!(_local7)))) && (!(_local8)))){ return (false); }; }; var _local9 = (MapAnalyzer.GetCellPhyValue((mCellRow - 1), (mCellCol - 1)) <= MapAnalyzer.PhyValue_HalfSolid); var _local10 = (MapAnalyzer.GetCellPhyValue((mCellRow - 1), mCellCol) <= MapAnalyzer.PhyValue_HalfSolid); var _local11 = (MapAnalyzer.GetCellPhyValue((mCellRow - 1), (mCellCol + 1)) <= MapAnalyzer.PhyValue_HalfSolid); var _local12 = (MapAnalyzer.GetCellPhyValue(mCellRow, (mCellCol - 1)) == MapAnalyzer.PhyValue_Air); var _local13 = (MapAnalyzer.GetCellPhyValue(mCellRow, mCellCol) == MapAnalyzer.PhyValue_Air); var _local14 = (MapAnalyzer.GetCellPhyValue(mCellRow, (mCellCol + 1)) == MapAnalyzer.PhyValue_Air); var _local15 = (MapAnalyzer.GetCellPhyValue((mCellRow + 1), (mCellCol - 1)) == MapAnalyzer.PhyValue_Air); var _local16 = (MapAnalyzer.GetCellPhyValue((mCellRow + 1), mCellCol) == MapAnalyzer.PhyValue_Air); var _local17 = (MapAnalyzer.GetCellPhyValue((mCellRow + 1), (mCellCol + 1)) == MapAnalyzer.PhyValue_Air); var _local18 = (MapAnalyzer.GetCellPhyValue(mCellRow, (mCellCol - 2)) == MapAnalyzer.PhyValue_Air); var _local19 = (MapAnalyzer.GetCellPhyValue(mCellRow, (mCellCol + 2)) == MapAnalyzer.PhyValue_Air); var _local20 = (MapAnalyzer.GetCellPhyValue((mCellRow + 1), (mCellCol - 2)) == MapAnalyzer.PhyValue_Air); var _local21 = (MapAnalyzer.GetCellPhyValue((mCellRow + 1), (mCellCol + 2)) == MapAnalyzer.PhyValue_Air); var _local22 = (MapAnalyzer.GetCellPhyValue((mCellRow - 2), (mCellCol - 1)) <= MapAnalyzer.PhyValue_HalfSolid); var _local23 = (MapAnalyzer.GetCellPhyValue((mCellRow - 2), mCellCol) <= MapAnalyzer.PhyValue_HalfSolid); var _local24 = (MapAnalyzer.GetCellPhyValue((mCellRow - 2), (mCellCol + 1)) <= MapAnalyzer.PhyValue_HalfSolid); var _local25:Boolean; var _local26:Boolean; var _local27:Boolean; var _local28:Boolean; var _local29:uint; var _local30:uint; if (_local16){ return (false); }; if (_local10){ if (((_local9) && (_local12))){ _local25 = true; if (((((_local15) && (_local20))) && (_local18))){ _local30 = 180; } else { _local30 = 90; }; } else { if (((_local14) && (_local11))){ _local27 = true; if (((((_local23) && (_local22))) && (_local9))){ _local30 = 180; } else { _local30 = 90; }; }; }; if (((_local11) && (_local14))){ _local26 = true; if (((((_local17) && (_local21))) && (_local19))){ _local29 = 180; } else { _local29 = 90; }; } else { if (((_local12) && (_local9))){ _local28 = true; if (((((_local23) && (_local24))) && (_local11))){ _local29 = 180; } else { _local29 = 90; }; }; }; }; if (_arg1){ return (((!((_local29 == 0))) || (!((_local30 == 0))))); }; mRemainingRollingDegrees = 0; var _local31:int; var _local32:int; if (_local6){ if (_local25){ mClockWiseRolling = false; mRemainingRollingDegrees = _local30; _local31 = 0; _local32 = MapAnalyzer.mCellHeight; if (_local30 == 90){ mEndRollingShiftX = -(MapAnalyzer.mCellWidth); mEndRollingShiftY = -(MapAnalyzer.mCellHeight); } else { mEndRollingShiftX = -(MapAnalyzer.mCellWidth); mEndRollingShiftY = 0; }; }; } else { if (_local7){ if (_local26){ mClockWiseRolling = true; mRemainingRollingDegrees = _local29; _local31 = MapAnalyzer.mCellWidth; _local32 = MapAnalyzer.mCellHeight; if (_local29 == 90){ mEndRollingShiftX = 0; mEndRollingShiftY = -(MapAnalyzer.mCellHeight); } else { mEndRollingShiftX = 0; mEndRollingShiftY = 0; }; }; }; }; if (mRemainingRollingDegrees == 0){ if (((_local6) || (_local8))){ if (_local27){ mClockWiseRolling = false; mRemainingRollingDegrees = _local30; _local31 = 0; _local32 = 0; if (_local30 == 90){ mEndRollingShiftX = 0; mEndRollingShiftY = -(MapAnalyzer.mCellHeight); } else { mEndRollingShiftX = -(MapAnalyzer.mCellWidth); mEndRollingShiftY = -(MapAnalyzer.mCellHeight); }; }; }; if (((_local7) || (_local8))){ if (_local28){ mClockWiseRolling = true; mRemainingRollingDegrees = _local29; _local31 = MapAnalyzer.mCellWidth; _local32 = 0; if (_local29 == 90){ mEndRollingShiftX = -(MapAnalyzer.mCellWidth); mEndRollingShiftY = -(MapAnalyzer.mCellHeight); } else { mEndRollingShiftX = 0; mEndRollingShiftY = -(MapAnalyzer.mCellHeight); }; }; }; }; if (mRemainingRollingDegrees != 0){ LevelStatusInfo.AddAutoSavedLevelHistoryStatusInfo(new LevelStatusInfo(mLevel)); ShiftDisplayOrigin(_local31, _local32); mDeltaRollingDegrees = 9; ChangeState(State_Rolling); return (true); }; return (false); } public function ChangeState(_arg1:int):void{ mState = _arg1; alpha = 1; if (_arg1 == State_Resting){ sAllBoxesAreResting = true; } else { sAllBoxesAreResting = false; }; } private function UpdateStateFalling():void{ var _local1:int = ((y / MapAnalyzer.mCellHeight) + 1); var _local2:int = (x / MapAnalyzer.mCellWidth); mFallingSpeed = (mFallingSpeed + 1); var _local3:int = (y + mFallingSpeed); var _local4:int = ((_local3 / MapAnalyzer.mCellHeight) + 1); var _local5:int = (_local1 + 1); while (_local5 <= _local4) { if (MapAnalyzer.GetCellPhyValue(_local5, _local2) != MapAnalyzer.PhyValue_Air){ SetPhyRowCol((_local5 - 1), _local2); SyncDisplayPosWithPhyPos(); ChangeState(State_Resting); return; }; _local5++; }; SetDisplayPos(x, _local3); } public function UpdateTargetStar():void{ if (mLevel.mInChangeTargetMode){ if (this == sTargetBoxActor){ mTargetStar.SetColor(0xFF00); } else { if (Rolledable()){ mTargetStar.SetColor(16744703); }; }; } else { if (!mTargetStar.visible){ return; }; if (!Rolledable()){ mTargetStar.SetColor(0x808080); } else { if (this == sTargetBoxActor){ mTargetStar.SetColor(0xFF00); } else { mTargetStar.SetColor(16744703); }; }; }; } public function ShiftDisplayOrigin(_arg1:int, _arg2:int):void{ var _local3:Point = new Point(x, y); SetDisplayPos((x + _arg1), (y + _arg2)); var _local4:Matrix = transform.matrix; _local4.invert(); var _local5:Point = _local4.transformPoint(_local3); mModel.x = (mModel.x + _local5.x); mModel.y = (mModel.y + _local5.y); mTargetStar.x = (mTargetStar.x + _local5.x); mTargetStar.y = (mTargetStar.y + _local5.y); } public function GetBackBox():BoxActor{ var _local1:BoxActor = MapAnalyzer.GetCellBox((mCellRow - sDeltaRow[mDir]), (mCellCol - sDeltaCol[mDir])); return (_local1); } public function GetBoxAtInvGravityDir():BoxActor{ return (null); } private function UpdateStateResting():void{ UpdateTargetStar(); } public function TryToStartFalling():Boolean{ if (mState == State_Falling){ return (true); }; if (MapAnalyzer.GetCellPhyValue((mCellRow + 1), mCellCol) == MapAnalyzer.PhyValue_Air){ mFallingSpeed = 0; ChangeState(State_Falling); return (true); }; return (false); } public function SyncDirWithRotation():void{ mDir = int((rotation / 90)); mDir = ((mDir + 4) % 4); } public function GetBoxAtGravityDir():BoxActor{ return (null); } override public function Destroy():void{ removeEventListener(MouseEvent.MOUSE_UP, OnMouseUp); removeEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown); } public function Rolledable():Boolean{ return (_TryToStartRolling(true)); } public function SyncPhyPosWithDisplayPos():void{ SetPhyPos(x, y); } override public function Update(_arg1:Number):void{ if (mModel != null){ mModel.UpdateAnimation(_arg1); }; if (((mTargetStar.visible) && (!(KeyInput.sIsDeactived)))){ mTargetStar.UpdateAnimation(_arg1); }; switch (mState){ case State_Resting: UpdateStateResting(); break; case State_Rolling: UpdateStateRolling(); break; case State_Falling: UpdateStateFalling(); break; }; } public function SetPhyPos(_arg1:int, _arg2:int):void{ MapAnalyzer.NotifyBoxPhyPosModified(this, _arg1, _arg2); } private function UpdateStateRolling():void{ mRemainingRollingDegrees = (mRemainingRollingDegrees - mDeltaRollingDegrees); if (mRemainingRollingDegrees <= 0){ mDeltaRollingDegrees = (mDeltaRollingDegrees + mRemainingRollingDegrees); }; rotation = (rotation + (mClockWiseRolling) ? mDeltaRollingDegrees : -(mDeltaRollingDegrees)); if (mRemainingRollingDegrees <= 0){ EndRolling(); }; } public static function SetTargetBoxActor(_arg1:BoxActor):void{ if (sTargetBoxActor == _arg1){ return; }; var _local2:BoxActor = sTargetBoxActor; sTargetBoxActor = _arg1; if (_local2 != null){ if (!_local2.mLevel.mInChangeTargetMode){ _local2.mTargetStar.visible = false; }; _local2.UpdateTargetStar(); }; if (sTargetBoxActor != null){ sTargetBoxActor.mTargetStar.visible = true; sTargetBoxActor.UpdateTargetStar(); }; } } }//package game.actorSection 39//BoxTarget (game.actor.BoxTarget) package game.actor { import engine.asset.*; import game.level.*; import engine.*; import engine.display.*; import game.general.*; public class BoxTarget extends ModelActor { private var mLastOverlapBox:BoxActor; private var mCellRow:int; private var mFoundIcon:Sprite2dModelInstance; private var mCellCol:int; private static const AnimID_ChildFound:int = 6; public function BoxTarget(_arg1:Level){ super(_arg1); } override public function Update(_arg1:Number):void{ var _local2:BoxActor = MapAnalyzer.GetCellBox(mCellRow, mCellCol); if (mFoundIcon.visible){ mFoundIcon.UpdateAnimation(_arg1); if (mFoundIcon.GetLoopCycles() > 0){ mFoundIcon.visible = false; }; }; if ((((((((_local2 == null)) || ((_local2.mModel == null)))) || (!((_local2.mModel.GetAnimationID() == mModel.GetAnimationID()))))) || ((MapAnalyzer.GetCellPhyValue((_local2.mCellRow + 1), _local2.mCellCol) == MapAnalyzer.PhyValue_Air)))){ mLevel.SetFinished(false); } else { if (mLastOverlapBox != _local2){ mFoundIcon.SetAnimationID(AnimID_ChildFound); mFoundIcon.SetLoopPlaying(false); mFoundIcon.visible = true; mFoundIcon.x = (x + (width / 2)); mFoundIcon.y = (y + (height / 2)); SoundPlayer.PlaySoundByFilePath("child.mp3", false); }; }; mLastOverlapBox = _local2; } override public function Initialize():void{ mLevel.AddDisplayObject(Level.LayerID_BackgroundSurface, this); var _local1:Sprite2dFile = (Engine.GetDataAsset("misc.xSprite2d") as Sprite2dFile); mFoundIcon = new Sprite2dModelInstance(_local1, 0); mFoundIcon.visible = false; mLevel.AddDisplayObject(Level.LayerID_TutorialActors, mFoundIcon); mCellRow = ((y + (MapAnalyzer.mCellHeight / 2)) / MapAnalyzer.mCellHeight); mCellCol = ((x + (MapAnalyzer.mCellWidth / 2)) / MapAnalyzer.mCellWidth); x = (mCellCol * MapAnalyzer.mCellWidth); y = (mCellRow * MapAnalyzer.mCellHeight); mLastOverlapBox = null; alpha = 1; x = (x + (width / 4)); y = (y + (height / 4)); scaleX = 0.5; scaleY = 0.5; } override public function Destroy():void{ } } }//package game.actorSection 40//BoxTelport (game.actor.BoxTelport) package game.actor { import flash.display.*; import game.level.*; import game.res.*; import game.general.*; public class BoxTelport extends BoxActor { private var mAnimationID_out:int; private var mAnimationID_ok:int; private var mAnimationID_normal:int; private var mPushZoneSprite:Shape; private var mTelportedBox:BoxActor; private var mAnimationID_in:int; private var mProgressStage:int; private var mTelportDelay:int;// = -1 private var _FreeCellRow:int; private var mTelportedBoxEverNotRestedWhenOut:Boolean; private var _FreeCellCol:int; public static const State_TelportResting:int = 0; public static const ProgressStage_PushBoxes:int = 3; public static const ProgressStage_ClaimPushZone:int = 0; private static const sBoxPushingSpeed:int = 2; public static const State_TelportOut:int = 101; public static const ProgressStage_DropBoxes:int = 2; public static const ProgressStage_EatTelportee:int = 1; public static const State_TelportIn:int = 103; public static const State_TelportProgress:int = 102; private static var sNumBoxesBeingPushed:int; private static var sBoxPushingLength:int; private static var sBoxPushingDirX:int; private static var sTelportedBox:BoxActor; private static var sAllBoxesBeingPushed:Array = new Array(128); private static var sBoxPushingDirY:int; public function BoxTelport(_arg1:Level){ mPushZoneSprite = new Shape(); super(_arg1); } private function CheckPushable(_arg1:Boolean, _arg2:BoxActor, _arg3:BoxTelport):Boolean{ var _local4:int; var _local5:int; var _local6:BoxActor; var _local7:int; _local4 = mCellRow; _local5 = mCellCol; while (true) { if (_arg1){ _local4 = (_local4 + sDeltaRow[mDir]); _local5 = (_local5 + sDeltaCol[mDir]); } else { _local4 = (_local4 - sDeltaRow[mDir]); _local5 = (_local5 - sDeltaCol[mDir]); }; _local7 = MapAnalyzer.GetCellPhyValue(_local4, _local5); _local6 = MapAnalyzer.GetCellBox(_local4, _local5); if ((((_local7 == MapAnalyzer.PhyValue_Air)) || ((_local6 == _arg2)))){ _FreeCellRow = _local4; _FreeCellCol = _local5; return (true); }; if (_local6 == null){ return (false); }; }; return (false); } private function RegisterBoxBeingPushed(_arg1:BoxActor, _arg2:Boolean):void{ var _local4:BoxActor; var _local5:int; var _local6 = sNumBoxesBeingPushed++; sAllBoxesBeingPushed[_local6] = _arg1; if (sBoxPushingDirX == 0){ return; }; if (!_arg2){ return; }; var _local3:BoxActor = MapAnalyzer.GetCellBox((_arg1.mCellRow - 1), _arg1.mCellCol); if (_local3 != null){ _local4 = MapAnalyzer.GetCellBox((_arg1.mCellRow - 1), (_arg1.mCellCol + sBoxPushingDirX)); _local5 = MapAnalyzer.GetCellPhyValue((_arg1.mCellRow - 1), (_arg1.mCellCol + sBoxPushingDirX)); if ((((_local5 == MapAnalyzer.PhyValue_Air)) || (((!((_local4 == null))) && (_local4.mCanBePushed))))){ RegisterBoxBeingPushed(_local3, true); } else { _local3.mCanBePushed = false; }; }; } private function UpdateTelportIn():void{ if (mModel.GetLoopCycles() > 0){ if (mModel.GetAnimationID() == mAnimationID_out){ mModel.SetAnimationID(mAnimationID_in); mModel.SetLoopPlaying(false); } else { mModel.SetAnimationID(mAnimationID_normal); mModel.SetLoopPlaying(true); ChangeState(State_TelportResting); }; }; } private function UpdateTelportProgress_EatTelportee():void{ } private function UpdateTelportProgress_DropBoxes():void{ } private function UpdateTelportProgress():void{ var _local1:int; var _local4:int; var _local5:BoxActor; mTelportDelay--; if (mTelportDelay == 0){ SoundPlayer.PlaySoundByFilePath("telport.mp3", false); }; if (mTelportDelay > 0){ return; }; sBoxPushingLength = (sBoxPushingLength - sBoxPushingSpeed); if (sBoxPushingLength < 0){ _local1 = -(sBoxPushingLength); } else { _local1 = sBoxPushingSpeed; }; var _local2:int = (sBoxPushingSpeed * sBoxPushingDirX); var _local3:int = (sBoxPushingSpeed * sBoxPushingDirY); _local4 = 0; while (_local4 < sNumBoxesBeingPushed) { _local5 = sAllBoxesBeingPushed[_local4]; sAllBoxesBeingPushed[_local4].SetDisplayPos((_local5.x + _local2), (_local5.y + _local3)); _local4++; }; if (sBoxPushingLength <= 0){ _local4 = 0; while (_local4 < sNumBoxesBeingPushed) { _local5 = sAllBoxesBeingPushed[_local4]; _local5.SyncPhyPosWithDisplayPos(); _local4++; }; sTelportedBox.SyncPhyPosWithDisplayPos(); ChangeState(State_Resting); }; } public function StartTelporting1(_arg1:BoxActor):void{ ChangeState(State_TelportProgress); mTelportedBox = _arg1; var _local2:BoxTelport = GetTelportPartner(); var _local3:int = GetTelportTowards(_arg1, _local2); if (_local3 == 0){ trace("Impossilbe !!!"); return; }; if (_FreeCellRow != mCellRow){ mProgressStage = ProgressStage_EatTelportee; } else { mProgressStage = ProgressStage_ClaimPushZone; }; } private function UpdateTelportOut():void{ var _local2:BoxTelport; var _local1:BoxActor = GetBackBox(); mTelportedBoxEverNotRestedWhenOut = ((((mTelportedBoxEverNotRestedWhenOut) || ((_local1 == null)))) || (!((_local1.mState == State_Resting)))); if (mTelportedBoxEverNotRestedWhenOut){ ChangeState(State_TelportIn); } else { if (mModel.GetLoopCycles() > 0){ _local2 = GetTelportPartner(); if (((((((!((_local2 == null))) && (!((_local1 == null))))) && (_local2.CanFinishTelport(_local1, this)))) && (!(mTelportedBoxEverNotRestedWhenOut)))){ if (((mLevel.mInRolling) || (mLevel.mInFalling))){ return; }; if (MapAnalyzer.GetCellPhyValue((_local2.mCellRow + 1), _local2.mCellCol) == MapAnalyzer.PhyValue_Air){ return; }; _local2.StartTelporting(_local1, this); mModel.SetAnimationID(mAnimationID_normal); mModel.SetLoopPlaying(true); ChangeState(State_TelportResting); } else { mModel.SetAnimationID(mAnimationID_in); mModel.SetLoopPlaying(false); ChangeState(State_TelportIn); }; }; }; } private function UpdateTelportProgress_PushBoxes():void{ } private function GetTelportPartner():BoxTelport{ var _local1:BoxTelport; var _local2:int = mCustomProperties[kTemplate.ICP_square_telport_1_Actor_Link]; if (_local2 < 0){ _local1 = null; } else { _local1 = (mLevel.GetActorAt(_local2) as BoxTelport); }; return (_local1); } private function UpdateTelportProgress_ClaimPushZone():void{ } private function ClearBoxesBeingPushed():void{ var _local2:Actor; sNumBoxesBeingPushed = 0; var _local1:int; while (_local1 < mLevel.mActorsCount) { _local2 = (mLevel.mActors[_local1] as Actor); if ((_local2 is BoxActor)){ (_local2 as BoxActor).mCanBePushed = true; }; _local1++; }; } public function StartTelporting(_arg1:BoxActor, _arg2:BoxTelport):void{ var _local8:int; var _local9:int; var _local10:BoxActor; var _local3:int = GetTelportTowards(_arg1, _arg2); if (_local3 == 0){ trace("Impossilbe !!!"); return; }; var _local4 = (_local3 > 0); ChangeState(State_TelportProgress); if (_arg1.mIsTelport){ mLevel.RemoveDisplayObject(Level.LayerID_TelportBoxActors, this); mLevel.AddDisplayObject(Level.LayerID_TelportBoxActors, this); }; if (_local4){ sBoxPushingDirX = sDeltaCol[mDir]; sBoxPushingDirY = sDeltaRow[mDir]; } else { sBoxPushingDirX = -(sDeltaCol[mDir]); sBoxPushingDirY = -(sDeltaRow[mDir]); }; var _local5 = !((sBoxPushingDirX == 0)); sBoxPushingLength = (_local5) ? MapAnalyzer.mCellWidth : MapAnalyzer.mCellHeight; sTelportedBox = _arg1; ClearBoxesBeingPushed(); SoundPlayer.PlaySoundByFilePath("telport_start.mp3", false); mTelportDelay = 12; var _local6:int = _FreeCellRow; var _local7:int = _FreeCellCol; if (_local5){ _local10 = MapAnalyzer.GetCellBox((_local6 - 1), _local7); if (_local10 != null){ _local10.mCanBePushed = false; }; }; MapAnalyzer.RemoveBox(_arg1); while (_local4) { _local8 = _local6; _local9 = _local7; _local6 = (_local6 - sBoxPushingDirY); _local7 = (_local7 - sBoxPushingDirX); _local10 = MapAnalyzer.GetCellBox(_local6, _local7); if (_local10 == this){ _arg1.SetDisplayRowCol(_local6, _local7); RegisterBoxBeingPushed(_arg1, false); break; }; if (_local10 == null){ trace("Error ??? !!! 1"); break; }; RegisterBoxBeingPushed(_local10, _local5); }; while (!(_local4)) { _local8 = _local6; _local9 = _local7; _local6 = (_local6 - sBoxPushingDirY); _local7 = (_local7 - sBoxPushingDirX); _local10 = MapAnalyzer.GetCellBox(_local6, _local7); RegisterBoxBeingPushed(_local10, _local5); if (_local10 == this){ _arg1.SetDisplayRowCol(_local6, _local7); break; }; if (_local10 == null){ trace("Error ??? !!! 2"); break; }; }; } private function UpdateTelportProgress1():void{ switch (mProgressStage){ case ProgressStage_ClaimPushZone: UpdateTelportProgress_ClaimPushZone(); break; case ProgressStage_EatTelportee: UpdateTelportProgress_EatTelportee(); break; case ProgressStage_DropBoxes: UpdateTelportProgress_DropBoxes(); break; case ProgressStage_PushBoxes: UpdateTelportProgress_PushBoxes(); break; }; } public function TryToStartTelporting():Boolean{ var _local1:int = MapAnalyzer.GetCellPhyValue((mCellRow + 1), mCellCol); if (_local1 == MapAnalyzer.PhyValue_Air){ return (false); }; var _local2:BoxTelport = GetTelportPartner(); var _local3:BoxActor = GetBackBox(); if (((((!((_local2 == null))) && (!((_local3 == null))))) && ((mModel.GetAnimationID() == mAnimationID_normal)))){ if (_local2.CanFinishTelport(_local3, this)){ mModel.SetAnimationID(mAnimationID_out); mModel.SetLoopPlaying(false); mTelportedBoxEverNotRestedWhenOut = false; ChangeState(State_TelportOut); return (true); }; }; return (false); } override public function Update(_arg1:Number):void{ super.Update(_arg1); switch (mState){ case State_TelportProgress: UpdateTelportProgress(); break; case State_TelportOut: UpdateTelportOut(); break; case State_TelportIn: UpdateTelportIn(); break; }; if (((((!((mState == State_TelportOut))) && ((mModel.GetAnimationID() == mAnimationID_out)))) && ((mModel.GetLoopCycles() > 0)))){ mModel.SetAnimationID(mAnimationID_in); mModel.SetLoopPlaying(false); } else { if (((((!((mState == State_TelportIn))) && ((mModel.GetAnimationID() == mAnimationID_in)))) && ((mModel.GetLoopCycles() > 0)))){ mModel.SetAnimationID(mAnimationID_normal); mModel.SetLoopPlaying(true); }; }; } public function CanFinishTelport(_arg1:BoxActor, _arg2:BoxTelport):Boolean{ var _local3:int; var _local4:int; var _local5:BoxActor; if (_arg1 == this){ return (false); }; if (_arg1.mIsTelport){ if ((((_arg2 == MapAnalyzer.GetCellBox((_arg1.mCellRow - sDeltaRow[_arg1.mDir]), (_arg1.mCellCol - sDeltaCol[_arg1.mDir])))) && ((_arg1 == MapAnalyzer.GetCellBox((_arg2.mCellRow - sDeltaRow[_arg2.mDir]), (_arg2.mCellCol - sDeltaCol[_arg2.mDir])))))){ return (false); }; }; var _local6:uint; var _local7:uint; while (_local7 < 4) { _local3 = (_arg1.mCellRow - sDeltaRow[_local7]); _local4 = (_arg1.mCellCol - sDeltaCol[_local7]); _local5 = MapAnalyzer.GetCellBox(_local3, _local4); if (((((!((_local5 == null))) && (_local5.mIsTelport))) && ((_arg1 == _local5.GetBackBox())))){ if (((!(_arg1.mIsTelport)) || (((!((_local5 == _arg1.GetBackBox()))) && (!((_local5 == (_arg1 as BoxTelport).GetTelportPartner()))))))){ _local6++; }; }; _local7++; }; if (_local6 > 1){ return (false); }; if (_local6 == 0){ trace("Entering this function means numTelporterAsses > 0."); return (false); }; return (!((GetTelportTowards(_arg1, _arg2) == 0))); } override public function Destroy():void{ super.Destroy(); sTelportedBox = null; var _local1:int; while (_local1 < sAllBoxesBeingPushed.length) { sAllBoxesBeingPushed[_local1] = null; _local1++; }; } public function GetTelportTowards(_arg1:BoxActor, _arg2:BoxTelport):int{ if (_arg1 == null){ return (0); }; if (_arg2 != GetTelportPartner()){ return (0); }; var _local3:Boolean = CheckPushable(true, _arg1, _arg2); if (!_local3){ if (!CheckPushable(false, _arg1, _arg2)){ return (0); }; return (-1); //unresolved jump }; return (1); } override public function Initialize():void{ super.Initialize(); mAnimationID_normal = mModel.GetAnimationID(); mAnimationID_ok = (mAnimationID_normal + 1); mAnimationID_out = (mAnimationID_normal + 2); mAnimationID_in = (mAnimationID_normal + 3); mTelportedBox = null; } } }//package game.actorSection 41//ModelActor (game.actor.ModelActor) package game.actor { import engine.asset.*; import game.level.*; import engine.*; import game.res.*; import engine.display.*; public class ModelActor extends Actor { public var mModel:Sprite2dModelInstance; public function ModelActor(_arg1:Level){ super(_arg1); } override protected function LoadAppearance(_arg1:int, _arg2:Object, _arg3:Object):void{ var _local4:Sprite2dFile; if (_arg2.mTypeID == kDefines.AppearanceType_sprite2d){ _local4 = (Engine.GetDataAsset(_arg2.mFilePath) as Sprite2dFile); mModel = new Sprite2dModelInstance(_local4, (_arg2.mModelID as int)); mModel.SetAnimationID((_arg3 as int)); addChild(mModel); } else { if (_arg2.mTypeID == kDefines.AppearanceType_box2d){ }; }; } } }//package game.actorSection 42//TutorialActor (game.actor.TutorialActor) package game.actor { import game.*; import game.level.*; import game.display.*; import game.res.*; public class TutorialActor extends ModelActor { public function TutorialActor(_arg1:Level){ super(_arg1); } override public function Initialize():void{ var _local3:DialogBox; mLevel.AddDisplayObject(Level.LayerID_TutorialActors, this); var _local1:int = mCustomProperties[kTemplate.ICP_tutorial_Type]; var _local2:int = mCustomProperties[kTemplate.ICP_tutorial_Text]; if ((((_local1 == 0)) && ((_local2 >= 0)))){ _local3 = new DialogBox(); addChild(_local3); _local3.SetText(Config.kTutorialTexts[_local2], true); _local3.SetCached(false); _local3.SetBackgroundVisible(false); _local3.alpha = 1; _local3.Rebuild(); _local3.x = (-(_local3.width) / 2); _local3.y = (-(_local3.height) / 2); }; } override public function Destroy():void{ } override public function Update(_arg1:Number):void{ } } }//package game.actorSection 43//DialogBox (game.display.DialogBox) package game.display { import flash.display.*; import flash.text.*; import flash.geom.*; public class DialogBox extends Sprite { private var mTextColor:int;// = 0 private var mBorderThickness:int;// = 3 private var mRoundRadium:int;// = 8 private var mIsHtmlText:Boolean;// = false private var mMessageText:String;// = "" private var mBackgroundColor:int;// = 14540287 private var mBorderColor:int;// = 8421536 private var mBackgroundVisible:Boolean;// = true private var mIsCached:Boolean;// = false public function SetBackgroundVisible(_arg1:Boolean):void{ mBackgroundVisible = _arg1; } public function SetCached(_arg1:Boolean):void{ mIsCached = _arg1; } public function SetBorderThickness(_arg1:int):void{ mBorderThickness = _arg1; } public function SetTextColor(_arg1:int):void{ mTextColor = _arg1; } public function SetText(_arg1:String, _arg2:Boolean=false):void{ mMessageText = _arg1; mIsHtmlText = _arg2; } public function SetBackgroundColor(_arg1:int):void{ mBackgroundColor = _arg1; } public function SetBorderColor(_arg1:int):void{ mBorderColor = _arg1; } public function Rebuild():void{ var _local3:uint; var _local4:uint; var _local5:uint; var _local6:BitmapData; var _local7:Matrix; var _local8:Bitmap; while (numChildren > 0) { removeChildAt(0); }; var _local1:TextField = new TextField(); _local1.autoSize = TextFieldAutoSize.LEFT; _local1.selectable = false; _local1.background = mBackgroundVisible; _local1.backgroundColor = mBackgroundColor; _local1.textColor = mTextColor; _local1.multiline = true; if (mIsHtmlText){ _local1.htmlText = mMessageText; } else { _local1.text = mMessageText; }; var _local2:Shape; if (mBackgroundVisible){ _local2 = new Shape(); _local3 = 8; _local4 = ((_local1.width + _local3) + _local3); _local5 = ((_local1.height + _local3) + _local3); _local2.graphics.beginFill(mBackgroundColor); _local2.graphics.lineStyle(mBorderThickness, mBorderColor); _local2.graphics.drawRoundRect(0, 0, _local4, _local5, mRoundRadium); _local2.graphics.endFill(); _local2.x = (mBorderThickness / 2); _local2.y = (mBorderThickness / 2); _local1.x = (mRoundRadium + (mBorderThickness / 2)); _local1.y = (mRoundRadium + (mBorderThickness / 2)); }; if (!mIsCached){ if (mBackgroundVisible){ addChild(_local2); }; addChild(_local1); } else { _local7 = new Matrix(); if (mBackgroundVisible){ _local6 = new BitmapData(_local2.width, _local2.height, true, 0xFFFFFF); _local7.tx = _local2.x; _local7.ty = _local2.y; _local6.draw(_local2, _local7); } else { _local6 = new BitmapData(_local1.width, _local1.height, true, 0xFFFFFF); }; _local7.tx = _local1.x; _local7.ty = _local1.y; _local6.draw(_local1, _local7); _local8 = new Bitmap(_local6); addChild(_local8); }; } } }//package game.displaySection 44//HtmlTextButton (game.display.HtmlTextButton) package game.display { import flash.display.*; public class HtmlTextButton extends SimpleButton { public function HtmlTextButton(_arg1:String, _arg2:Boolean, _arg3:Boolean){ var _local5:DialogBox; super(); var _local4:DialogBox = new DialogBox(); _local4.SetText(_arg1, true); _local4.SetCached(_arg3); _local4.SetBorderThickness(1); _local4.SetBackgroundColor(12632192); _local4.SetBackgroundVisible(_arg2); _local4.alpha = 1; _local4.Rebuild(); upState = _local4; hitTestState = _local4; if (_arg2){ _local5 = new DialogBox(); _local5.SetText(_arg1, true); _local5.SetCached(_arg3); _local5.SetBorderThickness(1); _local5.SetBackgroundColor(8440960); _local5.SetBackgroundVisible(_arg2); _local5.alpha = 1; _local5.Rebuild(); overState = _local5; downState = _local5; } else { overState = _local4; downState = _local4; }; } } }//package game.displaySection 45//LogoButton (game.display.LogoButton) package game.display { import flash.display.*; public class LogoButton extends SimpleButton { private var mBitmap:Bitmap; public function LogoButton(_arg1:BitmapData){ mBitmap = new Bitmap(_arg1); upState = mBitmap; hitTestState = mBitmap; overState = mBitmap; downState = mBitmap; } } }//package game.displaySection 46//MainMenuLevelItem (game.display.MainMenuLevelItem) package game.display { import flash.display.*; import engine.asset.*; import engine.*; import engine.display.*; public class MainMenuLevelItem extends SimpleButton { private var mLevelIndex:uint; private static const AnimID_Locked:int = 8; private static const AnimID_Finished:int = 7; public function MainMenuLevelItem(_arg1:uint, _arg2:Boolean, _arg3:Boolean, _arg4:uint, _arg5:uint){ var _local7:Sprite2dModelInstance; var _local8:DialogBox; super(); mLevelIndex = _arg1; var _local6:Sprite2dFile = (Engine.GetDataAsset("misc.xSprite2d") as Sprite2dFile); upState = new Sprite(); (upState as Sprite).addChild(CreateRoundRect((_arg2) ? 6340704 : 12607584, _arg4, _arg5)); if (_arg2){ }; if (_arg3){ _local7 = new Sprite2dModelInstance(_local6, 0); _local7.SetAnimationID(AnimID_Locked); _local7.x = ((_arg4 - _local7.width) / 2); _local7.y = ((_arg5 - _local7.height) / 2); (upState as Sprite).addChild(_local7); } else { _local8 = new DialogBox(); _local8.SetText(("" + (_arg1 + 1)), true); _local8.SetCached(true); _local8.SetBackgroundVisible(false); _local8.SetTextColor(0x111111); _local8.Rebuild(); _local8.x = ((_arg4 - _local8.width) / 2); _local8.y = ((_arg5 - _local8.height) / 2); _local8.alpha = 0.75; (upState as Sprite).addChild(_local8); }; overState = new Sprite(); (overState as Sprite).addChild(CreateRoundRect(8421631, _arg4, _arg5)); if (_arg2){ }; if (_arg3){ _local7 = new Sprite2dModelInstance(_local6, 0); _local7.SetAnimationID(AnimID_Locked); _local7.x = ((_arg4 - _local7.width) / 2); _local7.y = ((_arg5 - _local7.height) / 2); (overState as Sprite).addChild(_local7); } else { _local8 = new DialogBox(); _local8.SetText(("" + (_arg1 + 1)), true); _local8.SetCached(true); _local8.SetBackgroundVisible(false); _local8.SetTextColor(0x111111); _local8.Rebuild(); _local8.x = ((_arg4 - _local8.width) / 2); _local8.y = ((_arg5 - _local8.height) / 2); _local8.alpha = 0.75; (overState as Sprite).addChild(_local8); }; downState = overState; hitTestState = upState; } public function GetLevelIndex():uint{ return (mLevelIndex); } private function CreateRoundRect(_arg1:uint, _arg2:Number, _arg3:Number):Shape{ var _local4:Shape = new Shape(); _local4.graphics.beginFill(_arg1); _local4.graphics.lineStyle(2, 0xC2C2C2); _local4.graphics.drawRoundRect(0, 0, _arg2, _arg3, 8); _local4.graphics.endFill(); return (_local4); } } }//package game.displaySection 47//TargetStar (game.display.TargetStar) package game.display { import flash.display.*; public class TargetStar extends Shape { private var mColor:int; private var mRadiums:Number; public function TargetStar(_arg1:Number){ mRadiums = _arg1; mColor = -1; SetColor(0); } public function SetColor(_arg1:int):void{ if (mColor == _arg1){ return; }; mColor = _arg1; graphics.clear(); graphics.beginFill(_arg1); graphics.lineStyle(1, 0); graphics.drawRoundRect(-(mRadiums), -2, (mRadiums + mRadiums), 4, 1); graphics.drawRoundRect(-2, -(mRadiums), 4, (mRadiums + mRadiums), 1); graphics.endFill(); } public function UpdateAnimation(_arg1:Number):void{ rotation = (rotation + (_arg1 * 60)); } } }//package game.displaySection 48//MapAnalyzer (game.general.MapAnalyzer) package game.general { import flash.utils.*; import game.actor.*; public class MapAnalyzer { public static const CellValue_MinSolid:int = 1; public static const PhyFlag_Box:int = (1 << 6); public static const PhyValue_Solid:int = 2; public static const PhyValue_HalfSolid:int = 1; public static const PhyValue_Air:int = 0; public static var mCellCols:int; public static var mCellBoxes:Array; public static var mCellWidth:int; public static var mCellRows:int; public static var mCellValues:ByteArray; public static var mCellHeight:int; public static function RemoveBox(_arg1:BoxActor):void{ if (_arg1.mCellIndex >= 0){ mCellBoxes[_arg1.mCellIndex] = null; mCellValues[((_arg1.mCellRow * mCellCols) + _arg1.mCellCol)] = (mCellValues[((_arg1.mCellRow * mCellCols) + _arg1.mCellCol)] & 63); _arg1.mCellIndex = -1; }; } public static function SetMapInfo(_arg1:Object):void{ mCellRows = _arg1.mCellRows; mCellCols = _arg1.mCellCols; mCellWidth = _arg1.mCellWidth; mCellHeight = _arg1.mCellHeight; mCellValues = _arg1.mCellValues; mCellBoxes = new Array((mCellRows * mCellCols)); } public static function GetCellPhyValue(_arg1:int, _arg2:int):int{ if ((((((((_arg1 < 0)) || ((_arg1 >= mCellRows)))) || ((_arg2 < 0)))) || ((_arg2 >= mCellCols)))){ return (PhyValue_Solid); }; var _local3 = (mCellValues[((_arg1 * mCellCols) + _arg2)] & (63 | PhyFlag_Box)); if (_local3 >= CellValue_MinSolid){ return (PhyValue_Solid); }; return (PhyValue_Air); } public static function PutBoxAt(_arg1:BoxActor, _arg2:int, _arg3:int):void{ _arg1.mCellRow = (_arg3 / mCellHeight); _arg1.mCellCol = (_arg2 / mCellWidth); _arg1.mCellIndex = ((_arg1.mCellRow * mCellCols) + _arg1.mCellCol); mCellBoxes[_arg1.mCellIndex] = _arg1; mCellValues[_arg1.mCellIndex] = (mCellValues[_arg1.mCellIndex] | PhyFlag_Box); } public static function GetCellBox(_arg1:int, _arg2:int):BoxActor{ if ((((((((_arg1 < 0)) || ((_arg1 >= mCellRows)))) || ((_arg2 < 0)))) || ((_arg2 >= mCellCols)))){ return (null); }; return (mCellBoxes[((_arg1 * mCellCols) + _arg2)]); } public static function NotifyBoxPhyPosModified(_arg1:BoxActor, _arg2:int, _arg3:int):void{ RemoveBox(_arg1); PutBoxAt(_arg1, _arg2, _arg3); } } }//package game.generalSection 49//SoundPlayer (game.general.SoundPlayer) package game.general { import flash.media.*; import engine.*; public class SoundPlayer { private static var sSoundOn:Boolean = true; public static function StopAllSounds():void{ SoundMixer.stopAll(); } public static function SetSoundOnOff(_arg1:Boolean):void{ sSoundOn = _arg1; if (!sSoundOn){ StopAllSounds(); }; } public static function IsSoundOn():Boolean{ return (sSoundOn); } public static function SwitchSoundOnOff():void{ SetSoundOnOff(!(sSoundOn)); } public static function PlaySoundByFilePath(_arg1:String, _arg2:Boolean):void{ if (!sSoundOn){ return; }; var _local3:Sound = (Engine.GetDataAsset(_arg1) as Sound); if (((((!((_local3 == null))) && ((_local3.bytesTotal > 0)))) && ((_local3.bytesLoaded >= _local3.bytesTotal)))){ _local3.play(0, (_arg2) ? 2147483647 : 0); }; } } }//package game.generalSection 50//Level (game.level.Level) package game.level { import flash.display.*; import game.*; import flash.utils.*; import engine.asset.*; import game.actor.*; import game.state.*; import game.res.*; import game.general.*; public class Level extends Sprite implements GameEntity { private const AutoChangeTargetDuration:int = 200; private var mChangeTargetStartTime:Number; public var mInFalling:Boolean; public var mInChangeTargetMode:Boolean; private var mFlipSteps:uint;// = 0 public var mInTelporting:Boolean; private var mPlayfieldHeight:uint; public var mInTelportPreparing:Boolean; public var mActorsCount:int; public var mActors:Array; private var mPlayfieldWidth:uint; private var mManualChangeTargetStarted:Boolean; public var mInRolling:Boolean; private var mFinished:Boolean;// = false public static const LayerID_TelportBoxActors:uint = _LayerID++; public static const LayerID_Background:uint = _LayerID++; public static const LayerID_TutorialActors:uint = _LayerID++; public static const LayerID_BackgroundSurface:uint = _LayerID++; public static const LayersCount:uint = _LayerID++; public static const LayerID_BoxActors:uint = _LayerID++; public static var _LayerID:uint = 0; public function Level(){ CreateDisplayLayers(); } public function Load(_arg1:String, _arg2:ByteArray):void{ var _local6:ActorDefine; var _local7:ActorTemplate; var _local8:int; var _local9:int; var _local10:Actor; var _local3:LevelDefine = new LevelDefine(_arg1); _local3.Load(_arg2); mPlayfieldWidth = _local3.mPlayfieldWidth; mPlayfieldHeight = _local3.mPlayfieldHeight; var _local4:Array = _local3.mActorDefines; mActorsCount = _local4.length; mActors = new Array(mActorsCount); var _local5:int; while (_local5 < mActorsCount) { _local6 = _local4[_local5]; trace(((("actor id = " + _local5) + ", actorDefine = ") + _local6)); _local7 = _local6.mTemplate; _local8 = _local7.mInstanceActorType; if (_local8 != kDefines.ActorType_general){ } else { _local9 = _local7.mTemplateID; _local10 = null; switch (_local9){ case kTemplate.TemplateID_map: _local10 = new BackgroundActor(this); break; case kTemplate.TemplateID_square_target_0: case kTemplate.TemplateID_square_target_1: case kTemplate.TemplateID_square_target_2: case kTemplate.TemplateID_square_target_3: case kTemplate.TemplateID_square_target_4: case kTemplate.TemplateID_square_target_5: case kTemplate.TemplateID_square_target_6: case kTemplate.TemplateID_square_target_7: _local10 = new BoxTarget(this); break; case kTemplate.TemplateID_square_telport_0: case kTemplate.TemplateID_square_telport_1: _local10 = new BoxTelport(this); break; case kTemplate.TemplateID_square_general_0: case kTemplate.TemplateID_square_general_1: case kTemplate.TemplateID_square_general_2: case kTemplate.TemplateID_square_general_3: case kTemplate.TemplateID_square_general_4: case kTemplate.TemplateID_square_general_5: case kTemplate.TemplateID_square_general_6: case kTemplate.TemplateID_square_general_7: case kTemplate.TemplateID_square_general_8: case kTemplate.TemplateID_square_general_9: _local10 = new BoxActor(this); break; case kTemplate.TemplateID_tutorial: _local10 = new TutorialActor(this); break; default: break; }; mActors[_local5] = _local10; if (_local10 != null){ _local10.SetIndex(_local5); _local10.LoadFromDefine(_local6); }; }; _local5++; }; } public function IncFlipSteps():void{ mFlipSteps++; } public function AddDisplayObject(_arg1:uint, _arg2:DisplayObject):void{ trace(((("level: add object, layerID = " + _arg1) + ", object = ") + _arg2)); var _local3:Sprite = (getChildAt(_arg1) as Sprite); if (_local3 != null){ _local3.addChild(_arg2); }; } public function GetFlipSteps():uint{ return (mFlipSteps); } private function TryToAutoChangeTargetBox():void{ var _local1:BoxActor; if (BoxActor.sTargetBoxActor == null){ return; }; var _local2:int = BoxActor.sTargetBoxActor.mCellIndex; var _local3:int; while (_local3 < (MapAnalyzer.mCellBoxes.length - 1)) { _local2++; if (_local2 >= MapAnalyzer.mCellBoxes.length){ _local2 = (_local2 - MapAnalyzer.mCellBoxes.length); }; _local1 = (MapAnalyzer.mCellBoxes[_local2] as BoxActor); if (((!((_local1 == null))) && (_local1.Rolledable()))){ BoxActor.SetTargetBoxActor(_local1); break; }; _local3++; }; } private function UndoOneStep():void{ var _local2:int; var _local3:Actor; var _local4:BoxActor; var _local6:Array; var _local7:int; var _local1:LevelStatusInfo = LevelStatusInfo.PopAutoSavedLevelHistoryStatusInfo(); if (_local1 == null){ return; }; mFlipSteps = _local1.mTimeStep; _local2 = 0; while (_local2 < mActorsCount) { _local3 = (mActors[_local2] as Actor); if ((_local3 is BoxActor)){ _local4 = (_local3 as BoxActor); MapAnalyzer.RemoveBox(_local4); }; _local2++; }; var _local5:Array = _local1.mBoxActorsInfo; _local2 = 0; while (_local2 < _local5.length) { _local6 = _local5[_local2]; if (_local6 == null){ } else { _local3 = (mActors[_local2] as Actor); if ((!(_local3) is BoxActor)){ trace("somewhere wrong"); } else { _local4 = (_local3 as BoxActor); _local7 = 0; var _temp1 = _local7; _local7 = (_local7 + 1); var _temp2 = _local7; _local7 = (_local7 + 1); _local4.SetDisplayPos(_local6[_temp1], _local6[_temp2]); _local4.SyncPhyPosWithDisplayPos(); var _temp3 = _local7; _local7 = (_local7 + 1); _local4.rotation = _local6[_temp3]; _local4.SyncDirWithRotation(); var _temp4 = _local7; _local7 = (_local7 + 1); _local4.mModel.x = _local6[_temp4]; var _temp5 = _local7; _local7 = (_local7 + 1); _local4.mModel.y = _local6[_temp5]; var _temp6 = _local7; _local7 = (_local7 + 1); _local4.mTargetStar.x = _local6[_temp6]; var _temp7 = _local7; _local7 = (_local7 + 1); _local4.mTargetStar.y = _local6[_temp7]; var _temp8 = _local7; _local7 = (_local7 + 1); if (_local6[_temp8]){ BoxActor.SetTargetBoxActor(_local4); _local4.mTargetStar.visible = true; _local4.UpdateTargetStar(); } else { _local4.mTargetStar.visible = false; }; _local4.ChangeState(BoxActor.State_Resting); }; }; _local2++; }; } public function Initialize():void{ var _local2:Actor; mInChangeTargetMode = false; BoxActor.SetTargetBoxActor(null); var _local1:int; while (_local1 < mActorsCount) { _local2 = (mActors[_local1] as Actor); _local2.Initialize(); _local1++; }; LevelStatusInfo.ClearLevelHistoryInfos(); stage.focus = this; stage.focus = null; } private function RegisterActorState(_arg1:Actor):void{ var _local2:BoxActor; if ((_arg1 is BoxActor)){ _local2 = (_arg1 as BoxActor); if (_local2.mState == BoxActor.State_Rolling){ mInRolling = true; } else { if (_local2.mState == BoxActor.State_Falling){ mInFalling = true; } else { if (_local2.mState == BoxTelport.State_TelportProgress){ mInTelporting = true; } else { if (_local2.mState == BoxTelport.State_TelportOut){ mInTelportPreparing = true; }; }; }; }; }; } public function ResetFlipSteps():void{ mFlipSteps = 0; } public function SetFinished(_arg1:Boolean):void{ mFinished = _arg1; } private function TryToChangeTargetBox():void{ var _local2:int; var _local3:int; var _local4:int; var _local5:int; var _local6:int; var _local7:BoxActor; var _local8:int; var _local9:int; var _local10:int; if (BoxActor.sTargetBoxActor == null){ return; }; var _local1:int; if (((KeyInput.mDownKeyPressed) || (KeyInput.mUpKeyPressed))){ if (KeyInput.mDownKeyPressed){ _local1 = 1; } else { _local1 = -1; }; _local8 = BoxActor.sTargetBoxActor.x; _local9 = BoxActor.sTargetBoxActor.y; _local3 = BoxActor.sTargetBoxActor.mCellRow; _local2 = 0; while (_local2 < (MapAnalyzer.mCellRows - 1)) { _local3 = (_local3 + _local1); if (_local3 < 0){ _local3 = (_local3 + MapAnalyzer.mCellRows); }; if (_local3 >= MapAnalyzer.mCellRows){ _local3 = (_local3 - MapAnalyzer.mCellRows); }; _local6 = 1000000; _local4 = 0; while (_local4 < MapAnalyzer.mCellCols) { _local7 = (MapAnalyzer.GetCellBox(_local3, _local4) as BoxActor); if (((!((_local7 == null))) && (_local7.Rolledable()))){ _local5 = (Math.abs((_local7.x - _local8)) + Math.abs((_local7.y - _local9))); if (_local5 < _local6){ _local6 = _local5; BoxActor.SetTargetBoxActor(_local7); mChangeTargetStartTime = 0; }; }; _local4++; }; if (_local6 < 1000000){ break; }; _local2++; }; } else { if (((KeyInput.mLeftKeyPressed) || (KeyInput.mRightKeyPressed))){ if (KeyInput.mRightKeyPressed){ _local1 = 1; } else { _local1 = -1; }; _local6 = 1000000; _local3 = BoxActor.sTargetBoxActor.mCellRow; _local4 = BoxActor.sTargetBoxActor.mCellCol; _local10 = ((_local1 > 0)) ? ((MapAnalyzer.mCellCols - _local4) - 1) : _local4; _local2 = 0; while (_local2 < _local10) { _local4 = (_local4 + _local1); if (_local4 < 0){ _local4 = (_local4 + MapAnalyzer.mCellCols); }; if (_local4 >= MapAnalyzer.mCellCols){ _local4 = (_local4 - MapAnalyzer.mCellCols); }; _local7 = (MapAnalyzer.GetCellBox(_local3, _local4) as BoxActor); if (((!((_local7 == null))) && (_local7.Rolledable()))){ BoxActor.SetTargetBoxActor(_local7); _local6 = 0; mChangeTargetStartTime = 0; break; }; _local2++; }; if (_local6 > 0){ _local8 = BoxActor.sTargetBoxActor.x; _local9 = BoxActor.sTargetBoxActor.y; _local4 = BoxActor.sTargetBoxActor.mCellCol; _local2 = 0; while (_local2 < (MapAnalyzer.mCellCols - 1)) { _local4 = (_local4 + _local1); if (_local4 < 0){ _local4 = (_local4 + MapAnalyzer.mCellCols); }; if (_local4 >= MapAnalyzer.mCellCols){ _local4 = (_local4 - MapAnalyzer.mCellCols); }; _local6 = 1000000; _local3 = 0; while (_local3 < MapAnalyzer.mCellRows) { _local7 = (MapAnalyzer.GetCellBox(_local3, _local4) as BoxActor); if (((!((_local7 == null))) && (_local7.Rolledable()))){ _local5 = (Math.abs((_local7.x - _local8)) + Math.abs((_local7.y - _local9))); if (_local5 < _local6){ _local6 = _local5; BoxActor.SetTargetBoxActor(_local7); mChangeTargetStartTime = 0; }; }; _local3++; }; if (_local6 < 1000000){ break; }; _local2++; }; }; }; }; KeyInput.mDownKeyPressed = false; KeyInput.mUpKeyPressed = false; KeyInput.mLeftKeyPressed = false; KeyInput.mRightKeyPressed = false; } public function IsFinished():Boolean{ return (mFinished); } public function RemoveDisplayObject(_arg1:uint, _arg2:DisplayObject):void{ trace(((("level: remove object, layerID = " + _arg1) + ", object = ") + _arg2)); var _local3:Sprite = (getChildAt(_arg1) as Sprite); if (_local3 != null){ _local3.removeChild(_arg2); }; } private function UpdateBoxeTargetStars():void{ var _local2:Actor; var _local3:BoxActor; var _local1:int; while (_local1 < mActorsCount) { _local2 = (mActors[_local1] as Actor); if ((_local2 is BoxActor)){ _local3 = (_local2 as BoxActor); _local3.mTargetStar.visible = ((_local3 == BoxActor.sTargetBoxActor)) ? true : (_local3.Rolledable()) ? mInChangeTargetMode : false; if (_local3 != BoxActor.sTargetBoxActor){ _local3.mTargetStar.rotation = 0; }; _local3.UpdateTargetStar(); }; _local1++; }; } private function CreateDisplayLayers():void{ var _local1:uint; while (_local1 < LayersCount) { addChild(new Sprite()); _local1++; }; } public function Destroy():void{ var _local2:Actor; var _local1:int; while (_local1 < mActorsCount) { _local2 = (mActors[_local1] as Actor); _local2.Destroy(); _local1++; }; BoxActor.sTargetBoxActor = null; } public function GetActorAt(_arg1:uint):Actor{ if (_arg1 < mActors.length){ return (mActors[_arg1]); }; return (null); } public function GetPlayfieldWidth():uint{ return (mPlayfieldWidth); } public function GetPlayfieldHeight():uint{ return (mPlayfieldHeight); } public function Update(_arg1:Number):void{ var _local2:BoxActor; var _local4:int; var _local5:Actor; if (IsFinished()){ _local4 = 0; while (_local4 < mActorsCount) { _local5 = (mActors[_local4] as Actor); if ((_local5 is BoxTarget)){ (_local5 as BoxTarget).Update(_arg1); }; _local4++; }; return; }; var _local3:Boolean = KeyInput.mChangeTargetKeyPressed; if (mInChangeTargetMode != _local3){ mInChangeTargetMode = _local3; if (_local3){ mChangeTargetStartTime = getTimer(); mManualChangeTargetStarted = false; } else { if ((getTimer() - mChangeTargetStartTime) < AutoChangeTargetDuration){ TryToAutoChangeTargetBox(); }; mChangeTargetStartTime = 0; }; if (!_local3){ UpdateBoxeTargetStars(); }; }; if (((!((BoxActor.sTargetBoxActor == null))) && (!(KeyInput.sIsDeactived)))){ BoxActor.sTargetBoxActor.mTargetStar.UpdateAnimation(_arg1); }; if (((mInChangeTargetMode) && (((getTimer() - mChangeTargetStartTime) >= AutoChangeTargetDuration)))){ if (!mManualChangeTargetStarted){ mManualChangeTargetStarted = true; UpdateBoxeTargetStars(); }; TryToChangeTargetBox(); return; }; if (GameState_Level.sNeedUndo){ GameState_Level.sNeedUndo = false; UndoOneStep(); return; }; SetFinished(true); mInTelportPreparing = false; mInTelporting = false; mInFalling = false; mInRolling = false; _local4 = 0; while (_local4 < mActorsCount) { _local5 = (mActors[_local4] as Actor); RegisterActorState(_local5); _local4++; }; _local4 = 0; while (_local4 < mActorsCount) { _local5 = (mActors[_local4] as Actor); _local5.Update(_arg1); _local4++; }; _local4 = 0; while (_local4 < mActorsCount) { _local5 = (mActors[_local4] as Actor); RegisterActorState(_local5); _local4++; }; if (((!(mInRolling)) && (!(mInTelporting)))){ _local4 = 0; while (_local4 < mActorsCount) { _local5 = (mActors[_local4] as Actor); if ((_local5 is BoxActor)){ if ((_local5 as BoxActor).TryToStartFalling()){ RegisterActorState(_local5); }; }; _local4++; }; }; if (((((((!(mInRolling)) && (!(mInFalling)))) && (!(mInTelporting)))) && (!(mInTelportPreparing)))){ _local4 = 0; while (_local4 < mActorsCount) { _local5 = (mActors[_local4] as Actor); if ((_local5 is BoxTelport)){ if ((_local5 as BoxTelport).TryToStartTelporting()){ RegisterActorState(_local5); }; if (((mInTelporting) || (mInTelportPreparing))){ break; }; }; _local4++; }; }; if (((((!(mInTelporting)) && (!(mInFalling)))) && (!(mInRolling)))){ _local4 = 0; while (_local4 < mActorsCount) { _local5 = (mActors[_local4] as Actor); if ((_local5 is BoxActor)){ if ((_local5 as BoxActor).TryToStartRolling()){ RegisterActorState(_local5); }; if (mInRolling){ break; }; }; _local4++; }; }; } } }//package game.levelSection 51//LevelStatusInfo (game.level.LevelStatusInfo) package game.level { import game.actor.*; public class LevelStatusInfo { public var mBoxActorsInfo:Array; public var mTimeStep:int; public static var sAutoSavedLevelHistoryStatusInfos:Array; public static var sNumAutoSavedLevelHistoryStatusInfos:int = 0; public function LevelStatusInfo(_arg1:Level){ var _local3:Actor; var _local4:Array; var _local5:BoxActor; var _local6:int; super(); mTimeStep = _arg1.GetFlipSteps(); mBoxActorsInfo = new Array(_arg1.mActorsCount); var _local2:int; while (_local2 < _arg1.mActorsCount) { _local3 = (_arg1.mActors[_local2] as Actor); if ((_local3 is BoxActor)){ _local4 = new Array(10); mBoxActorsInfo[_local2] = _local4; _local5 = (_local3 as BoxActor); _local6 = 0; var _temp1 = _local6; _local6 = (_local6 + 1); var _local7 = _temp1; _local4[_local7] = _local5.x; var _temp2 = _local6; _local6 = (_local6 + 1); var _local8 = _temp2; _local4[_local8] = _local5.y; var _temp3 = _local6; _local6 = (_local6 + 1); var _local9 = _temp3; _local4[_local9] = _local5.rotation; var _temp4 = _local6; _local6 = (_local6 + 1); var _local10 = _temp4; _local4[_local10] = _local5.mModel.x; var _temp5 = _local6; _local6 = (_local6 + 1); var _local11 = _temp5; _local4[_local11] = _local5.mModel.y; var _temp6 = _local6; _local6 = (_local6 + 1); var _local12 = _temp6; _local4[_local12] = _local5.mTargetStar.x; var _temp7 = _local6; _local6 = (_local6 + 1); var _local13 = _temp7; _local4[_local13] = _local5.mTargetStar.y; var _temp8 = _local6; _local6 = (_local6 + 1); var _local14 = _temp8; _local4[_local14] = (_local5 == BoxActor.sTargetBoxActor); }; _local2++; }; } public static function PopAutoSavedLevelHistoryStatusInfo():LevelStatusInfo{ if (sNumAutoSavedLevelHistoryStatusInfos <= 0){ return (null); }; sNumAutoSavedLevelHistoryStatusInfos--; return (sAutoSavedLevelHistoryStatusInfos[sNumAutoSavedLevelHistoryStatusInfos]); } public static function AddAutoSavedLevelHistoryStatusInfo(_arg1:LevelStatusInfo):void{ var _local2 = sNumAutoSavedLevelHistoryStatusInfos++; sAutoSavedLevelHistoryStatusInfos[_local2] = _arg1; } public static function ClearLevelHistoryInfos():void{ var _local1:int; sNumAutoSavedLevelHistoryStatusInfos = 0; if ((((sAutoSavedLevelHistoryStatusInfos == null)) || ((sAutoSavedLevelHistoryStatusInfos.length > 1000)))){ sAutoSavedLevelHistoryStatusInfos = new Array(1000); } else { _local1 = 0; while (_local1 < sAutoSavedLevelHistoryStatusInfos.length) { sAutoSavedLevelHistoryStatusInfos[_local1] = null; _local1++; }; }; } } }//package game.levelSection 52//kDefines (game.res.kDefines) package game.res { public class kDefines { public static const PropertyType_string:int = 1; public static const PropertyType_boolean:int = 4; public static const FileType_ImageFile:int = 0; public static const PropertyType_items:int = 2; public static const FileType_SoundFile:int = 4; public static const ActorType_general:int = 0; public static const AppearanceType_background2d:int = 1; public static const FileType_Sprite2dFile:int = 1; public static const PropertyType_entity_ref:int = 3; public static const AppearanceType_box2d:int = 2; public static const FileType_DefineFile:int = 2; public static const PropertyType_number:int = 0; public static const FileType_LevelFile:int = 3; public static const AppearanceType_sprite2d:int = 0; } }//package game.resSection 53//kTemplate (game.res.kTemplate) package game.res { public class kTemplate { public static const ICP_square_general_2_Actor_Link:int = 3; public static const Appearance_square_target_0_zone:int = 1; public static const Appearance_square_target_0_main:int = 0; public static const Appearance_square_general_4_main:int = 0; public static const Appearance_map_main:int = 0; public static const ICP_square_general_6_IsTelport:int = 0; public static const Appearance_square_general_1_main:int = 0; public static const ICP_square_general_5_Actor_Link:int = 3; public static const ICP_square_telport_0_Param1:int = 2; public static const ICP_square_telport_0_Param0:int = 1; public static const ICP_square_general_8_Actor_Link:int = 3; public static const ICP_square_general_5_Param0:int = 1; public static const ICP_square_general_5_Param1:int = 2; public static const Appearance_thin_wall_switch_zone:int = 0; public static const ICP_square_general_1_IsTelport:int = 0; public static const Appearance_square_target_7_zone:int = 1; public static const ICP_square_general_9_IsTelport:int = 0; public static const Appearance_square_target_7_main:int = 0; public static const TemplateID_thin_wall_switch:int = 23; public static const Appearance_square_target_4_zone:int = 1; public static const ICP_square_general_3_Param0:int = 1; public static const Appearance_square_general_8_main:int = 0; public static const ICP_square_general_3_Param1:int = 2; public static const ICP_square_telport_1_IsTelport:int = 0; public static const Appearance_square_target_4_main:int = 0; public static const ICP_square_general_4_IsTelport:int = 0; public static const Appearance_square_target_1_zone:int = 1; public static const ICP_square_general_1_Actor_Link:int = 3; public static const Appearance_square_target_1_main:int = 0; public static const Appearance_square_general_5_main:int = 0; public static const ICP_square_general_4_Actor_Link:int = 3; public static const ICP_square_general_1_Param0:int = 1; public static const ICP_square_general_1_Param1:int = 2; public static const Appearance_square_general_2_main:int = 0; public static const Appearance_square_telport_0_main:int = 0; public static const ICP_square_general_8_Param0:int = 1; public static const ICP_square_general_8_Param1:int = 2; public static const TemplateID_square_target_2:int = 3; public static const TemplateID_square_target_3:int = 4; public static const TemplateID_square_target_4:int = 5; public static const TemplateID_square_target_5:int = 6; public static const TemplateID_square_target_6:int = 7; public static const TemplateID_square_target_0:int = 1; public static const TemplateID_square_target_1:int = 2; public static const ICP_square_general_7_Actor_Link:int = 3; public static const TemplateID_square_target_7:int = 8; public static const Appearance_thin_wall_h_zone:int = 0; public static const ICP_square_telport_1_Actor_Link:int = 3; public static const ICP_square_general_7_IsTelport:int = 0; public static const TemplateID_square_telport_0:int = 19; public static const TemplateID_square_telport_1:int = 20; public static const ICP_square_telport_1_Param0:int = 1; public static const ICP_square_telport_1_Param1:int = 2; public static const ICP_square_general_2_IsTelport:int = 0; public static const ICP_thin_wall_switch_Actor_Link:int = 0; public static const ICP_square_general_6_Param0:int = 1; public static const Appearance_square_target_5_zone:int = 1; public static const ICP_square_general_6_Param1:int = 2; public static const TemplateID_tutorial:int = 24; public static const Appearance_square_target_5_main:int = 0; public static const Appearance_square_general_9_main:int = 0; public static const Appearance_square_target_2_zone:int = 1; public static const ICP_square_general_0_Actor_Link:int = 3; public static const Appearance_square_target_2_main:int = 0; public static const Appearance_square_general_6_main:int = 0; public static const TemplateID_map:int = 0; public static const ICP_thin_wall_v_Vertical:int = 0; public static const ICP_square_general_5_IsTelport:int = 0; public static const ICP_square_general_4_Param0:int = 1; public static const ICP_square_general_4_Param1:int = 2; public static const ICP_square_general_3_Actor_Link:int = 3; public static const Appearance_square_general_3_main:int = 0; public static const Appearance_square_telport_1_main:int = 0; public static const Appearance_tutorial_zone:int = 0; public static const ICP_square_general_6_Actor_Link:int = 3; public static const ICP_tutorial_Text:int = 1; public static const Appearance_square_general_0_main:int = 0; public static const TemplateID_thin_wall_h:int = 22; public static const ICP_square_general_0_IsTelport:int = 0; public static const ICP_square_telport_0_Actor_Link:int = 3; public static const ICP_square_general_9_Actor_Link:int = 3; public static const ICP_square_general_8_IsTelport:int = 0; public static const TemplateID_thin_wall_v:int = 21; public static const Appearance_thin_wall_v_zone:int = 0; public static const ICP_square_general_2_Param0:int = 1; public static const ICP_square_general_2_Param1:int = 2; public static const ICP_thin_wall_h_Vertical:int = 0; public static const ICP_tutorial_Type:int = 0; public static const ICP_square_general_9_Param0:int = 1; public static const TemplateID_square_general_0:int = 9; public static const TemplateID_square_general_2:int = 11; public static const TemplateID_square_general_3:int = 12; public static const TemplateID_square_general_5:int = 14; public static const ICP_square_telport_0_IsTelport:int = 0; public static const TemplateID_square_general_7:int = 16; public static const TemplateID_square_general_1:int = 10; public static const TemplateID_square_general_9:int = 18; public static const Appearance_square_target_6_zone:int = 1; public static const TemplateID_square_general_4:int = 13; public static const TemplateID_square_general_6:int = 15; public static const TemplateID_square_general_8:int = 17; public static const ICP_square_general_9_Param1:int = 2; public static const ICP_square_general_3_IsTelport:int = 0; public static const Appearance_square_target_3_zone:int = 1; public static const Appearance_square_target_6_main:int = 0; public static const ICP_square_general_0_Param0:int = 1; public static const ICP_square_general_0_Param1:int = 2; public static const Appearance_square_general_7_main:int = 0; public static const Appearance_square_target_3_main:int = 0; public static const ICP_square_general_7_Param0:int = 1; public static const ICP_square_general_7_Param1:int = 2; } }//package game.resSection 54//GameState_Level (game.state.GameState_Level) package game.state { import flash.events.*; import flash.display.*; import game.*; import flash.text.*; import flash.utils.*; import engine.asset.*; import game.level.*; import game.display.*; import engine.*; import engine.display.*; import game.general.*; import flash.net.*; public class GameState_Level extends GameState { private var mInfoText:TextField; private var mFlipSteps:uint;// = 0 private var mStateTicker:int; private var mHelpMenu:TextField; private var mLevel:Level; private var mTopBlackBar:Shape; private var mRestartMenu:TextField; private var mState:int;// = 0 private var mExitMenu:TextField; private var mBottomBlackBar:Shape; private var mUndoMenu:TextField; private var mEntityContainer:Sprite; private var mBlackBarMinHeight:uint;// = 23 private var mBackground:Shape; private static const State_OpenScreen:int = 0; private static const AnimID_SoundOff:int = 5; private static const State_CloseScreen:int = 2; private static const State_InGame:int = 1; private static const State_ShowGameFinished:int = 5; private static const State_ShowLevelFinished:int = 3; private static const AnimID_SoundOn:int = 4; private static var sGameFinishedSprite:DialogBox; private static var sHtmlTextButton_TapirGamesBr:HtmlTextButton = null; private static var sLevelFinishedSprite:DialogBox; private static var sIconSoundOff:Sprite2dModelInstance; public static var sHtmlTextButton_TapirGames:HtmlTextButton = null; public static var sHtmlTextButton_MyDailyGameLogo:LogoButton = null; private static var sHtmlTextButton_MainMenuBr:HtmlTextButton = null; public static var sNeedRestart:Boolean; private static var sHtmlTextButton_TapirGamesLink:HtmlTextButton = null; public static var sNeedUndo:Boolean; private static var sSoundButton:SimpleButton; private static var sIconSoundOn:Sprite2dModelInstance; private static var sHelpDialog:DialogBox; public function GameState_Level(_arg1:Game){ super(_arg1); } private function LoadCurrentLevel():void{ if (mLevel != null){ mLevel.Destroy(); mEntityContainer.removeChild(mLevel); }; mLevel = new Level(); var _local1:String = (Game.sLevelFilePaths[Game.sCurrentLevelIndex] as String); var _local2:ByteArray = (Engine.GetDataAsset(_local1) as ByteArray); _local2.position = 0; mLevel.Load(_local1, _local2); mEntityContainer.addChildAt(mLevel, 0); mLevel.Initialize(); mLevel.x = ((mGame.stage.stageWidth - mLevel.GetPlayfieldWidth()) / 2); mLevel.y = ((mGame.stage.stageHeight - mLevel.GetPlayfieldHeight()) / 2); sNeedRestart = false; sNeedUndo = false; } override public function Update(_arg1:Number):void{ var _local3:String; mStateTicker++; var _local2:Number = 0.025; switch (mState){ case State_OpenScreen: mTopBlackBar.scaleY = (mTopBlackBar.scaleY - _local2); mBottomBlackBar.scaleY = (mBottomBlackBar.scaleY - _local2); if ((((mTopBlackBar.height <= mBlackBarMinHeight)) && ((mBottomBlackBar.height <= mBlackBarMinHeight)))){ mTopBlackBar.height = (mBottomBlackBar.height = mBlackBarMinHeight); AddOtherEntities(); ChangeState(State_InGame); }; break; case State_CloseScreen: mTopBlackBar.scaleY = (mTopBlackBar.scaleY + _local2); mBottomBlackBar.scaleY = (mBottomBlackBar.scaleY + _local2); if ((((mTopBlackBar.scaleY >= 1)) && ((mBottomBlackBar.scaleY >= 1)))){ sLevelFinishedSprite.visible = false; sGameFinishedSprite.visible = false; mGame.SetNextGameStateID(Game.k_GameState_MainMenu); }; break; case State_InGame: if (sNeedRestart){ LoadCurrentLevel(); return; }; mLevel.Update(_arg1); if (mFlipSteps != mLevel.GetFlipSteps()){ mFlipSteps = mLevel.GetFlipSteps(); mInfoText.text = ("Rolls: " + mFlipSteps); }; if (mLevel.IsFinished()){ Game.NotifyLevelFinished(); SoundPlayer.PlaySoundByFilePath("finished.mp3", false); if (Game.sCurrentLevelIndex < (Game.sLevelFilePaths.length - 1)){ ChangeState(State_ShowLevelFinished); sLevelFinishedSprite.visible = true; sLevelFinishedSprite.alpha = 0; } else { ChangeState(State_ShowGameFinished); sGameFinishedSprite.visible = true; sGameFinishedSprite.alpha = 0; sHtmlTextButton_MainMenuBr.visible = true; sHtmlTextButton_MainMenuBr.alpha = 0; sHtmlTextButton_TapirGamesBr.visible = true; sHtmlTextButton_TapirGamesBr.alpha = 0; }; _local3 = (Game.sLevelFilePaths[Game.sCurrentLevelIndex] as String); }; break; case State_ShowLevelFinished: mLevel.Update(_arg1); sLevelFinishedSprite.alpha = (sLevelFinishedSprite.alpha + 0.02); if (sLevelFinishedSprite.alpha > 1){ sLevelFinishedSprite.alpha = 1; }; if (mStateTicker > 60){ GoToMainMenu(); }; break; case State_ShowGameFinished: mLevel.Update(_arg1); sGameFinishedSprite.alpha = (sGameFinishedSprite.alpha + 0.02); sHtmlTextButton_MainMenuBr.alpha = (sHtmlTextButton_MainMenuBr.alpha + 0.02); sHtmlTextButton_TapirGamesBr.alpha = (sHtmlTextButton_TapirGamesBr.alpha + 0.02); if (sGameFinishedSprite.alpha >= 1){ sGameFinishedSprite.alpha = 1; }; break; }; } private function ChangeState(_arg1:int):void{ mStateTicker = 0; mState = _arg1; } private function AddOtherEntities():void{ mEntityContainer.addChild(mExitMenu); mEntityContainer.addChild(mHelpMenu); mEntityContainer.addChild(mRestartMenu); mEntityContainer.addChild(mUndoMenu); mEntityContainer.addChild(sSoundButton); mEntityContainer.addChild(mInfoText); mEntityContainer.addChild(sHtmlTextButton_TapirGamesLink); } private function OnMenuMouseOut(_arg1:MouseEvent):void{ var _local2:TextField = (_arg1.target as TextField); _local2.background = false; _local2.textColor = 0xFFFF00; } private function GoToMainMenu():void{ mEntityContainer.removeChild(mExitMenu); mEntityContainer.removeChild(mHelpMenu); mEntityContainer.removeChild(mRestartMenu); mEntityContainer.removeChild(mUndoMenu); mEntityContainer.removeChild(sSoundButton); mEntityContainer.removeChild(mInfoText); sHtmlTextButton_MainMenuBr.removeEventListener(MouseEvent.CLICK, OnClickMainMenu); mEntityContainer.removeChild(sHtmlTextButton_TapirGamesLink); ChangeState(State_CloseScreen); GameState_MainMenu.RefreshClickAwayAd(); } private function AddGameFinishedSprite():void{ if (sGameFinishedSprite == null){ sGameFinishedSprite = new DialogBox(); sGameFinishedSprite.SetText(Config.kGameFinishedText, true); sGameFinishedSprite.SetCached(true); sGameFinishedSprite.SetBackgroundVisible(false); sGameFinishedSprite.alpha = 1; sGameFinishedSprite.Rebuild(); sGameFinishedSprite.x = ((mGame.stage.stageWidth - sGameFinishedSprite.width) / 2); sGameFinishedSprite.y = (136 - (sGameFinishedSprite.height / 2)); }; sGameFinishedSprite.visible = false; mEntityContainer.addChild(sGameFinishedSprite); } override public function Initialize():void{ mBackground = new Shape(); mBackground.graphics.beginFill(0xFFFFFF); mBackground.graphics.lineStyle(0, 0xFFFFFF); mBackground.graphics.drawRect(0, 0, mGame.stage.stageWidth, mGame.stage.stageHeight); mBackground.graphics.endFill(); mGame.addChild(mBackground); mEntityContainer = new Sprite(); mGame.addChild(mEntityContainer); LoadCurrentLevel(); AddGameFinishedSprite(); AddHelpDialog(); AddLevelFinishedSprite(); AddSoundButton(); AddHtmlTextButtons(); mTopBlackBar = new Shape(); mTopBlackBar.graphics.beginFill(0); mTopBlackBar.graphics.lineStyle(0, 0); mTopBlackBar.graphics.drawRect(0, 0, mGame.stage.stageWidth, (mGame.stage.stageHeight / 2)); mTopBlackBar.graphics.endFill(); mEntityContainer.addChild(mTopBlackBar); mBottomBlackBar = new Shape(); mBottomBlackBar.graphics.beginFill(0); mBottomBlackBar.graphics.lineStyle(0, 0); mBottomBlackBar.graphics.drawRect(0, (-(mGame.stage.stageHeight) / 2), mGame.stage.stageWidth, (mGame.stage.stageHeight / 2)); mBottomBlackBar.graphics.endFill(); mBottomBlackBar.y = mGame.stage.stageHeight; mEntityContainer.addChild(mBottomBlackBar); mExitMenu = CreateMenuText(" Exit ", true); mExitMenu.x = 3; mExitMenu.y = 1; mHelpMenu = CreateMenuText(" Help ", true); mHelpMenu.x = ((mExitMenu.x + mExitMenu.width) + 10); mHelpMenu.y = 1; mRestartMenu = CreateMenuText(" Restart ", true); mRestartMenu.x = ((mTopBlackBar.width - mRestartMenu.width) - 3); mRestartMenu.y = 1; mUndoMenu = CreateMenuText(" Undo ", true); mUndoMenu.x = ((mRestartMenu.x - mUndoMenu.width) - 3); mUndoMenu.y = 1; mInfoText = CreateMenuText("Rolls: 0", false); mInfoText.x = 3; mInfoText.y = ((mBottomBlackBar.y - mInfoText.height) - 1); ChangeState(State_OpenScreen); } private function OnMenuMouseOver(_arg1:MouseEvent):void{ var _local2:TextField = (_arg1.target as TextField); _local2.background = true; _local2.backgroundColor = 14540287; _local2.textColor = 0; } private function ToggleSoundOnOff(_arg1:MouseEvent):void{ SoundPlayer.SwitchSoundOnOff(); UpdateSoundButton(); PlayBackgroundSound(); } private function AddHelpDialog():void{ if (sHelpDialog == null){ sHelpDialog = new DialogBox(); sHelpDialog.SetText(Config.kHelpDialogText, true); sHelpDialog.SetCached(false); sHelpDialog.SetBackgroundVisible(true); sHelpDialog.alpha = 0.9; sHelpDialog.Rebuild(); sHelpDialog.x = ((mGame.stage.stageWidth - sHelpDialog.width) / 2); sHelpDialog.y = ((mGame.stage.stageHeight - sHelpDialog.height) / 2); }; sHelpDialog.visible = false; mEntityContainer.addChild(sHelpDialog); } private function UpdateSoundButton():void{ if (SoundPlayer.IsSoundOn()){ sSoundButton.upState = sIconSoundOn; sSoundButton.downState = sIconSoundOn; sSoundButton.overState = sIconSoundOn; sSoundButton.hitTestState = sIconSoundOn; } else { sSoundButton.upState = sIconSoundOff; sSoundButton.downState = sIconSoundOff; sSoundButton.overState = sIconSoundOff; sSoundButton.hitTestState = sIconSoundOff; }; } private function AddSoundButton():void{ var _local1:Sprite2dFile; if (sSoundButton == null){ _local1 = (Engine.GetDataAsset("misc.xSprite2d") as Sprite2dFile); sIconSoundOn = new Sprite2dModelInstance(_local1, 0); sIconSoundOn.SetAnimationID(AnimID_SoundOn); sIconSoundOff = new Sprite2dModelInstance(_local1, 0); sIconSoundOff.SetAnimationID(AnimID_SoundOff); sSoundButton = new SimpleButton(); UpdateSoundButton(); sSoundButton.x = ((mGame.stage.stageWidth - sSoundButton.width) - 10); sSoundButton.y = ((mGame.stage.stageHeight - mBlackBarMinHeight) + ((mBlackBarMinHeight - sSoundButton.height) / 2)); sSoundButton.addEventListener(MouseEvent.CLICK, ToggleSoundOnOff); }; } private function CreateMenuText(_arg1:String, _arg2:Boolean):TextField{ var _local3:TextField = new TextField(); _local3.autoSize = TextFieldAutoSize.LEFT; _local3.selectable = false; _local3.background = false; _local3.textColor = 0xFFFF00; _local3.text = _arg1; if (_arg2){ _local3.addEventListener(MouseEvent.CLICK, OnMenuClick); _local3.addEventListener(MouseEvent.MOUSE_OVER, OnMenuMouseOver); _local3.addEventListener(MouseEvent.MOUSE_OUT, OnMenuMouseOut); }; return (_local3); } private function AddHtmlTextButtons():void{ if (sHtmlTextButton_MainMenuBr == null){ sHtmlTextButton_MainMenuBr = new HtmlTextButton(Config.kMainMenuButtonTextWithBr, true, true); }; sHtmlTextButton_MainMenuBr.addEventListener(MouseEvent.CLICK, OnClickMainMenu); sHtmlTextButton_MainMenuBr.y = 380; mEntityContainer.addChild(sHtmlTextButton_MainMenuBr); sHtmlTextButton_MainMenuBr.visible = false; if (sHtmlTextButton_TapirGamesBr == null){ sHtmlTextButton_TapirGamesBr = new HtmlTextButton(Config.kTapirGamesButtonTextWithBr, true, true); sHtmlTextButton_TapirGamesBr.addEventListener(MouseEvent.CLICK, OnClickTapirGames); }; sHtmlTextButton_TapirGamesBr.y = 380; mEntityContainer.addChild(sHtmlTextButton_TapirGamesBr); sHtmlTextButton_TapirGamesBr.visible = false; var _local1:int = (((mGame.stage.stageWidth - sHtmlTextButton_MainMenuBr.width) - sHtmlTextButton_TapirGamesBr.width) / 3); sHtmlTextButton_MainMenuBr.x = _local1; sHtmlTextButton_TapirGamesBr.x = ((sHtmlTextButton_MainMenuBr.width + _local1) + _local1); if (sHtmlTextButton_TapirGamesLink == null){ sHtmlTextButton_TapirGamesLink = new HtmlTextButton(Config.kTapirGamesLinkText, false, false); sHtmlTextButton_TapirGamesLink.addEventListener(MouseEvent.CLICK, OnClickMyDailyGame); }; sHtmlTextButton_TapirGamesLink.x = ((mGame.stage.stageWidth - sHtmlTextButton_TapirGamesLink.width) / 2); sHtmlTextButton_TapirGamesLink.y = ((mGame.stage.stageHeight - sHtmlTextButton_TapirGamesLink.height) - 1); mEntityContainer.addChild(sHtmlTextButton_TapirGamesLink); sHtmlTextButton_TapirGamesLink.visible = true; } override public function Destroy():void{ mGame.removeChild(mEntityContainer); mGame.removeChild(mBackground); } public function OnClickMainMenu(_arg1:MouseEvent):void{ GoToMainMenu(); } private function OnMenuClick(_arg1:MouseEvent):void{ var _local2:TextField = (_arg1.target as TextField); if (_local2 == mExitMenu){ GoToMainMenu(); } else { if (_local2 == mHelpMenu){ sHelpDialog.visible = !(sHelpDialog.visible); } else { if (_local2 == mRestartMenu){ sNeedRestart = true; } else { if (_local2 == mUndoMenu){ sNeedUndo = true; }; }; }; }; } private function AddLevelFinishedSprite():void{ if (sLevelFinishedSprite == null){ sLevelFinishedSprite = new DialogBox(); sLevelFinishedSprite.SetText(Config.kLevelFinishedText, true); sLevelFinishedSprite.SetCached(true); sLevelFinishedSprite.SetBackgroundVisible(false); sLevelFinishedSprite.SetBackgroundColor(8454016); sLevelFinishedSprite.alpha = 1; sLevelFinishedSprite.Rebuild(); sLevelFinishedSprite.x = ((mGame.stage.stageWidth - sLevelFinishedSprite.width) / 2); sLevelFinishedSprite.y = ((mGame.stage.stageHeight - sLevelFinishedSprite.height) / 2); }; sLevelFinishedSprite.visible = false; mEntityContainer.addChild(sLevelFinishedSprite); } public static function PlayBackgroundSound():void{ } public static function OnClickMyDailyGame(_arg1:MouseEvent):void{ var event = _arg1; var url = "http://www.mydailygame.com"; var request:URLRequest = new URLRequest(url); try { navigateToURL(request, "_blank"); } catch(e:Error) { trace("navigateToURL error."); }; } public static function OnClickTapirGames(_arg1:MouseEvent):void{ var event = _arg1; var url = "http://www.tapirgames.com"; var request:URLRequest = new URLRequest(url); try { navigateToURL(request, "_blank"); } catch(e:Error) { trace("navigateToURL error."); }; } } }//package game.stateSection 55//GameState_MainMenu (game.state.GameState_MainMenu) package game.state { import flash.events.*; import flash.display.*; import game.*; import flash.text.*; import game.display.*; import engine.*; import mochi.*; public class GameState_MainMenu extends GameState { private var mTitleTextColor:uint;// = 16777181 private var mTargetStar:TargetStar; private var mLevelMenuItems:Array; private var mTextField:TextField; private var mState:int;// = 0 private var mSelectLevelsText:DialogBox; private var mBlackBackground:Shape; private var mEntityContainer:Sprite; private var mTitleLogo:Bitmap; private static const LevelMenuItemsCount:int = 10; public static const mBottomLinePos:int = 330; public static var mClickAwayAdMC:MovieClip = null; public function GameState_MainMenu(_arg1:Game){ super(_arg1); } private function OnLevelMenuItemClick(_arg1:MouseEvent):void{ Game.sCurrentLevelIndex = (_arg1.target as MainMenuLevelItem).GetLevelIndex(); mState = 2; } private function CalColor(_arg1:uint, _arg2:Number):uint{ var _local3:uint = (((_arg1) && (0xFF0000)) >> 16); var _local4:uint = (((_arg1) && (0xFF00)) >> 8); var _local5:uint = (((_arg1) && (0xFF)) >> 0); if (_arg2 < 0){ _arg2 = 0; }; if (_arg2 > 1){ _arg2 = 1; }; _local3 = (_local3 * _arg2); _local4 = (_local4 * _arg2); _local5 = (_local5 * _arg2); return ((((_local3 << 16) + (_local4 << 8)) + _local5)); } override public function Destroy():void{ mGame.removeChild(mBlackBackground); mGame.removeChild(mEntityContainer); } override public function Update(_arg1:Number):void{ var _local3:int; var _local4:int; var _local5:int; var _local6:int; var _local7:int; var _local2:Number = 0.05; switch (mState){ case 0: if (mEntityContainer.alpha >= 1){ mState = 1; mEntityContainer.alpha = 1; } else { mEntityContainer.alpha = (mEntityContainer.alpha + _local2); }; break; case 1: mTargetStar.UpdateAnimation((_arg1 + _arg1)); _local3 = Game.sLevelFilePaths.length; _local4 = Game.sCurrentLevelIndex; _local5 = (Game.sCurrentLevelIndex / LevelMenuItemsCount); _local6 = (Game.sCurrentLevelIndex - (_local5 * LevelMenuItemsCount)); _local7 = (((_local3 + LevelMenuItemsCount) - 1) / LevelMenuItemsCount); if (KeyInput.mLeftKeyPressed){ do { --_local6; if (_local6 < 0){ _local6 = (_local6 + LevelMenuItemsCount); }; _local4 = ((_local5 * LevelMenuItemsCount) + _local6); if (_local4 >= _local3){ _local4 = _local3; }; } while (Game.sLevelLockeds[_local4]); } else { if (KeyInput.mRightKeyPressed){ do { _local6++; if (_local6 >= LevelMenuItemsCount){ _local6 = (_local6 - LevelMenuItemsCount); }; _local4 = ((_local5 * LevelMenuItemsCount) + _local6); if (_local4 >= _local3){ _local4 = (_local5 * LevelMenuItemsCount); }; } while (Game.sLevelLockeds[_local4]); } else { if (KeyInput.mUpKeyPressed){ do { --_local5; if (_local5 < 0){ _local5 = (_local5 + _local7); }; _local4 = ((_local5 * LevelMenuItemsCount) + _local6); if (_local4 >= _local3){ _local4 = (_local4 - LevelMenuItemsCount); }; } while (Game.sLevelLockeds[_local4]); } else { if (KeyInput.mDownKeyPressed){ do { _local5++; if (_local5 >= _local7){ _local5 = (_local5 - _local7); }; _local4 = ((_local5 * LevelMenuItemsCount) + _local6); if (_local4 >= _local3){ _local4 = _local6; }; } while (Game.sLevelLockeds[_local4]); }; }; }; }; if (!Game.sLevelLockeds[_local4]){ mTargetStar.x = (mLevelMenuItems[_local4].x + (mLevelMenuItems[_local4].width / 2)); mTargetStar.y = (mLevelMenuItems[_local4].y + (mLevelMenuItems[_local4].height / 2)); Game.sCurrentLevelIndex = _local4; if (KeyInput.mComfirmKeyPressed){ mState = 2; }; } else { trace("a locked level is selected."); }; KeyInput.ClearKeys(); break; case 2: if (mEntityContainer.alpha < _local2){ mGame.SetNextGameStateID(Game.k_GameState_Level); } else { mEntityContainer.alpha = (mEntityContainer.alpha - _local2); if (mClickAwayAdMC != null){ mClickAwayAdMC.alpha = mEntityContainer.alpha; }; }; break; }; } override public function Initialize():void{ var _local23:MainMenuLevelItem; mBlackBackground = new Shape(); mBlackBackground.graphics.beginFill(0); mBlackBackground.graphics.lineStyle(0, 0); mBlackBackground.graphics.drawRect(0, 0, mGame.stage.stageWidth, mGame.stage.stageHeight); mBlackBackground.graphics.endFill(); mGame.addChild(mBlackBackground); mEntityContainer = new Sprite(); mEntityContainer.alpha = 0; mGame.addChild(mEntityContainer); var _local1:Shape = new Shape(); _local1.graphics.beginFill(0); _local1.graphics.lineStyle(0, 0); _local1.graphics.drawRect(0, 0, mGame.stage.stageWidth, mGame.stage.stageHeight); _local1.graphics.endFill(); mEntityContainer.addChild(_local1); var _local2:uint = 10; var _local3:int = mBottomLinePos; if (GameState_Level.sHtmlTextButton_TapirGames == null){ GameState_Level.sHtmlTextButton_TapirGames = new HtmlTextButton(Config.kTapirGamesButtonText, true, true); GameState_Level.sHtmlTextButton_TapirGames.addEventListener(MouseEvent.CLICK, GameState_Level.OnClickTapirGames); }; if (GameState_Level.sHtmlTextButton_MyDailyGameLogo == null){ GameState_Level.sHtmlTextButton_MyDailyGameLogo = new LogoButton((Engine.GetDataAsset("my_daily_game_logo3.gif") as BitmapData)); GameState_Level.sHtmlTextButton_MyDailyGameLogo.addEventListener(MouseEvent.CLICK, GameState_Level.OnClickMyDailyGame); }; if ((((((((((mClickAwayAdMC == null)) || ((mClickAwayAdMC.width == 0)))) || ((mClickAwayAdMC.height == 0)))) || ((mClickAwayAdMC.visible == false)))) || ((mClickAwayAdMC.alpha == 0)))){ GameState_Level.sHtmlTextButton_MyDailyGameLogo.x = ((mGame.stage.stageWidth - GameState_Level.sHtmlTextButton_MyDailyGameLogo.width) / 2); GameState_Level.sHtmlTextButton_MyDailyGameLogo.y = (GameState_MainMenu.mBottomLinePos + (((mGame.stage.stageHeight - GameState_MainMenu.mBottomLinePos) - GameState_Level.sHtmlTextButton_MyDailyGameLogo.height) / 2)); mEntityContainer.addChild(GameState_Level.sHtmlTextButton_MyDailyGameLogo); }; mTitleLogo = new Bitmap((Engine.GetDataAsset("logo.png") as BitmapData)); mEntityContainer.addChild(mTitleLogo); mTitleLogo.x = ((mGame.stage.stageWidth - mTitleLogo.width) / 2); mTitleLogo.y = _local2; var _local4:int = ((mTitleLogo.y + mTitleLogo.height) + _local2); mSelectLevelsText = new DialogBox(); mSelectLevelsText.SetText(Config.kSelectLevels, true); mSelectLevelsText.SetCached(true); mSelectLevelsText.SetBackgroundVisible(false); mSelectLevelsText.Rebuild(); mSelectLevelsText.x = ((mGame.stage.stageWidth - mSelectLevelsText.width) / 2); mSelectLevelsText.y = (_local4 + 26); mEntityContainer.addChild(mSelectLevelsText); var _local5:Shape = new Shape(); _local5.graphics.lineStyle(1, 0xFF); _local5.graphics.moveTo(50, 0); _local5.graphics.lineTo((mGame.stage.stageWidth - 50), 0); _local5.y = _local4; mEntityContainer.addChild(_local5); var _local6:Shape = new Shape(); _local6.graphics.lineStyle(1, 0xFF); _local6.graphics.moveTo(50, 0); _local6.graphics.lineTo((mGame.stage.stageWidth - 50), 0); _local6.y = _local3; mEntityContainer.addChild(_local6); var _local7:Array = Game.sLevelFilePaths; var _local8:uint = _local7.length; var _local9:uint = LevelMenuItemsCount; var _local10:uint = ((_local8 > _local9)) ? _local9 : _local8; var _local11:uint = (((_local8 + _local9) - 1) / _local9); var _local12:uint = 30; var _local13:uint = 30; var _local14:uint = 6; var _local15:uint = 6; var _local16:int = ((mGame.stage.stageWidth - ((_local10 * _local12) + ((_local10 - 1) * _local14))) / 2); var _local17:int = ((mSelectLevelsText.y + mSelectLevelsText.height) + (((_local3 - (mSelectLevelsText.y + mSelectLevelsText.height)) - ((_local11 * _local13) + ((_local11 - 1) * _local15))) / 2)); var _local18:uint; var _local19:uint; var _local20:int = _local16; var _local21:int = _local17; mLevelMenuItems = new Array(_local8); var _local22:uint; while (_local22 < _local8) { _local23 = new MainMenuLevelItem(_local22, Game.sLevelFinisheds[_local22], Game.sLevelLockeds[_local22], _local12, _local13); if (!Game.sLevelLockeds[_local22]){ _local23.addEventListener(MouseEvent.CLICK, OnLevelMenuItemClick); }; mLevelMenuItems[_local22] = _local23; _local23.x = _local20; _local23.y = _local21; mEntityContainer.addChild(_local23); _local19++; _local20 = (_local20 + (_local12 + _local14)); if (_local19 >= _local9){ _local19 = 0; _local20 = _local16; _local18++; _local21 = (_local21 + (_local13 + _local15)); }; if (_local22 == Game.sCurrentLevelIndex){ mTargetStar = new TargetStar((_local12 / 4)); mTargetStar.SetColor(0xFF00); mTargetStar.x = (_local23.x + (_local23.width / 2)); mTargetStar.y = (_local23.y + (_local23.height / 2)); }; _local22++; }; mEntityContainer.addChild(mTargetStar); KeyInput.mComfirmKeyPressed = false; mGame.stage.focus = mEntityContainer; mGame.stage.focus = null; } public static function HideClickAwayAd(_arg1:DisplayObjectContainer):void{ if (mClickAwayAdMC == null){ mClickAwayAdMC = new MovieClip(); mClickAwayAdMC.x = 100; mClickAwayAdMC.y = (mBottomLinePos + 16); _arg1.addChildAt(mClickAwayAdMC, 0); } else { MochiAd.unload(mClickAwayAdMC); mClickAwayAdMC.alpha = 0; _arg1.removeChild(mClickAwayAdMC); _arg1.addChildAt(mClickAwayAdMC, 0); }; } public static function ShowClickAwayAd(_arg1:DisplayObjectContainer):void{ if (mClickAwayAdMC != null){ _arg1.removeChild(mClickAwayAdMC); _arg1.addChild(mClickAwayAdMC); mClickAwayAdMC.visible = true; mClickAwayAdMC.alpha = 1; }; } public static function RefreshClickAwayAd():void{ var opts:Object; } } }//package game.stateSection 56//GameState_Startup (game.state.GameState_Startup) package game.state { import flash.events.*; import flash.display.*; import game.*; import game.display.*; public class GameState_Startup extends GameState { private var mBlackBackground:Shape; private var mOldInitializedBalue:Boolean;// = false private var mPlayButton:HtmlTextButton; private var mWaitText:DialogBox; public function GameState_Startup(_arg1:Game){ super(_arg1); } override public function Update(_arg1:Number):void{ if (((ResLoader.mInitialized) && (!(mOldInitializedBalue)))){ mOldInitializedBalue = true; mPlayButton.visible = true; mWaitText.visible = false; }; } public function OnClickPlayButton(_arg1:MouseEvent):void{ mGame.SetNextGameStateID(Game.k_GameState_MainMenu); Game.LoadGame(); trace("SetNextGameStateID (Game.k_GameState_MainMenu)"); GameState_Level.PlayBackgroundSound(); } override public function Initialize():void{ mBlackBackground = new Shape(); mBlackBackground.graphics.beginFill(0); mBlackBackground.graphics.lineStyle(0, 0); mBlackBackground.graphics.drawRect(0, 0, mGame.stage.stageWidth, mGame.stage.stageHeight); mBlackBackground.graphics.endFill(); mGame.addChild(mBlackBackground); mWaitText = new DialogBox(); mGame.addChild(mWaitText); mWaitText.SetText("Initializing ...", true); mWaitText.SetCached(false); mWaitText.SetBackgroundVisible(false); mWaitText.Rebuild(); mWaitText.x = ((mGame.stage.stageWidth - mWaitText.width) / 2); mWaitText.y = ((mGame.stage.stageHeight - mWaitText.height) / 2); mPlayButton = new HtmlTextButton("<FONT FACE=\"Times New Roman\" SIZE=\"39\" COLOR=\"#8080FF\" LETTERSPACING=\"0\" KERNING=\"0\"><b>Play</b></FONT>", true, true); mPlayButton.addEventListener(MouseEvent.CLICK, OnClickPlayButton); mPlayButton.x = ((mGame.stage.stageWidth - mPlayButton.width) / 2); mPlayButton.y = ((mGame.stage.stageHeight - mPlayButton.height) / 2); mPlayButton.visible = false; mGame.addChild(mPlayButton); } override public function Destroy():void{ mGame.removeChild(mWaitText); mGame.removeChild(mPlayButton); } } }//package game.stateSection 57//Config (game.Config) package game { public class Config { public static const kLevelDifficuties:Array = [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 3, 5, 3, 3, 4, 5, 4, 2, 4, 4, 4, 5, 3, 3, 3, 3, 5, 4, 4, 3, 3, 3, 4, 4, 5, 5, 5, 6]; public static const kHelpDialogText:String = (((((((((((((((((((((("The goal of the game is to help boxes find their little children. " + "<br><br>Methods to select the <b>Target Box</b>:") + "<br> - left-click a box to set it as the Target Box.") + "<br> - press <b>Space Bar</b> to switch the Target Box.") + "<br> - hold <b>Space Bar</b>, then use <b>WASD</b> or <b>Up-Down-Left-Right</b>") + "<br> arrow keys to select the Target Box.") + "<br><br><b>NOTICE: </b>A teleporter is also a box. It can also be set as Target Box.") + "<br><br>To roll the <b>Target Box</b>, use any of these methods:") + "<br> - press <b>key A</b> and <b>key D</b>.") + "<br> - press <b>LEFT</b> and <b>RIGHT</b> arrow keys.") + "<br> - left-click (then either hold the mouse or not) an area without being") + "<br> occupied by boxes in the game field.") + "<br><br>Some rules::") + "<br> - Boxes can climb up sidesteps with the same height of boxes (one grid).") + "<br> - When a box wants to climb up a sidestep higher than the box, a") + "<br> somersault will be made. Teleporters can use this feature to adjust") + "<br> its direction.") + "<br> - <b>A teleporter box can teleport the neighbour box at its back to the") + "<br> front of its twin partner.</b>") + "<br> - When a box is at the back of more than one teleporters, the box can't") + "<br> be teleported.") + "<br> - When 2 teleporters are back to back, neither of them will be teleported.") + "<br><br><P ALIGN=\"CENTER\">(Click <B>Help</B> menu again to close this dialog.)</P>"); public static const kTapirGamesButtonText:String = "<P ALIGN="CENTER"><FONT FACE="Times New Roman" SIZE="39" COLOR="#8080FF" LETTERSPACING="0" KERNING="0"><b>Tapir Games</b></FONT></P>"; public static const kMainMenuButtonTextWithBr:String = "<P ALIGN="CENTER"><FONT FACE="Times New Roman" SIZE="39" COLOR="#8080FF" LETTERSPACING="0" KERNING="0"><b>Main<BR>Menu</b></FONT></P>"; public static const kSupportAntiGravity:Boolean = true; public static const kTutorialText_0_b:String = (((((((("Boxes can climb up sidesteps with the same height (one grid). When a box wants" + "<br>to climb up a sidestep higher than the box, a 90 degrees somersault will be made.") + "<br><b>This feature is very important for the teleporters in later levels.</b>") + "<br><br><b>NOTICE:</b> The grey box can also be set as the <b>Target box</b> and be rolled.") + "<br><br>There are 3 methods to select the Target Box:") + "<br> - left-click a box to set it as the Target Box.") + "<br> - press <b>Space Bar</b> to switch the Target Box.") + "<br> - hold <b>Space Bar</b>, then use <b>WASD</b> or <b>Up-Down-Left-Right</b>") + "<br> arrow keys to select the Target Box."); public static const kTutorialText_1_b:String = (((((("Sometimes, a teleporter wants to teleport a neighbour box, but the box is not at the" + "<br>back of the teleporter. In this occasion, the teleporter can adjust its direction by") + "<br>trying to climb up the sidesteps (or walls) higher than one:grid. Certainly the") + "<br>trying will fail, but after the trying, the teleporter would rotate 90 degrees.") + "<br><br><b>NOTICE:</b> If an unwanted step is made, we can undo it by click the <b>Undo</b> menu") + "<br>at top-right corner. In fact, we can undo any steps. We can also press <b>Backspace</b>") + "<br>key or <b>Esc</b> key to perform the undo actions."); public static const kForDebug:Boolean = false; public static const kGameFinishedText:String = (((("<P ALIGN=\"CENTER\"><FONT FACE=\"Times New Roman\" SIZE=\"20\" COLOR=\"#000000\" LETTERSPACING=\"0\" KERNING=\"0\"><b>Congratulation!</b></FONT></P>" + "<br>All levels are finished. Cool! You know, it is not an easy job") + "<br>to finish all the levels. Only the most intelligent people can") + "<br>do this. If you like this game, please recommend it to your") + "<br>friends. Let more people challenge the impossible missions! :)"); public static const kSelectLevels:String = "<FONT FACE="Times New Roman" SIZE="22" COLOR="#8080FF" LETTERSPACING="0" KERNING="0"><b>LEVEL SELECT</b></FONT>"; public static const kVersionString:String = "1.1"; public static const kTutorialText_0:String = (((((((("The goal of the game is to help boxes find their little children." + "<br><br>The box embeded with a windmill is the <B>Target Box</B>, to roll the") + "<br>Target Box, use any of these methods:") + "<br> - press key A and key D.") + "<br> - press Left and Right arrow keys.") + "<br> - left-click (then either hold the mouse or not) an area without") + "<br> being occupied by boxes in the game field.") + "<br><br><B>NOTICE</B>: If the windmill is not rotating, it means the game is") + "<br>deactivated. Please click any area in the game field to activate it."); public static const kTutorialText_1:String = ((((((((((("Now, let's introduce <b>teleporter twins</b>. Thay are the boxes embeded with" + "<br>an arrow. A teleporter box can teleport the neighbour box at its back to the front") + "<br>of its twin partner. With the help of teleporter twins, many impossible tasks can") + "<br>be finished now.") + "<br><br><b>NOTICE: </b>") + "<br> - A teleporter is also a box. It can also be set as the Target Box and be rolled.") + "<br> - When a box is at the back of both of the twins, teleportation will not start.") + "<br> - It will take about one second to prepare a teleportation. In the preparing process,") + "<br> the teleportation can be interrupted by rolling either the teleporter or the") + "<br> teleportee to make the teleportee be not the back neighbour of the teleporter.") + "<br> - To reset the current level, please click the <b>Restart</b> menu at top-right corner.") + "<br> We can also press the <b>R</b> key to reset the current level."); public static const kTutorialText_2:String = ((("Now, 2 pairs of teleporter twins. " + "<br><br><b>NOTICE: </b>") + "<br> - A teleporter is also a box. It can also be teleported by other teleporter twins.") + "<br> - But when 2 teleporters are back to back, neither of them will be teleported."); public static const kTapirGamesButtonTextWithBr:String = "<P ALIGN="CENTER"><FONT FACE="Times New Roman" SIZE="39" COLOR="#8080FF" LETTERSPACING="0" KERNING="0"><b>Tapir<BR>Games</b></FONT></P>"; public static const kGameName:String = "Teleporter Twins"; public static const kGameDataName:String = "TeleporterTwins_1_1"; public static const kTapirGamesLinkText:String = "<P ALIGN="CENTER"><FONT COLOR="#C0C0FF" LETTERSPACING="0" KERNING="0"><u>http://www.MyDailyGame.com</u></FONT></P>"; public static const kTutorialTexts:Array = [kTutorialText_0, kTutorialText_0_b, kTutorialText_1, kTutorialText_1_b, kTutorialText_2]; public static const kLevelFinishedText:String = "<FONT FACE="Times New Roman" SIZE="39" COLOR="#8080FF" LETTERSPACING="0" KERNING="0"><b>Level Finished</b></FONT>"; } }//package gameSection 58//Game (game.Game) package game { import flash.events.*; import flash.display.*; import game.state.*; import flash.net.*; public class Game extends Sprite { private var mTopContainer:DisplayObjectContainer; private var mNextGameStateID:int; private var mGameStateID:int; private var mGameState:GameState; public static const k_GameState_Invalid:int = k_GameState_i++; public static const k_GameState_Startup:int = k_GameState_i++; public static const k_GameState_MainMenu:int = k_GameState_i++; public static const k_GameState_Level:int = k_GameState_i++; public static var sLevelFilePaths:Array = new Array(); public static var sCurrentLevelIndex:uint = 0; public static var k_GameState_i:int = -1; public static var sLevelFinisheds:Array = new Array(); public static var sLevelLockeds:Array = new Array(); public function Game(){ ResLoader.Initialize(); mGameStateID = k_GameState_Invalid; mGameState = null; SetNextGameStateID(k_GameState_Startup); } public function CreateGameState(_arg1:int):GameState{ switch (_arg1){ case k_GameState_Startup: return (new GameState_Startup(this)); case k_GameState_MainMenu: return (new GameState_MainMenu(this)); case k_GameState_Level: return (new GameState_Level(this)); default: return (null); }; } public function SetNextGameStateID(_arg1:int):void{ mNextGameStateID = _arg1; } public function Update(_arg1:Number):void{ if (mNextGameStateID != mGameStateID){ ChangeGameState(mNextGameStateID); }; if (mGameState != null){ mGameState.Update(_arg1); }; } private function ChangeGameState(_arg1:int):void{ if (mGameState != null){ mGameState.Destroy(); }; mGameStateID = _arg1; mGameState = CreateGameState(mGameStateID); if (mGameState != null){ mGameState.Initialize(); }; mNextGameStateID = mGameStateID; } private static function CheckIfTheLastLevelUnlocked():void{ sLevelLockeds[(sLevelLockeds.length - 1)] = false; var _local1:int; while (_local1 < (sLevelLockeds.length - 1)) { if (!sLevelFinisheds[_local1]){ sLevelLockeds[(sLevelLockeds.length - 1)] = true; break; }; _local1++; }; } public static function NotifyLevelFinished():void{ var _local2:int; var _local11:int; sLevelFinisheds[sCurrentLevelIndex] = true; var _local1:int = (sCurrentLevelIndex + 3); if (_local1 >= sLevelLockeds.length){ _local1 = (sLevelLockeds.length - 1); }; _local2 = (sCurrentLevelIndex + 1); while (_local2 <= _local1) { sLevelLockeds[_local2] = false; _local2++; }; CheckIfTheLastLevelUnlocked(); SaveGame(); var _local3:int; _local2 = 0; while (_local2 < sLevelFinisheds.length) { if (sLevelFinisheds[_local2]){ _local3++; }; _local2++; }; var _local4:int; _local2 = 0; while (_local2 < sLevelLockeds.length) { if (!sLevelLockeds[_local2]){ _local4 = (_local2 + 1); }; _local2++; }; var _local5:int; _local2 = 0; while (_local2 < 30) { if (sLevelFinisheds[_local2]){ _local5 = (_local5 + (1 << _local2)); }; _local2++; }; var _local6:int; _local2 = 30; while (_local2 < sLevelFinisheds.length) { if (sLevelFinisheds[_local2]){ _local6 = (_local6 + (1 << (_local2 - 30))); }; _local2++; }; var _local7:Boolean; var _local8:Boolean; var _local9:Boolean; var _local10:Boolean; _local2 = 0; while (_local2 < sLevelFinisheds.length) { if (!sLevelFinisheds[_local2]){ _local11 = Config.kLevelDifficuties[_local2]; if (_local11 <= 1){ _local7 = false; } else { if (_local11 <= 3){ _local8 = false; } else { if (_local11 <= 5){ _local9 = false; }; }; }; _local10 = false; }; _local2++; }; OnlineAPI.UpdateOnlineData(_local3, _local4, _local5, _local6, _local7, _local8, _local9, _local10); } private static function SaveGame():void{ var so:SharedObject; var flushResult:String; var levelID:int; try { if (Config.kForDebug){ levelID = 0; while (levelID < sLevelLockeds.length) { sLevelLockeds[levelID] = false; levelID = (levelID + 1); }; }; so = SharedObject.getLocal(Config.kGameDataName); so.data.levelFinisheds = sLevelFinisheds; flushResult = so.flush(2000); if (flushResult == SharedObjectFlushStatus.PENDING){ so.addEventListener(NetStatusEvent.NET_STATUS, OnFlushStatus); } else { if (flushResult == SharedObjectFlushStatus.FLUSHED){ }; }; } catch(e:Error) { trace(("SaveGame error: " + e)); }; } public static function RegisterLevel(_arg1:String):void{ var _local2:int = sLevelFilePaths.length; sLevelFilePaths[_local2] = _arg1; sLevelFinisheds[_local2] = false; sLevelLockeds[_local2] = ((_local2 == 0)) ? false : true; if (_local2 > 0){ sLevelLockeds[(_local2 - 1)] = false; }; } public static function LoadGame():void{ var so:SharedObject; var levelFinisheds:Array; var levelID:int; var nLevels:int; try { so = SharedObject.getLocal(Config.kGameDataName); levelFinisheds = so.data.levelFinisheds; trace(("levelFinisheds.length = " + levelFinisheds.length)); nLevels = ((levelFinisheds.length < sLevelFinisheds.length)) ? levelFinisheds.length : sLevelFinisheds.length; levelID = 0; while (levelID < nLevels) { sLevelFinisheds[levelID] = levelFinisheds[levelID]; levelID = (levelID + 1); }; if (Config.kForDebug){ levelID = 0; while (levelID < sLevelLockeds.length) { sLevelLockeds[levelID] = false; levelID = (levelID + 1); }; }; } catch(e:Error) { trace(("LoadGame error: " + e)); }; } private static function OnFlushStatus(_arg1:NetStatusEvent):void{ if (_arg1.info.code == "SharedObject.Flush.Success"){ } else { if (_arg1.info.code == "SharedObject.Flush.Failed"){ }; }; SharedObject.getLocal(Config.kGameDataName).removeEventListener(NetStatusEvent.NET_STATUS, OnFlushStatus); } } }//package gameSection 59//GameCanvas (game.GameCanvas) package game { import flash.events.*; import flash.display.*; import flash.text.*; import flash.utils.*; public dynamic class GameCanvas extends Sprite { private var mFpsValue:Number;// = 0 private var mFpsTickers:uint;// = 0 private var mGameStatusInfoTextField:TextField; private var mLastFpsTime:Number;// = 0 private var mGame:Game; private static var mLastFrameTime:Number = getTimer(); public function GameCanvas(){ mGameStatusInfoTextField = new TextField(); super(); addEventListener(Event.ADDED_TO_STAGE, OnAddedToStage); addEventListener(Event.REMOVED_FROM_STAGE, OnRemovedFromStage); } private function OnRemovedFromStage(_arg1:Event):void{ } private function OnAddedToStage(_arg1:Event):void{ OnlineAPI.Initialize(stage); if (mGame == null){ mGame = new Game(); addChild(mGame); }; x = (x - transform.concatenatedMatrix.tx); y = (y - transform.concatenatedMatrix.ty); addEventListener(Event.RESIZE, OnResize); addEventListener(Event.ENTER_FRAME, OnTimerTick); stage.focus = stage; stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyInput.OnKeyDown); stage.addEventListener(KeyboardEvent.KEY_UP, KeyInput.OnKeyUp); stage.addEventListener(Event.DEACTIVATE, KeyInput.OnDeactivate); stage.addEventListener(Event.ACTIVATE, KeyInput.OnActivate); stage.addEventListener(MouseEvent.MOUSE_DOWN, KeyInput.OnMouseDown); stage.addEventListener(MouseEvent.MOUSE_UP, KeyInput.OnMouseUp); stage.addEventListener(MouseEvent.MOUSE_MOVE, KeyInput.OnMouseMove); } public function OnTimerTick(_arg1:Event):void{ if (mGame == null){ return; }; var _local2:Number = getTimer(); var _local3:Number = (_local2 - mLastFrameTime); mLastFrameTime = _local2; mGame.Update((_local3 / 1000)); mFpsTickers++; if ((_local2 - mLastFpsTime) > 1000){ mFpsValue = ((1000 * mFpsTickers) / (_local2 - mLastFpsTime)); mLastFpsTime = _local2; mFpsTickers = 0; }; } private function OnResize(_arg1:Event):void{ stage.invalidate(); } } }//package gameSection 60//GameEntity (game.GameEntity) package game { public interface GameEntity { function Initialize():void; function Update(_arg1:Number):void; function Destroy():void; } }//package gameSection 61//GameState (game.GameState) package game { public class GameState implements GameEntity { protected var mGame:Game; public function GameState(_arg1:Game){ mGame = _arg1; } public function Initialize():void{ } public function Update(_arg1:Number):void{ } public function Destroy():void{ } } }//package gameSection 62//KeyInput (game.KeyInput) package game { import flash.events.*; import game.state.*; import flash.ui.*; public class KeyInput { public static var sIsDeactived:Boolean = true; public static var mUpKeyPressed:Boolean; public static var mMouseLeftButtonHold:Boolean; public static var mChangeTargetKeyPressed:Boolean; public static var mDownKeyPressed:Boolean; public static var mRightKeyPressed:Boolean; public static var mMouseStageX:int; public static var mComfirmKeyPressed:Boolean; public static var mLeftKeyPressed:Boolean; public static var mMouseStageY:int; public static function ClearKeys():void{ mLeftKeyPressed = false; mRightKeyPressed = false; mUpKeyPressed = false; mDownKeyPressed = false; mChangeTargetKeyPressed = false; mComfirmKeyPressed = false; } public static function ClearMouseInfo():void{ mMouseLeftButtonHold = false; } public static function OnDeactivate(_arg1:Event):void{ sIsDeactived = true; ClearKeys(); ClearMouseInfo(); } public static function OnMouseMove(_arg1:MouseEvent):void{ mMouseStageX = _arg1.stageX; mMouseStageY = _arg1.stageY; } public static function OnKeyUp(_arg1:KeyboardEvent):void{ switch (_arg1.keyCode){ case Keyboard.LEFT: case 65: mLeftKeyPressed = false; break; case Keyboard.RIGHT: case 68: mRightKeyPressed = false; break; case Keyboard.UP: case 87: mUpKeyPressed = false; break; case Keyboard.DOWN: case 83: mDownKeyPressed = false; break; case Keyboard.SPACE: mComfirmKeyPressed = false; mChangeTargetKeyPressed = false; break; case 82: break; case Keyboard.BACKSPACE: case Keyboard.ESCAPE: break; case Keyboard.ENTER: mComfirmKeyPressed = false; break; }; } public static function OnMouseUp(_arg1:MouseEvent):void{ ClearMouseInfo(); } public static function OnMouseDown(_arg1:MouseEvent):void{ if (!sIsDeactived){ mMouseLeftButtonHold = true; mMouseStageX = _arg1.stageX; mMouseStageY = _arg1.stageY; }; sIsDeactived = false; } public static function OnKeyDown(_arg1:KeyboardEvent):void{ switch (_arg1.keyCode){ case Keyboard.LEFT: case 65: mLeftKeyPressed = true; break; case Keyboard.RIGHT: case 68: mRightKeyPressed = true; break; case Keyboard.UP: case 87: mUpKeyPressed = true; break; case Keyboard.DOWN: case 83: mDownKeyPressed = true; break; case Keyboard.SPACE: mComfirmKeyPressed = true; mChangeTargetKeyPressed = true; break; case 82: GameState_Level.sNeedRestart = true; break; case Keyboard.BACKSPACE: case Keyboard.ESCAPE: GameState_Level.sNeedUndo = true; break; case Keyboard.ENTER: mComfirmKeyPressed = true; break; }; } public static function OnActivate(_arg1:Event):void{ } } }//package gameSection 63//OnlineAPI (game.OnlineAPI) package game { import com.kongregate.as3.client.*; import flash.display.*; import com.kongregate.as3.client.events.*; import mochi.*; public class OnlineAPI { private static var sIsKongregate:Boolean; private static var sIsGuest:Boolean = true; private static var sAPI_Initialized:Boolean = false; private static function OnUserInfo(_arg1:Object):void{ trace(("isGuest: " + _arg1.isGuest)); sIsGuest = _arg1.isGuest; } public static function Initialize(_arg1:DisplayObjectContainer):void{ var kongregate:KongregateAPI; var container = _arg1; try { sIsKongregate = false; if (Preloader.sSwfUrl == null){ return; }; Preloader.sSwfUrl = Preloader.sSwfUrl.toLowerCase(); if (Preloader.sSwfUrl.indexOf("kongregate") < 0){ return; }; sIsKongregate = true; kongregate = new KongregateAPI(); kongregate.addEventListener(KongregateEvent.COMPLETE, OnInitComplete); container.addChild(kongregate); } catch(err:Error) { trace("online initialize error"); }; } public static function OnInitComplete(_arg1:KongregateEvent):void{ sAPI_Initialized = true; var _local2:KongregateAPI = KongregateAPI.getInstance(); _local2.user.getPlayerInfo(OnUserInfo); } public static function IsOk():Boolean{ return (sAPI_Initialized); } public static function UpdateOnlineData(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:Boolean, _arg6:Boolean, _arg7:Boolean, _arg8:Boolean):void{ var kongregate:KongregateAPI; var newScore:int; var numFinishedLevels = _arg1; var numUnlockedLevels = _arg2; var flagsLevelFinished1 = _arg3; var flagsLevelFinished2 = _arg4; var AllBasicLevelsFinished = _arg5; var AllNormalLevelsFinished = _arg6; var AllHardLevelsFinished = _arg7; var AllLevelsFinished = _arg8; trace(((("----------------------------------------------- score: sIsGuest = " + sIsGuest) + ", isOK = ") + IsOk())); if (!IsOk()){ return; }; try { kongregate = KongregateAPI.getInstance(); kongregate.user.getPlayerInfo(OnUserInfo); if (sIsGuest){ return; }; trace(("user name: " + kongregate.user.getName())); newScore = (numFinishedLevels * 10000); if (Config.kForDebug){ newScore = 0; }; kongregate.scores.submit(newScore); trace(("new score: " + newScore)); kongregate.stats.submit("flagsLevelFinished1", flagsLevelFinished1); kongregate.stats.submit("flagsLevelFinished2", flagsLevelFinished2); kongregate.stats.submit("AllBasicLevelsFinished", (AllBasicLevelsFinished) ? 1 : 0); kongregate.stats.submit("AllNormalLevelsFinished", (AllNormalLevelsFinished) ? 1 : 0); kongregate.stats.submit("AllHardLevelsFinished", (AllHardLevelsFinished) ? 1 : 0); kongregate.stats.submit("AllLevelsFinished", (AllLevelsFinished) ? 1 : 0); trace("UpdateOnlineData ok"); } catch(err:Error) { trace("UpdateOnlineData error"); }; } } }//package gameSection 64//ResLoader (game.ResLoader) package game { import flash.events.*; import flash.display.*; import flash.utils.*; import engine.asset.*; import mx.core.*; import engine.io.*; import engine.*; import game.res.*; public class ResLoader { private static var SoundFinished:Class = ResLoader_SoundFinished; private static var ResFile:Class = ResLoader_ResFile; public static var mInitialized:Boolean = false; private static var mResFilesCount:int; private static var SoundTelport:Class = ResLoader_SoundTelport; private static var mResFileDescs:Array; private static var SoundChild:Class = ResLoader_SoundChild; private static var SoundTelportStart:Class = ResLoader_SoundTelportStart; private static var mLastLoadingImageFileID:int = -1; private static var mResData:ByteArray; private static function StartLoadingImage(_arg1:int):void{ trace(("start loading image file: " + _arg1)); var _local2:Loader = new Loader(); _local2.contentLoaderInfo.addEventListener(Event.INIT, LoadingNextImage); mResFileDescs[_arg1].mDataSource.position = mResFileDescs[_arg1].mDataOffset; var _local3:ByteArray = new ByteArray(); _local3.length = mResFileDescs[_arg1].mDataLength; mResFileDescs[_arg1].mDataSource.readBytes(_local3, 0, mResFileDescs[_arg1].mDataLength); _local2.loadBytes(_local3); } private static function LoadingNextImage(_arg1:Event):void{ var _local2:Loader; var _local3:Bitmap; var _local4:BitmapData; if (_arg1 != null){ trace(("finished loading image file: " + mResFileDescs[mLastLoadingImageFileID].mFilePath)); _local2 = Loader(_arg1.target.loader); trace((" contentType=" + _local2.contentLoaderInfo.contentType)); _local3 = Bitmap(_local2.contentLoaderInfo.content); _local4 = _local3.bitmapData; Engine.RegisterDataAsset(mResFileDescs[mLastLoadingImageFileID].mFilePath, _local4); }; while (true) { mLastLoadingImageFileID++; if (mLastLoadingImageFileID >= mResFilesCount){ break; }; if (mResFileDescs[mLastLoadingImageFileID].mFileType == kDefines.FileType_ImageFile){ StartLoadingImage(mLastLoadingImageFileID); return; }; }; StartLoadingOtherAsset(); } public static function Initialize():void{ var _local2:int; mResData = new ResFile(); var _local1:int = mResData.readInt(); mResFilesCount = _local1; mResFileDescs = new Array(_local1); trace(("files count: " + _local1)); _local2 = 0; while (_local2 < _local1) { mResFileDescs[_local2] = new ResFileDescription(); mResFileDescs[_local2].mDataSource = mResData; mResFileDescs[_local2].mFilePath = mResData.readUTF(); mResFileDescs[_local2].mFileType = mResData.readShort(); trace((((((" - file path" + _local2) + ": ") + mResFileDescs[_local2].mFilePath) + ", type id: ") + mResFileDescs[_local2].mFileType)); _local2++; }; var _local3:int = mResData.readInt(); trace(("files count 2: " + _local3)); _local2 = 0; while (_local2 < _local3) { mResFileDescs[_local2].mDataOffset = mResData.readInt(); mResFileDescs[_local2].mDataLength = (mResData.readInt() - mResFileDescs[_local2].mDataOffset); trace((((((" - file data position: [" + mResFileDescs[_local2].mDataOffset) + ", ") + (mResFileDescs[_local2].mDataOffset + mResFileDescs[_local2].mDataLength)) + "), length: ") + mResFileDescs[_local2].mDataLength)); _local2++; }; LoadingNextImage(null); } private static function LoadSounds():void{ try { Engine.RegisterDataAsset("child.mp3", (new SoundChild() as SoundAsset)); Engine.RegisterDataAsset("finished.mp3", (new SoundFinished() as SoundAsset)); Engine.RegisterDataAsset("telport.mp3", (new SoundTelport() as SoundAsset)); Engine.RegisterDataAsset("telport_start.mp3", (new SoundTelportStart() as SoundAsset)); } catch(e:Error) { trace(("error: " + e)); }; } private static function StartLoadingOtherAsset():void{ var _local2:ResFileDescription; var _local3:ByteArray; var _local4:Sprite2dFile; var _local5:DefineFile; var _local6:ByteArray; var _local1:int; while (_local1 < mResFilesCount) { trace(((("> --------------------- loading fileID:" + _local1) + ") + path: ") + mResFileDescs[_local1].mFilePath)); _local2 = mResFileDescs[_local1]; _local3 = _local2.mDataSource; _local3.position = _local2.mDataOffset; switch (mResFileDescs[_local1].mFileType){ case kDefines.FileType_ImageFile: break; case kDefines.FileType_Sprite2dFile: _local4 = new Sprite2dFile(_local2.mFilePath); _local4.Load(_local3); Engine.RegisterDataAsset(_local2.mFilePath, _local4); break; case kDefines.FileType_DefineFile: _local5 = new DefineFile(_local2.mFilePath); _local5.Load(_local3); Engine.RegisterDataAsset(_local2.mFilePath, _local5); break; case kDefines.FileType_LevelFile: _local6 = new ByteArray(); _local6.length = _local2.mDataLength; _local3.readBytes(_local6, 0, _local2.mDataLength); Engine.RegisterDataAsset(_local2.mFilePath, _local6); Game.RegisterLevel(_local2.mFilePath); break; case kDefines.FileType_SoundFile: break; }; _local1++; }; LoadSounds(); mResData = null; trace("Res initialized"); mInitialized = true; } } }//package gameSection 65//ResLoader_ResFile (game.ResLoader_ResFile) package game { import mx.core.*; public class ResLoader_ResFile extends ByteArrayAsset { } }//package gameSection 66//ResLoader_SoundChild (game.ResLoader_SoundChild) package game { import mx.core.*; public class ResLoader_SoundChild extends SoundAsset { } }//package gameSection 67//ResLoader_SoundFinished (game.ResLoader_SoundFinished) package game { import mx.core.*; public class ResLoader_SoundFinished extends SoundAsset { } }//package gameSection 68//ResLoader_SoundTelport (game.ResLoader_SoundTelport) package game { import mx.core.*; public class ResLoader_SoundTelport extends SoundAsset { } }//package gameSection 69//ResLoader_SoundTelportStart (game.ResLoader_SoundTelportStart) package game { import mx.core.*; public class ResLoader_SoundTelportStart extends SoundAsset { } }//package gameSection 70//MochiAd (mochi.MochiAd) package mochi { import flash.events.*; import flash.display.*; import flash.utils.*; import flash.system.*; import flash.net.*; public class MochiAd { public static function getVersion():String{ return ("2.4.1"); } public static function showClickAwayAd(_arg1:Object):void{ var clip:Object; var mc:MovieClip; var chk:MovieClip; var options = _arg1; var DEFAULTS:Object = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{ }, ad_finished:function ():void{ }, ad_loaded:function (_arg1:Number, _arg2:Number):void{ }, ad_failed:function ():void{ trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software"); }, ad_skipped:function ():void{ }}; options = MochiAd._parseOptions(options, DEFAULTS); clip = options.clip; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; if (!MochiAd.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); options.ad_finished(); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; mc.unloadAd = function ():void{ MochiAd.unload(clip); }; mc.adLoaded = options.ad_loaded; mc.adSkipped = options.ad_skipped; mc.rpc = function (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; var sendHostProgress:Boolean; mc.regContLC = function (_arg1:String):void{ mc._containerLCName = _arg1; }; chk["onEnterFrame"] = function ():void{ var _local4:Number; if (!this.parent){ delete this.onEnterFrame; return; }; var _local1:Object = this.parent._mochiad_ctr; var _local2:Number = (getTimer() - this.started); var _local3:Boolean; if (!chk.showing){ _local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal; if (_local4 > 0){ chk.showing = true; _local3 = true; chk.started = getTimer(); } else { if (_local2 > chk.ad_timeout){ options.ad_failed(); _local3 = true; }; }; }; if (this.root == null){ _local3 = true; }; if (_local3){ delete this.onEnterFrame; }; }; doOnEnterFrame(chk); } public static function _isNetworkAvailable():Boolean{ return (!((Security.sandboxType == "localWithFile"))); } public static function _allowDomains(_arg1:String):String{ var _local2:String = _arg1.split("/")[2].split(":")[0]; Security.allowDomain("*"); Security.allowDomain(_local2); Security.allowInsecureDomain("*"); Security.allowInsecureDomain(_local2); return (_local2); } public static function unload(_arg1:Object):Boolean{ if (((_arg1.clip) && (_arg1.clip._mochiad))){ _arg1 = _arg1.clip; }; if (_arg1.origFrameRate != undefined){ _arg1.stage.frameRate = _arg1.origFrameRate; }; if (!_arg1._mochiad){ return (false); }; if (_arg1._mochiad._containerLCName != undefined){ _arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"}); }; if (_arg1._mochiad.onUnload){ _arg1._mochiad.onUnload(); }; delete _arg1._mochiad_loaded; delete _arg1._mochiad; return (true); } public static function showInterLevelAd(_arg1:Object):void{ var clip:Object; var mc:MovieClip; var chk:MovieClip; var options = _arg1; var DEFAULTS:Object = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{ if ((this.clip is MovieClip)){ this.clip.stop(); } else { throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_finished:function ():void{ if ((this.clip is MovieClip)){ this.clip.play(); } else { throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_loaded:function (_arg1:Number, _arg2:Number):void{ }, ad_failed:function ():void{ trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software"); }, ad_skipped:function ():void{ }}; options = MochiAd._parseOptions(options, DEFAULTS); clip = options.clip; var ad_msec:Number = 11000; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; var fadeout_time:Number = options.fadeout_time; delete options.fadeout_time; if (!MochiAd.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); options.ad_finished(); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.ad_msec = ad_msec; chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; chk.fadeout_time = fadeout_time; chk.fadeFunction = function ():void{ if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time))); if (_local1 > 0){ this.parent.alpha = (_local1 * 0.01); } else { MochiAd.unload(clip); delete this["onEnterFrame"]; }; }; mc.unloadAd = function ():void{ MochiAd.unload(clip); }; mc.adLoaded = options.ad_loaded; mc.adSkipped = options.ad_skipped; mc.adjustProgress = function (_arg1:Number):void{ var _local2:Object = mc._mochiad_wait; _local2.server_control = true; _local2.showing = true; _local2.started = getTimer(); _local2.ad_msec = (_arg1 - 250); }; mc.rpc = function (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; chk["onEnterFrame"] = function ():void{ var _local4:Number; if (!this.parent){ delete this.onEnterFrame; delete this.fadeFunction; return; }; var _local1:Object = this.parent._mochiad_ctr; var _local2:Number = (getTimer() - this.started); var _local3:Boolean; if (!chk.showing){ _local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal; if (_local4 > 0){ chk.showing = true; chk.started = getTimer(); MochiAd.adShowing(clip); } else { if (_local2 > chk.ad_timeout){ options.ad_failed(); _local3 = true; }; }; }; if (_local2 > chk.ad_msec){ _local3 = true; }; if (_local3){ if (this.server_control){ delete this.onEnterFrame; } else { this.fadeout_start = getTimer(); this.onEnterFrame = this.fadeFunction; }; }; }; doOnEnterFrame(chk); } public static function _parseOptions(_arg1:Object, _arg2:Object):Object{ var _local4:String; var _local5:Array; var _local6:Number; var _local7:Array; var _local3:Object = {}; for (_local4 in _arg2) { _local3[_local4] = _arg2[_local4]; }; if (_arg1){ for (_local4 in _arg1) { _local3[_local4] = _arg1[_local4]; }; }; if (_local3.clip == undefined){ throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite.")); }; _arg1 = _local3.clip.loaderInfo.parameters.mochiad_options; if (_arg1){ _local5 = _arg1.split("&"); _local6 = 0; while (_local6 < _local5.length) { _local7 = _local5[_local6].split("="); _local3[unescape(_local7[0])] = unescape(_local7[1]); _local6++; }; }; if (_local3.id == "test"){ trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!"); }; return (_local3); } public static function _cleanup(_arg1:Object):void{ var k:String; var lc:LocalConnection; var f:Function; var mc = _arg1; if (("lc" in mc)){ lc = mc.lc; f = function ():void{ try { lc.client = null; lc.close(); } catch(e:Error) { }; }; setTimeout(f, 0); }; var idx:Number = DisplayObjectContainer(mc).numChildren; while (idx > 0) { idx = (idx - 1); DisplayObjectContainer(mc).removeChildAt(idx); }; for (k in mc) { delete mc[k]; }; } public static function load(_arg1:Object):MovieClip{ var clip:Object; var k:String; var server:String; var hostname:String; var lc:LocalConnection; var name:String; var loader:Loader; var g:Function; var req:URLRequest; var v:Object; var options = _arg1; var DEFAULTS:Object = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"}; options = MochiAd._parseOptions(options, DEFAULTS); options.swfv = 9; options.mav = MochiAd.getVersion(); clip = options.clip; if (!MochiAd._isNetworkAvailable()){ return (null); }; try { if (clip._mochiad_loaded){ return (null); }; } catch(e:Error) { throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic.")); }; var depth:Number = options.depth; delete options.depth; var mc:MovieClip = createEmptyMovieClip(clip, "_mochiad", depth); var wh:Array = MochiAd._getRes(options, clip); options.res = ((wh[0] + "x") + wh[1]); options.server = (options.server + options.id); delete options.id; clip._mochiad_loaded = true; if (clip.loaderInfo.loaderURL.indexOf("http") == 0){ options.as3_swf = clip.loaderInfo.loaderURL; }; var lv:URLVariables = new URLVariables(); for (k in options) { v = options[k]; if (!(v is Function)){ lv[k] = v; }; }; server = lv.server; delete lv.server; hostname = _allowDomains(server); lc = new LocalConnection(); lc.client = mc; name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_"); lc.allowDomain("*", "localhost"); lc.allowInsecureDomain("*", "localhost"); lc.connect(name); mc.lc = lc; mc.lcName = name; lv.lc = name; lv.st = getTimer(); loader = new Loader(); g = function (_arg1:Object):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); MochiAd.unload(clip); }; loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g); req = new URLRequest((server + ".swf")); req.contentType = "application/x-www-form-urlencoded"; req.method = URLRequestMethod.POST; req.data = lv; loader.load(req); mc.addChild(loader); mc._mochiad_ctr = loader; return (mc); } public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{ var _local4:Array = _arg2.split("."); var _local5:Number = 0; while (_local5 < (_local4.length - 1)) { if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){ return (undefined); }; _arg1 = _arg1[_local4[_local5]]; _local5++; }; if (typeof(_arg1[_local4[_local5]]) == "function"){ return (_arg1[_local4[_local5]].apply(_arg1, _arg3)); }; return (undefined); } public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{ var _local4:MovieClip = new MovieClip(); if (((false) && (_arg3))){ _arg1.addChildAt(_local4, _arg3); } else { _arg1.addChild(_local4); }; _arg1[_arg2] = _local4; _local4["_name"] = _arg2; return (_local4); } public static function _getRes(_arg1:Object, _arg2:Object):Array{ var _local6:Array; var _local3:Object = _arg2.getBounds(_arg2.root); var _local4:Number = 0; var _local5:Number = 0; if (typeof(_arg1.res) != "undefined"){ _local6 = _arg1.res.split("x"); _local4 = parseFloat(_local6[0]); _local5 = parseFloat(_local6[1]); } else { _local4 = (_local3.xMax - _local3.xMin); _local5 = (_local3.yMax - _local3.yMin); }; if ((((_local4 == 0)) || ((_local5 == 0)))){ _local4 = _arg2.stage.stageWidth; _local5 = _arg2.stage.stageHeight; }; return ([_local4, _local5]); } public static function adShowing(_arg1:Object):void{ _arg1.origFrameRate = _arg1.stage.frameRate; _arg1.stage.frameRate = 30; } public static function getValue(_arg1:Object, _arg2:String):Object{ var _local3:Array = _arg2.split("."); var _local4:Number = 0; while (_local4 < (_local3.length - 1)) { if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){ return (undefined); }; _arg1 = _arg1[_local3[_local4]]; _local4++; }; return (_arg1[_local3[_local4]]); } public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{ var _local4:Object; var _local5:Object; switch (_arg3.id){ case "setValue": MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value); break; case "getValue": _local4 = MochiAd.getValue(_arg1, _arg3.objectName); _arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4); break; case "runMethod": _local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args); _arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5); break; default: trace(("[mochiads rpc] unknown rpc id: " + _arg3.id)); }; } public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{ var _local4:Array = _arg2.split("."); var _local5:Number = 0; while (_local5 < (_local4.length - 1)) { if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){ return; }; _arg1 = _arg1[_local4[_local5]]; _local5++; }; _arg1[_local4[_local5]] = _arg3; } public static function showPreGameAd(_arg1:Object):void{ var clip:Object; var mc:MovieClip; var chk:MovieClip; var complete:Boolean; var unloaded:Boolean; var sendHostProgress:Boolean; var r:MovieClip; var options = _arg1; var DEFAULTS:Object = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{ if ((this.clip is MovieClip)){ this.clip.stop(); } else { throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_finished:function ():void{ if ((this.clip is MovieClip)){ this.clip.play(); } else { throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers.")); }; }, ad_loaded:function (_arg1:Number, _arg2:Number):void{ }, ad_failed:function ():void{ trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software"); }, ad_skipped:function ():void{ }, ad_progress:function (_arg1:Number):void{ }}; options = MochiAd._parseOptions(options, DEFAULTS); if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){ options.ad_started(); setTimeout(options.ad_finished, 100); return; }; clip = options.clip; var ad_msec:Number = 11000; var ad_timeout:Number = options.ad_timeout; delete options.ad_timeout; var fadeout_time:Number = options.fadeout_time; delete options.fadeout_time; if (!MochiAd.load(options)){ options.ad_failed(); options.ad_finished(); return; }; options.ad_started(); mc = clip._mochiad; mc["onUnload"] = function ():void{ MochiAd._cleanup(mc); var fn:Function = function ():void{ options.ad_finished(); }; setTimeout(fn, 100); }; var wh:Array = MochiAd._getRes(options, clip); var w:Number = wh[0]; var h:Number = wh[1]; mc.x = (w * 0.5); mc.y = (h * 0.5); chk = createEmptyMovieClip(mc, "_mochiad_wait", 3); chk.x = (w * -0.5); chk.y = (h * -0.5); var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4); if (options.no_progress_bar){ bar.visible = false; delete options.no_progress_bar; } else { bar.x = 10; bar.y = (h - 20); }; var bar_color:Number = options.color; delete options.color; var bar_background:Number = options.background; delete options.background; var bar_outline:Number = options.outline; delete options.outline; var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1); var backing:Object = backing_mc.graphics; backing.beginFill(bar_background); backing.moveTo(0, 0); backing.lineTo((w - 20), 0); backing.lineTo((w - 20), 10); backing.lineTo(0, 10); backing.lineTo(0, 0); backing.endFill(); var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2); var inside:Object = inside_mc.graphics; inside.beginFill(bar_color); inside.moveTo(0, 0); inside.lineTo((w - 20), 0); inside.lineTo((w - 20), 10); inside.lineTo(0, 10); inside.lineTo(0, 0); inside.endFill(); inside_mc.scaleX = 0; var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3); var outline:Object = outline_mc.graphics; outline.lineStyle(0, bar_outline, 100); outline.moveTo(0, 0); outline.lineTo((w - 20), 0); outline.lineTo((w - 20), 10); outline.lineTo(0, 10); outline.lineTo(0, 0); chk.ad_msec = ad_msec; chk.ad_timeout = ad_timeout; chk.started = getTimer(); chk.showing = false; chk.last_pcnt = 0; chk.fadeout_time = fadeout_time; chk.fadeFunction = function ():void{ var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time))); if (_local1 > 0){ this.parent.alpha = (_local1 * 0.01); } else { MochiAd.unload(clip); delete this["onEnterFrame"]; }; }; complete = false; unloaded = false; var f:Function = function (_arg1:Event):void{ _arg1.target.removeEventListener(_arg1.type, arguments.callee); complete = true; if (unloaded){ MochiAd.unload(clip); }; }; clip.loaderInfo.addEventListener(Event.COMPLETE, f); if ((clip.root is MovieClip)){ r = (clip.root as MovieClip); if (r.framesLoaded >= r.totalFrames){ complete = true; }; }; mc.unloadAd = function ():void{ unloaded = true; if (complete){ MochiAd.unload(clip); }; }; mc.adLoaded = options.ad_loaded; mc.adSkipped = options.ad_skipped; mc.adjustProgress = function (_arg1:Number):void{ var _local2:Object = mc._mochiad_wait; _local2.server_control = true; _local2.showing = true; _local2.started = getTimer(); _local2.ad_msec = _arg1; }; mc.rpc = function (_arg1:Number, _arg2:Object):void{ MochiAd.rpc(clip, _arg1, _arg2); }; mc.rpcTestFn = function (_arg1:String):Object{ trace(("[MOCHIAD rpcTestFn] " + _arg1)); return (_arg1); }; mc.regContLC = function (_arg1:String):void{ mc._containerLCName = _arg1; }; sendHostProgress = false; mc.sendHostLoadProgress = function (_arg1:String):void{ sendHostProgress = true; }; chk["onEnterFrame"] = function ():void{ var _local11:Number; if (((!(this.parent)) || (!(this.parent.parent)))){ delete this["onEnterFrame"]; return; }; var _local1:Object = this.parent.parent.root; var _local2:Object = this.parent._mochiad_ctr; var _local3:Number = (getTimer() - this.started); var _local4:Boolean; var _local5:Number = _local1.loaderInfo.bytesTotal; var _local6:Number = _local1.loaderInfo.bytesLoaded; if (complete){ _local6 = Math.max(1, _local6); _local5 = _local6; }; var _local7:Number = ((100 * _local6) / _local5); var _local8:Number = ((100 * _local3) / chk.ad_msec); var _local9:Object = this._mochiad_bar._inside; var _local10:Number = Math.min(100, Math.min(((_local7) || (0)), _local8)); _local10 = Math.max(this.last_pcnt, _local10); this.last_pcnt = _local10; _local9.scaleX = (_local10 * 0.01); options.ad_progress(_local10); if (sendHostProgress){ clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7}); if (_local7 == 100){ sendHostProgress = false; }; }; if (!chk.showing){ _local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal; if (_local11 > 0){ chk.showing = true; chk.started = getTimer(); MochiAd.adShowing(clip); } else { if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){ options.ad_failed(); _local4 = true; }; }; }; if (_local3 > chk.ad_msec){ _local4 = true; }; if (((complete) && (_local4))){ if (this.server_control){ delete this.onEnterFrame; } else { this.fadeout_start = getTimer(); this.onEnterFrame = chk.fadeFunction; }; }; }; doOnEnterFrame(chk); } public static function showPreloaderAd(_arg1:Object):void{ trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0"); MochiAd.showPreGameAd(_arg1); } public static function showTimedAd(_arg1:Object):void{ trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0"); MochiAd.showInterLevelAd(_arg1); } public static function doOnEnterFrame(_arg1:MovieClip):void{ var mc = _arg1; var f:Function = function (_arg1:Object):void{ if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){ mc.onEnterFrame(); } else { _arg1.target.removeEventListener(_arg1.type, arguments.callee); }; }; mc.addEventListener(Event.ENTER_FRAME, f); } } }//package mochiSection 71//Preloader (mochi.Preloader) package mochi { import flash.events.*; import flash.display.*; import flash.utils.*; public dynamic class Preloader extends MovieClip { private var did_load:Boolean; public static var sSwfUrl:String = null; public static var GAME_OPTIONS:Object = {id:_mochiads_game_id, res:"512x558"}; public static var MAIN_CLASS:String = "game.GameCanvas"; public static var _mochiads_game_id:String = "a702cc65ba54b4e5"; public function Preloader(){ var k:String; super(); var f:Function = function (_arg1:IOErrorEvent):void{ }; loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f); sSwfUrl = loaderInfo.url; trace(("sSwfUrl= " + sSwfUrl)); var opts:Object = {}; for (k in GAME_OPTIONS) { opts[k] = GAME_OPTIONS[k]; }; opts.ad_started = function ():void{ did_load = true; }; opts.ad_finished = function ():void{ var _local1:Class = Class(getDefinitionByName(MAIN_CLASS)); var _local2:Object = new (_local1); addChild((_local2 as DisplayObject)); if (_local2.init){ _local2.init(did_load); }; }; opts.clip = this; MochiAd.showPreGameAd(opts); } } }//package mochiSection 72//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.coreSection 73//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.coreSection 74//mx_internal (mx.core.mx_internal) package mx.core { public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal"; }//package mx.coreSection 75//SoundAsset (mx.core.SoundAsset) package mx.core { import flash.media.*; public class SoundAsset extends Sound implements IFlexAsset { mx_internal static const VERSION:String = "3.0.0.0"; } }//package mx.core
Library Items
Symbol 1 MovieClip {com.kongregate.as3.client.KongregateAPI} [com.kongregate.as3.client.KongregateAPI] |
Symbol 2 Sound {game.ResLoader_SoundTelportStart} [game.ResLoader_SoundTelportStart] |
Symbol 3 Sound {game.ResLoader_SoundTelport} [game.ResLoader_SoundTelport] |
Symbol 4 Sound {game.ResLoader_SoundChild} [game.ResLoader_SoundChild] |
Symbol 5 Sound {game.ResLoader_SoundFinished} [game.ResLoader_SoundFinished] |
Symbol 6 BinaryData {game.ResLoader_ResFile} |
Special Tags
FileAttributes (69) | Timeline Frame 1 | Access network only, Metadata present, AS3. |
SWFMetaData (77) | Timeline Frame 1 | 455 bytes "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns ..." |
ScriptLimits (65) | Timeline Frame 1 | MaxRecursionDepth: 1000, ScriptTimeout: 60 seconds |
ExportAssets (56) | Timeline Frame 2 | Symbol 1 as "com.kongregate.as3.client.KongregateAPI" |
ExportAssets (56) | Timeline Frame 2 | Symbol 2 as "game.ResLoader_SoundTelportStart" |
ExportAssets (56) | Timeline Frame 2 | Symbol 3 as "game.ResLoader_SoundTelport" |
ExportAssets (56) | Timeline Frame 2 | Symbol 4 as "game.ResLoader_SoundChild" |
ExportAssets (56) | Timeline Frame 2 | Symbol 5 as "game.ResLoader_SoundFinished" |
SerialNumber (41) | Timeline Frame 1 |
Labels
"mochi_Preloader" | Frame 1 |
"game_canvas" | Frame 2 |
|