mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-20 01:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,139 @@
|
||||
package loader
|
||||
{
|
||||
import com.adobe.serialization.json.JSON;
|
||||
import com.sbi.loader.FileServerEvent;
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
public class DefPacksDefHelper
|
||||
{
|
||||
|
||||
public static const DEF_ITEM:int = 1000;
|
||||
|
||||
public static const DEF_AVATAR:int = 1003;
|
||||
|
||||
public static const DEF_LOCALIZATION:int = 1023;
|
||||
|
||||
public static const DEF_NPC:int = 1025;
|
||||
|
||||
public static const DEF_LAYER:int = 1027;
|
||||
|
||||
public static const DEF_DEN_ITEM:int = 1030;
|
||||
|
||||
public static const DEF_MEDIA:int = 1033;
|
||||
|
||||
public static const DEF_FACT:int = 1035;
|
||||
|
||||
public static const DEF_EMOTICON:int = 1036;
|
||||
|
||||
public static const DEF_STREAM:int = 1037;
|
||||
|
||||
public static const DEF_GENERIC_LIST_TYPE:int = 1038;
|
||||
|
||||
public static const DEF_DEN_ROOM:int = 1040;
|
||||
|
||||
public static const DEF_PET:int = 1046;
|
||||
|
||||
public static const DEF_PARTY:int = 1047;
|
||||
|
||||
public static const DEF_AVAILABILITY:int = 1048;
|
||||
|
||||
public static const DEF_NAMEBAR_BADGE:int = 1049;
|
||||
|
||||
public static const DEF_BATTLE_CARD:int = 1050;
|
||||
|
||||
public static const DEF_CURRENCY_EXCHANGE:int = 1051;
|
||||
|
||||
public static const DEF_SCRIPT:int = 1052;
|
||||
|
||||
public static const DEF_MOVIE_NODE:int = 1053;
|
||||
|
||||
public static const DEF_DIAMOND:int = 1054;
|
||||
|
||||
public static const DEF_PREFERRED_LOCALIZATION:int = 1055;
|
||||
|
||||
public static const DEF_AVATAR_CUSTOM:int = 1057;
|
||||
|
||||
public static const PREDICTIVE_TEXT_FILE_TO_APPEND_TO:int = 10;
|
||||
|
||||
public static const AUTO_CORRECT_TEXT_FILE_TO_APPEND_TO:int = 1;
|
||||
|
||||
public static var mediaArray:Array = [];
|
||||
|
||||
private var _id:uint;
|
||||
|
||||
private var _def:Object;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
private var _passback:Object;
|
||||
|
||||
public function DefPacksDefHelper()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get id() : int
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public function get def() : Object
|
||||
{
|
||||
return this._def;
|
||||
}
|
||||
|
||||
public function get passback() : Object
|
||||
{
|
||||
return this._passback;
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:Function = null, param3:Object = null, param4:int = 0) : void
|
||||
{
|
||||
this._id = param1;
|
||||
this._callback = param2;
|
||||
this._passback = param3;
|
||||
DefPacksFileServer.instance.addEventListener(FileServerEvent.ON_NEW_DATA,this.handleData,false,0,true);
|
||||
DefPacksFileServer.instance.requestFile(this._id,false,param4);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
DefPacksFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
this._callback = null;
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
var _loc2_:* = undefined;
|
||||
var _loc3_:ByteArray = null;
|
||||
if(param1.id == this._id && param1.success)
|
||||
{
|
||||
DefPacksFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
if(param1.contentType == FileServerEvent.JSON_TYPE)
|
||||
{
|
||||
param1.data.position = 0;
|
||||
this._def = com.adobe.serialization.json.JSON.decode(param1.data);
|
||||
}
|
||||
else if(param1.contentType == FileServerEvent.AMF3_TYPE)
|
||||
{
|
||||
_loc3_ = new ByteArray();
|
||||
_loc3_.writeObject(param1.data);
|
||||
_loc3_.position = 0;
|
||||
_loc2_ = _loc3_.readObject();
|
||||
_loc2_.uncompress("deflate");
|
||||
this._def = _loc2_.readObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
this._def = param1.data;
|
||||
}
|
||||
if(this._callback != null)
|
||||
{
|
||||
this._callback(this);
|
||||
this._callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class DefPacksFileServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static var _instance:DefPacksFileServer;
|
||||
|
||||
private static const CONTENT_PATH:String = "defPacks/";
|
||||
|
||||
public function DefPacksFileServer(param1:Class)
|
||||
{
|
||||
super(CONTENT_PATH);
|
||||
if(param1 != SingletonLock)
|
||||
{
|
||||
throw new Error("Invalid Singleton access. Use DefPacksFileServer.instance.");
|
||||
}
|
||||
}
|
||||
|
||||
public static function get instance() : DefPacksFileServer
|
||||
{
|
||||
if(!_instance)
|
||||
{
|
||||
_instance = new DefPacksFileServer(SingletonLock);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SingletonLock
|
||||
{
|
||||
|
||||
public function SingletonLock()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
package loader
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
import com.sbi.loader.FileServerEvent;
|
||||
import den.DenItem;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.Loader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.events.MouseEvent;
|
||||
import pet.PetManager;
|
||||
|
||||
public class DenItemHelper
|
||||
{
|
||||
|
||||
private var _id:uint;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
private var _loader:Loader;
|
||||
|
||||
private var _sprite:Sprite;
|
||||
|
||||
private var _portalSprite:Sprite;
|
||||
|
||||
private var _sortOffset:int;
|
||||
|
||||
private var _minigameDefId:int;
|
||||
|
||||
private var _version:int;
|
||||
|
||||
private var _version2:int;
|
||||
|
||||
private var _version3:int;
|
||||
|
||||
private var _bFlipLabel:Boolean;
|
||||
|
||||
private var _onMouseDownCallback:Function;
|
||||
|
||||
private var _onMouseOverCallback:Function;
|
||||
|
||||
private var _onMouseOutCallback:Function;
|
||||
|
||||
private var _passback:Object;
|
||||
|
||||
public function DenItemHelper()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get displayObject() : Sprite
|
||||
{
|
||||
return this._sprite;
|
||||
}
|
||||
|
||||
public function get content() : DisplayObject
|
||||
{
|
||||
return this._loader.content;
|
||||
}
|
||||
|
||||
public function get sortOffset() : int
|
||||
{
|
||||
return this._sortOffset;
|
||||
}
|
||||
|
||||
public function get id() : int
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public function get minigameDefId() : int
|
||||
{
|
||||
return this._minigameDefId;
|
||||
}
|
||||
|
||||
public function get bFlipLabel() : Boolean
|
||||
{
|
||||
return this._bFlipLabel;
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:Function, param3:int, param4:int = 0, param5:int = 0, param6:int = 0) : void
|
||||
{
|
||||
this._id = param1;
|
||||
this._callback = param2;
|
||||
this._minigameDefId = param4;
|
||||
this._bFlipLabel = false;
|
||||
this._version = param3;
|
||||
this._version2 = param5;
|
||||
this._version3 = param6;
|
||||
this._loader = new Loader();
|
||||
this._sprite = new Sprite();
|
||||
this._portalSprite = new Sprite();
|
||||
DenItemServer.instance.addEventListener(FileServerEvent.ON_NEW_DATA,this.handleData,false,0,true);
|
||||
DenItemServer.instance.requestFile(this._id);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
DenItemServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
if(this._loader)
|
||||
{
|
||||
if(this._loader.parent)
|
||||
{
|
||||
this._loader.parent.removeChild(this._loader);
|
||||
}
|
||||
this._loader.unloadAndStop(true);
|
||||
}
|
||||
this._callback = null;
|
||||
this._sprite = null;
|
||||
}
|
||||
|
||||
public function setupItemWithEmotes(param1:Object) : void
|
||||
{
|
||||
this._passback = param1;
|
||||
}
|
||||
|
||||
public function addPortalListeners(param1:Object, param2:Function, param3:Function = null, param4:Function = null) : void
|
||||
{
|
||||
this._passback = param1;
|
||||
this._onMouseDownCallback = param2;
|
||||
this._portalSprite.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown,false,0,true);
|
||||
if(param3 != null)
|
||||
{
|
||||
this._onMouseOverCallback = param3;
|
||||
this._portalSprite.addEventListener(MouseEvent.MOUSE_OVER,this.onMouseOver,false,0,true);
|
||||
}
|
||||
if(param4 != null)
|
||||
{
|
||||
this._onMouseOutCallback = param4;
|
||||
this._portalSprite.addEventListener(MouseEvent.MOUSE_OUT,this.onMouseOut,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
public function addMouseListeners(param1:Object, param2:Function, param3:Function = null, param4:Function = null) : void
|
||||
{
|
||||
this._passback = param1;
|
||||
this._onMouseDownCallback = param2;
|
||||
this._sprite.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown,false,0,true);
|
||||
if(param3 != null)
|
||||
{
|
||||
this._onMouseOverCallback = param3;
|
||||
this._sprite.addEventListener(MouseEvent.MOUSE_OVER,this.onMouseOver,false,0,true);
|
||||
}
|
||||
if(param4 != null)
|
||||
{
|
||||
this._onMouseOutCallback = param4;
|
||||
this._sprite.addEventListener(MouseEvent.MOUSE_OUT,this.onMouseOut,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeMouseListeners() : void
|
||||
{
|
||||
this._passback = null;
|
||||
this._onMouseDownCallback = null;
|
||||
this._sprite.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
|
||||
if(this._onMouseOverCallback != null)
|
||||
{
|
||||
this._onMouseOverCallback = null;
|
||||
this._sprite.removeEventListener(MouseEvent.MOUSE_OVER,this.onMouseOver);
|
||||
}
|
||||
if(this._onMouseOutCallback != null)
|
||||
{
|
||||
this._onMouseOutCallback = null;
|
||||
this._sprite.removeEventListener(MouseEvent.MOUSE_OUT,this.onMouseOut);
|
||||
}
|
||||
}
|
||||
|
||||
public function removePortalListeners() : void
|
||||
{
|
||||
this._passback = null;
|
||||
this._onMouseDownCallback = null;
|
||||
this._portalSprite.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown);
|
||||
if(this._onMouseOverCallback != null)
|
||||
{
|
||||
this._onMouseOverCallback = null;
|
||||
this._portalSprite.removeEventListener(MouseEvent.MOUSE_OVER,this.onMouseOver);
|
||||
}
|
||||
if(this._onMouseOutCallback != null)
|
||||
{
|
||||
this._onMouseOutCallback = null;
|
||||
this._portalSprite.removeEventListener(MouseEvent.MOUSE_OUT,this.onMouseOut);
|
||||
}
|
||||
}
|
||||
|
||||
public function getVersions() : Array
|
||||
{
|
||||
if(Boolean(this._loader) && Boolean(this._loader.content) && this._loader.content.hasOwnProperty("getVersions"))
|
||||
{
|
||||
return this._loader.content["getVersions"]();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function setVersion(param1:int, param2:int = 0, param3:int = 0) : void
|
||||
{
|
||||
this._version = param1;
|
||||
if(param2 > 0)
|
||||
{
|
||||
this._version2 = param2;
|
||||
}
|
||||
if(param3 > 0)
|
||||
{
|
||||
this._version3 = param3;
|
||||
}
|
||||
if(Boolean(this._loader) && Boolean(this._loader.content))
|
||||
{
|
||||
if(this._loader.content.hasOwnProperty("setVersion"))
|
||||
{
|
||||
if(this._version == -1)
|
||||
{
|
||||
this._version = this.getVersions()[0];
|
||||
}
|
||||
this._loader.content["setVersion"](param1);
|
||||
}
|
||||
else if(this._loader.content.hasOwnProperty("pet"))
|
||||
{
|
||||
PetManager.setPetState(MovieClip(this._loader.content),this._version,this._version2,this._version3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
if(param1.id == this._id && param1.success)
|
||||
{
|
||||
DenItemServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE,this.onBytesLoaded);
|
||||
param1.data.position = 0;
|
||||
_loc2_ = param1.data.readObject();
|
||||
this._sortOffset = _loc2_.so;
|
||||
this._loader.loadBytes(_loc2_.ba);
|
||||
}
|
||||
}
|
||||
|
||||
private function onBytesLoaded(param1:Event) : void
|
||||
{
|
||||
var _loc4_:Object = null;
|
||||
this._loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,this.onBytesLoaded);
|
||||
var _loc2_:int = int(this._loader.content["totalFrames"]);
|
||||
var _loc3_:Array = this._loader.content["currentLabels"];
|
||||
if(_loc2_ < 2)
|
||||
{
|
||||
this._loader.cacheAsBitmap = true;
|
||||
}
|
||||
else if(_loc3_.length >= 0)
|
||||
{
|
||||
for each(_loc4_ in _loc3_)
|
||||
{
|
||||
if(_loc4_.name == "flip")
|
||||
{
|
||||
this._bFlipLabel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(_loc2_ == 2)
|
||||
{
|
||||
this._loader.cacheAsBitmap = true;
|
||||
}
|
||||
}
|
||||
if(this._version == -1)
|
||||
{
|
||||
if(this._loader.content.hasOwnProperty("getVersions"))
|
||||
{
|
||||
this._version = this.getVersions()[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
this._version = 0;
|
||||
}
|
||||
}
|
||||
if(this._loader.content.hasOwnProperty("setVersion") && this._version >= 0)
|
||||
{
|
||||
MovieClip(this._loader.content).setVersion(this._version);
|
||||
}
|
||||
else if(this._loader.content.hasOwnProperty("pet"))
|
||||
{
|
||||
PetManager.setPetState(MovieClip(this._loader.content),this._version,this._version2,this._version3);
|
||||
}
|
||||
if(MovieClip(this._loader.content).isMoveToDisabled)
|
||||
{
|
||||
this._loader.name = "moveToDisabled";
|
||||
}
|
||||
if(this._passback != null)
|
||||
{
|
||||
if(this._passback.specialType == DenItem.SPECIAL_TYPE_PORTAL)
|
||||
{
|
||||
this._portalSprite.addChild(MovieClip(this._loader.content).clickObject);
|
||||
}
|
||||
else if(this._passback.specialType == DenItem.SPECIAL_TYPE_EMOTE && this._loader.content.hasOwnProperty("setEmoteCallback"))
|
||||
{
|
||||
MovieClip(this._loader.content).setEmoteCallback(this.onEmoteItemClicked);
|
||||
}
|
||||
}
|
||||
this._sprite.addChild(this._loader);
|
||||
this._sprite.addChild(this._portalSprite);
|
||||
if(this._callback != null)
|
||||
{
|
||||
this._callback(this);
|
||||
this._callback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onEmoteItemClicked(param1:int) : void
|
||||
{
|
||||
if(Boolean(AvatarManager.playerAvatarWorldView) && !AvatarManager.playerAvatarWorldView.isThisAttachmentOn(param1))
|
||||
{
|
||||
AvatarManager.setPlayerAttachmentEmot(param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseDown(param1:MouseEvent) : void
|
||||
{
|
||||
if(this._onMouseDownCallback != null)
|
||||
{
|
||||
this._onMouseDownCallback(param1,this._minigameDefId);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseOver(param1:MouseEvent) : void
|
||||
{
|
||||
if(this._onMouseOverCallback != null)
|
||||
{
|
||||
this._onMouseOverCallback(param1,this._passback,this._minigameDefId);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseOut(param1:MouseEvent) : void
|
||||
{
|
||||
if(this._onMouseOutCallback != null)
|
||||
{
|
||||
this._onMouseOutCallback(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class DenItemServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static var _instance:DenItemServer;
|
||||
|
||||
private static const CONTENT_PATH:String = "items/";
|
||||
|
||||
public function DenItemServer(param1:Class)
|
||||
{
|
||||
super(CONTENT_PATH);
|
||||
if(param1 != SingletonLock)
|
||||
{
|
||||
throw new Error("Invalid Singleton access. Use DenItemServer.instance.");
|
||||
}
|
||||
}
|
||||
|
||||
public static function get instance() : DenItemServer
|
||||
{
|
||||
if(!_instance)
|
||||
{
|
||||
_instance = new DenItemServer(SingletonLock);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SingletonLock
|
||||
{
|
||||
|
||||
public function SingletonLock()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.FileServerEvent;
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
public class FeedbackDefHelper
|
||||
{
|
||||
|
||||
private var _id:uint;
|
||||
|
||||
private var _def:Object;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
public function FeedbackDefHelper()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get id() : int
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public function get def() : Object
|
||||
{
|
||||
return this._def;
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:Function = null) : void
|
||||
{
|
||||
this._id = param1;
|
||||
this._callback = param2;
|
||||
FeedbackFileServer.instance.addEventListener(FileServerEvent.ON_NEW_DATA,this.handleData,false,0,true);
|
||||
FeedbackFileServer.instance.requestFile(this._id);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
FeedbackFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
this._callback = null;
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
var _loc2_:* = undefined;
|
||||
var _loc3_:ByteArray = null;
|
||||
if(param1.id == this._id && param1.success)
|
||||
{
|
||||
FeedbackFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
_loc3_ = new ByteArray();
|
||||
_loc3_.writeObject(param1.data);
|
||||
_loc3_.position = 0;
|
||||
_loc2_ = _loc3_.readObject();
|
||||
_loc2_.uncompress("deflate");
|
||||
this._def = _loc2_.readObject();
|
||||
if(this._callback != null)
|
||||
{
|
||||
this._callback(this);
|
||||
this._callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class FeedbackFileServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static var _instance:FeedbackFileServer;
|
||||
|
||||
private static const CONTENT_PATH:String = "feedbackDefs/";
|
||||
|
||||
public function FeedbackFileServer(param1:Class)
|
||||
{
|
||||
super(CONTENT_PATH);
|
||||
if(param1 != SingletonLock)
|
||||
{
|
||||
throw new Error("Invalid Singleton access. Use FeedbackFileServer.instance.");
|
||||
}
|
||||
}
|
||||
|
||||
public static function get instance() : FeedbackFileServer
|
||||
{
|
||||
if(!_instance)
|
||||
{
|
||||
_instance = new FeedbackFileServer(SingletonLock);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SingletonLock
|
||||
{
|
||||
|
||||
public function SingletonLock()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.FileServerEvent;
|
||||
import flash.display.Loader;
|
||||
import flash.display.LoaderInfo;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class JCDefHelper
|
||||
{
|
||||
|
||||
private var _id:uint;
|
||||
|
||||
private var _def:Object;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
private var _passback:Object;
|
||||
|
||||
private var _loadImage:Boolean;
|
||||
|
||||
private var _loader:Loader;
|
||||
|
||||
public function JCDefHelper()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get id() : int
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public function get def() : Object
|
||||
{
|
||||
return this._def;
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:Function = null, param3:Boolean = false, param4:Object = null) : void
|
||||
{
|
||||
this._id = param1;
|
||||
this._callback = param2;
|
||||
this._passback = param4;
|
||||
this._loadImage = param3;
|
||||
this._loader = new Loader();
|
||||
JCFileServer.instance.addEventListener(FileServerEvent.ON_NEW_DATA,this.handleData,false,0,true);
|
||||
if(param3)
|
||||
{
|
||||
JCFileServer.instance.requestFileWithExtension(this._id,false,FileServerEvent.JSON_TYPE,"images/");
|
||||
}
|
||||
else if(param1 == LocalizationManager.currentLanguage)
|
||||
{
|
||||
JCFileServer.instance.requestFileWithExtension(this._id,false,FileServerEvent.AMF3_TYPE,"index/");
|
||||
}
|
||||
else
|
||||
{
|
||||
JCFileServer.instance.requestFileWithExtension(this._id,false,FileServerEvent.AMF3_TYPE,"amf/");
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
JCFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
this._callback = null;
|
||||
this._passback = null;
|
||||
this._loader = null;
|
||||
}
|
||||
|
||||
public function deleteIndexFileFromCache() : void
|
||||
{
|
||||
JCFileServer.instance.clearFromCache("index/",1);
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
if(param1.id == this._id && param1.success)
|
||||
{
|
||||
JCFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
if(!this._loadImage)
|
||||
{
|
||||
param1.data.position = 0;
|
||||
this._def = param1.data.readObject();
|
||||
this.onComplete();
|
||||
}
|
||||
else
|
||||
{
|
||||
this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE,this.onBytesLoaded);
|
||||
this._loader.loadBytes(param1.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onBytesLoaded(param1:Event) : void
|
||||
{
|
||||
var _loc2_:LoaderInfo = param1.target as LoaderInfo;
|
||||
this._def = new MovieClip();
|
||||
this._def.addChild(_loc2_.content);
|
||||
if(this._def.hasOwnProperty("__rslPreloader") && Boolean(this._def.__rslPreloader))
|
||||
{
|
||||
this._def.addEventListener(Event.ENTER_FRAME,this.onFrame);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.onComplete();
|
||||
}
|
||||
}
|
||||
|
||||
private function onFrame(param1:Event) : void
|
||||
{
|
||||
if(this._def.__rslPreloader == null)
|
||||
{
|
||||
this._def.removeEventListener(Event.ENTER_FRAME,this.onFrame);
|
||||
this.onComplete();
|
||||
}
|
||||
}
|
||||
|
||||
private function onComplete() : void
|
||||
{
|
||||
if(this._passback != null)
|
||||
{
|
||||
this._def.defHelper = this;
|
||||
this._def.passback = this._passback;
|
||||
}
|
||||
if(this._callback != null)
|
||||
{
|
||||
this._callback(this._def);
|
||||
this._callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class JCFileServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static var _instance:JCFileServer;
|
||||
|
||||
private static const CONTENT_PATH:String = "ABSU/";
|
||||
|
||||
public function JCFileServer(param1:Class)
|
||||
{
|
||||
super(CONTENT_PATH);
|
||||
if(param1 != SingletonLock)
|
||||
{
|
||||
throw new Error("Invalid Singleton access. Use JCFileServer.instance.");
|
||||
}
|
||||
}
|
||||
|
||||
public static function get instance() : JCFileServer
|
||||
{
|
||||
if(!_instance)
|
||||
{
|
||||
_instance = new JCFileServer(SingletonLock);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
public function requestFileWithExtension(param1:uint, param2:Boolean = false, param3:int = 0, param4:String = "") : void
|
||||
{
|
||||
super.updatePath(CONTENT_PATH + param4);
|
||||
super.requestFile(param1,param2,param3,false);
|
||||
}
|
||||
|
||||
override public function clearFromCache(param1:String, param2:int) : void
|
||||
{
|
||||
super.clearFromCache(CONTENT_PATH + param1,param2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SingletonLock
|
||||
{
|
||||
|
||||
public function SingletonLock()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class MediaFileServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static var _instance:MediaFileServer;
|
||||
|
||||
private static const CONTENT_PATH:String = "media/";
|
||||
|
||||
public function MediaFileServer(param1:Class)
|
||||
{
|
||||
super(CONTENT_PATH);
|
||||
if(param1 != SingletonLock)
|
||||
{
|
||||
throw new Error("Invalid Singleton access. Use MediaFileServer.instance.");
|
||||
}
|
||||
}
|
||||
|
||||
public static function get instance() : MediaFileServer
|
||||
{
|
||||
if(!_instance)
|
||||
{
|
||||
_instance = new MediaFileServer(SingletonLock);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SingletonLock
|
||||
{
|
||||
|
||||
public function SingletonLock()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.FileServerEvent;
|
||||
import flash.display.Loader;
|
||||
import flash.display.LoaderInfo;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class MediaHelper
|
||||
{
|
||||
|
||||
private var _id:uint;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
private var _passback:Object;
|
||||
|
||||
private var _loader:Loader;
|
||||
|
||||
private var _mc:MovieClip;
|
||||
|
||||
public function MediaHelper()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:Function = null, param3:Object = null) : void
|
||||
{
|
||||
if(param1 == 0)
|
||||
{
|
||||
throw new Error("Media id is 0");
|
||||
}
|
||||
this._id = param1;
|
||||
this._callback = param2;
|
||||
this._passback = param3;
|
||||
this._loader = new Loader();
|
||||
MediaFileServer.instance.addEventListener(FileServerEvent.ON_NEW_DATA,this.handleMediaData);
|
||||
MediaFileServer.instance.requestFile(this._id);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
MediaFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleMediaData);
|
||||
this._mc = null;
|
||||
this._passback = null;
|
||||
this._loader = null;
|
||||
this._callback = null;
|
||||
}
|
||||
|
||||
public function get id() : int
|
||||
{
|
||||
if(this._loader == null)
|
||||
{
|
||||
throw new Error("attempt to get id of an uninitialized MediaHelper instance!");
|
||||
}
|
||||
return this._id;
|
||||
}
|
||||
|
||||
private function handleMediaData(param1:FileServerEvent) : void
|
||||
{
|
||||
if(param1.id != this._id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param1.success)
|
||||
{
|
||||
MediaFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleMediaData);
|
||||
this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE,this.onBytesLoaded);
|
||||
this._loader.loadBytes(param1.data);
|
||||
}
|
||||
}
|
||||
|
||||
private function onBytesLoaded(param1:Event) : void
|
||||
{
|
||||
var _loc2_:LoaderInfo = param1.target as LoaderInfo;
|
||||
this._mc = MovieClip(_loc2_.content);
|
||||
LocalizationManager.findAllTextfields(this._mc);
|
||||
if(this._passback != null)
|
||||
{
|
||||
this._mc.mediaHelper = this;
|
||||
this._mc.passback = this._passback;
|
||||
}
|
||||
if(this._mc.hasOwnProperty("__rslPreloader") && Boolean(this._mc.__rslPreloader))
|
||||
{
|
||||
this._mc.addEventListener(Event.ENTER_FRAME,this.onFrame);
|
||||
}
|
||||
else if(this._callback != null)
|
||||
{
|
||||
this._callback(this._mc);
|
||||
this._callback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onFrame(param1:Event) : void
|
||||
{
|
||||
if(this._mc.__rslPreloader == null)
|
||||
{
|
||||
this._mc.removeEventListener(Event.ENTER_FRAME,this.onFrame);
|
||||
if(this._callback != null)
|
||||
{
|
||||
this._callback(this._mc);
|
||||
this._callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.FileServerEvent;
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
public class NGFactDefHelper
|
||||
{
|
||||
|
||||
private var _id:uint;
|
||||
|
||||
private var _def:Object;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
private var _passback:Object;
|
||||
|
||||
public function NGFactDefHelper()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get id() : int
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public function get def() : Object
|
||||
{
|
||||
return this._def;
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:Function = null, param3:Object = null) : void
|
||||
{
|
||||
this._id = param1;
|
||||
this._callback = param2;
|
||||
this._passback = param3;
|
||||
NGFactFileServer.instance.addEventListener(FileServerEvent.ON_NEW_DATA,this.handleData,false,0,true);
|
||||
NGFactFileServer.instance.requestFile(this._id);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
NGFactFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
this._callback = null;
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
var _loc2_:* = undefined;
|
||||
var _loc3_:ByteArray = null;
|
||||
if(param1.id == this._id && param1.success)
|
||||
{
|
||||
NGFactFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
_loc3_ = new ByteArray();
|
||||
_loc3_.writeObject(param1.data);
|
||||
_loc3_.position = 0;
|
||||
_loc2_ = _loc3_.readObject();
|
||||
_loc2_.uncompress("deflate");
|
||||
this._def = _loc2_.readObject();
|
||||
if(this._passback != null)
|
||||
{
|
||||
this._def.passback = this._passback;
|
||||
this._passback = null;
|
||||
}
|
||||
if(this._callback != null)
|
||||
{
|
||||
this._callback(this);
|
||||
this._callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class NGFactFileServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static var _instance:NGFactFileServer;
|
||||
|
||||
private static const CONTENT_PATH:String = "factDefs/";
|
||||
|
||||
public function NGFactFileServer(param1:Class)
|
||||
{
|
||||
super(CONTENT_PATH);
|
||||
if(param1 != SingletonLock)
|
||||
{
|
||||
throw new Error("Invalid Singleton access. Use NGFactFileServer.instance.");
|
||||
}
|
||||
}
|
||||
|
||||
public static function get instance() : NGFactFileServer
|
||||
{
|
||||
if(!_instance)
|
||||
{
|
||||
_instance = new NGFactFileServer(SingletonLock);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SingletonLock
|
||||
{
|
||||
|
||||
public function SingletonLock()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package loader
|
||||
{
|
||||
import com.adobe.serialization.json.JSON;
|
||||
import com.sbi.loader.FileServerEvent;
|
||||
import flash.utils.ByteArray;
|
||||
|
||||
public class PollDefHelper
|
||||
{
|
||||
|
||||
private var _id:uint;
|
||||
|
||||
private var _def:Object;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
public function PollDefHelper()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get id() : int
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public function get def() : Object
|
||||
{
|
||||
return this._def;
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:Function = null) : void
|
||||
{
|
||||
this._id = param1;
|
||||
this._callback = param2;
|
||||
PollFileServer.instance.addEventListener(FileServerEvent.ON_NEW_DATA,this.handleData,false,0,true);
|
||||
PollFileServer.instance.requestFile(this._id,false,FileServerEvent.AMF3_TYPE);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
PollFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
this._callback = null;
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
var _loc2_:* = undefined;
|
||||
var _loc3_:ByteArray = null;
|
||||
if(param1.id == this._id && param1.success)
|
||||
{
|
||||
PollFileServer.instance.removeEventListener(FileServerEvent.ON_NEW_DATA,this.handleData);
|
||||
if(param1.contentType == FileServerEvent.JSON_TYPE)
|
||||
{
|
||||
this._def = com.adobe.serialization.json.JSON.decode(param1.data);
|
||||
}
|
||||
else if(param1.contentType == FileServerEvent.AMF3_TYPE)
|
||||
{
|
||||
_loc3_ = new ByteArray();
|
||||
_loc3_.writeObject(param1.data);
|
||||
_loc3_.position = 0;
|
||||
_loc2_ = _loc3_.readObject();
|
||||
_loc2_.uncompress("deflate");
|
||||
this._def = _loc2_.readObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
this._def = param1.data;
|
||||
}
|
||||
if(this._callback != null)
|
||||
{
|
||||
this._callback(this);
|
||||
this._callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class PollFileServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static var _instance:PollFileServer;
|
||||
|
||||
private static const CONTENT_PATH:String = "pollDefs/";
|
||||
|
||||
public function PollFileServer(param1:Class)
|
||||
{
|
||||
super(CONTENT_PATH);
|
||||
if(param1 != SingletonLock)
|
||||
{
|
||||
throw new Error("Invalid Singleton access. Use PollItemServer.instance.");
|
||||
}
|
||||
}
|
||||
|
||||
public static function get instance() : PollFileServer
|
||||
{
|
||||
if(!_instance)
|
||||
{
|
||||
_instance = new PollFileServer(SingletonLock);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SingletonLock
|
||||
{
|
||||
|
||||
public function SingletonLock()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user