mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27: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,160 @@
|
||||
package loader
|
||||
{
|
||||
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_ROOM:int = 1011;
|
||||
|
||||
public static const DEF_LOCALIZATION:int = 1023;
|
||||
|
||||
public static const DEF_GAME:int = 1024;
|
||||
|
||||
public static const DEF_NPC:int = 1025;
|
||||
|
||||
public static const DEF_LAYER:int = 1027;
|
||||
|
||||
public static const DEF_IMAGE_ARRAY_INFO:int = 1029;
|
||||
|
||||
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_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 DEF_ACHIEVEMENTS:int = 1042;
|
||||
|
||||
public static const DEF_EBOOK:int = 1058;
|
||||
|
||||
public static const DEF_PARTY_LIST:int = 1059;
|
||||
|
||||
public static const DEF_COMBINED_LIST:int = 1060;
|
||||
|
||||
public static const DEF_ADOPT_A_PET_LIST:int = 1061;
|
||||
|
||||
public static const DEF_PET_FOOD_LIST:int = 1062;
|
||||
|
||||
public static const DEF_PET_TOY_LIST:int = 1063;
|
||||
|
||||
public static const DEF_TYPE_WORLD_ITEMS:int = 1064;
|
||||
|
||||
public static const DEF_TYPE_NEWSPAPER:int = 1065;
|
||||
|
||||
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:Object;
|
||||
|
||||
private var _def:Object;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
private var _passback:Object;
|
||||
|
||||
public function DefPacksDefHelper()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get id() : Object
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public function get def() : Object
|
||||
{
|
||||
return _def;
|
||||
}
|
||||
|
||||
public function get passback() : Object
|
||||
{
|
||||
return _passback;
|
||||
}
|
||||
|
||||
public function init(param1:Object, param2:Function = null, param3:Object = null, param4:int = 0) : void
|
||||
{
|
||||
_id = param1;
|
||||
_callback = param2;
|
||||
_passback = param3;
|
||||
DefPacksFileServer.instance.addEventListener("OnNewData",handleData,false,0,true);
|
||||
DefPacksFileServer.instance.requestFile(_id,false,param4);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
DefPacksFileServer.instance.removeEventListener("OnNewData",handleData);
|
||||
_callback = null;
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
var _loc2_:* = undefined;
|
||||
var _loc3_:ByteArray = null;
|
||||
if(param1.id == _id && param1.success)
|
||||
{
|
||||
DefPacksFileServer.instance.removeEventListener("OnNewData",handleData);
|
||||
if(param1.contentType == 0)
|
||||
{
|
||||
param1.data.position = 0;
|
||||
_def = JSON.parse(param1.data);
|
||||
}
|
||||
else if(param1.contentType == 2)
|
||||
{
|
||||
_loc3_ = new ByteArray();
|
||||
_loc3_.writeObject(param1.data);
|
||||
_loc3_.position = 0;
|
||||
_loc2_ = _loc3_.readObject();
|
||||
_loc2_.uncompress("deflate");
|
||||
_def = _loc2_.readObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
_def = param1.data;
|
||||
}
|
||||
if(_callback != null)
|
||||
{
|
||||
_callback(this);
|
||||
_callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class DefPacksFileServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static const CONTENT_PATH:String = "defPacks/";
|
||||
|
||||
private static var _instance:DefPacksFileServer;
|
||||
|
||||
public function DefPacksFileServer(param1:Class)
|
||||
{
|
||||
super("defPacks/");
|
||||
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,630 @@
|
||||
package loader
|
||||
{
|
||||
import Enums.DenItemDef;
|
||||
import avatar.AvatarManager;
|
||||
import avatar.MannequinData;
|
||||
import com.sbi.loader.FileServerEvent;
|
||||
import den.DenItem;
|
||||
import den.DenStateItem;
|
||||
import den.DenXtCommManager;
|
||||
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.PetItem;
|
||||
import pet.PetManager;
|
||||
|
||||
public class DenItemHelper
|
||||
{
|
||||
|
||||
private var _denItem:DenItem;
|
||||
|
||||
private var _denStateItem:DenStateItem;
|
||||
|
||||
private var _defId:int;
|
||||
|
||||
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 _nameStrId:int;
|
||||
|
||||
private var _listLauncherId:int;
|
||||
|
||||
private var _version:int;
|
||||
|
||||
private var _version2:int;
|
||||
|
||||
private var _version3:int;
|
||||
|
||||
private var _petItem:PetItem;
|
||||
|
||||
private var _bFlipLabel:Boolean;
|
||||
|
||||
private var _isUniqueImageItem:Boolean;
|
||||
|
||||
private var _uniqueImageId:String;
|
||||
|
||||
private var _uniqueImageCreator:String;
|
||||
|
||||
private var _uniqueImageCreatorDbId:int;
|
||||
|
||||
private var _uniqueImageCreatorUUID:String;
|
||||
|
||||
private var _isMannequin:Boolean;
|
||||
|
||||
private var _isDenStore:Boolean;
|
||||
|
||||
private var _masterpieceDefHelper:MasterpieceDefHelper;
|
||||
|
||||
private var _mannequinData:MannequinData;
|
||||
|
||||
private var _onMouseDownCallback:Function;
|
||||
|
||||
private var _onMouseOverCallback:Function;
|
||||
|
||||
private var _onMouseOutCallback:Function;
|
||||
|
||||
private var _uniqueImage:Sprite;
|
||||
|
||||
public function DenItemHelper()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function get displayObject() : Sprite
|
||||
{
|
||||
return _sprite;
|
||||
}
|
||||
|
||||
public function get content() : DisplayObject
|
||||
{
|
||||
return _loader.content;
|
||||
}
|
||||
|
||||
public function get sortOffset() : int
|
||||
{
|
||||
return _sortOffset;
|
||||
}
|
||||
|
||||
public function get id() : int
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public function get minigameDefId() : int
|
||||
{
|
||||
return _minigameDefId;
|
||||
}
|
||||
|
||||
public function get bFlipLabel() : Boolean
|
||||
{
|
||||
return _bFlipLabel;
|
||||
}
|
||||
|
||||
public function get isUniqueImageItem() : Boolean
|
||||
{
|
||||
return _isUniqueImageItem;
|
||||
}
|
||||
|
||||
public function get listLauncherId() : int
|
||||
{
|
||||
return _listLauncherId;
|
||||
}
|
||||
|
||||
public function get nameStrId() : int
|
||||
{
|
||||
return _nameStrId;
|
||||
}
|
||||
|
||||
public function get uniqueImage() : Sprite
|
||||
{
|
||||
return _uniqueImage;
|
||||
}
|
||||
|
||||
public function get uniqueImageId() : String
|
||||
{
|
||||
return _uniqueImageId;
|
||||
}
|
||||
|
||||
public function set uniqueImageId(param1:String) : void
|
||||
{
|
||||
_uniqueImageId = param1;
|
||||
}
|
||||
|
||||
public function get uniqueImageCreator() : String
|
||||
{
|
||||
return _uniqueImageCreator;
|
||||
}
|
||||
|
||||
public function set uniqueImageCreator(param1:String) : void
|
||||
{
|
||||
_uniqueImageCreator = param1;
|
||||
}
|
||||
|
||||
public function get uniqueImageCreatorDbId() : int
|
||||
{
|
||||
return _uniqueImageCreatorDbId;
|
||||
}
|
||||
|
||||
public function get uniqueImageCreatorUUID() : String
|
||||
{
|
||||
return _uniqueImageCreatorUUID;
|
||||
}
|
||||
|
||||
public function get denStateItem() : DenStateItem
|
||||
{
|
||||
return _denStateItem;
|
||||
}
|
||||
|
||||
public function get defId() : int
|
||||
{
|
||||
return _defId;
|
||||
}
|
||||
|
||||
public function get version() : int
|
||||
{
|
||||
return _version;
|
||||
}
|
||||
|
||||
public function get mannequin() : MannequinData
|
||||
{
|
||||
return _mannequinData;
|
||||
}
|
||||
|
||||
public function get isMannequin() : Boolean
|
||||
{
|
||||
return _isMannequin;
|
||||
}
|
||||
|
||||
public function get isDenStore() : Boolean
|
||||
{
|
||||
return _isDenStore;
|
||||
}
|
||||
|
||||
public function get contentWidth() : int
|
||||
{
|
||||
if(_loader != null && _loader.content != null)
|
||||
{
|
||||
if(_loader.content.hasOwnProperty("sizeCont"))
|
||||
{
|
||||
return _loader.content["sizeCont"].width;
|
||||
}
|
||||
return _loader.content.width;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function get contentHeight() : int
|
||||
{
|
||||
if(_loader != null && _loader.content != null)
|
||||
{
|
||||
if(_loader.content.hasOwnProperty("sizeCont"))
|
||||
{
|
||||
return _loader.content["sizeCont"].height;
|
||||
}
|
||||
return _loader.content.height;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function get currDenItem() : DenItem
|
||||
{
|
||||
return _denItem;
|
||||
}
|
||||
|
||||
public function init(param1:DenItem, param2:Function, param3:PetItem = null, param4:int = 0, param5:int = 0, param6:MannequinData = null) : void
|
||||
{
|
||||
_denItem = param1;
|
||||
_defId = param1.defId;
|
||||
_id = uint(_defId << 16 | DenItem.getIconId(param1.sortId));
|
||||
_callback = param2;
|
||||
_minigameDefId = param1.minigameDefId;
|
||||
_nameStrId = param5;
|
||||
_listLauncherId = param4;
|
||||
_bFlipLabel = false;
|
||||
_isUniqueImageItem = false;
|
||||
_petItem = param3;
|
||||
_version = param1.sortId == 99 ? _petItem.petBits[0] : param1.version;
|
||||
_version2 = param1.sortId == 99 ? _petItem.petBits[1] : 0;
|
||||
_version3 = param1.sortId == 99 ? _petItem.petBits[2] : 0;
|
||||
_loader = new Loader();
|
||||
_sprite = new Sprite();
|
||||
_portalSprite = new Sprite();
|
||||
_uniqueImage = new Sprite();
|
||||
_uniqueImageId = param1.uniqueImageId;
|
||||
_uniqueImageCreator = param1.uniqueImageCreator;
|
||||
_uniqueImageCreatorDbId = param1.uniqueImageCreatorDbId;
|
||||
_uniqueImageCreatorUUID = param1.uniqueImageCreatorUUID;
|
||||
_mannequinData = param6;
|
||||
DenItemServer.instance.addEventListener("OnNewData",handleData,false,0,true);
|
||||
DenItemServer.instance.requestFile(_id);
|
||||
}
|
||||
|
||||
public function initDS(param1:DenStateItem, param2:Function) : void
|
||||
{
|
||||
_denStateItem = param1;
|
||||
_defId = param1.defId;
|
||||
_id = uint(_defId << 16 | param1.catId);
|
||||
_callback = param2;
|
||||
_minigameDefId = param1.minigameDefId;
|
||||
_nameStrId = param1.nameStrId;
|
||||
_listLauncherId = param1.listLauncherId;
|
||||
_bFlipLabel = false;
|
||||
_isUniqueImageItem = false;
|
||||
_petItem = param1.petItem;
|
||||
_version = param1.sortCatId == 99 ? _petItem.petBits[0] : param1.version;
|
||||
_version2 = param1.sortCatId == 99 ? _petItem.petBits[1] : 0;
|
||||
_version3 = param1.sortCatId == 99 ? _petItem.petBits[2] : 0;
|
||||
_loader = new Loader();
|
||||
_sprite = new Sprite();
|
||||
_portalSprite = new Sprite();
|
||||
_uniqueImage = new Sprite();
|
||||
_uniqueImageId = param1.uniqueImageId;
|
||||
_uniqueImageCreator = param1.uniqueImageCreator;
|
||||
_uniqueImageCreatorDbId = param1.uniqueImageCreatorDbId;
|
||||
_uniqueImageCreatorUUID = param1.uniqueImageCreatorUUID;
|
||||
_mannequinData = param1.mannequinData;
|
||||
DenItemServer.instance.addEventListener("OnNewData",handleData,false,0,true);
|
||||
DenItemServer.instance.requestFile(_id);
|
||||
}
|
||||
|
||||
public function initGeneric(param1:DenItemDef, param2:Function, param3:int = 0, param4:int = 0, param5:int = 0, param6:String = "", param7:int = -1, param8:String = "", param9:PetItem = null, param10:MannequinData = null) : void
|
||||
{
|
||||
_defId = param1.id;
|
||||
_id = uint(_defId << 16 | DenItem.getIconId(param1.sortCat));
|
||||
_callback = param2;
|
||||
_minigameDefId = param1.gameDefId;
|
||||
_nameStrId = param5;
|
||||
_listLauncherId = param4;
|
||||
_bFlipLabel = false;
|
||||
_isUniqueImageItem = false;
|
||||
_petItem = param9;
|
||||
_version = param1.sortCat == 99 ? _petItem.petBits[0] : param3;
|
||||
_version2 = param1.sortCat == 99 ? _petItem.petBits[1] : 0;
|
||||
_version3 = param1.sortCat == 99 ? _petItem.petBits[2] : 0;
|
||||
_loader = new Loader();
|
||||
_sprite = new Sprite();
|
||||
_portalSprite = new Sprite();
|
||||
_uniqueImage = new Sprite();
|
||||
_uniqueImageId = param6;
|
||||
_uniqueImageCreator = "";
|
||||
_uniqueImageCreatorDbId = param7;
|
||||
_uniqueImageCreatorUUID = param8;
|
||||
_mannequinData = param10;
|
||||
DenItemServer.instance.addEventListener("OnNewData",handleData,false,0,true);
|
||||
DenItemServer.instance.requestFile(_id);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
DenItemServer.instance.removeEventListener("OnNewData",handleData);
|
||||
if(_loader)
|
||||
{
|
||||
if(_loader.parent)
|
||||
{
|
||||
_loader.parent.removeChild(_loader);
|
||||
}
|
||||
_loader.unloadAndStop(true);
|
||||
}
|
||||
_callback = null;
|
||||
_sprite = null;
|
||||
}
|
||||
|
||||
public function loadUniqueImage() : void
|
||||
{
|
||||
if(_loader && _loader.content.hasOwnProperty("setUniqueImage"))
|
||||
{
|
||||
_isUniqueImageItem = true;
|
||||
if(_uniqueImageId != "")
|
||||
{
|
||||
_masterpieceDefHelper = new MasterpieceDefHelper();
|
||||
_masterpieceDefHelper.init(_uniqueImageId,onUniqueImageIdLoaded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setupItemWithEmotes(param1:DenStateItem) : void
|
||||
{
|
||||
_denStateItem = param1;
|
||||
}
|
||||
|
||||
public function addPortalListeners(param1:DenStateItem, param2:Function, param3:Function = null, param4:Function = null) : void
|
||||
{
|
||||
_denStateItem = param1;
|
||||
_onMouseDownCallback = param2;
|
||||
_portalSprite.addEventListener("mouseDown",onMouseDown,false,0,true);
|
||||
if(param3 != null)
|
||||
{
|
||||
_onMouseOverCallback = param3;
|
||||
_portalSprite.addEventListener("mouseOver",onMouseOver,false,0,true);
|
||||
}
|
||||
if(param4 != null)
|
||||
{
|
||||
_onMouseOutCallback = param4;
|
||||
_portalSprite.addEventListener("mouseOut",onMouseOut,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
public function addMouseListeners(param1:DenStateItem, param2:Function, param3:Function = null, param4:Function = null) : void
|
||||
{
|
||||
_denStateItem = param1;
|
||||
_onMouseDownCallback = param2;
|
||||
_sprite.addEventListener("mouseDown",onMouseDown,false,0,true);
|
||||
if(param3 != null)
|
||||
{
|
||||
_onMouseOverCallback = param3;
|
||||
_sprite.addEventListener("mouseOver",onMouseOver,false,0,true);
|
||||
}
|
||||
if(param4 != null)
|
||||
{
|
||||
_onMouseOutCallback = param4;
|
||||
_sprite.addEventListener("mouseOut",onMouseOut,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeMouseListeners() : void
|
||||
{
|
||||
_denStateItem = null;
|
||||
_onMouseDownCallback = null;
|
||||
_sprite.removeEventListener("mouseDown",onMouseDown);
|
||||
if(_onMouseOverCallback != null)
|
||||
{
|
||||
_onMouseOverCallback = null;
|
||||
_sprite.removeEventListener("mouseOver",onMouseOver);
|
||||
}
|
||||
if(_onMouseOutCallback != null)
|
||||
{
|
||||
_onMouseOutCallback = null;
|
||||
_sprite.removeEventListener("mouseOut",onMouseOut);
|
||||
}
|
||||
}
|
||||
|
||||
public function removePortalListeners() : void
|
||||
{
|
||||
_denStateItem = null;
|
||||
_onMouseDownCallback = null;
|
||||
_portalSprite.removeEventListener("mouseDown",onMouseDown);
|
||||
if(_onMouseOverCallback != null)
|
||||
{
|
||||
_onMouseOverCallback = null;
|
||||
_portalSprite.removeEventListener("mouseOver",onMouseOver);
|
||||
}
|
||||
if(_onMouseOutCallback != null)
|
||||
{
|
||||
_onMouseOutCallback = null;
|
||||
_portalSprite.removeEventListener("mouseOut",onMouseOut);
|
||||
}
|
||||
}
|
||||
|
||||
public function getVersions() : Array
|
||||
{
|
||||
if(_loader && _loader.content && _loader.content.hasOwnProperty("getVersions"))
|
||||
{
|
||||
return _loader.content["getVersions"]();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function setVersion(param1:int, param2:int = 0, param3:int = 0) : void
|
||||
{
|
||||
var _loc5_:MovieClip = null;
|
||||
var _loc4_:int = 0;
|
||||
_version = param1;
|
||||
if(param2 > 0)
|
||||
{
|
||||
_version2 = param2;
|
||||
}
|
||||
if(param3 > 0)
|
||||
{
|
||||
_version3 = param3;
|
||||
}
|
||||
if(_loader && _loader.content)
|
||||
{
|
||||
if(_loader.content.hasOwnProperty("setVersion"))
|
||||
{
|
||||
if(_version == -1)
|
||||
{
|
||||
_version = getVersions()[0];
|
||||
}
|
||||
_loader.content["setVersion"](param1);
|
||||
}
|
||||
else if(_loader.content.hasOwnProperty("pet"))
|
||||
{
|
||||
_loc5_ = MovieClip(_loader.content);
|
||||
PetManager.setPetState(_loc5_,_version,_version2,_version3);
|
||||
if(_petItem && _petItem.isEgg)
|
||||
{
|
||||
if(_loc5_.pet.hasOwnProperty("setEggDayInt"))
|
||||
{
|
||||
_loc4_ = _petItem.createdTs > 0 ? Math.floor((Utility.getInitialEpochTime() - _petItem.createdTs) / 86400) : 0;
|
||||
_loc5_.pet.setEggDayInt(_loc4_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function rebuildMannequinView() : void
|
||||
{
|
||||
var _loc1_:DenItemDef = DenXtCommManager.getDenItemDef(_defId);
|
||||
if(_loc1_ != null && _loc1_.mannequinAvatarDefId > 0)
|
||||
{
|
||||
_isMannequin = true;
|
||||
_mannequinData.setupMannequinAvatarView(_loc1_,MovieClip(_loader.content));
|
||||
}
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
if(param1.id == _id && param1.success)
|
||||
{
|
||||
DenItemServer.instance.removeEventListener("OnNewData",handleData);
|
||||
_loader.contentLoaderInfo.addEventListener("complete",onBytesLoaded);
|
||||
param1.data.position = 0;
|
||||
_loc2_ = param1.data.readObject();
|
||||
_sortOffset = _loc2_.so;
|
||||
_loader.loadBytes(_loc2_.ba);
|
||||
}
|
||||
}
|
||||
|
||||
private function onBytesLoaded(param1:Event) : void
|
||||
{
|
||||
var _loc3_:MovieClip = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc4_:DenItemDef = null;
|
||||
_loader.contentLoaderInfo.removeEventListener("complete",onBytesLoaded);
|
||||
var _loc5_:Array = _loader.content["currentLabels"];
|
||||
if(_loc5_.length >= 0)
|
||||
{
|
||||
for each(var _loc6_:Object in _loc5_)
|
||||
{
|
||||
if(_loc6_.name == "flip")
|
||||
{
|
||||
_bFlipLabel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!Utility.doesItAnimate(_loader.content))
|
||||
{
|
||||
_loader.cacheAsBitmap = true;
|
||||
}
|
||||
}
|
||||
if(_version == -1)
|
||||
{
|
||||
if(_loader.content.hasOwnProperty("getVersions"))
|
||||
{
|
||||
_version = getVersions()[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
_version = 0;
|
||||
}
|
||||
}
|
||||
if(_loader.content.hasOwnProperty("setVersion") && _version >= 0)
|
||||
{
|
||||
MovieClip(_loader.content).setVersion(_version);
|
||||
}
|
||||
else if(_loader.content.hasOwnProperty("pet"))
|
||||
{
|
||||
_loc3_ = MovieClip(_loader.content);
|
||||
PetManager.setPetState(_loc3_,_version,_version2,_version3);
|
||||
if(_petItem && _petItem.isEgg)
|
||||
{
|
||||
if(_loc3_.pet.hasOwnProperty("setEggDayInt"))
|
||||
{
|
||||
_loc2_ = _petItem.createdTs > 0 ? Math.floor((Utility.getInitialEpochTime() - _petItem.createdTs) / 86400) : 0;
|
||||
_loc3_.pet.setEggDayInt(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(MovieClip(_loader.content).isMoveToDisabled)
|
||||
{
|
||||
_loader.name = "moveToDisabled";
|
||||
}
|
||||
if(_mannequinData != null)
|
||||
{
|
||||
_loc4_ = DenXtCommManager.getDenItemDef(_defId);
|
||||
if(_loc4_ != null && _loc4_.mannequinAvatarDefId > 0)
|
||||
{
|
||||
_isMannequin = true;
|
||||
_mannequinData.setupMannequinAvatarView(_loc4_,MovieClip(_loader.content));
|
||||
}
|
||||
}
|
||||
if(_denStateItem != null)
|
||||
{
|
||||
if(_denStateItem.specialType == 1)
|
||||
{
|
||||
_portalSprite.addChild(MovieClip(_loader.content).clickObject);
|
||||
}
|
||||
else if(_denStateItem.specialType == 2 && _loader.content.hasOwnProperty("setEmoteCallback"))
|
||||
{
|
||||
MovieClip(_loader.content).setEmoteCallback(onEmoteItemClicked);
|
||||
}
|
||||
else if(_denStateItem.specialType == 5)
|
||||
{
|
||||
_isDenStore = true;
|
||||
}
|
||||
}
|
||||
if(_loader.content.hasOwnProperty("setUniqueImage"))
|
||||
{
|
||||
_isUniqueImageItem = true;
|
||||
if(_uniqueImageId != "")
|
||||
{
|
||||
_masterpieceDefHelper = new MasterpieceDefHelper();
|
||||
_masterpieceDefHelper.init(_uniqueImageId,onUniqueImageIdLoaded);
|
||||
}
|
||||
}
|
||||
_sprite.addChild(_loader);
|
||||
_sprite.addChild(_portalSprite);
|
||||
if(_callback != null)
|
||||
{
|
||||
_callback(this);
|
||||
_callback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onUniqueImageIdLoaded(param1:Sprite) : void
|
||||
{
|
||||
if(_masterpieceDefHelper)
|
||||
{
|
||||
_masterpieceDefHelper.destroy();
|
||||
_masterpieceDefHelper = null;
|
||||
}
|
||||
if(_uniqueImage)
|
||||
{
|
||||
_uniqueImage.addChild(param1);
|
||||
if(_loader && _loader.content && "setUniqueImage" in _loader.content)
|
||||
{
|
||||
MovieClip(_loader.content).setUniqueImage(_uniqueImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onEmoteItemClicked(param1:int) : void
|
||||
{
|
||||
if(AvatarManager.playerAvatarWorldView && !AvatarManager.playerAvatarWorldView.isThisAttachmentOn(param1))
|
||||
{
|
||||
AvatarManager.setPlayerAttachmentEmot(param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseDown(param1:MouseEvent) : void
|
||||
{
|
||||
if(_onMouseDownCallback != null)
|
||||
{
|
||||
_onMouseDownCallback(param1,this);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseOver(param1:MouseEvent) : void
|
||||
{
|
||||
if(_onMouseOverCallback != null)
|
||||
{
|
||||
_onMouseOverCallback(param1,this);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseOut(param1:MouseEvent) : void
|
||||
{
|
||||
if(_onMouseOutCallback != null)
|
||||
{
|
||||
_onMouseOutCallback(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class DenItemServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static const CONTENT_PATH:String = "items/";
|
||||
|
||||
private static var _instance:DenItemServer;
|
||||
|
||||
public function DenItemServer(param1:Class)
|
||||
{
|
||||
super("items/");
|
||||
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 _id;
|
||||
}
|
||||
|
||||
public function get def() : Object
|
||||
{
|
||||
return _def;
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:Function = null) : void
|
||||
{
|
||||
_id = param1;
|
||||
_callback = param2;
|
||||
FeedbackFileServer.instance.addEventListener("OnNewData",handleData,false,0,true);
|
||||
FeedbackFileServer.instance.requestFile(_id);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
FeedbackFileServer.instance.removeEventListener("OnNewData",handleData);
|
||||
_callback = null;
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
var _loc2_:* = undefined;
|
||||
var _loc3_:ByteArray = null;
|
||||
if(param1.id == _id && param1.success)
|
||||
{
|
||||
FeedbackFileServer.instance.removeEventListener("OnNewData",handleData);
|
||||
_loc3_ = new ByteArray();
|
||||
_loc3_.writeObject(param1.data);
|
||||
_loc3_.position = 0;
|
||||
_loc2_ = _loc3_.readObject();
|
||||
_loc2_.uncompress("deflate");
|
||||
_def = _loc2_.readObject();
|
||||
if(_callback != null)
|
||||
{
|
||||
_callback(this);
|
||||
_callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class FeedbackFileServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static const CONTENT_PATH:String = "feedbackDefs/";
|
||||
|
||||
private static var _instance:FeedbackFileServer;
|
||||
|
||||
public function FeedbackFileServer(param1:Class)
|
||||
{
|
||||
super("feedbackDefs/");
|
||||
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,68 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.FileServerEvent;
|
||||
import flash.display.Loader;
|
||||
import flash.display.LoaderInfo;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
|
||||
public class MasterpieceDefHelper
|
||||
{
|
||||
|
||||
private var _id:String;
|
||||
|
||||
private var _def:Object;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
private var _loader:Loader;
|
||||
|
||||
private var _image:Sprite;
|
||||
|
||||
public function MasterpieceDefHelper()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:String, param2:Function = null) : void
|
||||
{
|
||||
_id = param1;
|
||||
_callback = param2;
|
||||
_loader = new Loader();
|
||||
MasterpieceFileServer.instance.addEventListener("OnNewData",handleData,false,0,true);
|
||||
MasterpieceFileServer.instance.requestFile(_id);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
MasterpieceFileServer.instance.removeEventListener("OnNewData",handleData);
|
||||
_callback = null;
|
||||
_loader = null;
|
||||
_image = null;
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
if(param1.id == _id && param1.success)
|
||||
{
|
||||
MasterpieceFileServer.instance.removeEventListener("OnNewData",handleData);
|
||||
_loader.contentLoaderInfo.addEventListener("complete",onBytesLoaded);
|
||||
_loader.loadBytes(param1.data);
|
||||
}
|
||||
}
|
||||
|
||||
private function onBytesLoaded(param1:Event) : void
|
||||
{
|
||||
var _loc2_:LoaderInfo = param1.target as LoaderInfo;
|
||||
_image = new Sprite();
|
||||
_image.addChild(_loc2_.content);
|
||||
param1.target.removeEventListener("complete",onBytesLoaded);
|
||||
if(_callback != null)
|
||||
{
|
||||
_callback(_image);
|
||||
_callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class MasterpieceFileServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static const CONTENT_PATH:String = "masterpieces/";
|
||||
|
||||
private static var _instance:MasterpieceFileServer;
|
||||
|
||||
public function MasterpieceFileServer(param1:Class)
|
||||
{
|
||||
super("masterpieces/");
|
||||
if(param1 != SingletonLock)
|
||||
{
|
||||
throw new Error("Invalid Singleton access. Use MasterpieceFileServer.instance.");
|
||||
}
|
||||
}
|
||||
|
||||
public static function get instance() : MasterpieceFileServer
|
||||
{
|
||||
if(!_instance)
|
||||
{
|
||||
_instance = new MasterpieceFileServer(SingletonLock);
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
override public function requestFile(param1:Object, param2:Boolean = false, param3:int = 0, param4:Boolean = false, param5:Function = null) : void
|
||||
{
|
||||
super.requestFile(param1,param2,param3,false,param5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SingletonLock
|
||||
{
|
||||
|
||||
public function SingletonLock()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class MediaFileServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static const CONTENT_PATH:String = "media/";
|
||||
|
||||
private static var _instance:MediaFileServer;
|
||||
|
||||
public function MediaFileServer(param1:Class)
|
||||
{
|
||||
super("media/");
|
||||
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,131 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.FileServerEvent;
|
||||
import flash.display.Loader;
|
||||
import flash.display.LoaderInfo;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.events.ProgressEvent;
|
||||
import flash.system.LoaderContext;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class MediaHelper
|
||||
{
|
||||
|
||||
private var _id:uint;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
private var _passback:Object;
|
||||
|
||||
private var _loader:Loader;
|
||||
|
||||
private var _loadProgressFunc:Function;
|
||||
|
||||
private var _mc:MovieClip;
|
||||
|
||||
public function MediaHelper()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:Function = null, param3:Object = null, param4:Function = null) : void
|
||||
{
|
||||
if(param1 == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_id = param1;
|
||||
_callback = param2;
|
||||
_passback = param3;
|
||||
_loadProgressFunc = param4;
|
||||
_loader = new Loader();
|
||||
MediaFileServer.instance.addEventListener("OnNewData",handleMediaData);
|
||||
MediaFileServer.instance.addEventListener("progress",onLoadProgress);
|
||||
MediaFileServer.instance.requestFile(_id);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
MediaFileServer.instance.removeEventListener("OnNewData",handleMediaData);
|
||||
_mc = null;
|
||||
_passback = null;
|
||||
_loader = null;
|
||||
_callback = null;
|
||||
_loadProgressFunc = null;
|
||||
}
|
||||
|
||||
public function get id() : int
|
||||
{
|
||||
if(_loader == null)
|
||||
{
|
||||
throw new Error("attempt to get id of an uninitialized MediaHelper instance!");
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
|
||||
private function handleMediaData(param1:FileServerEvent) : void
|
||||
{
|
||||
var _loc2_:LoaderContext = null;
|
||||
if(param1.id != _id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param1.success)
|
||||
{
|
||||
MediaFileServer.instance.removeEventListener("OnNewData",handleMediaData);
|
||||
_loader.contentLoaderInfo.addEventListener("complete",onBytesLoaded);
|
||||
_loader.contentLoaderInfo.addEventListener("progress",onLoadProgress);
|
||||
_loc2_ = new LoaderContext();
|
||||
_loc2_.allowCodeImport = true;
|
||||
_loader.loadBytes(param1.data,_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private function onLoadProgress(param1:ProgressEvent) : void
|
||||
{
|
||||
if(_loadProgressFunc != null)
|
||||
{
|
||||
_loadProgressFunc(param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onBytesLoaded(param1:Event) : void
|
||||
{
|
||||
var _loc2_:LoaderInfo = param1.target as LoaderInfo;
|
||||
_mc = MovieClip(_loc2_.content);
|
||||
LocalizationManager.findAllTextfields(_mc);
|
||||
if(_passback != null)
|
||||
{
|
||||
_mc.mediaHelper = this;
|
||||
_mc.passback = _passback;
|
||||
}
|
||||
param1.target.removeEventListener("complete",onBytesLoaded);
|
||||
param1.target.removeEventListener("OnLoadProgress",onLoadProgress);
|
||||
_loadProgressFunc = null;
|
||||
if(_mc.hasOwnProperty("__rslPreloader") && _mc.__rslPreloader)
|
||||
{
|
||||
_mc.addEventListener("enterFrame",onFrame);
|
||||
}
|
||||
else if(_callback != null)
|
||||
{
|
||||
_callback(_mc);
|
||||
_callback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onFrame(param1:Event) : void
|
||||
{
|
||||
if(_mc.__rslPreloader == null)
|
||||
{
|
||||
_mc.removeEventListener("enterFrame",onFrame);
|
||||
if(_callback != null)
|
||||
{
|
||||
_callback(_mc);
|
||||
_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 _id;
|
||||
}
|
||||
|
||||
public function get def() : Object
|
||||
{
|
||||
return _def;
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:Function = null, param3:Object = null) : void
|
||||
{
|
||||
_id = param1;
|
||||
_callback = param2;
|
||||
_passback = param3;
|
||||
NGFactFileServer.instance.addEventListener("OnNewData",handleData,false,0,true);
|
||||
NGFactFileServer.instance.requestFile(_id);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
NGFactFileServer.instance.removeEventListener("OnNewData",handleData);
|
||||
_callback = null;
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
var _loc2_:* = undefined;
|
||||
var _loc3_:ByteArray = null;
|
||||
if(param1.id == _id && param1.success)
|
||||
{
|
||||
NGFactFileServer.instance.removeEventListener("OnNewData",handleData);
|
||||
_loc3_ = new ByteArray();
|
||||
_loc3_.writeObject(param1.data);
|
||||
_loc3_.position = 0;
|
||||
_loc2_ = _loc3_.readObject();
|
||||
_loc2_.uncompress("deflate");
|
||||
_def = _loc2_.readObject();
|
||||
if(_passback != null)
|
||||
{
|
||||
_def.passback = _passback;
|
||||
_passback = null;
|
||||
}
|
||||
if(_callback != null)
|
||||
{
|
||||
_callback(this);
|
||||
_callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class NGFactFileServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static const CONTENT_PATH:String = "factDefs/";
|
||||
|
||||
private static var _instance:NGFactFileServer;
|
||||
|
||||
public function NGFactFileServer(param1:Class)
|
||||
{
|
||||
super("factDefs/");
|
||||
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,77 @@
|
||||
package loader
|
||||
{
|
||||
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 _id;
|
||||
}
|
||||
|
||||
public function get def() : Object
|
||||
{
|
||||
return _def;
|
||||
}
|
||||
|
||||
public function init(param1:uint, param2:Function = null) : void
|
||||
{
|
||||
_id = param1;
|
||||
_callback = param2;
|
||||
PollFileServer.instance.addEventListener("OnNewData",handleData,false,0,true);
|
||||
PollFileServer.instance.requestFile(_id,false,2);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
PollFileServer.instance.removeEventListener("OnNewData",handleData);
|
||||
_callback = null;
|
||||
}
|
||||
|
||||
private function handleData(param1:FileServerEvent) : void
|
||||
{
|
||||
var _loc2_:* = undefined;
|
||||
var _loc3_:ByteArray = null;
|
||||
if(param1.id == _id && param1.success)
|
||||
{
|
||||
PollFileServer.instance.removeEventListener("OnNewData",handleData);
|
||||
if(param1.contentType == 0)
|
||||
{
|
||||
_def = JSON.parse(param1.data);
|
||||
}
|
||||
else if(param1.contentType == 2)
|
||||
{
|
||||
_loc3_ = new ByteArray();
|
||||
_loc3_.writeObject(param1.data);
|
||||
_loc3_.position = 0;
|
||||
_loc2_ = _loc3_.readObject();
|
||||
_loc2_.uncompress("deflate");
|
||||
_def = _loc2_.readObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
_def = param1.data;
|
||||
}
|
||||
if(_callback != null)
|
||||
{
|
||||
_callback(this);
|
||||
_callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package loader
|
||||
{
|
||||
import com.sbi.loader.BaseFileServer;
|
||||
|
||||
public class PollFileServer extends BaseFileServer
|
||||
{
|
||||
|
||||
private static const CONTENT_PATH:String = "pollDefs/";
|
||||
|
||||
private static var _instance:PollFileServer;
|
||||
|
||||
public function PollFileServer(param1:Class)
|
||||
{
|
||||
super("pollDefs/");
|
||||
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