mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 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,542 @@
|
||||
package den
|
||||
{
|
||||
import flash.display.Loader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import item.Item;
|
||||
import loader.DenItemHelper;
|
||||
import pet.PetManager;
|
||||
|
||||
public class DenItem
|
||||
{
|
||||
|
||||
public static const SORT_FLOOR:int = 0;
|
||||
|
||||
public static const SORT_WALL:int = 1;
|
||||
|
||||
public static const SORT_FLOORING:int = 2;
|
||||
|
||||
public static const SORT_WALLPAPER:int = 3;
|
||||
|
||||
public static const SORT_AUDIO:int = 4;
|
||||
|
||||
public static const SORT_PET:int = 5;
|
||||
|
||||
public static const PLACE_CAT_FLOOR:int = 1;
|
||||
|
||||
public static const PLACE_CAT_WALL:int = 2;
|
||||
|
||||
public static const PLACE_CAT_ICONL:int = 3;
|
||||
|
||||
public static const SPECIAL_TYPE_NORMAL:int = 0;
|
||||
|
||||
public static const SPECIAL_TYPE_PORTAL:int = 1;
|
||||
|
||||
public static const SPECIAL_TYPE_EMOTE:int = 2;
|
||||
|
||||
public static const REF_ID_DEN_ITEM:int = 0;
|
||||
|
||||
public static const REF_ID_PET_ITEM:int = 1;
|
||||
|
||||
public static const DEN_PET_LAYER_ID:int = 0;
|
||||
|
||||
public static const NORMAL_ITEM:int = 0;
|
||||
|
||||
public static const NEW_ITEM:int = 1;
|
||||
|
||||
public static const SALE_ITEM:int = 2;
|
||||
|
||||
public static const CLEARANCE_ITEM:int = 3;
|
||||
|
||||
public static const RARE_ITEM:int = 4;
|
||||
|
||||
public static const DEF_AUDIO_DEF_ID:int = 617;
|
||||
|
||||
public static const DEF_AUDIO_PACKED_ID:uint = DEF_AUDIO_DEF_ID << 16 | PLACE_CAT_ICONL;
|
||||
|
||||
public static const DEF_AUDIO_INVIDX:int = -1;
|
||||
|
||||
public static const DEF_AUDIO_STRMNAME:String = "MusDenDef";
|
||||
|
||||
public static const DEF_AUDIO_VOL:int = 50;
|
||||
|
||||
public static const WIND_SMALL_SIZE:int = 80;
|
||||
|
||||
public static const WIND_MED_SIZE:int = 168;
|
||||
|
||||
public static const WIND_LARGE_SIZE:int = 280;
|
||||
|
||||
public var refId:int;
|
||||
|
||||
public var invIdx:int;
|
||||
|
||||
public var categoryId:int;
|
||||
|
||||
public var value:int;
|
||||
|
||||
public var layerId:int;
|
||||
|
||||
public var sortId:int;
|
||||
|
||||
public var name:String;
|
||||
|
||||
public var isMemberOnly:Boolean;
|
||||
|
||||
public var version:int;
|
||||
|
||||
public var version2:int;
|
||||
|
||||
public var version3:int;
|
||||
|
||||
public var strmName:String;
|
||||
|
||||
public var enviroType:int;
|
||||
|
||||
public var recycleValue:int;
|
||||
|
||||
public var currencyType:int;
|
||||
|
||||
public var endTime:uint;
|
||||
|
||||
public var specialType:int;
|
||||
|
||||
private var _diamondDefId:int = -1;
|
||||
|
||||
private var _itemDefId:int;
|
||||
|
||||
public var itemStatus:int;
|
||||
|
||||
public var minigameDefId:int;
|
||||
|
||||
public var isIconLoaded:Boolean;
|
||||
|
||||
public var imageLoadedCallback:Function;
|
||||
|
||||
private var _icon:Sprite;
|
||||
|
||||
private var _iconHelper:DenItemHelper;
|
||||
|
||||
private var _largeIcon:Sprite;
|
||||
|
||||
private var _largeIconHelper:DenItemHelper;
|
||||
|
||||
private var _isShopItem:Boolean;
|
||||
|
||||
private var _listenToMouse:Boolean;
|
||||
|
||||
private var _globalScale:Number = 1;
|
||||
|
||||
private var _setRandomVersion:Boolean;
|
||||
|
||||
public function DenItem()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function getIconId(sortId:int) : int
|
||||
{
|
||||
if(sortId == SORT_FLOOR || sortId == SORT_PET)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if(sortId == SORT_WALL)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if(sortId == SORT_FLOORING || sortId == SORT_WALLPAPER || sortId == SORT_AUDIO)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
return sortId + 1;
|
||||
}
|
||||
|
||||
public static function getInWorldId(sortId:int, currDenCatId:int) : int
|
||||
{
|
||||
if(sortId == SORT_FLOOR || sortId == SORT_PET)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if(sortId == SORT_WALL)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if(sortId == SORT_AUDIO)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
return currDenCatId;
|
||||
}
|
||||
|
||||
public function init(initItemDefId:int, initInvIdx:int = 0, initCategoryId:int = 0, initVersion:int = 0, initRefId:int = 0, initPetExtra:int = 0, initPetExtra2:int = 0, initEndTime:uint = 0) : void
|
||||
{
|
||||
var currDef:Object = null;
|
||||
this.refId = initRefId;
|
||||
this.invIdx = initInvIdx;
|
||||
this._itemDefId = initItemDefId;
|
||||
this.categoryId = initCategoryId;
|
||||
this.version = initVersion;
|
||||
this.endTime = initEndTime;
|
||||
if(initRefId == REF_ID_PET_ITEM)
|
||||
{
|
||||
currDef = PetManager.getPetDef(this._itemDefId);
|
||||
this._itemDefId = DenXtCommManager.denItemDefIdForPetDefId(this._itemDefId);
|
||||
this.value = currDef.cost;
|
||||
this.layerId = DEN_PET_LAYER_ID;
|
||||
this.sortId = SORT_PET;
|
||||
this.isMemberOnly = currDef.isMember;
|
||||
this.itemStatus = currDef.status;
|
||||
this.value = this.isOnSale ? int(currDef.cost * 0.5) : int(currDef.cost);
|
||||
this.strmName = "";
|
||||
this.name = currDef.title;
|
||||
this.minigameDefId = 0;
|
||||
this.version2 = initPetExtra;
|
||||
this.version3 = initPetExtra2;
|
||||
this.enviroType = PetManager.getEnviroTypeByPetType(currDef.type);
|
||||
this.recycleValue = currDef.recycleValue == "0" || currDef.recycleValue == null ? int(currDef.cost * gMainFrame.clientInfo.recyclePercentage) : int(currDef.recycleValue);
|
||||
this.currencyType = 0;
|
||||
this._globalScale = 1;
|
||||
this.specialType = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
currDef = DenXtCommManager.getDenItemDef(initItemDefId);
|
||||
this.value = currDef.cost;
|
||||
this.layerId = currDef.layer;
|
||||
this.sortId = currDef.sortCat;
|
||||
this.isMemberOnly = currDef.membersOnly == "1";
|
||||
this.itemStatus = currDef.itemStatus;
|
||||
this.value = this.isOnSale ? int(currDef.cost * 0.5) : int(currDef.cost);
|
||||
this.strmName = this._itemDefId == DEF_AUDIO_DEF_ID ? DEF_AUDIO_STRMNAME : currDef.abbrName;
|
||||
this.name = currDef.name;
|
||||
this.minigameDefId = currDef.gameDefId;
|
||||
this.version2 = currDef.flag;
|
||||
this.enviroType = currDef.enviroType;
|
||||
this.currencyType = currDef.currencyType;
|
||||
this.recycleValue = currDef.recycleValue == "0" && this.currencyType != Item.TICKET_CURRENCY ? int(this.value * gMainFrame.clientInfo.recyclePercentage) : int(currDef.recycleValue);
|
||||
this._globalScale = currDef.scalePercent / 100;
|
||||
this.specialType = currDef.specialType;
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(Boolean(this._iconHelper))
|
||||
{
|
||||
this._iconHelper.destroy();
|
||||
this._iconHelper = null;
|
||||
}
|
||||
this._icon = null;
|
||||
if(Boolean(this._largeIconHelper))
|
||||
{
|
||||
this._largeIconHelper.destroy();
|
||||
this._largeIconHelper = null;
|
||||
}
|
||||
this._largeIcon = null;
|
||||
}
|
||||
|
||||
public function initShopItem(initItemDefId:int, initVersion:int, setRandomVersion:Boolean = false, initEndTime:uint = 0) : void
|
||||
{
|
||||
this._itemDefId = initItemDefId;
|
||||
this._setRandomVersion = setRandomVersion;
|
||||
this.version = initVersion;
|
||||
var currDef:Object = DenXtCommManager.getDenItemDef(initItemDefId);
|
||||
this.name = currDef.name;
|
||||
this.isMemberOnly = currDef.membersOnly == "1";
|
||||
this.itemStatus = currDef.itemStatus;
|
||||
this.value = this.isOnSale ? int(currDef.cost * 0.5) : int(currDef.cost);
|
||||
this.minigameDefId = currDef.gameDefId;
|
||||
this.sortId = currDef.sortCat;
|
||||
this.enviroType = currDef.enviroType;
|
||||
this.strmName = currDef.abbrName;
|
||||
this.version2 = currDef.flag;
|
||||
this.currencyType = currDef.currencyType;
|
||||
this._isShopItem = true;
|
||||
this._globalScale = currDef.scalePercent / 100;
|
||||
this.endTime = initEndTime;
|
||||
}
|
||||
|
||||
public function ifItemDiffers(itemParam:DenItem) : Boolean
|
||||
{
|
||||
if(this.invIdx == itemParam.invIdx)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function clone() : DenItem
|
||||
{
|
||||
var clonedItem:DenItem = new DenItem();
|
||||
if(this._isShopItem)
|
||||
{
|
||||
clonedItem.initShopItem(this._itemDefId,this.version,this._setRandomVersion,this.endTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
clonedItem.init(this._itemDefId,this.invIdx,this.categoryId,this.version,this.refId,this.version2,this.version3,this.endTime);
|
||||
}
|
||||
if(this._diamondDefId != -1)
|
||||
{
|
||||
clonedItem._diamondDefId = this._diamondDefId;
|
||||
clonedItem.currencyType = this.currencyType;
|
||||
clonedItem.value = this.value;
|
||||
clonedItem.endTime = this.endTime;
|
||||
}
|
||||
return clonedItem;
|
||||
}
|
||||
|
||||
public function makeSmallIcon() : void
|
||||
{
|
||||
var extraVersion:int = this.sortId == SORT_PET ? this.version2 : 0;
|
||||
var extraVersion2:int = this.sortId == SORT_PET ? this.version3 : 0;
|
||||
this._icon = new Sprite();
|
||||
this._iconHelper = new DenItemHelper();
|
||||
this._iconHelper.init(uint(this._itemDefId << 16 | getIconId(this.sortId)),this.iconReceived,this.version,0,extraVersion,extraVersion2);
|
||||
}
|
||||
|
||||
public function makeLargeIcon() : void
|
||||
{
|
||||
var extraVersion:int = this.sortId == SORT_PET ? this.version2 : 0;
|
||||
var extraVersion2:int = this.sortId == SORT_PET ? this.version3 : 0;
|
||||
this._largeIcon = new Sprite();
|
||||
this._largeIconHelper = new DenItemHelper();
|
||||
this._largeIconHelper.init(uint(this._itemDefId << 16 | getIconId(this.sortId)),this.largeIconReceived,this.version,0,extraVersion,extraVersion2);
|
||||
}
|
||||
|
||||
public function getVersions() : Array
|
||||
{
|
||||
var returnArray:Array = null;
|
||||
if(Boolean(this._iconHelper))
|
||||
{
|
||||
returnArray = this._iconHelper.getVersions();
|
||||
}
|
||||
else if(Boolean(this._largeIconHelper))
|
||||
{
|
||||
returnArray = this._largeIconHelper.getVersions();
|
||||
}
|
||||
if(returnArray == null)
|
||||
{
|
||||
this.version = 0;
|
||||
}
|
||||
return returnArray;
|
||||
}
|
||||
|
||||
public function setVersion(v:int) : void
|
||||
{
|
||||
this.version = v;
|
||||
if(Boolean(this._iconHelper))
|
||||
{
|
||||
this._iconHelper.setVersion(v);
|
||||
}
|
||||
else if(Boolean(this._largeIconHelper))
|
||||
{
|
||||
this._largeIconHelper.setVersion(v);
|
||||
}
|
||||
}
|
||||
|
||||
private function iconReceived(helper:DenItemHelper) : void
|
||||
{
|
||||
var versions:Array = null;
|
||||
helper.displayObject.cacheAsBitmap = true;
|
||||
this._icon.addChild(helper.displayObject);
|
||||
this.resizeAndPositionIcon(false);
|
||||
this.isIconLoaded = true;
|
||||
if(this._setRandomVersion)
|
||||
{
|
||||
versions = this.getVersions();
|
||||
if(Boolean(versions))
|
||||
{
|
||||
this.setVersion(versions[Math.floor(Math.random() * (versions.length - 1 + 1))]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function largeIconReceived(helper:DenItemHelper) : void
|
||||
{
|
||||
var versions:Array = null;
|
||||
helper.displayObject.cacheAsBitmap = true;
|
||||
this._largeIcon.addChild(helper.displayObject);
|
||||
this.resizeAndPositionIcon(true);
|
||||
this.isIconLoaded = true;
|
||||
if(this._setRandomVersion)
|
||||
{
|
||||
versions = this.getVersions();
|
||||
if(Boolean(versions))
|
||||
{
|
||||
this.setVersion(versions[Math.floor(Math.random() * (versions.length - 1 + 1))]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function resizeAndPositionIcon(isLargeIcon:Boolean) : void
|
||||
{
|
||||
var scale:Number = NaN;
|
||||
var spr:Sprite = null;
|
||||
if(isLargeIcon)
|
||||
{
|
||||
spr = Sprite(this._largeIcon.getChildAt(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
spr = Sprite(this._icon.getChildAt(0));
|
||||
}
|
||||
var mc:MovieClip = MovieClip(Loader(spr.getChildAt(0)).content);
|
||||
for(var i:int = 0; i < mc.currentLabels.length; i++)
|
||||
{
|
||||
if(mc.currentLabels[i].name == "icon")
|
||||
{
|
||||
mc.gotoAndStop("icon");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(this._isShopItem)
|
||||
{
|
||||
if(isLargeIcon)
|
||||
{
|
||||
if(mc.hasOwnProperty("listenToMouseInShop"))
|
||||
{
|
||||
this._listenToMouse = mc.listenToMouseInShop;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._listenToMouse = true;
|
||||
}
|
||||
scale = WIND_LARGE_SIZE / Math.max(this._largeIcon.width,this._largeIcon.height) * this._globalScale;
|
||||
this._largeIcon.width *= scale;
|
||||
this._largeIcon.height *= scale;
|
||||
this._largeIcon.x = -(this._largeIcon.width * 0.5);
|
||||
this._largeIcon.y = -(this._largeIcon.height * 0.5);
|
||||
}
|
||||
else
|
||||
{
|
||||
scale = WIND_MED_SIZE / Math.max(this._icon.width,this._icon.height) * this._globalScale;
|
||||
this._icon.width *= scale;
|
||||
this._icon.height *= scale;
|
||||
this._icon.x = -(this._icon.width * 0.5);
|
||||
this._icon.y = -(this._icon.height * 0.5);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
scale = WIND_SMALL_SIZE / Math.max(this._icon.width,this._icon.height) * this._globalScale;
|
||||
this._icon.width *= scale;
|
||||
this._icon.height *= scale;
|
||||
this._icon.x = -(this._icon.width * 0.5);
|
||||
this._icon.y = -(this._icon.height * 0.5);
|
||||
}
|
||||
this.listenToMouse(this._listenToMouse,mc);
|
||||
if(this.imageLoadedCallback != null)
|
||||
{
|
||||
this.imageLoadedCallback();
|
||||
}
|
||||
}
|
||||
|
||||
public function listenToMouse(shouldListen:Boolean, mc:MovieClip = null) : void
|
||||
{
|
||||
var spr:Sprite = null;
|
||||
this._listenToMouse = shouldListen;
|
||||
if(!mc)
|
||||
{
|
||||
if(Boolean(this._largeIcon))
|
||||
{
|
||||
if(this._largeIcon.numChildren <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
spr = Sprite(this._largeIcon.getChildAt(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!this._icon || this._icon.numChildren <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
spr = Sprite(this._icon.getChildAt(0));
|
||||
}
|
||||
if(!spr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mc = MovieClip(Loader(spr.getChildAt(0)).content);
|
||||
}
|
||||
if(Boolean(mc) && mc.hasOwnProperty("listenToMouse"))
|
||||
{
|
||||
mc.listenToMouse = this._listenToMouse;
|
||||
}
|
||||
}
|
||||
|
||||
public function get diamondDefId() : int
|
||||
{
|
||||
return this._diamondDefId;
|
||||
}
|
||||
|
||||
public function set diamondDefId(value:int) : void
|
||||
{
|
||||
this._diamondDefId = value;
|
||||
}
|
||||
|
||||
public function get icon() : Sprite
|
||||
{
|
||||
if(!this._icon)
|
||||
{
|
||||
this.makeSmallIcon();
|
||||
}
|
||||
return this._icon;
|
||||
}
|
||||
|
||||
public function get largeIcon() : Sprite
|
||||
{
|
||||
if(!this._largeIcon)
|
||||
{
|
||||
this.makeLargeIcon();
|
||||
}
|
||||
return this._largeIcon;
|
||||
}
|
||||
|
||||
public function get isOnSale() : Boolean
|
||||
{
|
||||
return this.itemStatus == SALE_ITEM;
|
||||
}
|
||||
|
||||
public function get isOnClearance() : Boolean
|
||||
{
|
||||
return this.itemStatus == CLEARANCE_ITEM;
|
||||
}
|
||||
|
||||
public function get isRare() : Boolean
|
||||
{
|
||||
return this.itemStatus == RARE_ITEM;
|
||||
}
|
||||
|
||||
public function get isNew() : Boolean
|
||||
{
|
||||
return this.itemStatus == NEW_ITEM;
|
||||
}
|
||||
|
||||
public function get isOcean() : Boolean
|
||||
{
|
||||
return this.enviroType == Utility.ENVIRO_OCEAN;
|
||||
}
|
||||
|
||||
public function get isLand() : Boolean
|
||||
{
|
||||
return this.enviroType == Utility.ENVIRO_LAND;
|
||||
}
|
||||
|
||||
public function get extraTooltipInfo() : String
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public function get itemDefId() : int
|
||||
{
|
||||
return this._itemDefId;
|
||||
}
|
||||
|
||||
public function set itemDefId(value:int) : void
|
||||
{
|
||||
this._itemDefId = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
package den
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class DenRoomItem
|
||||
{
|
||||
|
||||
public static const NORMAL_ITEM:int = 0;
|
||||
|
||||
public static const NEW_ITEM:int = 1;
|
||||
|
||||
public static const SALE_ITEM:int = 2;
|
||||
|
||||
public static const CLEARANCE_ITEM:int = 3;
|
||||
|
||||
public static const RARE_ITEM:int = 4;
|
||||
|
||||
public var invId:int;
|
||||
|
||||
public var itemDefId:int;
|
||||
|
||||
public var value:int;
|
||||
|
||||
public var name:String;
|
||||
|
||||
public var itemStatus:int;
|
||||
|
||||
public var isIconLoaded:Boolean;
|
||||
|
||||
public var imageLoadedCallback:Function;
|
||||
|
||||
public var enviroType:int;
|
||||
|
||||
public var currencyType:int;
|
||||
|
||||
public var endTime:uint;
|
||||
|
||||
public var recycleValue:int;
|
||||
|
||||
private var _diamondDefId:int = -1;
|
||||
|
||||
private var _mediaId:int;
|
||||
|
||||
private var _mediaIdLarge:int;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _mediaHelperLarge:MediaHelper;
|
||||
|
||||
private var _isMemberOnly:Boolean;
|
||||
|
||||
private var _waitForSmallIcon:Boolean;
|
||||
|
||||
private var _waitForLargeIcon:Boolean;
|
||||
|
||||
private var _icon:Sprite;
|
||||
|
||||
private var _largeIcon:Sprite;
|
||||
|
||||
private var _isShopItem:Boolean;
|
||||
|
||||
public function DenRoomItem()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(initInvId:int, initItemDefId:int, initMediaId:int, initValue:int, initName:String, initEnviroType:int, membersOnly:Boolean, initEndTime:uint = 0) : void
|
||||
{
|
||||
this.invId = initInvId;
|
||||
this.itemDefId = initItemDefId;
|
||||
this._mediaId = initMediaId;
|
||||
this.value = initValue;
|
||||
this.recycleValue = this.value * gMainFrame.clientInfo.recyclePercentage;
|
||||
this.name = initName;
|
||||
this._isMemberOnly = membersOnly;
|
||||
this.enviroType = initEnviroType;
|
||||
this.endTime = initEndTime;
|
||||
this._icon = new Sprite();
|
||||
this._waitForSmallIcon = true;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
this._icon = null;
|
||||
this._largeIcon = null;
|
||||
}
|
||||
|
||||
public function initShopItem(initInvId:int, initItemDefId:int, initMediaId:int, initMediaIdLarge:int, initValue:int, initName:String, initEnviroType:int, membersOnly:Boolean, initItemStatus:int = 0, initCurrencyType:int = 0, initEndtime:uint = 0) : void
|
||||
{
|
||||
this.invId = initInvId;
|
||||
this.itemDefId = initItemDefId;
|
||||
this._mediaId = initMediaId;
|
||||
this._mediaIdLarge = initMediaIdLarge;
|
||||
this.name = initName;
|
||||
this._isMemberOnly = membersOnly;
|
||||
this.itemStatus = initItemStatus;
|
||||
this.value = this.isOnSale ? int(initValue * 0.5) : initValue;
|
||||
this.enviroType = initEnviroType;
|
||||
this.currencyType = initCurrencyType;
|
||||
this.endTime = initEndtime;
|
||||
this.recycleValue = initValue * gMainFrame.clientInfo.recyclePercentage;
|
||||
this._isShopItem = true;
|
||||
this._icon = new Sprite();
|
||||
this._largeIcon = new Sprite();
|
||||
this._waitForSmallIcon = this._waitForLargeIcon = true;
|
||||
this.makeShopIcons();
|
||||
}
|
||||
|
||||
public function clone() : DenRoomItem
|
||||
{
|
||||
var clonedItem:DenRoomItem = new DenRoomItem();
|
||||
if(this._isShopItem)
|
||||
{
|
||||
clonedItem.initShopItem(this.invId,this.itemDefId,this._mediaId,this._mediaIdLarge,this.value,this.name,this.enviroType,this._isMemberOnly,this.itemStatus,this.currencyType,this.endTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
clonedItem.init(this.invId,this.itemDefId,this._mediaId,this.value,this.name,this.enviroType,this._isMemberOnly,this.endTime);
|
||||
}
|
||||
return clonedItem;
|
||||
}
|
||||
|
||||
private function makeIcon() : void
|
||||
{
|
||||
var denRoomHelper:MediaHelper = new MediaHelper();
|
||||
denRoomHelper.init(this._mediaId,this.mediaHelperCallback,true);
|
||||
}
|
||||
|
||||
private function makeShopIcons() : void
|
||||
{
|
||||
this._mediaHelper = new MediaHelper();
|
||||
this._mediaHelper.init(this._mediaId,this.mediaHelperCallback,true);
|
||||
this._mediaHelperLarge = new MediaHelper();
|
||||
this._mediaHelperLarge.init(this._mediaIdLarge,this.mediaHelperCallback,true);
|
||||
}
|
||||
|
||||
private function mediaHelperCallback(mc:MovieClip) : void
|
||||
{
|
||||
if(this._mediaId == mc.mediaHelper.id)
|
||||
{
|
||||
if(Boolean(this._icon))
|
||||
{
|
||||
this._icon.addChild(mc);
|
||||
}
|
||||
if(!this._isShopItem)
|
||||
{
|
||||
this._icon.x = -(this._icon.width * 0.5);
|
||||
this._icon.y = -(this._icon.height * 0.5);
|
||||
}
|
||||
if(Boolean(this._mediaHelper))
|
||||
{
|
||||
this._mediaHelper.destroy();
|
||||
this._mediaHelper = null;
|
||||
}
|
||||
}
|
||||
else if(this._mediaIdLarge == mc.mediaHelper.id)
|
||||
{
|
||||
if(Boolean(this._largeIcon))
|
||||
{
|
||||
this._largeIcon.addChild(mc);
|
||||
}
|
||||
if(!this._isShopItem)
|
||||
{
|
||||
this._largeIcon.x = -(this._largeIcon.width * 0.5);
|
||||
this._largeIcon.y = -(this._largeIcon.height * 0.5);
|
||||
}
|
||||
if(Boolean(this._mediaHelperLarge))
|
||||
{
|
||||
this._mediaHelperLarge.destroy();
|
||||
this._mediaHelperLarge = null;
|
||||
}
|
||||
}
|
||||
if(this.imageLoadedCallback != null)
|
||||
{
|
||||
this.imageLoadedCallback();
|
||||
}
|
||||
this.isIconLoaded = true;
|
||||
}
|
||||
|
||||
public function get icon() : Sprite
|
||||
{
|
||||
return this._icon;
|
||||
}
|
||||
|
||||
public function get largeIcon() : Sprite
|
||||
{
|
||||
return this._largeIcon;
|
||||
}
|
||||
|
||||
public function get mediaId() : int
|
||||
{
|
||||
return this._mediaId;
|
||||
}
|
||||
|
||||
public function get mediaIdLarge() : int
|
||||
{
|
||||
return this._mediaIdLarge;
|
||||
}
|
||||
|
||||
public function get isMemberOnly() : Boolean
|
||||
{
|
||||
return this._isMemberOnly;
|
||||
}
|
||||
|
||||
public function get isOnSale() : Boolean
|
||||
{
|
||||
return this.itemStatus == SALE_ITEM;
|
||||
}
|
||||
|
||||
public function get isOnClearance() : Boolean
|
||||
{
|
||||
return this.itemStatus == CLEARANCE_ITEM;
|
||||
}
|
||||
|
||||
public function get isRare() : Boolean
|
||||
{
|
||||
return this.itemStatus == RARE_ITEM;
|
||||
}
|
||||
|
||||
public function get isNew() : Boolean
|
||||
{
|
||||
return this.itemStatus == NEW_ITEM;
|
||||
}
|
||||
|
||||
public function get isOcean() : Boolean
|
||||
{
|
||||
return this.enviroType == Utility.ENVIRO_OCEAN;
|
||||
}
|
||||
|
||||
public function get isLand() : Boolean
|
||||
{
|
||||
return this.enviroType == Utility.ENVIRO_LAND;
|
||||
}
|
||||
|
||||
public function get diamondDefId() : int
|
||||
{
|
||||
return this._diamondDefId;
|
||||
}
|
||||
|
||||
public function set diamondDefId(value:int) : void
|
||||
{
|
||||
this._diamondDefId = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user