mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-20 09: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,325 @@
|
||||
package ecard
|
||||
{
|
||||
import den.DenItem;
|
||||
import den.DenXtCommManager;
|
||||
import flash.display.MovieClip;
|
||||
import gui.ECardInbox;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class ECard
|
||||
{
|
||||
|
||||
public static const TYPE_STANDARD:int = 0;
|
||||
|
||||
public static const TYPE_CLOTHING:int = 1;
|
||||
|
||||
public static const TYPE_BUDDY:int = 2;
|
||||
|
||||
public static const TYPE_DEN_ACC:int = 3;
|
||||
|
||||
public static const TYPE_GEMS:int = 4;
|
||||
|
||||
public static const TYPE_DEN_ROOM:int = 5;
|
||||
|
||||
public static const TYPE_AVT:int = 6;
|
||||
|
||||
public static const TYPE_SUBSCRIPTION:int = 7;
|
||||
|
||||
public static const TYPE_PET:int = 8;
|
||||
|
||||
public static const TYPE_DIAMOND:int = 9;
|
||||
|
||||
public static const TYPE_DEN_AUDIO:int = 99;
|
||||
|
||||
public static const MESSAGE_TYPE_BUBBLECHAT:int = 1;
|
||||
|
||||
public static const MESSAGE_TYPE_LIMITEDCHAT:int = 2;
|
||||
|
||||
public static const SENDER_USER:int = 0;
|
||||
|
||||
public static const SENDER_VOICE:int = 1;
|
||||
|
||||
public static const SENDER_REDEM:int = 2;
|
||||
|
||||
private var _msgId:int;
|
||||
|
||||
private var _senderUserName:String;
|
||||
|
||||
private var _cardMediaId:int;
|
||||
|
||||
private var _stampMediaId:int;
|
||||
|
||||
private var _isRead:Boolean;
|
||||
|
||||
private var _msg:String;
|
||||
|
||||
private var _type:int;
|
||||
|
||||
private var _secondaryType:int;
|
||||
|
||||
private var _giftId:int;
|
||||
|
||||
private var _giftColor:uint;
|
||||
|
||||
private var _giftName:String;
|
||||
|
||||
private var _senderType:int;
|
||||
|
||||
private var _senderSGAccountType:int;
|
||||
|
||||
private var _senderNameBarData:int;
|
||||
|
||||
private var _cardImg:MovieClip;
|
||||
|
||||
private var _cardImgHelper:MediaHelper;
|
||||
|
||||
private var _stampImg:MovieClip;
|
||||
|
||||
private var _stampImgHelper:MediaHelper;
|
||||
|
||||
private var _acceptBtn:MovieClip;
|
||||
|
||||
private var _rejectBtn:MovieClip;
|
||||
|
||||
private var _buddyButtonsLoadedCallback:Function;
|
||||
|
||||
public function ECard()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:int, param2:String, param3:int, param4:int, param5:Boolean, param6:String, param7:int, param8:int, param9:uint, param10:String, param11:int, param12:int, param13:int, param14:int) : void
|
||||
{
|
||||
this._msgId = param1;
|
||||
this._senderUserName = param2;
|
||||
this._cardMediaId = param3;
|
||||
this._stampMediaId = param4;
|
||||
this._isRead = param5;
|
||||
this._msg = param6;
|
||||
this._giftId = param8;
|
||||
this._giftColor = param9;
|
||||
this._giftName = param10;
|
||||
this._senderSGAccountType = param11;
|
||||
this._senderNameBarData = param12;
|
||||
this._secondaryType = param13;
|
||||
this._senderType = param14;
|
||||
if(param7 == TYPE_DEN_ACC)
|
||||
{
|
||||
if(DenXtCommManager.getDenItemDef(this._giftId).sortCat == DenItem.SORT_AUDIO)
|
||||
{
|
||||
this._type = TYPE_DEN_AUDIO;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._type = param7;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._type = param7;
|
||||
}
|
||||
this._stampImg = new MovieClip();
|
||||
this._cardImg = new MovieClip();
|
||||
}
|
||||
|
||||
public function get msgId() : int
|
||||
{
|
||||
return this._msgId;
|
||||
}
|
||||
|
||||
public function get senderUserName() : String
|
||||
{
|
||||
return this._senderUserName;
|
||||
}
|
||||
|
||||
public function get cardMediaId() : int
|
||||
{
|
||||
return this._cardMediaId;
|
||||
}
|
||||
|
||||
public function get stampMediaId() : int
|
||||
{
|
||||
return this._stampMediaId;
|
||||
}
|
||||
|
||||
public function get isRead() : Boolean
|
||||
{
|
||||
return this._isRead;
|
||||
}
|
||||
|
||||
public function set isRead(param1:Boolean) : void
|
||||
{
|
||||
this._isRead = param1;
|
||||
}
|
||||
|
||||
public function get msg() : String
|
||||
{
|
||||
return this._msg;
|
||||
}
|
||||
|
||||
public function set msg(param1:String) : void
|
||||
{
|
||||
this._msg = param1;
|
||||
}
|
||||
|
||||
public function get isBuddy() : Boolean
|
||||
{
|
||||
return this._type == TYPE_BUDDY;
|
||||
}
|
||||
|
||||
public function get isGift() : Boolean
|
||||
{
|
||||
return this._type == TYPE_CLOTHING || this._type >= TYPE_DEN_ACC;
|
||||
}
|
||||
|
||||
public function get giftId() : int
|
||||
{
|
||||
return this._giftId;
|
||||
}
|
||||
|
||||
public function get giftColor() : uint
|
||||
{
|
||||
return this._giftColor;
|
||||
}
|
||||
|
||||
public function get giftName() : String
|
||||
{
|
||||
return this._giftName;
|
||||
}
|
||||
|
||||
public function get isSenderMember() : Boolean
|
||||
{
|
||||
return this._senderSGAccountType >= Utility.PREMIUM_MEMBER;
|
||||
}
|
||||
|
||||
public function get isSenderArchived() : Boolean
|
||||
{
|
||||
return this._senderSGAccountType == Utility.ACCOUNT_TYPE_ARCHIVED;
|
||||
}
|
||||
|
||||
public function get isFromUser() : Boolean
|
||||
{
|
||||
return this._senderType == SENDER_USER;
|
||||
}
|
||||
|
||||
public function get isFromVoice() : Boolean
|
||||
{
|
||||
return this._senderType == SENDER_VOICE;
|
||||
}
|
||||
|
||||
public function get isStartupJAG() : Boolean
|
||||
{
|
||||
return this._senderType == SENDER_REDEM || !gMainFrame.userInfo.isMember && this.isAJHQGift;
|
||||
}
|
||||
|
||||
public function get isAJHQGift() : Boolean
|
||||
{
|
||||
return this.isFromVoice && this._giftId > 0;
|
||||
}
|
||||
|
||||
public function get type() : int
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public function set type(param1:int) : void
|
||||
{
|
||||
this._type = param1;
|
||||
}
|
||||
|
||||
public function get secondaryType() : int
|
||||
{
|
||||
return this._secondaryType;
|
||||
}
|
||||
|
||||
public function get nameBarData() : int
|
||||
{
|
||||
return this._senderNameBarData;
|
||||
}
|
||||
|
||||
public function set nameBarData(param1:int) : void
|
||||
{
|
||||
this._senderNameBarData = param1;
|
||||
}
|
||||
|
||||
public function get cardImg() : MovieClip
|
||||
{
|
||||
if(this._cardImg.numChildren == 0)
|
||||
{
|
||||
ECardInbox.loadingSpiral.visible = true;
|
||||
this._cardImgHelper = new MediaHelper();
|
||||
this._cardImgHelper.init(this._cardMediaId,this.cardImgReceived);
|
||||
}
|
||||
else if(ECardInbox.loadingSpiral)
|
||||
{
|
||||
ECardInbox.loadingSpiral.visible = false;
|
||||
}
|
||||
return this._cardImg;
|
||||
}
|
||||
|
||||
public function get stampImg() : MovieClip
|
||||
{
|
||||
if(this._type != TYPE_BUDDY && !this.isFromVoice)
|
||||
{
|
||||
if(this._stampImg.numChildren == 0)
|
||||
{
|
||||
this._stampImgHelper = new MediaHelper();
|
||||
this._stampImgHelper.init(this._stampMediaId,this.stampImgReceived);
|
||||
}
|
||||
}
|
||||
return this._stampImg;
|
||||
}
|
||||
|
||||
public function get acceptBtn() : MovieClip
|
||||
{
|
||||
return this._acceptBtn;
|
||||
}
|
||||
|
||||
public function get rejectBtn() : MovieClip
|
||||
{
|
||||
return this._rejectBtn;
|
||||
}
|
||||
|
||||
public function setBuddyButtonsLoadedCallback(param1:Function) : void
|
||||
{
|
||||
if(this._type == TYPE_BUDDY)
|
||||
{
|
||||
this._buddyButtonsLoadedCallback = param1;
|
||||
}
|
||||
}
|
||||
|
||||
private function cardImgReceived(param1:MovieClip) : void
|
||||
{
|
||||
this._cardImg.addChild(param1);
|
||||
if(param1.userNameTxt)
|
||||
{
|
||||
param1.userNameTxt.text = this._senderUserName;
|
||||
}
|
||||
if(this._type == TYPE_BUDDY)
|
||||
{
|
||||
if(param1.acceptBtn)
|
||||
{
|
||||
this._acceptBtn = param1.acceptBtn;
|
||||
}
|
||||
if(param1.rejectBtn)
|
||||
{
|
||||
this._rejectBtn = param1.rejectBtn;
|
||||
}
|
||||
if(this._buddyButtonsLoadedCallback != null)
|
||||
{
|
||||
this._buddyButtonsLoadedCallback();
|
||||
}
|
||||
}
|
||||
if(ECardInbox.loadingSpiral)
|
||||
{
|
||||
ECardInbox.loadingSpiral.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function stampImgReceived(param1:MovieClip) : void
|
||||
{
|
||||
this._stampImg.addChild(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package ecard
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class ECardImageBase
|
||||
{
|
||||
|
||||
private var _mediaId:int;
|
||||
|
||||
private var _img:MovieClip;
|
||||
|
||||
private var _img2:MovieClip;
|
||||
|
||||
private var _imgHelper:MediaHelper;
|
||||
|
||||
private var _imgHelper2:MediaHelper;
|
||||
|
||||
public function ECardImageBase()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:int) : void
|
||||
{
|
||||
this._mediaId = param1;
|
||||
this._imgHelper = new MediaHelper();
|
||||
this._imgHelper.init(this._mediaId,this.imgReceived);
|
||||
this._imgHelper2 = new MediaHelper();
|
||||
this._imgHelper2.init(this._mediaId,this.img2Received);
|
||||
}
|
||||
|
||||
private function imgReceived(param1:MovieClip) : void
|
||||
{
|
||||
this._img = param1;
|
||||
this._imgHelper.destroy();
|
||||
this._imgHelper = null;
|
||||
}
|
||||
|
||||
private function img2Received(param1:MovieClip) : void
|
||||
{
|
||||
this._img2 = param1;
|
||||
this._imgHelper2.destroy();
|
||||
this._imgHelper2 = null;
|
||||
}
|
||||
|
||||
public function get img() : MovieClip
|
||||
{
|
||||
return this._img;
|
||||
}
|
||||
|
||||
public function get img2() : MovieClip
|
||||
{
|
||||
return this._img2;
|
||||
}
|
||||
|
||||
public function get mediaId() : int
|
||||
{
|
||||
return this._mediaId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,440 @@
|
||||
package ecard
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.utils.Timer;
|
||||
import gui.DarkenManager;
|
||||
import gui.ECardCreation;
|
||||
import gui.ECardInbox;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class ECardManager
|
||||
{
|
||||
|
||||
private static var _inbox:Array;
|
||||
|
||||
private static var _cards:Array;
|
||||
|
||||
private static var _stamps:Array;
|
||||
|
||||
private static var _cardIdObjects:Array;
|
||||
|
||||
private static var _eCardInbox:ECardInbox;
|
||||
|
||||
private static var _eCardCreation:ECardCreation;
|
||||
|
||||
private static var _glowTimer:Timer;
|
||||
|
||||
private static var _hudECardBtn:MovieClip;
|
||||
|
||||
private static var _guiLayer:DisplayLayer;
|
||||
|
||||
private static var _eCardInboxAndCreation:MovieClip;
|
||||
|
||||
private static var _unreadCount:int;
|
||||
|
||||
private static var _isFirstTime:Boolean;
|
||||
|
||||
private static var _mediaHelper:MediaHelper;
|
||||
|
||||
private static const ECARD_INBOX_CREATION_MEDIA_ID:int = 1353;
|
||||
|
||||
public function ECardManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init(param1:DisplayLayer, param2:MovieClip, param3:Boolean = false) : void
|
||||
{
|
||||
_guiLayer = param1;
|
||||
_hudECardBtn = param2;
|
||||
_hudECardBtn.glow.visible = false;
|
||||
_hudECardBtn.addEventListener(MouseEvent.MOUSE_DOWN,eCardBtnDownHandler,false,0,true);
|
||||
if(!param3)
|
||||
{
|
||||
_glowTimer = new Timer(5000);
|
||||
_glowTimer.addEventListener(TimerEvent.TIMER,glowTimerHandler,false,0,true);
|
||||
_inbox = new Array();
|
||||
_isFirstTime = true;
|
||||
_unreadCount = 0;
|
||||
_hudECardBtn.newEcardCount.visible = false;
|
||||
_hudECardBtn.newEcardCount.eCardCountTxt.text = "";
|
||||
ECardXtCommManager._deleteResponseCallback = onDeleteResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
_hudECardBtn.newEcardCount.visible = _unreadCount > 0;
|
||||
_hudECardBtn.newEcardCount.eCardCountTxt.text = _unreadCount;
|
||||
}
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
ECardXtCommManager._deleteResponseCallback = null;
|
||||
}
|
||||
|
||||
public static function processECardList(param1:Array, param2:int) : void
|
||||
{
|
||||
_inbox = param1.concat();
|
||||
unreadCount = param2;
|
||||
if(_eCardInbox)
|
||||
{
|
||||
_eCardInbox.reloadInbox(_inbox);
|
||||
}
|
||||
}
|
||||
|
||||
public static function processECardPush(param1:ECard) : void
|
||||
{
|
||||
if(param1.isAJHQGift && !gMainFrame.userInfo.isMember)
|
||||
{
|
||||
return;
|
||||
}
|
||||
inbox.push(param1);
|
||||
if(!param1.isRead)
|
||||
{
|
||||
++unreadCount;
|
||||
}
|
||||
}
|
||||
|
||||
public static function processECardUpdate(param1:int, param2:String) : void
|
||||
{
|
||||
var _loc3_:ECard = null;
|
||||
var _loc4_:int = 0;
|
||||
while(_loc4_ < _inbox.length)
|
||||
{
|
||||
_loc3_ = _inbox[_loc4_];
|
||||
if(_loc3_ != null && _loc3_.msgId == param1)
|
||||
{
|
||||
_loc3_.msg = param2;
|
||||
if(_eCardInbox)
|
||||
{
|
||||
_eCardInbox.reloadInbox(_inbox);
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
|
||||
public static function get inbox() : Array
|
||||
{
|
||||
return _inbox;
|
||||
}
|
||||
|
||||
public static function onCardsLoaded(param1:int, param2:Array, param3:Array) : void
|
||||
{
|
||||
var _loc4_:ECardImageBase = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc5_:* = int(param2.length - 1);
|
||||
_cards = [];
|
||||
while(_loc6_ < param2.length)
|
||||
{
|
||||
_loc4_ = new ECardImageBase();
|
||||
_loc4_.init(param2[_loc6_]);
|
||||
_cards[_loc6_] = _loc4_;
|
||||
_loc5_--;
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
|
||||
public static function onStampsLoaded(param1:int, param2:Array, param3:Array) : void
|
||||
{
|
||||
var _loc4_:ECardImageBase = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc5_:* = int(param2.length - 1);
|
||||
_stamps = [];
|
||||
while(_loc6_ < param2.length)
|
||||
{
|
||||
_loc4_ = new ECardImageBase();
|
||||
_loc4_.init(param2[_loc6_]);
|
||||
_stamps[_loc6_] = _loc4_;
|
||||
_loc5_--;
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
|
||||
private static function eCardBtnDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
if(!_eCardInboxAndCreation)
|
||||
{
|
||||
createInboxAndCreationPopup("inbox");
|
||||
}
|
||||
else
|
||||
{
|
||||
_eCardInbox = new ECardInbox();
|
||||
_eCardInbox.init(_guiLayer,_inbox,createCard,onECardInboxClose);
|
||||
}
|
||||
}
|
||||
|
||||
private static function onECardInboxClose() : void
|
||||
{
|
||||
_hudECardBtn.downToUpState();
|
||||
if(_eCardCreation)
|
||||
{
|
||||
_eCardCreation.destroy();
|
||||
_eCardCreation = null;
|
||||
}
|
||||
if(_eCardInbox)
|
||||
{
|
||||
_eCardInbox.destroy();
|
||||
_eCardInbox = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function eCardVisibility() : Boolean
|
||||
{
|
||||
if(_eCardInbox)
|
||||
{
|
||||
return _eCardInbox.visibility || _eCardCreation.visibility;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function closeECard() : void
|
||||
{
|
||||
onECardInboxClose();
|
||||
}
|
||||
|
||||
public static function createCard(param1:String, param2:Boolean = true) : void
|
||||
{
|
||||
if(_eCardCreation)
|
||||
{
|
||||
_eCardCreation.destroy();
|
||||
_eCardCreation = null;
|
||||
}
|
||||
else if(_eCardInboxAndCreation != null)
|
||||
{
|
||||
if(_eCardInbox)
|
||||
{
|
||||
_eCardInbox.showHide(true);
|
||||
}
|
||||
_eCardCreation = new ECardCreation();
|
||||
if(param2)
|
||||
{
|
||||
_eCardCreation.init(_guiLayer,param1,_cards,_stamps,onCreateCardBackBtn,onCreateCardClose);
|
||||
}
|
||||
else
|
||||
{
|
||||
_eCardCreation.init(_guiLayer,param1,_cards,_stamps,onCreateCardBackBtn,onCreateCardClose,true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
createInboxAndCreationPopup("create",{
|
||||
"toUserName":param1,
|
||||
"backBtnEnabled":param2
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static function createInboxAndCreationPopup(param1:String, param2:Object = null) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(ECARD_INBOX_CREATION_MEDIA_ID,onMediaItemLoaded,{
|
||||
"type":param1,
|
||||
"vars":param2
|
||||
});
|
||||
}
|
||||
|
||||
private static function onMediaItemLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_eCardInboxAndCreation = MovieClip(param1.getChildAt(0));
|
||||
_eCardInboxAndCreation.x = MainFrame.VIEW_WIDTH * 0.5;
|
||||
_eCardInboxAndCreation.y = MainFrame.VIEW_HEIGHT * 0.5;
|
||||
_guiLayer.addChild(_eCardInboxAndCreation);
|
||||
DarkenManager.darken(_eCardInboxAndCreation);
|
||||
if(param1.passback.type == "inbox")
|
||||
{
|
||||
_eCardInbox = new ECardInbox();
|
||||
_eCardInbox.init(_guiLayer,_inbox,createCard,onECardInboxClose);
|
||||
}
|
||||
else
|
||||
{
|
||||
_eCardCreation = new ECardCreation();
|
||||
if(param1.passback.vars.backBtnEnabled)
|
||||
{
|
||||
_eCardCreation.init(_guiLayer,param1.passback.vars.toUserName,_cards,_stamps,onCreateCardBackBtn,onCreateCardClose);
|
||||
}
|
||||
else
|
||||
{
|
||||
_eCardCreation.init(_guiLayer,param1.passback.vars.toUserName,_cards,_stamps,onCreateCardBackBtn,onCreateCardClose,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function onCreateCardBackBtn(param1:Boolean) : void
|
||||
{
|
||||
if(_eCardCreation)
|
||||
{
|
||||
_eCardCreation.destroy();
|
||||
_eCardCreation = null;
|
||||
if(_eCardInbox)
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_hudECardBtn.downToUpState();
|
||||
_eCardInbox.destroy();
|
||||
_eCardInbox = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_eCardInbox.showHide(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function onCreateCardClose() : void
|
||||
{
|
||||
if(_eCardCreation)
|
||||
{
|
||||
_eCardCreation.destroy();
|
||||
_eCardCreation = null;
|
||||
}
|
||||
if(_eCardInbox)
|
||||
{
|
||||
_hudECardBtn.downToUpState();
|
||||
_eCardInbox.destroy();
|
||||
_eCardInbox = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function onDeleteResponse(param1:Array, param2:Boolean) : void
|
||||
{
|
||||
var _loc3_:ECard = null;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(_eCardInbox)
|
||||
{
|
||||
_eCardInbox.onDeleteResponse(param1,param2);
|
||||
}
|
||||
else if(param2)
|
||||
{
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < param1.length)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _inbox.length)
|
||||
{
|
||||
_loc3_ = _inbox[_loc5_];
|
||||
if(_loc3_ != null && _loc3_.msgId == param1[_loc4_])
|
||||
{
|
||||
_inbox.splice(_loc5_,1);
|
||||
break;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
if(param2)
|
||||
{
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _inbox.length)
|
||||
{
|
||||
_loc3_ = _inbox[_loc7_];
|
||||
if(Boolean(_loc3_) && !_loc3_.isRead)
|
||||
{
|
||||
_loc6_++;
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
_unreadCount = _loc6_;
|
||||
if(_unreadCount > 0)
|
||||
{
|
||||
_hudECardBtn.newEcardCount.eCardCountTxt.text = _unreadCount;
|
||||
_hudECardBtn.newEcardCount.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_hudECardBtn.newEcardCount.visible = false;
|
||||
_hudECardBtn.newEcardCount.eCardCountTxt.text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function glowTimerHandler(param1:TimerEvent) : void
|
||||
{
|
||||
_glowTimer.stop();
|
||||
if(_hudECardBtn)
|
||||
{
|
||||
_hudECardBtn.glow.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function get unreadCount() : int
|
||||
{
|
||||
return _unreadCount;
|
||||
}
|
||||
|
||||
public static function set unreadCount(param1:int) : void
|
||||
{
|
||||
if(param1 > _unreadCount)
|
||||
{
|
||||
if(_glowTimer.running)
|
||||
{
|
||||
_glowTimer.stop();
|
||||
}
|
||||
if(!_eCardCreation)
|
||||
{
|
||||
_glowTimer.start();
|
||||
if(_hudECardBtn)
|
||||
{
|
||||
_hudECardBtn.glow.visible = true;
|
||||
}
|
||||
AJAudio.playMailReceivedSound();
|
||||
if(_eCardInbox)
|
||||
{
|
||||
if(_inbox.length == 1)
|
||||
{
|
||||
_eCardInbox.reloadInbox(inbox);
|
||||
}
|
||||
else
|
||||
{
|
||||
_eCardInbox.reloadInbox();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_unreadCount = param1;
|
||||
if(_hudECardBtn)
|
||||
{
|
||||
if(_unreadCount > 0)
|
||||
{
|
||||
_hudECardBtn.newEcardCount.eCardCountTxt.text = param1;
|
||||
_hudECardBtn.newEcardCount.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_hudECardBtn.newEcardCount.visible = false;
|
||||
_hudECardBtn.newEcardCount.eCardCountTxt.text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function get eCardInboxAndCreation() : MovieClip
|
||||
{
|
||||
return _eCardInboxAndCreation;
|
||||
}
|
||||
|
||||
public static function get isFirstTime() : Boolean
|
||||
{
|
||||
return _isFirstTime;
|
||||
}
|
||||
|
||||
public static function set isFirstTime(param1:Boolean) : void
|
||||
{
|
||||
_isFirstTime = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
package ecard
|
||||
{
|
||||
import com.sbi.client.SFEvent;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import gui.BuddyManager;
|
||||
import gui.DarkenManager;
|
||||
import gui.GuiManager;
|
||||
|
||||
public class ECardXtCommManager
|
||||
{
|
||||
|
||||
private static var _requestCallback:Function;
|
||||
|
||||
private static var _readResponseCallback:Function;
|
||||
|
||||
private static var _sendResponseCallback:Function;
|
||||
|
||||
public static var _deleteResponseCallback:Function;
|
||||
|
||||
public static var _giftResponseCallback:Function;
|
||||
|
||||
private static var _jaggedPlayers:Object;
|
||||
|
||||
private static var NUM_JAGS_PER_NON_BUDDY_PER_SESSION:int = 5;
|
||||
|
||||
private static var NUM_JAGS_PER_BUDDY_PER_SESSION:int = 25;
|
||||
|
||||
public function ECardXtCommManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init() : void
|
||||
{
|
||||
_jaggedPlayers = new Object();
|
||||
}
|
||||
|
||||
public static function sendECardListRequest(param1:Function = null) : void
|
||||
{
|
||||
if(param1 != null)
|
||||
{
|
||||
_requestCallback = param1;
|
||||
}
|
||||
gMainFrame.server.setXtObject_Str("el",[]);
|
||||
}
|
||||
|
||||
public static function sendECardReadRequest(param1:int, param2:Function = null) : void
|
||||
{
|
||||
if(!gMainFrame.clientInfo.invisMode)
|
||||
{
|
||||
if(param2 != null)
|
||||
{
|
||||
_readResponseCallback = param2;
|
||||
}
|
||||
gMainFrame.server.setXtObject_Str("er",[param1]);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendECardSendRequest(param1:String, param2:int, param3:int, param4:int, param5:String, param6:int, param7:int = -1, param8:Function = null) : Boolean
|
||||
{
|
||||
if(_jaggedPlayers[param1] == null)
|
||||
{
|
||||
_jaggedPlayers[param1] = 0;
|
||||
}
|
||||
var _loc9_:int = BuddyManager.isBuddy(param1) ? NUM_JAGS_PER_BUDDY_PER_SESSION : NUM_JAGS_PER_NON_BUDDY_PER_SESSION;
|
||||
if(_jaggedPlayers[param1] < _loc9_)
|
||||
{
|
||||
++_jaggedPlayers[param1];
|
||||
if(param8 != null)
|
||||
{
|
||||
_sendResponseCallback = param8;
|
||||
}
|
||||
gMainFrame.server.setXtObject_Str("es",[param1,param2,param3,param4,param5,param6,param7]);
|
||||
return true;
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,"You have reached your\nJam-A-Gram limit for\n" + param1 + " today!");
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function sendECardDeleteRequest(param1:int, param2:Function = null) : void
|
||||
{
|
||||
if(param2 != null)
|
||||
{
|
||||
_deleteResponseCallback = param2;
|
||||
}
|
||||
gMainFrame.server.setXtObject_Str("ed",[param1]);
|
||||
}
|
||||
|
||||
public static function sendECardBuddyRequest(param1:int, param2:Boolean) : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("eb",[param1,param2 ? 1 : 0]);
|
||||
}
|
||||
|
||||
public static function sendECardAcceptDiscardGiftRequest(param1:int, param2:Boolean, param3:Function) : void
|
||||
{
|
||||
if(!gMainFrame.clientInfo.invisMode)
|
||||
{
|
||||
if(param3 != null)
|
||||
{
|
||||
_giftResponseCallback = param3;
|
||||
}
|
||||
gMainFrame.server.setXtObject_Str("eg",[param1,param2 ? 1 : 0]);
|
||||
}
|
||||
else if(param3 != null)
|
||||
{
|
||||
param3(0,true);
|
||||
}
|
||||
}
|
||||
|
||||
public static function handleXtReply(param1:SFEvent) : void
|
||||
{
|
||||
var _loc2_:Object = param1.obj;
|
||||
switch(_loc2_[0])
|
||||
{
|
||||
case "el":
|
||||
eCardListResponse(_loc2_);
|
||||
break;
|
||||
case "er":
|
||||
eCardReadResponse(_loc2_);
|
||||
break;
|
||||
case "ed":
|
||||
eCardDeleteResponse(_loc2_);
|
||||
break;
|
||||
case "es":
|
||||
eCardSendResponse(_loc2_);
|
||||
break;
|
||||
case "eg":
|
||||
eCardGiftResponse(_loc2_);
|
||||
break;
|
||||
case "eb":
|
||||
eCardBuddyResponse(_loc2_);
|
||||
break;
|
||||
case "ep":
|
||||
eCardPushHandler(_loc2_);
|
||||
break;
|
||||
case "eu":
|
||||
eCardUpdateHandler(_loc2_);
|
||||
break;
|
||||
default:
|
||||
throw new Error("ECardXtCommManager: Received illegal cmd: " + _loc2_[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private static function eCardListResponse(param1:Object) : void
|
||||
{
|
||||
var _loc6_:ECard = null;
|
||||
var _loc2_:int = int(param1[2]);
|
||||
var _loc3_:Array = new Array(_loc2_);
|
||||
if(_loc2_ == -1)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
}
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:* = 3;
|
||||
var _loc7_:int = 0;
|
||||
while(_loc7_ < _loc2_)
|
||||
{
|
||||
_loc6_ = new ECard();
|
||||
_loc6_.init(int(param1[_loc5_++]),param1[_loc5_++],int(param1[_loc5_++]),int(param1[_loc5_++]),param1[_loc5_++] == "1",param1[_loc5_++],int(param1[_loc5_++]),int(param1[_loc5_++]),uint(param1[_loc5_++]),param1[_loc5_++],int(param1[_loc5_++]),int(param1[_loc5_++]),int(param1[_loc5_++]),int(param1[_loc5_++]));
|
||||
_loc3_[_loc7_] = _loc6_;
|
||||
if(!_loc6_.isRead && !(_loc6_.isAJHQGift && !gMainFrame.userInfo.isMember))
|
||||
{
|
||||
_loc4_++;
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
ECardManager.processECardList(_loc3_,_loc4_);
|
||||
if(_requestCallback != null)
|
||||
{
|
||||
_requestCallback(_loc3_);
|
||||
_requestCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function eCardReadResponse(param1:Object) : void
|
||||
{
|
||||
if(_readResponseCallback != null)
|
||||
{
|
||||
_readResponseCallback(int(param1[2]),param1[3] == "1");
|
||||
}
|
||||
}
|
||||
|
||||
private static function eCardDeleteResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1[2] == "1" ? true : false;
|
||||
var _loc3_:int = int(param1[3]);
|
||||
var _loc4_:* = 4;
|
||||
var _loc5_:Array = new Array(_loc3_);
|
||||
var _loc6_:int = 0;
|
||||
while(_loc6_ < _loc3_)
|
||||
{
|
||||
_loc5_[_loc6_] = param1[_loc4_++];
|
||||
_loc6_++;
|
||||
}
|
||||
if(_deleteResponseCallback != null)
|
||||
{
|
||||
_deleteResponseCallback(_loc5_,_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function eCardSendResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Boolean = param1[2] == "1" ? true : false;
|
||||
if(_sendResponseCallback != null)
|
||||
{
|
||||
_sendResponseCallback(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function eCardGiftResponse(param1:Object) : void
|
||||
{
|
||||
if(_giftResponseCallback != null)
|
||||
{
|
||||
_giftResponseCallback(int(param1[2]),param1[3] == "1");
|
||||
}
|
||||
}
|
||||
|
||||
private static function eCardBuddyResponse(param1:Object) : void
|
||||
{
|
||||
if(param1[2] == -1)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBOkPopup(GuiManager.guiLayer,"This buddy request is no longer valid!");
|
||||
}
|
||||
}
|
||||
|
||||
private static function eCardPushHandler(param1:Object) : void
|
||||
{
|
||||
var _loc2_:ECard = new ECard();
|
||||
var _loc3_:* = 2;
|
||||
_loc2_.init(int(param1[_loc3_++]),param1[_loc3_++],int(param1[_loc3_++]),int(param1[_loc3_++]),param1[_loc3_++] == "1",param1[_loc3_++],int(param1[_loc3_++]),int(param1[_loc3_++]),uint(param1[_loc3_++]),param1[_loc3_++],int(param1[_loc3_++]),int(param1[_loc3_++]),int(param1[_loc3_++]),int(param1[_loc3_++]));
|
||||
ECardManager.processECardPush(_loc2_);
|
||||
}
|
||||
|
||||
private static function eCardUpdateHandler(param1:Object) : void
|
||||
{
|
||||
ECardManager.processECardUpdate(param1[2],param1[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user