Brought up to date with the private repository (feea4c7)

This commit is contained in:
S committed 2026-10-14 20:57:33 +03:00
1 parent 1aa738d692
commit 1b1df1ae48
7925 files changed
+2617237 -20

No files matched your search

@@ -0,0 +1,299 @@
package gui
{
import achievement.Achievement;
import achievement.AchievementXtCommManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
public class AchievementViewer
{
private var _achievementMediaHelper:MediaHelper;
private var _achievementPopupContent:MovieClip;
private var _itemWindows:WindowGenerator;
private var _scrollButtons:MovieClip;
private var _achievements:Array;
private var _xPos:int;
private var _yPos:int;
private var _numAchievementsLastDrawn:int;
private var _hasBeenInited:Boolean;
private var _loadingSpiral:LoadingSpiral;
public function AchievementViewer()
{
super();
}
public function init(param1:int, param2:int, param3:int = -1, param4:Boolean = false) : void
{
this._achievements = new Array();
this._xPos = param1;
this._yPos = param2;
if(!gMainFrame.userInfo.playerUserInfo.achievements)
{
AchievementXtCommManager.requestAchievements(gMainFrame.userInfo.playerUserInfo.userName,this.achievementListCallback);
if(this._loadingSpiral)
{
this._loadingSpiral.visible = true;
}
}
else
{
this._achievements = gMainFrame.userInfo.playerUserInfo.achievements;
}
if(param3 != -1 && this._achievementPopupContent == null)
{
this._achievementMediaHelper = new MediaHelper();
this._achievementMediaHelper.init(param3,this.mediaHelperCallback,param4);
}
else
{
this._achievementPopupContent.x = this._xPos;
this._achievementPopupContent.y = this._yPos + this._achievementPopupContent.height * 0.5;
}
if(this._achievementPopupContent)
{
this._achievementPopupContent.parent.setChildIndex(this._achievementPopupContent,this._achievementPopupContent.parent.numChildren - 1);
this._achievementPopupContent.visible = true;
this._achievementPopupContent.counterTxt.text = this._achievements.length;
this.createWindows();
this._hasBeenInited = true;
}
}
public function destroy() : void
{
if(this._achievementMediaHelper)
{
this._achievementMediaHelper.destroy();
}
if(this._scrollButtons)
{
this._scrollButtons.destroy();
this._scrollButtons = null;
}
if(this._itemWindows)
{
this._itemWindows.destroy();
this._itemWindows = null;
}
if(this._achievements)
{
this._achievements = null;
}
if(this._achievementPopupContent)
{
this.removeEventListeners();
GuiManager.guiLayer.removeChild(this._achievementPopupContent);
this._achievementPopupContent.visible = false;
this._achievementPopupContent = null;
}
this._hasBeenInited = false;
GuiManager.mainHud.awardsBtn.downToUpState();
}
public function loadMedia(param1:int = -1) : void
{
if(param1 != -1)
{
this._achievementMediaHelper = new MediaHelper();
this._achievementMediaHelper.init(param1,this.initMediaCallback);
}
}
public function open() : void
{
if(this._numAchievementsLastDrawn < this._achievements.length)
{
this.createWindows();
this._achievementPopupContent.counterTxt.text = this._achievements.length;
}
this._achievementPopupContent.parent.setChildIndex(this._achievementPopupContent,this._achievementPopupContent.parent.numChildren - 1);
this._achievementPopupContent.visible = true;
}
public function close() : void
{
GuiManager.mainHud.awardsBtn.downToUpState();
this._achievementPopupContent.visible = false;
}
public function get visible() : Boolean
{
if(this._achievementPopupContent)
{
return this._achievementPopupContent.visible;
}
return false;
}
public function get hasBeenInited() : Boolean
{
return this._hasBeenInited;
}
private function addAchievementCallback(param1:Array) : void
{
var _loc2_:int = 0;
while(_loc2_ < param1.length)
{
this._achievements[_loc2_] = param1[_loc2_].image;
_loc2_++;
}
}
private function initMediaCallback(param1:MovieClip) : void
{
if(param1)
{
this._achievementPopupContent = MovieClip(param1.getChildAt(0));
this._achievementPopupContent.counterTxt.text = "";
GuiManager.guiLayer.addChild(this._achievementPopupContent);
this.addEventListeners();
this._achievementPopupContent.visible = false;
this._loadingSpiral = new LoadingSpiral(this._achievementPopupContent.itemBlock,this._achievementPopupContent.itemBlock.width * 0.5,this._achievementPopupContent.itemBlock.height * 0.5);
this._loadingSpiral.visible = false;
this._achievementMediaHelper.destroy();
this._achievementMediaHelper = null;
}
}
private function mediaHelperCallback(param1:MovieClip) : void
{
if(param1)
{
this._achievementPopupContent = MovieClip(param1.getChildAt(0));
this._achievementPopupContent.x = this._xPos;
this._achievementPopupContent.y = this._yPos + this._achievementPopupContent.height * 0.5;
this._achievementPopupContent.counterTxt.text = "";
GuiManager.guiLayer.addChild(this._achievementPopupContent);
this.addEventListeners();
this._loadingSpiral = new LoadingSpiral(this._achievementPopupContent.itemBlock,this._achievementPopupContent.itemBlock.width * 0.5,this._achievementPopupContent.itemBlock.height * 0.5);
this._loadingSpiral.visible = false;
if(param1.passback)
{
this._achievementPopupContent.visible = false;
}
else
{
this._achievementPopupContent.counterTxt.text = this._achievements.length;
this.createWindows();
this._hasBeenInited = true;
}
}
}
private function achievementListCallback(param1:Array) : void
{
if(param1)
{
this._achievements = param1;
if(this._achievementPopupContent)
{
this._achievementPopupContent.counterTxt.text = this._achievements.length;
this.createWindows(true);
}
}
}
private function createWindows(param1:Boolean = false) : void
{
if(this._scrollButtons)
{
this._scrollButtons.destroy();
this._scrollButtons = null;
}
if(this._itemWindows)
{
this._itemWindows.destroy();
this._itemWindows = null;
}
var _loc2_:int = this._numAchievementsLastDrawn = this._achievements.length;
var _loc3_:int = Math.min(_loc2_,5);
var _loc4_:int = Math.ceil(_loc3_ / 5);
this._itemWindows = new WindowGenerator();
this._itemWindows.init(_loc3_,_loc4_,Math.ceil(_loc2_ / _loc3_) * _loc3_,0,0,0,ItemWindowBase,this._achievements,"image",{
"mouseOver":this.winMouseOver,
"mouseOut":this.winMouseOut
},{"itemClassName":"awardCont"});
this._achievementPopupContent.itemBlock.addChild(this._itemWindows);
if(param1)
{
this._loadingSpiral.visible = false;
}
this._scrollButtons = new SBScrollbar();
this._scrollButtons.init(this._itemWindows,328,213,0,"scrollbar2",71);
if(this._loadingSpiral)
{
this._loadingSpiral.visible = false;
}
}
private function onPopupDownHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
this.close();
}
private function winMouseOver(param1:MouseEvent) : void
{
var _loc2_:int = int(param1.currentTarget.index);
var _loc3_:Achievement = this._achievements[_loc2_];
GuiManager.toolTip.init(this._achievementPopupContent.itemBlock,_loc3_.name,0,0);
GuiManager.toolTip.startTimer(param1);
var _loc4_:int = param1.currentTarget.y + this._itemWindows.y;
if(_loc3_.baseImageMediaId == Achievement.BASE_RIBBON_ID)
{
_loc4_ += 42;
}
else if(_loc3_.baseImageMediaId == Achievement.BASE_MEDAL_ID)
{
_loc4_ += 56;
}
else
{
_loc4_ += 57;
}
var _loc5_:int = param1.currentTarget.x + param1.currentTarget.width * 0.5;
var _loc6_:Number = GuiManager.toolTip.width * 0.5 - _loc5_;
if(_loc6_ > 15)
{
_loc5_ += _loc6_ - 15;
}
GuiManager.toolTip.setPos(_loc5_,_loc4_);
}
private function winMouseOut(param1:MouseEvent) : void
{
GuiManager.toolTip.resetTimerAndSetVisibility();
}
private function addEventListeners() : void
{
this._achievementPopupContent.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDownHandler,false,0,true);
this._achievementPopupContent.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
}
private function removeEventListeners() : void
{
this._achievementPopupContent.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDownHandler);
this._achievementPopupContent.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
}
}
}
@@ -0,0 +1,629 @@
package gui
{
import avatar.AvatarManager;
import avatar.UserCommXtCommManager;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;
import game.MinigameManager;
import gskinner.motion.GTween;
import loader.MediaHelper;
import localization.LocalizationManager;
import pet.WorldPet;
public class ActionManager
{
private const ACTIONWINDOW_DIM_ALPHA:Number = 0.5;
private const ACTIONWINDOW_BRIGHT_ALPHA:Number = 1;
public var actionBtn:MovieClip;
public var actionWindow:MovieClip;
public var emoteBtn:MovieClip;
public var emoteWindow:Sprite;
public var safeChatBtn:MovieClip;
public var safeChatTree:MovieClip;
public var setActionCallback:Function;
public var actionSprites:Array = ["sit1BtnCont","sit2BtnCont","sit3BtnCont","sit4BtnCont","danceAnim_btnCont","sleepAnim_btnCont","hopAnim_btnCont","playAnim_btnCont","pose1BtnCont","pose2BtnCont","diveAnim_btnCont","swirlAnim_btnCont"];
public var actionStrings:Object;
private var _actions:MovieClip;
private var _petActions:MovieClip;
private var _gameTab:MovieClip;
private var _isGameTabOpen:Boolean;
private var _sideMenuTweenFinished:Boolean;
private var _pvpScrollBar:SBScrollbar;
private var _pvpItemWindows:WindowGenerator;
private var _pvpGameList:Array;
private var _views:Array;
public function ActionManager(param1:Function, param2:MovieClip, param3:MovieClip, param4:MovieClip, param5:Sprite, param6:MovieClip, param7:MovieClip)
{
super();
if(this.setActionCallback != null)
{
throw new Error("ERROR: Singleton ActionManager did not expect to be created twice!");
}
this.setActionCallback = param1;
this.actionBtn = param2;
this.actionBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.actionBtnDownHandler,false,0,true);
this.actionWindow = param3;
this._gameTab = param3.hudGameTab;
this._gameTab.gameCancelTabBtn.visible = false;
if(Utility.canPVP())
{
this._gameTab.gameTabBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onGameTab,false,0,true);
this._gameTab.gameCancelTabBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onCancelGameTab,false,0,true);
}
else
{
this._gameTab.gameTabBtn.activateGrayState(true);
}
LocalizationManager.translateId(this._gameTab.buddyGamesTxt,6285);
this.addAllActions();
this.actionWindow.addChild(this._actions);
this.actionWindow.addChild(this._petActions);
this._petActions.visible = false;
this.actionWindow.poseBtns = this._actions.poseBtns;
this.actionWindow.diveBtn = this._actions.diveBtn;
this.actionWindow.swirlBtn = this._actions.swirlBtn;
this.actionWindow.sitBtns = this._actions.sitBtns;
this.actionWindow.visible = false;
this.emoteBtn = param4;
this.emoteWindow = param5;
this.safeChatBtn = param6;
this.safeChatTree = param7;
this.setupTitleBanner();
}
public function turnOnOceanActions(param1:Boolean) : void
{
this.actionWindow.poseBtns.visible = param1;
this.actionWindow.diveBtn.visible = param1;
this.actionWindow.swirlBtn.visible = param1;
this.actionWindow.sitBtns.visible = !param1;
}
public function turnOnPetActions(param1:Boolean) : void
{
if(param1)
{
this._petActions.visible = true;
this._actions.visible = false;
}
else
{
this._petActions.visible = false;
this._actions.visible = true;
}
}
public function grayGameTab(param1:Boolean) : void
{
this._gameTab.gameTabBtn.activateGrayState(param1);
}
public function reload(param1:MovieClip, param2:MovieClip, param3:MovieClip, param4:Sprite, param5:MovieClip, param6:MovieClip, param7:Function) : void
{
this.setActionCallback = param7;
if(this.actionBtn)
{
this.actionBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.actionBtnDownHandler);
}
this.actionBtn = param1;
this.actionBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.actionBtnDownHandler,false,0,true);
while(this.actionWindow.numChildren > 2)
{
this.actionWindow.removeChildAt(this.actionWindow.numChildren - 1);
}
this.actionWindow = param2;
this._gameTab = param2.hudGameTab;
if(this._gameTab)
{
this._gameTab.gameCancelTabBtn.visible = false;
this._gameTab.visible = !MinigameManager.inMinigame();
if(Utility.canPVP())
{
this._gameTab.gameTabBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onGameTab,false,0,true);
this._gameTab.gameCancelTabBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onCancelGameTab,false,0,true);
}
else
{
this._gameTab.gameTabBtn.activateGrayState(true);
}
LocalizationManager.translateId(this._gameTab.buddyGamesTxt,6285);
this.setupTitleBanner();
}
this.addAllActions();
this.actionWindow.addChild(this._actions);
this.actionWindow.addChild(this._petActions);
this._petActions.visible = false;
this.actionWindow.poseBtns = this._actions.poseBtns;
this.actionWindow.diveBtn = this._actions.diveBtn;
this.actionWindow.swirlBtn = this._actions.swirlBtn;
this.actionWindow.sitBtns = this._actions.sitBtns;
this.actionWindow.visible = false;
this.emoteBtn = param3;
this.emoteWindow = param4;
this.actionWindow = param2;
this.safeChatBtn = param5;
this.safeChatTree = param6;
this.actionBtn.downToUpState();
}
private function addAllActions() : void
{
var _loc2_:uint = 0;
var _loc6_:Number = NaN;
var _loc13_:Sprite = null;
var _loc14_:Sprite = null;
var _loc15_:int = 0;
var _loc16_:int = 0;
var _loc1_:uint = 10;
_loc2_ = 25;
var _loc3_:uint = 40;
var _loc4_:uint = 91;
var _loc5_:uint = 2;
_loc6_ = -72;
var _loc7_:Number = -50;
var _loc8_:Number = -88;
var _loc9_:int = 4;
var _loc10_:int = 2;
var _loc11_:int = 8;
this._actions = new MovieClip();
this._petActions = new MovieClip();
var _loc12_:uint = 0;
while(_loc12_ < this.actionSprites.length)
{
if(_loc12_ < _loc11_)
{
_loc13_ = GETDEFINITIONBYNAME(_loc12_ < _loc9_ ? "sitBtns" : this.actionSprites[_loc12_]);
if(_loc12_ == 0)
{
_loc13_.x = this.actionWindow.ba.width * 0.5 + _loc6_ - _loc2_ - 5;
_loc13_.y = _loc1_ + Math.floor(_loc12_ / _loc5_) * _loc3_ + _loc7_;
this._actions.addChild(_loc13_);
this._actions.sitBtns = _loc13_;
_loc15_ = 1;
while(_loc15_ <= 4)
{
_loc14_ = _loc13_["sit" + _loc15_ + "Btn"];
_loc14_.buttonMode = true;
_loc14_.useHandCursor = true;
_loc14_.tabEnabled = true;
_loc14_.tabChildren = false;
_loc14_.addEventListener(MouseEvent.MOUSE_DOWN,this.actionClickHandler,false,0,true);
_loc15_++;
}
}
else if(_loc12_ >= _loc9_)
{
_loc13_.x = _loc2_ + (_loc12_ % _loc5_ * _loc4_ + _loc6_);
_loc13_.y = _loc1_ + Math.floor(_loc12_ / _loc5_) * _loc3_ + _loc8_;
this._actions.addChild(_loc13_);
_loc13_.buttonMode = true;
_loc13_.useHandCursor = true;
_loc13_.tabEnabled = true;
_loc13_.tabChildren = false;
_loc13_.addEventListener(MouseEvent.MOUSE_DOWN,this.actionClickHandler,false,0,true);
}
}
else
{
_loc13_ = GETDEFINITIONBYNAME(_loc12_ == _loc11_ ? "poseBtns" : this.actionSprites[_loc12_]);
if(_loc12_ == _loc11_)
{
_loc13_.visible = false;
this._actions.poseBtns = _loc13_;
_loc13_.x = this.actionWindow.ba.width * 0.5 + _loc6_ - _loc2_ - 5;
_loc13_.y = _loc1_ + Math.floor((_loc12_ - _loc11_) / _loc5_) * _loc3_ + _loc7_;
this._actions.addChild(_loc13_);
_loc16_ = 1;
while(_loc16_ <= 2)
{
_loc14_ = _loc13_["pose" + _loc16_ + "Btn"];
_loc14_.buttonMode = true;
_loc14_.useHandCursor = true;
_loc14_.tabEnabled = true;
_loc14_.tabChildren = false;
_loc14_.addEventListener(MouseEvent.MOUSE_DOWN,this.actionClickHandler,false,0,true);
_loc16_++;
}
}
else if(_loc12_ >= _loc11_ + _loc10_)
{
_loc13_.visible = false;
if(_loc12_ == this.actionSprites.length - 1)
{
this._actions.diveBtn = _loc13_;
}
else
{
this._actions.swirlBtn = _loc13_;
}
_loc13_.x = _loc2_ + ((_loc12_ - 5) % _loc5_ * _loc4_ + _loc6_);
_loc13_.y = _loc1_ + Math.floor((_loc12_ - 5) / _loc5_) * _loc3_ + _loc8_;
this._actions.addChild(_loc13_);
_loc13_.buttonMode = true;
_loc13_.useHandCursor = true;
_loc13_.tabEnabled = true;
_loc13_.tabChildren = false;
_loc13_.addEventListener(MouseEvent.MOUSE_DOWN,this.actionClickHandler,false,0,true);
}
}
_loc12_++;
}
_loc13_ = GETDEFINITIONBYNAME("playPetAnim_btnCont");
_loc13_.y = -31;
_loc13_.buttonMode = true;
_loc13_.useHandCursor = true;
_loc13_.tabEnabled = true;
_loc13_.tabChildren = false;
_loc13_.addEventListener(MouseEvent.MOUSE_DOWN,this.onPetPlayBtn,false,0,true);
this._petActions.addChild(_loc13_);
_loc13_ = GETDEFINITIONBYNAME("dancePetAnim_btnCont");
this._petActions.danceBtn = _loc13_;
_loc13_.y = 31;
_loc13_.buttonMode = true;
_loc13_.useHandCursor = true;
_loc13_.tabEnabled = true;
_loc13_.tabChildren = false;
_loc13_.addEventListener(MouseEvent.MOUSE_DOWN,this.actionClickHandler,false,0,true);
this._petActions.addChild(_loc13_);
this.actionStrings = new Object();
this.actionStrings["sit1BtnCont"] = this.actionStrings["pose1BtnCont"] = [":sitNW:",":poseLeft:"];
this.actionStrings["sit2BtnCont"] = [":sitNE:"];
this.actionStrings["sit3BtnCont"] = [":sitSE:"];
this.actionStrings["sit4BtnCont"] = this.actionStrings["pose2BtnCont"] = [":sitSW:",":poseRight:"];
this.actionStrings["danceAnim_btnCont"] = this.actionStrings["dancePetAnim_btnCont"] = [":dance:"];
this.actionStrings["sleepAnim_btnCont"] = this.actionStrings["diveAnim_btnCont"] = [":sleep:",":dive:"];
this.actionStrings["hopAnim_btnCont"] = this.actionStrings["swirlAnim_btnCont"] = [":hop:",":swirl:"];
this.actionStrings["playAnim_btnCont"] = [":play:"];
}
private function setupTitleBanner() : void
{
var _loc1_:Sprite = GETDEFINITIONBYNAME("AnimsTitleBanner");
_loc1_.x = -91.75;
_loc1_.y = -91.25;
this.actionWindow.addChild(_loc1_);
}
public function destroy() : void
{
this.setActionCallback = null;
this.actionBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.actionBtnDownHandler);
this.actionBtn = null;
this.actionWindow.visible = false;
this.actionWindow = null;
this.emoteBtn = null;
this.emoteWindow = null;
this.safeChatBtn = null;
this.safeChatTree = null;
}
public function getActionString(param1:Sprite) : String
{
var _loc2_:String = param1["constructor"].toString();
var _loc3_:String = _loc2_.slice(7,_loc2_.length - 1);
if(this.actionStrings[_loc3_])
{
if(this.actionStrings[_loc3_].length > 1)
{
return this.actionStrings[_loc2_.slice(7,_loc2_.length - 1)][AvatarManager.roomEnviroType == SbiConstants.ENVIRO_LAND ? 0 : 1];
}
return this.actionStrings[_loc2_.slice(7,_loc2_.length - 1)][0];
}
return null;
}
public function matchActionString(param1:String) : Sprite
{
var _loc2_:String = null;
var _loc3_:int = 0;
for each(_loc2_ in this.actionSprites)
{
_loc3_ = int(this.actionStrings[_loc2_].indexOf(param1));
if(_loc3_ != -1)
{
if(this.actionStrings[_loc2_].length <= 1)
{
return GETDEFINITIONBYNAME(_loc2_);
}
if(AvatarManager.roomEnviroType == SbiConstants.ENVIRO_LAND ? _loc3_ == 0 : _loc3_ == 1)
{
return GETDEFINITIONBYNAME(_loc2_);
}
}
}
return null;
}
public function openActions() : void
{
if(!this.actionWindow.visible)
{
this.actionWindow.visible = true;
this.brightenActions();
}
}
public function dimActions() : void
{
if(this.actionWindow.visible && this.actionWindow.alpha != this.ACTIONWINDOW_DIM_ALPHA)
{
this.actionWindow.alpha = this.ACTIONWINDOW_DIM_ALPHA;
}
}
public function brightenActions() : void
{
if(this.actionWindow.alpha != this.ACTIONWINDOW_BRIGHT_ALPHA)
{
this.actionWindow.alpha = this.ACTIONWINDOW_BRIGHT_ALPHA;
}
}
public function closeActions() : void
{
if(this.actionWindow.visible)
{
this.actionWindow.visible = false;
this.brightenActions();
this.actionBtn.downToUpState();
this.closeSideMenu(this._gameTab);
}
}
public function hideCancelBtn() : void
{
if(this._gameTab)
{
this._gameTab.gameCancelTabBtn.visible = false;
}
}
public function grayOutPetDanceBtn(param1:Boolean) : void
{
if(this._petActions)
{
this._petActions.danceBtn.activateGrayState(param1);
}
}
private function actionBtnDownHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(!param1.currentTarget.isGray)
{
if(this.actionWindow.visible)
{
this.closeActions();
}
else
{
if(this.safeChatTree.visible)
{
this.safeChatBtn.dispatchEvent(param1);
}
if(this.emoteWindow.visible)
{
this.emoteBtn.dispatchEvent(param1);
}
this.openActions();
}
}
}
private function onGameTab(param1:MouseEvent) : void
{
param1.stopPropagation();
if(!param1.currentTarget.isGray)
{
if(!this._isGameTabOpen)
{
if(this._pvpItemWindows == null)
{
this._pvpGameList = MinigameManager.minigameInfoCache.getAllReadyForPvpGameDefs();
this.createPVPWindows();
this.getPVPIcons();
}
else
{
this._gameTab.itemWindow.addChild(this._pvpItemWindows);
if(this._pvpScrollBar)
{
this._pvpScrollBar.destroy();
}
this._pvpScrollBar = new SBScrollbar();
this._pvpScrollBar.init(this._pvpItemWindows,155,156,3,"scrollbar2",78);
}
this.openSideMenu(this._gameTab);
}
else
{
this.closeSideMenu(this._gameTab);
}
}
}
private function onCancelGameTab(param1:MouseEvent) : void
{
param1.stopPropagation();
param1.currentTarget.visible = false;
UserCommXtCommManager.sendCustomPVPMessage(false,MinigameManager.minigameInfoCache.currMinigameId);
MinigameManager.readySelfForCustomPVPGame(-1,"");
}
private function openSideMenu(param1:MovieClip) : void
{
if(!this._isGameTabOpen)
{
new GTween(param1,0.5,{"x":param1.x + 175},{
"ease":TweenManager.quadratic,
"onComplete":this.sideMenuComplete
});
this._sideMenuTweenFinished = false;
this._isGameTabOpen = true;
AJAudio.playBuddyCardOpen();
}
}
private function closeSideMenu(param1:MovieClip) : void
{
if(this._isGameTabOpen && this._sideMenuTweenFinished)
{
new GTween(param1,0.5,{"x":param1.x - 175},{
"ease":TweenManager.quadratic,
"onComplete":this.sideMenuComplete
});
this._sideMenuTweenFinished = false;
this._isGameTabOpen = false;
AJAudio.playBuddyCardClose();
}
}
private function createPVPWindows() : void
{
if(this._pvpScrollBar)
{
this._pvpScrollBar.destroy();
this._pvpScrollBar = null;
}
if(Boolean(this._pvpItemWindows) && this._pvpItemWindows.numChildren > 0)
{
this._pvpItemWindows.destroy();
this._pvpItemWindows = null;
}
var _loc1_:int = int(this._pvpGameList.length);
var _loc2_:int = Math.min(_loc1_,2);
this._pvpItemWindows = new WindowGenerator();
this._pvpItemWindows.init(_loc2_,_loc2_,_loc1_,2,2,0,ItemWindowGame,null,"",{
"mouseDown":this.sideMenuMouseDown,
"mouseOver":this.sideMenuMouseOver,
"mouseOut":this.winMouseOut
},null,null,false,false);
this._gameTab.itemWindow.addChild(this._pvpItemWindows);
this._pvpScrollBar = new SBScrollbar();
this._pvpScrollBar.init(this._pvpItemWindows,155,156,3,"scrollbar2",78,0,Math.ceil(_loc1_ / _loc2_) * 78);
}
private function getPVPIcons() : void
{
var _loc2_:MediaHelper = null;
this._views = new Array();
var _loc1_:int = 0;
while(_loc1_ < this._pvpGameList.length)
{
_loc2_ = new MediaHelper();
_loc2_.init(this._pvpGameList[_loc1_].gameCardMediaId,this.mediaHelperCallback,true);
this._views[_loc1_] = _loc2_;
_loc1_++;
}
}
private function mediaHelperCallback(param1:MovieClip) : void
{
var _loc3_:MovieClip = null;
var _loc2_:int = 0;
while(_loc2_ < this._views.length)
{
if(this._views[_loc2_] == param1.mediaHelper)
{
_loc3_ = MovieClip(this._pvpItemWindows.bg.getChildAt(_loc2_));
_loc3_.itemLayer.addChild(param1);
}
_loc2_++;
}
}
private function sideMenuComplete(param1:GTween) : void
{
this._sideMenuTweenFinished = true;
}
private function sideMenuMouseDown(param1:MouseEvent) : void
{
param1.stopPropagation();
if(MinigameManager.minigameInfoCache.currMinigameId == this._pvpGameList[param1.currentTarget.index].gameDefId)
{
UserCommXtCommManager.sendCustomPVPMessage(false,this._pvpGameList[param1.currentTarget.index].gameDefId);
MinigameManager.readySelfForCustomPVPGame(-1,"");
this._gameTab.gameCancelTabBtn.visible = false;
}
else
{
UserCommXtCommManager.sendCustomPVPMessage(true,this._pvpGameList[param1.currentTarget.index].gameDefId);
MinigameManager.readySelfForCustomPVPGame(this._pvpGameList[param1.currentTarget.index].gameDefId,"");
this._gameTab.gameCancelTabBtn.visible = true;
}
this.closeActions();
}
private function sideMenuMouseOver(param1:MouseEvent) : void
{
var _loc2_:Point = null;
param1.stopPropagation();
if(this._sideMenuTweenFinished)
{
_loc2_ = param1.currentTarget.localToGlobal(new Point(0,0));
GuiManager.toolTip.init(this.actionWindow,LocalizationManager.translateIdOnly(this._pvpGameList[param1.currentTarget.index].titleStrId),_loc2_.x - this.actionWindow.x + this.actionWindow.hudGameTab.x + this.actionWindow.hudGameTab.itemWindow.x - param1.currentTarget.width,_loc2_.y - this.actionWindow.y + param1.currentTarget.height + this._gameTab.y);
GuiManager.toolTip.startTimer(param1);
AJAudio.playSubMenuBtnRollover();
}
}
private function winMouseOut(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.toolTip.resetTimerAndSetVisibility();
}
private function actionClickHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(!this.actionBtn.isGray && !param1.currentTarget.isGray)
{
this.setActionCallback(new param1.currentTarget.constructor());
this.actionBtn.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_DOWN));
param1.currentTarget.downToUpState();
}
}
private function onPetPlayBtn(param1:MouseEvent) : void
{
var _loc2_:WorldPet = null;
param1.stopPropagation();
if(AvatarManager.playerAvatarWorldView)
{
_loc2_ = AvatarManager.playerAvatarWorldView.getActivePet();
if(_loc2_)
{
AvatarManager.playerAvatarWorldView.faceAnim(0,0,false);
_loc2_.onClick(param1);
}
}
this.actionBtn.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_DOWN));
param1.currentTarget.downToUpState();
}
}
}
@@ -0,0 +1,187 @@
package gui
{
import avatar.AvatarInfo;
import com.sbi.popup.SBOkPopup;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
import localization.LocalizationManager;
import quest.QuestXtCommManager;
public class AdventureExpertPopup
{
private static var _difficultyPopup:MovieClip;
private static var _mediaHelper:MediaHelper;
private static var _guiLayer:DisplayLayer;
private static var _autoStart:Boolean;
private static var _scriptDef:Object;
private static const ADVENTURE_EXPERT_ID:int = 2288;
public function AdventureExpertPopup()
{
super();
}
public static function init(param1:int, param2:Boolean = false) : void
{
_scriptDef = QuestXtCommManager.getScriptDef(param1);
_guiLayer = GuiManager.guiLayer;
_autoStart = param2;
DarkenManager.showLoadingSpiral(true);
_mediaHelper = new MediaHelper();
_mediaHelper.init(ADVENTURE_EXPERT_ID,onExpertLoaded);
}
public static function destroy() : void
{
removeEventListeners();
_mediaHelper.destroy();
_mediaHelper = null;
if(_difficultyPopup)
{
DarkenManager.unDarken(_difficultyPopup);
_guiLayer.removeChild(_difficultyPopup);
_difficultyPopup = null;
}
}
private static function onExpertLoaded(param1:MovieClip) : void
{
DarkenManager.showLoadingSpiral(false);
_difficultyPopup = MovieClip(param1.getChildAt(0));
_difficultyPopup.x = MainFrame.VIEW_WIDTH * 0.5;
_difficultyPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
_difficultyPopup.nonMemLock.visible = !gMainFrame.userInfo.isMember;
_difficultyPopup.dModeCont.visible = false;
_difficultyPopup.scrim.visible = false;
addEventListeners();
_guiLayer.addChild(_difficultyPopup);
DarkenManager.darken(_difficultyPopup);
}
private static function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private static function onCloseBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
destroy();
}
private static function onDifficulty(param1:MouseEvent) : void
{
var _loc3_:AvatarInfo = null;
param1.stopPropagation();
var _loc2_:int = 0;
if(Utility.canQuest())
{
if(param1.currentTarget.name == _difficultyPopup.dModeCont.hardBtn.name)
{
_loc3_ = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
if(Boolean(_loc3_) && _loc3_.questLevel < _scriptDef.levelMin + 1)
{
new SBOkPopup(_guiLayer,LocalizationManager.translateIdAndInsertOnly(14696,_scriptDef.levelMin + 1));
return;
}
_loc2_ = 1;
}
if(_difficultyPopup.joinName == _difficultyPopup.joinBtn.name)
{
QuestXtCommManager.sendQuestCreateJoinPublic(_scriptDef.defId,_loc2_,_autoStart);
destroy();
DarkenManager.showLoadingSpiral(true);
return;
}
if(!gMainFrame.userInfo.isMember)
{
UpsellManager.displayPopup(UpsellManager.DIAMONDS,"customAdventure/");
destroy();
return;
}
QuestXtCommManager.sendQuestCreatePrivate(_scriptDef.defId,_loc2_,false);
destroy();
DarkenManager.showLoadingSpiral(true);
return;
}
destroy();
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(20142));
}
private static function onJoinTypeBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:AvatarInfo = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
if(Boolean(_loc2_) && _loc2_.questLevel < _scriptDef.levelMin)
{
new SBOkPopup(_guiLayer,LocalizationManager.translateIdAndInsertOnly(14697,_scriptDef.levelMin));
return;
}
if(!gMainFrame.userInfo.isMember && param1.currentTarget.name == _difficultyPopup.hostBtn.name)
{
UpsellManager.displayPopup(UpsellManager.DIAMONDS,"customAdventure/");
}
else if(_scriptDef.difficulty != 0)
{
_difficultyPopup.dModeCont.visible = true;
_difficultyPopup.scrim.visible = true;
_difficultyPopup.joinName = param1.currentTarget.name;
}
else
{
if(param1.currentTarget.name == _difficultyPopup.joinBtn.name)
{
QuestXtCommManager.sendQuestCreateJoinPublic(_scriptDef.defId,0,_autoStart);
}
else
{
QuestXtCommManager.sendQuestCreatePrivate(_scriptDef.defId,0,false);
}
destroy();
}
}
private static function onCloseModeCont(param1:MouseEvent) : void
{
param1.stopPropagation();
_difficultyPopup.dModeCont.visible = false;
_difficultyPopup.scrim.visible = false;
}
private static function addEventListeners() : void
{
if(_difficultyPopup)
{
_difficultyPopup.addEventListener(MouseEvent.MOUSE_DOWN,onPopup,false,0,true);
_difficultyPopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,onCloseBtn,false,0,true);
_difficultyPopup.dModeCont.normalBtn.addEventListener(MouseEvent.MOUSE_DOWN,onDifficulty,false,0,true);
_difficultyPopup.dModeCont.hardBtn.addEventListener(MouseEvent.MOUSE_DOWN,onDifficulty,false,0,true);
_difficultyPopup.dModeCont.bx.addEventListener(MouseEvent.MOUSE_DOWN,onCloseModeCont,false,0,true);
_difficultyPopup.joinBtn.addEventListener(MouseEvent.MOUSE_DOWN,onJoinTypeBtn,false,0,true);
_difficultyPopup.hostBtn.addEventListener(MouseEvent.MOUSE_DOWN,onJoinTypeBtn,false,0,true);
}
}
private static function removeEventListeners() : void
{
if(_difficultyPopup)
{
_difficultyPopup.removeEventListener(MouseEvent.MOUSE_DOWN,onPopup);
_difficultyPopup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,onCloseBtn);
_difficultyPopup.dModeCont.normalBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onDifficulty);
_difficultyPopup.dModeCont.hardBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onDifficulty);
_difficultyPopup.dModeCont.bx.removeEventListener(MouseEvent.MOUSE_DOWN,onCloseModeCont);
_difficultyPopup.joinBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onJoinTypeBtn);
_difficultyPopup.hostBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onJoinTypeBtn);
}
}
}
}
@@ -0,0 +1,510 @@
package gui
{
import avatar.Avatar;
import avatar.AvatarInfo;
import avatar.AvatarManager;
import avatar.AvatarUtility;
import avatar.AvatarView;
import avatar.AvatarXtCommManager;
import com.sbi.graphics.LayerAnim;
import com.sbi.popup.SBOkPopup;
import com.sbi.popup.SBPopupManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.geom.Point;
import loader.MediaHelper;
import localization.LocalizationManager;
import pet.GuiPet;
import quest.QuestXtCommManager;
public class AdventureJoin
{
public static const NORMAL_TYPE:String = "normal";
public static const CUSTOM_WAITING_TYPE:String = "custParty";
public static const CUSTOM_SETTINGS_TYPE:String = "custSettings";
public static const NO_LOBBY:String = "noPlayers";
private const MEDIA_ID:int = 2249;
private var _scriptDef:Object;
private var _mediaHelper:MediaHelper;
private var _popup:MovieClip;
private var _numPlayersMC:MovieClip;
private var _guiLayer:DisplayLayer;
private var _inParamsWaiting:Object;
private var _artLoadingSpiral:LoadingSpiral;
private var _closeCallback:Function;
private var _savedParams:Array;
private var _type:String;
private var _modeDropDown:GuiDropdown;
private var _difficulty:int;
private var _numPlayersText:String;
private var _bigPet:GuiPet;
public function AdventureJoin()
{
super();
}
public function init(param1:int, param2:String, param3:int, param4:Function) : void
{
this._savedParams = [];
this._scriptDef = QuestXtCommManager.getScriptDef(param1);
this._type = param2;
this._difficulty = param3;
this._guiLayer = GuiManager.guiLayer;
this._closeCallback = param4;
DarkenManager.showLoadingSpiral(true);
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(this.MEDIA_ID,this.onMediaLoaded);
}
public function destroy() : void
{
SBPopupManager.closeAll();
TradeManager.closeAllTradingRelatedPopups();
this.removeEventListeners();
if(this._bigPet)
{
this._bigPet.destroy();
this._bigPet = null;
}
this._mediaHelper.destroy();
this._mediaHelper = null;
if(this._popup)
{
DarkenManager.unDarken(this._popup);
this._guiLayer.removeChild(this._popup);
this._popup = null;
}
}
public function handleWaitResponse(param1:Object) : void
{
var _loc2_:int = 0;
var _loc3_:int = 0;
var _loc4_:int = 0;
var _loc5_:int = 0;
var _loc6_:int = 0;
var _loc7_:Avatar = null;
var _loc8_:AvatarInfo = null;
if(Boolean(this._popup) && (this._type == NORMAL_TYPE || this._type == CUSTOM_WAITING_TYPE))
{
_loc2_ = int(this._scriptDef.avatarLimit);
_loc3_ = 1;
_loc4_ = 1;
while(_loc4_ < _loc2_ + 1)
{
while(this._numPlayersMC["p" + _loc4_].char.charLayer.numChildren > 0)
{
this._numPlayersMC["p" + _loc4_].char.charLayer.removeChildAt(0);
}
this._numPlayersMC["p" + _loc4_].char.gotoAndPlay("waiting");
this._numPlayersMC["p" + _loc4_].char.nameBar.lastName_txt.text = "";
_loc4_++;
}
_loc5_ = 2;
for(; _loc5_ < _loc2_ + 2; _loc5_++)
{
if(_loc5_ < param1.length)
{
_loc6_ = int(param1[_loc5_]);
this._numPlayersMC["p" + (_loc5_ - 1)].char.gotoAndPlay("up");
_loc7_ = AvatarManager.getAvatarBySfsUserId(_loc6_);
if(_loc7_)
{
_loc8_ = gMainFrame.userInfo.getAvatarInfoByUserName(_loc7_.userName);
}
if(_loc7_ == null || _loc8_ == null)
{
this._savedParams[_loc6_] = this._numPlayersMC["p" + (_loc5_ - 1)];
AvatarXtCommManager.requestAvatarGetBySfsId(_loc6_,this.onAvatarGetReceived);
continue;
}
this.setupAvatar(this._numPlayersMC["p" + (_loc5_ - 1)],_loc7_,_loc8_.currPet);
}
else
{
this._numPlayersMC["p" + (_loc5_ - 1)].char.gotoAndPlay("waiting");
LocalizationManager.translateId(this._numPlayersMC["p" + (_loc5_ - 1)].char.nameBar.firstName_txt,11101);
this._numPlayersMC["p" + (_loc5_ - 1)].char.nameBar.lastName_txt.text = "";
}
this._numPlayersMC["p" + (_loc5_ - 1)].char.nameBar.visible = false;
}
}
else
{
this._inParamsWaiting = param1;
}
}
private function setupAvatar(param1:MovieClip, param2:Avatar, param3:Object) : void
{
var _loc4_:GuiPet = null;
var _loc5_:AvatarView = null;
var _loc6_:Point = null;
var _loc7_:String = null;
var _loc8_:int = 0;
var _loc9_:String = null;
var _loc10_:String = null;
if(this._scriptDef.playAsPet)
{
_loc4_ = new GuiPet(0,param3.lBits,param3.uBits,param3.eBits,param3.type,param3.name,this.onBigPetLoaded);
param1.char.charLayer.addChild(_loc4_);
param1.char.nameBar.firstName_txt.text = _loc4_.petName;
}
else
{
_loc5_ = new AvatarView();
_loc5_.init(param2);
_loc5_.playAnim(LayerAnim.AN_HUD_AVT);
_loc5_.scaleX = 0.7;
_loc5_.scaleY = 0.7;
_loc6_ = AvatarUtility.getAvatarMinigameLobbyOffset(_loc5_.avTypeId);
_loc5_.x = _loc6_.x;
_loc5_.y = _loc6_.y + 5;
param1.char.charLayer.addChild(_loc5_);
_loc7_ = param2.avName;
_loc8_ = _loc7_.indexOf(" ");
if(_loc8_ != -1)
{
_loc9_ = _loc7_.substr(0,_loc8_);
_loc10_ = _loc7_.substr(_loc8_ + 1,_loc7_.length);
}
else
{
_loc9_ = _loc7_;
}
param1.char.nameBar.firstName_txt.text = _loc9_;
if(_loc10_)
{
param1.char.nameBar.lastName_txt.text = _loc10_;
}
}
param1.char.nameBar.visible = false;
}
private function onBigPetLoaded(param1:MovieClip, param2:GuiPet) : void
{
param2.y += 30;
}
private function onAvatarGetReceived(param1:String, param2:Boolean, param3:int, param4:int) : void
{
var _loc5_:AvatarInfo = null;
var _loc6_:int = 0;
var _loc7_:Avatar = null;
if(Boolean(this._popup) && param2)
{
_loc5_ = gMainFrame.userInfo.getAvatarInfoByUserName(param1);
if(!_loc5_)
{
throw new Error("onAvatarSFSGetReceived and avInfo is null");
}
_loc6_ = _loc5_.perUserAvId;
_loc7_ = AvatarManager.getAvatarByUserName(param1);
if(_loc7_ == null)
{
_loc7_ = AvatarUtility.generateNew(_loc6_,null,param1,-1,0);
}
this.setupAvatar(this._savedParams[param4],_loc7_,_loc5_.currPet);
delete this._savedParams[param4];
}
}
private function onMediaLoaded(param1:MovieClip) : void
{
var _loc2_:AvatarView = null;
var _loc3_:String = null;
var _loc4_:int = 0;
var _loc5_:String = null;
var _loc6_:String = null;
var _loc7_:int = 0;
DarkenManager.showLoadingSpiral(false);
this._popup = MovieClip(param1.getChildAt(0));
if(this._type == NO_LOBBY)
{
this._popup.gotoAndStop(NO_LOBBY);
LocalizationManager.translateId(this._popup.contTxt,this._scriptDef.descStrId);
this._artLoadingSpiral = new LoadingSpiral(this._popup.artWindow,this._popup.artWindow.width * 0.5,this._popup.artWindow.height * 0.5);
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(this._scriptDef.mediaRefId,this.onArtLoaded);
}
else
{
this._popup.gotoAndStop(NORMAL_TYPE);
switch(this._scriptDef.avatarLimit)
{
case 4:
this._numPlayersMC = this._popup.fourPlayers;
this._popup.sixPlayers.visible = false;
this._popup.eightPlayers.visible = false;
this._popup.twelvePlayers.visible = false;
break;
case 6:
this._numPlayersMC = this._popup.sixPlayers;
this._popup.fourPlayers.visible = false;
this._popup.eightPlayers.visible = false;
this._popup.twelvePlayers.visible = false;
break;
case 8:
this._numPlayersMC = this._popup.eightPlayers;
this._popup.sixPlayers.visible = false;
this._popup.fourPlayers.visible = false;
this._popup.twelvePlayers.visible = false;
break;
case 12:
this._numPlayersMC = this._popup.twelvePlayers;
this._popup.sixPlayers.visible = false;
this._popup.fourPlayers.visible = false;
this._popup.eightPlayers.visible = false;
}
LocalizationManager.translateId(this._numPlayersMC.contTxt,this._scriptDef.descStrId);
this._artLoadingSpiral = new LoadingSpiral(this._popup.artWindow,this._popup.artWindow.width * 0.5,this._popup.artWindow.height * 0.5);
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(this._scriptDef.mediaRefId,this.onArtLoaded);
if(this._type == NORMAL_TYPE || this._type == CUSTOM_WAITING_TYPE)
{
_loc2_ = new AvatarView();
_loc2_.init(AvatarManager.playerAvatar);
_loc2_.playAnim(LayerAnim.AN_HUD_AVT);
this._numPlayersMC.p1.char.charLayer.addChild(_loc2_);
if(this._type == CUSTOM_WAITING_TYPE)
{
this._popup.playBtn.visible = false;
this._popup.playBg.visible = false;
}
_loc3_ = AvatarManager.playerAvatar.avName;
_loc4_ = _loc3_.indexOf(" ");
if(_loc4_ != -1)
{
_loc5_ = _loc3_.substr(0,_loc4_);
_loc6_ = _loc3_.substr(_loc4_ + 1,_loc3_.length);
}
else
{
_loc5_ = _loc3_;
}
this._numPlayersMC.p1.char.nameBar.firstName_txt.text = _loc5_;
if(_loc6_)
{
this._numPlayersMC.p1.char.nameBar.lastName_txt.text = _loc6_;
}
this._numPlayersMC.p1.char.nameBar.visible = false;
_loc7_ = 2;
while(_loc7_ < this._scriptDef.avatarLimit + 1)
{
this._numPlayersMC["p" + _loc7_].char.gotoAndPlay("waiting");
LocalizationManager.translateId(this._numPlayersMC["p" + _loc7_].char.nameBar.firstName_txt,11101);
this._numPlayersMC["p" + _loc7_].char.nameBar.lastName_txt.text = "";
_loc7_++;
}
}
else if(this._type == CUSTOM_SETTINGS_TYPE)
{
this._modeDropDown = new GuiDropdown(this._popup.mode.dropdown);
this._modeDropDown.init(0,0);
}
}
if(this._difficulty == 0)
{
this._popup.hardMode.visible = false;
}
LocalizationManager.translateId(this._popup.titleTxt,this._scriptDef.titleStrId);
this.addEventListeners();
this._popup.x = MainFrame.VIEW_WIDTH * 0.5;
this._popup.y = MainFrame.VIEW_HEIGHT * 0.5;
this._guiLayer.addChild(this._popup);
DarkenManager.darken(this._popup);
if(this._inParamsWaiting != null)
{
this.handleWaitResponse(this._inParamsWaiting);
this._inParamsWaiting = null;
}
}
private function onArtLoaded(param1:MovieClip) : void
{
while(this._popup.artWindow.numChildren > 0)
{
this._popup.artWindow.removeChildAt(0);
}
this._popup.artWindow.addChild(param1);
if(this._artLoadingSpiral != null)
{
this._artLoadingSpiral.destroy();
this._artLoadingSpiral = null;
}
}
private function onBuddyToggle(param1:MouseEvent) : void
{
param1.stopPropagation();
if(param1.currentTarget.currentLabel == "on" || param1.currentTarget.currentLabel == "startingOn")
{
param1.currentTarget.gotoAndPlay("off");
}
else
{
param1.currentTarget.gotoAndPlay("on");
}
}
private function onDropDown(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function addEventListeners() : void
{
var _loc1_:int = 0;
if(this._popup)
{
this._popup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
this._popup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onCloseBtn,false,0,true);
if(this._type == NO_LOBBY)
{
this._popup.playBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlayBtn,false,0,true);
}
else
{
_loc1_ = 1;
while(_loc1_ < this._scriptDef.avatarLimit + 1)
{
this._numPlayersMC["p" + _loc1_].char.addEventListener(MouseEvent.ROLL_OVER,this.onCharRollOver,false,0,true);
this._numPlayersMC["p" + _loc1_].char.addEventListener(MouseEvent.ROLL_OUT,this.onCharRollOut,false,0,true);
_loc1_++;
}
if(this._type == NORMAL_TYPE)
{
this._popup.playBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlayBtn,false,0,true);
}
else if(this._type == CUSTOM_SETTINGS_TYPE)
{
this._popup.buddiesOnly.toggleBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onBuddyToggle,false,0,true);
this._modeDropDown.currDropDown.addEventListener(MouseEvent.MOUSE_DOWN,this.onDropDown,false,0,true);
this._popup.inviteBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onInviteBtn,false,0,true);
}
}
}
}
private function removeEventListeners() : void
{
var _loc1_:int = 0;
if(this._popup)
{
this._popup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
this._popup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onCloseBtn);
if(this._type == NO_LOBBY)
{
this._popup.playBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPlayBtn);
}
else
{
_loc1_ = 1;
while(_loc1_ < this._scriptDef.avatarLimit + 1)
{
this._numPlayersMC["p" + _loc1_].char.removeEventListener(MouseEvent.ROLL_OVER,this.onCharRollOver);
this._numPlayersMC["p" + _loc1_].char.removeEventListener(MouseEvent.ROLL_OUT,this.onCharRollOut);
_loc1_++;
}
if(this._type == NORMAL_TYPE)
{
this._popup.playBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPlayBtn);
}
else if(this._type == CUSTOM_SETTINGS_TYPE)
{
this._popup.buddiesOnly.toggleBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onBuddyToggle);
this._modeDropDown.currDropDown.removeEventListener(MouseEvent.MOUSE_DOWN,this.onDropDown);
this._popup.inviteBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onInviteBtn);
}
}
}
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onCloseBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
QuestXtCommManager.sendQuestJoinCancel();
if(this._closeCallback != null)
{
this._closeCallback();
this._closeCallback = null;
}
else
{
this.destroy();
}
}
private function onPlayBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
if(param1.currentTarget.isGray)
{
return;
}
var _loc2_:AvatarInfo = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
if(Boolean(_loc2_) && _loc2_.questLevel < this._scriptDef.levelMin)
{
new SBOkPopup(this._guiLayer,LocalizationManager.translateIdAndInsertOnly(14697,this._scriptDef.levelMin));
return;
}
if(this._type == CUSTOM_SETTINGS_TYPE)
{
QuestXtCommManager.sendQuestCreatePrivate(this._scriptDef.defId,this._modeDropDown.selectedIdx,false);
}
else if(this._type == NORMAL_TYPE)
{
QuestXtCommManager.sendQuestStartRequest();
}
else if(this._type == NO_LOBBY)
{
QuestXtCommManager.sendQuestCreateJoinPublic(this._scriptDef.defId,0);
}
}
private function onInviteBtn(param1:MouseEvent) : void
{
this.onPlayBtn(param1);
}
private function onCharRollOver(param1:MouseEvent) : void
{
param1.stopPropagation();
param1.currentTarget.gotoAndStop("over");
param1.currentTarget.nameBar.visible = true;
}
private function onCharRollOut(param1:MouseEvent) : void
{
param1.stopPropagation();
param1.currentTarget.gotoAndStop("up");
param1.currentTarget.nameBar.visible = false;
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,626 @@
package gui
{
import avatar.AvatarInfo;
import buddy.Buddy;
import buddy.BuddyEvent;
import buddy.BuddyXtCommManager;
import com.sbi.client.SFClient;
import com.sbi.popup.SBPopup;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.geom.Point;
import flash.utils.Dictionary;
import flash.utils.Timer;
import localization.LocalizationManager;
import room.RoomManagerWorld;
public class BuddyList
{
private static var _playerSearch:PlayerSearch;
private static var _buddyListPopup:SBPopup;
private static var _buddyListContent:MovieClip;
private static var _buddyListWindow:MovieClip;
private static var _buddyListWindow2:MovieClip;
private static var _buddyListBtn:MovieClip;
private static var _scrollbar:SBScrollbar;
private static var _buddyListWorldPopup:MovieClip;
private static var _buddyListWorldWindow:MovieClip;
private static var _scrollbarInWorld:SBScrollbar;
private static var _requestingForWorldBuddyList:Boolean;
private static var _worldSelectCallback:Function;
private static var _currentSelectedUsername:String;
private static var _currentSelectedItem:Object;
private static var _glowTimer:Timer;
private static var _buddyListScrollOffset:int;
private static var _popupLayer:DisplayLayer;
private static var _loadingSpiral:LoadingSpiral;
private static var _worldPopupLoadingSpiral:LoadingSpiral;
public static var listRequested:Boolean;
private static const BUDDY_LIST_X_OFFSET:int = 5;
private static const BUDDY_LIST_Y_OFFSET:int = 49;
public function BuddyList()
{
super();
}
public static function init(param1:DisplayLayer, param2:MovieClip, param3:Boolean = false) : void
{
_popupLayer = param1;
_buddyListBtn = param2;
if(!Utility.canBuddy())
{
_buddyListBtn.activateGrayState(true);
}
_buddyListContent = GETDEFINITIONBYNAME("BuddyListContent");
LocalizationManager.translateId(_buddyListContent.buddyListTitleTxt,11250);
_buddyListContent.counterTxt.text = String(BuddyManager.buddyCount) + "/" + String(BuddyManager.MAX_BUDDY_COUNT);
_buddyListPopup = new SBPopup(_popupLayer,GETDEFINITIONBYNAME("BuddyListPopup"),_buddyListContent,false,true,false,false);
_buddyListPopup.closeCallback = buddyListClosedCallback;
_buddyListPopup.x = _buddyListPopup.width * 0.5 + BUDDY_LIST_X_OFFSET;
_buddyListPopup.y = _buddyListPopup.skin.s.ba.height * 0.5 + BUDDY_LIST_Y_OFFSET;
_loadingSpiral = new LoadingSpiral(DisplayObjectContainer(_buddyListPopup.content),-15);
_glowTimer = new Timer(5000);
addListeners();
if(param3)
{
onBuddyListChange(null);
}
}
public static function rebuildBtn(param1:MovieClip) : void
{
if(_buddyListBtn)
{
_buddyListBtn.removeEventListener(MouseEvent.MOUSE_DOWN,buddyListBtnHandler);
}
_buddyListBtn = param1;
if(Utility.canBuddy())
{
_buddyListBtn.addEventListener(MouseEvent.MOUSE_DOWN,buddyListBtnHandler,false,0,true);
}
else
{
_buddyListBtn.activateGrayState(true);
}
_buddyListBtn.glow.visible = false;
LocalizationManager.translateId(_buddyListContent.buddyListTitleTxt,11250);
}
public static function destroy() : void
{
var _loc1_:int = 0;
if(_buddyListWindow)
{
_loc1_ = 0;
while(_loc1_ < _buddyListWindow.numChildren)
{
_buddyListWindow.getChildAt(0).removeEventListener(MouseEvent.MOUSE_DOWN,buddyListClickOnBuddyHandler);
_buddyListWindow.removeChildAt(0);
_loc1_++;
}
}
removeListeners();
if(_buddyListWindow2)
{
_loc1_ = 0;
while(_loc1_ < _buddyListWindow2.numChildren)
{
_buddyListWindow2.removeChildAt(0);
_loc1_++;
}
}
_buddyListContent = null;
if(_buddyListPopup)
{
_buddyListPopup.destroy();
_buddyListPopup = null;
}
}
public static function get visible() : Boolean
{
return _buddyListPopup.visible;
}
public static function closeBuddyList() : void
{
if(Boolean(_buddyListPopup) && _buddyListPopup.visible)
{
_buddyListPopup.close();
GuiManager.toolTip.resetTimerAndSetVisibility();
_buddyListBtn.downToUpState();
}
}
private static function onBuddyListChange(param1:Event) : void
{
var _loc3_:DisplayObject = null;
if(_buddyListWorldPopup)
{
buildInWorldBuddyList(null,_currentSelectedItem,null,_currentSelectedUsername);
}
_loadingSpiral.visible = false;
_buddyListContent.counterTxt.text = String(BuddyManager.buddyCount) + "/" + String(BuddyManager.MAX_BUDDY_COUNT);
var _loc2_:Number = -1;
if(_scrollbar)
{
_loc2_ = _scrollbar.scrollYPercentage;
_scrollbar.destroy();
_scrollbar = null;
}
if(_buddyListWindow != null)
{
while(_buddyListWindow.numChildren > 0)
{
_loc3_ = _buddyListWindow.getChildAt(0);
_loc3_.removeEventListener(MouseEvent.MOUSE_DOWN,buddyListClickOnBuddyHandler);
_buddyListWindow.removeChild(_loc3_);
_loc3_ = null;
}
if(_buddyListWindow.parent)
{
_buddyListWindow.parent.removeChild(_buddyListWindow);
}
}
_buddyListWindow = new MovieClip();
MovieClip(_buddyListPopup.content).itemBlock.addChild(_buddyListWindow);
buildBuddyListWindow(_buddyListWindow,true);
if(_buddyListWindow.height >= 19.59 * 10)
{
_loc2_ *= _buddyListWindow.height - 19.59 * 10;
}
_scrollbar = new SBScrollbar();
_scrollbar.init(_buddyListWindow,MovieClip(_buddyListPopup.content).itemBlock.width,19.59 * 10,5,"scrollbar2",19.59,_loc2_);
}
public static function buildBuddyListWindow(param1:MovieClip, param2:Boolean = false) : void
{
var _loc6_:Buddy = null;
var _loc7_:Number = NaN;
var _loc8_:int = 0;
var _loc9_:MovieClip = null;
var _loc10_:String = null;
var _loc11_:String = null;
var _loc12_:AvatarInfo = null;
var _loc3_:Array = [];
var _loc4_:Dictionary = BuddyManager.buddyList;
var _loc5_:int = BuddyManager.buddyCount;
_buddyListContent.counterTxt.text = String(BuddyManager.buddyCount) + "/" + String(BuddyManager.MAX_BUDDY_COUNT);
if(Boolean(_loc4_) && _loc5_ > 0)
{
for each(_loc6_ in _loc4_)
{
_loc3_.push({
"userName":_loc6_.userName,
"moderatedUserName":_loc6_.userNameModerated,
"onlineStatus":_loc6_.onlineStatus,
"numDaysSinceLastLogin":_loc6_.numDaysSinceLastLogin,
"accountType":_loc6_.accountType
});
}
_loc3_.sortOn(["onlineStatus","userName"],[Array.DESCENDING,Array.CASEINSENSITIVE]);
_loc7_ = 0;
_loc8_ = 0;
while(_loc8_ < _loc5_)
{
_loc10_ = _loc3_[_loc8_].userName;
if(_loc3_[_loc8_].onlineStatus == SFClient.STATUS_ONLINE)
{
_loc9_ = GETDEFINITIONBYNAME("OnlineBuddyListWindow");
_loc11_ = "Avatar Name";
_loc12_ = gMainFrame.userInfo.getAvatarInfoByUserName(_loc10_);
if(_loc12_)
{
_loc11_ = _loc12_.avName;
}
LocalizationManager.updateToFit(_loc9_.avNameTxt,_loc11_);
if(BuddyManager.isBlocked(_loc10_))
{
_loc9_.onOffBlocked.gotoAndStop("blocked");
}
else
{
_loc9_.onOffBlocked.gotoAndStop("online");
}
}
else
{
_loc9_ = GETDEFINITIONBYNAME("OfflineBuddyListWindow");
_loc9_.onOffBlocked.gotoAndStop("offline");
}
param1.addChild(_loc9_);
_loc9_.x = 0;
_loc9_.y = _loc7_;
_loc7_ += _loc9_.height;
_loc9_.userName = _loc10_;
_loc9_.moderatedUserName = _loc3_[_loc8_].moderatedUserName;
LocalizationManager.updateToFit(_loc9_.userNameTxt,_loc3_[_loc8_].moderatedUserName);
_loc9_.onlineStatus = _loc3_[_loc8_].onlineStatus;
_loc9_.daysSinceLastLogin = _loc3_[_loc8_].numDaysSinceLastLogin;
_loc9_.accountType = _loc3_[_loc8_].accountType;
if(param2)
{
_loc9_.addEventListener(MouseEvent.MOUSE_DOWN,buddyListClickOnBuddyHandler,false,0,true);
_loc9_.addEventListener(MouseEvent.MOUSE_OVER,buddyListOverBuddyHandler,false,0,true);
_loc9_.addEventListener(MouseEvent.MOUSE_OUT,buddyListOutBuddyHandler,false,0,true);
}
_loc8_++;
}
}
}
private static function buildInWorldBuddyListWindow(param1:MovieClip, param2:String) : void
{
var _loc6_:Buddy = null;
var _loc7_:Number = NaN;
var _loc8_:int = 0;
var _loc9_:MovieClip = null;
var _loc10_:String = null;
var _loc3_:Array = [];
var _loc4_:Dictionary = BuddyManager.buddyList;
var _loc5_:int = BuddyManager.buddyCount;
if(Boolean(_loc4_) && _loc5_ > 0)
{
for each(_loc6_ in _loc4_)
{
_loc3_.push({
"userName":_loc6_.userName,
"moderatedUserName":_loc6_.userNameModerated,
"onlineStatus":_loc6_.onlineStatus
});
}
_loc3_.sortOn(["userName"],[Array.DESCENDING,Array.CASEINSENSITIVE]);
_loc7_ = 0;
param1.selectedIndex = -1;
_loc8_ = 0;
while(_loc8_ < _loc5_)
{
_loc10_ = _loc3_[_loc8_].userName;
_loc9_ = GETDEFINITIONBYNAME("portalBuddyListWindowCont");
param1.addChild(_loc9_);
_loc9_.x = 0;
_loc9_.y = _loc7_;
_loc7_ += _loc9_.height;
_loc9_.userName = _loc10_;
_loc9_.moderatedUserName = _loc3_[_loc8_].moderatedUserName;
LocalizationManager.updateToFit(_loc9_.userNameTxt,_loc3_[_loc8_].moderatedUserName);
_loc9_.selectPortalBuddyBox = new GuiRadioButtonSingle(_loc9_.radioBtn,_loc9_.userNameTxt);
if(_loc3_[_loc8_].onlineStatus == SFClient.STATUS_OFFLINE_ARCHIVED)
{
_loc9_.selectPortalBuddyBox.gray = true;
}
else
{
if(_loc10_.toLowerCase() == param2.toLowerCase())
{
_loc9_.selectPortalBuddyBox.selected = true;
param1.selectedIndex = _loc8_;
_currentSelectedUsername = param2;
}
else
{
_loc9_.selectPortalBuddyBox.selected = false;
}
_loc9_.index = _loc8_;
_loc9_.addEventListener(MouseEvent.MOUSE_DOWN,worldBuddyListClickOnBuddyHandler,false,0,true);
}
_loc8_++;
}
}
}
public static function buildInWorldBuddyList(param1:MovieClip, param2:Object, param3:Function, param4:String) : void
{
if(Boolean(!param1) || Boolean(param1 && !closeWorldBuddyList()) || !listRequested)
{
if(param1)
{
_worldSelectCallback = param3;
if(_buddyListWorldPopup == null)
{
_buddyListWorldPopup = GETDEFINITIONBYNAME("portalLinkBuddyListPopup");
}
if(_worldPopupLoadingSpiral == null)
{
_worldPopupLoadingSpiral = new LoadingSpiral(_buddyListWorldPopup,_buddyListWorldPopup.width * 0.5,_buddyListWorldPopup.height * 0.5);
}
RoomManagerWorld.instance.layerManager.room_chat.addChild(_buddyListWorldPopup);
_buddyListWorldPopup.x = param1.x - _buddyListWorldPopup.width * 0.5;
_buddyListWorldPopup.y = param1.y + 30;
}
if(!listRequested)
{
_worldPopupLoadingSpiral.visible = true;
BuddyXtCommManager.sendBuddyListRequest();
listRequested = true;
_requestingForWorldBuddyList = true;
_currentSelectedUsername = param4;
_currentSelectedItem = param2;
}
else
{
if(!param1 || !_buddyListWorldWindow || _buddyListWorldWindow.selectedItem != param2)
{
_currentSelectedUsername = param4;
_currentSelectedItem = param2;
if(_scrollbarInWorld)
{
_scrollbarInWorld.destroy();
_scrollbarInWorld = null;
}
_buddyListWorldWindow = new MovieClip();
while(_buddyListWorldPopup.numChildren > 2)
{
_buddyListWorldPopup.removeChildAt(_buddyListWorldPopup.numChildren - 1);
}
_buddyListWorldPopup.itemBlock.addChild(_buddyListWorldWindow);
buildInWorldBuddyListWindow(_buddyListWorldWindow,param4);
_scrollbarInWorld = new SBScrollbar();
_scrollbarInWorld.init(_buddyListWorldWindow,_buddyListWorldPopup.itemBlock.width,22 * 6,0,"scrollbar2",22);
_buddyListWorldWindow.selectedItem = param2;
}
_worldPopupLoadingSpiral.visible = false;
}
}
}
public static function updateWorldBuddyListPosition(param1:MovieClip) : void
{
if(Boolean(_buddyListWorldPopup) && Boolean(_buddyListWorldPopup.parent))
{
_buddyListWorldPopup.x = param1.x - _buddyListWorldPopup.width * 0.5;
_buddyListWorldPopup.y = param1.y + 30;
}
}
public static function closeWorldBuddyList() : Boolean
{
if(Boolean(_buddyListWorldPopup) && Boolean(_buddyListWorldPopup.parent))
{
_buddyListWorldPopup.parent.removeChild(_buddyListWorldPopup);
_worldSelectCallback = null;
_currentSelectedItem = null;
return true;
}
return false;
}
public static function isOverWorldBuddyList(param1:int, param2:int) : Boolean
{
var _loc3_:Point = null;
if(Boolean(_buddyListWorldPopup) && Boolean(_buddyListWorldPopup.parent))
{
_loc3_ = RoomManagerWorld.instance.convertWorldToScreen(param1,param2);
return _buddyListWorldPopup.hitTestPoint(_loc3_.x,_loc3_.y,true);
}
return false;
}
public static function destroyInWorldBuddyList() : void
{
closeWorldBuddyList();
_buddyListWorldPopup = null;
_buddyListWorldWindow = null;
if(_scrollbarInWorld)
{
_scrollbarInWorld.destroy();
_scrollbarInWorld = null;
}
_worldSelectCallback = null;
_currentSelectedUsername = "";
_currentSelectedItem = null;
}
private static function worldBuddyListClickOnBuddyHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_worldSelectCallback != null)
{
if(_currentSelectedUsername.toLowerCase() == param1.currentTarget.userName.toLowerCase())
{
_buddyListWorldWindow.selectedIndex = -1;
_currentSelectedUsername = "";
}
else
{
if(_buddyListWorldWindow.selectedIndex != -1)
{
MovieClip(_buddyListWorldWindow.getChildAt(_buddyListWorldWindow.selectedIndex)).selectPortalBuddyBox.selected = false;
}
_buddyListWorldWindow.selectedIndex = param1.currentTarget.index;
_currentSelectedUsername = param1.currentTarget.userName;
}
_worldSelectCallback(_currentSelectedUsername);
}
}
private static function buddyListClickOnBuddyHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:MovieClip = MovieClip(param1.currentTarget);
if(_loc2_.userName.indexOf("Liza") < 0)
{
BuddyCard.showBuddyCard({
"userName":_loc2_.userName,
"onlineStatus":_loc2_.onlineStatus
});
}
GuiManager.toolTip.resetTimerAndSetVisibility();
AJAudio.playSubMenuBtnClick();
}
private static function buddyListOverBuddyHandler(param1:MouseEvent) : void
{
var _loc5_:String = null;
var _loc2_:int = _buddyListPopup.x - _buddyListWindow.width * 0.5 + 5;
var _loc3_:int = _buddyListPopup.y - 19.6 * 4.5 - _scrollbar.scrollYValue;
var _loc4_:MovieClip = MovieClip(param1.currentTarget.getChildAt(0));
var _loc6_:int = int(param1.currentTarget.daysSinceLastLogin);
if(param1.currentTarget.avNameTxt)
{
_loc5_ = LocalizationManager.translateIdOnly(11251);
}
else if(_loc6_ == 0)
{
_loc5_ = LocalizationManager.translateIdOnly(11252);
}
else if(_loc6_ == 1)
{
_loc5_ = LocalizationManager.translateIdOnly(11253);
}
else if(_loc6_ > 1 && _loc6_ < 31)
{
_loc5_ = LocalizationManager.translateIdAndInsertOnly(11254,_loc6_);
}
else if(_loc6_ > 30 || _loc6_ == -1)
{
_loc5_ = LocalizationManager.translateIdOnly(11255);
}
else
{
_loc5_ = LocalizationManager.translateIdOnly(11256);
}
GuiManager.toolTip.init(GuiManager.guiLayer,_loc5_,0,0);
GuiManager.toolTip.setPos(_loc2_ + _loc4_.x + GuiManager.toolTip.width * 0.5,_loc3_ + param1.currentTarget.y);
GuiManager.toolTip.startTimer(param1);
}
private static function buddyListOutBuddyHandler(param1:MouseEvent) : void
{
GuiManager.toolTip.resetTimerAndSetVisibility();
}
private static function buddyListBtnHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(!param1.currentTarget.isGray)
{
if(!listRequested)
{
BuddyXtCommManager.sendBuddyListRequest();
listRequested = true;
}
GuiManager.onExitRoom(true);
if(_buddyListPopup.visible)
{
_buddyListPopup.close();
}
else
{
glowTimerHandler(null);
_buddyListPopup.open();
}
}
}
private static function buddyListClosedCallback() : void
{
_buddyListBtn.downToUpState();
_buddyListScrollOffset = 0;
}
public static function startBuddyListBtnGlow() : void
{
if(_buddyListBtn)
{
_buddyListBtn.glow.visible = true;
}
AJAudio.playBuddyOnlineOfflineSound();
if(_glowTimer.running)
{
_glowTimer.stop();
}
_glowTimer.start();
}
private static function glowTimerHandler(param1:TimerEvent) : void
{
_glowTimer.stop();
if(_buddyListBtn)
{
_buddyListBtn.glow.visible = false;
}
}
private static function onSearchBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
_playerSearch = new PlayerSearch();
_playerSearch.init();
DarkenManager.showLoadingSpiral(true);
GuiManager.toolTip.resetTimerAndSetVisibility();
}
private static function onSearchBtnOver(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.toolTip.init(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14638),180,305);
GuiManager.toolTip.startTimer(param1);
}
private static function onSearchBtnOut(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.toolTip.resetTimerAndSetVisibility();
}
private static function addListeners() : void
{
_glowTimer.addEventListener(TimerEvent.TIMER,glowTimerHandler,false,0,true);
BuddyManager.eventDispatcher.addEventListener(BuddyEvent.BUDDY_LIST,onBuddyListChange,false,0,true);
BuddyManager.eventDispatcher.addEventListener(BuddyEvent.BUDDY_CHANGED,onBuddyListChange,false,0,true);
if(Utility.canBuddy())
{
_buddyListBtn.addEventListener(MouseEvent.MOUSE_DOWN,buddyListBtnHandler,false,0,true);
}
_buddyListContent.searchBtn.addEventListener(MouseEvent.MOUSE_DOWN,onSearchBtn,false,0,true);
_buddyListContent.searchBtn.addEventListener(MouseEvent.MOUSE_OVER,onSearchBtnOver,false,0,true);
_buddyListContent.searchBtn.addEventListener(MouseEvent.MOUSE_OUT,onSearchBtnOut,false,0,true);
}
private static function removeListeners() : void
{
if(Utility.canBuddy())
{
_buddyListBtn.removeEventListener(MouseEvent.MOUSE_DOWN,buddyListBtnHandler);
}
_glowTimer.removeEventListener(TimerEvent.TIMER,glowTimerHandler);
BuddyManager.eventDispatcher.removeEventListener(BuddyEvent.BUDDY_LIST,onBuddyListChange);
BuddyManager.eventDispatcher.removeEventListener(BuddyEvent.BUDDY_CHANGED,onBuddyListChange);
if(_buddyListContent)
{
_buddyListContent.searchBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onSearchBtn);
_buddyListContent.searchBtn.removeEventListener(MouseEvent.MOUSE_OVER,onSearchBtnOver);
_buddyListContent.searchBtn.removeEventListener(MouseEvent.MOUSE_OUT,onSearchBtnOut);
}
}
}
}
@@ -0,0 +1,553 @@
package gui
{
import avatar.AvatarInfo;
import avatar.UserInfo;
import buddy.Buddy;
import buddy.BuddyEvent;
import buddy.BuddyTimer;
import buddy.BuddyXtCommManager;
import com.sbi.client.SFClient;
import com.sbi.popup.SBOkPopup;
import com.sbi.popup.SBPopupManager;
import flash.display.MovieClip;
import flash.events.EventDispatcher;
import flash.events.TimerEvent;
import flash.utils.Dictionary;
import flash.utils.Timer;
import localization.LocalizationManager;
public class BuddyManager
{
private static var _numOnlineBuddies:int;
private static var _buddyList:Dictionary;
private static var _blockedList:Dictionary;
private static var _buddyRequestList:Dictionary;
private static var _buddyRequestCleanupTimer:Timer;
private static var _buddyRequestPopups:Dictionary;
private static var _confirmBuddyRequestPopups:Dictionary;
private static var _eventDispatcher:EventDispatcher;
private static var _mainHud:MovieClip;
private static var _popupLayer:DisplayLayer;
public static const MAX_BUDDY_COUNT:int = 100;
public static const WARNING_BUDDY_COUNT:int = 95;
private static const PERMISSION_TIMEOUT:int = 20000;
private static const BUDDY_REQUEST_TIMEOUT:int = 30000;
public function BuddyManager()
{
super();
}
public static function init(param1:DisplayLayer, param2:MovieClip) : void
{
_buddyList = new Dictionary(false);
_blockedList = new Dictionary(false);
_buddyRequestList = new Dictionary(false);
_buddyRequestPopups = new Dictionary(false);
_confirmBuddyRequestPopups = new Dictionary(false);
_popupLayer = param1;
_eventDispatcher = new EventDispatcher();
BuddyCard.init(_popupLayer);
BuddyList.init(_popupLayer,param2);
_buddyRequestCleanupTimer = new Timer(BUDDY_REQUEST_TIMEOUT);
_buddyRequestCleanupTimer.addEventListener(TimerEvent.TIMER,buddyRequestCleanupTimerHandler,false,0,true);
_buddyRequestCleanupTimer.start();
}
public static function destroy() : void
{
var _loc1_:Buddy = null;
var _loc2_:Object = null;
var _loc3_:Object = null;
var _loc4_:Object = null;
var _loc5_:Object = null;
for each(_loc1_ in _buddyList)
{
_loc1_ = null;
}
for each(_loc2_ in _blockedList)
{
_loc2_ = null;
}
for each(_loc3_ in _buddyRequestList)
{
_loc3_ = null;
}
for each(_loc4_ in _buddyRequestPopups)
{
_loc4_ = null;
}
for each(_loc5_ in _confirmBuddyRequestPopups)
{
_loc5_ = null;
}
_eventDispatcher = null;
_buddyList = null;
_blockedList = null;
BuddyCard.destroy();
BuddyList.destroy();
}
public static function get eventDispatcher() : EventDispatcher
{
return _eventDispatcher;
}
public static function isBuddy(param1:String) : Boolean
{
return _buddyList[param1.toLowerCase()] != null;
}
public static function isBlocked(param1:String) : Boolean
{
return _blockedList[param1.toLowerCase()] != null;
}
public static function getBuddyByUserName(param1:String) : Buddy
{
return _buddyList[param1.toLowerCase()];
}
public static function get buddyCount() : int
{
var _loc2_:Object = null;
var _loc1_:int = 0;
for(_loc2_ in _buddyList)
{
_loc1_++;
}
return _loc1_;
}
public static function addRemoveBuddy(param1:String, param2:String, param3:Boolean) : void
{
var _loc4_:String = null;
var _loc5_:String = null;
var _loc6_:Object = null;
if(param3)
{
_loc4_ = param1.toLowerCase();
if(buddyCount < MAX_BUDDY_COUNT)
{
_loc6_ = _buddyRequestList[_loc4_];
if(_loc6_ == null || _loc6_.expires < new Date().getTime())
{
BuddyXtCommManager.sendBuddyAddRequest(param1);
_buddyRequestList[_loc4_] = {
"userName":param1,
"expires":new Date().getTime() + 30000,
"isAccepting":true
};
}
else
{
if(_buddyRequestList[_loc4_] != null)
{
if(!_buddyRequestList[_loc4_].isAccepting)
{
_buddyRequestPopups[_loc4_] = new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14706,param2));
return;
}
}
_buddyRequestPopups[_loc4_] = new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14707,param2));
}
}
else
{
new SBOkPopup(_popupLayer,LocalizationManager.translateIdOnly(14708));
}
}
else
{
BuddyXtCommManager.sendBuddyDeleteRequest(param1);
}
}
private static function buddyAddRequestCallback(param1:Object) : void
{
var _loc2_:Timer = _confirmBuddyRequestPopups[param1.passback.toLowerCase()].timer;
if(_loc2_)
{
_loc2_.reset();
_loc2_ = null;
}
var _loc3_:BuddyRequest = _confirmBuddyRequestPopups[param1.passback.toLowerCase()].popup;
if(_loc3_)
{
_loc3_.destroy();
_loc3_ = null;
}
delete _confirmBuddyRequestPopups[param1.passback.toLowerCase()];
if(buddyCount < MAX_BUDDY_COUNT)
{
BuddyXtCommManager.sendBuddyConfirmRequest(param1.passback,param1.status);
}
else
{
new SBOkPopup(_popupLayer,LocalizationManager.translateIdOnly(14708));
}
}
public static function buddyListResponseHandler(param1:Object) : void
{
var _loc7_:Buddy = null;
var _loc8_:String = null;
var _loc9_:String = null;
var _loc10_:int = 0;
var _loc11_:String = null;
var _loc12_:int = 0;
var _loc13_:int = 0;
var _loc14_:UserInfo = null;
var _loc15_:AvatarInfo = null;
var _loc16_:Buddy = null;
var _loc17_:String = null;
var _loc18_:String = null;
var _loc19_:int = 0;
var _loc20_:int = 0;
var _loc21_:int = 0;
var _loc22_:int = 0;
_buddyList = new Dictionary(true);
var _loc2_:* = 3;
var _loc3_:int = int(param1[_loc2_++]);
var _loc4_:int = 0;
while(_loc4_ < _loc3_)
{
_loc7_ = new Buddy();
_loc8_ = param1[_loc2_++];
_loc9_ = param1[_loc2_++];
_loc10_ = int(param1[_loc2_++]);
_loc11_ = param1[_loc2_++];
_loc12_ = int(param1[_loc2_++]);
_loc13_ = int(param1[_loc2_++]);
_loc7_.init(_loc8_,_loc9_,_loc10_,SFClient.STATUS_ONLINE,_loc13_);
_buddyList[_loc8_.toLowerCase()] = _loc7_;
_loc14_ = gMainFrame.userInfo.getUserInfoByUserName(_loc8_);
if(!_loc14_)
{
if(_loc12_ > -1)
{
_loc15_ = new AvatarInfo();
_loc15_.init(_loc12_,_loc11_,_loc8_,_loc9_);
_loc14_ = new UserInfo();
_loc14_.init(_loc8_,_loc9_,null,_loc12_);
_loc14_.addAvatarToList(_loc15_);
_loc14_.accountType = _loc13_;
_loc14_.userNameModeratedFlag = _loc10_;
gMainFrame.userInfo.setUserInfoByUserName(_loc8_,_loc14_);
}
}
else
{
if(_loc12_ > -1 && !_loc14_.getAvatarInfoByPerUserAvId(_loc12_))
{
_loc15_ = new AvatarInfo();
_loc15_.init(_loc12_,_loc11_,_loc8_,_loc9_);
_loc14_.addAvatarToList(_loc15_);
}
_loc14_.uuid = _loc9_;
_loc14_.userNameModeratedFlag = _loc10_;
_loc14_.accountType = _loc13_;
if(_loc12_ > -1)
{
_loc14_.currPerUserAvId = _loc12_;
}
}
_loc4_++;
}
var _loc5_:int = int(param1[_loc2_++]);
_loc4_ = 0;
while(_loc4_ < _loc5_)
{
_loc16_ = new Buddy();
_loc17_ = param1[_loc2_++];
_loc18_ = param1[_loc2_++];
_loc19_ = int(param1[_loc2_++]);
_loc20_ = int(param1[_loc2_++]);
_loc21_ = int(param1[_loc2_++]);
_loc22_ = _loc20_ > -1 ? SFClient.STATUS_OFFLINE_ACTIVE : SFClient.STATUS_OFFLINE_ARCHIVED;
if(_loc22_ == SFClient.STATUS_OFFLINE_ARCHIVED)
{
_loc19_ = 1;
}
_loc16_.init(_loc17_,_loc18_,_loc19_,_loc22_,_loc21_,_loc20_);
_buddyList[_loc17_.toLowerCase()] = _loc16_;
_loc4_++;
}
BuddyList.listRequested = true;
var _loc6_:BuddyEvent = new BuddyEvent(BuddyEvent.BUDDY_LIST);
_eventDispatcher.dispatchEvent(_loc6_);
}
public static function blockedListResponseHandler(param1:Object) : void
{
var _loc2_:* = 3;
var _loc3_:int = int(param1[_loc2_++]);
_blockedList = new Dictionary(true);
var _loc4_:int = 0;
while(_loc4_ < _loc3_)
{
_blockedList[param1[_loc2_++].toLowerCase()] = "1";
_loc4_++;
}
}
public static function buddyAddRequestResponseHandler(param1:int, param2:String, param3:int) : void
{
var _loc5_:AvatarInfo = null;
var _loc6_:BuddyTimer = null;
var _loc4_:String = param3 > 0 ? param2 : LocalizationManager.translateIdOnly(LocalizationManager.NEW_JAMMER_USERNAME);
if(param1 == 0)
{
if(!_buddyList[param2.toLowerCase()])
{
_loc5_ = gMainFrame.userInfo.getAvatarInfoByUserName(param2);
_loc6_ = new BuddyTimer(BUDDY_REQUEST_TIMEOUT);
_loc6_.userName = param2.toLowerCase();
_loc6_.addEventListener(TimerEvent.TIMER,confirmPopupTimerHandler,false,0,true);
_confirmBuddyRequestPopups[param2.toLowerCase()] = {
"popup":new BuddyRequest(param2,buddyAddRequestCallback,BuddyRequest.ACCEPT_REJECT),
"timer":_loc6_
};
_loc6_.start();
}
}
else if(param1 == 1)
{
_buddyRequestPopups[param2.toLowerCase()] = new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14707,_loc4_));
}
else if(param1 == 2)
{
new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14710,_loc4_));
}
else if(param1 == 3)
{
if(_buddyRequestList[param2.toLowerCase()] != null)
{
_buddyRequestList[param2.toLowerCase()].isAccepting = false;
}
new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14706,_loc4_));
}
else if(param1 == 4)
{
new SBOkPopup(_popupLayer,LocalizationManager.translateIdOnly(14708));
}
}
public static function buddyStatusResponseHandler(param1:String, param2:String, param3:int, param4:Boolean, param5:int, param6:int, param7:String = null, param8:String = null, param9:int = -1) : void
{
var _loc14_:AvatarInfo = null;
var _loc15_:String = null;
var _loc10_:String = param1.toLowerCase();
var _loc11_:Buddy = _buddyList[_loc10_];
var _loc12_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(param1);
if(!_loc12_)
{
_loc12_ = new UserInfo();
_loc12_.init(param1,param2);
_loc12_.userNameModeratedFlag = param3;
gMainFrame.userInfo.setUserInfoByUserName(param1,_loc12_);
}
_loc12_.accountType = param5;
if(param8)
{
_loc14_ = _loc12_.getAvatarInfoByPerUserAvId(param9);
if(param9 > 0)
{
if(!_loc14_)
{
_loc14_ = new AvatarInfo();
_loc14_.init(param9,param8,param1,param2);
_loc12_.addAvatarToList(_loc14_);
}
_loc12_.currPerUserAvId = param9;
}
}
if(param6 != 3 && param6 != 4)
{
if(_loc11_)
{
_loc11_.userName = param1;
_loc11_.userNameModeratedFlag = param3;
if(_loc11_.isOnline && !param4)
{
--_numOnlineBuddies;
_loc11_.numDaysSinceLastLogin = 0;
}
else if(!_loc11_.isOnline && param4)
{
if(Utility.canBuddy())
{
BuddyList.startBuddyListBtnGlow();
}
++_numOnlineBuddies;
}
_loc11_.onlineStatus = param4 ? SFClient.STATUS_ONLINE : SFClient.STATUS_OFFLINE_ACTIVE;
}
else
{
_loc11_ = new Buddy();
_loc11_.init(param1,param2,param3,param4 ? SFClient.STATUS_ONLINE : SFClient.STATUS_OFFLINE_ACTIVE,param5);
_buddyList[_loc10_] = _loc11_;
if(param6 == 1)
{
if(_buddyRequestPopups[_loc10_] != null)
{
_buddyRequestPopups[_loc10_].destroy();
delete _buddyRequestPopups[_loc10_];
}
SBPopupManager.nonSBPopups.push(new BuddyRequest(param1,null,BuddyRequest.CONFIRMATION));
}
else if(param6 == 2)
{
SBPopupManager.nonSBPopups.push(new BuddyRequest(param1,null,BuddyRequest.CONFIRMATION));
}
}
}
else
{
if(_loc11_)
{
_loc11_.userName = param7;
_loc11_.userNameModeratedFlag = param3;
if(_loc11_.isOnline && !param4)
{
--_numOnlineBuddies;
}
else if(!_loc11_.isOnline && param4)
{
BuddyList.startBuddyListBtnGlow();
++_numOnlineBuddies;
}
_loc11_.onlineStatus = param4 ? SFClient.STATUS_ONLINE : SFClient.STATUS_OFFLINE_ACTIVE;
delete _buddyList[_loc10_];
_buddyList[param7.toLowerCase()] = _loc11_;
BuddyCard.userNameChange(param1,param7,_loc11_.userNameModerated);
gMainFrame.userInfo.changeUserName(param1,param7,param3);
param1 = param7;
}
if(isBlocked(_loc10_))
{
_loc15_ = param3 > 0 ? param7 : LocalizationManager.translateIdOnly(LocalizationManager.NEW_JAMMER_USERNAME);
BuddyCard.userNameChange(param1,param7,_loc15_);
gMainFrame.userInfo.changeUserName(param1,param7,param3);
param1 = param7;
delete _blockedList[_loc10_];
_blockedList[param7.toLowerCase()] = "1";
}
}
var _loc13_:BuddyEvent = new BuddyEvent(BuddyEvent.BUDDY_CHANGED);
_loc13_.userName = param1;
_eventDispatcher.dispatchEvent(_loc13_);
}
public static function buddyDeleteResponseHandler(param1:String) : void
{
var _loc3_:BuddyEvent = null;
var _loc2_:String = param1.toLowerCase();
if(_buddyList[_loc2_])
{
delete _buddyList[_loc2_];
delete _buddyRequestList[_loc2_];
_loc3_ = new BuddyEvent(BuddyEvent.BUDDY_CHANGED);
_loc3_.userName = param1;
_eventDispatcher.dispatchEvent(_loc3_);
}
}
public static function buddyBlockResponseHandler(param1:String, param2:Boolean) : void
{
var _loc3_:BuddyEvent = null;
if(param2)
{
_blockedList[param1.toLowerCase()] = "1";
_loc3_ = new BuddyEvent(BuddyEvent.BUDDY_CHANGED);
_loc3_.userName = param1;
_eventDispatcher.dispatchEvent(_loc3_);
}
}
public static function buddyUnblockResponseHandler(param1:String, param2:Boolean) : void
{
var _loc3_:BuddyEvent = null;
if(param2)
{
delete _blockedList[param1.toLowerCase()];
_loc3_ = new BuddyEvent(BuddyEvent.BUDDY_CHANGED);
_loc3_.userName = param1;
_eventDispatcher.dispatchEvent(_loc3_);
}
}
public static function get buddyList() : Dictionary
{
return _buddyList;
}
public static function get blockedList() : Dictionary
{
return _blockedList;
}
public static function avatarListResponse() : void
{
var _loc1_:BuddyEvent = new BuddyEvent(BuddyEvent.BUDDY_LIST);
BuddyManager.eventDispatcher.dispatchEvent(_loc1_);
}
private static function buddyRequestCleanupTimerHandler(param1:TimerEvent) : void
{
var _loc2_:Object = null;
var _loc3_:String = null;
for each(_loc2_ in _buddyRequestList)
{
_loc3_ = _loc2_.userName.toLowerCase();
if(_loc2_ == null || _loc2_.expires < new Date().getTime())
{
delete _buddyRequestList[_loc3_];
if(_buddyRequestPopups[_loc3_] != null)
{
delete _buddyRequestPopups[_loc3_];
}
}
}
}
private static function confirmPopupTimerHandler(param1:TimerEvent) : void
{
var _loc3_:String = null;
var _loc4_:Object = null;
var _loc2_:BuddyTimer = BuddyTimer(param1.currentTarget);
if(_loc2_)
{
_loc3_ = _loc2_.userName;
_loc2_.stop();
_loc2_ = null;
_loc4_ = _confirmBuddyRequestPopups[_loc3_];
if(_loc4_ != null)
{
if(_loc4_.popup)
{
_loc4_.popup.destroy();
_loc4_.popup = null;
}
delete _confirmBuddyRequestPopups[_loc3_];
}
}
}
}
}
@@ -0,0 +1,252 @@
package gui
{
import avatar.Avatar;
import avatar.AvatarInfo;
import avatar.AvatarManager;
import avatar.AvatarUtility;
import avatar.AvatarView;
import avatar.AvatarXtCommManager;
import avatar.UserInfo;
import com.sbi.graphics.LayerAnim;
import com.sbi.popup.SBPopupManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.geom.Point;
import loader.MediaHelper;
import localization.LocalizationManager;
public class BuddyRequest
{
public static const ACCEPT_REJECT:int = 1;
public static const CONFIRMATION:int = 2;
private var _mediaHelper:MediaHelper;
private var _requestPopup:MovieClip;
private var _playerUserName:String;
private var _mainAvatarView:AvatarView;
private var _loadingSpiralAvatar:LoadingSpiral;
private var _mainAvatar:Avatar;
private var _requestCallback:Function;
private var _popupType:int;
public function BuddyRequest(param1:String, param2:Function, param3:int)
{
super();
DarkenManager.showLoadingSpiral(true);
this._playerUserName = param1;
this._requestCallback = param2;
this._popupType = param3;
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(2778,this.onMediaLoaded);
}
public function destroy() : void
{
SBPopupManager.destroySpecificNonSBPopup(this);
if(this._mediaHelper)
{
this._mediaHelper.destroy();
this._mediaHelper = null;
}
if(this._mainAvatarView)
{
this._mainAvatarView.destroy();
this._mainAvatarView = null;
}
this._mainAvatar = null;
this.removeEventListeners();
DarkenManager.unDarken(this._requestPopup);
GuiManager.guiLayer.removeChild(this._requestPopup);
this._requestPopup = null;
}
private function onMediaLoaded(param1:MovieClip) : void
{
DarkenManager.showLoadingSpiral(false);
if(param1)
{
this._requestPopup = MovieClip(param1.getChildAt(0));
this._requestPopup.x = MainFrame.VIEW_WIDTH * 0.5;
this._requestPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
GuiManager.guiLayer.addChild(this._requestPopup);
DarkenManager.darken(this._requestPopup);
this.setupRequestPopup();
this.addEventListeners();
}
}
private function setupRequestPopup() : void
{
this._requestPopup.gotoAndStop(this._popupType);
this._loadingSpiralAvatar = new LoadingSpiral(this._requestPopup.charBox);
var _loc1_:AvatarInfo = gMainFrame.userInfo.getAvatarInfoByUserName(this._playerUserName);
if(!_loc1_)
{
AvatarXtCommManager.requestAvatarGet(this._playerUserName,this.onAvatarGetReceived);
}
else
{
this.onAvatarGetReceived(this._playerUserName,true,0,_loc1_);
}
}
private function onAvatarGetReceived(param1:String, param2:Boolean, param3:int, param4:AvatarInfo = null) : void
{
var _loc5_:UserInfo = null;
var _loc6_:int = 0;
if(param2 && param1.toLowerCase() == this._playerUserName.toLowerCase())
{
if(!param4)
{
param4 = gMainFrame.userInfo.getAvatarInfoByUserName(param1);
if(!param4)
{
throw new Error("onAvatarGetReceived and avInfo is null");
}
}
_loc5_ = gMainFrame.userInfo.getUserInfoByUserName(this._playerUserName);
if(param4.isMember)
{
this._requestPopup.nonmember.visible = false;
this._requestPopup.userName_txt.visible = false;
this._requestPopup.member.setNubType("buddy",false);
this._requestPopup.member.setColorAndBadge(_loc5_.nameBarData);
this._requestPopup.member.isBlocked = false;
this._requestPopup.member.setAvName(_loc5_.getModeratedUserName(),false);
this._requestPopup.member.mouseEnabled = false;
this._requestPopup.member.mouseChildren = false;
}
else
{
this._requestPopup.member.visible = false;
this._requestPopup.userName_txt.visible = true;
this._requestPopup.userName_txt.text = _loc5_.getModeratedUserName();
}
if(this._popupType == CONFIRMATION)
{
_loc6_ = BuddyManager.buddyCount;
if(_loc6_ >= BuddyManager.WARNING_BUDDY_COUNT)
{
LocalizationManager.translateIdAndInsert(this._requestPopup.txt,18509,BuddyManager.MAX_BUDDY_COUNT - _loc6_);
}
else
{
LocalizationManager.translateId(this._requestPopup.txt,9491);
}
}
this._mainAvatar = AvatarManager.getAvatarByUserName(this._playerUserName);
if(this._mainAvatar == null)
{
this._mainAvatar = AvatarUtility.generateNew(param4.perUserAvId,null,this._playerUserName,-1,0,this.onAvatarItemData);
}
this.drawMainAvatar(this._mainAvatar);
}
else
{
this.destroy();
}
}
public function onAvatarItemData(param1:Boolean) : void
{
if(param1 && this._mainAvatar != null)
{
this.drawMainAvatar(this._mainAvatar);
}
else
{
this.destroy();
}
}
private function drawMainAvatar(param1:Avatar) : void
{
if(Utility.isOcean(param1.enviroTypeFlag))
{
if(Utility.isLand(param1.enviroTypeFlag))
{
this._requestPopup.charBox.gotoAndStop(3);
}
else
{
this._requestPopup.charBox.gotoAndStop(2);
}
}
else
{
this._requestPopup.charBox.gotoAndStop(1);
}
this._mainAvatarView = new AvatarView();
this._mainAvatarView.init(param1);
if(param1.avTypeId >= 0)
{
this._mainAvatarView.playAnim(LayerAnim.AN_BBCARD,false,LayerAnim.PLAY_ONE_SHOT,this.positionAndAddMainAvatarView);
}
}
private function positionAndAddMainAvatarView(param1:LayerAnim, param2:int) : void
{
var _loc3_:Point = BuddyCard.getAvOffsetByDefId(this._mainAvatarView.avTypeId);
this._mainAvatarView.x = _loc3_.x;
this._mainAvatarView.y = _loc3_.y;
if(this._requestPopup)
{
this._requestPopup.charBox.addChild(this._mainAvatarView);
}
this._loadingSpiralAvatar.visible = false;
}
private function addEventListeners() : void
{
if(this._requestPopup.currentFrame == 1)
{
this._requestPopup.cancelBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onCancelBtn,false,0,true);
}
this._requestPopup.okBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onOkBtn,false,0,true);
}
private function removeEventListeners() : void
{
if(this._requestPopup.currentFrame == 1)
{
this._requestPopup.cancelBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onCancelBtn);
}
this._requestPopup.okBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onOkBtn);
}
private function onOkBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
if(this._requestPopup.currentFrame == 1)
{
this._requestCallback({
"status":true,
"passback":this._playerUserName
});
}
else
{
this.destroy();
}
}
private function onCancelBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
this._requestCallback({
"status":false,
"passback":this._playerUserName
});
}
}
}
@@ -0,0 +1,787 @@
package gui
{
import com.sbi.analytics.SBTracker;
import com.sbi.client.KeepAlive;
import com.sbi.corelib.audio.SBAudio;
import com.sbi.popup.SBOkPopup;
import flash.display.MovieClip;
import flash.display.StageQuality;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.geom.Rectangle;
import flash.text.AntiAliasType;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.utils.Timer;
import game.MinigameManager;
import loader.JCDefHelper;
import loader.MediaHelper;
import localization.LocalizationManager;
import movie.MovieManager;
public class BulletinBoard
{
private static const BBOARD_MEDIA_ID:int = 563;
private static const CAL_MEDIA_ID:int = 564;
private static const GALLERY_MEDIA_ID:int = 565;
private static const COSTUME_MEDIA_ID:int = 1634;
private static const TUT_STREAM_GL_ID:int = 8;
private static const ART_MEDIA_GL_ID:int = 23;
private static const EVT_LOC_ID:int = 670;
private static const DESC_TXT_Y_POS:Number = 201.35;
private var _bulletinBoardPopup:MovieClip;
private var _calendarPopup:MovieClip;
private var _costumePopup:MovieClip;
private var _tutorialMediaId:int;
private var _tutorialStreamId:int;
private var _tutorialText:String;
private var _tutorialSubtitleId:int;
private var _artGalleryPopup:MovieClip;
private var _artMediaIds:Array;
private var _artObjects:Object;
private var _artPageNum:int;
private var _jcLoader:JCDefHelper;
private var _howlTextField:TextField;
private var _howlsTextArray:Array;
private var _howlTimer:Timer;
private var _scrollRect:Rectangle;
private var _howlIndex:int;
private var _guiLayer:DisplayLayer;
private var _loadingMediaHelper:MediaHelper;
private var _mediaHelpers:Array;
private var _tutorialSpiral:LoadingSpiral;
private var _artSpiral:LoadingSpiral;
private var _closeCallback:Function;
private var _gameLaunchObj:Object;
private var _introMediaHelper:MediaHelper;
private var _introCloseId:int;
private var _intro:MovieClip;
private var _introCloseBtn:MovieClip;
private var _musicMutedByPlayer:Boolean;
public function BulletinBoard()
{
super();
}
public function init(param1:DisplayLayer, param2:Function) : void
{
DarkenManager.showLoadingSpiral(true);
this._guiLayer = param1;
this._closeCallback = param2;
this._mediaHelpers = [];
this._artObjects = new Object();
this._tutorialSpiral = new LoadingSpiral();
this._artSpiral = new LoadingSpiral();
this._loadingMediaHelper = new MediaHelper();
this._loadingMediaHelper.init(BBOARD_MEDIA_ID,this.onMediaItemLoaded,true);
this._mediaHelpers.push(this._loadingMediaHelper);
}
public function destroy() : void
{
if(this._bulletinBoardPopup)
{
this.removeBoardListeners();
this._guiLayer.removeChild(this._bulletinBoardPopup);
DarkenManager.unDarken(this._bulletinBoardPopup);
KeepAlive.stopKATimer(this._bulletinBoardPopup);
this._bulletinBoardPopup = null;
}
if(this._artGalleryPopup)
{
this.removeGalleryListeners();
if(Boolean(this._artGalleryPopup.parent) && this._artGalleryPopup.parent == this._guiLayer)
{
this._guiLayer.removeChild(this._artGalleryPopup);
}
DarkenManager.unDarken(this._artGalleryPopup);
this._artGalleryPopup = null;
}
if(this._calendarPopup)
{
if(Boolean(this._calendarPopup.parent) && this._calendarPopup.parent == this._guiLayer)
{
this._guiLayer.removeChild(this._calendarPopup);
}
this._calendarPopup = null;
}
if(this._costumePopup)
{
if(Boolean(this._costumePopup.parent) && this._costumePopup.parent == this._guiLayer)
{
this._guiLayer.removeChild(this._costumePopup);
}
this._costumePopup = null;
}
if(this._loadingMediaHelper)
{
this._loadingMediaHelper.destroy();
this._loadingMediaHelper = null;
}
if(this._tutorialSpiral)
{
this._tutorialSpiral.destroy();
this._tutorialSpiral = null;
}
if(this._artSpiral)
{
this._artSpiral.destroy();
this._artSpiral = null;
}
if(this._intro)
{
this._intro.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown);
this._intro = null;
}
if(this._introCloseBtn)
{
this._introCloseBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onIntroClose);
this._introCloseBtn = null;
}
if(this._howlTimer)
{
this._howlTimer.reset();
this._howlTimer = null;
}
this._artObjects = null;
this._artMediaIds = null;
this._mediaHelpers = null;
}
public function refresh() : void
{
if(this._bulletinBoardPopup)
{
if(Boolean(this._artGalleryPopup) && this._artGalleryPopup.visible)
{
this.removeGalleryListeners();
if(Boolean(this._artGalleryPopup.parent) && this._artGalleryPopup.parent == this._guiLayer)
{
this._guiLayer.removeChild(this._artGalleryPopup);
}
DarkenManager.unDarken(this._artGalleryPopup);
this._artGalleryPopup = null;
}
this._artSpiral.setNewParent(this._bulletinBoardPopup.artItemWindow,this._bulletinBoardPopup.artItemWindow.width * 0.5,this._bulletinBoardPopup.artItemWindow.height * 0.5);
this._artSpiral.visible = true;
this._jcLoader = new JCDefHelper();
this._jcLoader.init(1,this.onArtGLReceived);
new SBOkPopup(this._guiLayer,LocalizationManager.translateIdOnly(14712));
}
}
private function onMediaItemLoaded(param1:MovieClip) : void
{
var _loc2_:int = 0;
var _loc3_:Number = NaN;
if(param1)
{
_loc2_ = 0;
while(_loc2_ < this._mediaHelpers.length)
{
if(this._mediaHelpers[_loc2_] == param1.mediaHelper)
{
switch(param1.mediaHelper.id)
{
case BBOARD_MEDIA_ID:
DarkenManager.showLoadingSpiral(false);
this._bulletinBoardPopup = MovieClip(param1.getChildAt(0));
this._howlTextField = this._bulletinBoardPopup.howlTxt;
this._bulletinBoardPopup.x = MainFrame.VIEW_WIDTH * 0.5;
this._bulletinBoardPopup.y = MainFrame.VIEW_HEIGHT;
this._artSpiral.setNewParent(this._bulletinBoardPopup.artItemWindow,this._bulletinBoardPopup.artItemWindow.width * 0.5,this._bulletinBoardPopup.artItemWindow.height * 0.5);
this._tutorialSpiral.setNewParent(this._bulletinBoardPopup.videoItemWindow);
this._bulletinBoardPopup.playMovBtn.visible = false;
this._guiLayer.addChild(this._bulletinBoardPopup);
DarkenManager.darken(this._bulletinBoardPopup);
KeepAlive.startKATimer(this._bulletinBoardPopup);
this.addBoardListeners();
if(this._tutorialMediaId > 0)
{
this._loadingMediaHelper = new MediaHelper();
this._loadingMediaHelper.init(this._tutorialMediaId,this.onMediaItemLoaded,true);
this._mediaHelpers.push(this._loadingMediaHelper);
}
this._jcLoader = new JCDefHelper();
this._jcLoader.init(LocalizationManager.currentLanguage,this.onArtGLReceived);
GenericListXtCommManager.requestStreamList(TUT_STREAM_GL_ID,this.onTutorialGLReceived);
LocalizationManager.translateId(this._bulletinBoardPopup.eventsTxt,EVT_LOC_ID);
break;
case this._tutorialMediaId:
_loc3_ = this._bulletinBoardPopup.videoItemWindow.width / param1.width;
param1.scaleX = _loc3_;
param1.scaleY = _loc3_;
this._bulletinBoardPopup.videoItemWindow.addChild(param1);
this._bulletinBoardPopup.playMovBtn.visible = true;
this._tutorialSpiral.destroy();
break;
case this._introCloseId:
this._introCloseBtn = MovieClip(param1.getChildAt(0));
this._guiLayer.addChild(this._introCloseBtn);
this._introCloseBtn.x = 855;
this._introCloseBtn.y = 10;
this._introCloseBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onIntroClose,false,0,true);
break;
case GALLERY_MEDIA_ID:
DarkenManager.showLoadingSpiral(false);
this._artGalleryPopup = MovieClip(param1.getChildAt(0));
this.onGalleryLeftRightDown(null);
this.addGalleryListeners();
this._guiLayer.addChild(this._artGalleryPopup);
this._artGalleryPopup.x = MainFrame.VIEW_WIDTH * 0.5;
this._artGalleryPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
DarkenManager.darken(this._artGalleryPopup);
break;
case CAL_MEDIA_ID:
DarkenManager.showLoadingSpiral(false);
this._calendarPopup = MovieClip(param1.getChildAt(0));
this._calendarPopup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown,false,0,true);
this._calendarPopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupClose,false,0,true);
this._guiLayer.addChild(this._calendarPopup);
this._calendarPopup.x = MainFrame.VIEW_WIDTH * 0.5;
this._calendarPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
DarkenManager.darken(this._calendarPopup);
break;
case COSTUME_MEDIA_ID:
DarkenManager.showLoadingSpiral(false);
this._costumePopup = MovieClip(param1.getChildAt(0));
this._costumePopup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown,false,0,true);
this._costumePopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupClose,false,0,true);
this._guiLayer.addChild(this._costumePopup);
this._costumePopup.x = MainFrame.VIEW_WIDTH * 0.5;
this._costumePopup.y = MainFrame.VIEW_HEIGHT * 0.5;
DarkenManager.darken(this._costumePopup);
}
param1.mediaHelper.destroy();
delete param1.mediaHelper;
this._mediaHelpers.splice(_loc2_,1);
break;
}
_loc2_++;
}
}
}
private function displayText(param1:int) : void
{
if(this._artGalleryPopup)
{
this._artGalleryPopup.descTxt.text = this._artObjects[param1].desc;
this._artGalleryPopup.descTxt.y = DESC_TXT_Y_POS;
if(this._artGalleryPopup.descTxt.numLines == 1)
{
this._artGalleryPopup.descTxt.y += 11;
}
this._artGalleryPopup.titleTxt.text = this._artObjects[param1].title;
}
}
private function onArtDataLoaded(param1:Object) : void
{
var _loc2_:int = 0;
var _loc3_:String = null;
var _loc4_:String = null;
var _loc5_:String = null;
if(Boolean(param1) && Boolean(this._bulletinBoardPopup))
{
_loc3_ = param1.data.text;
_loc2_ = _loc3_.indexOf("|");
_loc4_ = _loc3_.substr(0,_loc2_);
_loc5_ = _loc3_.substr(_loc2_ + 1,_loc3_.length);
_loc5_ = LocalizationManager.translateAvatarName(_loc5_);
this._artObjects[param1.data.imageId] = {
"img":null,
"title":LocalizationManager.translateIdOnly(int(_loc4_)),
"desc":_loc5_.toUpperCase()
};
this.displayText(param1.data.imageId);
this._jcLoader.destroy();
this._jcLoader = null;
this._jcLoader = new JCDefHelper();
this._jcLoader.init(this._artMediaIds[this._artPageNum],this.onArtLoaded,true,true);
}
}
private function onArtLoaded(param1:MovieClip) : void
{
var _loc2_:Number = NaN;
var _loc3_:Object = null;
if(Boolean(param1) && Boolean(this._bulletinBoardPopup))
{
if(Boolean(this._artGalleryPopup) && this._artGalleryPopup.visible)
{
_loc3_ = this._artObjects[param1.defHelper.id];
_loc2_ = this._artGalleryPopup.itemWindow.height / this._artGalleryPopup.itemWindow.width;
if(param1.width * _loc2_ > param1.height)
{
_loc2_ = this._artGalleryPopup.itemWindow.width / param1.width;
}
else
{
_loc2_ = this._artGalleryPopup.itemWindow.height / param1.height;
}
param1.width *= _loc2_;
param1.height *= _loc2_;
param1.y = (this._artGalleryPopup.itemWindow.height - param1.height) * 0.5;
param1.x = (this._artGalleryPopup.itemWindow.width - param1.width) * 0.5;
_loc3_.img = param1;
while(this._artGalleryPopup.itemWindow.numChildren > 1)
{
this._artGalleryPopup.itemWindow.removeChildAt(this._artGalleryPopup.itemWindow.numChildren - 1);
}
this._artSpiral.visible = false;
this._artGalleryPopup.itemWindow.addChild(param1);
this._artGalleryPopup.descTxt.text = _loc3_.desc;
this._artGalleryPopup.titleTxt.text = _loc3_.title;
}
else
{
_loc2_ = this._bulletinBoardPopup.artItemWindow.height / this._bulletinBoardPopup.artItemWindow.width;
if(param1.width * _loc2_ > param1.height)
{
_loc2_ = this._bulletinBoardPopup.artItemWindow.width / param1.width;
}
else
{
_loc2_ = this._bulletinBoardPopup.artItemWindow.height / param1.height;
}
param1.width *= _loc2_;
param1.height *= _loc2_;
param1.y = (this._bulletinBoardPopup.artItemWindow.height - param1.height) * 0.5;
param1.x = (this._bulletinBoardPopup.artItemWindow.width - param1.width) * 0.5;
while(this._bulletinBoardPopup.artItemWindow.numChildren > 1)
{
this._bulletinBoardPopup.artItemWindow.removeChildAt(this._bulletinBoardPopup.artItemWindow.numChildren - 1);
}
this._bulletinBoardPopup.artItemWindow.addChild(param1);
this._artSpiral.visible = false;
}
param1.defHelper.destroy();
delete param1.defHelper;
}
}
private function onIntroLoaded(param1:MovieClip) : void
{
gMainFrame.stage.quality = StageQuality.HIGH;
DarkenManager.showLoadingSpiral(false);
if(!SBAudio.isMusicMuted || !SBAudio.areSoundsMuted)
{
SBAudio.muteMusic(false);
SBAudio.muteSounds();
this._musicMutedByPlayer = true;
}
this._intro = param1;
this._intro.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown,false,0,true);
this._guiLayer.addChild(this._intro);
DarkenManager.darken(this._intro);
this._intro.playMovie(this.onIntroClose);
this._loadingMediaHelper = new MediaHelper();
this._loadingMediaHelper.init(this._introCloseId,this.onMediaItemLoaded,true);
this._mediaHelpers.push(this._loadingMediaHelper);
this._introMediaHelper.destroy();
this._introMediaHelper = null;
}
private function onIntroClose(param1:MouseEvent = null) : void
{
if(param1)
{
param1.stopPropagation();
}
if(this._intro.parent == this._guiLayer)
{
this._guiLayer.removeChild(this._intro);
}
if(this._intro)
{
this._intro.stopMovie();
DarkenManager.unDarken(this._intro);
}
if(Boolean(this._introCloseBtn) && this._introCloseBtn.parent == this._guiLayer)
{
this._guiLayer.removeChild(this._introCloseBtn);
}
if(this._musicMutedByPlayer)
{
this._musicMutedByPlayer = false;
SBAudio.unmuteMusic(false);
SBAudio.unmuteSounds();
}
gMainFrame.stage.quality = StageQuality.MEDIUM;
}
private function onTutorialGLReceived(param1:int, param2:Array, param3:Array, param4:Array, param5:Array, param6:Array, param7:Array) : void
{
this._tutorialStreamId = param2[0];
this._introCloseId = 178;
LocalizationManager.translateId(this._bulletinBoardPopup.videoTitleTxt,param4[0]);
this._tutorialText = param4[0];
this._tutorialMediaId = param3[0];
this._tutorialSubtitleId = param7[0];
this._loadingMediaHelper = new MediaHelper();
this._loadingMediaHelper.init(this._tutorialMediaId,this.onMediaItemLoaded,true);
this._mediaHelpers.push(this._loadingMediaHelper);
}
private function onArtGLReceived(param1:Object) : void
{
var _loc2_:Array = null;
var _loc3_:int = 0;
var _loc4_:Array = null;
var _loc5_:* = 0;
if(this._bulletinBoardPopup)
{
this._artMediaIds = param1.data.jammerCentralGallery;
_loc2_ = param1.data.jammerCentralHowls.split(/\"\|/g);
_loc3_ = 0;
this.shuffle(_loc2_);
this._howlsTextArray = [];
_loc5_ = 0;
for(; _loc5_ < _loc2_.length; _loc5_++)
{
if(this._howlsTextArray[_loc3_] == null)
{
this._howlsTextArray[_loc3_] = new String();
}
else if(this._howlsTextArray[_loc3_].length > 1700)
{
_loc5_--;
_loc3_++;
continue;
}
_loc4_ = _loc2_[_loc5_].split(":");
_loc4_[0] = LocalizationManager.translateAvatarName(_loc4_[0]).toUpperCase();
_loc2_[_loc5_] = _loc4_.join(":");
_loc2_[_loc5_] = _loc2_[_loc5_].replace(/\n/g,"");
this._howlsTextArray[_loc3_] += _loc2_[_loc5_] + "\" - ";
}
this._howlIndex = 0;
this.setUpHowls();
this._artPageNum = 0;
this._jcLoader = new JCDefHelper();
this._jcLoader.init(this._artMediaIds[this._artPageNum],this.onArtDataLoaded);
}
}
private function shuffle(param1:Array) : void
{
var _loc3_:String = null;
var _loc4_:int = 0;
var _loc2_:int = 0;
while(_loc2_ < param1.length)
{
_loc3_ = param1[_loc2_];
_loc4_ = Math.floor(Math.random() * param1.length);
param1[_loc2_] = param1[_loc4_];
param1[_loc4_] = _loc3_;
_loc2_++;
}
}
private function onPopupDown(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onPopupClose(param1:MouseEvent) : void
{
param1.stopPropagation();
SBTracker.pop();
switch(param1.currentTarget.parent)
{
case this._calendarPopup:
this._guiLayer.removeChild(this._calendarPopup);
DarkenManager.unDarken(this._calendarPopup);
break;
case this._artGalleryPopup:
this._guiLayer.removeChild(this._artGalleryPopup);
DarkenManager.unDarken(this._artGalleryPopup);
this._artGalleryPopup.visible = false;
this._artSpiral.visible = false;
break;
case this._bulletinBoardPopup:
if(this._closeCallback != null)
{
this._closeCallback();
}
else
{
this.destroy();
}
break;
case this._costumePopup:
this._guiLayer.removeChild(this._costumePopup);
DarkenManager.unDarken(this._costumePopup);
}
}
private function onPlayMovieDown(param1:MouseEvent) : void
{
param1.stopPropagation();
DarkenManager.showLoadingSpiral(true);
GuiManager.initMoviePlayer(MovieManager.VID_PLAYER_MEDIA_ID,[this._tutorialStreamId],[this._tutorialText],[this._tutorialSubtitleId],false,768,432);
GuiManager.setVideoPlayerSkin(MovieManager.BIGGER_FRAME);
}
private function onMinigameInfoResponse() : void
{
DarkenManager.showLoadingSpiral(false);
MinigameManager.handleGameClick(this._gameLaunchObj,null,false);
}
private function onCostumeBtnDown(param1:MouseEvent) : void
{
param1.stopPropagation();
SBTracker.push();
SBTracker.trackPageview("/game/play/popup/jammerCentral/costumeCorner",-1,SBTracker.TYPE_EVENT);
if(this._costumePopup)
{
this._guiLayer.addChild(this._costumePopup);
DarkenManager.darken(this._costumePopup);
}
else
{
DarkenManager.showLoadingSpiral(true);
this._loadingMediaHelper = new MediaHelper();
this._loadingMediaHelper.init(COSTUME_MEDIA_ID,this.onMediaItemLoaded,true);
this._mediaHelpers.push(this._loadingMediaHelper);
}
}
private function onCalendarBtnDown(param1:MouseEvent) : void
{
param1.stopPropagation();
SBTracker.push();
SBTracker.trackPageview("/game/play/popup/jammerCentral/calendar",-1,SBTracker.TYPE_EVENT);
if(this._calendarPopup)
{
this._guiLayer.addChild(this._calendarPopup);
DarkenManager.darken(this._calendarPopup);
}
else
{
DarkenManager.showLoadingSpiral(true);
this._loadingMediaHelper = new MediaHelper();
this._loadingMediaHelper.init(CAL_MEDIA_ID,this.onMediaItemLoaded,true);
this._mediaHelpers.push(this._loadingMediaHelper);
}
}
private function onSubmitHowlDown(param1:MouseEvent) : void
{
param1.stopPropagation();
SBTracker.push();
SBTracker.trackPageview("/game/play/popup/jammerCentral/submit/howl",-1,SBTracker.TYPE_EVENT);
DarkenManager.showLoadingSpiral(true);
FeedbackManager.openFeedbackPopup(FeedbackManager.TYPE_HOWL);
}
private function onSubmitWorkDown(param1:MouseEvent) : void
{
param1.stopPropagation();
SBTracker.push();
SBTracker.trackPageview("/game/play/popup/jammerCentral/submit/art",-1,SBTracker.TYPE_EVENT);
DarkenManager.showLoadingSpiral(true);
FeedbackManager.openFeedbackPopup(FeedbackManager.TYPE_WORK);
}
private function onArtGalleryDown(param1:MouseEvent) : void
{
param1.stopPropagation();
if(Boolean(this._artSpiral) && this._artSpiral.visible)
{
return;
}
SBTracker.push();
SBTracker.trackPageview("/game/play/popup/jammerCentral/artGallery/#page1",-1,SBTracker.TYPE_EVENT);
if(this._artGalleryPopup)
{
this._guiLayer.addChild(this._artGalleryPopup);
DarkenManager.darken(this._artGalleryPopup);
this._artGalleryPopup.visible = true;
}
else
{
DarkenManager.showLoadingSpiral(true);
this._loadingMediaHelper = new MediaHelper();
this._loadingMediaHelper.init(GALLERY_MEDIA_ID,this.onMediaItemLoaded,true);
this._mediaHelpers.push(this._loadingMediaHelper);
}
}
private function onGalleryLeftRightDown(param1:MouseEvent) : void
{
var _loc2_:int = 0;
var _loc3_:Object = null;
if(!this._artSpiral.visible)
{
if(param1)
{
param1.stopPropagation();
if(param1.currentTarget.name == "lBtn")
{
if(this._artPageNum - 1 < 0)
{
this._artPageNum = this._artMediaIds.length - 1;
}
else
{
--this._artPageNum;
}
}
else if(this._artPageNum + 1 >= this._artMediaIds.length)
{
this._artPageNum = 0;
}
else
{
++this._artPageNum;
}
SBTracker.trackPageview("/game/play/popup/jammerCentral/artGallery/#page" + (this._artPageNum + 1),-1,SBTracker.TYPE_EVENT);
}
_loc2_ = int(this._artMediaIds[this._artPageNum]);
_loc3_ = this._artObjects[_loc2_];
if(Boolean(_loc3_) && _loc3_.img != null)
{
while(this._artGalleryPopup.itemWindow.numChildren > 1)
{
this._artGalleryPopup.itemWindow.removeChildAt(1);
}
this._artGalleryPopup.itemWindow.addChild(_loc3_.img);
this.displayText(_loc2_);
}
else
{
this._artSpiral.setNewParent(this._artGalleryPopup.itemWindow,this._artGalleryPopup.itemWindow.width * 0.5,this._artGalleryPopup.itemWindow.height * 0.5);
this._artSpiral.visible = true;
this._jcLoader = new JCDefHelper();
this._jcLoader.init(this._artMediaIds[this._artPageNum],this.onArtDataLoaded);
}
}
}
private function setUpHowls() : void
{
this._howlTextField.cacheAsBitmap = true;
this._howlTextField.autoSize = TextFieldAutoSize.LEFT;
this._howlTextField.antiAliasType = AntiAliasType.ADVANCED;
this._howlTextField.text = this._howlsTextArray[this._howlIndex];
this._howlTextField.scrollRect = new Rectangle(0,0,564,18);
this._scrollRect = this._howlTextField.scrollRect;
this._scrollRect.x = -564;
this._howlTextField.scrollRect = this._scrollRect;
if(this._howlTimer)
{
this._howlTimer.reset();
this._howlTimer.start();
}
else
{
this._howlTimer = new Timer(1000 / 24);
this._howlTimer.addEventListener(TimerEvent.TIMER,this.onTimerEvent,false,0,true);
this._howlTimer.start();
}
}
private function onTimerEvent(param1:TimerEvent) : void
{
if(this._scrollRect.x >= this._howlTextField.textWidth)
{
this._scrollRect.x = -564;
if(this._howlIndex < this._howlsTextArray.length - 1)
{
++this._howlIndex;
}
else
{
this._howlIndex = 0;
}
this._howlTextField.text = this._howlsTextArray[this._howlIndex];
}
else
{
this._scrollRect.x += 1;
}
this._howlTextField.scrollRect = this._scrollRect;
param1.updateAfterEvent();
}
private function addGalleryListeners() : void
{
this._artGalleryPopup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown,false,0,true);
this._artGalleryPopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupClose,false,0,true);
this._artGalleryPopup.lBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onGalleryLeftRightDown,false,0,true);
this._artGalleryPopup.rBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onGalleryLeftRightDown,false,0,true);
}
private function removeGalleryListeners() : void
{
this._artGalleryPopup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown);
this._artGalleryPopup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopupClose);
this._artGalleryPopup.lBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onGalleryLeftRightDown);
this._artGalleryPopup.rBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onGalleryLeftRightDown);
}
private function addBoardListeners() : void
{
this._bulletinBoardPopup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown,false,0,true);
this._bulletinBoardPopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupClose,false,0,true);
this._bulletinBoardPopup.playMovBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlayMovieDown,false,0,true);
this._bulletinBoardPopup.seeCalBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onCalendarBtnDown,false,0,true);
this._bulletinBoardPopup.submitHowlBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onSubmitHowlDown,false,0,true);
this._bulletinBoardPopup.submitWorkBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onSubmitWorkDown,false,0,true);
this._bulletinBoardPopup.artBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onArtGalleryDown,false,0,true);
}
private function removeBoardListeners() : void
{
this._bulletinBoardPopup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown);
this._bulletinBoardPopup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopupClose);
this._bulletinBoardPopup.playMovBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPlayMovieDown);
this._bulletinBoardPopup.seeCalBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onCalendarBtnDown);
this._bulletinBoardPopup.submitHowlBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onSubmitHowlDown);
this._bulletinBoardPopup.submitWorkBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onSubmitWorkDown);
this._bulletinBoardPopup.artBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onArtGalleryDown);
}
}
}
@@ -0,0 +1,457 @@
package gui
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.text.TextFieldAutoSize;
import loader.MediaHelper;
import localization.LocalizationManager;
public dynamic class ChatBalloon extends MovieClip
{
private const CHAT_TIMEOUT_MS:int = 8000;
private const BALLOON_BEGIN_FADEOUT:Number = 1000;
private const BALLOON_MAX_ALPHA:Number = 0.75;
private const TEXT_COLOR_NORMAL:uint = 4477529;
private const TEXT_COLOR_BAD_TEXT:uint = 13369344;
private var _maxAlpha:Number;
private var _timeout:int = 0;
private var _avType:int = 0;
private var _originalFrameId:int = 0;
private var _originalCustomMsgText:String;
private var _emoteBG:MovieClip = null;
private var _emote:Sprite = null;
private var _permEmoteMediaId:int = -1;
private var _permEmoteMediaHelper:MediaHelper;
private var _hasSbTextfield:Boolean;
public var msgTxt:Object;
public var balloonBG:MovieClip;
private var btnBallonBG:MovieClip;
private var btnBalloonMouseBG:MovieClip;
private var btnBalloonUpBG:MovieClip;
private var btnBalloonDownBg:MovieClip;
private var btnBalloonGrayBG:MovieClip;
private var _onCustomAdventureBtn:Function;
private var _onCustomPVPBtn:Function;
private var _emoteBGOffsetFunc:Function;
public function ChatBalloon()
{
super();
}
public function init(param1:int, param2:Function, param3:Boolean = false, param4:int = 1, param5:Class = null, param6:Function = null, param7:Function = null) : void
{
this._originalFrameId = param4;
this.gotoAndStop(param4);
this.balloonBG = this["balloon_bg"];
this.msgTxt = this["message_txt"];
this._onCustomAdventureBtn = param6;
this._onCustomPVPBtn = param7;
this._emoteBGOffsetFunc = param2;
this._avType = param1;
visible = false;
this.msgTxt.autoSize = TextFieldAutoSize.CENTER;
if(param3)
{
this._maxAlpha = 1;
}
else
{
this._maxAlpha = this.BALLOON_MAX_ALPHA;
}
this._emoteBG = GETDEFINITIONBYNAME("emo_bubble");
this.setEmoteBgOffsets();
}
public function setText(param1:String, param2:Boolean = false, param3:Boolean = true) : void
{
var _loc4_:int = 0;
if(this._emote)
{
this._permEmoteMediaId = -1;
this._emoteBG.itemWindow.removeChild(this._emote);
this._emote = null;
}
if(contains(this._emoteBG))
{
removeChild(this._emoteBG);
}
if(param1 != this.msgTxt.text && this._hasSbTextfield)
{
this.balloonBG.visible = false;
this.setAlpha(this._maxAlpha);
this.visible = false;
}
else
{
this.balloonBG.visible = true;
this.setAlpha(this._maxAlpha);
this.visible = true;
}
this.msgTxt.text = param1;
if(!this._hasSbTextfield)
{
if(param3)
{
if(Math.abs(this.msgTxt.height - Math.floor(this.msgTxt.height) - 0.5) < 0.3)
{
_loc4_ = 1;
}
this.balloonBG.m.height = Math.floor(this.msgTxt.height - _loc4_);
this.balloonBG.m.y = this.balloonBG.b.y - this.balloonBG.m.height;
this.balloonBG.t.y = this.balloonBG.m.y - this.balloonBG.t.height;
this.msgTxt.y = -this.balloonBG.b.height - this.msgTxt.height - (this.msgTxt.height - this.balloonBG.m.height);
}
else
{
this.balloonBG.m.height = Math.floor(this.msgTxt.height);
this.balloonBG.b.y = Math.round(this.balloonBG.m.y + this.balloonBG.m.height);
this.msgTxt.y = this.balloonBG.t.height + (this.balloonBG.m.height * 0.5 - this.msgTxt.height * 0.5) + 3;
}
if(this.currentFrameLabel == "advBtn")
{
this.btnBallonBG.y = this.balloonBG.y + this.balloonBG.t.y - this.btnBallonBG.height + this.balloonBG.t.height;
}
}
if(param2)
{
this.msgTxt.textColor = this.TEXT_COLOR_BAD_TEXT;
}
else
{
this.msgTxt.textColor = this.TEXT_COLOR_NORMAL;
}
this._timeout = this.CHAT_TIMEOUT_MS;
if(param3 && Boolean(this.parent))
{
this.parent.addChild(this);
}
}
public function setCustomAdventureMessage(param1:String, param2:String, param3:int, param4:Boolean = false, param5:Boolean = false) : void
{
var _loc6_:int = 0;
var _loc7_:int = 0;
var _loc8_:Array = param2.split("|");
if(param5)
{
param2 = _loc8_[0];
_loc6_ = int(_loc8_[1]);
}
else
{
param2 = _loc8_[0];
_loc7_ = int(_loc8_[1]);
}
if(param2 == "on")
{
if(Boolean(this._emote) && Boolean(this._emoteBG))
{
this._emoteBG.itemWindow.removeChild(this._emote);
this._emote = null;
if(contains(this._emoteBG))
{
removeChild(this._emoteBG);
}
}
if(this.currentFrameLabel != "advBtn")
{
this.gotoAndStop("advBtn");
}
this.balloonBG = this["balloon_bg"];
this.btnBallonBG = this["btnBalloon_bg"];
this.btnBalloonMouseBG = this.btnBallonBG.mouse.mouse;
this.btnBalloonUpBG = this.btnBallonBG.mouse.up;
this.btnBalloonDownBg = this.btnBallonBG.down;
this.btnBalloonGrayBG = this.btnBallonBG.gray;
this.btnBallonBG.isForPVP = param5;
this.btnBallonBG.PVPGameId = _loc6_;
this.btnBallonBG.scriptDefId = _loc7_;
this.btnBallonBG.addEventListener(MouseEvent.MOUSE_DOWN,this.onBtnBG,false,0,true);
this.msgTxt = this["message_txt"];
this.msgTxt.autoSize = TextFieldAutoSize.CENTER;
LocalizationManager.translateId(this.btnBalloonMouseBG.message_txt,11259);
LocalizationManager.translateId(this.btnBalloonUpBG.message_txt,11259);
LocalizationManager.translateId(this.btnBalloonDownBg.message_txt,11259);
LocalizationManager.translateId(this.btnBalloonGrayBG.message_txt,11259);
if(param3 > 0)
{
this.btnBalloonMouseBG.message_txt.x = 3;
this.btnBalloonUpBG.message_txt.x = 3;
this.btnBalloonDownBg.message_txt.x = 3;
this.btnBalloonGrayBG.message_txt.x = 3;
this.btnBallonBG["redDot"].visible = true;
}
else
{
this.btnBalloonMouseBG.message_txt.x = 17;
this.btnBalloonUpBG.message_txt.x = 17;
this.btnBalloonDownBg.message_txt.x = 17;
this.btnBalloonGrayBG.message_txt.x = 17;
this.btnBallonBG["redDot"].visible = false;
}
this.msgTxt.text = param1;
this._originalCustomMsgText = param1;
this.balloonBG.m.height = Math.floor(this.msgTxt.height);
this.balloonBG.m.y = this.balloonBG.b.y - this.balloonBG.m.height;
this.balloonBG.t.y = this.balloonBG.m.y - this.balloonBG.t.height;
this.msgTxt.y = -this.balloonBG.b.height - this.msgTxt.height - (this.msgTxt.height - this.balloonBG.m.height);
this.btnBallonBG.y = this.balloonBG.y + this.balloonBG.t.y - this.btnBallonBG.height + this.balloonBG.t.height;
if(this.itemWindow)
{
this.itemWindow.y = this.btnBallonBG.y;
}
this.balloonBG.t.alpha = 0;
this.setAlpha(this._maxAlpha);
this.visible = true;
this._timeout = this.CHAT_TIMEOUT_MS;
if(this.parent)
{
this.parent.addChild(this);
}
}
else
{
if(this.btnBallonBG)
{
if(this.btnBallonBG.isForPVP != param5)
{
return;
}
this.btnBallonBG.removeEventListener(MouseEvent.MOUSE_DOWN,this.onBtnBG);
}
if(this.currentFrameLabel == "advBtn")
{
this.gotoAndStop(this._originalFrameId);
}
this.balloonBG = this["balloon_bg"];
this.msgTxt = this["message_txt"];
this.msgTxt.autoSize = TextFieldAutoSize.CENTER;
this.visible = false;
}
}
public function get isPvpCustom() : Boolean
{
if(this.btnBallonBG)
{
return this.btnBallonBG.isForPVP;
}
return false;
}
public function get pvpGameId() : int
{
if(this.btnBallonBG)
{
return this.btnBallonBG.PVPGameId;
}
return 0;
}
public function setCustomPVPImage(param1:MovieClip) : void
{
if(this.currentFrameLabel == "advBtn")
{
while(this.itemWindow.numChildren > 0)
{
this.itemWindow.removeChildAt(0);
}
this.itemWindow.addChild(param1);
}
}
private function onBtnBG(param1:MouseEvent) : void
{
param1.stopPropagation();
if(param1.currentTarget.isForPVP)
{
this._onCustomPVPBtn(param1.currentTarget.PVPGameId);
}
else
{
this._onCustomAdventureBtn(param1.currentTarget.scriptDefId);
}
}
private function updateCustAdventureBGSize(param1:MovieClip, param2:Object) : void
{
this.balloonBG.m.height = Math.floor(this.msgTxt.height);
this.balloonBG.m.y = this.balloonBG.b.y - this.balloonBG.m.height;
this.balloonBG.t.y = this.balloonBG.m.y - this.balloonBG.t.height;
this.msgTxt.y = -this.balloonBG.b.height - this.msgTxt.height - (this.msgTxt.height - this.balloonBG.m.height);
this.btnBallonBG.y = this.balloonBG.y + this.balloonBG.t.y - this.btnBallonBG.height + this.balloonBG.t.height;
if(this.itemWindow)
{
this.itemWindow.y = this.btnBallonBG.y;
}
}
private function updateSizeFunction() : void
{
this.balloonBG.m.height = Math.floor(this.msgTxt.height);
this.balloonBG.m.y = Math.floor(this.balloonBG.b.y - this.balloonBG.m.height);
this.balloonBG.t.y = Math.floor(this.balloonBG.m.y - this.balloonBG.t.height);
var _loc1_:Number = Number(this.msgTxt.y);
this.msgTxt.y = -this.balloonBG.b.height - this.msgTxt.height - (this.msgTxt.height - this.balloonBG.m.height);
this.msgTxt.adjustSmileys(_loc1_ - this.msgTxt.y);
this.balloonBG.visible = true;
this.visible = true;
}
public function setEmote(param1:Sprite, param2:int = -1) : void
{
if(this.currentFrameLabel != "advBtn")
{
this._permEmoteMediaId = param2;
if(this._emote)
{
this._emoteBG.itemWindow.removeChild(this._emote);
this._emote = null;
}
if(this._permEmoteMediaId >= 0)
{
param1 = new Sprite();
this._permEmoteMediaHelper = new MediaHelper();
this._permEmoteMediaHelper.init(this._permEmoteMediaId,this.permEmoteMediaCallback);
}
if(param1)
{
this.msgTxt.text = "";
addChild(this._emoteBG);
this._emote = param1;
this._emote.y = -5;
this._emoteBG.itemWindow.addChild(this._emote);
if(this._emote is MovieClip)
{
MovieClip(this._emote).gotoAndPlay(1);
}
if(this.currentFrameLabel != "advBtn")
{
this._timeout = this.CHAT_TIMEOUT_MS;
}
this.balloonBG.visible = false;
this.setAlpha(1);
this._emoteBG.bubble.alpha = this._maxAlpha;
this._emoteBG.itemWindow.alpha = 1;
this.visible = true;
}
}
}
public function setReadyForClear() : void
{
if(this.visible && this._timeout > this.BALLOON_BEGIN_FADEOUT)
{
this._timeout = this.BALLOON_BEGIN_FADEOUT;
}
this._permEmoteMediaId = -1;
}
public function setPos(param1:int, param2:int) : void
{
this.x = param1;
this.y = param2;
}
public function heartbeat(param1:int) : void
{
if(Boolean(this._timeout) && this._permEmoteMediaId < 0)
{
if(param1 >= this._timeout)
{
this._timeout = 0;
if(this._emote)
{
this._emoteBG.itemWindow.removeChild(this._emote);
this._emote = null;
}
if(this.currentFrameLabel != "advBtn")
{
this.visible = false;
}
else
{
this.msgTxt.text = this._originalCustomMsgText;
this.updateCustAdventureBGSize(this.balloonBG,this.msgTxt);
}
}
else
{
this._timeout -= param1;
if(this.currentFrameLabel != "advBtn" && this._timeout < this.BALLOON_BEGIN_FADEOUT)
{
this.setAlpha(this._timeout / this.BALLOON_BEGIN_FADEOUT * this._maxAlpha);
}
}
}
}
public function set avType(param1:int) : void
{
if(param1 != this._avType)
{
this._avType = param1;
this.setEmoteBgOffsets();
}
}
public function updateEmoteBgOffsets() : void
{
this.setEmoteBgOffsets();
}
private function setAlpha(param1:Number) : void
{
this.alpha = param1;
this.msgTxt.alpha = 1;
}
private function permEmoteMediaCallback(param1:MovieClip) : void
{
if(Boolean(param1) && Boolean(this._emote) && this._permEmoteMediaId >= 0)
{
param1.scaleX = 0.5;
param1.scaleY = 0.5;
param1.x = -(param1.width * 0.5);
param1.y = -(param1.height * 0.5);
this._emote.addChild(param1);
}
}
private function setEmoteBgOffsets() : void
{
var _loc1_:Point = this._emoteBGOffsetFunc(this._avType);
this._emoteBG.x = _loc1_.x;
this._emoteBG.y = _loc1_.y;
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,179 @@
package gui
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
public class ColorTable extends MovieClip
{
private var _bm:Bitmap;
private var _bmd:BitmapData;
private var _id:int;
private var _currColor:int;
private var _currColorSwatch:Sprite;
private var _secretColorIdx:int;
private var _colorValues:Array;
private var _colorIndexes:Array;
private var _width:int;
private var _height:int;
private var _numRows:int;
private var _numCols:int;
private var _cellWidth:int;
private var _cellHeight:int;
private var _colorChangeCallback:Function;
public function ColorTable()
{
super();
}
public function init(param1:int, param2:int, param3:int, param4:int, param5:int, param6:Array, param7:Array, param8:int, param9:Function, param10:int = -1) : void
{
this._id = param1;
this._width = param2;
this._height = param3;
this._colorValues = param6;
this._colorIndexes = param7;
this._numCols = param4;
this._numRows = param5;
this._cellWidth = this._width / this._numCols;
this._cellHeight = this._height / this._numRows;
this._colorChangeCallback = param9;
this._secretColorIdx = param10;
this._bmd = new BitmapData(this._width,this._height,false,0);
this.fillColorTable();
this._currColor = param8;
this.setCurrentColorSwatch(this._currColor);
addEventListener(MouseEvent.MOUSE_DOWN,this.colorTableClickHandler,false,0,true);
}
public function destroy() : void
{
if(this._bm)
{
this.removeChild(this._bm);
this._bm = null;
}
if(this._bmd)
{
this._bmd = null;
}
this._colorIndexes = null;
this._colorValues = null;
removeEventListener(MouseEvent.MOUSE_DOWN,this.colorTableClickHandler);
}
private function fillColorTable() : void
{
var _loc1_:int = 0;
var _loc2_:int = 0;
var _loc4_:Rectangle = null;
var _loc3_:int = 0;
while(_loc3_ < this._colorIndexes.length)
{
_loc1_ = _loc3_ % this._numCols * (this._width / this._numCols);
_loc2_ = Math.floor(_loc3_ / this._numCols) * (this._height / this._numRows);
_loc4_ = new Rectangle(_loc1_,_loc2_,this._width / this._numCols,this._height / this._numRows);
this._bmd.fillRect(_loc4_,this._colorValues[this._colorIndexes[_loc3_]]);
_loc3_++;
}
this._bm = new Bitmap(this._bmd);
this.addChild(this._bm);
}
private function setCurrentColorSwatch(param1:int) : void
{
var x:int = 0;
var y:int = 0;
var color:int = param1;
var idxInPalette:int = -1;
var i:int = 0;
while(i < this._colorIndexes.length)
{
if(this._colorIndexes[i] == color)
{
idxInPalette = i;
break;
}
i++;
}
if(this._currColorSwatch)
{
this.removeChild(this._currColorSwatch);
this._currColorSwatch = null;
}
if(idxInPalette >= 0)
{
x = idxInPalette % this._numCols * this._cellWidth;
y = Math.floor(idxInPalette / this._numCols) * this._cellHeight;
this._currColorSwatch = new Sprite();
with(this._currColorSwatch.graphics)
{
beginFill(0);
drawRect(x,y,_cellWidth,5);
drawRect(x,y + _cellHeight - 5,_cellWidth,5);
drawRect(x,y,5,_cellHeight);
drawRect(x + _cellWidth - 5,y,5,_cellHeight);
}
this.addChild(this._currColorSwatch);
}
}
private function colorTableClickHandler(param1:MouseEvent) : void
{
var _loc4_:int = 0;
var _loc2_:Point = new Point(param1.localX,param1.localY);
var _loc3_:int = -1;
if(_loc2_.x == this._width)
{
if(this._secretColorIdx == -1)
{
_loc2_.x = this._width - 1;
}
else if(_loc2_.y < this._cellHeight * (this._numRows - 1))
{
_loc2_.x = this._width - 1;
}
else
{
_loc3_ = this._secretColorIdx;
}
}
if(_loc3_ < 0)
{
_loc4_ = Math.floor(_loc2_.x / this._cellWidth) + Math.floor(_loc2_.y / this._cellHeight) * this._numCols;
_loc3_ = int(this._colorIndexes[_loc4_]);
}
if(this._currColor != _loc3_)
{
this._currColor = _loc3_;
this.setCurrentColorSwatch(_loc3_);
if(this._colorChangeCallback != null)
{
this._colorChangeCallback(this._id,_loc3_);
}
}
}
}
}
@@ -0,0 +1,94 @@
package gui
{
import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.ui.Mouse;
import flash.ui.MouseCursor;
import flash.ui.MouseCursorData;
public class CursorManager extends Sprite
{
private static var _customCursor:Sprite;
private static var _mcd:MouseCursorData;
private static var _previousCursor:String;
public static const CUSTOM_CURSOR:String = "custom_cursor";
public static const DEFAULT_I_CURSOR:String = "ibeam";
public static const DEFAULT_CURSOR:String = "Default_Cursor";
public function CursorManager()
{
super();
}
public static function init() : void
{
_customCursor = GETDEFINITIONBYNAME("Cursor");
_mcd = new MouseCursorData();
}
public static function changeDefaultMouse() : void
{
var _loc1_:Vector.<BitmapData> = new Vector.<BitmapData>();
_loc1_[0] = convertToBitmapData(_customCursor);
_mcd.data = _loc1_;
_mcd.hotSpot = new Point(5,0.5);
Mouse.registerCursor("custom_cursor",_mcd);
Mouse.cursor = "custom_cursor";
}
public static function switchToCursor(param1:String) : void
{
var _loc2_:Vector.<BitmapData> = new Vector.<BitmapData>();
switch(param1)
{
case CUSTOM_CURSOR:
_loc2_[0] = convertToBitmapData(_customCursor);
_mcd.hotSpot = new Point(5,0.5);
_mcd.data = _loc2_;
Mouse.registerCursor("custom_cursor",_mcd);
Mouse.cursor = "custom_cursor";
break;
case DEFAULT_I_CURSOR:
Mouse.cursor = MouseCursor.IBEAM;
break;
case DEFAULT_CURSOR:
Mouse.unregisterCursor("custom_cursor");
_previousCursor = "";
}
}
public static function showICursor(param1:Boolean) : void
{
if(Mouse.cursor != "auto")
{
if(param1)
{
_previousCursor = Mouse.cursor;
switchToCursor(DEFAULT_I_CURSOR);
}
else
{
switchToCursor(_previousCursor);
}
}
}
private static function convertToBitmapData(param1:DisplayObject) : BitmapData
{
var _loc2_:Rectangle = new Rectangle(0,0,19,24);
var _loc3_:BitmapData = new BitmapData(19,24,true,0);
_loc3_.draw(param1);
return _loc3_;
}
}
}
@@ -0,0 +1,388 @@
package gui
{
import achievement.AchievementXtCommManager;
import com.sbi.analytics.SBTracker;
import com.sbi.popup.SBOkPopup;
import den.DenItem;
import den.DenXtCommManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import item.Item;
import item.ItemXtCommManager;
import loader.MediaHelper;
import localization.LocalizationManager;
public class DailyGiftManager
{
private const GIFTS_RECEIVED_UV:int = 373;
private var _giftingPopupMediaHelper:MediaHelper;
private var _giftingPopupContent:MovieClip;
private var _giftPopup:GiftPopup;
private var _giftIndex:int;
private var _guiLayer:DisplayLayer;
private var _randColorIndex:int;
private var _gemAmount:int;
private var _diamondAmount:int;
private var _closeCallback:Function;
private var _giftDataToStillBeDisplayed:Object;
private var _additionalDiamond:Array;
public function DailyGiftManager()
{
super();
}
public function init(param1:int, param2:Function) : void
{
this._guiLayer = GuiManager.guiLayer;
this._closeCallback = param2;
this._giftIndex = param1;
this._giftingPopupMediaHelper = new MediaHelper();
this._giftingPopupMediaHelper.init(2539,this.giftingPopupCallback);
}
public function destroy() : void
{
this.removeEventListeners();
if(this._giftPopup)
{
this._giftPopup.destroy();
this._giftPopup = null;
}
this._giftDataToStillBeDisplayed = null;
if(this._giftingPopupContent)
{
DarkenManager.unDarken(this._giftingPopupContent.parent);
this._guiLayer.removeChild(this._giftingPopupContent.parent);
this._giftingPopupContent.visible = false;
this._giftingPopupContent = null;
this._giftingPopupMediaHelper = null;
}
}
private function giftingPopupCallback(param1:MovieClip) : void
{
if(param1)
{
DarkenManager.showLoadingSpiral(false);
this._giftingPopupContent = MovieClip(param1.getChildAt(0));
param1.x = MainFrame.VIEW_WIDTH * 0.5;
param1.y = MainFrame.VIEW_HEIGHT * 0.5;
this._additionalDiamond = new Array(false,false,false,true,false,true,true,false,true,true,false,true,true,false,false,true,false,true,true,false,true,false,true,true,true,false,true,false,true,false,true);
this.setupPopup();
this.addEventListeners();
this._guiLayer.addChild(param1);
DarkenManager.darken(param1);
}
}
private function setupPopup() : void
{
var _loc1_:MovieClip = null;
var _loc2_:Number = Number(gMainFrame.userInfo.userVarCache.getUserVarValueById(this.GIFTS_RECEIVED_UV));
var _loc3_:int = 1;
while(_loc3_ <= 31)
{
_loc1_ = this._giftingPopupContent["gift" + _loc3_];
if(_loc3_ < this._giftIndex + 1)
{
if(_loc2_ != -1 && (_loc2_ & 1 << _loc3_ - 1) > 0)
{
_loc1_.gotoAndStop("opened");
}
else
{
_loc1_.gotoAndStop("missed");
_loc1_.missedGift.diamond.visible = this._additionalDiamond[_loc3_ - 1];
}
}
else
{
if(_loc3_ > this._giftIndex + 1)
{
_loc1_.gotoAndStop("unopened");
_loc1_.unopenedGift.highlight.visible = false;
_loc1_.unopenedGift.openTag.visible = false;
_loc1_.unopenedGift.currIndex = _loc3_;
_loc1_.unopenedGift.shine.visible = false;
_loc1_.unopenedGift.gift.addEventListener(MouseEvent.MOUSE_DOWN,this.onFutureGiftDown,false,0,true);
_loc1_.unopenedGift.diamond.addEventListener(MouseEvent.MOUSE_DOWN,this.onFutureDiamondDown,false,0,true);
}
else if(_loc3_ == this._giftIndex + 1)
{
_loc1_.gotoAndStop("unopened");
_loc1_.unopenedGift.openTag.visible = true;
_loc1_.unopenedGift.highlight.visible = false;
_loc1_.unopenedGift.highlight.mouseChildren = false;
_loc1_.unopenedGift.highlight.mouseEnabled = false;
_loc1_.unopenedGift.shine.mouseChildren = false;
_loc1_.unopenedGift.shine.mouseEnabled = false;
_loc1_.unopenedGift.gift.addEventListener(MouseEvent.MOUSE_DOWN,this.onGiftDown,false,0,true);
_loc1_.unopenedGift.gift.addEventListener(MouseEvent.ROLL_OVER,this.onGiftOver,false,0,true);
_loc1_.unopenedGift.gift.addEventListener(MouseEvent.ROLL_OUT,this.onGiftOut,false,0,true);
_loc1_.unopenedGift.diamond.addEventListener(MouseEvent.MOUSE_DOWN,this.onGiftDown,false,0,true);
}
if(!gMainFrame.userInfo.isMember)
{
_loc1_.unopenedGift.diamond.gotoAndStop("nonMember");
}
_loc1_.unopenedGift.diamond.visible = this._additionalDiamond[_loc3_ - 1];
}
_loc3_++;
}
}
public function setupGiftPopup() : void
{
var _loc8_:Object = null;
var _loc9_:Object = null;
var _loc10_:int = 0;
var _loc1_:int = 0;
var _loc2_:int = 1;
var _loc3_:int = 2;
var _loc4_:int = 3;
var _loc5_:Array = new Array(_loc2_,_loc2_,_loc2_,_loc2_,_loc1_,_loc1_,_loc1_,_loc2_,_loc2_,_loc2_,_loc2_,_loc1_,_loc1_,_loc1_,_loc2_,_loc2_,_loc2_,_loc2_,_loc1_,_loc1_,_loc1_,_loc2_,_loc2_,_loc1_,_loc1_,_loc2_,_loc2_,_loc2_,_loc2_,_loc2_,_loc2_);
var _loc6_:Array = new Array(1825,1837,717,715,849,526,691,1164,1165,1806,1838,850,692,851,1352,1354,1842,1836,852,525,690,1808,1161,853,854,1832,1833,1835,1351,1353,1826);
var _loc7_:int = 0;
var _loc11_:int = int(gMainFrame.clientInfo.dailyGiftIndex);
if(_loc11_ <= _loc5_.length)
{
if(_loc5_[this._giftIndex] == _loc1_)
{
_loc9_ = ItemXtCommManager.getItemDef(_loc6_[_loc11_]);
this._randColorIndex = (_loc9_.colors.length - 1) * Math.random();
_loc8_ = new Item();
_loc8_.init(_loc9_.defId,0,_loc9_.colors[this._randColorIndex],0,0,true);
_loc10_ = GiftPopup.GIFT_TYPE_CLOTHING;
}
else if(_loc5_[this._giftIndex] == _loc2_)
{
_loc9_ = DenXtCommManager.getDenItemDef(_loc6_[_loc11_]);
_loc8_ = new DenItem();
_loc8_.initShopItem(_loc9_.id,0);
_loc10_ = GiftPopup.GIFT_TYPE_DEN_ACC;
}
else if(_loc5_[this._giftIndex] == _loc3_)
{
_loc10_ = GiftPopup.GIFT_TYPE_GEMS;
}
else if(_loc5_[this._giftIndex] == _loc4_)
{
_loc10_ = GiftPopup.GIFT_TYPE_DIAMOND;
}
if(Boolean(this._additionalDiamond[this._giftIndex]) && Boolean(gMainFrame.userInfo.isMember))
{
this._diamondAmount = 1;
this._giftingPopupMediaHelper = new MediaHelper();
this._giftingPopupMediaHelper.init(StartupPopups.DIAMOND_MEDIA_ID,this.onDiamondIconLoaded);
this._giftDataToStillBeDisplayed = {
"currItem":_loc8_,
"defIdOrAmount":_loc6_[_loc11_],
"giftType":_loc10_
};
}
else
{
this.checkAndInitializeGiftPopup(_loc10_,_loc8_,_loc6_[_loc11_]);
}
}
else
{
DarkenManager.showLoadingSpiral(false);
}
}
private function checkAndInitializeGiftPopup(param1:int, param2:Object, param3:int) : void
{
if(param1 == GiftPopup.GIFT_TYPE_GEMS)
{
this._gemAmount = param3;
this._giftingPopupMediaHelper = new MediaHelper();
this._giftingPopupMediaHelper.init(StartupPopups.GEMS_MEDIA_ID,this.onGemIconLoaded);
}
else if(param1 == GiftPopup.GIFT_TYPE_DIAMOND)
{
this._diamondAmount = param3;
this._giftingPopupMediaHelper = new MediaHelper();
this._giftingPopupMediaHelper.init(StartupPopups.DIAMOND_MEDIA_ID,this.onDiamondIconLoaded);
}
else
{
this._giftPopup = new GiftPopup();
this._giftPopup.init(this._guiLayer,param2.largeIcon,param2.name,param3,GiftPopup.POPUP_TYPE_JAMAALIDAY_GIFT,param1,this.keepGiftCallback,this.rejectGiftCallback);
}
}
private function onGemIconLoaded(param1:MovieClip) : void
{
if(param1)
{
this._giftPopup = new GiftPopup();
this._giftPopup.init(this._guiLayer,param1,LocalizationManager.translateIdAndInsertOnly(this._gemAmount == 1 ? LocalizationManager.GEM_CAPITALIZED : LocalizationManager.GEMS_CAPITALIZED,this._gemAmount),this._gemAmount,GiftPopup.POPUP_TYPE_JAMAALIDAY_GIFT,GiftPopup.GIFT_TYPE_GEMS,null,this.keepGiftCallback,null,false,GiftPopup.BUTTONS_TYPE_OK);
}
}
private function onDiamondIconLoaded(param1:MovieClip) : void
{
if(param1)
{
this._giftPopup = new GiftPopup();
this._giftPopup.init(this._guiLayer,param1,LocalizationManager.translateIdAndInsertOnly(this._diamondAmount == 1 ? LocalizationManager.DIAMOND_CAPITALIZED : LocalizationManager.DIAMONDS_CAPITALIZED,this._diamondAmount),this._diamondAmount,GiftPopup.POPUP_TYPE_JAMAALIDAY_GIFT,GiftPopup.GIFT_TYPE_DIAMOND,null,this.keepDiamondGiftCallback,null,false,GiftPopup.BUTTONS_TYPE_OK);
}
}
private function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
SBTracker.trackPageview("game/play/popup/dailyGift/close");
this.close();
}
private function keepDiamondGiftCallback() : void
{
if(this._giftDataToStillBeDisplayed != null)
{
this._giftPopup.destroy();
this.checkAndInitializeGiftPopup(this._giftDataToStillBeDisplayed.giftType,this._giftDataToStillBeDisplayed.currItem,this._giftDataToStillBeDisplayed.defIdOrAmount);
}
else
{
DarkenManager.showLoadingSpiral(true);
this._giftingPopupContent.visible = false;
AchievementXtCommManager.requestSetUserVar(AchievementXtCommManager.UV_DAILY_GEM_BONUS,this._randColorIndex,this.setVarCallback);
AchievementXtCommManager.requestSetUserVar(this.GIFTS_RECEIVED_UV,this._giftIndex);
}
}
private function keepGiftCallback() : void
{
DarkenManager.showLoadingSpiral(true);
this._giftingPopupContent.visible = false;
AchievementXtCommManager.requestSetUserVar(AchievementXtCommManager.UV_DAILY_GEM_BONUS,this._randColorIndex,this.setVarCallback);
AchievementXtCommManager.requestSetUserVar(this.GIFTS_RECEIVED_UV,this._giftIndex);
}
private function rejectGiftCallback() : void
{
if(this._giftDataToStillBeDisplayed)
{
DarkenManager.showLoadingSpiral(true);
this._giftingPopupContent.visible = false;
AchievementXtCommManager.requestSetUserVar(AchievementXtCommManager.UV_DAILY_GEM_BONUS,666,this.setVarCallback);
AchievementXtCommManager.requestSetUserVar(this.GIFTS_RECEIVED_UV,this._giftIndex);
}
else
{
this.close();
}
}
private function setVarCallback(param1:int, param2:int) : void
{
if(this._gemAmount > 0)
{
gMainFrame.clientInfo.gemCount += this._gemAmount;
}
if(this._diamondAmount > 0)
{
gMainFrame.clientInfo.diamondCount += this._diamondAmount;
}
DarkenManager.showLoadingSpiral(false);
this.close();
}
private function close() : void
{
if(this._closeCallback != null)
{
this._closeCallback();
this._closeCallback = null;
}
else
{
this.destroy();
}
}
private function onGiftDown(param1:MouseEvent) : void
{
param1.stopPropagation();
SBTracker.trackPageview("game/play/popup/dailyGift/" + param1.currentTarget.name);
this.setupGiftPopup();
}
private function onFutureGiftDown(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:int = param1.currentTarget.parent.currIndex - (this._giftIndex + 1);
new SBOkPopup(this._guiLayer,LocalizationManager.translateIdAndInsertOnly(_loc2_ == 1 ? 11383 : 11384,_loc2_));
}
private function onFutureDiamondDown(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:int = param1.currentTarget.parent.currIndex - (this._giftIndex + 1);
if(!gMainFrame.userInfo.isMember)
{
new SBOkPopup(this._guiLayer,LocalizationManager.translateIdAndInsertOnly(_loc2_ == 1 ? 20019 : 20020,_loc2_));
}
else
{
new SBOkPopup(this._guiLayer,LocalizationManager.translateIdAndInsertOnly(_loc2_ == 1 ? 11383 : 11384,_loc2_));
}
}
private function onGiftOver(param1:MouseEvent) : void
{
param1.stopPropagation();
param1.currentTarget.parent.highlight.visible = true;
}
private function onGiftOut(param1:MouseEvent) : void
{
param1.stopPropagation();
param1.currentTarget.parent.highlight.visible = false;
}
private function onPopupDown(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function addEventListeners() : void
{
this._giftingPopupContent.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
this._giftingPopupContent.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown,false,0,true);
}
private function removeEventListeners() : void
{
var _loc1_:MovieClip = null;
this._giftingPopupContent.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
this._giftingPopupContent.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopupDown);
var _loc2_:int = this._giftIndex + 1;
while(_loc2_ <= 25)
{
_loc1_ = this._giftingPopupContent["gift" + _loc2_];
_loc1_.unopenedGift.gift.removeEventListener(MouseEvent.MOUSE_DOWN,this.onGiftDown);
_loc1_.unopenedGift.gift.removeEventListener(MouseEvent.ROLL_OVER,this.onGiftOver);
_loc1_.unopenedGift.gift.removeEventListener(MouseEvent.ROLL_OUT,this.onGiftOut);
_loc1_.unopenedGift.diamond.removeEventListener(MouseEvent.MOUSE_DOWN,this.onFutureDiamondDown);
_loc2_++;
}
}
}
}
@@ -0,0 +1,257 @@
package gui
{
import flash.display.DisplayObjectContainer;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
public class DarkenManager
{
private static var _darken:Vector.<DisplayObjectContainer>;
private static var _stageDarkBG:Sprite;
private static var _darkBG:Sprite;
private static var _stageBlockBG:Sprite;
private static var _layer:DisplayLayer;
private static var _spiral:LoadingSpiral;
public static var setFocus:Function;
public function DarkenManager()
{
super();
}
public static function init(param1:DisplayLayer) : void
{
_darken = new Vector.<DisplayObjectContainer>();
_darkBG = new Sprite();
_stageBlockBG = new Sprite();
_stageDarkBG = new Sprite();
addListeners();
makeDarkShape();
makeStageDarkBG();
makeLightStageBlock();
gMainFrame.stage.addEventListener(Event.RESIZE,onStageResize,false,0,true);
_spiral = new LoadingSpiral(null);
_spiral.isDarkenManagersSpiral = true;
_layer = param1;
}
public static function destroy() : void
{
_darkBG.removeEventListener(MouseEvent.MOUSE_DOWN,blockMouseHandler);
_stageDarkBG.removeEventListener(MouseEvent.MOUSE_DOWN,blockMouseHandler);
_stageBlockBG.removeEventListener(MouseEvent.MOUSE_DOWN,blockMouseHandler);
var _loc1_:int = 0;
while(_loc1_ < _darken.length)
{
while(_darken[_loc1_].numChildren)
{
_darken[_loc1_].removeChildAt(0);
}
_loc1_++;
}
if(_spiral)
{
_spiral.destroy();
_spiral = null;
}
_darken = null;
_darkBG.x = undefined;
_darkBG.y = undefined;
_darkBG = null;
removeInvisibleBlockBG();
_stageBlockBG.x = undefined;
_stageBlockBG.y = undefined;
_stageBlockBG = null;
_layer = null;
_stageDarkBG = null;
}
public static function showLoadingSpiral(param1:Boolean, param2:Boolean = false) : void
{
if(_spiral)
{
if(param1)
{
_spiral.setNewParent(_layer,450,275,param2);
darken(_spiral);
}
else
{
unDarken(_spiral);
_spiral.destroy();
}
}
}
public static function updateLoadingSpiralPercentage(param1:String) : void
{
_spiral.updatePercentText(param1);
}
public static function clearDarkenList() : void
{
if(_darken)
{
_darken.length = 0;
}
removeInvisibleBlockBG();
}
public static function addListeners() : void
{
_darkBG.addEventListener(MouseEvent.MOUSE_DOWN,blockMouseHandler,false,0,true);
_stageDarkBG.addEventListener(MouseEvent.MOUSE_DOWN,blockMouseHandler,false,0,true);
_stageBlockBG.addEventListener(MouseEvent.MOUSE_DOWN,blockMouseHandler,false,0,true);
}
public static function makeDarkShape() : void
{
_darkBG.graphics.beginFill(0,0.5);
_darkBG.graphics.drawRect(0,0,MainFrame.VIEW_WIDTH,MainFrame.VIEW_HEIGHT);
_darkBG.graphics.endFill();
_darkBG.x = -MainFrame.VIEW_WIDTH * 0.5;
_darkBG.y = -MainFrame.VIEW_HEIGHT * 0.5;
}
private static function makeLightStageBlock() : void
{
_stageBlockBG.graphics.beginFill(0,0);
_stageBlockBG.graphics.drawRect(0,0,gMainFrame.stage.stageWidth,gMainFrame.stage.stageHeight);
_stageBlockBG.graphics.endFill();
_stageBlockBG.x = -gMainFrame.stage.stageWidth * 0.5 + MainFrame.VIEW_WIDTH * 0.5;
_stageBlockBG.y = -gMainFrame.stage.stageHeight * 0.5 + MainFrame.VIEW_HEIGHT * 0.5;
}
private static function makeStageDarkBG(param1:Event = null) : void
{
_stageDarkBG.graphics.clear();
_stageDarkBG.graphics.beginFill(0,0.5);
_stageDarkBG.graphics.drawRect(0,0,gMainFrame.stage.stageWidth,gMainFrame.stage.stageHeight);
_stageDarkBG.graphics.endFill();
_stageDarkBG.x = -gMainFrame.stage.stageWidth * 0.5 + MainFrame.VIEW_WIDTH * 0.5;
_stageDarkBG.y = -gMainFrame.stage.stageHeight * 0.5 + MainFrame.VIEW_HEIGHT * 0.5;
if(_stageDarkBG.parent == null)
{
gMainFrame.stage.addChildAt(_stageDarkBG,0);
}
}
private static function onStageResize(param1:Event) : void
{
makeStageDarkBG(param1);
}
private static function blockMouseHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
}
public static function addInvisibleBlockBG() : void
{
if(_stageBlockBG)
{
if(_stageBlockBG.parent)
{
_stageBlockBG.parent.removeChild(_stageBlockBG);
}
gMainFrame.stage.addChild(_stageBlockBG);
}
}
public static function removeInvisibleBlockBG() : void
{
if(_stageBlockBG)
{
if(_stageBlockBG.parent)
{
_stageBlockBG.parent.removeChild(_stageBlockBG);
}
}
}
public static function darken(param1:DisplayObjectContainer) : void
{
param1.addChildAt(_darkBG,0);
var _loc2_:DisplayObjectContainer = param1;
while(_loc2_ != null && _loc2_.parent != _layer)
{
if(_loc2_.parent == null)
{
break;
}
_loc2_ = _loc2_.parent;
}
_darkBG.x = -_loc2_.x;
_darkBG.y = -_loc2_.y;
if(setFocus != null)
{
setFocus(false);
}
if(_darken.indexOf(param1) < 0)
{
_darken.push(param1);
}
}
public static function unDarken(param1:DisplayObjectContainer) : void
{
var _loc2_:int = 0;
var _loc3_:DisplayObjectContainer = null;
var _loc4_:DisplayObjectContainer = null;
if(param1)
{
_loc2_ = _darken.indexOf(param1);
if(_loc2_ >= 0)
{
if(param1.parent == _darkBG)
{
param1.removeChild(_darkBG);
}
_darken.splice(_loc2_,1);
if(_darken.length > 0)
{
_loc3_ = _darken[_darken.length - 1];
_loc4_ = _loc3_;
_loc3_.addChildAt(_darkBG,0);
while(_loc4_ != null && _loc4_.parent != _layer)
{
if(_loc4_.parent == null)
{
break;
}
_loc4_ = _loc4_.parent;
}
_darkBG.x = -_loc4_.x;
_darkBG.y = -_loc4_.y;
}
gMainFrame.stage.invalidate();
}
}
}
public static function get isDarkened() : Boolean
{
var _loc1_:Boolean = false;
var _loc2_:int = 0;
while(_loc2_ < _darken.length)
{
if(_darken[_loc2_].visible)
{
_loc1_ = true;
break;
}
_loc2_++;
}
return _loc1_;
}
}
}
@@ -0,0 +1,350 @@
package gui
{
import avatar.AvatarSwitch;
import avatar.AvatarXtCommManager;
import com.sbi.analytics.SBTracker;
import com.sbi.corelib.audio.SBAudio;
import com.sbi.debug.DebugUtility;
import com.sbi.loader.LoaderCache;
import com.sbi.popup.SBOkPopup;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import loader.MediaHelper;
import localization.LocalizationManager;
public class DemotionMessages
{
private var _demotionMessage:MediaHelper;
private var _newMemberPopup:MovieClip;
private var _content:MovieClip;
private var _idx:int;
private var _gaIdx:int;
private var _choose:SwitchManager;
private var _currSound:Sound;
private var _currSoundChannel:SoundChannel;
private var _closeCallBack:Function;
private var _roomVolume:Number;
private var _hasChosen:Boolean;
private var _wasMusicMuted:Boolean;
private var _startingIndex:int;
public function DemotionMessages()
{
super();
}
public function init(param1:Function = null) : void
{
this._demotionMessage = new MediaHelper();
this._demotionMessage.init(156,this.demotionCallback);
this._closeCallBack = param1;
}
public function destroy() : void
{
this.removeListeners();
DarkenManager.unDarken(this._newMemberPopup);
if(this._demotionMessage)
{
this._demotionMessage.destroy();
}
this._newMemberPopup.visible = false;
this._newMemberPopup = null;
this._content.visible = false;
this._content = null;
if(this._closeCallBack != null)
{
this._closeCallBack();
}
if(this._currSoundChannel)
{
this._currSoundChannel.stop();
this._currSoundChannel = null;
}
this._closeCallBack = null;
}
public function goToNextPage() : void
{
this.nextBtnHandler(null);
}
public function set hasChosen(param1:Boolean) : void
{
this._hasChosen = param1;
}
private function demotionCallback(param1:MovieClip) : void
{
this._newMemberPopup = param1;
this._newMemberPopup.x = MainFrame.VIEW_WIDTH * 0.5;
this._newMemberPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
this._newMemberPopup.addEventListener(MouseEvent.MOUSE_DOWN,this.demotionMouseDownHandler,false,0,true);
GuiManager.guiLayer.addChild(this._newMemberPopup);
DarkenManager.showLoadingSpiral(false);
DarkenManager.darken(this._newMemberPopup);
this._content = this._newMemberPopup.getChildAt(1)["c"];
this._content.soundBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.soundBtnHandler,false,0,true);
this._content.chooseBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.chooseBtnHandler,false,0,true);
this._content.renewBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.joinBtnHandler,false,0,true);
this._content.nextBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.nextBtnHandler,false,0,true);
this._content.noThanksBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.demotionCloseHandler,false,0,true);
this._content.chooseBtn.visible = false;
this._content.noThanksBtn.visible = false;
switch(LocalizationManager.currentLanguage)
{
case LocalizationManager.LANG_ENG:
this._startingIndex = 67;
break;
case LocalizationManager.LANG_SPA:
this._startingIndex = 676;
break;
case LocalizationManager.LANG_POR:
this._startingIndex = 631;
break;
case LocalizationManager.LANG_FRE:
this._startingIndex = 626;
break;
case LocalizationManager.LANG_DE:
this._startingIndex = 621;
break;
default:
this._startingIndex = 67;
}
this._idx = 1;
this._gaIdx = 2;
this._currSound = new Sound();
this._currSound.load(LoaderCache.fetchCDNURLRequest("streams/" + (this._startingIndex + this._idx) + ".mp3"));
this.playSoundCallback();
}
private function playSoundCallback() : void
{
this._wasMusicMuted = SBAudio.isMusicMuted;
if(!this._wasMusicMuted)
{
SBAudio.muteMusic();
}
this._currSoundChannel = this._currSound.play();
}
private function nextBtnHandler(param1:MouseEvent) : void
{
var _loc3_:Array = null;
var _loc4_:Array = null;
var _loc5_:int = 0;
var _loc6_:int = 0;
var _loc7_:Boolean = false;
var _loc8_:int = 0;
var _loc9_:int = 0;
if(param1)
{
param1.stopPropagation();
}
SBTracker.push();
SBTracker.trackPageview("/game/play/popup/demotion/#page" + this._gaIdx);
var _loc2_:Boolean = AvatarSwitch.shouldChoose();
++this._gaIdx;
++this._idx;
if(!this._hasChosen && !_loc2_ && this._idx > 2)
{
++this._idx;
_loc3_ = AvatarSwitch.avatars;
_loc4_ = new Array();
_loc8_ = AvatarSwitch.numNonMemberAvatars;
_loc9_ = 0;
while(_loc9_ < _loc3_.length)
{
if(_loc3_[_loc9_])
{
if(!AvatarSwitch.isMemberOnlyAvatar(_loc9_))
{
_loc7_ = true;
}
}
else if(_loc9_ >= _loc8_ - 1)
{
_loc7_ = true;
}
if(_loc7_)
{
_loc7_ = false;
if(_loc4_[0] == null && Boolean(_loc3_[_loc9_]))
{
_loc4_[0] = _loc5_ = _loc9_;
}
else
{
_loc4_[1] = _loc6_ = _loc9_;
}
if(_loc4_[0] != null && _loc4_[1] != null)
{
break;
}
}
_loc9_++;
}
if(_loc4_[1] != null && Boolean(_loc3_[_loc6_]))
{
AvatarSwitch.adjustAvailSlotFlags(AvatarXtCommManager.avSlotInfo[_loc3_[_loc5_].perUserAvId].avInvId,true);
AvatarSwitch.adjustAvailSlotFlags(AvatarXtCommManager.avSlotInfo[_loc3_[_loc6_].perUserAvId].avInvId,true);
}
else
{
AvatarSwitch.adjustAvailSlotFlags(AvatarXtCommManager.avSlotInfo[_loc3_[_loc5_].perUserAvId].avInvId,true);
}
DarkenManager.showLoadingSpiral(true);
this._content.nextBtn.visible = false;
AvatarSwitch.chooseTwo(_loc4_,this.onAvatarChooseCallback);
return;
}
if(this._idx == 3)
{
this._content.renewBtn.visible = false;
this._content.nextBtn.visible = false;
this._content.chooseBtn.visible = true;
}
if(this._idx == 4 && _loc2_)
{
this._content.chooseBtn.visible = false;
this._content.nextBtn.visible = false;
this._content.noThanksBtn.visible = true;
}
if(this._currSoundChannel)
{
this._currSoundChannel.stop();
}
this._currSound = new Sound();
this._currSound.load(LoaderCache.fetchCDNURLRequest("streams/" + (this._startingIndex + this._idx) + ".mp3"));
this._currSoundChannel = this._currSound.play();
this._content.gotoAndStop("p" + this._idx);
}
private function onAvatarChooseCallback(param1:Boolean) : void
{
DarkenManager.showLoadingSpiral(false);
if(this._currSoundChannel)
{
this._currSoundChannel.stop();
}
if(param1)
{
this._content.chooseBtn.visible = false;
this._content.nextBtn.visible = false;
this._content.noThanksBtn.visible = true;
this._currSound = new Sound();
this._currSound.load(LoaderCache.fetchCDNURLRequest("streams/" + (this._startingIndex + this._idx) + ".mp3"));
this._currSoundChannel = this._currSound.play();
this._content.gotoAndStop("p" + this._idx);
}
else
{
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(11233));
this._content.nextBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.nextBtnHandler);
this._content.nextBtn.visible = true;
}
}
private function joinBtnHandler(param1:MouseEvent) : void
{
var url:String;
var request:URLRequest;
var m:MouseEvent = param1;
SBTracker.push();
SBTracker.trackPageview("/game/play/popup/demotion/renew");
m.stopPropagation();
url = gMainFrame.clientInfo.websiteURL + "membership";
request = new URLRequest(url);
try
{
navigateToURL(request,"_blank");
}
catch(e:Error)
{
DebugUtility.debugTrace("error with loading URL");
}
}
private function chooseBtnHandler(param1:MouseEvent) : void
{
SBTracker.push();
SBTracker.trackPageview("/game/play/popup/demotion/avatarChoose");
param1.stopPropagation();
if(this._currSoundChannel)
{
this._currSoundChannel.stop();
}
GuiManager.openAvatarChoose();
this._content.chooseBtn.visible = false;
this._content.renewBtn.visible = true;
this._content.noThanksBtn.visible = true;
}
private function soundBtnHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(this._currSoundChannel)
{
this._currSoundChannel.stop();
this._currSoundChannel = this._currSound.play();
}
else
{
this._currSoundChannel = this._currSound.play();
}
}
private function demotionMouseDownHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function demotionCloseHandler(param1:MouseEvent) : void
{
SBTracker.push();
SBTracker.trackPageview("/game/play/popup/demotion/page4_noThanks");
if(this._currSoundChannel)
{
this._currSoundChannel.stop();
this._currSoundChannel = this._currSound.play();
}
else
{
this._currSoundChannel = this._currSound.play();
}
if(!this._wasMusicMuted)
{
SBAudio.unmuteMusic();
}
param1.stopPropagation();
this.destroy();
}
private function removeListeners() : void
{
this._content.chooseBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.chooseBtnHandler);
this._content.renewBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.joinBtnHandler);
this._content.nextBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.nextBtnHandler);
this._content.noThanksBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.demotionCloseHandler);
this._newMemberPopup.removeEventListener(MouseEvent.MOUSE_DOWN,this.demotionMouseDownHandler);
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,155 @@
package gui
{
import com.sbi.popup.SBYesNoPopup;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
import localization.LocalizationManager;
import room.RoomManagerWorld;
public class DenPreviewManager
{
private static var _currentShop:Shop;
private static var _buyAndBackBtns:MovieClip;
private static var _loadingMediaHelper:MediaHelper;
public function DenPreviewManager()
{
super();
}
public static function setCurrentShop(param1:Shop) : void
{
_currentShop = param1;
}
public static function handleAllRequiredVisibilities(param1:Boolean) : void
{
GuiManager.toggleHud();
handleDenSwitcherandShopVisibility(param1);
GuiManager.showDenHudItems(param1);
if(_buyAndBackBtns)
{
_buyAndBackBtns.visible = !param1;
}
else if(!param1)
{
showBuyAndBackBtns(true);
}
}
public static function handleDenPurchase() : void
{
if(Boolean(_buyAndBackBtns) && _buyAndBackBtns.visible)
{
RoomManagerWorld.instance.reloadCurrentNormalRoom();
_buyAndBackBtns.visible = false;
}
}
public static function showBuyAndBackBtns(param1:Boolean) : void
{
if(param1)
{
if(_buyAndBackBtns)
{
_buyAndBackBtns.visible = true;
}
else
{
_loadingMediaHelper = new MediaHelper();
_loadingMediaHelper.init(2969,onBuyAndBackBtnsLoaded);
}
}
else if(_buyAndBackBtns)
{
_buyAndBackBtns.visible = false;
}
}
public static function exitPreview() : void
{
onBackBtn(null);
}
private static function handleDenSwitcherandShopVisibility(param1:Boolean) : void
{
if(param1)
{
GuiManager.showDenSwitcher(true);
if(_currentShop)
{
_currentShop.showShop(true);
}
}
else
{
if(_currentShop)
{
_currentShop.showShop(false);
}
GuiManager.showDenSwitcher(false);
}
}
private static function onBuyAndBackBtnsLoaded(param1:MovieClip) : void
{
if(param1)
{
_buyAndBackBtns = param1;
_buyAndBackBtns.backBtn.addEventListener(MouseEvent.MOUSE_DOWN,onBackBtn,false,0,true);
_buyAndBackBtns.buyBtn.addEventListener(MouseEvent.MOUSE_DOWN,onBuyBtn,false,0,true);
GuiManager.guiLayer.addChild(_buyAndBackBtns);
}
}
private static function onBackBtn(param1:MouseEvent) : void
{
if(param1)
{
param1.stopPropagation();
}
if(Boolean(_buyAndBackBtns) && _buyAndBackBtns.visible)
{
RoomManagerWorld.instance.reloadCurrentNormalRoom();
_buyAndBackBtns.visible = false;
}
}
private static function onBuyBtn(param1:MouseEvent) : void
{
var _loc2_:Object = null;
param1.stopPropagation();
if(_currentShop)
{
if(_currentShop.isDiamondStore)
{
_currentShop.attemptToBuyCurrrentItem();
}
else
{
_loc2_ = gMainFrame.userInfo.denRoomDefs[_currentShop.getCurrentItemDefId()];
if(_loc2_)
{
new SBYesNoPopup(GuiManager.guiLayer,LocalizationManager.translateIdAndInsertOnly(10305,Utility.convertNumberToString(_loc2_.value)),true,onPreviewBuy);
}
}
}
}
private static function onPreviewBuy(param1:Object) : void
{
if(param1.status)
{
if(_currentShop)
{
_currentShop.attemptToBuyCurrrentItem();
}
}
}
}
}
@@ -0,0 +1,185 @@
package gui
{
import avatar.UserInfo;
import den.DenXtCommManager;
public class DenSwitch
{
public static var activeDenIdx:int;
public static var playerUserInfo:UserInfo;
public static var playerUsername:String;
public static var playerSfsUserId:int;
private static var _denList:Array;
private static var _addDenCallback:Function;
private static var _removeCallback:Function;
private static var _switchIdx:int;
private static var _switchDensCallback:Function;
private static var _removeIdx:int;
private static var _maxSlots:int;
private static var _numSlots:int;
public static const RECYCLE_DEN_ROOM:int = 99;
public function DenSwitch()
{
super();
}
public static function init(param1:int) : void
{
setActiveDenIdx(param1);
}
public static function destroy() : void
{
}
public static function setActiveDenIdx(param1:int) : void
{
activeDenIdx = param1;
}
public static function denInfoSet() : void
{
}
private static function updateDens() : void
{
}
public static function get numSlots() : int
{
return _numSlots;
}
public static function get numDens() : int
{
var _loc1_:int = 0;
var _loc2_:int = 0;
while(_loc2_ < _denList.length)
{
if(_denList[_loc2_])
{
_loc1_++;
}
_loc2_++;
}
return _loc1_;
}
public static function addNewDen(param1:int, param2:String, param3:Function) : void
{
_addDenCallback = param3;
}
public static function addDenResponse(param1:Boolean, param2:int) : void
{
if(param1)
{
}
if(_addDenCallback != null)
{
_addDenCallback(param1);
}
}
public static function switchDens(param1:int, param2:Function = null) : void
{
if(param1 < 0 || param1 >= _denList.length)
{
throw new Error("Invalid switchIdx:" + param1);
}
_switchIdx = param1;
_switchDensCallback = param2;
activeDenIdx = _denList[_switchIdx].invId;
DenXtCommManager.requestDenChange(param1,param2);
}
public static function reTrySwitchDensAfterAddingAvatar() : void
{
DenXtCommManager.requestDenChange(_switchIdx,_switchDensCallback);
}
public static function denListResponse(param1:Array) : void
{
_denList = param1;
}
public static function removeDen(param1:int, param2:Function) : void
{
if(param1 < 0 || param1 >= _denList.length)
{
throw new Error("Invalid removeIdx:" + param1);
}
_removeCallback = param2;
_removeIdx = param1;
if(_denList[param1].invId != activeDenIdx && _denList[param1].invId > 0)
{
DenXtCommManager.requestRecycle(false,_denList[param1].invId,denRecycleResponse);
}
else
{
denRecycleResponse(false);
}
}
public static function denRecycleResponse(param1:Boolean) : void
{
if(param1)
{
_denList[_removeIdx] = null;
}
if(_removeCallback != null)
{
_removeCallback(param1,_removeIdx);
}
_removeIdx = -1;
}
public static function get denList() : Array
{
return _denList;
}
public static function get nextFreeSlotIdx() : int
{
var _loc1_:int = 0;
while(_loc1_ < SwitchManager.NUM_DEN_ROOM_SLOTS)
{
if(!_denList[_loc1_])
{
return _loc1_;
}
_loc1_++;
}
return -1;
}
public static function haveOceanDen() : Boolean
{
var _loc1_:int = 0;
while(_loc1_ < _denList.length)
{
if(Boolean(_denList[_loc1_]) && _denList[_loc1_].enviroType == SbiConstants.ENVIRO_OCEAN)
{
return true;
}
_loc1_++;
}
return false;
}
}
}
@@ -0,0 +1,655 @@
package gui
{
import avatar.Avatar;
import com.sbi.client.KeepAlive;
import com.sbi.popup.SBYesNoPopup;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.DefPacksDefHelper;
import loader.MediaHelper;
import localization.LocalizationManager;
public class DenSwitcher
{
private const MIN_NUM_DENS:int = 1;
private const DENSWITCH_MEDIA_ID:int = 1168;
private var _numTotalSlots:int;
private var _playerAvatar:Avatar;
private var _guiLayer:DisplayLayer;
private var _closeCallback:Function;
private var _shop:Shop;
private var _views:Array;
private var _activeIdx:int;
private var _idx:int;
private var _recycling:Boolean;
private var _recyclingOnly:Boolean;
private var _loadingMediaHelper:MediaHelper;
private var _mediaHelpers:Array;
private var _contentItems:Array;
private var _switchContent:MovieClip;
private var _closeBtn:MovieClip;
private var _choosingContent:MovieClip;
private var _scrollButtons:SBScrollbar;
private var _itemWindows:WindowGenerator;
private var _openStoreOnly:Boolean;
private var _firstOpenIdx:int;
private var _glId:int;
private var _storeItemIndex:int;
public function DenSwitcher()
{
super();
}
public function init(param1:Avatar, param2:DisplayLayer, param3:Boolean = false, param4:Boolean = false, param5:Function = null, param6:int = -1, param7:int = -1, param8:int = -1, param9:int = 450, param10:int = 250) : void
{
DarkenManager.showLoadingSpiral(true);
this._playerAvatar = param1;
this._guiLayer = param2;
this._closeCallback = param5;
this._recyclingOnly = param3;
this._openStoreOnly = param4;
this._firstOpenIdx = param6;
this._storeItemIndex = param8;
this._numTotalSlots = SwitchManager.NUM_DEN_ROOM_SLOTS;
this._mediaHelpers = [];
if(param7 == -1)
{
this._glId = GenericListXtCommManager.DEN_ROOM_SHOP_ID;
}
else
{
this._glId = param7;
}
this._loadingMediaHelper = new MediaHelper();
this._loadingMediaHelper.init(this.DENSWITCH_MEDIA_ID,this.onMediaItemLoaded,true);
this._mediaHelpers.push(this._loadingMediaHelper);
}
public function destroy() : void
{
this.removeListeners();
KeepAlive.stopKATimer(this._switchContent);
var _loc1_:int = 0;
while(_loc1_ < this._views.length)
{
if(this._views[_loc1_])
{
this._views[_loc1_].destroy();
this._views[_loc1_] = null;
}
_loc1_++;
}
if(this._shop)
{
this._shop.destroy();
this._shop = null;
}
if(this._switchContent)
{
if(this._switchContent.root.parent == this._guiLayer)
{
this._guiLayer.removeChild(this._switchContent.root);
}
DarkenManager.unDarken(MovieClip(this._switchContent.root));
this._switchContent.root.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
this._switchContent = null;
if(this._closeBtn)
{
this._closeBtn = null;
}
if(this._contentItems)
{
this._contentItems = null;
}
}
if(this._itemWindows)
{
this._itemWindows.destroy();
this._itemWindows = null;
}
this._recyclingOnly = false;
this._recycling = false;
this._closeCallback = null;
}
public function close() : void
{
if(this._closeCallback != null)
{
this._closeCallback();
}
else
{
this.destroy();
}
}
public function get idx() : int
{
return this._idx;
}
public function showDenSwitcher(param1:Boolean) : void
{
if(Boolean(this._switchContent) && this._switchContent.root.visible != param1)
{
this._switchContent.root.visible = param1;
if(param1)
{
DarkenManager.darken(MovieClip(this._switchContent.root));
}
else
{
DarkenManager.unDarken(MovieClip(this._switchContent.root));
}
}
}
private function onMediaItemLoaded(param1:MovieClip) : void
{
var _loc2_:Boolean = false;
if(param1)
{
this._closeBtn = MovieClip(param1.getChildAt(0)).bx;
this._switchContent = MovieClip(param1.getChildAt(0)).c;
KeepAlive.startKATimer(this._switchContent);
this._guiLayer.addChild(param1);
param1.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
param1.x = MainFrame.VIEW_WIDTH * 0.5;
param1.y = MainFrame.VIEW_HEIGHT * 0.5;
DarkenManager.showLoadingSpiral(false);
DarkenManager.darken(param1);
this.addListeners();
_loc2_ = this._firstOpenIdx != -1;
this.initVisibilityAndStates();
this.buildWindows();
if(this._openStoreOnly)
{
param1.visible = false;
this.onItemWindowDown(null);
}
else if(_loc2_)
{
this.onItemWindowDown(null);
}
}
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function initVisibilityAndStates() : void
{
this._activeIdx = DenSwitch.activeDenIdx;
this._switchContent.buyPopup.tag.visible = false;
this._switchContent.oopsPopup.body_txt.text = "";
LocalizationManager.translateId(this._switchContent.switchTitleTxt,11271);
this._switchContent.buyPopup.tag.txt.text = "";
this._switchContent.buyPopup.paw.gray.visible = false;
this._switchContent.buyPopup.banner.visible = false;
this._switchContent.buyPopup.lock.visible = false;
this._switchContent.buyPopup.lockOpen.visible = false;
this._switchContent.buyPopup.colorChange_btn.visible = false;
this._switchContent.buyPopup.paw.visible = true;
this._switchContent.buyPopup.visible = false;
this._switchContent.oopsPopup.visible = false;
this._switchContent.oopsCostPopup.visible = false;
this._switchContent.denShopTag.visible = false;
this._switchContent.saveAmlTag.visible = false;
}
private function buildWindows() : void
{
var _loc6_:MovieClip = null;
var _loc7_:MediaHelper = null;
if(this._scrollButtons)
{
this._scrollButtons.destroy();
this._scrollButtons = null;
}
if(this._itemWindows)
{
this._itemWindows.destroy();
this._itemWindows = null;
}
var _loc1_:int = this._numTotalSlots;
var _loc2_:int = Math.min(_loc1_,4);
var _loc3_:int = Math.ceil(_loc2_ / 2);
this._itemWindows = new WindowGenerator();
this._itemWindows.init(_loc2_,_loc3_,_loc1_,2,2,0,ItemWindowAnimal,DenSwitch.denList,"icon",{
"mouseDown":this.onItemWindowDown,
"mouseOver":this.onItemWindowOver,
"mouseOut":this.onItemWindowOut
},{"recylingOnly":this._recyclingOnly},null,false,false);
this._switchContent.itemBlock.addChild(this._itemWindows);
this._views = new Array(this._numTotalSlots);
this._contentItems = new Array(this._numTotalSlots);
this._activeIdx = DenSwitch.activeDenIdx;
var _loc4_:int = 0;
while(_loc4_ < this._numTotalSlots)
{
_loc6_ = MovieClip(this._itemWindows.bg.getChildAt(_loc4_));
this._contentItems[_loc4_] = _loc6_;
if(DenSwitch.denList[_loc4_] != null)
{
_loc7_ = new MediaHelper();
_loc7_.init(DenSwitch.denList[_loc4_].mediaId,this.mediaHelperCallback,DenSwitch.denList[_loc4_].isMemberOnly);
this._views[_loc4_] = _loc7_;
}
else if(this._firstOpenIdx == -1)
{
this._firstOpenIdx = _loc4_;
}
_loc4_++;
}
if(this._firstOpenIdx == -1)
{
this._firstOpenIdx = 0;
}
var _loc5_:int = DenSwitch.numDens;
if(_loc5_ > this.MIN_NUM_DENS)
{
this._switchContent.recycleBtn.gray.visible = false;
this._switchContent.recycleBtn.mouse.visible = true;
this._switchContent.recycleBtn.down.visible = false;
}
else
{
this._switchContent.recycleBtn.gray.visible = true;
this._switchContent.recycleBtn.mouse.visible = false;
this._switchContent.recycleBtn.down.visible = false;
}
if(this._recyclingOnly)
{
this._recycling = true;
}
if(_loc5_ >= this._numTotalSlots && !this._recyclingOnly)
{
this._switchContent.denShopTag.visible = true;
}
else
{
this._switchContent.denShopTag.visible = false;
}
this._scrollButtons = new SBScrollbar();
this._scrollButtons.init(this._itemWindows,840,440,0,"scrollbar2",224.6);
}
public function switchDenCallback(param1:Boolean) : void
{
if(param1)
{
this.close();
}
else
{
DarkenManager.darken(this._switchContent.oopsPopup);
LocalizationManager.translateId(this._switchContent.oopsPopup.body_txt,11272);
this._switchContent.oopsPopup.visible = true;
}
DarkenManager.showLoadingSpiral(false);
}
private function recycleDenCallback(param1:Boolean, param2:int) : void
{
var _loc3_:MovieClip = null;
var _loc4_:int = 0;
if(param1)
{
if(this._recyclingOnly)
{
DarkenManager.showLoadingSpiral(false);
if(this._closeCallback != null)
{
this._closeCallback(true);
}
else
{
this.destroy();
}
}
else
{
_loc3_ = this._contentItems[param2];
if(this._views[param2])
{
this._views[param2].destroy();
this._views[param2] = null;
}
this._recycling = false;
_loc4_ = 0;
while(_loc4_ < this._numTotalSlots)
{
this._contentItems[_loc4_].recycle.visible = false;
_loc4_++;
}
_loc3_.resetWindow(param2);
if(DenSwitch.numDens <= this.MIN_NUM_DENS)
{
this._switchContent.recycleBtn.gray.visible = true;
this._switchContent.recycleBtn.mouse.visible = false;
this._switchContent.recycleBtn.down.visible = false;
}
if(DenSwitch.numDens >= this._numTotalSlots)
{
this._switchContent.denShopTag.visible = true;
}
else
{
this._switchContent.denShopTag.visible = false;
}
}
}
else
{
DarkenManager.darken(this._switchContent.oopsPopup);
LocalizationManager.translateId(this._switchContent.oopsPopup.body_txt,11273);
this._switchContent.oopsPopup.visible = true;
this._recycling = true;
}
DarkenManager.showLoadingSpiral(false);
}
private function purchasedDenRoomCallback() : void
{
DenPreviewManager.handleDenPurchase();
if(!this._openStoreOnly)
{
this.closeDenShop(true);
}
MovieClip(this._itemWindows).bg.getChildAt(this._idx).currItem = DenSwitch.denList[this._idx];
var _loc1_:MovieClip = this._contentItems[this._idx];
_loc1_.buyDen.visible = false;
_loc1_.den.visible = true;
_loc1_.den.txt.text = DenSwitch.denList[this._idx].name;
_loc1_.den.sel.visible = false;
var _loc2_:MediaHelper = new MediaHelper();
_loc2_.init(DenSwitch.denList[this._idx].mediaId,this.mediaHelperCallback,DenSwitch.denList[this._idx].isMemberOnly);
this._views[this._idx] = _loc2_;
if(DenSwitch.numDens >= this._numTotalSlots)
{
this._switchContent.denShopTag.visible = true;
}
else
{
this._switchContent.denShopTag.visible = false;
}
if(DenSwitch.numDens > this.MIN_NUM_DENS)
{
this._switchContent.recycleBtn.gray.visible = false;
this._switchContent.recycleBtn.mouse.visible = true;
this._switchContent.recycleBtn.down.visible = false;
}
if(this._shop)
{
this._shop.denItemIdx = this._firstOpenIdx = Math.max(0,DenSwitch.nextFreeSlotIdx);
}
}
public function closeDenShop(param1:Boolean = false) : void
{
if(this._shop)
{
this._shop.destroy();
this._shop = null;
}
if(this._openStoreOnly)
{
this.close();
}
}
private function mediaHelperCallback(param1:MovieClip) : void
{
var _loc2_:int = 0;
while(_loc2_ < this._views.length)
{
if(this._views[_loc2_] == param1.mediaHelper)
{
if(Boolean(param1.passback) && !gMainFrame.userInfo.isMember)
{
this._contentItems[_loc2_].gray.amlMask.amlBox.addChild(param1);
}
else
{
this._contentItems[_loc2_].den.itemBlock.addChild(param1);
}
break;
}
_loc2_++;
}
}
private function confirmRecycleHandler(param1:Object) : void
{
if(param1.status)
{
DenSwitch.removeDen(this._idx,this.recycleDenCallback);
DarkenManager.showLoadingSpiral(true);
}
}
private function onItemWindowDown(param1:MouseEvent) : void
{
if(param1)
{
param1.stopPropagation();
this._idx = param1.currentTarget.index;
}
else
{
this._idx = this._firstOpenIdx;
}
if(Boolean(this._contentItems[this._idx].buyDen.visible) || this._openStoreOnly)
{
if(!GenericListGuiManager.isWorldShopOpen())
{
this._shop = new Shop();
this._shop.init(this._glId,DefPacksDefHelper.DEF_DEN_ROOM,this._playerAvatar,this._guiLayer,true,this.closeDenShop,MainFrame.VIEW_WIDTH * 0.5,MainFrame.VIEW_HEIGHT * 0.5,this._idx,this.purchasedDenRoomCallback,this._openStoreOnly,this._storeItemIndex);
}
}
else if(this._contentItems[this._idx].gray.visible == true && !this._recycling)
{
if(!gMainFrame.userInfo.isMember)
{
UpsellManager.displayPopup(UpsellManager.DENS,"useLockedDen/" + DenSwitch.denList[this._idx].name);
}
}
else if(this._recycling)
{
if(this._idx == this._activeIdx)
{
DarkenManager.darken(this._switchContent.oopsPopup);
LocalizationManager.translateId(this._switchContent.oopsPopup.body_txt,11274);
this._switchContent.oopsPopup.visible = true;
}
else if(this._idx == 0)
{
DarkenManager.darken(this._switchContent.oopsPopup);
LocalizationManager.translateId(this._switchContent.oopsPopup.body_txt,11275);
this._switchContent.oopsPopup.visible = true;
}
else
{
new SBYesNoPopup(this._guiLayer,LocalizationManager.translateIdAndInsertOnly(14715,Utility.convertNumberToString(DenSwitch.denList[this._idx].recycleValue)),true,this.confirmRecycleHandler);
}
}
else if(this._contentItems[this._idx].den.visible == true)
{
if(this._idx != this._activeIdx)
{
DarkenManager.showLoadingSpiral(true);
DenSwitch.switchDens(this._idx,this.switchDenCallback);
}
}
}
private function onItemWindowOver(param1:MouseEvent) : void
{
param1.stopPropagation();
this._idx = param1.currentTarget.index;
if(this._contentItems[this._idx].den.currentFrameLabel != "mouse")
{
this._contentItems[this._idx].den.gotoAndPlay("mouse");
}
AJAudio.playSubMenuBtnRollover();
}
private function onItemWindowOut(param1:MouseEvent) : void
{
param1.stopPropagation();
this._idx = param1.currentTarget.index;
if(this._contentItems[this._idx].den.currentFrameLabel != "out")
{
this._contentItems[this._idx].den.gotoAndPlay("out");
}
}
private function onOopsClose(param1:MouseEvent) : void
{
param1.stopPropagation();
DarkenManager.unDarken(this._switchContent.oopsPopup);
this._switchContent.oopsPopup.visible = false;
}
private function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
this.close();
}
private function onRecycleDown(param1:MouseEvent) : void
{
var _loc2_:int = 0;
var _loc3_:int = 0;
param1.stopPropagation();
if(!this._recyclingOnly)
{
if(this._recycling)
{
_loc2_ = 0;
while(_loc2_ < this._numTotalSlots)
{
this._contentItems[_loc2_].recycle.visible = false;
_loc2_++;
}
this._recycling = false;
}
else if(!this._switchContent.recycleBtn.gray.visible)
{
this._recycling = true;
_loc3_ = 0;
while(_loc3_ < this._numTotalSlots)
{
if(this._views[_loc3_])
{
if(!this._contentItems[_loc3_].buyDen.visible)
{
this._contentItems[_loc3_].recycle.visible = true;
}
}
_loc3_++;
}
}
else
{
this._switchContent.recycleBtn.mouse.visible = false;
}
}
}
private function onRecycleOver(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.toolTip.init(this._guiLayer,LocalizationManager.translateIdOnly(14626),843,480);
GuiManager.toolTip.startTimer(param1);
}
private function onRecycleOut(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.toolTip.resetTimerAndSetVisibility();
}
private function onMoreDenDown(param1:MouseEvent) : void
{
param1.stopPropagation();
if(!this._recyclingOnly)
{
this._shop = new Shop();
this._shop.init(this._glId,DefPacksDefHelper.DEF_DEN_ROOM,this._playerAvatar,this._guiLayer,true,this.closeDenShop,MainFrame.VIEW_WIDTH * 0.5,MainFrame.VIEW_HEIGHT * 0.5,this._idx,this.purchasedDenRoomCallback);
}
}
private function addListeners() : void
{
if(this._closeBtn)
{
this._closeBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
}
if(this._switchContent)
{
this._switchContent.recycleBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onRecycleDown,false,0,true);
this._switchContent.recycleBtn.addEventListener(MouseEvent.MOUSE_OVER,this.onRecycleOver,false,0,true);
this._switchContent.recycleBtn.addEventListener(MouseEvent.MOUSE_OUT,this.onRecycleOut,false,0,true);
this._switchContent.oopsPopup.closeBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onOopsClose,false,0,true);
this._switchContent.denShopTag.denShopBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onMoreDenDown,false,0,true);
}
}
private function removeListeners() : void
{
var _loc1_:int = 0;
while(_loc1_ < this._numTotalSlots)
{
if(this._contentItems[_loc1_])
{
this._contentItems[_loc1_].removeEventListener(MouseEvent.MOUSE_DOWN,this.onItemWindowDown);
this._contentItems[_loc1_].removeEventListener(MouseEvent.ROLL_OVER,this.onItemWindowOver);
this._contentItems[_loc1_].removeEventListener(MouseEvent.ROLL_OUT,this.onItemWindowOut);
}
_loc1_++;
}
if(this._closeBtn)
{
this._closeBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
}
if(this._switchContent)
{
this._switchContent.recycleBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onRecycleDown);
this._switchContent.recycleBtn.removeEventListener(MouseEvent.MOUSE_OVER,this.onRecycleOver);
this._switchContent.recycleBtn.removeEventListener(MouseEvent.MOUSE_OUT,this.onRecycleOut);
this._switchContent.oopsPopup.closeBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onOopsClose);
this._switchContent.denShopTag.denShopBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMoreDenDown);
}
}
}
}
@@ -0,0 +1,178 @@
package gui
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.system.ApplicationDomain;
import loader.MediaHelper;
public class EBookChooser
{
public static const LAND_TYPE:String = "land";
public static const OCEAN_TYPE:String = "ocean";
public static const AIR_TYPE:String = "air";
private var _closeCallback:Function;
private var _mediaHelper:MediaHelper;
private var _popup:MovieClip;
private var _itemWindowsTop:WindowGenerator;
private var _itemWindowsBottom:WindowGenerator;
private var _currLoaderAppDomain:ApplicationDomain;
private var _type:String;
public function EBookChooser()
{
super();
}
public function init(param1:String, param2:Function) : void
{
this._type = param1;
this._closeCallback = param2;
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(3836,this.onPopupLoaded);
}
public function destroy() : void
{
this._closeCallback = null;
if(this._mediaHelper)
{
this._mediaHelper.destroy();
this._mediaHelper = null;
}
if(this._itemWindowsBottom)
{
this._itemWindowsBottom.destroy();
}
if(this._itemWindowsTop)
{
this._itemWindowsTop.destroy();
}
if(this._popup)
{
DarkenManager.unDarken(this._popup);
if(Boolean(this._popup.parent) && GuiManager.guiLayer == this._popup.parent)
{
GuiManager.guiLayer.removeChild(this._popup);
}
}
}
private function onPopupLoaded(param1:MovieClip) : void
{
if(param1)
{
this._currLoaderAppDomain = param1.loaderInfo.applicationDomain;
this._popup = MovieClip(param1.getChildAt(0));
this._popup.logo.gotoAndStop(this._type);
this._popup.x = MainFrame.VIEW_WIDTH * 0.5;
this._popup.y = MainFrame.VIEW_HEIGHT * 0.5;
GuiManager.guiLayer.addChild(this._popup);
DarkenManager.darken(this._popup);
this.addEventListeners();
this.loadBooks();
}
}
private function addEventListeners() : void
{
this._popup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
this._popup.xBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
}
private function loadBooks() : void
{
var _loc2_:int = 0;
var _loc3_:int = 0;
var _loc4_:int = 0;
var _loc5_:int = 0;
var _loc1_:Array = this.setupBooksObject();
if(_loc1_ != null)
{
_loc2_ = 3;
_loc3_ = 1;
_loc4_ = Math.min(_loc2_,_loc1_.length);
_loc5_ = Math.min(_loc2_,_loc1_.length - _loc4_);
this._itemWindowsTop = new WindowGenerator();
this._itemWindowsBottom = new WindowGenerator();
this._itemWindowsTop.init(_loc2_,_loc3_,_loc4_,12,2,0,ItemWindowBook,_loc1_.slice(0,3),"",null,{"currLoaderAppDomain":this._currLoaderAppDomain},null,false,false);
this._itemWindowsBottom.init(_loc2_,_loc3_,_loc5_,12,2,0,ItemWindowBook,_loc1_.slice(3,6),"",null,{"currLoaderAppDomain":this._currLoaderAppDomain},null,false,false);
this._popup.itemWindowTop.addChild(this._itemWindowsTop);
this._popup.itemWindowBtm.addChild(this._itemWindowsBottom);
}
}
private function setupBooksObject() : Array
{
switch(this._type)
{
case LAND_TYPE:
return [{
"mediaId":3839,
"listId":249
},{
"mediaId":3853,
"listId":294
},{
"mediaId":3977,
"listId":315
}];
case OCEAN_TYPE:
return [{
"mediaId":3837,
"listId":240
},{
"mediaId":3840,
"listId":254
}];
case AIR_TYPE:
return [{
"mediaId":3838,
"listId":284
}];
default:
return null;
}
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
if(this._closeCallback != null)
{
this._closeCallback();
}
else
{
this.destroy();
}
}
private function onItemWindowDown(param1:MouseEvent) : void
{
}
private function onItemWindowOver(param1:MouseEvent) : void
{
}
private function onItemWindowOut(param1:MouseEvent) : void
{
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,255 @@
package gui
{
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import localization.LocalizationManager;
public class EmoticonManager
{
private const EMOTEWINDOW_DIM_ALPHA:Number = 0.5;
private const EMOTEWINDOW_BRIGHT_ALPHA:Number = 1;
private var emoteBtn:MovieClip;
private var emoteWindow:MovieClip;
private var emoteBtnsBg:Sprite;
private var actionBtn:MovieClip;
private var actionWindow:Sprite;
private var safeChatBtn:MovieClip;
private var safeChatTree:MovieClip;
private var setEmoteCallback:Function;
private var _useMemberOnlyEmotes:Boolean;
private var _emotes:MovieClip;
public function EmoticonManager(param1:Function, param2:MovieClip, param3:MovieClip, param4:MovieClip, param5:Sprite, param6:MovieClip, param7:MovieClip, param8:Boolean = true)
{
super();
this._useMemberOnlyEmotes = param8;
this.setEmoteCallback = param1;
this.emoteBtn = param2;
this.emoteBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.emoteBtnDownHandler,false,0,true);
this.emoteWindow = param3;
this.addAllEmotes();
this.emoteWindow.visible = false;
this.actionBtn = param4;
this.actionWindow = param5;
this.safeChatBtn = param6;
this.safeChatTree = param7;
this.emoteBtnsBg = GETDEFINITIONBYNAME("emo_mouse");
this.emoteWindow.addChild(this.emoteBtnsBg);
this.emoteBtnsBg.visible = false;
if(param3.titleTxt)
{
LocalizationManager.translateId(param3.titleTxt,6308);
}
}
public function reload(param1:MovieClip, param2:MovieClip, param3:MovieClip, param4:Sprite, param5:MovieClip, param6:MovieClip, param7:Function) : void
{
if(this.emoteBtn)
{
this.emoteBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.emoteBtnDownHandler);
}
this.emoteBtn = param1;
this.emoteBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.emoteBtnDownHandler,false,0,true);
this.emoteWindow = param2;
this.emoteWindow.addChild(this._emotes);
this.emoteWindow.addChild(this.emoteBtnsBg);
this.emoteWindow.visible = false;
this.actionBtn = param3;
this.actionWindow = param4;
this.safeChatBtn = param5;
this.safeChatTree = param6;
this.emoteBtnsBg.visible = false;
this.resetEmotePrivs();
LocalizationManager.translateId(param2.titleTxt,6308);
this.emoteBtn.downToUpState();
this.setEmoteCallback = param7;
}
public function resetEmotePrivs() : void
{
if(gMainFrame.userInfo.isMember)
{
this.emoteWindow.locked.visible = false;
}
else
{
this.emoteWindow.locked.visible = true;
}
}
public function reAddAllEmotes(param1:Boolean = true) : void
{
this._useMemberOnlyEmotes = param1;
if(this._emotes.parent == this.emoteWindow)
{
this.emoteWindow.removeChild(this._emotes);
}
this._emotes = EmoticonUtility.setupEmotes(this.emoteWindow,this._useMemberOnlyEmotes,this.smileyClickHandler,this.smileyRollOverHandler,this.smileyRollOutHandler);
this.emoteWindow.addChild(this._emotes);
}
private function addAllEmotes() : void
{
this._emotes = EmoticonUtility.setupEmotes(this.emoteWindow,this._useMemberOnlyEmotes,this.smileyClickHandler,this.smileyRollOverHandler,this.smileyRollOutHandler);
this.emoteWindow.addChild(this._emotes);
if(this.emoteWindow.hasOwnProperty("locked"))
{
if(this._useMemberOnlyEmotes)
{
this.emoteWindow.setChildIndex(this.emoteWindow.locked,this.emoteWindow.numChildren - 1);
this.emoteWindow.locked.mouseChidren = false;
this.emoteWindow.locked.mouseEnabled = false;
if(gMainFrame.userInfo.isMember)
{
this.emoteWindow.locked.visible = false;
}
else
{
this.emoteWindow.locked.visible = true;
}
}
else
{
this.emoteWindow.titleTxt.visible = false;
this.emoteWindow.memEmoteTop.visible = false;
this.emoteWindow.locked.visible = false;
}
}
}
public function destroy() : void
{
this.setEmoteCallback = null;
this.emoteBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.emoteBtnDownHandler);
this.emoteBtn = null;
this.emoteWindow.visible = false;
this.emoteWindow = null;
this.actionBtn = null;
this.actionWindow = null;
this.safeChatBtn = null;
this.safeChatTree = null;
}
public function openEmotes() : void
{
if(!this.emoteWindow.visible)
{
this.emoteWindow.visible = true;
this.emoteWindow.gotoAndPlay(1);
this.brightenEmotes();
}
}
public function dimEmotes() : void
{
if(this.emoteWindow.visible && this.emoteWindow.alpha != this.EMOTEWINDOW_DIM_ALPHA)
{
this.emoteWindow.alpha = this.EMOTEWINDOW_DIM_ALPHA;
}
}
public function brightenEmotes() : void
{
if(this.emoteWindow.alpha != this.EMOTEWINDOW_BRIGHT_ALPHA)
{
this.emoteWindow.alpha = this.EMOTEWINDOW_BRIGHT_ALPHA;
}
}
public function closeEmotes(param1:Boolean = false) : void
{
if(this.emoteWindow.visible)
{
if(GuiManager.isInFFM && !param1)
{
this.emoteWindow.parent.setChildIndex(this.emoteWindow,this.emoteWindow.parent.numChildren - 1);
}
else
{
this.emoteWindow.visible = false;
this.brightenEmotes();
this.emoteBtn.downToUpState();
}
}
}
private function emoteBtnDownHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(!param1.currentTarget.isGray)
{
if(this.emoteWindow.visible)
{
this.closeEmotes(true);
}
else
{
if(Boolean(this.safeChatTree) && this.safeChatTree.visible)
{
this.safeChatBtn.dispatchEvent(param1);
}
if(Boolean(this.actionWindow) && this.actionWindow.visible)
{
this.actionBtn.dispatchEvent(param1);
}
this.openEmotes();
if(GuiManager.isInFFM)
{
this.emoteBtn.mouseEnabled = false;
this.emoteBtn.mouseChildren = false;
this.emoteBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.emoteBtnDownHandler);
}
}
}
}
private function smileyClickHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(!this.emoteBtn.isGray)
{
if(GuiManager.isInFFM)
{
this.emoteBtn.mouseEnabled = true;
this.emoteBtn.mouseChildren = true;
this.emoteBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.emoteBtnDownHandler,false,0,true);
}
EmoticonUtility.handleSmileyClick(param1.target,this.setEmoteCallback);
this.emoteBtn.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_DOWN));
AJAudio.playSubMenuBtnClick();
}
}
private function smileyRollOverHandler(param1:MouseEvent) : void
{
if(param1.target is MovieClip)
{
MovieClip(param1.target).gotoAndPlay(1);
}
AJAudio.playSubMenuBtnRollover();
this.emoteWindow.setChildIndex(this.emoteBtnsBg,1);
this.emoteBtnsBg.x = param1.currentTarget.x;
this.emoteBtnsBg.y = param1.currentTarget.y;
this.emoteBtnsBg.visible = true;
}
private function smileyRollOutHandler(param1:MouseEvent) : void
{
this.emoteBtnsBg.visible = false;
}
}
}
@@ -0,0 +1,387 @@
package gui
{
import avmplus.getQualifiedClassName;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
public class EmoticonUtility
{
private static var displaySprites:Array = ["emoMO_angry_sml","emoMO_combat_sml","emoMO_confused_sml","emoMO_laugh_sml","emoMO_phantom_sml","emoMO_sad_sml","emoMO_sleep_sml","emoMO_heartbreak_sml","emoMO_lovesick_sml","emoMO_ninja_sml","emoMO_sick_sml","emoMO_smiley_sml","emoMO_sunglasses_sml","emoMO_vampire_sml","emo_peace_sml","emo_angry_sml","emo_blush_sml","emo_confused_sml","emo_cool_sml","emo_cry_sml","emo_evil_sml","emo_grin_sml","emo_happy_sml","emo_laugh_sml","emo_love_sml","emo_rainy_sml","emo_sick_sml","emo_sleep_sml","emo_sneaky_sml","emo_surprise_sml","emo_think_sml","emo_tongue_sml","emo_wink_sml","emo_game_sml","emo_hearts_sml","emo_brokenHeart_sml","emo_burger_sml","emo_icecream_sml","emo_sword_sml","emo_star1_sml","emo_star2_sml","emo_star3_sml"];
private static var emoteSprites:Array = ["emoMO_angry","emoMO_combat","emoMO_confused","emoMO_laugh","emoMO_phantom","emoMO_sad","emoMO_sleep","emoMO_heartbreak","emoMO_lovesick","emoMO_ninja","emoMO_sick","emoMO_smiley","emoMO_sunglasses","emoMO_vampire","emo_peace","emo_angry","emo_blush","emo_confused","emo_cool","emo_cry","emo_evil","emo_grin","emo_happy","emo_laugh","emo_love","emo_rainy","emo_sick","emo_sleep","emo_sneaky","emo_surprise","emo_think","emo_tongue","emo_wink","emo_game","emo_hearts","emo_brokenHeart","emo_burger","emo_icecream","emo_sword","emo_star1","emo_star2","emo_star3"];
private static var _emoteStrings:Object = new Object();
private static var _emoteChatStrings:Object = new Object();
private static const MEMBER_EMOTES_WINDOW_OFFSET_Y:Number = -70;
private static const MEMBER_EMOTES_ROWS:int = 2;
private static const EMOTES_MARGIN_TOP:int = 14;
private static const EMOTES_MARGIN_LEFT:int = 11;
private static const EMOTES_STEP_V:int = 23;
private static const EMOTES_STEP_H:int = 33;
private static const EMOTES_ROW_MAX:uint = 7;
private static const EMOTES_WINDOW_OFFSET_X:Number = -109;
private static const EMOTES_WINDOW_OFFSET_Y:Number = -55;
private static const NUM_MEMBER_EMOTES:int = 14;
_emoteStrings["emoMO_angry"] = [":mad:"];
_emoteStrings["emoMO_combat"] = [":scuffle:"];
_emoteStrings["emoMO_confused"] = [":puzzle:"];
_emoteStrings["emoMO_laugh"] = [":joy:"];
_emoteStrings["emoMO_phantom"] = [":phantom:"];
_emoteStrings["emoMO_sad"] = [":sad:"];
_emoteStrings["emoMO_sleep"] = [":sleepy:"];
_emoteStrings["emoMO_heartbreak"] = [":breakingheart:"];
_emoteStrings["emoMO_lovesick"] = [":lovesick:"];
_emoteStrings["emoMO_ninja"] = [":ninja:"];
_emoteStrings["emoMO_sick"] = [":queasy:"];
_emoteStrings["emoMO_smiley"] = [":smiley:"];
_emoteStrings["emoMO_sunglasses"] = [":sunglasses:"];
_emoteStrings["emoMO_vampire"] = [":vampire:"];
_emoteStrings["emo_peace"] = [":peace:"];
_emoteStrings["emo_angry"] = [":angry:","X(","X-("];
_emoteStrings["emo_blush"] = [":blush:"];
_emoteStrings["emo_brokenHeart"] = [":brokenheart:"];
_emoteStrings["emo_burger"] = [":burger:"];
_emoteStrings["emo_confused"] = [":confused:",":/"];
_emoteStrings["emo_cool"] = [":cool:"];
_emoteStrings["emo_cry"] = [":cry:"];
_emoteStrings["emo_evil"] = [":evil:"];
_emoteStrings["emo_game"] = [":game:"];
_emoteStrings["emo_grin"] = [":D",":grin:"];
_emoteStrings["emo_happy"] = [":)",":happy:"];
_emoteStrings["emo_hearts"] = [":hearts:","<3<3<3"];
_emoteStrings["emo_icecream"] = [":icecream:"];
_emoteStrings["emo_laugh"] = [":laugh:",":))"];
_emoteStrings["emo_love"] = [":love:","(l)","(L)","(^_^)<3"];
_emoteStrings["emo_rainy"] = [":rainy:"];
_emoteStrings["emo_sick"] = [":sick:"];
_emoteStrings["emo_sleep"] = [":tired:","|)","|-)",":zzz:","-_-","-_-zzz","--_"];
_emoteStrings["emo_sneaky"] = [":sneaky:"];
_emoteStrings["emo_surprise"] = [":surprise:",":O",":-O"];
_emoteStrings["emo_sword"] = [":sword:"];
_emoteStrings["emo_think"] = [":think:",":?"];
_emoteStrings["emo_tongue"] = [":P",":p",":tongue:"];
_emoteStrings["emo_wink"] = [":wink:",";)",";-)"];
_emoteStrings["emo_star1"] = [":singlestar:"];
_emoteStrings["emo_star2"] = [":doublestar:"];
_emoteStrings["emo_star3"] = [":triplestar:"];
_emoteChatStrings["emo_happy"] = [":happy:"];
public function EmoticonUtility()
{
super();
}
public static function setupEmotes(param1:MovieClip, param2:Boolean, param3:Function, param4:Function, param5:Function) : MovieClip
{
var _loc9_:Sprite = null;
var _loc6_:int = param2 ? 0 : int(EMOTES_ROW_MAX * MEMBER_EMOTES_ROWS);
var _loc7_:MovieClip = new MovieClip();
var _loc8_:uint = 0;
for(; _loc8_ < displaySprites.length; _loc8_++)
{
_loc9_ = GETDEFINITIONBYNAME(displaySprites[_loc8_]);
if(_loc8_ < EMOTES_ROW_MAX * MEMBER_EMOTES_ROWS)
{
if(!param2)
{
continue;
}
_loc9_.x = EMOTES_MARGIN_LEFT + _loc8_ % EMOTES_ROW_MAX * EMOTES_STEP_H + EMOTES_WINDOW_OFFSET_X;
_loc9_.y = EMOTES_MARGIN_TOP + Math.floor(_loc8_ / EMOTES_ROW_MAX) * EMOTES_STEP_V + MEMBER_EMOTES_WINDOW_OFFSET_Y;
}
else
{
_loc9_.x = EMOTES_MARGIN_LEFT + _loc8_ % EMOTES_ROW_MAX * EMOTES_STEP_H + EMOTES_WINDOW_OFFSET_X;
_loc9_.y = EMOTES_MARGIN_TOP + Math.floor((_loc8_ - _loc6_) / EMOTES_ROW_MAX) * EMOTES_STEP_V + EMOTES_WINDOW_OFFSET_Y;
if(!param2)
{
_loc9_.y += 35;
}
}
_loc7_.addChild(_loc9_);
_loc9_.addChild(GETDEFINITIONBYNAME("emo_place_holder"));
_loc9_.buttonMode = true;
_loc9_.useHandCursor = true;
_loc9_.mouseChildren = false;
_loc9_.tabEnabled = true;
_loc9_.tabChildren = false;
_loc9_.addEventListener(MouseEvent.CLICK,param3,false,0,true);
_loc9_.addEventListener(MouseEvent.ROLL_OVER,param4,false,0,true);
_loc9_.addEventListener(MouseEvent.ROLL_OUT,param4,false,0,true);
}
return _loc7_;
}
public static function getEmoteString(param1:Sprite) : String
{
if(_emoteStrings[getQualifiedClassName(param1)])
{
return _emoteStrings[getQualifiedClassName(param1)][0];
}
return null;
}
public static function matchEmoteString(param1:String, param2:Boolean = false) : Object
{
var _loc3_:Object = null;
var _loc4_:String = null;
for each(_loc4_ in emoteSprites)
{
if(_emoteStrings[_loc4_].indexOf(param1) != -1)
{
if(param2 == false && _loc4_.slice(3,5) == "MO" && !gMainFrame.userInfo.isMember)
{
UpsellManager.displayPopup(UpsellManager.EMOTES,"useLockedEmote");
return {
"sprite":null,
"status":false
};
}
return {
"sprite":GETDEFINITIONBYNAME(_loc4_),
"status":true
};
}
}
return {
"sprite":null,
"status":true
};
}
public static function doesStringMatchAnEmote(param1:String) : Boolean
{
var _loc2_:String = null;
for each(_loc2_ in emoteSprites)
{
if(_emoteStrings[_loc2_].indexOf(param1) != -1)
{
return true;
}
}
return false;
}
public static function emoteForId(param1:int) : Sprite
{
if(param1 >= 0 && param1 < emoteSprites.length)
{
return GETDEFINITIONBYNAME(emoteSprites[param1]);
}
return null;
}
public static function idForEmote(param1:Sprite) : int
{
return emoteSprites.indexOf(getQualifiedClassName(param1));
}
public static function stringForId(param1:int) : String
{
if(param1 >= 0 && param1 < emoteSprites.length)
{
return _emoteStrings[emoteSprites[param1]][0];
}
return null;
}
public static function handleSmileyClick(param1:Object, param2:Function) : void
{
var _loc3_:int = displaySprites.indexOf(getQualifiedClassName(param1));
if(_loc3_ != -1 && _loc3_ < NUM_MEMBER_EMOTES && !gMainFrame.userInfo.isMember)
{
UpsellManager.displayPopup(UpsellManager.EMOTES,"useLockedEmote");
}
else
{
param2(GETDEFINITIONBYNAME(emoteSprites[_loc3_]));
}
}
public static function formatStringForSmiley(param1:String, param2:int, param3:Array, param4:Boolean) : Object
{
var _loc5_:Array = null;
var _loc6_:String = null;
var _loc8_:Boolean = false;
var _loc9_:Boolean = false;
var _loc10_:String = null;
var _loc11_:int = 0;
var _loc12_:RegExp = null;
var _loc13_:Array = null;
var _loc15_:String = null;
var _loc16_:String = null;
var _loc17_:MovieClip = null;
var _loc18_:String = null;
var _loc19_:String = null;
var _loc20_:String = null;
var _loc21_:String = null;
var _loc22_:int = 0;
var _loc23_:Array = null;
var _loc24_:Boolean = false;
var _loc7_:Array = [];
for each(_loc5_ in _emoteChatStrings)
{
for each(_loc6_ in _loc5_)
{
_loc12_ = new RegExp(_loc6_,"gim");
_loc7_ = param1.split(_loc12_);
if(param4)
{
param1 = _loc7_.join("|*|" + _loc6_);
}
else if(_loc7_.length > 1)
{
param1 = "";
_loc11_ = 0;
while(_loc11_ < _loc7_.length)
{
_loc10_ = _loc7_[_loc11_];
if(_loc11_ == 0 && _loc10_ != " ")
{
param1 += _loc10_;
}
else if(!_loc8_)
{
if(_loc10_ != "" && _loc10_ != " ")
{
param1 += "|*|" + _loc6_ + _loc10_;
}
else
{
param1 += "|*|" + _loc6_;
}
_loc8_ = true;
}
else if(_loc10_ != "" && _loc10_ != " ")
{
param1 += _loc10_;
}
_loc11_++;
}
}
}
}
_loc13_ = param1.split("|*|");
if(_loc13_[0] == "")
{
_loc13_.shift();
}
var _loc14_:String = "false";
for(_loc6_ in _loc13_)
{
if(_loc6_ == "0" && _loc13_[_loc6_] == "")
{
_loc14_ = "true";
}
for(_loc16_ in _emoteChatStrings)
{
for each(_loc15_ in _emoteChatStrings[_loc16_])
{
_loc20_ = _loc13_[_loc6_];
if(_loc20_ == "" || _loc20_.charAt() == " ")
{
break;
}
_loc19_ = _loc15_;
_loc22_ = _loc20_.indexOf(_loc19_);
if(_loc22_ != -1)
{
_loc21_ = "";
_loc11_ = 0;
while(_loc11_ < _loc15_.length)
{
_loc21_ += _loc20_.charAt(_loc22_ + _loc11_);
_loc11_++;
}
}
if(_loc21_ == _loc19_)
{
if(_loc16_.slice(3,5) == "MO" && !gMainFrame.userInfo.isMember)
{
break;
}
_loc17_ = GETDEFINITIONBYNAME(_loc16_ + "_sml");
_loc17_.y -= 3;
if(_loc14_ == "false" && _loc13_[_loc6_].charAt(_loc13_[_loc6_].length - 1) != "")
{
_loc24_ = true;
}
if(_loc17_.width <= 20)
{
_loc18_ = " .";
}
else if(_loc17_.width <= 22)
{
_loc18_ = " . ";
}
else if(_loc17_.width <= 25)
{
_loc18_ = " . ";
}
else
{
_loc18_ = " . ";
}
_loc13_[_loc6_] = _loc18_ + (_loc24_ == true ? " " : "") + _loc13_[_loc6_].substr(_loc15_.length,_loc13_[_loc6_].length);
param3.push({
"strindex":param2,
"emoticon":_loc17_,
"added":false,
"smileystart":_loc14_
});
break;
}
}
}
_loc23_ = _loc13_[_loc6_].split("");
param2 += _loc23_.length;
}
return {
"str":_loc13_.join(""),
"smileyArray":param3,
"stringIndex":param2
};
}
public static function getSmallSmileyMCForEmoteString(param1:String) : MovieClip
{
var _loc2_:String = null;
var _loc3_:String = null;
loop0:
for(_loc2_ in _emoteStrings)
{
var _loc6_:int = 0;
var _loc7_:* = _emoteStrings[_loc2_];
do
{
for each(_loc3_ in _loc7_)
{
}
continue loop0;
}
while(_loc3_ != param1);
if(_loc2_.slice(3,5) == "MO" && !gMainFrame.userInfo.isMember)
{
return null;
}
return GETDEFINITIONBYNAME(_loc2_ + "_sml");
}
return null;
}
}
}
@@ -0,0 +1,558 @@
package gui
{
import achievement.AchievementXtCommManager;
import com.sbi.analytics.SBTracker;
import com.sbi.client.KeepAlive;
import com.sbi.popup.SBStandardTitlePopup;
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.events.MouseEvent;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import flash.net.URLRequestHeader;
import flash.net.URLRequestMethod;
import flash.utils.ByteArray;
import flash.utils.Endian;
import loader.FeedbackDefHelper;
import loader.MediaHelper;
import localization.LocalizationManager;
public class FeedbackManager
{
private static var _feedbackDefCache:Array;
private static var _feedbackLocs:Array;
private static var _feedbackDefHelpers:Array;
private static var _tabMediaHelper:MediaHelper;
private static var _tabTemplate:MovieClip;
private static var _popupMediaHelper:MediaHelper;
private static var _popup:MovieClip;
private static var _imageUploader:UserImageUpload;
private static var _guiLayer:DisplayLayer;
private static var _worldLayer:DisplayLayer;
private static var _secondaryType:int;
public static const TYPE_ASK_BRADY:int = 1;
public static const TYPE_ITEMS:int = 2;
public static const TYPE_HOWL:int = 3;
public static const TYPE_WORK:int = 4;
public static const TYPE_SERVERS:int = 5;
public static const TYPE_FLAGS:int = 6;
public static const TYPE_PETS:int = 7;
public static const TYPE_PARTIES:int = 8;
public static const TYPE_EPIC_ITEMS:int = 9;
public static const TYPE_ARCADE:int = 10;
public static const TYPE_ASK_TIERNEY:int = 11;
public static const TYPE_DONATION:int = 12;
public static const TYPE_CARNIVAL:int = 13;
public static const TYPE_ARTSTUDIO:int = 14;
public static const TYPE_JAMSESSION:int = 15;
public static const TYPE_DIAMOND:int = 16;
public static const TYPE_ADVENTURE:int = 17;
public static const TYPE_DICTIONARY:int = 18;
private static const TAB_MEDIA_ID:int = 153;
private static const POPUP_MEDIA_ID:int = 457;
private static const TAB_FRAME_LABEL:String = "answer";
public function FeedbackManager()
{
super();
}
public static function init(param1:DisplayLayer, param2:DisplayLayer) : void
{
_feedbackDefCache = [];
_guiLayer = param1;
_worldLayer = param2;
_popupMediaHelper = new MediaHelper();
_tabMediaHelper = new MediaHelper();
_tabMediaHelper.init(TAB_MEDIA_ID,mediaHelperCallback,true);
_imageUploader = new UserImageUpload();
_imageUploader.init();
}
public static function setUpOrbs(param1:Array, param2:Array) : void
{
var _loc4_:Object = null;
var _loc5_:FeedbackDefHelper = null;
_feedbackLocs = param2;
_feedbackDefHelpers = [];
var _loc3_:int = 0;
while(_loc3_ < param1.length)
{
if(param1[_loc3_] == 0)
{
DarkenManager.showLoadingSpiral(false);
throw new Error("Id == 0");
}
_loc4_ = _feedbackDefCache[param1[_loc3_]];
if(!_loc4_)
{
_loc5_ = new FeedbackDefHelper();
_loc5_.init(param1[_loc3_],onDefReceived);
_feedbackDefHelpers[param1[_loc3_]] = _loc5_;
}
else
{
setUpOrb(_loc4_);
}
_loc3_++;
}
}
public static function openFeedbackPopup(param1:int) : void
{
var _loc3_:FeedbackDefHelper = null;
if(param1 == 0)
{
DarkenManager.showLoadingSpiral(false);
throw new Error("Id == 0");
}
DarkenManager.showLoadingSpiral(true);
if(!_feedbackDefHelpers)
{
_feedbackDefHelpers = [];
}
var _loc2_:Object = _feedbackDefCache[param1];
if(!_loc2_)
{
_loc3_ = new FeedbackDefHelper();
_loc3_.init(param1,onDefReceived);
_feedbackDefHelpers[param1] = _loc3_;
}
else
{
displayFeedbackPopup(_loc2_);
}
}
private static function onDefReceived(param1:FeedbackDefHelper) : void
{
var _loc2_:Object = param1.def;
var _loc3_:String = LocalizationManager.translateIdOnly(int(_loc2_.defaultStrRef));
var _loc4_:RegExp = /\r\n/g;
_loc3_ = _loc3_.replace(_loc4_,"\n");
_loc4_ = /\r/g;
_loc3_ = _loc3_.replace(_loc4_,"\n");
var _loc5_:Object = {
"id":int(_loc2_.id),
"titleTxt":LocalizationManager.translateIdOnly(int(_loc2_.titleStrRef)),
"defaultTxt":_loc3_,
"thanksTxt":LocalizationManager.translateIdOnly(int(_loc2_.thankStrRef)),
"allowImg":Boolean(int(_loc2_.bAcceptImage)),
"userVarId":int(_loc2_.userVarRef),
"bitIdx":int(_loc2_.bitIndex)
};
_feedbackDefCache[_loc5_.id] = _loc5_;
_feedbackDefHelpers[_loc5_.id] = null;
_loc5_.seen = gMainFrame.userInfo.userVarCache.isBitSet(_loc5_.userVarId,_loc5_.bitIdx);
if(_loc5_.id == TYPE_ASK_BRADY || _loc5_.id == TYPE_ASK_TIERNEY || _loc5_.id == TYPE_HOWL || _loc5_.id == TYPE_WORK || _loc5_.id == TYPE_SERVERS || _loc5_.id == TYPE_DICTIONARY)
{
displayFeedbackPopup(_loc5_);
}
else
{
setUpOrb(_loc5_);
}
}
private static function setUpOrb(param1:Object) : void
{
var _loc2_:MovieClip = null;
var _loc3_:int = 0;
if(_tabTemplate)
{
_loc2_ = new _tabTemplate.constructor();
_loc2_.def = param1;
_loc3_ = int(_loc2_.id = int(param1.id));
_loc2_.x = _feedbackLocs[_loc3_].x;
_loc2_.y = _feedbackLocs[_loc3_].y;
if(param1.seen)
{
_loc2_.gotoAndPlay(TAB_FRAME_LABEL + "Dim");
}
else
{
_loc2_.gotoAndPlay(TAB_FRAME_LABEL);
}
_loc2_.addEventListener(MouseEvent.MOUSE_DOWN,onTabMouseDown,false,0,true);
_worldLayer.addChild(_loc2_);
}
}
private static function mediaHelperCallback(param1:MovieClip) : void
{
var _loc2_:int = 0;
if(param1)
{
if(param1.mediaHelper.id == TAB_MEDIA_ID)
{
_loc2_ = int(param1.mediaHelper.id);
_tabTemplate = MovieClip(param1.getChildAt(0));
_tabMediaHelper.destroy();
_tabMediaHelper = null;
}
else if(param1.mediaHelper.id == POPUP_MEDIA_ID)
{
_popup = param1;
_popupMediaHelper.destroy();
_popupMediaHelper = null;
_popup.x = MainFrame.VIEW_WIDTH * 0.5;
_popup.y = MainFrame.VIEW_HEIGHT * 0.5;
_popup.parent.x = _popup.x;
_popup.parent.y = _popup.y;
displayFeedbackPopup(param1.passback);
}
}
}
private static function onTabMouseDown(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:MovieClip = MovieClip(param1.currentTarget);
var _loc3_:Object = _loc2_.def;
SBTracker.push();
SBTracker.trackPageview("/game/play/popup/feedback/" + _loc3_.id);
DarkenManager.showLoadingSpiral(true);
if(!_loc3_.seen)
{
_loc2_.gotoAndPlay(TAB_FRAME_LABEL + "Dim");
}
displayFeedbackPopup(_loc3_);
}
public static function displayFeedbackPopup(param1:Object) : void
{
var _loc3_:Array = null;
var _loc2_:int = int(param1.id);
if(!_popup)
{
_popupMediaHelper.init(POPUP_MEDIA_ID,mediaHelperCallback,param1);
return;
}
if(!param1.seen)
{
param1.seen = true;
AchievementXtCommManager.requestSetUserVar(param1.userVarId,param1.bitIdx);
}
_popup.gotoAndStop(frameLabelForType(_loc2_));
_popup.submitBtn.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown,false,0,true);
_popup.bx.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown,false,0,true);
_popup.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown,false,0,true);
_popup.txt.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown,false,0,true);
_popup.def = param1;
if(_popup["descTxt"])
{
_loc3_ = param1.defaultTxt.split("|");
LocalizationManager.updateToFit(_popup.descTxt,_loc3_[0]);
LocalizationManager.updateToFit(_popup.txt,_loc3_[1]);
}
else
{
LocalizationManager.updateToFit(_popup.txt,param1.defaultTxt);
}
_popup.defaultTxt = _popup.txt.text;
_popup.titleTxt.text = param1.titleTxt;
if(param1.allowImg)
{
_popup.addFileBtn.visible = true;
_imageUploader.setUploadBtn(_popup.addFileBtn);
_popup.removeFileBtn.addEventListener(MouseEvent.MOUSE_DOWN,onRemoveFileBtn,false,0,true);
}
else
{
if(_popup.addFileBtn)
{
_popup.addFileBtn.visible = false;
}
if(_popup.removeFileBtn)
{
_popup.removeFileBtn.visible = false;
}
}
_popup.txt.maxChars = maxCharsForType(_loc2_);
if(_loc2_ == TYPE_DICTIONARY)
{
_popup.txt.restrict = "^ ";
}
else
{
_popup.txt.restrict = null;
}
_popup.visible = true;
_popup.clickedTextBox = false;
KeepAlive.startKATimer(_popup);
DarkenManager.showLoadingSpiral(false);
DarkenManager.darken(DisplayObjectContainer(_popup));
_guiLayer.addChild(DisplayObjectContainer(_popup));
}
private static function frameLabelForType(param1:int) : int
{
switch(param1)
{
case TYPE_ASK_BRADY:
return 1;
case TYPE_HOWL:
return 2;
case TYPE_WORK:
case TYPE_ITEMS:
case TYPE_SERVERS:
case TYPE_FLAGS:
case TYPE_PETS:
case TYPE_PARTIES:
case TYPE_EPIC_ITEMS:
case TYPE_ARCADE:
case TYPE_CARNIVAL:
case TYPE_JAMSESSION:
case TYPE_DIAMOND:
case TYPE_ADVENTURE:
return 3;
case TYPE_ASK_TIERNEY:
return 4;
case TYPE_DICTIONARY:
return 6;
default:
return 1;
}
}
private static function maxCharsForType(param1:int) : int
{
switch(param1)
{
case TYPE_ASK_BRADY:
case TYPE_ASK_TIERNEY:
return 150;
case TYPE_HOWL:
return 50;
case TYPE_WORK:
return 3000;
case TYPE_ITEMS:
case TYPE_SERVERS:
case TYPE_FLAGS:
case TYPE_PARTIES:
case TYPE_EPIC_ITEMS:
case TYPE_ARCADE:
case TYPE_CARNIVAL:
case TYPE_JAMSESSION:
case TYPE_DIAMOND:
case TYPE_DONATION:
case TYPE_PETS:
case TYPE_ARTSTUDIO:
return 100;
case TYPE_ADVENTURE:
return 200;
case TYPE_DICTIONARY:
return 25;
default:
return 1;
}
}
private static function onRemoveFileBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
_imageUploader.resetUploader();
_popup.addFileBtn.visible = true;
}
private static function onMouseDown(param1:MouseEvent) : void
{
var _loc2_:String = null;
var _loc3_:RegExp = null;
param1.stopPropagation();
if(param1.currentTarget == _popup)
{
return;
}
if(param1.currentTarget == _popup.txt)
{
if(!_popup.clickedTextBox)
{
_popup.txt.text = "";
_popup.clickedTextBox = true;
gMainFrame.stage.focus = _popup.txt;
_popup.txt.setSelection(0,0);
}
return;
}
if(param1.currentTarget.name == "submitBtn")
{
_loc2_ = _popup.txt.text;
_loc3_ = /\r\n/g;
_loc2_ = _loc2_.replace(_loc3_,"\n");
_loc3_ = /\r/g;
_loc2_ = _loc2_.replace(_loc3_,"\n");
if(_loc2_.length > 0 && _loc2_ != _popup.defaultTxt || _imageUploader.fileName != "")
{
if(_loc2_ == _popup.def.defaultTxt)
{
_loc2_ = _popup.txt.text = "";
}
setupRequest(_imageUploader,_loc2_,_popup.def.id,_secondaryType,onSendComplete,onSendError);
}
}
_popup.removeEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
_popup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
_popup.submitBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
_popup.txt.removeEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
if(_popup.def.allowImg)
{
_imageUploader.resetUploader();
_popup.addFileBtn.visible = true;
_popup.removeFileBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onRemoveFileBtn);
}
DarkenManager.unDarken(_popup);
_popup.visible = false;
SBTracker.pop();
if(param1.currentTarget.name != "bx")
{
new SBStandardTitlePopup(_guiLayer,_popup.def.thanksTxt);
}
KeepAlive.stopKATimer(_popup);
}
public static function setupRequest(param1:UserImageUpload, param2:String, param3:int, param4:int, param5:Function, param6:Function) : void
{
var _loc7_:String = "---------------------------" + Math.floor(Math.random() * 100000000000000);
var _loc8_:Object = {
"userName":gMainFrame.userInfo.myUserName,
"type":param3,
"message":param2,
"secondaryType":param4,
"languageId":LocalizationManager.currentLanguage
};
var _loc9_:URLRequest = new URLRequest(gMainFrame.clientInfo.mdUrl + "fb");
_loc9_.contentType = "multipart/form-data; boundary=" + _loc7_;
_loc9_.requestHeaders.push(new URLRequestHeader("Cache-Control","no-cache"));
_loc9_.method = URLRequestMethod.POST;
_loc9_.data = createPostData(param1.fileName,param1.uploadedImage,_loc7_,_loc8_);
var _loc10_:URLLoader = new URLLoader();
_loc10_.dataFormat = URLLoaderDataFormat.BINARY;
_loc10_.addEventListener(Event.COMPLETE,param5);
_loc10_.addEventListener(IOErrorEvent.IO_ERROR,param6);
_loc10_.load(_loc9_);
}
public static function createPostData(param1:String, param2:ByteArray, param3:String, param4:Object = null) : ByteArray
{
var _loc5_:String = null;
var _loc7_:String = null;
var _loc8_:int = 0;
var _loc6_:ByteArray = new ByteArray();
_loc6_.endian = Endian.BIG_ENDIAN;
if(param4 == null)
{
param4 = new Object();
}
for(_loc7_ in param4)
{
writeBoundary(_loc6_,param3);
writeLineBreak(_loc6_);
_loc5_ = "Content-Disposition: form-data; name=\"" + _loc7_ + "\"";
_loc8_ = 0;
while(_loc8_ < _loc5_.length)
{
_loc6_.writeByte(_loc5_.charCodeAt(_loc8_));
_loc8_++;
}
writeLineBreak(_loc6_);
writeLineBreak(_loc6_);
_loc6_.writeUTFBytes(param4[_loc7_]);
writeLineBreak(_loc6_);
}
if(param2)
{
writeBoundary(_loc6_,param3);
writeLineBreak(_loc6_);
_loc5_ = "Content-Disposition: form-data; name=\"image\"; filename=\"" + param1 + "\"";
_loc8_ = 0;
while(_loc8_ < _loc5_.length)
{
_loc6_.writeByte(_loc5_.charCodeAt(_loc8_));
_loc8_++;
}
writeLineBreak(_loc6_);
_loc5_ = "Content-Type: image/jpeg";
_loc8_ = 0;
while(_loc8_ < _loc5_.length)
{
_loc6_.writeByte(_loc5_.charCodeAt(_loc8_));
_loc8_++;
}
writeLineBreak(_loc6_);
writeLineBreak(_loc6_);
_loc6_.writeBytes(param2,0,param2.length);
writeLineBreak(_loc6_);
}
writeBoundary(_loc6_,param3);
writeDoubleDash(_loc6_);
writeLineBreak(_loc6_);
return _loc6_;
}
private static function writeLineBreak(param1:ByteArray) : void
{
param1.writeShort(3338);
}
private static function writeDoubleDash(param1:ByteArray) : void
{
param1.writeShort(11565);
}
private static function writeBoundary(param1:ByteArray, param2:String) : void
{
writeDoubleDash(param1);
var _loc3_:int = 0;
while(_loc3_ < param2.length)
{
param1.writeByte(param2.charCodeAt(_loc3_));
_loc3_++;
}
}
private static function onSendComplete(param1:Event) : void
{
}
private static function onSendError(param1:Event) : void
{
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,43 @@
package gui
{
import flash.text.Font;
import flash.text.TextFormat;
public class Fonts
{
public static var defaultFont:Font;
public static var defaultFontBold:Font;
public static var titleFont:Font;
public static var defaultFontFormat:TextFormat;
public static var defaultFontBoldFormat:TextFormat;
public static var defaultFontRedFormat:TextFormat;
public static var defaultFontBlackFormat:TextFormat;
public static var titleFontFormat:TextFormat;
public function Fonts()
{
super();
}
public static function init() : void
{
defaultFontFormat = new TextFormat();
defaultFontBoldFormat = new TextFormat();
defaultFontBoldFormat.bold = true;
defaultFontRedFormat = new TextFormat();
defaultFontRedFormat.color = 13369344;
defaultFontBlackFormat = new TextFormat();
defaultFontBlackFormat.color = 0;
titleFontFormat = new TextFormat();
}
}
}
@@ -0,0 +1,598 @@
package gui
{
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.utils.Dictionary;
import flash.utils.getTimer;
import game.MinigameManager;
import game.MinigameXtCommManager;
import loader.MediaHelper;
import localization.LocalizationManager;
public class GameCardPopup
{
private static var instrObjs:Object;
private static const LEADERBOARD_TYPE_ALLTIME:int = 1;
private static const LEADERBOARD_TYPE_THISWEEK:int = 2;
private static const LEADERBOARD_TYPE_BUDDY:int = 3;
private var _onStartClicked:Function;
private var _thePopup:MovieClip;
private var _mediaHelper:MediaHelper;
private var _parent:DisplayObjectContainer;
private var _gameCard:Sprite;
private var _onInstrClicked:Function;
private var _onCloseCallback:Function;
private var _showProModeBtn:Boolean;
private var _proModeValue:Number;
private var _isMultiplayer:Boolean;
private var _originalBX:int;
private var _joinGamePopup:MovieClip;
private var _instructionsPopup:MovieClip;
private var _instrInfo:Object;
private var _numScreens:int;
private var _currScreen:int;
private var _gameName:String;
private var _leaderBoardCache:Dictionary;
private var _joinGameObj:Object;
private var _showLeaderBoard:Boolean;
public function GameCardPopup(param1:DisplayObjectContainer, param2:Object, param3:Function, param4:Function)
{
super();
DarkenManager.showLoadingSpiral(true);
this._parent = param1;
this._joinGameObj = param2;
this._gameCard = param2.mi.gameCardScreen;
this._onStartClicked = param3;
this._onCloseCallback = param4;
var _loc5_:int = int(this._joinGameObj.mi.proModeUserVarRefId);
this._showProModeBtn = _loc5_ > 0;
this._proModeValue = gMainFrame.userInfo.userVarCache.getUserVarValueById(_loc5_);
this._isMultiplayer = this._joinGameObj.mi.maxPlayers > 1;
this._gameName = this._joinGameObj.swfName;
this._showLeaderBoard = false;
if(instrObjs == null)
{
this.setupInstructions();
}
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(3754,this.onGameCardLoaded);
}
public function destroy() : void
{
this.removeEventListeners();
this._mediaHelper.destroy();
this._mediaHelper = null;
DarkenManager.unDarken(this._thePopup);
this._parent.removeChild(this._thePopup);
this._thePopup = null;
}
private function setupInstructions() : void
{
instrObjs = new Object();
var _loc1_:Object = instrObjs["Pachinko"] = new Object();
_loc1_.name = 11284;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11285;
_loc1_.instrTxts[1] = 11286;
_loc1_ = instrObjs["MiniGame_Memory"] = new Object();
_loc1_.name = 11287;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11288;
_loc1_.instrTxts[1] = 11289;
_loc1_ = instrObjs["MoatMadness"] = new Object();
_loc1_.name = 11290;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11291;
_loc1_.instrTxts[1] = 11292;
_loc1_ = instrObjs["ParachuteGlider"] = new Object();
_loc1_.name = 11293;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11294;
_loc1_.instrTxts[1] = 11295;
_loc1_ = instrObjs["QuestParachuteGlider"] = new Object();
_loc1_.name = 11293;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11294;
_loc1_.instrTxts[1] = 11295;
_loc1_ = instrObjs["Trivia"] = new Object();
_loc1_.name = 11299;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11297;
_loc1_.instrTxts[1] = 11298;
_loc1_ = instrObjs["PhantomFighter"] = new Object();
_loc1_.name = 11300;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11301;
_loc1_.instrTxts[1] = 11302;
_loc1_ = instrObjs["SpiderShooter"] = new Object();
_loc1_.name = 11303;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11304;
_loc1_.instrTxts[1] = 11305;
_loc1_ = instrObjs["RiverRace"] = new Object();
_loc1_.name = 11306;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11307;
_loc1_.instrTxts[1] = 11308;
_loc1_ = instrObjs["WindRider"] = new Object();
_loc1_.name = 11309;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11310;
_loc1_.instrTxts[1] = 11311;
_loc1_ = instrObjs["DistanceChallenge"] = new Object();
_loc1_.name = 11312;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11313;
_loc1_.instrTxts[1] = 11314;
_loc1_ = instrObjs["Twister"] = new Object();
_loc1_.name = 11315;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11316;
_loc1_.instrTxts[1] = 11317;
_loc1_ = instrObjs["MicroMiraSays"] = new Object();
_loc1_.name = 11318;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11319;
_loc1_.instrTxts[1] = 11320;
_loc1_ = instrObjs["GemBreaker"] = new Object();
_loc1_.name = 11321;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11322;
_loc1_.instrTxts[1] = 11323;
_loc1_ = instrObjs["SuperSort"] = new Object();
_loc1_.name = 11324;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11325;
_loc1_.instrTxts[1] = 11326;
_loc1_ = instrObjs["TowerDefense"] = new Object();
_loc1_.name = 11327;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11328;
_loc1_.instrTxts[1] = 11329;
_loc1_ = instrObjs["FortSmasher"] = new Object();
_loc1_.name = 11330;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11331;
_loc1_.instrTxts[1] = 11332;
_loc1_ = instrObjs["PillBugs"] = new Object();
_loc1_.name = 11333;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11334;
_loc1_.instrTxts[1] = 11335;
_loc1_ = instrObjs["FeedingFrenzy"] = new Object();
_loc1_.name = 11336;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11337;
_loc1_.instrTxts[1] = 11338;
_loc1_ = instrObjs["PhantomsTreasure"] = new Object();
_loc1_.name = 11339;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11340;
_loc1_.instrTxts[1] = 11341;
_loc1_ = instrObjs["FashionShow"] = new Object();
_loc1_.name = 11342;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11343;
_loc1_.instrTxts[1] = 11344;
_loc1_ = instrObjs["Adventure"] = new Object();
_loc1_.name = "Adventure";
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = "\nHOW TO PLAY\n\n TBD.";
_loc1_.instrTxts[1] = "\nHINT!\n\n Just Play!";
_loc1_ = instrObjs["HorseRace"] = new Object();
_loc1_.name = 11348;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11349;
_loc1_.instrTxts[1] = 11350;
_loc1_ = instrObjs["FallingPhantoms"] = new Object();
_loc1_.name = 11351;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11352;
_loc1_.instrTxts[1] = 11353;
_loc1_ = instrObjs["HedgeHog"] = new Object();
_loc1_.name = 11354;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11355;
_loc1_.instrTxts[1] = 11356;
_loc1_ = instrObjs["DolphinRace"] = new Object();
_loc1_.name = 11357;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 11358;
_loc1_.instrTxts[1] = 11359;
_loc1_ = instrObjs["EagleFlap"] = new Object();
_loc1_.name = 15735;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 15740;
_loc1_.instrTxts[1] = 15741;
_loc1_ = instrObjs["SpotOn"] = new Object();
_loc1_.name = 19654;
_loc1_.instrTxts = [];
_loc1_.instrTxts[0] = 19686;
_loc1_.instrTxts[1] = 19687;
}
private function onGameCardLoaded(param1:MovieClip) : void
{
this._thePopup = MovieClip(param1.getChildAt(0));
this._joinGamePopup = this._thePopup.joinGame;
this._instructionsPopup = this._thePopup.instructions;
this.addEventListeners();
if(this._joinGamePopup.msg)
{
this._joinGamePopup.msg.visible = false;
}
this._instructionsPopup.visible = false;
this._joinGamePopup.visible = true;
if(this._joinGamePopup.hasOwnProperty("gameTitle") && this._gameCard != null)
{
this._joinGamePopup.gameTitle.addChild(this._gameCard);
}
if(this._isMultiplayer && !Utility.canMultiplayer())
{
this._joinGamePopup.startBtn.activateGrayState(true);
this._joinGamePopup.proStartBtn.activateGrayState(true);
}
if(this._showProModeBtn)
{
this._joinGamePopup.gotoAndPlay("pro");
if(this._proModeValue <= 0)
{
this._joinGamePopup.proStartBtn.activateGrayState(true);
}
}
this._thePopup.x = MainFrame.VIEW_WIDTH * 0.5;
this._thePopup.y = MainFrame.VIEW_HEIGHT * 0.5;
this._originalBX = this._thePopup.bx.y;
DarkenManager.showLoadingSpiral(false);
this._parent.addChild(this._thePopup);
DarkenManager.darken(this._thePopup);
}
private function getVisibleLeaderBoard() : int
{
if(this._thePopup.leaderboards_popup.thisWeekUp.visible)
{
return LEADERBOARD_TYPE_THISWEEK;
}
if(this._thePopup.leaderboards_popup.allTimeUp.visible)
{
return LEADERBOARD_TYPE_ALLTIME;
}
return LEADERBOARD_TYPE_BUDDY;
}
private function addEventListeners() : void
{
this._thePopup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
this._thePopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
this._joinGamePopup.startBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onAnyStartClicked,false,0,true);
this._joinGamePopup.proStartBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onAnyStartClicked,false,0,true);
this._joinGamePopup.instrBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onInstructionsClicked,false,0,true);
if(this._showLeaderBoard)
{
this._joinGamePopup.leaderboardsButton.gotoAndStop("active");
this._joinGamePopup.leaderboards_popup.thisWeekDown.addEventListener(MouseEvent.MOUSE_DOWN,this.thisWeekClicked,false,0,true);
this._joinGamePopup.leaderboards_popup.buddiesDown.addEventListener(MouseEvent.MOUSE_DOWN,this.buddiesClicked,false,0,true);
this._joinGamePopup.leaderboards_popup.allTimeDown.addEventListener(MouseEvent.MOUSE_DOWN,this.allTimeClicked,false,0,true);
this._joinGamePopup.leaderboards_popup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.leaderBoardBXClicked,false,0,true);
this._joinGamePopup.leaderboardsButton.btn.addEventListener(MouseEvent.MOUSE_DOWN,this.leaderBoardClicked,false,0,true);
}
this._instructionsPopup.backBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.backHandler,false,0,true);
this._instructionsPopup.backToMainBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.backBtnHandlerOnFirstScreen,false,0,true);
this._instructionsPopup.nextBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.nextHandler,false,0,true);
}
private function removeEventListeners() : void
{
this._thePopup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
this._thePopup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
this._joinGamePopup.startBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onAnyStartClicked);
this._joinGamePopup.proStartBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onAnyStartClicked);
this._joinGamePopup.instrBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onInstructionsClicked);
if(this._showLeaderBoard)
{
this._joinGamePopup.leaderboards_popup.thisWeekDown.removeEventListener(MouseEvent.MOUSE_DOWN,this.thisWeekClicked);
this._joinGamePopup.leaderboards_popup.buddiesDown.removeEventListener(MouseEvent.MOUSE_DOWN,this.buddiesClicked);
this._joinGamePopup.leaderboards_popup.allTimeDown.removeEventListener(MouseEvent.MOUSE_DOWN,this.allTimeClicked);
this._joinGamePopup.leaderboards_popup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.leaderBoardBXClicked);
this._joinGamePopup.leaderboardsButton.btn.removeEventListener(MouseEvent.MOUSE_DOWN,this.leaderBoardClicked);
}
this._instructionsPopup.backBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.backHandler);
this._instructionsPopup.backToMainBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.backBtnHandlerOnFirstScreen);
this._instructionsPopup.nextBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.nextHandler);
}
private function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
if(this._onCloseCallback != null)
{
this._onCloseCallback();
}
else
{
this.destroy();
}
}
private function thisWeekClicked(param1:MouseEvent) : void
{
param1.stopPropagation();
this._joinGamePopup.leaderboards_popup.thisWeekUp.visible = true;
this._joinGamePopup.leaderboards_popup.allTimeUp.visible = false;
this._joinGamePopup.leaderboards_popup.buddiesUp.visible = false;
this.onLeaderBoardSelected();
}
private function buddiesClicked(param1:MouseEvent) : void
{
param1.stopPropagation();
this._joinGamePopup.leaderboards_popup.thisWeekUp.visible = false;
this._joinGamePopup.leaderboards_popup.allTimeUp.visible = false;
this._joinGamePopup.leaderboards_popup.buddiesUp.visible = true;
this.onLeaderBoardSelected();
}
private function allTimeClicked(param1:MouseEvent) : void
{
param1.stopPropagation();
this._joinGamePopup.leaderboards_popup.thisWeekUp.visible = false;
this._joinGamePopup.leaderboards_popup.allTimeUp.visible = true;
this._joinGamePopup.leaderboards_popup.buddiesUp.visible = false;
this.onLeaderBoardSelected();
}
private function leaderBoardClicked(param1:MouseEvent) : void
{
param1.stopPropagation();
this._joinGamePopup.leaderboardsButton.gotoAndPlay("off");
this._joinGamePopup.gotoAndPlay("normal_l");
this._joinGamePopup.gotoAndPlay("pro_l");
this._thePopup.bx.y = -1000;
if(this._joinGameObj != null && this._joinGameObj.typeDefId != -1)
{
this.onLeaderBoardSelected();
}
}
private function leaderBoardBXClicked(param1:MouseEvent) : void
{
param1.stopPropagation();
this._joinGamePopup.leaderboardsButton.gotoAndPlay("on");
this._joinGamePopup.gotoAndPlay("normal_l_close");
this._joinGamePopup.gotoAndPlay("pro_l_close");
this._thePopup.bx.y = this._originalBX;
}
public function onLeaderBoardSelected() : void
{
if(this._thePopup != null && this._joinGameObj != null && this._joinGameObj.typeDefId != -1)
{
this._leaderBoardCache = MinigameManager.getLeaderBoardCache();
if(this._leaderBoardCache[this._joinGameObj.typeDefId] != null && getTimer() - this._leaderBoardCache[this._joinGameObj.typeDefId]._cacheTime < 60000)
{
switch(this.getVisibleLeaderBoard())
{
case LEADERBOARD_TYPE_ALLTIME:
this.populateLeaderBoard(this._leaderBoardCache[this._joinGameObj.typeDefId]._allTime);
break;
case LEADERBOARD_TYPE_BUDDY:
this.populateLeaderBoard(this._leaderBoardCache[this._joinGameObj.typeDefId]._buddy);
break;
case LEADERBOARD_TYPE_THISWEEK:
this.populateLeaderBoard(this._leaderBoardCache[this._joinGameObj.typeDefId]._thisWeek);
}
}
else
{
this.populateLeaderBoard(null);
DarkenManager.showLoadingSpiral(true);
MinigameXtCommManager.sendMinigameLeaderboardRequest(this._joinGameObj.typeDefId);
}
}
}
private function populateLeaderBoard(param1:Array) : void
{
var _loc2_:int = 0;
if(param1 != null && param1.length > 0)
{
if(param1[0]._score != -1)
{
this._joinGamePopup.leaderboards_popup["p11"].text = param1[0]._name;
this._joinGamePopup.leaderboards_popup["s11"].text = param1[0]._score;
}
else
{
this._joinGamePopup.leaderboards_popup["p11"].text = "";
this._joinGamePopup.leaderboards_popup["s11"].text = "";
}
_loc2_ = 1;
while(_loc2_ < 11)
{
if(_loc2_ < param1.length)
{
this._joinGamePopup.leaderboards_popup["p" + _loc2_].text = param1[_loc2_]._name;
this._joinGamePopup.leaderboards_popup["s" + _loc2_].text = param1[_loc2_]._score;
if(param1[_loc2_]._name == param1[0]._name)
{
this._joinGamePopup.leaderboards_popup["p" + _loc2_].textColor = 26265;
this._joinGamePopup.leaderboards_popup["s" + _loc2_].textColor = 26265;
}
else
{
this._joinGamePopup.leaderboards_popup["p" + _loc2_].textColor = 4137240;
this._joinGamePopup.leaderboards_popup["s" + _loc2_].textColor = 4137240;
}
}
else
{
this._joinGamePopup.leaderboards_popup["p" + _loc2_].text = "";
this._joinGamePopup.leaderboards_popup["s" + _loc2_].text = "";
}
_loc2_++;
}
}
else
{
_loc2_ = 1;
while(_loc2_ <= 11)
{
this._joinGamePopup.leaderboards_popup["p" + _loc2_].text = "";
this._joinGamePopup.leaderboards_popup["s" + _loc2_].text = "";
_loc2_++;
}
}
}
private function onAnyStartClicked(param1:MouseEvent) : void
{
param1.stopPropagation();
if(param1.currentTarget.isGray)
{
return;
}
if(param1.currentTarget.name == "startBtn")
{
this._onStartClicked(0);
}
else if(param1.currentTarget.name == "proStartBtn")
{
this._onStartClicked(1);
}
}
private function onInstructionsClicked(param1:MouseEvent) : void
{
param1.stopPropagation();
this._instructionsPopup.visible = true;
this._joinGamePopup.visible = false;
this._instructionsPopup.startBtn.visible = false;
this._instrInfo = instrObjs[this._gameName];
if(this._instrInfo == null)
{
throw new Error("InstructionScreenBuilder could not find instrObjs[\"" + this._gameName + "\"]!");
}
this._instrInfo.displayName = this._gameName;
this._numScreens = this._instrInfo.instrTxts.length;
this._currScreen = 0;
this.updateInstrScreen();
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function backHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(this._currScreen > 0)
{
--this._currScreen;
this.updateInstrScreen();
return;
}
throw new Error("Tried to go back on first instr screen!");
}
private function nextHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(this._currScreen < this._numScreens - 1)
{
++this._currScreen;
this.updateInstrScreen();
return;
}
throw new Error("Tried to go next on last instr screen!");
}
private function backBtnHandlerOnFirstScreen(param1:MouseEvent) : void
{
param1.stopPropagation();
this._instructionsPopup.visible = false;
this._joinGamePopup.visible = true;
}
private function updateInstrScreen() : void
{
LocalizationManager.translateId(this._instructionsPopup.gameName.gameNameTxt,instrObjs[this._instrInfo.displayName].name);
LocalizationManager.translateId(this._instructionsPopup.gameInstr.gameInstrTxt,this._instrInfo.instrTxts[this._currScreen]);
var _loc1_:int = 0;
while(_loc1_ < this._instructionsPopup.instrImg.numChildren)
{
this._instructionsPopup.instrImg.getChildAt(_loc1_).visible = false;
_loc1_++;
}
if(this._instructionsPopup.instrImg[this._instrInfo.name + this._currScreen])
{
this._instructionsPopup.instrImg[this._instrInfo.name + this._currScreen].visible = true;
}
if(this._currScreen == 0)
{
if(this._numScreens > 1)
{
this._instructionsPopup.nextBtn.visible = true;
this._instructionsPopup.nextTxt.visible = true;
}
else
{
this._instructionsPopup.nextBtn.visible = false;
this._instructionsPopup.nextTxt.visible = false;
}
this._instructionsPopup.backToMainBtn.visible = true;
this._instructionsPopup.backBtn.visible = false;
}
else if(this._currScreen == this._numScreens - 1)
{
this._instructionsPopup.backBtn.visible = true;
this._instructionsPopup.backTxt.visible = true;
this._instructionsPopup.nextBtn.visible = false;
this._instructionsPopup.nextTxt.visible = false;
this._instructionsPopup.backToMainBtn.visible = false;
}
else
{
this._instructionsPopup.backBtn.visible = true;
this._instructionsPopup.backTxt.visible = true;
this._instructionsPopup.nextBtn.visible = true;
this._instructionsPopup.nextTxt.visible = true;
this._instructionsPopup.backToMainBtn.visible = false;
}
this._instructionsPopup.page.pageTxt.text = this._currScreen + 1 + " / " + this._numScreens;
this._instructionsPopup.nextTxt.visible = false;
this._instructionsPopup.backTxt.visible = false;
}
}
}
@@ -0,0 +1,325 @@
package gui
{
import achievement.AchievementXtCommManager;
import com.sbi.analytics.SBTracker;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
import flash.system.ApplicationDomain;
import flash.utils.Timer;
import loader.MediaHelper;
public class GemBonusSpinWheel
{
private const WHEEL_SPIN_MEDIA_ID:int = 1025;
private var _loadingMediaHelper:MediaHelper;
private var _mediaHelpers:Array;
private var _guiLayer:DisplayLayer;
private var _spinWheelMC:MovieClip;
private var _gems:int;
private var _multiplier:uint;
private var _spinEndPoint:int;
private var _wheelNumbers:Array;
private var _displayTimer:Timer;
private var _callback:Function;
private var _isDiamond:Boolean;
private var _isGift:Boolean;
public function GemBonusSpinWheel()
{
super();
}
public function init(param1:int, param2:Function) : void
{
this._guiLayer = GuiManager.guiLayer;
this._callback = param2;
this._mediaHelpers = [];
this._wheelNumbers = [500,100,25,50,1,75,25,100,0,100,25,50,1,75,25,100];
this._displayTimer = new Timer(375);
this._displayTimer.addEventListener(TimerEvent.TIMER,this.onTimerComplete,false,0,true);
this._loadingMediaHelper = new MediaHelper();
this._loadingMediaHelper.init(this.WHEEL_SPIN_MEDIA_ID,this.onMediaItemLoaded,param1);
this._mediaHelpers.push(this._loadingMediaHelper);
}
public function destroy() : void
{
this.removeGeneralEventListeners();
DarkenManager.unDarken(this._spinWheelMC);
if(Boolean(this._spinWheelMC) && Boolean(this._guiLayer) && this._spinWheelMC.parent == this._guiLayer)
{
this._guiLayer.removeChild(this._spinWheelMC);
}
this._guiLayer = null;
this._mediaHelpers = null;
}
public function setupValuesAndSpin(param1:uint) : void
{
DarkenManager.showLoadingSpiral(false);
this._gems = this.convertToGemsValue(param1 >> 24);
this._multiplier = param1 >> 16 & 0xFF;
this._spinEndPoint = this.calculateSpinEndPoint(this._gems);
if(!this._isGift)
{
if(this._isDiamond)
{
gMainFrame.clientInfo.diamondCount += this._gems * this._multiplier;
}
else
{
gMainFrame.clientInfo.gemCount += this._gems * this._multiplier;
}
}
var _loc2_:int = 1;
while(_loc2_ < 4)
{
if(this._multiplier < _loc2_)
{
this._spinWheelMC["x" + _loc2_ + "_on"].visible = false;
}
else
{
this._spinWheelMC["x" + _loc2_ + "_on"].visible = true;
}
_loc2_++;
}
if(this._isDiamond)
{
this._spinWheelMC.earnGifts(0);
this._spinWheelMC.earnDiamonds(this._gems * this._multiplier);
}
else if(this._isGift)
{
this._spinWheelMC.earnDiamonds(0);
this._spinWheelMC.earnGifts(1 * this._multiplier);
}
else
{
this._spinWheelMC.earnDiamonds(0);
this._spinWheelMC.earnGifts(0);
}
this._spinWheelMC.spin(this._spinEndPoint,this.onSpinComplete);
AJAudio.playDailySpinSpin();
}
private function onMediaItemLoaded(param1:MovieClip) : void
{
var _loc2_:int = 0;
var _loc3_:int = 0;
var _loc4_:ApplicationDomain = null;
if(param1)
{
SBTracker.push();
SBTracker.trackPageview("game/play/popup/spinBonus");
this._spinWheelMC = MovieClip(param1.getChildAt(0));
DarkenManager.showLoadingSpiral(false);
if(!AJAudio.hasLoadedDailySpinSfx)
{
_loc4_ = param1.loaderInfo.applicationDomain;
AJAudio.loadSfx("DailySpinSpin",_loc4_.getDefinition("DailySpinSpin") as Class,0.5);
AJAudio.loadSfx("DailySpinBub1",_loc4_.getDefinition("DailySpinBub1") as Class,0.5);
AJAudio.loadSfx("DailySpinBub2",_loc4_.getDefinition("DailySpinBub2") as Class,0.5);
AJAudio.loadSfx("DailySpinBub3",_loc4_.getDefinition("DailySpinBub3") as Class,0.5);
AJAudio.hasLoadedDailySpinSfx = true;
}
this._spinWheelMC.spinTxtAnim.spinTxt.text = "";
this._spinWheelMC.bonusTxtAnim.bonusTxt.text = "";
this._spinWheelMC.totalTxtAnim.totalTxt.text = "";
if(gMainFrame.clientInfo.jamaaDate - (param1.passback & 0xFFFF) == 1)
{
_loc2_ = Math.min((param1.passback >> 16 & 0xFF) + 1,3);
}
else
{
_loc2_ = 1;
}
_loc3_ = 1;
while(_loc3_ < 4)
{
if(_loc2_ < _loc3_)
{
this._spinWheelMC["x" + _loc3_ + "_on"].visible = false;
}
_loc3_++;
}
this._spinWheelMC.x = MainFrame.VIEW_WIDTH * 0.5;
this._spinWheelMC.y = MainFrame.VIEW_HEIGHT * 0.5;
this._guiLayer.addChild(this._spinWheelMC);
DarkenManager.darken(this._spinWheelMC);
this._mediaHelpers = [];
this.addGeneralEventListeners();
}
}
private function convertToGemsValue(param1:int) : int
{
if(param1 < 4)
{
return (param1 + 1) * 25;
}
if(param1 == 4)
{
return 500;
}
if(param1 == 5)
{
this._isDiamond = true;
return 1;
}
if(param1 == 6)
{
this._isGift = true;
return 0;
}
return 25;
}
private function calculateSpinEndPoint(param1:int) : int
{
var _loc2_:Number = Math.random();
_loc2_ = int(this._wheelNumbers.length * _loc2_);
while(this._wheelNumbers[_loc2_] != param1)
{
if(_loc2_ + 1 >= this._wheelNumbers.length)
{
_loc2_ = 0;
}
else
{
_loc2_++;
}
}
return _loc2_;
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onClose(param1:MouseEvent = null) : void
{
if(param1)
{
param1.stopPropagation();
}
if(this._gems > 0)
{
GuiManager.startGemsFlash();
SBTracker.trackPageview("game/play/popup/spinBonus/close/didSpin",-1,SBTracker.TYPE_EVENT);
}
else
{
SBTracker.trackPageview("game/play/popup/spinBonus/close/noSpin",-1,SBTracker.TYPE_EVENT);
}
SBTracker.pop();
if(this._callback != null)
{
this._callback();
this._callback = null;
}
else
{
this.destroy();
}
}
private function onSpinBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
SBTracker.trackPageview("game/play/popup/spinBonus/spin",-1,SBTracker.TYPE_EVENT);
this._spinWheelMC.spinBtn.mouse.visible = false;
this._spinWheelMC.spinBtn.down.visible = true;
this._spinWheelMC.spinBtn.down.gotoAndStop(3);
this._spinWheelMC.spinBtn.mouseEnabled = false;
this._spinWheelMC.spinBtn.mouseChildren = false;
this._spinWheelMC.spinBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onSpinBtn);
this._spinWheelMC.bx.mouse.visible = false;
this._spinWheelMC.bx.down.visible = true;
this._spinWheelMC.bx.down.gotoAndStop(3);
this._spinWheelMC.bx.mouseEnabled = false;
this._spinWheelMC.bx.mouseChildren = false;
this._spinWheelMC.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
AchievementXtCommManager.requestSetUserVar(AchievementXtCommManager.UV_DAILY_GEM_BONUS,1);
DarkenManager.showLoadingSpiral(true);
}
private function onSpinComplete() : void
{
this._displayTimer.start();
}
private function onTimerComplete(param1:TimerEvent) : void
{
if(this._spinWheelMC.spinTxtAnim.spinTxt.text == "")
{
this._spinWheelMC.spinTxtAnim.spinTxt.text = this._gems;
this._spinWheelMC.popupObject(0);
AJAudio.playDailySpinBub1();
}
else if(this._spinWheelMC.bonusTxtAnim.bonusTxt.text == "")
{
this._spinWheelMC.bonusTxtAnim.bonusTxt.text = this._multiplier;
this._displayTimer.delay = 750;
this._spinWheelMC.popupObject(1);
AJAudio.playDailySpinBub2();
}
else if(this._spinWheelMC.totalTxtAnim.totalTxt.text == "")
{
this._spinWheelMC.totalTxtAnim.totalTxt.text = Utility.convertNumberToString(this._gems * this._multiplier);
this._displayTimer.delay = 3000;
this._spinWheelMC.popupObject(2);
AJAudio.playDailySpinBub3();
this._spinWheelMC.bx.mouse.visible = true;
this._spinWheelMC.bx.down.visible = false;
this._spinWheelMC.bx.down.gotoAndStop(3);
this._spinWheelMC.bx.mouseEnabled = true;
this._spinWheelMC.bx.mouseChildren = true;
this._spinWheelMC.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
if(this._isGift)
{
GuiManager.initMessagePopups(true);
}
}
else
{
this._displayTimer.reset();
this._displayTimer.removeEventListener(TimerEvent.TIMER_COMPLETE,this.onTimerComplete);
if(!this._isGift)
{
this.onClose();
}
}
}
private function addGeneralEventListeners() : void
{
this._spinWheelMC.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
this._spinWheelMC.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
this._spinWheelMC.spinBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onSpinBtn,false,0,true);
}
private function removeGeneralEventListeners() : void
{
this._spinWheelMC.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
this._spinWheelMC.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
this._spinWheelMC.spinBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onSpinBtn);
}
}
}
@@ -0,0 +1,201 @@
package gui
{
import avatar.AvatarManager;
import loader.DefPacksDefHelper;
import movie.MovieManager;
import quest.QuestManager;
import room.RoomManagerWorld;
public class GenericListGuiManager
{
public static var movieSelector:MovieManager;
private static var _shop:Shop;
public function GenericListGuiManager()
{
super();
}
public static function genericListVolumeClicked(param1:int, param2:Object = null) : void
{
var _loc3_:int = int(gMainFrame.userInfo.getGenericListDefByDefId(param1).typeId);
switch(_loc3_)
{
case DefPacksDefHelper.DEF_ITEM:
case DefPacksDefHelper.DEF_DEN_ITEM:
case DefPacksDefHelper.DEF_CURRENCY_EXCHANGE:
case DefPacksDefHelper.DEF_DIAMOND:
if(param2 == null || !param2.hasOwnProperty("volName") || QuestManager.onShopClick(param2.volName))
{
launchStore(param1,_loc3_);
}
break;
case DefPacksDefHelper.DEF_DEN_ROOM:
GuiManager.openDenRoomSwitcher(false,null,true,-1,param1);
break;
case DefPacksDefHelper.DEF_STREAM:
DarkenManager.showLoadingSpiral(true);
GenericListXtCommManager.requestStreamList(param1,launchMovies,param2);
break;
case DefPacksDefHelper.DEF_LOCALIZATION:
case DefPacksDefHelper.DEF_MEDIA:
case DefPacksDefHelper.DEF_FACT:
}
}
public static function launchMovies(param1:int, param2:Array, param3:Array, param4:Array, param5:Array, param6:Array, param7:Array, param8:Object = null) : void
{
var _loc9_:Boolean = false;
var _loc10_:Array = null;
if(param2.length > 1)
{
GenericListXtCommManager.filterList(DefPacksDefHelper.DEF_STREAM,param2,{
"thumbIds":param3,
"baseTitles":param4,
"indivTitles":param5,
"statusIds":param6,
"subtitleIds":param7
});
if(Boolean(movieSelector) && Boolean(RoomManagerWorld.instance.theaterWindow))
{
DarkenManager.showLoadingSpiral(false);
movieSelector.toggleVisibility();
}
else
{
if(movieSelector)
{
movieSelector.destroy();
movieSelector = null;
}
movieSelector = new MovieManager();
movieSelector.init(GuiManager.guiLayer,RoomManagerWorld.instance.theaterWindow,param3,param2,param4,param5,param6,param7,MovieManager.VID_SELECTOR_MEDIA_ID,MovieManager.VID_PLAYER_MEDIA_ID,onMovieSelectorClose);
if(param8)
{
movieSelector.setSkinFrame(frameIdForMsg(param8.msg));
if(param8.msg == "bb" || param8.msg == "tt")
{
movieSelector.setQuestionBtn();
}
if(param8.titleTxt)
{
movieSelector.setTitleTxt(param8.titleTxt);
}
if(param8.msg.indexOf("autoplay") != -1)
{
movieSelector.chooseRandom(true,frameIdForMsg(param8.msg),param8.shouldRepeat != null ? Boolean(param8.shouldRepeat) : false);
}
if(param8.shouldRepeat != null)
{
movieSelector.setShouldRepeat(param8.shouldRepeat);
}
if(Boolean(param8.width) && Boolean(param8.height))
{
movieSelector.setDefaultWidthHeight(param8.width,param8.height);
}
}
}
}
else if(param8)
{
if(param8.msg)
{
_loc10_ = param8.msg.split("%");
if(_loc10_.length > 1)
{
param8.shouldRepeat = _loc10_[1] == "true";
param8.width = int(_loc10_[2]);
param8.height = int(_loc10_[3]);
}
}
_loc9_ = true;
if(param8.shouldRepeat != null)
{
_loc9_ = Boolean(param8.shouldRepeat);
}
if(Boolean(param8.width) && Boolean(param8.height))
{
GuiManager.initMoviePlayer(MovieManager.VID_PLAYER_MEDIA_ID,param2,param4,param7,_loc9_,param8.width,param8.height);
}
else
{
GuiManager.initMoviePlayer(MovieManager.VID_PLAYER_MEDIA_ID,param2,param4,param7,_loc9_);
}
if(_loc10_)
{
GuiManager.setVideoPlayerSkin(frameIdForMsg(_loc10_[0]));
}
}
else
{
GuiManager.initMoviePlayer(MovieManager.VID_PLAYER_MEDIA_ID,param2,param4,param7,false);
}
}
public static function onRoomExit() : void
{
if(movieSelector)
{
movieSelector.destroy();
movieSelector = null;
}
}
public static function isWorldShopOpen() : Boolean
{
return _shop != null;
}
private static function frameIdForMsg(param1:String) : int
{
param1 = param1.toLowerCase();
if(param1 == "bb" || param1 == "bb_experiments")
{
return MovieManager.BRADY_BARR_SKIN;
}
if(param1 == "tt" || param1 == "tt_autoplay")
{
return MovieManager.TIERNEY_THYS_SKIN;
}
if(param1 == "biggerframe")
{
return MovieManager.BIGGER_FRAME;
}
return MovieManager.NORMAL_SKIN;
}
private static function onMovieSelectorClose() : void
{
if(movieSelector)
{
movieSelector.toggleVisibility();
}
}
private static function launchStore(param1:int, param2:int) : void
{
if(_shop)
{
_shop.destroy();
}
_shop = new Shop();
_shop.init(param1,param2,AvatarManager.playerAvatar,GuiManager.guiLayer,true,onShopClose,MainFrame.VIEW_WIDTH * 0.5,MainFrame.VIEW_HEIGHT * 0.5);
}
private static function onShopClose(param1:Boolean) : void
{
if(_shop)
{
_shop.destroy();
_shop = null;
}
}
public function init() : void
{
}
}
}
@@ -0,0 +1,869 @@
package gui
{
import avatar.AvatarManager;
import avatar.UserInfo;
import com.sbi.analytics.SBTracker;
import com.sbi.popup.SBOkPopup;
import com.sbi.popup.SBYesNoPopup;
import ecard.ECard;
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.ui.Keyboard;
import loader.MediaHelper;
import localization.LocalizationManager;
import pet.PetManager;
public class GiftPopup
{
public static const POPUP_TYPE_JAG:int = 0;
public static const POPUP_TYPE_PROMO:int = 1;
public static const POPUP_TYPE_PRIZE:int = 2;
public static const POPUP_TYPE_JB:int = 3;
public static const POPUP_TYPE_JAMAALIDAY_GIFT:int = 4;
public static const POPUP_TYPE_TOUCH_POOL:int = 5;
public static const POPUP_TYPE_HQ:int = 6;
public static const POPUP_TYPE_TREASURE:int = 7;
public static const POPUP_TYPE_ADVENTURES:int = 8;
public static const POPUP_TYPE_TREASURE_RED:int = 9;
public static const POPUP_TYPE_TREASURE_BLUE:int = 10;
public static const POPUP_TYPE_TREASURE_ORANGE:int = 11;
public static const POPUP_TYPE_TREASURE_GREEN:int = 12;
public static const POPUP_TYPE_TREASURE_BAG:int = 13;
public static const POPUP_TYPE_ADVENTURES_ALT:int = 14;
public static const POPUP_TYPE_ADVENTURES_LUCKY:int = 15;
public static const POPUP_TYPE_ADVENTURES_EASTER:int = 16;
public static const GIFT_TYPE_GEMS:int = 0;
public static const GIFT_TYPE_CLOTHING:int = 1;
public static const GIFT_TYPE_DEN_ACC:int = 2;
public static const GIFT_TYPE_DEN_ROOM:int = 3;
public static const GIFT_TYPE_AVT:int = 4;
public static const GIFT_TYPE_DEN_AUDIO:int = 5;
public static const GIFT_TYPE_PET:int = 6;
public static const GIFT_TYPE_CRYSTALS:int = 7;
public static const GIFT_TYPE_DIAMOND:int = 8;
public static const GIFT_TYPE_CUSTOM_AVT:int = 9;
public static const BUTTONS_TYPE_KEEP_DISCARD:int = 0;
public static const BUTTONS_TYPE_OK:int = 1;
public static const BUTTONS_TYPE_CREATE:int = 2;
public static const BUTTONS_TYPE_TAKE_LEAVE:int = 3;
private const GIFT_POPUP_ID:int = 1084;
private var _guiLayer:DisplayObjectContainer;
private var _icon:Sprite;
private var _name:String;
private var _popupType:int;
private var _giftType:int;
private var _enviroType:int;
private var _denyForNonMem:Boolean;
private var _buttonsType:int;
private var _onCloseMsg:String;
private var _msgText:String;
private var _keepCallback:Function;
private var _rejectCallback:Function;
private var _closeCallback:Function;
private var _loadingMediaHelper:MediaHelper;
private var _popupContent:MovieClip;
private var _closeMsgOkPopup:SBOkPopup;
private var _recyclePopup:RecycleItems;
private var _giftDataArray:Array;
private var _isFromStartup:Boolean;
private var _popupActive:Boolean;
private var _giftDefIdOrAmount:String;
public function GiftPopup()
{
super();
}
public static function giftTypeForECardType(param1:int) : int
{
if(param1 == ECard.TYPE_GEMS)
{
return GIFT_TYPE_GEMS;
}
if(param1 == ECard.TYPE_CLOTHING)
{
return GIFT_TYPE_CLOTHING;
}
if(param1 == ECard.TYPE_DEN_ACC)
{
return GIFT_TYPE_DEN_ACC;
}
if(param1 == ECard.TYPE_DEN_ROOM)
{
return GIFT_TYPE_DEN_ROOM;
}
if(param1 == ECard.TYPE_AVT)
{
return GIFT_TYPE_AVT;
}
if(param1 == ECard.TYPE_DEN_AUDIO)
{
return GIFT_TYPE_DEN_AUDIO;
}
if(param1 == ECard.TYPE_PET)
{
return GIFT_TYPE_PET;
}
if(param1 == ECard.TYPE_DIAMOND)
{
return GIFT_TYPE_DIAMOND;
}
if(param1 == ECard.TYPE_CUSTOM_AVT)
{
return GIFT_TYPE_CUSTOM_AVT;
}
return -1;
}
public static function buttonsTypeForECardType(param1:int) : int
{
if(param1 == ECard.TYPE_PET)
{
return BUTTONS_TYPE_CREATE;
}
if(param1 == ECard.TYPE_GEMS || param1 == ECard.TYPE_AVT || param1 == ECard.TYPE_DIAMOND || param1 == ECard.TYPE_CUSTOM_AVT)
{
return BUTTONS_TYPE_OK;
}
return BUTTONS_TYPE_KEEP_DISCARD;
}
public function init(param1:DisplayObjectContainer, param2:Sprite, param3:String, param4:int, param5:int, param6:int, param7:Function = null, param8:Function = null, param9:Function = null, param10:Boolean = false, param11:int = 0, param12:int = 0, param13:String = null, param14:String = null, param15:Array = null, param16:Boolean = false) : void
{
this._guiLayer = param1;
this._icon = param2;
this._name = param3;
this._enviroType = param12;
this._denyForNonMem = param10;
this._buttonsType = param11;
this._onCloseMsg = param13;
this._giftDefIdOrAmount = param4 == 0 ? param3 : String(param4);
this.translateNonItemNameForTracking();
this._popupType = param5;
this._giftType = param6;
this._keepCallback = param7;
this._rejectCallback = param8;
this._closeCallback = param9;
this._msgText = param14;
this._giftDataArray = param15;
this._isFromStartup = param16;
DarkenManager.showLoadingSpiral(true);
this._loadingMediaHelper = new MediaHelper();
this._loadingMediaHelper.init(this.GIFT_POPUP_ID,this.onMediaItemLoaded,this._name);
}
public function destroy() : void
{
this._popupContent.removeEventListener(MouseEvent.MOUSE_DOWN,this.onGiftPopup);
if(this._popupContent.buttons.keepBtn.visible)
{
this._guiLayer.stage.removeEventListener(KeyboardEvent.KEY_DOWN,this.keepKeyDown);
this._popupContent.buttons.keepBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.keepBtnDownHandler);
this._guiLayer.stage.removeEventListener(KeyboardEvent.KEY_DOWN,this.rejectKeyDown);
this._popupContent.buttons.discardBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.rejectBtnDownHandler);
}
if(this._popupContent.buttons.okBtn.visible)
{
this._guiLayer.stage.removeEventListener(KeyboardEvent.KEY_DOWN,this.rejectFromOkKeyDown);
this._popupContent.buttons.okBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.rejectFromOkButtonDownHandler);
}
if(this._popupContent.bx.visible)
{
this._popupContent.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onXBtnDown);
}
this._guiLayer.removeChild(this._popupContent);
DarkenManager.unDarken(this._popupContent);
this._popupContent = null;
this._guiLayer = null;
this._icon = null;
this._keepCallback = null;
this._rejectCallback = null;
this._closeCallback = null;
}
public function close() : void
{
if(this._onCloseMsg)
{
this._closeMsgOkPopup = new SBOkPopup(this._guiLayer,this._onCloseMsg,true,this.onCloseMsgOkBtnDown);
this._onCloseMsg = null;
return;
}
SBTracker.pop();
if(this._closeCallback != null)
{
this._closeCallback();
}
}
private function onMediaItemLoaded(param1:MovieClip) : void
{
var _loc2_:String = null;
if(param1)
{
_loc2_ = this._enviroType == SbiConstants.ENVIRO_OCEAN ? "_Ocean" : "";
SBTracker.push();
SBTracker.trackPageview("game/play/popup/gift/" + this.popupTypeToString(this._popupType) + "/#" + this._giftDefIdOrAmount,-1,SBTracker.TYPE_EVENT);
this._popupContent = MovieClip(param1.getChildAt(0));
this._popupContent.itemLayer.addChild(this._icon);
LocalizationManager.updateToFit(this._popupContent.buttons.giftNameTxt,param1.passback);
this._popupContent.bx.visible = false;
if(!AJAudio.hasLoadedGiftUnwrapSfx)
{
AJAudio.loadSfx("GiftUnwrap",param1.loaderInfo.applicationDomain.getDefinition("GiftUnwrap") as Class,0.6);
AJAudio.loadSfx("TreasureUnwrap",param1.loaderInfo.applicationDomain.getDefinition("TreasureUnwrap") as Class,0.33);
AJAudio.loadSfx("TreasureBagUnwrap",param1.loaderInfo.applicationDomain.getDefinition("TreasureBagUnwrap") as Class,0.6);
AJAudio.loadSfx("EpicLuckyTreasureUnwrap",param1.loaderInfo.applicationDomain.getDefinition("EpicLuckyTreasureUnwrap") as Class,0.6);
AJAudio.loadSfx("TreasureGoldenEgg",param1.loaderInfo.applicationDomain.getDefinition("TreasureGoldenEgg") as Class,0.68);
AJAudio.hasLoadedGiftUnwrapSfx = true;
}
this._guiLayer.addChild(this._popupContent);
if(this._popupType == POPUP_TYPE_PROMO)
{
this._popupContent.buttons.treasureNameTxt.visible = false;
this._popupContent.buttons.treasureTxtBox.visible = false;
if(this._name.indexOf("Diamond") != -1)
{
LocalizationManager.translateId(this._popupContent.mailboxTitleTxt,11280);
}
else
{
LocalizationManager.translateId(this._popupContent.mailboxTitleTxt,11281);
}
this._popupContent.present.addEventListener(MouseEvent.MOUSE_DOWN,this.onPresentDownHandler,false,0,true);
this._popupContent.buttons.visible = false;
}
else if(this._popupType == POPUP_TYPE_HQ)
{
this._popupContent.buttons.treasureNameTxt.visible = false;
this._popupContent.buttons.treasureTxtBox.visible = false;
this._popupContent.present.addEventListener(MouseEvent.MOUSE_DOWN,this.onPresentDownHandler,false,0,true);
if(!this._isFromStartup)
{
this._popupContent.bx.visible = true;
this._popupContent.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onXBtnDown,false,0,true);
}
this._popupContent.gotoAndPlay("offMessage");
if(this._msgText)
{
this._popupContent.messageTxt.text = this._msgText;
}
this._popupContent.buttons.visible = false;
}
else if(this.isPopUpTypeTreasure())
{
this._popupContent.buttons.giftNameTxt.visible = false;
this._popupContent.buttons.giftTxtBox.visible = false;
this._popupContent.buttons.treasureNameTxt.text = param1.passback;
this._popupContent.gotoAndStop("offTreasureMessage" + _loc2_ + this.popUpColor());
this._popupContent.present.addEventListener(MouseEvent.MOUSE_DOWN,this.onPresentDownHandler,false,0,true);
this._popupContent.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onXBtnDown,false,0,true);
this._popupContent.buttons.visible = false;
}
else if(this._popupType == POPUP_TYPE_ADVENTURES)
{
this._popupContent.buttons.giftNameTxt.visible = false;
this._popupContent.buttons.giftTxtBox.visible = false;
this._popupContent.buttons.treasureNameTxt.text = param1.passback;
this._popupContent.gotoAndPlay("onChooseTreasure" + _loc2_);
AJAudio.playTreasureUnwrap();
}
else if(this._popupType == POPUP_TYPE_ADVENTURES_ALT)
{
this._popupContent.buttons.giftNameTxt.visible = false;
this._popupContent.buttons.giftTxtBox.visible = false;
this._popupContent.buttons.treasureNameTxt.text = param1.passback;
this._popupContent.gotoAndPlay("onChooseTreasure" + _loc2_);
AJAudio.playTreasureUnwrap();
}
else if(this._popupType == POPUP_TYPE_ADVENTURES_LUCKY)
{
this._popupContent.buttons.giftNameTxt.visible = false;
this._popupContent.buttons.giftTxtBox.visible = false;
this._popupContent.buttons.treasureNameTxt.text = param1.passback;
this._popupContent.gotoAndPlay("onTreasureLucky" + _loc2_);
AJAudio.playTreasureLuckyUnwrap();
}
else if(this._popupType == POPUP_TYPE_ADVENTURES_EASTER)
{
this._popupContent.buttons.giftNameTxt.visible = false;
this._popupContent.buttons.giftTxtBox.visible = false;
this._popupContent.buttons.treasureNameTxt.text = param1.passback;
this._popupContent.gotoAndPlay("onTreasureGoldEgg" + _loc2_);
AJAudio.playTreasureEggUnwrap();
}
else
{
this._popupContent.buttons.treasureNameTxt.visible = false;
this._popupContent.buttons.treasureTxtBox.visible = false;
if(this._popupType == POPUP_TYPE_JAG || this._popupType == POPUP_TYPE_JB || this._popupType == POPUP_TYPE_TOUCH_POOL)
{
if(this._popupType == POPUP_TYPE_TOUCH_POOL)
{
LocalizationManager.translateId(this._popupContent.mailboxTitleTxt,11282);
}
else
{
LocalizationManager.translateId(this._popupContent.mailboxTitleTxt,11283);
}
this._popupContent.bx.visible = true;
this._popupContent.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onXBtnDown,false,0,true);
}
else if(this._popupType == POPUP_TYPE_JAMAALIDAY_GIFT)
{
LocalizationManager.translateId(this._popupContent.mailboxTitleTxt,11283);
}
else if(this._popupType == POPUP_TYPE_PRIZE)
{
LocalizationManager.translateId(this._popupContent.mailboxTitleTxt,11282);
}
this._popupContent.gotoAndStop("lastFrame");
AJAudio.playGiftUnwrap();
}
this._popupContent.addEventListener(MouseEvent.MOUSE_DOWN,this.onGiftPopup,false,0,true);
if(this._buttonsType == BUTTONS_TYPE_KEEP_DISCARD)
{
this._guiLayer.stage.addEventListener(KeyboardEvent.KEY_DOWN,this.keepKeyDown,false,0,true);
this._popupContent.buttons.keepBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.keepBtnDownHandler,false,0,true);
this._guiLayer.stage.addEventListener(KeyboardEvent.KEY_DOWN,this.rejectKeyDown,false,0,true);
this._popupContent.buttons.discardBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.rejectBtnDownHandler,false,0,true);
this._popupContent.buttons.okBtn.visible = false;
this._popupContent.buttons.createBtn.visible = false;
if(this._popupContent.buttons.takeBtn)
{
this._popupContent.buttons.takeBtn.visible = false;
}
if(this._popupContent.buttons.leaveBtn)
{
this._popupContent.buttons.leaveBtn.visible = false;
}
}
else if(this._buttonsType == BUTTONS_TYPE_OK)
{
this._guiLayer.stage.addEventListener(KeyboardEvent.KEY_DOWN,this.rejectFromOkKeyDown,false,0,true);
this._popupContent.buttons.okBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.rejectFromOkButtonDownHandler,false,0,true);
this._popupContent.buttons.keepBtn.visible = false;
this._popupContent.buttons.discardBtn.visible = false;
this._popupContent.buttons.createBtn.visible = false;
if(this._popupContent.buttons.takeBtn)
{
this._popupContent.buttons.takeBtn.visible = false;
}
if(this._popupContent.buttons.leaveBtn)
{
this._popupContent.buttons.leaveBtn.visible = false;
}
}
else if(this._buttonsType == BUTTONS_TYPE_CREATE)
{
this._popupContent.buttons.createBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onCreateButton,false,0,true);
this._popupContent.buttons.createBtn.visible = true;
this._popupContent.buttons.keepBtn.visible = false;
this._popupContent.buttons.discardBtn.visible = false;
this._popupContent.buttons.okBtn.visible = false;
if(this._popupContent.buttons.takeBtn)
{
this._popupContent.buttons.takeBtn.visible = false;
}
if(this._popupContent.buttons.leaveBtn)
{
this._popupContent.buttons.leaveBtn.visible = false;
}
}
else if(this._buttonsType == BUTTONS_TYPE_TAKE_LEAVE)
{
this._guiLayer.stage.addEventListener(KeyboardEvent.KEY_DOWN,this.keepKeyDown,false,0,true);
this._popupContent.buttons.takeBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.keepBtnDownHandler,false,0,true);
this._guiLayer.stage.addEventListener(KeyboardEvent.KEY_DOWN,this.rejectKeyDown,false,0,true);
this._popupContent.buttons.leaveBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.rejectBtnDownHandler,false,0,true);
this._popupContent.buttons.okBtn.visible = false;
this._popupContent.buttons.createBtn.visible = false;
this._popupContent.buttons.keepBtn.visible = false;
this._popupContent.buttons.discardBtn.visible = false;
}
this._popupContent.x = MainFrame.VIEW_WIDTH * 0.5;
this._popupContent.y = MainFrame.VIEW_HEIGHT * 0.5;
DarkenManager.showLoadingSpiral(false);
DarkenManager.darken(this._popupContent);
}
}
private function keepKeyDown(param1:KeyboardEvent) : void
{
if(this._popupActive == false)
{
switch(param1.keyCode)
{
case Keyboard.ENTER:
case Keyboard.SPACE:
this.keepBtnDownHandler(param1);
}
}
}
private function rejectKeyDown(param1:KeyboardEvent) : void
{
if(this._popupActive == false)
{
switch(param1.keyCode)
{
case Keyboard.BACKSPACE:
case Keyboard.DELETE:
case Keyboard.ESCAPE:
this.rejectBtnDownHandler(param1);
}
}
}
private function rejectFromOkKeyDown(param1:KeyboardEvent) : void
{
if(this._popupActive == false)
{
switch(param1.keyCode)
{
case Keyboard.BACKSPACE:
case Keyboard.DELETE:
case Keyboard.ESCAPE:
this.rejectFromOkButtonDownHandler(param1);
}
}
}
private function onGiftPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onXBtnDown(param1:MouseEvent) : void
{
param1.stopPropagation();
this.close();
}
private function isPopUpTypeTreasure() : Boolean
{
return this._popupType == POPUP_TYPE_TREASURE || this._popupType == POPUP_TYPE_TREASURE_BLUE || this._popupType == POPUP_TYPE_TREASURE_RED || this._popupType == POPUP_TYPE_TREASURE_ORANGE || this._popupType == POPUP_TYPE_TREASURE_GREEN || this._popupType == POPUP_TYPE_TREASURE_BAG;
}
private function popUpColor() : String
{
switch(this._popupType)
{
case POPUP_TYPE_TREASURE_BLUE:
return "Blue";
case POPUP_TYPE_TREASURE_RED:
return "Red";
case POPUP_TYPE_TREASURE_ORANGE:
return "Orange";
case POPUP_TYPE_TREASURE_GREEN:
return "Green";
case POPUP_TYPE_TREASURE_BAG:
return "Bag";
default:
return "";
}
}
private function onPresentDownHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:String = this._enviroType == SbiConstants.ENVIRO_OCEAN ? "_Ocean" : "";
this._popupContent.buttons.visible = true;
this._popupContent.present.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPresentDownHandler);
this._popupContent.gotoAndPlay(this._popupType == POPUP_TYPE_HQ ? "onMessage" : (this.isPopUpTypeTreasure() ? "onTreasureMessage" + _loc2_ + this.popUpColor() : "on"));
if(this.isPopUpTypeTreasure())
{
if(this._popupType == POPUP_TYPE_TREASURE_BAG)
{
AJAudio.playTreasureBagUnwrap();
}
else
{
AJAudio.playTreasureUnwrap();
}
}
else
{
AJAudio.playGiftUnwrap();
}
}
private function keepBtnDownHandler(param1:Event) : void
{
var _loc2_:Array = null;
var _loc3_:int = 0;
var _loc4_:int = 0;
var _loc5_:int = 0;
var _loc6_:Array = null;
var _loc7_:UserInfo = null;
var _loc8_:int = 0;
if(param1)
{
param1.stopPropagation();
}
if(this._denyForNonMem && !gMainFrame.userInfo.isMember)
{
UpsellManager.displayPopup(UpsellManager.JAG,"Receiving_Gift");
}
else
{
_loc2_ = [];
if(this._giftType == GIFT_TYPE_CLOTHING)
{
if(gMainFrame.userInfo.playerAvatarInfo)
{
_loc6_ = gMainFrame.userInfo.playerAvatarInfo.getFullItems();
}
if(this._enviroType == SbiConstants.ENVIRO_LAND)
{
if(_loc6_.length > 0)
{
_loc2_ = Utility.clothingItemListByEnviroType(_loc6_,SbiConstants.ENVIRO_LAND);
}
_loc5_ = RecycleItems.RECYCLE_ACCESSORIES_LAND_ONLY;
}
else
{
if(_loc6_.length > 0)
{
_loc2_ = Utility.clothingItemListByEnviroType(_loc6_,SbiConstants.ENVIRO_OCEAN);
}
_loc5_ = RecycleItems.RECYCLE_ACCESSORIES_OCEAN_ONLY;
}
if(_loc2_)
{
_loc3_ = int(_loc2_.length);
}
_loc4_ = Shop.maxItems;
}
else if(this._giftType == GIFT_TYPE_DEN_ACC)
{
if(this._enviroType == SbiConstants.ENVIRO_LAND)
{
if(gMainFrame.userInfo.playerUserInfo)
{
_loc7_ = gMainFrame.userInfo.playerUserInfo;
if(_loc7_.denItemsFull.length > 0)
{
_loc2_ = Utility.denItemListByEnviroType(_loc7_.denItemsFull,SbiConstants.ENVIRO_LAND);
}
}
_loc5_ = RecycleItems.RECYCLE_DEN_ITEMS_LAND_ONLY;
}
else
{
if(Boolean(gMainFrame.userInfo.playerUserInfo) && gMainFrame.userInfo.playerUserInfo.denItemsFull.length > 0)
{
_loc2_ = Utility.denItemListByEnviroType(gMainFrame.userInfo.playerUserInfo.denItemsFull,SbiConstants.ENVIRO_OCEAN);
}
_loc5_ = RecycleItems.RECYCLE_DEN_ITEMS_OCEAN_ONLY;
}
if(_loc2_)
{
_loc3_ = int(_loc2_.length);
}
_loc4_ = Shop.maxDenItems;
}
else if(this._giftType == GIFT_TYPE_DEN_AUDIO)
{
if(Boolean(gMainFrame.userInfo.playerUserInfo) && gMainFrame.userInfo.playerUserInfo.denItemsFull.length > 0)
{
_loc2_ = Utility.denItemListByEnviroType(gMainFrame.userInfo.playerUserInfo.denItemsFull,-1,true);
}
_loc5_ = RecycleItems.RECYCLE_DEN_AUDIO;
if(_loc2_)
{
_loc3_ = int(_loc2_.length);
}
_loc4_ = Shop.maxAudioItems;
}
else if(this._giftType == GIFT_TYPE_DEN_ROOM)
{
_loc2_ = DenSwitch.denList;
_loc5_ = DenSwitch.RECYCLE_DEN_ROOM;
if(_loc2_)
{
_loc8_ = 0;
while(_loc8_ < _loc2_.length)
{
if(_loc2_[_loc8_])
{
_loc3_++;
}
_loc8_++;
}
}
_loc4_ = SwitchManager.NUM_DEN_ROOM_SLOTS;
}
else if(this._popupType == POPUP_TYPE_ADVENTURES || this._popupType == POPUP_TYPE_ADVENTURES_ALT || this._popupType == POPUP_TYPE_ADVENTURES_LUCKY || this._popupType == POPUP_TYPE_ADVENTURES_EASTER)
{
if(this._giftType == GIFT_TYPE_GEMS || this._giftType == GIFT_TYPE_CRYSTALS)
{
this.keepItem();
return;
}
}
if(Utility.canGift() || this._popupType != POPUP_TYPE_JAG)
{
if(_loc3_ >= _loc4_)
{
this._popupActive = true;
new SBYesNoPopup(this._guiLayer,LocalizationManager.translateIdOnly(14746),true,this.confirmRecycleHandler,_loc5_);
}
else
{
this.keepItem();
}
}
else
{
this._popupActive = true;
new SBOkPopup(this._guiLayer,LocalizationManager.translateIdOnly(14747),true,this.okPopupComplete);
}
}
}
private function okPopupComplete(param1:MouseEvent) : void
{
this._popupActive = false;
SBOkPopup.destroyInParentChain(param1.target.parent);
}
private function rejectFromOkButtonDownHandler(param1:Event) : void
{
if(param1)
{
param1.stopPropagation();
}
if(this._giftType == GIFT_TYPE_GEMS || this._giftType == GIFT_TYPE_CRYSTALS || this._giftType == GIFT_TYPE_DIAMOND)
{
GuiManager.startGemsFlash();
}
SBTracker.trackPageview("game/play/popup/gift/" + this.popupTypeToString(this._popupType) + "/#" + this._giftDefIdOrAmount + "/ok",-1,SBTracker.TYPE_EVENT);
if(this._rejectCallback != null)
{
this._rejectCallback();
}
else
{
this.close();
}
}
private function rejectBtnDownHandler(param1:Event) : void
{
var _loc2_:String = null;
if(param1)
{
param1.stopPropagation();
}
if(!this.isPopUpTypeTreasure())
{
if(this._popupType == POPUP_TYPE_PROMO)
{
_loc2_ = LocalizationManager.translateIdAndInsertOnly(14748,this._popupContent.mailboxTitleTxt.text.toLowerCase());
}
else if(this._popupType == POPUP_TYPE_HQ)
{
_loc2_ = LocalizationManager.translateIdOnly(14749);
}
else
{
_loc2_ = LocalizationManager.translateIdAndInsertOnly(14750,this._popupContent.mailboxTitleTxt.text.toLowerCase());
}
this._popupActive = true;
new SBYesNoPopup(this._guiLayer,_loc2_,true,this.onConfirmReject);
}
else
{
this._popupActive = true;
new SBYesNoPopup(this._guiLayer,LocalizationManager.translateIdOnly(14919),true,this.onConfirmReject);
}
}
private function onCreateButton(param1:MouseEvent) : void
{
PetManager.openPetFinder(this._name.toLowerCase().replace(/[\s\r\n]*/gim,""),this.onPetCreated,true,this._giftDataArray);
}
private function onPetCreated() : void
{
if(this._closeCallback != null)
{
this._closeCallback();
}
}
private function onConfirmReject(param1:Object) : void
{
if(param1.status)
{
SBTracker.trackPageview("game/play/popup/gift/" + this.popupTypeToString(this._popupType) + "/#" + this._giftDefIdOrAmount + "/reject",-1,SBTracker.TYPE_EVENT);
if(this._rejectCallback != null)
{
this._rejectCallback();
}
else
{
this.close();
}
}
this._popupActive = false;
}
private function keepItem() : void
{
SBTracker.trackPageview("game/play/popup/gift/" + this.popupTypeToString(this._popupType) + "/#" + this._giftDefIdOrAmount + "/keep",-1,SBTracker.TYPE_EVENT);
if(this._keepCallback != null)
{
this._keepCallback();
}
else
{
this.close();
}
}
private function onCloseMsgOkBtnDown(param1:MouseEvent) : void
{
param1.stopPropagation();
this._closeMsgOkPopup.destroy();
this._closeMsgOkPopup = null;
this.close();
}
private function confirmRecycleHandler(param1:Object) : void
{
var _loc2_:int = 0;
if(param1.status)
{
_loc2_ = int(param1.passback);
if(_loc2_ == DenSwitch.RECYCLE_DEN_ROOM)
{
GuiManager.openDenRoomSwitcher(true,this.onDenRoomRecycleClose);
}
else
{
this._recyclePopup = new RecycleItems();
this._recyclePopup.init(_loc2_,this._guiLayer,true,this.onRecycleClose,MainFrame.VIEW_WIDTH * 0.5,MainFrame.VIEW_HEIGHT * 0.5,this._enviroType == AvatarManager.roomEnviroType);
}
}
this._popupActive = false;
}
private function onRecycleClose(param1:Boolean = false) : void
{
if(this._recyclePopup)
{
this._recyclePopup.destroy();
this._recyclePopup = null;
}
if(param1)
{
this.keepItem();
}
}
private function onDenRoomRecycleClose(param1:Boolean = false) : void
{
GuiManager.onDenSwitchClose(true);
if(param1)
{
this.keepItem();
}
}
private function popupTypeToString(param1:int) : String
{
switch(param1)
{
case POPUP_TYPE_JAG:
return "JAG";
case POPUP_TYPE_PRIZE:
return "Prize";
case POPUP_TYPE_PROMO:
return "Promo";
case POPUP_TYPE_JB:
return "JB";
case POPUP_TYPE_TOUCH_POOL:
return "TouchPool";
default:
return "";
}
}
private function translateNonItemNameForTracking() : void
{
if(this._giftType == GIFT_TYPE_GEMS)
{
this._giftDefIdOrAmount += " gems";
}
else if(this._giftType == GIFT_TYPE_CRYSTALS)
{
this._giftDefIdOrAmount += " crystals";
}
else if(this._giftType == GIFT_TYPE_DIAMOND)
{
this._giftDefIdOrAmount += " diamonds";
}
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,160 @@
package gui
{
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.filters.GlowFilter;
import flash.text.TextField;
import flash.ui.Keyboard;
public class GuiCheckBox
{
public var box:MovieClip;
public var grayBox:MovieClip;
public var check:MovieClip;
public var chkTxt:TextField;
private var _currCheckBox:MovieClip;
private var _checkCallback:Function;
private var _glow:GlowFilter;
public function GuiCheckBox(param1:MovieClip, param2:Function = null)
{
super();
this._currCheckBox = param1;
this._checkCallback = param2;
}
public function init(param1:TextField = null) : void
{
this.chkTxt = param1;
this.box = this._currCheckBox["_box"];
this.check = this.box["_check"];
this.grayBox = this._currCheckBox["_boxGray"];
if(this.grayBox)
{
this.grayBox.visible = false;
}
if(!(Boolean(this.box) && Boolean(this.check)))
{
throw new Error("GuiCheckBox is missing parts or they are named incorrectly!");
}
this.box.stop();
this.check.stop();
this._currCheckBox.tabEnabled = true;
this._glow = new GlowFilter(5562619,1,6,6,2,2);
this._currCheckBox.addEventListener(KeyboardEvent.KEY_DOWN,this.checkBoxKeyDownHandler,false,0,true);
this._currCheckBox.addEventListener(MouseEvent.MOUSE_DOWN,this.checkBoxClickHandler,false,0,true);
this._currCheckBox.addEventListener(MouseEvent.ROLL_OVER,this.onRollOver,false,0,true);
this._currCheckBox.addEventListener(MouseEvent.ROLL_OUT,this.onRollOut,false,0,true);
if(this.chkTxt != null)
{
this.chkTxt.addEventListener(MouseEvent.MOUSE_DOWN,this.checkBoxClickHandler,false,0,true);
this.chkTxt.addEventListener(MouseEvent.ROLL_OVER,this.onRollOver,false,0,true);
this.chkTxt.addEventListener(MouseEvent.ROLL_OUT,this.onRollOut,false,0,true);
}
}
public function destroy() : void
{
this._currCheckBox.removeEventListener(KeyboardEvent.KEY_DOWN,this.checkBoxKeyDownHandler);
this._currCheckBox.removeEventListener(MouseEvent.MOUSE_DOWN,this.checkBoxClickHandler);
this._currCheckBox.removeEventListener(MouseEvent.ROLL_OVER,this.onRollOver);
this._currCheckBox.removeEventListener(MouseEvent.ROLL_OUT,this.onRollOut);
if(this.chkTxt != null)
{
this.chkTxt.removeEventListener(MouseEvent.MOUSE_DOWN,this.checkBoxClickHandler);
this.chkTxt.removeEventListener(MouseEvent.ROLL_OVER,this.onRollOver);
this.chkTxt.removeEventListener(MouseEvent.ROLL_OUT,this.onRollOut);
}
this._currCheckBox = null;
this._checkCallback = null;
}
public function get gray() : Boolean
{
if(this.grayBox)
{
return this.grayBox.visible;
}
return false;
}
public function set gray(param1:Boolean) : void
{
if(this.grayBox)
{
this.grayBox.visible = param1;
this.box.visible = !param1;
}
}
public function get checked() : Boolean
{
return this.check.visible;
}
public function set checked(param1:Boolean) : void
{
this.check.visible = param1;
}
private function checkBoxKeyDownHandler(param1:KeyboardEvent) : void
{
if(!this.gray)
{
if(param1.keyCode == Keyboard.SPACE)
{
this.checked = !this.checked;
}
if(this._checkCallback != null)
{
this._checkCallback();
}
}
}
private function checkBoxClickHandler(param1:MouseEvent) : void
{
if(!this.gray)
{
this.checked = !this.checked;
if(this._checkCallback != null)
{
this._checkCallback();
}
}
}
private function onRollOver(param1:MouseEvent) : void
{
if(!this.gray)
{
this.box.filters = [this._glow];
if(this.chkTxt)
{
this.chkTxt.filters = [this._glow];
}
}
}
private function onRollOut(param1:MouseEvent) : void
{
if(!this.gray)
{
this.box.filters = null;
if(this.chkTxt)
{
this.chkTxt.filters = null;
}
}
}
}
}
@@ -0,0 +1,221 @@
package gui
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.events.FocusEvent;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.ui.Keyboard;
public class GuiDropdown
{
public var dropdownTxt:TextField;
public var dropdownBtn:MovieClip;
public var dropdown:MovieClip;
public var scrollContent:MovieClip;
public var scrollView:MovieClip;
public var highlight:MovieClip;
public var mouseHighlight:MovieClip;
public var scrollbar:SBScrollbar;
public var selectedTxt:TextField;
public var selectedIdx:int;
public var scrollItems:Array;
public var blockItemDown:Boolean;
public var currDropDown:MovieClip;
public function GuiDropdown(param1:MovieClip)
{
var _loc3_:DisplayObject = null;
super();
this.currDropDown = param1;
this.dropdownTxt = this.currDropDown.dropdown_txt;
this.dropdownBtn = this.currDropDown.dropdown_btn;
this.dropdown = this.currDropDown._dropdown;
this.scrollContent = this.dropdown.scroll_content;
this.highlight = this.scrollContent.dropdown_h;
this.mouseHighlight = this.scrollContent.mouse;
this.scrollView = this.dropdown.scroll_view;
this.scrollItems = [];
var _loc2_:int = 0;
while(_loc2_ < this.scrollContent.numChildren)
{
_loc3_ = this.scrollContent.getChildAt(_loc2_);
if(_loc3_.name.indexOf("_item") == 0)
{
_loc3_.addEventListener(MouseEvent.MOUSE_DOWN,this.itemMouseDownHandler,false,0,true);
if(this.mouseHighlight)
{
_loc3_.addEventListener(MouseEvent.MOUSE_OVER,this.itemMouseOverHandler,false,0,true);
_loc3_.addEventListener(MouseEvent.MOUSE_OUT,this.itemMouseOutHandler,false,0,true);
}
this.scrollItems[int(_loc3_.name.substr(5)) - 1] = _loc3_;
}
_loc2_++;
}
}
public function init(param1:Number, param2:int = 0, param3:String = null) : void
{
this.dropdown.visible = false;
if(this.scrollContent.height > this.scrollView.height)
{
this.scrollbar = new SBScrollbar();
this.scrollbar.init(this.scrollContent,this.scrollView.width,this.scrollView.height,param1,"scrollbar2",this.scrollContent["_item2"].y - this.scrollContent["_item1"].y);
}
if(param3)
{
this.selectedIdx = -1;
this.dropdownTxt.text = param3;
}
else
{
this.selectedIdx = this.selectedIdx;
this.selectedTxt = this.scrollItems[param2];
this.dropdownTxt.text = this.selectedTxt.text;
}
if(param2 > 0)
{
if(this.scrollbar)
{
this.scrollbar.scrollToElement(param2 - (param2 >= 2 ? 2 : 0));
}
this.selectedIdx = param2;
this.selectedTxt = this.scrollItems[param2];
this.highlight.visible = true;
this.highlight.y = this.selectedTxt.y + this.highlight.height * 0.5;
}
this.mouseHighlight.visible = false;
this.scrollView.visible = false;
this.dropdownBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.dropdownBtnMouseDownHandler,false,0,true);
this.currDropDown.addEventListener(KeyboardEvent.KEY_DOWN,this.keyDownHandler,false,0,true);
}
public function destroy() : void
{
var _loc2_:DisplayObject = null;
var _loc1_:int = 0;
while(_loc1_ < this.scrollContent.numChildren)
{
_loc2_ = this.scrollContent.getChildAt(_loc1_);
if(_loc2_.name.indexOf("_item") == 0)
{
_loc2_.removeEventListener(MouseEvent.MOUSE_DOWN,this.itemMouseDownHandler);
if(this.mouseHighlight)
{
_loc2_.removeEventListener(MouseEvent.MOUSE_OVER,this.itemMouseOverHandler);
_loc2_.removeEventListener(MouseEvent.MOUSE_OUT,this.itemMouseOutHandler);
}
}
_loc1_++;
}
this.scrollItems = null;
if(this.scrollbar)
{
this.scrollbar.destroy();
this.scrollbar = null;
}
this.dropdownBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.dropdownBtnMouseDownHandler);
this.currDropDown.removeEventListener(KeyboardEvent.KEY_DOWN,this.keyDownHandler);
}
public function reset(param1:int = 0, param2:String = null) : void
{
if(this.scrollbar)
{
this.scrollbar.scrollToElement(param1);
}
if(param1)
{
if(this.scrollbar)
{
this.scrollbar.scrollToElement(param1);
}
this.selectedIdx = param1;
this.selectedTxt = this.scrollItems[param1];
this.highlight.visible = true;
this.highlight.y = this.selectedTxt.y + this.highlight.height * 0.5;
}
if(param2)
{
this.selectedIdx = -1;
this.dropdownTxt.text = param2;
}
else
{
this.selectedIdx = this.selectedIdx;
this.selectedTxt = this.scrollItems[param1];
this.dropdownTxt.text = this.selectedTxt.text;
}
}
public function closeDropdownSilent() : void
{
this.focusOutHandler(null);
GuiSoundToggleButton(this.dropdownBtn).downToUpState();
}
private function keyDownHandler(param1:KeyboardEvent) : void
{
if(param1.keyCode == Keyboard.SPACE)
{
this.dropdownBtnMouseDownHandler(null);
}
}
private function dropdownBtnMouseDownHandler(param1:MouseEvent) : void
{
this.dropdown.visible = !this.dropdown.visible;
}
private function focusOutHandler(param1:FocusEvent) : void
{
if(this.dropdown.visible)
{
this.dropdown.visible = false;
}
}
private function itemMouseOverHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
this.mouseHighlight.visible = true;
this.mouseHighlight.y = param1.currentTarget.y + this.mouseHighlight.height * 0.5;
}
private function itemMouseOutHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
this.mouseHighlight.visible = false;
}
private function itemMouseDownHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(!this.blockItemDown)
{
this.selectedTxt = TextField(param1.currentTarget);
this.selectedIdx = int(this.selectedTxt.name.substr(5)) - 1;
this.dropdownTxt.text = this.selectedTxt.text;
this.highlight.visible = true;
this.highlight.y = this.selectedTxt.y + this.highlight.height * 0.5;
this.dropdownBtn.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_DOWN));
this.dropdownBtn.dispatchEvent(new MouseEvent(MouseEvent.ROLL_OUT));
}
}
}
}
@@ -0,0 +1,97 @@
package gui
{
import flash.display.MovieClip;
public class GuiDropdownDay extends GuiDropdown
{
private var _numDaysShow:int = 31;
public function GuiDropdownDay(param1:MovieClip)
{
super(param1);
}
public function updateDaysShown(param1:int) : void
{
var _loc2_:int = 0;
var _loc3_:int = 0;
var _loc4_:String = null;
if(Boolean(scrollItems) && Boolean(scrollItems.length > 0) && this._numDaysShow != param1)
{
_loc2_ = scrollContent["_item2"].y - scrollContent["_item1"].y;
_loc3_ = 0;
_loc4_ = null;
this._numDaysShow = param1;
if(param1 == 30)
{
_loc3_ = _loc2_;
if(selectedIdx > 29)
{
selectedIdx = 29;
}
}
else if(param1 == 29)
{
_loc3_ = _loc2_ * 2;
if(selectedIdx > 28)
{
selectedIdx = 28;
}
}
else if(param1 == 28)
{
_loc3_ = _loc2_ * 3;
if(selectedIdx > 27)
{
selectedIdx = 27;
}
}
if(selectedIdx == -1)
{
selectedIdx = 0;
_loc4_ = "-";
}
this.rebuild(0.55,selectedIdx,_loc4_,_loc3_);
}
}
private function rebuild(param1:Number, param2:int, param3:String, param4:Number) : void
{
dropdown.visible = false;
if(scrollbar)
{
scrollbar.destroy();
scrollbar = null;
}
if(scrollContent.height > scrollView.height)
{
scrollbar = new SBScrollbar();
scrollbar.init(scrollContent,scrollView.width,scrollView.height,param1,"scrollbar2",scrollContent["_item2"].y - scrollContent["_item1"].y,0,param4 == -1 ? -1 : scrollContent.height - param4);
}
if(param2 > 0)
{
if(scrollbar)
{
scrollbar.scrollToElement(param2);
}
selectedIdx = param2;
selectedTxt = scrollItems[param2];
highlight.visible = true;
highlight.y = selectedTxt.y + highlight.height * 0.5;
}
if(param3)
{
this.selectedIdx = -1;
dropdownTxt.text = param3;
}
else
{
this.selectedIdx = selectedIdx;
selectedTxt = scrollItems[param2];
dropdownTxt.text = selectedTxt.text;
}
}
}
}
@@ -0,0 +1,125 @@
package gui
{
import flash.display.MovieClip;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
public class GuiHelpTextBubble extends MovieClip
{
public var soundBtn:MovieClip;
public var txt:TextField;
public var tl:MovieClip;
public var tr:MovieClip;
public var bl:MovieClip;
public var bl2:MovieClip;
public var br:MovieClip;
public var bubble:MovieClip;
public var helpBubbleBG:MovieClip = null;
public var helpBubble:MovieClip = null;
public function GuiHelpTextBubble()
{
super();
this.soundBtn = this["soundBtn"];
this.txt = this["txt"];
this.tl = this["tl"];
this.tr = this["tr"];
this.bl = this["bl"];
this.bl2 = this["bl2"];
this.br = this["br"];
this.bubble = this["bubble"];
if(!this.soundBtn)
{
throw new Error("GuiHelpTextBubble MAIN BUTTONS is missing part or they are named incorrectly!");
}
if(!(Boolean(this.tl) && Boolean(this.tr) && Boolean(this.bl) && Boolean(this.bl2) && Boolean(this.br) && Boolean(this.bubble)))
{
throw new Error("GuiHelpTextBubble MAIN CONTENTS section is missing parts or they are named incorrectly!");
}
if(!this.txt)
{
throw new Error("GuiHelpTextBubble TEXT FIELDS section is missing parts or they are named incorrectly!");
}
}
public function init(param1:Number = undefined, param2:Number = undefined) : void
{
visible = false;
this.txt.autoSize = TextFieldAutoSize.CENTER;
}
public function setText(param1:String) : void
{
this.txt.text = param1;
}
public function setPos(param1:int, param2:int) : void
{
this.x = param1;
this.y = param2;
}
public function bringToFront() : void
{
parent.setChildIndex(this,parent.numChildren - 1);
}
public function setTails(param1:Boolean = false, param2:Boolean = false, param3:Boolean = false) : void
{
if(param3)
{
this.tl.visible = false;
this.tr.visible = false;
this.bl.visible = false;
this.br.visible = false;
this.bl2.visible = true;
}
else if(param1)
{
if(param2)
{
this.tl.visible = true;
this.tr.visible = false;
this.bl.visible = false;
this.br.visible = false;
this.bl2.visible = false;
}
else
{
this.tl.visible = false;
this.tr.visible = true;
this.bl.visible = false;
this.br.visible = false;
this.bl2.visible = false;
}
}
else if(param2)
{
this.tl.visible = false;
this.tr.visible = false;
this.bl.visible = true;
this.br.visible = false;
this.bl2.visible = false;
}
else
{
this.tl.visible = false;
this.tr.visible = false;
this.bl.visible = false;
this.br.visible = true;
this.bl2.visible = false;
}
}
}
}
@@ -0,0 +1,185 @@
package gui
{
import flash.display.MovieClip;
import flash.text.TextField;
public class GuiHud extends MovieClip
{
public var charWindow:MovieClip;
public var charNameTxt:TextField;
public var safeChatTreeWindow:MovieClip;
public var swapBtn:MovieClip;
public var actionsWindow:MovieClip;
public var emotesWindow:MovieClip;
public var chatBar:MovieClip;
public var sendChatBtn:MovieClip;
public var ansChatBtn:MovieClip;
public var chatTxt:TextField;
public var chatHist:MovieClip;
public var chatHistUpDownBtn:MovieClip;
public var chatHistTxt:TextField;
public var chatRepeatBtn:MovieClip;
public var chatRepeatWindow:MovieClip;
public var editCharBtn:MovieClip;
public var actionsBtn:MovieClip;
public var safeChatBtn:MovieClip;
public var emotesBtn:MovieClip;
public var denBtn:MovieClip;
public var worldMapBtn:MovieClip;
public var soundBtn:MovieClip;
public var furnBtn:MovieClip;
public var eCardBtn:MovieClip;
public var buddyListBtn:MovieClip;
public var newsBtn:MovieClip;
public var awardsBtn:MovieClip;
public var gemsBtn:MovieClip;
public var reportBtn:MovieClip;
public var mySettingsBtn:MovieClip;
public var zoneName:MovieClip;
public var zoneNameTxt:TextField;
public var eCardCount:MovieClip;
public var eCardCountTxt:TextField;
public var partyBtn:MovieClip;
public var playerWallBtn:MovieClip;
public var combatCardDeckBtn:MovieClip;
public var questExitBtn:MovieClip;
public var questPlayersBtn:MovieClip;
public var questObjectiveTxt:TextField;
public var mainBlock:MovieClip;
public var gemsBtnBlock:MovieClip;
public var charWindowBlock:MovieClip;
private var append:String;
public function GuiHud()
{
super();
this.init();
}
public function init(param1:Boolean = false) : void
{
this.append = currentFrameLabel == "quest" ? "Quest" : "";
this.charWindow = this["char"];
this.charNameTxt = this["text01_charName"];
this.safeChatTreeWindow = this["safeChatTree" + this.append];
this.actionsWindow = this["actionWindow" + this.append];
this.emotesWindow = this["emoteWindow" + this.append];
this.chatBar = this["hud01_chat" + this.append];
this.sendChatBtn = this.chatBar != null ? this.chatBar.but01_send : null;
this.ansChatBtn = this.chatBar != null ? this.chatBar.but01_ans : null;
this.chatTxt = this.chatBar != null ? this.chatBar.text01_chat : null;
this.chatHist = this["chat" + this.append];
this.chatHistUpDownBtn = this.chatHist != null ? this.chatHist.chatHistoryBG.chatHistBox.hud01_chatHistory.chatUpDown : null;
this.chatHistTxt = this.chatHist != null ? this.chatHist.chatHistoryBG["chatHistoryTxtCont" + this.append].text01_chatHistory : null;
this.chatRepeatBtn = this["chatRepeat" + this.append];
this.chatRepeatWindow = this["chatRepeatWindow" + this.append];
this.swapBtn = this["swap"];
this.actionsBtn = this["anim" + this.append];
this.safeChatBtn = this["speedChat" + this.append];
this.emotesBtn = this["emote" + this.append];
this.denBtn = this["home"];
this.worldMapBtn = this["world"];
this.soundBtn = this["sound_btn" + this.append];
this.furnBtn = this["furnBtn"];
this.eCardBtn = this["mail"];
this.buddyListBtn = this["buddyList"];
this.newsBtn = this["news"];
this.awardsBtn = this["trophy"];
this.gemsBtn = this["money"];
this.reportBtn = this["report"];
this.mySettingsBtn = this["mySettings"];
this.zoneName = this["zoneName"];
this.zoneNameTxt = this.zoneName != null ? this.zoneName.mouse.name_txt : null;
this.eCardCount = this.eCardBtn != null ? this.eCardBtn.newEcardCount : null;
this.eCardCountTxt = this.eCardCount != null ? this.eCardCount.eCardCountTxt : null;
this.mainBlock = this["mainBlock"];
this.gemsBtnBlock = this["gemsBtnBlock"];
this.charWindowBlock = this["charWindowBlock"];
this.partyBtn = this["party"];
this.playerWallBtn = this["playerWall"];
this.combatCardDeckBtn = this["cardDeck_btn"];
this.questExitBtn = this["questingExit_btn" + this.append];
this.questPlayersBtn = this["questPlayersBtn"];
if(this["objBar"] != null)
{
this.questObjectiveTxt = this["objBar"].objTxt;
}
if(!param1)
{
if(!(Boolean(this.eCardBtn) && Boolean(this.buddyListBtn) && Boolean(this.newsBtn) && Boolean(this.awardsBtn) && Boolean(this.gemsBtn) && Boolean(this.zoneName) && Boolean(this.mySettingsBtn) && Boolean(this.reportBtn) && Boolean(this.playerWallBtn)))
{
throw new Error("GuiHud TOP BAR section is missing parts or they are named incorrectly!");
}
if(!(this.swapBtn && this.actionsBtn && this.safeChatBtn && this.emotesBtn && this.denBtn && this.worldMapBtn && this.soundBtn && this.charNameTxt && Boolean(this.eCardCount) && this.eCardCountTxt))
{
throw new Error("GuiHud MAIN BUTTONS section is missing parts or they are named incorrectly!");
}
if(!(Boolean(this.actionsWindow) && Boolean(this.safeChatTreeWindow) && Boolean(this.emotesWindow) && Boolean(this.charWindow)))
{
throw new Error("GuiHud WINDOWS section is missing parts or they are named incorrectly!");
}
if(!(Boolean(this.zoneName) && Boolean(this.zoneName.mouse.mid) && Boolean(this.zoneName.mouse.left) && Boolean(this.zoneName.mouse.right)))
{
throw new Error("GuiHud ZONE NAME section is missing parts or they are named incorrectly!");
}
if(!(Boolean(this.chatBar) && Boolean(this.sendChatBtn) && Boolean(this.ansChatBtn) && this.chatTxt))
{
throw new Error("GuiHud CHAT BAR section is missing parts or they are named incorrectly!");
}
if(!(this.chatHist && this.chatHistUpDownBtn && this.chatHistTxt && Boolean(this.chatRepeatBtn) && this.chatRepeatWindow))
{
throw new Error("GuiHud CHAT HISTORY section is missing parts or they are named incorrectly!");
}
if(!(Boolean(this.mainBlock) && Boolean(this.gemsBtnBlock) && Boolean(this.charWindowBlock)))
{
throw new Error("GuiHud BLOCK section is missing parts or they are named incorrectly!");
}
}
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,12 @@
package gui
{
public class GuiNameTypeScreen
{
public function GuiNameTypeScreen()
{
super();
}
}
}
@@ -0,0 +1,132 @@
package gui
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class GuiRadioButtonGroup
{
public var radioButtons:Array;
public var currRadioButton:MovieClip;
private var _selectedRadioButton:DisplayObject;
public function GuiRadioButtonGroup(param1:MovieClip)
{
var _loc3_:DisplayObject = null;
var _loc4_:DisplayObject = null;
super();
this.currRadioButton = param1;
if(this.currRadioButton.numChildren <= 1)
{
throw new Error("GuiRadioButtonGroup requires two or more radio buttons!");
}
this.radioButtons = [];
var _loc2_:int = 0;
while(_loc2_ < this.currRadioButton.numChildren)
{
_loc3_ = this.currRadioButton.getChildAt(_loc2_);
this.radioButtons.push(_loc3_);
if(_loc3_ is MovieClip)
{
MovieClip(_loc3_).stop();
}
_loc3_.addEventListener(MouseEvent.CLICK,this.checkBoxClickHandler,false,0,true);
_loc3_.addEventListener(MouseEvent.MOUSE_OVER,this.boxOverHandler,false,0,true);
_loc3_.addEventListener(MouseEvent.MOUSE_OUT,this.boxOutHandler,false,0,true);
if(_loc3_["mouse"])
{
_loc3_["mouse"].visible = false;
}
_loc4_ = _loc3_["_circle"];
_loc4_.visible = false;
if(_loc4_ is MovieClip)
{
MovieClip(_loc4_).stop();
}
_loc2_++;
}
}
public function destroy() : void
{
var _loc2_:DisplayObject = null;
var _loc1_:int = 0;
while(_loc1_ < this.currRadioButton.numChildren)
{
_loc2_ = this.currRadioButton.getChildAt(_loc1_);
_loc2_.removeEventListener(MouseEvent.CLICK,this.checkBoxClickHandler);
_loc2_.removeEventListener(MouseEvent.MOUSE_OVER,this.boxOverHandler);
_loc2_.removeEventListener(MouseEvent.MOUSE_OUT,this.boxOutHandler);
_loc1_++;
}
this.radioButtons = null;
}
public function get selected() : int
{
return this.radioButtons.indexOf(this._selectedRadioButton);
}
public function set selected(param1:int) : void
{
var _loc2_:int = 0;
var _loc3_:int = int(this.radioButtons.length);
if(param1 == this.selected || param1 < 0 || param1 >= _loc3_)
{
return;
}
while(_loc2_ < _loc3_)
{
if(_loc2_ != param1)
{
this.radioButtons[_loc2_]["_circle"].visible = false;
}
_loc2_++;
}
this.setSelectedRadioButton(this.radioButtons[param1]);
}
public function reset() : void
{
var _loc1_:int = 0;
while(_loc1_ < this.radioButtons.length)
{
this.radioButtons[_loc1_]["_circle"].visible = false;
_loc1_++;
}
this._selectedRadioButton = null;
}
private function setSelectedRadioButton(param1:DisplayObject) : void
{
this._selectedRadioButton = param1;
this._selectedRadioButton["_circle"].visible = true;
}
private function checkBoxClickHandler(param1:MouseEvent) : void
{
this.selected = this.radioButtons.indexOf(param1.currentTarget);
param1.currentTarget.dispatchEvent(new MouseEvent(MouseEvent.MOUSE_DOWN));
}
private function boxOverHandler(param1:MouseEvent) : void
{
if(param1.currentTarget.mouse)
{
param1.currentTarget.mouse.visible = true;
}
}
private function boxOutHandler(param1:MouseEvent) : void
{
if(param1.currentTarget.mouse)
{
param1.currentTarget.mouse.visible = false;
}
}
}
}
@@ -0,0 +1,123 @@
package gui
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.filters.GlowFilter;
import flash.text.TextField;
public class GuiRadioButtonSingle
{
public var currRadioButton:MovieClip;
public var bg:MovieClip;
public var chkTxt:TextField;
public var circle:MovieClip;
public var grayBg:MovieClip;
private var _selectedRadioButton:DisplayObject;
private var _glow:GlowFilter;
public function GuiRadioButtonSingle(param1:MovieClip, param2:TextField = null)
{
super();
this.currRadioButton = param1;
this.chkTxt = param2;
this.bg = this.currRadioButton["bg"];
this.circle = this.currRadioButton["_circle"];
this.grayBg = this.currRadioButton["bgGray"];
this.gray = false;
this.circle.visible = false;
this._glow = new GlowFilter(5562619,1,6,6,2,2);
this.currRadioButton.addEventListener(MouseEvent.MOUSE_DOWN,this.checkBoxClickHandler,false,0,true);
this.currRadioButton.addEventListener(MouseEvent.ROLL_OVER,this.onRollOver,false,0,true);
this.currRadioButton.addEventListener(MouseEvent.ROLL_OUT,this.onRollOut,false,0,true);
if(this.chkTxt)
{
this.chkTxt.addEventListener(MouseEvent.MOUSE_DOWN,this.checkBoxClickHandler,false,0,true);
this.chkTxt.addEventListener(MouseEvent.ROLL_OVER,this.onRollOver,false,0,true);
this.chkTxt.addEventListener(MouseEvent.ROLL_OUT,this.onRollOut,false,0,true);
}
}
public function destroy() : void
{
this.currRadioButton.removeEventListener(MouseEvent.MOUSE_DOWN,this.checkBoxClickHandler);
this.currRadioButton.removeEventListener(MouseEvent.ROLL_OVER,this.onRollOver);
this.currRadioButton.removeEventListener(MouseEvent.ROLL_OUT,this.onRollOut);
if(this.chkTxt)
{
this.chkTxt.removeEventListener(MouseEvent.MOUSE_DOWN,this.checkBoxClickHandler);
this.chkTxt.removeEventListener(MouseEvent.ROLL_OVER,this.onRollOver);
this.chkTxt.removeEventListener(MouseEvent.ROLL_OUT,this.onRollOut);
}
}
public function get gray() : Boolean
{
if(this.grayBg)
{
return this.grayBg.visible;
}
return false;
}
public function set gray(param1:Boolean) : void
{
if(this.grayBg)
{
this.grayBg.visible = param1;
this.bg.visible = !param1;
this.circle.visible = !param1;
}
}
public function get selected() : Boolean
{
return this.circle.visible;
}
public function set selected(param1:Boolean) : void
{
this.circle.visible = param1;
}
private function checkBoxClickHandler(param1:MouseEvent) : void
{
if(!this.gray)
{
this.selected = !this.selected;
}
}
private function onRollOver(param1:MouseEvent) : void
{
if(!this.gray)
{
this.bg.filters = [this._glow];
if(this.chkTxt)
{
this.chkTxt.filters = [this._glow];
}
}
}
private function onRollOut(param1:MouseEvent) : void
{
if(!this.gray)
{
this.bg.filters = null;
if(this.chkTxt)
{
this.chkTxt.filters = null;
}
}
}
}
}
@@ -0,0 +1,28 @@
package gui
{
public class GuiSoundBtnSubMenu extends GuiSoundButton
{
public function GuiSoundBtnSubMenu()
{
super();
}
override public function playClickSound() : void
{
if(AJAudio)
{
AJAudio.playSubMenuBtnClick();
}
}
override public function playRolloverSound() : void
{
if(AJAudio)
{
AJAudio.playSubMenuBtnRollover();
}
}
}
}
@@ -0,0 +1,311 @@
package gui
{
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
public class GuiSoundButton extends MovieClip
{
public var mouse:MovieClip;
public var down:MovieClip;
public var gray:MovieClip;
public var glowArrow:MovieClip;
public var glow:MovieClip;
public var hasGrayState:Boolean = false;
public var isGray:Boolean = false;
public var soundsEnabled:Boolean = true;
public var hazMouse:Boolean = false;
public var hasGlowArrowState:Boolean;
public var isGlowArrow:Boolean;
private var _mouseVisibleOnEnableGray:Boolean = true;
private var _toolTip:ToolTipPopup;
private var _useTimer:Boolean = true;
public function GuiSoundButton()
{
super();
this.mouse = this["mouse"];
this.down = this["down"];
this.gray = this["gray"];
this.glowArrow = this["glowArrow"];
this.glow = this["glow"];
if(!this.mouse)
{
throw new Error("GuiSoundButton is missing parts or they are named incorrectly!");
}
this.mouse.stop();
this.mouse.visible = true;
if(this.down)
{
this.down.stop();
this.down.visible = false;
}
if(this.gray)
{
this.hasGrayState = true;
this.gray.visible = false;
}
if(this.glowArrow)
{
this.hasGlowArrowState = true;
this.glowArrow.visible = false;
}
if(this.glow)
{
this.glow.visible = false;
}
mouseEnabled = false;
addEventListener(MouseEvent.MOUSE_DOWN,this.btnDownHandler,false,1,true);
addEventListener(MouseEvent.ROLL_OVER,this.btnOverHandler,false,1,true);
addEventListener(MouseEvent.ROLL_OUT,this.btnOutHandler,false,1,true);
}
public function initToolTip(param1:DisplayObjectContainer, param2:String, param3:int, param4:int, param5:Boolean = true) : void
{
if(!this._toolTip)
{
this._toolTip = GETDEFINITIONBYNAME("Tooltip");
}
this._toolTip.init(param1,param2,this.x + param3,this.y + param4,param5);
}
public function activateGrayState(param1:Boolean) : void
{
if(param1)
{
if(this.hasGrayState && !this.isGray)
{
this.btnOutHandler(null);
this.isGray = this.gray.visible = true;
this._mouseVisibleOnEnableGray = this.mouse.visible;
this.mouse.visible = false;
if(this.down)
{
this.down.visible = false;
}
removeEventListener(MouseEvent.ROLL_OVER,this.btnOverHandler);
removeEventListener(MouseEvent.ROLL_OUT,this.btnOutHandler);
removeEventListener(MouseEvent.MOUSE_DOWN,this.btnDownHandler);
}
}
else if(this.hasGrayState && this.isGray)
{
this.isGray = this.gray.visible = false;
if(this._mouseVisibleOnEnableGray)
{
this.mouse.visible = true;
}
else
{
this.mouse.visible = false;
}
if(this.down)
{
this.down.visible = !this.mouse.visible;
}
addEventListener(MouseEvent.ROLL_OVER,this.btnOverHandler,false,1,true);
addEventListener(MouseEvent.ROLL_OUT,this.btnOutHandler,false,1,true);
addEventListener(MouseEvent.MOUSE_DOWN,this.btnDownHandler,false,1,true);
}
}
public function activateGlowArrowState(param1:Boolean) : void
{
if(param1)
{
if(this.hasGlowArrowState)
{
this.isGlowArrow = true;
this.glowArrow.visible = true;
this.glowArrow.mouseChildren = false;
this.glowArrow.mouseEnabled = false;
}
}
else if(this.hasGlowArrowState)
{
this.isGlowArrow = false;
this.glowArrow.visible = false;
}
}
public function setButtonState(param1:int) : void
{
this.activateGlowArrowState(false);
this.activateGrayState(false);
switch(param1)
{
case 0:
if(this.glow)
{
this.glow.visible = false;
}
this.activateGrayState(true);
break;
case 1:
this.activateGlowArrowState(false);
break;
case 2:
this.activateGlowArrowState(true);
}
}
public function btnOverHandler(param1:MouseEvent) : void
{
this.hazMouse = true;
if(this.mouse.visible)
{
if(this.mouse.hasEventListener(Event.ENTER_FRAME))
{
this.mouse.removeEventListener(Event.ENTER_FRAME,this.pbFrameHandler);
}
this.mouse.gotoAndPlay(1);
if(this.soundsEnabled && param1 != null)
{
this.playRolloverSound();
}
if(Boolean(this._toolTip) && this._toolTip.enabled)
{
this._toolTip.startTimer(param1);
this._toolTip.bringToolToFront();
}
}
}
public function btnOutHandler(param1:MouseEvent) : void
{
this.hazMouse = false;
if(this.mouse.visible)
{
if(this.mouse.currentFrame > 1)
{
this.playBackwards(this.mouse);
}
else
{
this.mouse.stop();
}
if(Boolean(this._toolTip) && Boolean(this._toolTip.toolTipTimer) && this._toolTip.isTimerRunning())
{
this._toolTip.resetTimerAndSetVisibility();
}
else if(this._toolTip)
{
this._toolTip.visible = false;
}
}
}
public function btnDownHandler(param1:MouseEvent) : void
{
if(this.isGray)
{
if(param1)
{
param1.stopPropagation();
}
return;
}
if(Boolean(this.down) && !this.down.visible)
{
this.down.visible = true;
this.mouse.visible = false;
}
else
{
this.mouse.visible = true;
this.mouse.gotoAndPlay(1);
if(this.down)
{
this.down.visible = false;
}
}
if(this.soundsEnabled && param1 != null)
{
this.playClickSound();
}
if(Boolean(this._toolTip) && Boolean(this._toolTip.toolTipTimer) && this._toolTip.isTimerRunning())
{
this._toolTip.resetTimerAndSetVisibility();
}
else if(this._toolTip)
{
this._toolTip.visible = false;
}
this.downToUpState();
}
public function setTimer(param1:Boolean) : void
{
this._useTimer = param1;
}
private function playBackwards(param1:MovieClip) : void
{
param1.addEventListener(Event.ENTER_FRAME,this.pbFrameHandler,false,0,true);
}
private function pbFrameHandler(param1:Event) : void
{
var _loc2_:MovieClip = null;
if(param1.target as MovieClip)
{
_loc2_ = MovieClip(param1.target);
if(_loc2_.currentFrame == 1)
{
_loc2_.removeEventListener(Event.ENTER_FRAME,this.pbFrameHandler);
return;
}
_loc2_.prevFrame();
}
}
public function downToUpState() : void
{
if(this.down)
{
this.down.visible = false;
}
this.mouse.visible = true;
this.mouse.gotoAndStop(1);
if(this.hazMouse)
{
this.btnOverHandler(null);
}
}
public function upToDownState() : void
{
if(Boolean(this.down) && !this.down.visible)
{
this.down.visible = true;
this.mouse.visible = false;
}
}
public function playClickSound() : void
{
AJAudio.playHudBtnClick();
}
public function playRolloverSound() : void
{
AJAudio.playHudBtnRollover();
}
}
}
@@ -0,0 +1,457 @@
package gui
{
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
public class GuiSoundToggleButton extends MovieClip
{
public var mouse:MovieClip;
public var down:MovieClip;
public var gray:MovieClip;
public var glowArrow:MovieClip;
public var glow:MovieClip;
public var hasGrayState:Boolean = false;
public var isGray:Boolean = false;
public var soundsEnabled:Boolean = true;
public var clickQueued:Boolean = false;
public var hazMouse:Boolean = false;
public var hasGlowArrowState:Boolean;
public var isGlowArrow:Boolean;
private var _mouseVisibleOnEnableGray:Boolean = true;
private var _pulseForward:Boolean = true;
private var _pulseExtraFrames:int = 0;
private var _repetitions:int = 0;
private var _toolTip:ToolTipPopup;
private var _useTimer:Boolean = true;
public function GuiSoundToggleButton()
{
super();
this.mouse = this["mouse"];
this.down = this["down"];
this.gray = this["gray"];
this.glowArrow = this["glowArrow"];
this.glow = this["glow"];
if(!this.mouse)
{
throw new Error("GuiSoundToggleButton is missing parts or they are named incorrectly!");
}
this.mouse.stop();
this.mouse.visible = true;
if(this.down)
{
this.down.stop();
this.down.visible = false;
}
if(this.gray)
{
this.hasGrayState = true;
this.gray.visible = false;
}
if(this.glowArrow)
{
this.hasGlowArrowState = true;
this.glowArrow.visible = false;
}
if(this.glow)
{
this.glow.visible = false;
}
mouseEnabled = false;
addEventListener(MouseEvent.MOUSE_DOWN,this.btnDownHandler,false,1,true);
addEventListener(MouseEvent.ROLL_OVER,this.btnOverHandler,false,1,true);
addEventListener(MouseEvent.ROLL_OUT,this.btnOutHandler,false,1,true);
}
public function initToolTip(param1:DisplayObjectContainer, param2:String, param3:int, param4:int, param5:Boolean = true) : void
{
if(!this._toolTip)
{
this._toolTip = GETDEFINITIONBYNAME("Tooltip");
}
this._toolTip.init(param1,param2,this.x + param3,this.y + param4,param5);
}
public function activateGrayState(param1:Boolean) : void
{
if(param1)
{
if(this.hasGrayState && !this.isGray)
{
this.isGray = this.gray.visible = true;
this._mouseVisibleOnEnableGray = this.mouse.visible;
this.mouse.visible = false;
if(this.down)
{
this.down.visible = false;
}
removeEventListener(MouseEvent.ROLL_OVER,this.btnOverHandler);
removeEventListener(MouseEvent.ROLL_OUT,this.btnOutHandler);
removeEventListener(MouseEvent.MOUSE_DOWN,this.btnDownHandler);
}
}
else if(this.hasGrayState && this.isGray)
{
this.isGray = this.gray.visible = false;
if(this._mouseVisibleOnEnableGray)
{
this.mouse.visible = true;
}
else
{
this.mouse.visible = false;
}
if(this.down)
{
this.down.visible = !this.mouse.visible;
}
addEventListener(MouseEvent.ROLL_OVER,this.btnOverHandler,false,1,true);
addEventListener(MouseEvent.ROLL_OUT,this.btnOutHandler,false,1,true);
addEventListener(MouseEvent.MOUSE_DOWN,this.btnDownHandler,false,1,true);
}
}
public function activateGlowArrowState(param1:Boolean) : void
{
if(param1)
{
if(this.hasGlowArrowState)
{
this.isGlowArrow = true;
this.glowArrow.visible = true;
this.glowArrow.mouseChildren = false;
this.glowArrow.mouseEnabled = false;
}
}
else if(this.hasGlowArrowState)
{
this.isGlowArrow = false;
this.glowArrow.visible = false;
}
}
public function setButtonState(param1:int) : void
{
this.activateGlowArrowState(false);
this.activateGrayState(false);
switch(param1)
{
case 0:
if(this.glow)
{
this.glow.visible = false;
}
this.activateGrayState(true);
break;
case 1:
this.activateGlowArrowState(false);
break;
case 2:
this.activateGlowArrowState(true);
}
}
public function pulseButton(param1:Boolean, param2:int = -1) : void
{
if(param1)
{
this.mouse.addEventListener(Event.ENTER_FRAME,this.pulseFrameHandler,false,0,true);
this._repetitions = param2;
}
else
{
this.mouse.removeEventListener(Event.ENTER_FRAME,this.pulseFrameHandler);
this._repetitions = 0;
}
}
private function pulseFrameHandler(param1:Event) : void
{
var _loc2_:MovieClip = MovieClip(param1.target);
if(this._repetitions > 0)
{
if(this._pulseForward && _loc2_.currentFrame <= _loc2_.totalFrames - 1)
{
if(this._pulseExtraFrames > 10)
{
_loc2_.nextFrame();
}
else
{
++this._pulseExtraFrames;
}
if(_loc2_.currentFrame == _loc2_.totalFrames)
{
--this._repetitions;
this._pulseForward = false;
this._pulseExtraFrames = 0;
}
}
else if(this._pulseExtraFrames >= 10)
{
_loc2_.prevFrame();
if(_loc2_.currentFrame == 1)
{
--this._repetitions;
this._pulseForward = true;
this._pulseExtraFrames = 0;
}
}
else
{
++this._pulseExtraFrames;
}
}
else if(this._repetitions == -1)
{
if(this._pulseForward && _loc2_.currentFrame <= _loc2_.totalFrames - 1)
{
if(this._pulseExtraFrames > 10)
{
_loc2_.nextFrame();
}
else
{
++this._pulseExtraFrames;
}
if(_loc2_.currentFrame == _loc2_.totalFrames)
{
this._pulseForward = false;
this._pulseExtraFrames = 0;
}
}
else if(this._pulseExtraFrames >= 10)
{
_loc2_.prevFrame();
if(_loc2_.currentFrame == 1)
{
this._pulseForward = true;
this._pulseExtraFrames = 0;
}
}
else
{
++this._pulseExtraFrames;
}
}
else
{
this.mouse.removeEventListener(Event.ENTER_FRAME,this.pulseFrameHandler);
}
}
private function btnOverHandler(param1:MouseEvent) : void
{
this.hazMouse = true;
if(this.mouse.visible)
{
if(this.mouse.hasEventListener(Event.ENTER_FRAME))
{
this.mouse.removeEventListener(Event.ENTER_FRAME,this.pbFrameHandler);
}
this.mouse.gotoAndPlay(1);
if(this.soundsEnabled && param1 != null)
{
this.playRolloverSound();
}
if(Boolean(this._toolTip) && this._toolTip.enabled)
{
this._toolTip.startTimer(param1);
this._toolTip.bringToolToFront();
}
}
}
private function btnOutHandler(param1:MouseEvent) : void
{
this.hazMouse = false;
if(this.mouse.visible)
{
if(this.mouse.currentFrame > 1)
{
this.playBackwards(this.mouse);
}
else
{
this.mouse.stop();
}
if(Boolean(this._toolTip) && Boolean(this._toolTip.toolTipTimer) && this._toolTip.isTimerRunning())
{
this._toolTip.resetTimerAndSetVisibility();
}
else if(this._toolTip)
{
this._toolTip.visible = false;
}
}
}
private function btnDownHandler(param1:MouseEvent) : void
{
if(this.isGray)
{
if(param1)
{
param1.stopPropagation();
}
return;
}
if(Boolean(this.down) && !this.down.visible)
{
this.down.visible = true;
this.mouse.visible = false;
}
else
{
this.mouse.visible = true;
this.mouse.gotoAndPlay(1);
if(this.down)
{
this.down.visible = false;
}
}
if(this.soundsEnabled && param1 != null)
{
this.playClickSound();
}
if(Boolean(this._toolTip) && Boolean(this._toolTip.toolTipTimer) && this._toolTip.isTimerRunning())
{
this._toolTip.resetTimerAndSetVisibility();
}
else if(this._toolTip)
{
this._toolTip.visible = false;
}
}
public function setTimer(param1:Boolean) : void
{
this._useTimer = param1;
}
private function selWatcher(param1:Event) : void
{
var _loc2_:MovieClip = null;
if(param1.target as MovieClip)
{
_loc2_ = MovieClip(param1.target);
if(_loc2_.currentFrame == _loc2_.totalFrames)
{
if(this.hazMouse)
{
this.mouse.gotoAndPlay(1);
}
else
{
this.mouse.gotoAndStop(1);
}
this.mouse.visible = true;
_loc2_.gotoAndStop(1);
_loc2_.visible = false;
_loc2_.removeEventListener(Event.ENTER_FRAME,this.selWatcher);
}
}
}
private function queueClick(param1:MovieClip) : void
{
this.clickQueued = true;
param1.addEventListener(Event.ENTER_FRAME,this.qcFrameHandler,false,0,true);
}
private function queueClickCallback() : void
{
if(!this.down.visible)
{
this.down.visible = true;
this.mouse.visible = false;
}
this.down.gotoAndPlay(1);
}
private function qcFrameHandler(param1:Event) : void
{
var _loc2_:MovieClip = null;
if(this.clickQueued && Boolean(param1.target as MovieClip))
{
_loc2_ = MovieClip(param1.target);
if(_loc2_.currentFrame == _loc2_.totalFrames)
{
this.clickQueued = false;
this.queueClickCallback();
_loc2_.removeEventListener(Event.ENTER_FRAME,this.qcFrameHandler);
}
}
}
private function playBackwards(param1:MovieClip) : void
{
param1.addEventListener(Event.ENTER_FRAME,this.pbFrameHandler,false,0,true);
}
private function pbFrameHandler(param1:Event) : void
{
var _loc2_:MovieClip = null;
if(param1.target as MovieClip)
{
_loc2_ = MovieClip(param1.target);
if(_loc2_.currentFrame == 1)
{
_loc2_.removeEventListener(Event.ENTER_FRAME,this.pbFrameHandler);
return;
}
_loc2_.prevFrame();
}
}
public function downToUpState() : void
{
if(this.down)
{
this.down.visible = false;
}
this.mouse.visible = true;
this.mouse.gotoAndStop(1);
}
public function upToDownState() : void
{
if(Boolean(this.down) && !this.down.visible)
{
this.down.visible = true;
this.mouse.visible = false;
}
}
public function playClickSound() : void
{
AJAudio.playHudBtnClick();
}
public function playRolloverSound() : void
{
AJAudio.playHudBtnRollover();
}
}
}
@@ -0,0 +1,88 @@
package gui
{
import flash.display.MovieClip;
public class GuiStatusIcon
{
public function GuiStatusIcon()
{
super();
}
public static function initClip(param1:MovieClip, param2:Object = null) : void
{
param1.visible = false;
param1["_x"].visible = false;
param1["_wait"].visible = true;
param1["_check"].visible = false;
if(param2)
{
param2.xTracking = false;
param2.waitTracking = true;
param2.checkTracking = false;
}
}
public static function initClipOff(param1:MovieClip, param2:Object = null) : void
{
param1.visible = false;
param1["_x"].visible = false;
param1["_wait"].visible = false;
param1["_check"].visible = false;
if(param2)
{
param2.xTracking = false;
param2.waitTracking = false;
param2.checkTracking = false;
}
}
public static function setVisBasedOnTrackers(param1:MovieClip, param2:Object = null) : void
{
param1["_x"].visible = param2.xTracking;
param1["_wait"].visible = param2.waitTracking;
param1["_check"].visible = param2.checkTracking;
}
public static function showX(param1:MovieClip, param2:Object = null) : void
{
param1["_x"].visible = true;
param1["_wait"].visible = false;
param1["_check"].visible = false;
if(param2)
{
param2.xTracking = true;
param2.waitTracking = false;
param2.checkTracking = false;
}
}
public static function showWait(param1:MovieClip, param2:Object = null) : void
{
param1["_x"].visible = false;
param1["_wait"].visible = true;
param1["_check"].visible = false;
if(param2)
{
param2.xTracking = false;
param2.waitTracking = true;
param2.checkTracking = false;
}
}
public static function showCheck(param1:MovieClip, param2:Object = null) : void
{
param1["_x"].visible = false;
param1["_wait"].visible = false;
param1["_check"].visible = true;
if(param2)
{
param2.xTracking = false;
param2.waitTracking = false;
param2.checkTracking = true;
}
}
}
}
@@ -0,0 +1,230 @@
package gui
{
import achievement.AchievementXtCommManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.TextFieldAutoSize;
import loader.MediaHelper;
import localization.LocalizationManager;
import movie.MovieManager;
public class ImageDisplayPopup
{
private const POPUP_MEDIA_ID:int = 2418;
private const IMAGES_LIST_ID:int = 182;
private var _guiLayer:DisplayLayer;
private var _popupMediaHelper:MediaHelper;
private var _popup:MovieClip;
private var _loadingSpiral:LoadingSpiral;
private var _imageIds:Array;
private var _mediaIndex:int;
private var _imageMediaHelper:MediaHelper;
private var _itemWindow:MovieClip;
private var _locStrs:Array;
private var _closeCallback:Function;
private var _tutorialStreamId:int;
private var _tutorialSubtitleId:int;
private var _tutorialText:String;
private var _userVarIdToCheck:int;
private var _videoGenericListId:int;
public function ImageDisplayPopup(param1:Function, param2:int, param3:int)
{
super();
DarkenManager.showLoadingSpiral(true);
this._closeCallback = param1;
this._guiLayer = GuiManager.guiLayer;
this._userVarIdToCheck = param3;
this._videoGenericListId = param2;
this._popupMediaHelper = new MediaHelper();
this._popupMediaHelper.init(this.POPUP_MEDIA_ID,this.onMediaLoaded);
}
public function destroy() : void
{
DarkenManager.unDarken(this._popup);
this._guiLayer.removeChild(this._popup);
if(this._popupMediaHelper)
{
this._popupMediaHelper.destroy();
this._popupMediaHelper = null;
}
if(this._imageMediaHelper)
{
this._imageMediaHelper.destroy();
this._imageMediaHelper = null;
}
if(this._loadingSpiral)
{
this._loadingSpiral.destroy();
this._loadingSpiral = null;
}
this.removeEventListeners();
this._popup = null;
this._closeCallback = null;
}
private function onMediaLoaded(param1:MovieClip) : void
{
this._popup = param1.getChildAt(0) as MovieClip;
this._popup.info.visible = false;
this._popup.darkBg.visible = false;
this._itemWindow = this._popup.greatNatureProject.itemWindow;
this._loadingSpiral = new LoadingSpiral(this._itemWindow);
this._imageMediaHelper = new MediaHelper();
this._popup.x = MainFrame.VIEW_WIDTH * 0.5;
this._popup.y = MainFrame.VIEW_HEIGHT * 0.5;
this._popup.greatNatureProject.artistName.autoSize = TextFieldAutoSize.RIGHT;
GenericListXtCommManager.requestStreamList(this._videoGenericListId,this.onTutorialGLReceived);
GenericListXtCommManager.requestGenericList(this.IMAGES_LIST_ID,this.onImagesListReceived);
this.addEventListeners();
DarkenManager.showLoadingSpiral(false);
this._guiLayer.addChild(this._popup);
DarkenManager.darken(this._popup);
}
private function onImagesListReceived(param1:int, param2:Array, param3:Array) : void
{
this._imageIds = param2;
this._locStrs = param3;
this.loadImage(null);
}
private function onTutorialGLReceived(param1:int, param2:Array, param3:Array, param4:Array, param5:Array, param6:Array, param7:Array) : void
{
this._tutorialStreamId = param2[0];
this._tutorialText = param4[0];
this._tutorialSubtitleId = param7[0];
if(gMainFrame.userInfo.userVarCache.getUserVarValueById(this._userVarIdToCheck) < 0)
{
this.onInfo(null);
AchievementXtCommManager.requestSetUserVar(this._userVarIdToCheck,1);
}
}
private function loadImage(param1:MouseEvent) : void
{
if(this._popup)
{
this._loadingSpiral.visible = true;
if(param1)
{
if(param1.currentTarget == this._popup.greatNatureProject.lArrow)
{
if(--this._mediaIndex < 0)
{
this._mediaIndex = this._imageIds.length - 1;
}
}
else if(param1.currentTarget == this._popup.greatNatureProject.rArrow)
{
if(++this._mediaIndex > this._imageIds.length - 1)
{
this._mediaIndex = 0;
}
}
}
this._popup.greatNatureProject.lArrow.activateGrayState(true);
this._popup.greatNatureProject.rArrow.activateGrayState(true);
LocalizationManager.translateId(this._popup.greatNatureProject.artistName,this._locStrs[this._mediaIndex]);
this._popup.greatNatureProject.photoCredit.x = this._popup.greatNatureProject.artistName.x - this._popup.greatNatureProject.photoCredit.width - 2;
this._imageMediaHelper.init(this._imageIds[this._mediaIndex],this.onImageLoaded);
}
}
private function onImageLoaded(param1:MovieClip) : void
{
if(this._popup)
{
while(this._itemWindow.numChildren > 0)
{
this._itemWindow.removeChildAt(0);
}
this._itemWindow.addChild(param1);
this._loadingSpiral.visible = false;
this._popup.greatNatureProject.lArrow.activateGrayState(false);
this._popup.greatNatureProject.rArrow.activateGrayState(false);
}
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onArrow(param1:MouseEvent) : void
{
param1.stopPropagation();
this.loadImage(param1);
}
private function onInfo(param1:MouseEvent) : void
{
if(param1)
{
param1.stopPropagation();
}
DarkenManager.showLoadingSpiral(true);
GuiManager.initMoviePlayer(MovieManager.VID_PLAYER_MEDIA_ID,[this._tutorialStreamId],[this._tutorialText],[this._tutorialSubtitleId],false);
}
private function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
if(param1.currentTarget == this._popup.info.xBtn)
{
this._popup.darkBg.visible = false;
this._popup.info.visible = false;
}
else if(param1.currentTarget == this._popup.greatNatureProject.xBtn)
{
if(this._closeCallback != null)
{
this._closeCallback();
}
else
{
this.destroy();
}
}
}
private function addEventListeners() : void
{
this._popup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
this._popup.greatNatureProject.lArrow.addEventListener(MouseEvent.MOUSE_DOWN,this.onArrow,false,0,true);
this._popup.greatNatureProject.rArrow.addEventListener(MouseEvent.MOUSE_DOWN,this.onArrow,false,0,true);
this._popup.greatNatureProject.infoBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onInfo,false,0,true);
this._popup.greatNatureProject.xBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
this._popup.info.xBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
}
private function removeEventListeners() : void
{
this._popup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
this._popup.greatNatureProject.lArrow.removeEventListener(MouseEvent.MOUSE_DOWN,this.onArrow);
this._popup.greatNatureProject.rArrow.removeEventListener(MouseEvent.MOUSE_DOWN,this.onArrow);
this._popup.greatNatureProject.infoBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onInfo);
this._popup.greatNatureProject.xBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
this._popup.info.xBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
}
}
}
@@ -0,0 +1,431 @@
package gui
{
import achievement.AchievementXtCommManager;
import com.sbi.analytics.SBTracker;
import com.sbi.popup.SBOkPopup;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
import localization.LocalizationManager;
public class ImagePoll
{
private static var _guiLayer:DisplayLayer;
private static var _mediaHelper:MediaHelper;
private static var _imgPopup:MovieClip;
private static var _pollTab:MovieClip;
private static var _closeCallback:Function;
private static var _spirals:Array;
private static var _mediaIds:Array;
private static var _randOptionLookup:Array;
private static var _locStrings:Array;
private static var _mediaHolder:Array;
private static var _checkedItems:Array;
private static var _itemImages:Array;
private static var _numAllowedVotes:int;
private static var _pollUserVardId:int;
private static var _numImageWindow:int;
private static var _pollPopupMediaId:int;
private static var _pollUserVarIndex:int;
public static const TSHIRT_VAR_ID:int = 312;
public static const DEN_ITEM_VOTING_VAR_ID:int = 374;
public static const TSHIRT_IMAGES_MEDIA_ID:int = 76;
public static const POLL_MEDIA_ID:int = 1355;
public static const DEN_POLL_MEDIA_ID:int = 2926;
public function ImagePoll()
{
super();
}
public static function displayPoll(param1:int, param2:int, param3:int, param4:int, param5:int, param6:int, param7:MovieClip = null, param8:Function = null) : void
{
if(gMainFrame.userInfo.userVarCache.getUserVarValueById(param1) != param2)
{
DarkenManager.showLoadingSpiral(true);
_spirals = [];
_checkedItems = [];
_guiLayer = GuiManager.guiLayer;
_pollPopupMediaId = param3;
_numImageWindow = param5;
_numAllowedVotes = param6;
_pollUserVardId = param1;
_pollTab = param7;
_closeCallback = param8;
_pollUserVarIndex = param2;
if(param4 != 0)
{
GenericListXtCommManager.requestGenericList(param4,onMediaListReceived);
}
else
{
onMediaListReceived(0,null,null);
}
}
else
{
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(18821));
}
}
public static function destroy(param1:Boolean) : void
{
var _loc2_:int = 0;
while(_loc2_ < _mediaHolder.length)
{
if(_mediaHolder[_loc2_])
{
_mediaHolder[_loc2_].destroy();
}
if(_spirals[_loc2_])
{
_spirals[_loc2_].destroy();
}
_loc2_++;
}
removeListeners();
DarkenManager.unDarken(_imgPopup);
_guiLayer.removeChild(_imgPopup);
if(param1)
{
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(18821));
}
}
private static function onMediaListReceived(param1:int, param2:Array, param3:Array) : void
{
if(_mediaIds)
{
_mediaIds = param2;
_randOptionLookup = [0,1,2,3,4,5,6,7,8,9];
_locStrings = param3;
_mediaIds = shuffleArray(_mediaIds);
}
_mediaHelper = new MediaHelper();
_mediaHelper.init(_pollPopupMediaId,onMediaReceived,true);
}
private static function onMediaReceived(param1:MovieClip) : void
{
var _loc2_:Object = null;
var _loc3_:int = 0;
var _loc4_:Object = null;
if(param1)
{
if(param1.mediaHelper.id == _pollPopupMediaId)
{
DarkenManager.showLoadingSpiral(false);
_imgPopup = MovieClip(param1.getChildAt(0));
_imgPopup.x = MainFrame.VIEW_WIDTH * 0.5;
_imgPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
_imgPopup.imageViewerPopup.visible = false;
_imgPopup.scrim.visible = false;
if(_imgPopup.doneBtn.hasGrayState)
{
_imgPopup.doneBtn.activateGrayState(true);
}
_mediaHelper.destroy();
_mediaHelper = null;
_mediaHolder = [];
_itemImages = [];
_loc3_ = 0;
while(_loc3_ < _numImageWindow)
{
_loc2_ = _imgPopup["pollItem" + _loc3_];
_loc2_.index = _loc3_;
_loc2_.ItemHL.itemSelectedHL.visible = false;
_loc2_.ItemHL.mouseOverHL.gotoAndStop("out");
_loc2_.checkbox.checkmark.visible = false;
_loc2_.checkbox.mouse.visible = false;
if(_mediaIds)
{
_spirals[_loc3_] = new LoadingSpiral(_loc2_.itemBlock);
_mediaHelper = new MediaHelper();
_mediaHelper.init(_mediaIds[_loc3_],onMediaReceived,_loc3_);
_mediaHolder.push(_mediaHelper);
_mediaHelper = new MediaHelper();
_mediaHelper.init(_mediaIds[_loc3_],onMediaReceived,_loc3_ + 10);
_mediaHolder.push(_mediaHelper);
}
_loc3_++;
}
_guiLayer.addChild(_imgPopup);
DarkenManager.darken(_imgPopup);
addListeners();
}
else
{
_loc4_ = param1.getChildAt(0);
_itemImages[param1.passback] = _loc4_;
if(param1.passback < _numImageWindow)
{
_spirals[param1.passback].destroy();
_imgPopup["pollItem" + param1.passback].itemBlock.addChild(_loc4_);
}
}
}
}
private static function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private static function onClose(param1:MouseEvent) : void
{
var _loc2_:int = 0;
var _loc3_:int = 0;
param1.stopPropagation();
if(!param1.currentTarget.isGray)
{
if(param1.currentTarget.name == "doneBtn")
{
_loc3_ = 0;
while(_loc3_ < _checkedItems.length)
{
if(_checkedItems[_loc3_] != null)
{
if(_randOptionLookup)
{
_loc2_ |= 1 << _randOptionLookup[_checkedItems[_loc3_]];
}
else
{
_loc2_ |= 1 << _checkedItems[_loc3_];
}
}
_loc3_++;
}
SBTracker.trackPageview("/game/play/imageVote/#" + _loc2_);
AchievementXtCommManager.requestSetUserVar(_pollUserVardId,_pollUserVarIndex);
if(_closeCallback != null)
{
_closeCallback(_pollTab);
_closeCallback = null;
}
}
else if(_closeCallback != null)
{
SBTracker.pop();
}
destroy(param1.currentTarget.name == "doneBtn");
}
}
private static function onItemOut(param1:MouseEvent) : void
{
param1.stopPropagation();
if(param1.currentTarget.ItemHL.mouseOverHL.currentFrameLabel != "out")
{
param1.currentTarget.ItemHL.mouseOverHL.gotoAndStop("out");
}
}
private static function onItemOver(param1:MouseEvent) : void
{
param1.stopPropagation();
if(param1.currentTarget.ItemHL.mouseOverHL.currentFrameLabel != "over")
{
param1.currentTarget.ItemHL.mouseOverHL.gotoAndStop("over");
}
}
private static function onCheckOut(param1:MouseEvent) : void
{
param1.stopPropagation();
param1.currentTarget.mouse.visible = !param1.currentTarget.mouse.visible;
}
private static function onCheckOver(param1:MouseEvent) : void
{
param1.stopPropagation();
param1.currentTarget.mouse.visible = !param1.currentTarget.mouse.visible;
}
private static function onCheckOrVote(param1:MouseEvent) : void
{
var _loc2_:int = 0;
var _loc3_:Boolean = false;
var _loc4_:int = 0;
param1.stopPropagation();
if(param1.currentTarget.name == "checkbox")
{
param1.currentTarget.checkmark.visible = _loc3_ = !param1.currentTarget.checkmark.visible;
_loc2_ = int(param1.currentTarget.parent.index);
}
else
{
_loc2_ = int(param1.currentTarget.parent.currPollIndex);
_imgPopup["pollItem" + _loc2_].checkbox.checkmark.visible = _loc3_ = !_imgPopup["pollItem" + _loc2_].checkbox.checkmark.visible;
}
if(_loc3_)
{
_checkedItems.push(_loc2_);
if(_checkedItems.length > _numAllowedVotes)
{
_loc4_ = int(_checkedItems[0]);
_checkedItems.shift();
_imgPopup["pollItem" + _loc4_].checkbox.checkmark.visible = false;
_imgPopup["pollItem" + _loc4_].ItemHL.itemSelectedHL.visible = false;
}
if(_checkedItems.length > 0)
{
if(Boolean(_imgPopup.doneBtn.hasGrayState) && Boolean(_imgPopup.doneBtn.isGray))
{
_imgPopup.doneBtn.activateGrayState(false);
}
}
}
else
{
_checkedItems.splice(_checkedItems.indexOf(_loc2_),1);
if(Boolean(_imgPopup.doneBtn.hasGrayState) && Boolean(!_imgPopup.doneBtn.isGray) && _checkedItems.length == 0)
{
_imgPopup.doneBtn.activateGrayState(true);
}
}
_imgPopup["pollItem" + _loc2_].ItemHL.itemSelectedHL.visible = _loc3_;
if(param1.currentTarget.name != "checkbox")
{
_imgPopup.imageViewerPopup.visible = false;
_imgPopup.scrim.visible = false;
}
}
private static function onItemZoom(param1:MouseEvent) : void
{
var _loc3_:MovieClip = null;
param1.stopPropagation();
_imgPopup.imageViewerPopup.visible = true;
_imgPopup.scrim.visible = true;
if(_imgPopup.imageViewerPopup.currentLabels.length < 1)
{
while(_imgPopup.imageViewerPopup.itemBlock.numChildren > 0)
{
_imgPopup.imageViewerPopup.itemBlock.removeChildAt(0);
}
}
var _loc2_:int = param1.currentTarget.name == "zoomBtn" ? int(param1.currentTarget.parent.index) : int(param1.currentTarget.index);
if(_itemImages)
{
_loc3_ = _itemImages[_loc2_ + 10];
if(_loc3_ != null)
{
_loc3_.gotoAndStop("large");
_imgPopup.imageViewerPopup.itemBlock.addChild(_loc3_);
}
}
if(_locStrings)
{
_imgPopup.imageViewerPopup.titleTxt.text = _locStrings[_randOptionLookup[_loc2_]];
}
if(_imgPopup.imageViewerPopup.currentLabels.length > 1)
{
_imgPopup.imageViewerPopup.gotoAndStop("pollItem" + _loc2_);
_imgPopup.imageViewerPopup.titleTxt.text = _imgPopup["pollItem" + _loc2_].titleTxt.text;
}
_imgPopup.imageViewerPopup.currPollIndex = _loc2_;
}
private static function onCloseViewer(param1:MouseEvent) : void
{
param1.stopPropagation();
_imgPopup.imageViewerPopup.visible = false;
_imgPopup.scrim.visible = false;
}
private static function shuffleArray(param1:Array) : Array
{
var _loc4_:String = null;
var _loc5_:int = 0;
var _loc6_:int = 0;
var _loc7_:int = 0;
var _loc2_:int = int(param1.length);
var _loc3_:Array = param1.slice();
while(_loc5_ < _loc2_)
{
_loc4_ = _loc3_[_loc5_];
_loc6_ = Math.floor(Math.random() * _loc2_);
if(_loc5_ != _loc6_)
{
_loc3_[_loc5_] = _loc3_[_loc6_];
_loc3_[_loc6_] = _loc4_;
_loc7_ = int(_randOptionLookup[_loc5_]);
_randOptionLookup[_loc5_] = _randOptionLookup[_loc6_];
_randOptionLookup[_loc6_] = _loc7_;
}
_loc5_++;
}
return _loc3_;
}
private static function addListeners() : void
{
var _loc1_:Object = null;
_imgPopup.addEventListener(MouseEvent.MOUSE_DOWN,onPopup,false,0,true);
_imgPopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,onClose,false,0,true);
_imgPopup.doneBtn.addEventListener(MouseEvent.MOUSE_DOWN,onClose,false,0,true);
var _loc2_:int = 0;
while(_loc2_ < _numImageWindow)
{
_loc1_ = _imgPopup["pollItem" + _loc2_];
_loc1_.addEventListener(MouseEvent.MOUSE_OUT,onItemOut,false,0,true);
_loc1_.addEventListener(MouseEvent.MOUSE_OVER,onItemOver,false,0,true);
_loc1_.addEventListener(MouseEvent.MOUSE_DOWN,onItemZoom,false,0,true);
_loc1_.zoomBtn.addEventListener(MouseEvent.MOUSE_DOWN,onItemZoom,false,0,true);
_loc1_.checkbox.addEventListener(MouseEvent.ROLL_OVER,onCheckOver,false,0,true);
_loc1_.checkbox.addEventListener(MouseEvent.ROLL_OUT,onCheckOut,false,0,true);
_loc1_.checkbox.addEventListener(MouseEvent.MOUSE_DOWN,onCheckOrVote,false,0,true);
_loc2_++;
}
_imgPopup.imageViewerPopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,onCloseViewer,false,0,true);
_imgPopup.imageViewerPopup.voteBtn.addEventListener(MouseEvent.MOUSE_DOWN,onCheckOrVote,false,0,true);
}
private static function removeListeners() : void
{
var _loc1_:Object = null;
_imgPopup.removeEventListener(MouseEvent.MOUSE_DOWN,onPopup);
_imgPopup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,onClose);
_imgPopup.doneBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onClose);
var _loc2_:int = 0;
while(_loc2_ < _numImageWindow)
{
_loc1_ = _imgPopup["pollItem" + _loc2_];
_loc1_.removeEventListener(MouseEvent.MOUSE_OUT,onItemOut);
_loc1_.removeEventListener(MouseEvent.MOUSE_OVER,onItemOver);
_loc1_.removeEventListener(MouseEvent.MOUSE_DOWN,onItemZoom);
_loc1_.zoomBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onItemZoom);
_loc1_.checkbox.removeEventListener(MouseEvent.ROLL_OVER,onCheckOver);
_loc1_.checkbox.removeEventListener(MouseEvent.ROLL_OUT,onCheckOut);
_loc1_.checkbox.removeEventListener(MouseEvent.MOUSE_DOWN,onCheckOrVote);
_loc2_++;
}
_imgPopup.imageViewerPopup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,onCloseViewer);
_imgPopup.imageViewerPopup.voteBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onCheckOrVote);
}
}
}
@@ -0,0 +1,172 @@
package gui
{
import avatar.AvatarInfo;
import avatar.AvatarManager;
import avatar.UserCommXtCommManager;
import com.sbi.popup.SBOkPopup;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import localization.LocalizationManager;
import pet.PetManager;
import quest.QuestManager;
import quest.QuestXtCommManager;
import room.RoomXtCommManager;
public class ItemWindowAdventure extends ItemWindowBase
{
private var _scriptDef:Object;
public function ItemWindowAdventure(param1:Function, param2:MovieClip, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
this._scriptDef = QuestXtCommManager.getScriptDef(param9.scriptIds[param4]);
super(this._scriptDef.bannerMediaRefId,param1,param2,param3,param4,param5,param6,param7,param8);
}
override protected function setChildrenAndInitialConditions() : void
{
var _loc1_:AvatarInfo = null;
_window.txt.mouseEnabled = false;
_window.txt.mouseChildren = false;
LocalizationManager.translateId(_window.txt.titleTxt,this._scriptDef.titleStrId);
if(_window["memLock"])
{
_window["memLock"].visible = this._scriptDef.membersOnly;
_window["memLock"].mouseEnabled = false;
_window["memLock"].mouseChildren = false;
_loc1_ = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
if(_loc1_)
{
if(_loc1_.questLevel < this._scriptDef.levelMin)
{
_window.tag.visible = false;
}
}
}
if(this._scriptDef.defId == 21)
{
_window.tag.visible = false;
}
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null && !(_memberOnlyDown != null && !gMainFrame.userInfo.isMember))
{
addEventListener(MouseEvent.MOUSE_DOWN,_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener(MouseEvent.ROLL_OVER,_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener(MouseEvent.ROLL_OUT,_mouseOut,false,0,true);
}
if(_memberOnlyDown != null && !gMainFrame.userInfo.isMember)
{
addEventListener(MouseEvent.MOUSE_DOWN,_memberOnlyDown,false,0,true);
}
}
}
public function performContinueChecks() : Object
{
var _loc1_:AvatarInfo = null;
var _loc2_:Object = null;
if(QuestManager.isInPrivateAdventureState)
{
QuestManager.showLeaveQuestLobbyPopup(this.performContinueChecks);
return null;
}
if(AvatarManager.isMyUserInCustomPVPState())
{
UserCommXtCommManager.sendCustomPVPMessage(false,0);
}
if(!RoomXtCommManager.isSwitching)
{
if(Boolean(this._scriptDef.membersOnly) && !gMainFrame.userInfo.isMember)
{
UpsellManager.displayPopup(UpsellManager.ADVENTURES,"adventure/" + this._scriptDef.defId);
return null;
}
_loc1_ = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
if(_loc1_)
{
if(this._scriptDef.playAsPet)
{
_loc2_ = PetManager.myActivePet;
if(!_loc2_)
{
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(19656));
return null;
}
if(!PetManager.canPetGoInEnviroType(_loc2_.type,this._scriptDef.avatarType))
{
switch(this._scriptDef.avatarType)
{
case 1:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(19648));
break;
case 2:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(19649));
break;
case 4:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(19650));
break;
case 5:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(19655));
}
return null;
}
}
else
{
if(Boolean(AvatarManager.playerAvatar) && !AvatarManager.isValidEnviro(this._scriptDef.avatarType))
{
switch(this._scriptDef.avatarType)
{
case 1:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(15706));
break;
case 2:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(18476));
break;
case 4:
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(18475));
break;
case 5:
}
return null;
}
if(_loc1_.questLevel < this._scriptDef.levelMin)
{
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdAndInsertOnly(14697,this._scriptDef.levelMin));
return null;
}
if(this._scriptDef.avatarLimit == 1 && Boolean(_window.tag.visible))
{
return {
"func":QuestXtCommManager.sendQuestCreateJoinPublic,
"defId":this._scriptDef.defId
};
}
}
if(_window.tag.visible)
{
return {
"func":AdventureExpertPopup.init,
"defId":this._scriptDef.defId
};
}
return null;
}
return null;
}
return null;
}
}
}
@@ -0,0 +1,450 @@
package gui
{
import avatar.Avatar;
import avatar.AvatarInfo;
import avatar.AvatarSwitch;
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class ItemWindowAnimal extends ItemWindowBase
{
private const COST_OF_NEW_ANIMAL:int = 1000;
private const SLOTS_PER_NONMEMBER:int = 2;
private var _isChoosing:Boolean;
private var _isAnimal:Boolean;
private var _recyclingOnly:Boolean;
private var _addGrayChild:Boolean;
private var _isChoosingOcean:Boolean;
private var _ai:AvatarInfo;
private var _nameBarData:int;
public function ItemWindowAnimal(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
this._isChoosing = param9.isChoosing;
this._isAnimal = param9.isAnimal;
this._recyclingOnly = param9.recylingOnly;
this._isChoosingOcean = param9.isChoosingOcean;
this._nameBarData = param9.nameBarData;
super("amlCont",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get aml() : MovieClip
{
return _window.aml;
}
public function get makeNew() : MovieClip
{
return _window.makeNew;
}
public function get recycle() : MovieClip
{
return _window.recycle;
}
public function get den() : MovieClip
{
return _window.den;
}
public function get lock() : MovieClip
{
return _window.lock;
}
public function get gray() : MovieClip
{
return _window.gray;
}
public function get checkbox() : MovieClip
{
return _window.checkbox;
}
public function get buyDen() : MovieClip
{
return _window.buyDen;
}
public function set currItem(param1:Object) : void
{
_currItem = param1;
}
public function get level() : int
{
return this._ai ? this._ai.questLevel : 0;
}
public function resetWindow(param1:int) : void
{
if(this._isAnimal)
{
_window.makeNew.visible = true;
_window.priceTag.visible = false;
_window.buy.visible = false;
_window.lock.visible = false;
_window.aml.visible = false;
_window.aml.sel.visible = false;
_window.recycle.visible = false;
_window.gray.visible = false;
_window.lock.visible = false;
_window.makeNew.newAmlBtn.gray.visible = false;
_window.xpShape.visible = false;
--AvatarSwitch.numOpenNonMemberSlots;
_isCurrItemLoaded = false;
this.loadCurrItem();
}
else
{
if(param1 > 0)
{
while(_window.den.itemBlock.numChildren > 0)
{
_window.den.itemBlock.removeChildAt(0);
}
}
_window.buyDen.visible = true;
_window.den.visible = false;
_window.priceTag.visible = false;
_window.buy.visible = false;
_window.lock.visible = false;
_window.aml.visible = false;
_window.aml.sel.visible = false;
_window.recycle.visible = false;
_window.gray.visible = false;
}
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
var _loc3_:int = 0;
var _loc4_:Avatar = null;
var _loc5_:int = 0;
var _loc6_:int = 0;
_itemYLocation = param1;
_itemXLocation = param2;
if(this._isAnimal)
{
if(!_isCurrItemLoaded)
{
_loc3_ = SwitchManager.NUM_AVATAR_SLOTS;
_window.gray.grayDen.visible = false;
_window.aml.bg.visible = true;
_window.aml.gray.visible = false;
_window.aml.nameTxt.visible = true;
_window.priceTag.txt.text = this.COST_OF_NEW_ANIMAL;
_window.aml.visible = true;
_loc4_ = AvatarSwitch.avatars[_index];
_loc5_ = AvatarSwitch.numNonMemberAvatars;
_loc6_ = AvatarSwitch.numNonMemberOceanAvatars;
if(_loc4_ != null)
{
if(AvatarSwitch.isSlotAvailable(_index) || this._isChoosing)
{
_window.priceTag.visible = false;
_window.buy.visible = false;
_window.makeNew.visible = false;
_window.lock.visible = false;
_window.aml.visible = true;
_window.aml.sel.visible = false;
_window.aml.nameTxt.text = _loc4_.avName;
if(this._isChoosing)
{
_window.checkbox.visible = true;
_window.checkbox.check.visible = false;
_window.aml.bg.visible = false;
_window.aml.gray.visible = true;
if(_loc5_ > 0 && _loc5_ < 3)
{
if(!AvatarSwitch.isMemberOnlyAvatar(_index))
{
_window.checkbox.check.visible = false;
}
}
if(_loc5_ - _loc6_ < 1 || _loc5_ <= _loc3_ && AvatarSwitch.isMemberOnlyAvatar(_index))
{
_window.aml.visible = false;
_window.gray.visible = true;
_window.lock.visible = true;
_window.checkbox.visible = false;
_window.gray.nameTxt.text = _loc4_.avName;
this._addGrayChild = true;
}
}
else if(!this._isChoosingOcean)
{
_window.recycle.visible = false;
}
if(_index == AvatarSwitch.activeAvatarIdx)
{
_window.aml.sel.visible = true;
}
while(_window.xpShape.numChildren > 0)
{
_window.xpShape.removeChildAt(0);
}
this._ai = gMainFrame.userInfo.getAvatarInfoByUserNameThenPerUserAvId(_loc4_.userName,_loc4_.perUserAvId);
if(Boolean(this._ai) && this._ai.questLevel > 0)
{
this.loadQuestShape();
}
if(this._isChoosing)
{
if(!gMainFrame.userInfo.isMember && !AvatarSwitch.isMemberOnlyAvatar(_index))
{
++AvatarSwitch.numOpenNonMemberSlots;
}
}
else
{
++AvatarSwitch.numOpenNonMemberSlots;
}
}
else
{
_window.aml.visible = false;
_window.gray.visible = true;
_window.gray.nameTxt.text = _loc4_.avName;
this._addGrayChild = true;
_window.gray.amlMask.amlBox.addChild(_currItem);
}
if(Utility.isOcean(_currItem.avatarData.enviroTypeFlag))
{
if(Utility.isLand(_currItem.avatarData.enviroTypeFlag))
{
if(_window.aml.visible)
{
if(_window.aml.gray.visible)
{
_window.aml.gray.gotoAndStop(3);
}
else
{
_window.aml.bg.gotoAndStop(3);
}
}
else
{
_window.gray.grayAml.gotoAndStop(3);
}
}
else if(_window.aml.visible)
{
if(_window.aml.gray.visible)
{
_window.aml.gray.gotoAndStop(2);
}
else
{
_window.aml.bg.gotoAndStop(2);
}
}
else
{
_window.gray.grayAml.gotoAndStop(2);
}
}
}
else
{
if(!gMainFrame.userInfo.isMember)
{
if(AvatarSwitch.numOpenNonMemberSlots < this.SLOTS_PER_NONMEMBER || this._isChoosing && _loc5_ - _loc6_ < 1)
{
++AvatarSwitch.numOpenNonMemberSlots;
_window.makeNew.visible = true;
_window.lock.visible = false;
}
else
{
_window.makeNew.visible = false;
_window.lock.visible = true;
}
}
else
{
_window.makeNew.visible = true;
_window.lock.visible = false;
}
_window.priceTag.visible = false;
_window.buy.visible = false;
_window.aml.visible = false;
_window.aml.sel.visible = false;
_window.recycle.visible = false;
if(this._isChoosing && AvatarSwitch.numNonMemberAvatars > 1 && _loc5_ - _loc6_ > 0)
{
_window.makeNew.newAmlBtn.gray.visible = true;
}
else
{
_window.makeNew.newAmlBtn.gray.visible = false;
}
_isCurrItemLoaded = true;
}
}
}
else if(_currItem != null)
{
if(!_isCurrItemLoaded)
{
_isCurrItemLoaded = true;
_window.den.sel.visible = false;
if(gMainFrame.userInfo.isMember)
{
_window.den.visible = true;
_window.den.txt.text = _currItem.name;
}
else if(_currItem.isMemberOnly)
{
this._addGrayChild = true;
_window.den.visible = false;
_window.gray.visible = true;
_window.gray.nameTxt.text = _currItem.name;
}
else
{
_window.den.visible = true;
_window.den.txt.text = _currItem.name;
}
if(_currItem.isLand)
{
_window.den.greenBG.visible = true;
}
else
{
_window.den.greenBG.visible = false;
}
if(_index == DenSwitch.activeDenIdx)
{
_window.den.sel.visible = true;
}
_window.buyDen.visible = false;
if(this._recyclingOnly)
{
_window.recycle.visible = true;
}
else
{
_window.recycle.visible = false;
}
}
}
else
{
_window.den.visible = false;
_window.buyDen.visible = true;
}
if(Boolean(_currItem) && Boolean(!_isCurrItemLoaded) && this._isAnimal)
{
_isCurrItemLoaded = true;
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
{
if(this._addGrayChild)
{
_window.gray.amlMask.amlBox.addChild(_currItem[_iconLayerName]);
}
else
{
_window.aml.amlMask.amlBox.addChild(_currItem[_iconLayerName]);
}
}
else if(this._addGrayChild)
{
_window.gray.amlMask.amlBox.addChild(_currItem);
}
else
{
_window.aml.amlMask.amlBox.addChild(_currItem);
}
}
}
private function loadQuestShape() : void
{
var _loc1_:String = _window.xpShape.currentLabels[Utility.getColorId(this._nameBarData) - 1].name;
_window.xpShape.visible = true;
if(_loc1_ == "black")
{
_window.xpShape.gotoAndStop(2);
_window.xpShape.gotoAndStop(_loc1_);
}
if(_window.xpShape.currentFrameLabel != _loc1_)
{
_window.xpShape.gotoAndStop(_loc1_);
}
Utility.createXpShape(this._ai.questLevel,true,_window.xpShape[_loc1_].mouse.up.icon,null,this._nameBarData);
}
override public function destroy() : void
{
AvatarSwitch.numOpenNonMemberSlots = 0;
super.destroy();
}
override protected function setChildrenAndInitialConditions() : void
{
_window.priceTag.visible = false;
_window.priceTag.txt.textColor = "0x386630";
_window.buy.visible = false;
_window.makeNew.visible = false;
_window.lock.visible = false;
_window.recycle.visible = false;
_window.den.visible = false;
_window.buyDen.visible = false;
_window.xpShape.visible = false;
if(this._isAnimal)
{
_window.aml.visible = true;
_window.aml.bg.visible = false;
_window.aml.gray.visible = true;
_window.aml.sel.visible = false;
_window.aml.nameTxt.visible = false;
}
else
{
_window.aml.visible = false;
}
_window.gray.visible = false;
_window.buyDen.buyBtn.gray.visible = false;
_window.buy.buyAmlBtn.gray.visible = false;
_window.makeNew.newAmlBtn.gray.visible = false;
_window.checkbox.visible = false;
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null)
{
addEventListener(MouseEvent.MOUSE_DOWN,_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener(MouseEvent.ROLL_OVER,_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener(MouseEvent.ROLL_OUT,_mouseOut,false,0,true);
}
if(_memberOnlyDown != null)
{
addEventListener(MouseEvent.MOUSE_DOWN,_memberOnlyDown,false,0,true);
}
}
}
}
}
@@ -0,0 +1,227 @@
package gui
{
import avatar.Avatar;
import avatar.AvatarUtility;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.filters.ColorMatrixFilter;
import loader.MediaHelper;
import localization.LocalizationManager;
import pet.GuiPet;
import pet.PetManager;
public class ItemWindowAvatarOrPetSelect extends ItemWindowBase
{
private var _mediaHelper:MediaHelper;
private var _currIconId:int;
private var _forCreation:Boolean;
private var _avType:int;
private var _currDef:Object;
private var _shouldShowDiamond:Boolean;
private var _customAvId:int;
private var _creationAvatar:Avatar;
private var _isPet:Boolean;
private var _currGuiPet:GuiPet;
private var _selectedIndex:int;
public function ItemWindowAvatarOrPetSelect(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
this._currIconId = int(param2);
this._isPet = param9.isPet == null ? false : true;
this._selectedIndex = param9.selectedIndex == null ? 0 : int(param9.selectedIndex);
if(!this._isPet)
{
this._forCreation = param9.forCreation == null ? false : Boolean(param9.forCreation);
this._avType = param9.avTypes[param4];
this._creationAvatar = param9.creationAvatars[param4];
this._customAvId = this._creationAvatar.customAvId;
this._currDef = AvatarUtility.findAvDefByType(this._avType,this._customAvId);
this._shouldShowDiamond = Boolean(this._currDef.isDiamond) && !AvatarUtility.getAvatarDefIsViewableWithAvId(this._avType,this._customAvId != -1);
}
else
{
this._currDef = PetManager.getPetDef(this._currIconId);
this._shouldShowDiamond = this._currDef.isDiamond;
}
super(1810,param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get currIconId() : int
{
return this._currIconId;
}
public function get currWindow() : MovieClip
{
return _window;
}
public function get customAvId() : int
{
return this._customAvId;
}
public function selectItem() : void
{
if(_window.currentFrameLabel != (!this._isPet && this.isDiamond) ? Boolean("diamond_down") : Boolean("down"))
{
_window.gotoAndStop(!this._isPet && this.isDiamond ? "diamond_down" : "down");
}
}
public function deselect() : void
{
if(_window.currentFrameLabel != (!this._isPet && this.isDiamond) ? Boolean("diamond_up") : Boolean("up"))
{
_window.gotoAndStop(!this._isPet && this.isDiamond ? "diamond_up" : "up");
}
}
public function setupLayers() : void
{
_window.diamond.visible = this._shouldShowDiamond;
}
public function get isDiamond() : Boolean
{
return this._currDef.isDiamond;
}
override public function destroy() : void
{
super.destroy();
if(this._currGuiPet)
{
this._currGuiPet.destroy();
this._currGuiPet = null;
}
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
var _loc3_:Array = null;
var _loc4_:Array = null;
if(_window)
{
if(this._isPet)
{
if(!_isCurrItemLoaded)
{
_loc3_ = PetManager.packPetBits(PetManager.createRandomPet(this._currIconId));
this._currGuiPet = PetManager.getGuiPet(0,_loc3_[0],_loc3_[1],_loc3_[2],this._currDef.type,this._currDef.title,null);
_window.diamond.visible = this._shouldShowDiamond;
if(!gMainFrame.userInfo.isMember)
{
if(this._currDef.isMember)
{
_window.memberLock.visible = true;
}
}
if(this._currGuiPet.canGoInOcean())
{
_window.ocean.visible = true;
}
this._currGuiPet.scaleX = this._currGuiPet.scaleY = 2;
this._currGuiPet.x = 53;
this._currGuiPet.y = 85;
_window.itemWindow.addChild(this._currGuiPet);
_isCurrItemLoaded = true;
}
}
else if(_currItem is int && _currItem != 0)
{
_itemYLocation = param1;
_itemXLocation = param2;
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(int(_currItem),this.onCurrItemLoaded);
}
else if(Boolean(_currItem) && !_isCurrItemLoaded)
{
_isCurrItemLoaded = true;
if(!gMainFrame.userInfo.isMember)
{
if(this._currDef.isMemberOnly)
{
_window.memberLock.visible = true;
}
}
if(!this._forCreation && Utility.isOcean(this._currDef.enviroFlag))
{
_window.ocean.visible = true;
}
if(AvatarUtility.isEndangered(this._currDef.availability))
{
if(this._avType == 13 || this._avType == 16 || this._avType == 26)
{
LocalizationManager.translateId(_window.endangered.txt,11177);
}
else if(this._avType == 6)
{
LocalizationManager.translateId(_window.endangered.txt,14226);
}
else
{
LocalizationManager.translateId(_window.endangered.txt,11178);
}
_window.endangered.visible = true;
}
if(AvatarUtility.isExtinct(this._currDef.availability))
{
_loc4_ = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0];
_currItem.filters = [new ColorMatrixFilter(_loc4_)];
}
_window.diamond.visible = this._shouldShowDiamond;
if(Boolean(this._currDef.isDiamond) && _window.currentFrameLabel != "diamond_down")
{
_window.gotoAndStop("diamond_up");
}
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
{
_window.itemWindow.addChild(_currItem[_iconLayerName]);
}
else
{
_window.itemWindow.addChild(DisplayObject(_currItem));
}
}
if(index == this._selectedIndex)
{
this.selectItem();
}
}
}
override protected function setChildrenAndInitialConditions() : void
{
_window.memberLock.visible = false;
_window.endangered.visible = false;
_window.ocean.visible = false;
_window.diamond.visible = false;
if(this._forCreation)
{
this.loadCurrItem();
}
}
private function onCurrItemLoaded(param1:MovieClip) : void
{
if(param1)
{
_currItem = param1.getChildAt(0);
this.loadCurrItem();
}
}
}
}
@@ -0,0 +1,103 @@
package gui
{
import avatar.AvatarInfo;
import flash.display.DisplayObject;
import flash.display.MovieClip;
public class ItemWindowAvtPetSml extends ItemWindowBase
{
private var _isPet:Boolean;
private var _ai:AvatarInfo;
private var _isMember:Boolean;
private var _nameBarData:int;
private var _currFrameName:String;
public function ItemWindowAvtPetSml(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
this._isPet = param9 != null ? Boolean(param9.isPet) : false;
this._isMember = param9 != null ? Boolean(param9.isMember) : false;
this._nameBarData = param9 != null ? int(param9.nameBarData) : 0;
if(!this._isPet)
{
this._ai = gMainFrame.userInfo.getAvatarInfoByUserNameThenPerUserAvId(param2.userName,param2.perUserAvId);
}
super("charBtnSmlCont",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get sel() : MovieClip
{
return _window.sel;
}
public function get isPet() : Boolean
{
return this._isPet;
}
public function get charLayer() : MovieClip
{
return _window.charLayer;
}
public function get xpShape() : MovieClip
{
return _window.xpShape;
}
override public function gotoAndStop(param1:Object, param2:String = null) : void
{
_window.gotoAndStop(param1,param2);
if(this._currFrameName)
{
if(param1 == "over")
{
this.xpShape[this._currFrameName].mouse.gotoAndPlay(1);
}
else
{
this.xpShape[this._currFrameName].mouse.gotoAndStop(1);
}
}
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(Boolean(_currItem) && !_isCurrItemLoaded)
{
_isCurrItemLoaded = true;
_window.charLayer.addChild(DisplayObject(_currItem));
if(Boolean(this._ai) && this._ai.questLevel > 0)
{
this._currFrameName = this.xpShape.currentLabels[Utility.getColorId(this._nameBarData) - 1].name;
if(this.xpShape.currentFrameLabel != this._currFrameName)
{
this.xpShape.gotoAndStop(this._currFrameName);
}
Utility.createXpShape(this._ai.questLevel,this._isMember,this.xpShape[this._currFrameName].mouse.up.icon,this.xpShape[this._currFrameName].mouse.mouse.icon,int.MAX_VALUE);
}
}
}
override protected function setChildrenAndInitialConditions() : void
{
var _loc1_:Object = null;
_window.sel.visible = false;
if(this._isPet)
{
_loc1_ = _currItem;
_loc1_.x = this.width * 0.5;
_loc1_.y = this.height * 0.8;
_loc1_.scaleX = _loc1_.scaleY = 1.1;
_currItem = _loc1_;
}
}
}
}
@@ -0,0 +1,244 @@
package gui
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
public class ItemWindowBase extends MovieClip
{
protected var _window:MovieClip;
protected var _currItem:Object;
protected var _mouseDown:Function;
protected var _mouseOver:Function;
protected var _mouseOut:Function;
protected var _memberOnlyDown:Function;
protected var _index:int;
protected var _spiral:LoadingSpiral;
protected var _windowLoadedCallback:Function;
protected var _iconLayerName:String;
protected var _isCurrItemLoaded:Boolean;
protected var _itemYLocation:int;
protected var _itemXLocation:int;
protected var _useToolTip:Boolean;
protected var _windowGenerator:WindowGenerator;
private var _windowMediaHelper:MediaHelper;
private var _memberOnlyTrackingName:String;
public function ItemWindowBase(param1:*, param2:Function, param3:Object, param4:String, param5:int, param6:Function, param7:Function, param8:Function, param9:Function, param10:Boolean = false)
{
var _loc11_:Array = null;
super();
this._currItem = param3;
this._iconLayerName = param4;
this._mouseDown = param6;
this._mouseOver = param7;
this._mouseOut = param8;
this._memberOnlyDown = param9;
this._index = param5;
this._windowLoadedCallback = param2;
this._useToolTip = param10;
if(param1 is String)
{
_loc11_ = String(param1).split("|");
this._window = GETDEFINITIONBYNAME(_loc11_[0],_loc11_.length > 1 ? false : true);
addChild(this._window);
this.addEventListeners();
this.setChildrenAndInitialConditions();
this.onWindowLoadCallback();
}
else if(param1 is int)
{
this._windowMediaHelper = new MediaHelper();
this._windowMediaHelper.init(param1,this.onWindowLoaded);
}
else
{
if(!(param1 is MovieClip))
{
throw new Error("windowClassOrId is not of type string or int. windowClassOrIdOrMovieClip = " + param1);
}
this._window = param1;
addChild(this._window);
this.addEventListeners();
this.setChildrenAndInitialConditions();
this.onWindowLoadCallback();
}
}
public function destroy() : void
{
this.removeEventListeners();
if(this._spiral)
{
this._spiral.destroy();
}
if(this._windowMediaHelper)
{
this._windowMediaHelper.destroy();
}
if(Boolean(this._window) && this._window.parent == this)
{
removeChild(this._window);
}
if(Boolean(this._currItem) && this._currItem.hasOwnProperty("destroy"))
{
this._currItem.destroy();
}
this._windowGenerator = null;
this._window = null;
this._windowLoadedCallback = null;
this._currItem = null;
this._mouseDown = null;
this._mouseOver = null;
this._mouseOut = null;
}
public function get index() : int
{
return this._index;
}
public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
this._itemYLocation = param1;
this._itemXLocation = param2;
if(Boolean(this._currItem) && Boolean(!(this._currItem is int)) && !this._isCurrItemLoaded)
{
this._isCurrItemLoaded = true;
if(this._iconLayerName != "" && this._currItem.hasOwnProperty(this._iconLayerName))
{
this._window.addChild(this._currItem[this._iconLayerName]);
}
else
{
this._window.addChild(DisplayObject(this._currItem));
}
}
}
protected function onWindowLoaded(param1:MovieClip) : void
{
if(param1)
{
this._window = MovieClip(param1.getChildAt(0));
addChild(this._window);
this.setChildrenAndInitialConditions();
this.onWindowLoadCallback();
this.addEventListeners();
this._windowMediaHelper.destroy();
this._windowMediaHelper = null;
}
}
protected function onWindowLoadCallback() : void
{
if(this._windowLoadedCallback != null)
{
this._windowLoadedCallback(this);
}
}
protected function setChildrenAndInitialConditions() : void
{
}
protected function onWindowRollOver(param1:MouseEvent) : void
{
if(this._useToolTip && this.parent != null)
{
if(this._windowGenerator == null)
{
this._windowGenerator = WindowGenerator(this.parent.parent);
}
this._windowGenerator.toolTip.init(this._windowGenerator.parent.parent,this._currItem.name,this.x + this._windowGenerator.boxWidth * 0.5 + this._windowGenerator.parent.x + this._itemXLocation,this.y + this._windowGenerator.boxHeight - this._itemYLocation + this._windowGenerator.parent.y - 5);
this._windowGenerator.toolTip.startTimer(param1);
}
}
protected function onWindowRollOut(param1:MouseEvent) : void
{
if(this._useToolTip && this.parent != null)
{
this._windowGenerator.toolTip.resetTimerAndSetVisibility();
}
}
protected function addEventListeners() : void
{
if(Boolean(this._window) && Boolean(this._currItem))
{
if(this._mouseDown != null && !(this._memberOnlyDown != null && !gMainFrame.userInfo.isMember))
{
addEventListener(MouseEvent.MOUSE_DOWN,this._mouseDown,false,0,true);
}
if(this._mouseOver != null)
{
if(this._useToolTip)
{
addEventListener(MouseEvent.ROLL_OVER,this.onWindowRollOver,false,0,true);
}
addEventListener(MouseEvent.ROLL_OVER,this._mouseOver,false,0,true);
}
if(this._mouseOut != null)
{
if(this._useToolTip)
{
addEventListener(MouseEvent.ROLL_OUT,this.onWindowRollOut,false,0,true);
}
addEventListener(MouseEvent.ROLL_OUT,this._mouseOut,false,0,true);
}
if(this._memberOnlyDown != null && !gMainFrame.userInfo.isMember)
{
addEventListener(MouseEvent.MOUSE_DOWN,this._memberOnlyDown,false,0,true);
}
}
}
protected function removeEventListeners() : void
{
if(this._mouseDown != null)
{
removeEventListener(MouseEvent.MOUSE_DOWN,this._mouseDown);
}
if(this._mouseOver != null)
{
if(this._useToolTip)
{
removeEventListener(MouseEvent.ROLL_OVER,this.onWindowRollOut);
}
removeEventListener(MouseEvent.ROLL_OVER,this._mouseOver);
}
if(this._mouseOut != null)
{
if(this._useToolTip)
{
removeEventListener(MouseEvent.ROLL_OUT,this.onWindowRollOut);
}
removeEventListener(MouseEvent.ROLL_OUT,this._mouseOut);
}
if(this._memberOnlyDown != null)
{
removeEventListener(MouseEvent.MOUSE_DOWN,this._memberOnlyDown);
}
}
}
}
@@ -0,0 +1,45 @@
package gui
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
public class ItemWindowBook extends ItemWindowBase
{
private var _mediaHelper:MediaHelper;
public function ItemWindowBook(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super(new (param9.currLoaderAppDomain.getDefinition("eBookLibraryCont") as Class)(),param1,param2,param3,param4,param5,param6,param7,param8);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
}
override protected function setChildrenAndInitialConditions() : void
{
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(_currItem.mediaId,this.onBookCoverLoaded);
}
override protected function addEventListeners() : void
{
super.addEventListeners();
_window.itemWindow.addEventListener(MouseEvent.MOUSE_DOWN,this.onBookCoverDown,false,0,true);
}
private function onBookCoverLoaded(param1:MovieClip) : void
{
_window.itemWindow.addChild(param1.getChildAt(0));
}
private function onBookCoverDown(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.openEBook(_currItem.listId,true,true);
}
}
}
@@ -0,0 +1,95 @@
package gui
{
import flash.events.MouseEvent;
import localization.LocalizationManager;
import movie.MovieNode;
public class ItemWindowChapterSelect extends ItemWindowBase
{
private var _currMovieNodeDef:MovieNode;
private var _isGray:Boolean;
private var _baseDefId:int;
public function ItemWindowChapterSelect(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super(2162,param1,param2,param3,param4,param5,param6,param7,param8);
this._currMovieNodeDef = MovieNode(param2);
this._baseDefId = param9.baseDefId;
}
public function getMovieNodeDef() : MovieNode
{
return this._currMovieNodeDef;
}
public function activateGrayState(param1:Boolean) : void
{
this._isGray = param1;
_window.activateGrayState(param1);
}
public function get isGray() : Boolean
{
return this._isGray;
}
override protected function setChildrenAndInitialConditions() : void
{
var _loc1_:Boolean = false;
if(this._currMovieNodeDef.defId != this._baseDefId && !gMainFrame.userInfo.userVarCache.isBitSet(this._currMovieNodeDef.userVarId,this._currMovieNodeDef.bitIndex))
{
if(this._currMovieNodeDef.bitIndex > 0 && Boolean(gMainFrame.userInfo.userVarCache.isBitSet(this._currMovieNodeDef.userVarId,this._currMovieNodeDef.bitIndex - 1)))
{
this.activateGrayState(false);
_loc1_ = true;
}
else
{
this.activateGrayState(true);
}
}
if(this._currMovieNodeDef.thisChapterHasGift && (_loc1_ || this._isGray))
{
_window.btnCont.showGift(true);
}
else
{
_window.btnCont.showGift(false);
}
var _loc2_:String = LocalizationManager.translateIdOnly(this._currMovieNodeDef.streamTitleId);
if(this._isGray)
{
_loc2_ = _loc2_.slice(0,_loc2_.indexOf(":"));
}
LocalizationManager.updateToFit(_window.btnCont.mouse.up.txt,_loc2_);
LocalizationManager.updateToFit(_window.btnCont.gray.txt,_loc2_);
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null)
{
addEventListener(MouseEvent.MOUSE_DOWN,_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener(MouseEvent.ROLL_OVER,_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener(MouseEvent.ROLL_OUT,_mouseOut,false,0,true);
}
if(_memberOnlyDown != null)
{
addEventListener(MouseEvent.MOUSE_DOWN,_memberOnlyDown,false,0,true);
}
}
}
}
}
@@ -0,0 +1,193 @@
package gui
{
import avatar.Avatar;
import avatar.AvatarInfo;
import avatar.AvatarManager;
import avatar.AvatarUtility;
import avatar.AvatarView;
import avatar.AvatarXtCommManager;
import avatar.UserInfo;
import com.sbi.graphics.LayerAnim;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.geom.Point;
import localization.LocalizationManager;
import pet.GuiPet;
import quest.QuestXtCommManager;
public class ItemWindowCustPlayers extends ItemWindowBase
{
private var _onBxBtn:Function;
private var _currUserName:String;
private var _ai:AvatarInfo;
private var _scriptDefId:int;
public function ItemWindowCustPlayers(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
this._onBxBtn = param9.onBxBtn;
this._scriptDefId = param9.scriptDefId;
super(2301,param1,param2,param3,param4,param5,param6,param7,param8);
}
override protected function setChildrenAndInitialConditions() : void
{
_window.bx.visible = false;
super.setChildrenAndInitialConditions();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
var _loc4_:AvatarInfo = null;
while(_window.char.charLayer.numChildren > 0)
{
_window.char.charLayer.removeChildAt(0);
}
_window.char.gotoAndPlay("waiting");
LocalizationManager.translateId(_window.nameBar.firstName_txt,11101);
_window.nameBar.lastName_txt.text = "";
_window.char.gotoAndPlay("up");
var _loc3_:Avatar = AvatarManager.getAvatarBySfsUserId(int(_currItem));
if(_loc3_)
{
_loc4_ = gMainFrame.userInfo.getAvatarInfoByUserName(_loc3_.userName);
}
if(_loc3_ == null || _loc4_ == null)
{
AvatarXtCommManager.requestAvatarGetBySfsId(int(_currItem),this.onAvatarGetReceived);
}
else
{
this.setupAvatar(_loc3_,_loc4_.currPet);
}
}
override protected function addEventListeners() : void
{
_window.bx.addEventListener(MouseEvent.MOUSE_DOWN,this._onBxBtn,false,0,true);
super.addEventListeners();
}
override protected function removeEventListeners() : void
{
_window.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this._onBxBtn);
super.removeEventListeners();
}
public function showXBtn(param1:Boolean) : void
{
_window.bx.visible = param1;
}
public function get userName() : String
{
return this._currUserName;
}
public function get char() : MovieClip
{
return _window.char;
}
private function setupAvatar(param1:Avatar, param2:Object) : void
{
var _loc5_:GuiPet = null;
var _loc6_:AvatarView = null;
var _loc7_:Point = null;
var _loc8_:String = null;
var _loc9_:int = 0;
var _loc10_:String = null;
var _loc11_:String = null;
var _loc3_:Object = QuestXtCommManager.getScriptDef(this._scriptDefId);
if(_loc3_.playAsPet)
{
_loc5_ = new GuiPet(0,param2.lBits,param2.uBits,param2.eBits,param2.type,param2.name,this.onBigPetLoaded);
_window.char.charLayer.addChild(_loc5_);
_window.nameBar.firstName_txt.text = _loc5_.petName;
}
else
{
_loc6_ = new AvatarView();
_loc6_.init(param1);
_loc6_.playAnim(LayerAnim.AN_HUD_AVT);
_loc6_.scaleX = 0.7;
_loc6_.scaleY = 0.7;
_loc7_ = AvatarUtility.getAvatarMinigameLobbyOffset(_loc6_.avTypeId);
_loc6_.x = _loc7_.x;
_loc6_.y = _loc7_.y + 5;
_window.char.charLayer.addChild(_loc6_);
_loc8_ = param1.avName;
_loc9_ = _loc8_.indexOf(" ");
if(_loc9_ != -1)
{
_loc10_ = _loc8_.substr(0,_loc9_);
_loc11_ = _loc8_.substr(_loc9_ + 1,_loc8_.length);
}
else
{
_loc10_ = _loc8_;
}
_window.nameBar.firstName_txt.text = _loc10_;
if(_loc11_)
{
_window.nameBar.lastName_txt.text = _loc11_;
}
}
this._currUserName = param1.userName;
this._ai = gMainFrame.userInfo.getAvatarInfoByUserNameThenPerUserAvId(param1.userName,param1.perUserAvId);
var _loc4_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(param1.userName);
if(Boolean(this._ai) && Boolean(_loc4_) && this._ai.questLevel > 0)
{
this.loadQuestShape(_loc4_.nameBarData);
}
}
private function onAvatarGetReceived(param1:String, param2:Boolean, param3:int, param4:int) : void
{
var _loc5_:AvatarInfo = null;
var _loc6_:int = 0;
var _loc7_:Avatar = null;
if(param2)
{
_loc5_ = gMainFrame.userInfo.getAvatarInfoByUserName(param1);
if(!_loc5_)
{
throw new Error("onAvatarSFSGetReceived and avInfo is null");
}
_loc6_ = _loc5_.perUserAvId;
_loc7_ = AvatarManager.getAvatarByUserName(param1);
if(_loc7_ == null)
{
_loc7_ = AvatarUtility.generateNew(_loc6_,null,param1,-1,0);
}
this.setupAvatar(_loc7_,_loc5_.currPet);
}
}
private function onBigPetLoaded(param1:MovieClip, param2:GuiPet) : void
{
param2.scaleX = param2.scaleY = 1.5;
param2.y += 30;
}
private function loadQuestShape(param1:int) : void
{
var _loc2_:String = _window.xpShape.currentLabels[Utility.getColorId(param1) - 1].name;
_window.xpShape.visible = true;
if(_loc2_ == "black")
{
_window.xpShape.gotoAndStop(2);
_window.xpShape.gotoAndStop(_loc2_);
}
if(_window.xpShape.currentFrameLabel != _loc2_)
{
_window.xpShape.gotoAndStop(_loc2_);
}
Utility.createXpShape(this._ai.questLevel,true,_window.xpShape[_loc2_].mouse.up.icon,null,param1);
}
}
}
@@ -0,0 +1,62 @@
package gui
{
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class ItemWindowGame extends ItemWindowBase
{
public function ItemWindowGame(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super("gameBtnCont",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get itemLayer() : MovieClip
{
return _window.itemLayer;
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(Boolean(_currItem) && !_isCurrItemLoaded)
{
_isCurrItemLoaded = true;
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
{
_window.itemLayer.addChild(_currItem[_iconLayerName]);
}
else
{
_window.itemLayer.addChild(DisplayObject(_currItem));
}
}
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null)
{
addEventListener(MouseEvent.MOUSE_DOWN,_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener(MouseEvent.ROLL_OVER,_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener(MouseEvent.ROLL_OUT,_mouseOut,false,0,true);
}
if(_memberOnlyDown != null)
{
addEventListener(MouseEvent.MOUSE_DOWN,_memberOnlyDown,false,0,true);
}
}
}
}
}
@@ -0,0 +1,56 @@
package gui
{
import avatar.AvatarInfo;
public class ItemWindowHeart extends ItemWindowBase
{
private var _frameName:String = "fullHeart";
private var _hpPercentage:Number;
private var _isEmptyHeart:Boolean;
private var _numTotalHearts:Number;
public function ItemWindowHeart(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
this._hpPercentage = param9.hpPercentage;
var _loc10_:AvatarInfo = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
this._numTotalHearts = _loc10_.healthBase * 0.5;
var _loc11_:Number = 100 / this._numTotalHearts;
var _loc12_:Number = Math.min(this._numTotalHearts,this._hpPercentage / _loc11_);
var _loc13_:int = Math.ceil(_loc12_);
if(param4 + 1 == _loc13_)
{
if(_loc13_ - _loc12_ >= 0.5 && this._numTotalHearts == _loc12_)
{
this._frameName = "halfHeart";
}
else
{
this._frameName = _loc13_ - _loc12_ >= 0.5 ? "halfEmpty" : "fullHeart";
}
}
else if(param4 + 1 > _loc13_ && _loc13_ < this._numTotalHearts)
{
this._isEmptyHeart = true;
if(param4 + 1 == Math.ceil(this._numTotalHearts) && _loc13_ - _loc12_ >= 0.5)
{
this._frameName = "halfCont";
}
else
{
this._frameName = "emptyHeart";
}
}
super("questHudHeart",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function updateFrame() : void
{
_window.gotoAndStop(this._frameName);
}
}
}
@@ -0,0 +1,80 @@
package gui
{
import avatar.AvatarManager;
import avatar.NameBar;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import localization.LocalizationManager;
public class ItemWindowNameBar extends ItemWindowBase
{
private var _isMember:Boolean;
private var _nameBarData:Object;
private var _userName:String;
private var _avName:String;
private var _isBuddy:Boolean;
private var _isBlocked:Boolean;
public function ItemWindowNameBar(param1:Function, param2:MovieClip, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
this._isMember = param9[param4].isMember;
this._nameBarData = param9[param4].nameBarData;
this._userName = param9[param4].userName;
this._avName = param9[param4].avName;
this._isBuddy = param9[param4].isBuddy;
this._isBlocked = param9[param4].isBlocked;
super(this._isMember ? "memberNameBar" : "FreeNameBar",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get userName() : String
{
return this._userName;
}
public function updateToBeCentered(param1:int) : void
{
_window.x += (param1 - _window.width) * 0.5;
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
}
override protected function setChildrenAndInitialConditions() : void
{
if(this._isMember)
{
_window.nubData = AvatarManager.playerAvatarWorldView.nubData;
_window.setNubType(this._isBuddy ? NameBar.BUDDY : NameBar.NON_BUDDY);
_window.setColorAndBadge(this._nameBarData);
}
else
{
_window.iconIds = AvatarManager.playerAvatarWorldView.nameBarIconIds;
_window.nubData = AvatarManager.playerAvatarWorldView.nubData;
}
_window.isBlocked = this._isBlocked;
_window.setAvName(LocalizationManager.translateAvatarName(this._avName));
_window.x += _window.width * 0.5;
_window.y += _window.height * 0.5;
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null)
{
addEventListener(MouseEvent.MOUSE_DOWN,_mouseDown,false,0,true);
}
}
}
}
}
@@ -0,0 +1,121 @@
package gui
{
import flash.display.MovieClip;
import loader.MediaHelper;
public class ItemWindowNameBarIcon extends ItemWindowBase
{
private var _currFrameLabel:String;
private var _loadIcons:Boolean;
private var _icon1:MovieClip;
private var _icon2:MovieClip;
private var _iconsMediaHelper:MediaHelper;
private var _callbackFunction:Function;
private var _triedToLoadCurrItem:Boolean;
public function ItemWindowNameBarIcon(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
this._currFrameLabel = param9.currFrameLabel;
this._loadIcons = param9.loadIcons;
this._callbackFunction = param9.callbackFunction;
super("selNub",param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get mouse() : MovieClip
{
return _window.mouse;
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(Boolean(_currItem && !_isCurrItemLoaded) && Boolean(!this._loadIcons) && _window.hasOwnProperty("mouse"))
{
_isCurrItemLoaded = true;
_window.mouse.gotoAndStop(1);
_window.mouse.mouse.icon.addChild(_currItem.iconMouse);
_window.mouse.up.icon.addChild(_currItem.iconUp);
}
else
{
this._triedToLoadCurrItem = true;
}
}
override protected function setChildrenAndInitialConditions() : void
{
if(_currItem)
{
_window.scaleX = 1.5;
_window.scaleY = 1.5;
_window.gotoAndStop(this._currFrameLabel);
_window = _window[this._currFrameLabel];
_window.y += _window.height * 0.5;
while(_window.mouse.mouse.icon.numChildren > 0)
{
_window.mouse.mouse.icon.removeChildAt(0);
}
while(_window.mouse.up.icon.numChildren > 0)
{
_window.mouse.up.icon.removeChildAt(0);
}
if(this._loadIcons)
{
_window.mouse.gotoAndStop(1);
this.loadIcon();
}
}
else
{
_window.visible = false;
}
}
private function loadIcon() : void
{
this._iconsMediaHelper = new MediaHelper();
this._iconsMediaHelper.init(int(_currItem),this.onIconsLoaded);
}
private function onIconsLoaded(param1:MovieClip) : void
{
if(Boolean(param1) && Boolean(_window))
{
if(this._icon1 == null)
{
this._icon1 = param1;
this._iconsMediaHelper = new MediaHelper();
this._iconsMediaHelper.init(int(_currItem),this.onIconsLoaded);
}
else
{
this._loadIcons = false;
this._icon2 = param1;
_currItem = {
"iconMouse":this._icon1,
"iconUp":this._icon2
};
this._callbackFunction(this._icon1,this._icon2,_index);
this._icon1 = null;
this._icon2 = null;
this._callbackFunction = null;
this._iconsMediaHelper.destroy();
this._iconsMediaHelper = null;
if(this._triedToLoadCurrItem)
{
this.loadCurrItem();
}
}
}
}
}
}
@@ -0,0 +1,363 @@
package gui
{
import avatar.AvatarManager;
import den.DenItem;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import item.Item;
import pet.PetManager;
public class ItemWindowOriginal extends ItemWindowBase
{
private var _isAvatarEditor:Boolean;
private var _isTradeList:Boolean;
private var _isChoosingForTradeList:Boolean;
private var _generatorIndex:int;
private var _giftItemIdx:int;
private var _isDownGift:Boolean;
private var _isPetItem:Boolean;
private var _isActivePet:Boolean;
private var _isAudio:Boolean;
private var _isLastPlacedAudio:Boolean;
private var _isTradeManager:Boolean;
private var _isECard:Boolean;
private var _isViewingATradeList:Boolean;
private var _isRecycling:Boolean;
private var _loadImmediately:Boolean;
private var _showAddRemoveBtns:Boolean;
public function ItemWindowOriginal(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
var _loc11_:int = 0;
var _loc10_:int = param4;
this._generatorIndex = param4;
if(param9 != null)
{
this._loadImmediately = param9.loadImmediately;
this._isRecycling = param9.isRecycling;
this._isViewingATradeList = param9.isViewingATradeList;
this._isECard = param9.isECard;
this._isAvatarEditor = param9.isAvatarEditor;
this._isTradeManager = param9.isTradeManager;
this._isAudio = param9.isAudio;
this._isPetItem = param9.isPetItem;
this._giftItemIdx = param9.giftItemIdx;
this._isTradeList = param9.isTradeList;
this._isChoosingForTradeList = param9.isChoosingForTradeList;
this._showAddRemoveBtns = param9.showAddRemoveBtns;
if(param9.indexArray != null)
{
_loc11_ = int(param9.indexArray.length);
_loc10_ = _loc11_ - 1 > param4 ? int(param9.indexArray[param4]) : int(param9.indexArray[_loc11_ - 1] - param4 + param4);
}
}
super("itemWindow",param1,param2,param3,_loc10_,param5,param6,param7,param8,true);
}
public function get removeBtn() : MovieClip
{
return _window.removeBtn;
}
public function get addBtn() : MovieClip
{
return _window.addBtn;
}
public function get cir() : MovieClip
{
return _window.cir;
}
public function get gift() : MovieClip
{
return _window.gift;
}
public function get isDownGift() : Boolean
{
return this._isDownGift;
}
public function get isActivePet() : Boolean
{
return this._isActivePet;
}
public function get isLastPlacedAudio() : Boolean
{
return this._isLastPlacedAudio;
}
public function get isAudio() : Boolean
{
return this._isAudio;
}
override public function get numChildren() : int
{
return _window.numChildren;
}
override public function getChildAt(param1:int) : DisplayObject
{
return _window.getChildAt(param1);
}
public function resetDownGift() : void
{
_window.gift.visible = false;
this._isDownGift = false;
}
public function set currDownGift(param1:Object) : void
{
this._isDownGift = true;
_window.gift.visible = true;
}
public function resetAudioDown() : void
{
this._isLastPlacedAudio = false;
_window.cir.gotoAndStop("up");
}
public function setAudioDown() : void
{
this._isLastPlacedAudio = true;
_window.cir.gotoAndStop("down");
}
public function get defId() : int
{
if(_currItem)
{
if(_currItem is Item)
{
return _currItem.defId;
}
return _currItem.itemDefId;
}
return -1;
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
var _loc3_:Object = null;
_itemYLocation = param1;
_itemXLocation = param2;
if(Boolean(_currItem) && !_isCurrItemLoaded)
{
_isCurrItemLoaded = true;
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
{
_window.iconLayer.addChild(_currItem[_iconLayerName]);
}
else
{
_window.iconLayer.addChild(DisplayObject(_currItem));
}
if(this._isTradeManager)
{
if(_currItem is Item)
{
_loc3_ = _currItem;
_currItem = new Item();
_currItem.init(_loc3_.defId,_loc3_.invIdx,_loc3_.color,_loc3_.getInUse(AvatarManager.playerAvatar.perUserAvId));
}
else
{
_loc3_ = _currItem;
_currItem = new DenItem();
_currItem.init(_loc3_.itemDefId,_loc3_.invIdx,_loc3_.categoryId,_loc3_.version,_loc3_.refId);
_currItem.name = _loc3_.name;
}
}
if(_currItem.isMemberOnly)
{
if(!gMainFrame.userInfo.isMember)
{
_window.lock.visible = true;
if(!this.isSpecialList())
{
_window.gray.visible = true;
}
}
else
{
_window.lockOpen.visible = true;
}
}
if(_currItem.isOcean)
{
_window.ocean.visible = true;
}
if(_currItem.isRareDiamond)
{
_window.rareDiamondTag.visible = true;
}
else
{
if(_currItem.isRare)
{
_window.rare.visible = true;
}
_window.diamond.visible = _currItem.isDiamond;
}
if(this._showAddRemoveBtns && (this._isTradeList || this._isTradeManager))
{
_window.removeBtn.visible = true;
}
if(this._isPetItem && _currItem.invIdx == PetManager.myActivePetInvId)
{
_window.cir.gotoAndStop("green");
this._isActivePet = true;
}
if(_currItem is Item)
{
if(_currItem.getInUse(gMainFrame.userInfo.myPerUserAvId))
{
_window.cir.gotoAndStop("down");
}
}
else if(_currItem is DenItem)
{
if(_currItem.categoryId != 0 && !this._isActivePet)
{
this._isLastPlacedAudio = true;
_window.cir.gotoAndStop("down");
}
}
if(this._isECard)
{
if(this._giftItemIdx == _currItem.invIdx)
{
this.gift.visible = true;
this._isDownGift = true;
}
}
}
}
override protected function setChildrenAndInitialConditions() : void
{
_window.lock.visible = false;
_window.lockOpen.visible = false;
_window.gray.visible = false;
_window.gift.visible = false;
_window.addBtn.visible = false;
_window.removeBtn.visible = false;
_window.ocean.visible = false;
_window.rare.visible = false;
_window.avtSpecific.visible = false;
_window.avtSpecificIcon.visible = false;
_window.avtSpecificHighlight.visible = false;
_window.rareDiamondTag.visible = false;
_window.diamond.visible = false;
if(_currItem)
{
if(!_spiral)
{
_spiral = new LoadingSpiral(_window.iconLayer);
}
else
{
_spiral.setNewParent(_window.iconLayer);
}
if(!_currItem.isIconLoaded)
{
_currItem.imageLoadedCallback = _spiral.destroy();
}
else
{
_spiral.destroy();
}
if(this._loadImmediately)
{
this.loadCurrItem();
}
}
else if(this._showAddRemoveBtns && (this._isTradeList || this._isTradeManager))
{
_window.addBtn.visible = true;
}
}
override protected function onWindowLoadCallback() : void
{
if(_windowLoadedCallback != null)
{
_windowLoadedCallback(this,this._generatorIndex);
}
}
override protected function addEventListeners() : void
{
if(Boolean(_window) && Boolean(_currItem))
{
if(_mouseDown != null && !(_currItem.isMemberOnly && _memberOnlyDown != null && !gMainFrame.userInfo.isMember && !this.isSpecialList()))
{
addEventListener(MouseEvent.MOUSE_DOWN,_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener(MouseEvent.ROLL_OVER,_mouseOver,false,0,true);
if(_useToolTip)
{
addEventListener(MouseEvent.ROLL_OVER,onWindowRollOver,false,0,true);
}
}
if(_mouseOut != null)
{
addEventListener(MouseEvent.ROLL_OUT,_mouseOut,false,0,true);
if(_useToolTip)
{
addEventListener(MouseEvent.ROLL_OUT,onWindowRollOut,false,0,true);
}
}
if(Boolean(_memberOnlyDown != null && _currItem.isMemberOnly) && Boolean(!gMainFrame.userInfo.isMember) && !this.isSpecialList())
{
addEventListener(MouseEvent.MOUSE_DOWN,_memberOnlyDown,false,0,true);
}
}
else if(this._showAddRemoveBtns && (this._isTradeList || this._isTradeManager))
{
if(_mouseDown != null)
{
addEventListener(MouseEvent.MOUSE_DOWN,_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener(MouseEvent.ROLL_OVER,_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener(MouseEvent.ROLL_OUT,_mouseOut,false,0,true);
}
}
}
private function isSpecialList() : Boolean
{
return this._isTradeList || this._isTradeManager || this._isChoosingForTradeList || this._isViewingATradeList || this._isECard || this._isRecycling;
}
}
}
@@ -0,0 +1,107 @@
package gui
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import localization.LocalizationManager;
public class ItemWindowParty extends ItemWindowBase
{
private var _defId:int;
private var _isGame:Boolean;
private var _additionalIndex:int;
public function ItemWindowParty(param1:Function, param2:MovieClip, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
this._additionalIndex = param9.additionalIndex;
super(param9.mediaRefId[param4],param1,param2,param3,param4,param5,param6,param7,param8);
}
override protected function setChildrenAndInitialConditions() : void
{
_window.anims.mouseEnabled = false;
_window.anims.mouseChildren = false;
_window.txt.mouseEnabled = false;
_window.txt.mouseChildren = false;
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null && !(_memberOnlyDown != null && !gMainFrame.userInfo.isMember))
{
addEventListener(MouseEvent.MOUSE_DOWN,_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener(MouseEvent.ROLL_OVER,_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener(MouseEvent.ROLL_OUT,_mouseOut,false,0,true);
}
if(_memberOnlyDown != null && !gMainFrame.userInfo.isMember)
{
addEventListener(MouseEvent.MOUSE_DOWN,_memberOnlyDown,false,0,true);
}
}
}
public function setupTextAndAnims(param1:int, param2:String) : void
{
if(param1 > 0)
{
_window.goBtn.visible = false;
_window.txt.timeTxt.text = param2;
}
else
{
_window.goBtn.visible = true;
_window.txt.timeTxt.visible = false;
_window.anims.animate();
}
}
public function get additionalIndex() : int
{
return this._additionalIndex;
}
public function get txt() : MovieClip
{
return _window.txt;
}
public function set titleText(param1:int) : void
{
if(_window.txt.hasOwnProperty("titleTxt"))
{
LocalizationManager.translateId(_window.txt.titleTxt,param1);
}
}
public function set defId(param1:int) : void
{
this._defId = param1;
}
public function get defId() : int
{
return this._defId;
}
public function set isGame(param1:Boolean) : void
{
this._isGame = param1;
}
public function get isGame() : Boolean
{
return this._isGame;
}
}
}
@@ -0,0 +1,65 @@
package gui
{
public class ItemWindowPattern extends ItemWindowBase
{
public static const TYPE_SWATCH:String = "swatch";
public static const TYPE_MESSAGE:String = "message";
public static const TYPE_POST:String = "post";
private var _type:String;
private var _patternIndexOrName:Object;
private var _colorIndexOrName:Object;
public function ItemWindowPattern(param1:Function, param2:Object, param3:String, param4:int, param5:Function, param6:Function, param7:Function, param8:Function, param9:Object)
{
this._type = param9.type;
this._patternIndexOrName = param9.patternIndex != null ? param9.patternIndex : param4 + 1;
this._colorIndexOrName = param9.colorIndex != null ? param9.colorIndex : 1;
super(param2,param1,param2,param3,param4,param5,param6,param7,param8,false);
}
override protected function setChildrenAndInitialConditions() : void
{
if(_window)
{
_window.gotoAndStop(this._type);
_window[this._type + "Btn"].gotoAndStop(this._colorIndexOrName);
if(_window[this._type + "Btn"].messageBodyCont != null)
{
_window[this._type + "Btn"].messageBodyCont.gotoAndStop(this._colorIndexOrName);
}
_window[this._type + "Btn"].pattern.gotoAndStop(this._patternIndexOrName);
}
}
public function getCurrentPatternIndex() : int
{
return _window[this._type + "Btn"].pattern.currentFrame;
}
public function setPatternAndColor(param1:Object, param2:Object) : void
{
this._colorIndexOrName = param2;
this._patternIndexOrName = param1;
this.setChildrenAndInitialConditions();
}
public function setColor(param1:Object) : void
{
this._colorIndexOrName = param1;
this.setChildrenAndInitialConditions();
}
public function setPattern(param1:Object) : void
{
this._patternIndexOrName = param1;
this.setChildrenAndInitialConditions();
}
}
}
@@ -0,0 +1,170 @@
package gui
{
import avatar.AvatarManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import pet.GuiPet;
import pet.PetManager;
public class ItemWindowPets extends ItemWindowBase
{
private var _isRecycling:Boolean;
private var _currGuiPet:GuiPet;
public function ItemWindowPets(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
this._isRecycling = param9.isRecycling;
super("itemWindowPets",param1,param2,param3,param4,param5,param6,param7,param8,true);
}
public function get cir() : MovieClip
{
return _window.cir;
}
public function get gray() : MovieClip
{
return _window.gray;
}
public function get cageIcon() : MovieClip
{
return _window.cageIcon;
}
public function get newPetIcon() : MovieClip
{
return _window.newPet;
}
public function get hasPet() : Boolean
{
return _currItem;
}
override public function destroy() : void
{
if(this._currGuiPet)
{
this._currGuiPet.destroy();
this._currGuiPet = null;
}
super.destroy();
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
var _loc3_:Object = null;
_itemYLocation = param1;
_itemXLocation = param2;
if(Boolean(_currItem) && !_isCurrItemLoaded)
{
_loc3_ = PetManager.getPetDef(_currItem.defId);
this._currGuiPet = new GuiPet(_currItem.idx,_currItem.lBits,_currItem.uBits,_currItem.eBits,_currItem.type,_currItem.name,null);
_window.cageIcon.visible = this._isRecycling;
_window.ocean.visible = this._currGuiPet.canGoInOcean();
if(!gMainFrame.userInfo.isMember)
{
_window.lockOpen.visible = false;
if(_loc3_.isMember)
{
_window.gray.visible = true;
_window.lock.visible = true;
}
else
{
_window.lock.visible = false;
_window.gray.visible = false;
}
}
else
{
_window.lock.visible = false;
_window.gray.visible = false;
if(_loc3_.isMember)
{
_window.lockOpen.visible = true;
}
else
{
_window.lockOpen.visible = false;
}
}
_window.newPet.visible = false;
if(!PetManager.canCurrAvatarUsePet(AvatarManager.playerAvatar.enviroTypeFlag,_loc3_.type))
{
_window.gray.visible = true;
}
else if(PetManager.myActivePetInvId == this._currGuiPet.idx)
{
_window.cir.gotoAndStop("down");
}
this._currGuiPet.scaleX = this._currGuiPet.scaleY = 2;
_isCurrItemLoaded = true;
_window.iconLayer.addChild(this._currGuiPet);
}
if(_spiral)
{
_spiral.destroy();
}
}
override protected function setChildrenAndInitialConditions() : void
{
_spiral = new LoadingSpiral(_window.iconLayer);
_window.lockOpen.visible = false;
_window.lock.visible = false;
_window.gray.visible = false;
_window.ocean.visible = false;
_window.cageIcon.visible = false;
_window.newPet.gray.visible = false;
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null && !(_memberOnlyDown != null && !gMainFrame.userInfo.isMember))
{
addEventListener(MouseEvent.MOUSE_DOWN,_mouseDown,false,0,true);
}
if(_mouseOver != null && Boolean(_currItem))
{
addEventListener(MouseEvent.ROLL_OVER,_mouseOver,false,0,true);
if(_useToolTip)
{
addEventListener(MouseEvent.ROLL_OVER,this.onWindowRollOver,false,0,true);
}
}
if(_mouseOut != null && Boolean(_currItem))
{
addEventListener(MouseEvent.ROLL_OUT,_mouseOut,false,0,true);
if(_useToolTip)
{
addEventListener(MouseEvent.ROLL_OUT,onWindowRollOut,false,0,true);
}
}
if(_memberOnlyDown != null && !gMainFrame.userInfo.isMember)
{
addEventListener(MouseEvent.MOUSE_DOWN,_memberOnlyDown,false,0,true);
}
}
}
override protected function onWindowRollOver(param1:MouseEvent) : void
{
if(_useToolTip && this.parent != null)
{
if(_windowGenerator == null)
{
_windowGenerator = WindowGenerator(this.parent.parent);
}
_windowGenerator.toolTip.init(_windowGenerator.parent.parent,this._currGuiPet.petName,this.x + _windowGenerator.boxWidth * 0.5 + _windowGenerator.parent.x + _itemXLocation,this.y + _windowGenerator.boxHeight - _itemYLocation + _windowGenerator.parent.y - 5);
_windowGenerator.toolTip.startTimer(param1);
}
}
}
}
@@ -0,0 +1,22 @@
package gui
{
import flash.events.MouseEvent;
public class ItemWindowPlayerWallDecor extends ItemWindowBase
{
public function ItemWindowPlayerWallDecor(param1:Function, param2:Object, param3:String, param4:int, param5:Function, param6:Function, param7:Function, param8:Function, param9:Boolean = false)
{
super(param2,param1,null,param3,param4,param5,param6,param7,param8,param9);
}
override protected function addEventListeners() : void
{
if(_mouseDown != null)
{
addEventListener(MouseEvent.MOUSE_DOWN,_mouseDown,false,0,true);
}
}
}
}
@@ -0,0 +1,276 @@
package gui
{
import avatar.Avatar;
import avatar.AvatarView;
import avatar.AvatarXtCommManager;
import buddy.Buddy;
import com.sbi.corelib.input.SBTextField;
import com.sbi.graphics.LayerAnim;
import flash.events.MouseEvent;
import flash.text.TextFieldAutoSize;
import item.Item;
import loader.MediaHelper;
import localization.LocalizationManager;
import playerWall.PlayerWallManager;
public class ItemWindowPost extends ItemWindowBase
{
private var _iconMediaHelper:MediaHelper;
private var _onReportDown:Function;
private var _onDeleteDown:Function;
private var _smileyText:SBTextField;
private var _isMyPost:Boolean;
private var _patternWindow:ItemWindowPattern;
public function ItemWindowPost(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
this._onReportDown = param9.reportMsgBtnMouseDown;
this._onDeleteDown = param9.deleteMsgBtnMouseDown;
this._isMyPost = param9.isMyPost;
tabEnabled = false;
super(1501,param1,param2,param3,param4,param5,param6,param7,param8);
}
public function get msgId() : String
{
return _currItem.msgId;
}
public function get senderUserName() : String
{
return _currItem.senderUserName;
}
public function get senderModeratedUserName() : String
{
return _currItem.senderModeratedUserName;
}
override public function destroy() : void
{
this.removeEventListeners();
if(this._iconMediaHelper)
{
this._iconMediaHelper.destroy();
this._iconMediaHelper = null;
}
this._onReportDown = null;
this._onDeleteDown = null;
if(this._smileyText)
{
this._smileyText.destroy();
this._smileyText = null;
}
_window = null;
_windowLoadedCallback = null;
_currItem = null;
_mouseDown = null;
_mouseOver = null;
_mouseOut = null;
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(Boolean(_currItem) && !_isCurrItemLoaded)
{
if(!_spiral)
{
_spiral = new LoadingSpiral(_window.iconLayer);
}
else
{
_spiral.setNewParent(_window.iconLayer);
}
this._smileyText = new SBTextField(null,_window.messageTxt,_window.textItemHolder,true);
this._smileyText.text = _currItem.message;
this._smileyText.mouseChildren = false;
this._smileyText.mouseEnabled = false;
this._smileyText.selectable = false;
_window.deleteMessageBtn.parent.setChildIndex(_window.deleteMessageBtn,_window.deleteMessageBtn.parent.numChildren - 1);
_window.reportMessageBtn.parent.setChildIndex(_window.reportMessageBtn,_window.reportMessageBtn.parent.numChildren - 1);
if(!this._isMyPost)
{
_window.reportMessageBtn.x += _window.reportMessageBtn.width;
}
_isCurrItemLoaded = true;
this.setupCurrAvtImage();
}
}
override protected function setChildrenAndInitialConditions() : void
{
var _loc1_:Number = NaN;
var _loc2_:Object = null;
if(_currItem)
{
if(_currItem.senderUserName.toLowerCase() == gMainFrame.userInfo.myUserName.toLowerCase())
{
_window.gotoAndStop("player");
_window = _window.player;
}
else
{
_window.gotoAndStop("buddies");
_window = _window.buddies;
}
this.loadPostPattern();
_window.reportMessageBtn.visible = false;
_window.deleteMessageBtn.visible = false;
_window.gotoAndStop(_currItem.colorId);
_window.messageTxt.text = "";
_window.messageTxt.selectable = false;
_window.nameTxt.text = _currItem.senderModeratedUserName;
_window.timeTxt.autoSize = TextFieldAutoSize.RIGHT;
_loc1_ = new Date().valueOf();
_loc2_ = Utility.calculateTime((new Date().valueOf() - _currItem.postTime) / 1000);
LocalizationManager.translateIdAndInsert(_window.timeTxt,11360,Utility.calculatePrintTime(_loc2_.mins,_loc2_.hours,false,_loc2_.days));
if(Boolean(_currItem.isBuddy) && _currItem.senderUserName != gMainFrame.userInfo.myUserName)
{
_window.buddyIcon.visible = true;
_window.nameTxt.x += _window.buddyIcon.width;
}
else
{
_window.buddyIcon.visible = false;
}
}
}
override protected function addEventListeners() : void
{
if(this._isMyPost)
{
_window.deleteMessageBtn.addEventListener(MouseEvent.MOUSE_DOWN,this._onDeleteDown,false,0,true);
}
else
{
addEventListener(MouseEvent.MOUSE_DOWN,this.onPostDown,false,0,true);
}
_window.reportMessageBtn.addEventListener(MouseEvent.MOUSE_DOWN,this._onReportDown,false,0,true);
addEventListener(MouseEvent.ROLL_OVER,this.onPostRollOverOut,false,0,true);
addEventListener(MouseEvent.ROLL_OUT,this.onPostRollOverOut,false,0,true);
}
override protected function removeEventListeners() : void
{
if(this._isMyPost)
{
_window.deleteMessageBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this._onDeleteDown);
}
else
{
removeEventListener(MouseEvent.MOUSE_DOWN,this.onPostDown);
}
_window.reportMessageBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this._onReportDown);
removeEventListener(MouseEvent.ROLL_OVER,this.onPostRollOverOut);
removeEventListener(MouseEvent.ROLL_OUT,this.onPostRollOverOut);
}
private function onPostDown(param1:MouseEvent) : void
{
var _loc2_:Buddy = null;
param1.stopPropagation();
if(_window)
{
_loc2_ = BuddyManager.getBuddyByUserName(_currItem.senderUserName);
if(_loc2_)
{
BuddyCard.showBuddyCard({
"userName":_loc2_.userName,
"onlineStatus":_loc2_.onlineStatus
});
return;
}
AvatarXtCommManager.requestAvatarGet(_currItem.senderUserName,this.onUserLookUpReceived,true);
return;
}
}
private function onUserLookUpReceived(param1:String, param2:Boolean, param3:int) : void
{
if(param2)
{
BuddyCard.showBuddyCard({
"userName":param1,
"onlineStatus":param3
});
}
}
private function onPostRollOverOut(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_window)
{
if(_window.messageHighlight.currentFrameLabel != "on")
{
_window.messageHighlight.gotoAndStop("on");
_window.reportMessageBtn.visible = _currItem.senderUserName != gMainFrame.userInfo.myUserName;
if(this._isMyPost)
{
_window.deleteMessageBtn.visible = true;
}
}
else
{
_window.messageHighlight.gotoAndStop("off");
_window.reportMessageBtn.visible = false;
if(this._isMyPost)
{
_window.deleteMessageBtn.visible = false;
}
}
}
}
private function loadPostPattern() : void
{
this._patternWindow = new ItemWindowPattern(null,PlayerWallManager.PATTERN_MEDIA_ID,"",0,null,null,null,null,{
"type":ItemWindowPattern.TYPE_MESSAGE,
"colorIndex":_currItem.colorId,
"patternIndex":_currItem.patternId
});
_window.messageBodyHolder.addChild(this._patternWindow);
}
private function setupCurrAvtImage() : void
{
var _loc1_:Avatar = new Avatar();
_loc1_.init(-1,"",_currItem.avtDefId,_currItem.avtColors,_currItem.avtCustomId,null,_currItem.senderUserName);
var _loc2_:Array = [];
var _loc3_:Item = new Item();
_loc2_[0] = _loc3_;
_loc3_.init(1,1,0,-1,-1);
_loc3_ = new Item();
_loc2_[1] = _loc3_;
_loc3_.init(_currItem.avtEyeDefId > 0 ? int(_currItem.avtEyeDefId) : 2,2,0,-1,-1);
var _loc4_:Object = gMainFrame.userInfo.getAvatarDefByAvatar(_loc1_);
if(_currItem.avtCustomId != -1 && Boolean(_loc4_))
{
_currItem.avtPatternDefId = _loc4_.patternRefId;
}
if(_currItem.avtPatternDefId > 0)
{
_loc3_ = new Item();
_loc2_[2] = _loc3_;
_loc3_.init(_currItem.avtPatternDefId,3,0,-1,-1);
}
_loc1_.itemResponseIntegrate(_loc2_);
var _loc5_:AvatarView = new AvatarView();
_loc5_.init(_loc1_,null);
_loc5_.playAnim(LayerAnim.AN_HUD_AVT,false,LayerAnim.PLAY_ONE_SHOT,null);
_loc5_.x = 275;
_loc5_.y = 260;
_window.charCont.charLayer.addChild(_loc5_);
}
}
}
@@ -0,0 +1,111 @@
package gui
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.TextField;
public class ItemWindowServer extends ItemWindowBase
{
public function ItemWindowServer(param1:Function, param2:MovieClip, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super("serverBarSml",param1,param2,param3,param4,param5,param6,param7,param8);
}
override protected function setChildrenAndInitialConditions() : void
{
_window.txt.mouseEnabled = false;
_window.buddy.mouseEnabled = false;
_window.g1.mouseEnabled = false;
_window.g2.mouseEnabled = false;
_window.g3.mouseEnabled = false;
_window.o1.mouseEnabled = false;
_window.o2.mouseEnabled = false;
_window.o3.mouseEnabled = false;
_window.full.mouseEnabled = false;
_window.full.mouseChildren = false;
}
public function get full() : Boolean
{
return _window.full.visible;
}
public function set text(param1:String) : void
{
_window.txt.text = param1;
}
public function get textField() : TextField
{
return _window.txt;
}
public function set buddy(param1:Boolean) : void
{
_window.buddy.visible = param1;
}
public function set flag(param1:int) : void
{
_window.flag.gotoAndStop(param1);
}
public function set population(param1:String) : void
{
switch(param1)
{
case "0":
_window.full.visible = false;
_window.o1.visible = false;
_window.o2.visible = false;
_window.o3.visible = false;
break;
case "1":
_window.o1.visible = true;
_window.o2.visible = false;
_window.o3.visible = false;
_window.full.visible = false;
break;
case "2":
_window.o1.visible = true;
_window.o2.visible = true;
_window.o3.visible = false;
_window.full.visible = false;
break;
case "3":
_window.o1.visible = true;
_window.o2.visible = true;
_window.o3.visible = true;
_window.full.visible = false;
break;
case "4":
_window.full.visible = true;
}
}
override protected function addEventListeners() : void
{
if(_window)
{
if(_mouseDown != null)
{
addEventListener(MouseEvent.MOUSE_DOWN,_mouseDown,false,0,true);
}
if(_mouseOver != null)
{
addEventListener(MouseEvent.ROLL_OVER,_mouseOver,false,0,true);
}
if(_mouseOut != null)
{
addEventListener(MouseEvent.ROLL_OUT,_mouseOut,false,0,true);
}
if(_memberOnlyDown != null)
{
addEventListener(MouseEvent.MOUSE_DOWN,_memberOnlyDown,false,0,true);
}
}
}
}
}
@@ -0,0 +1,36 @@
package gui
{
import flash.text.TextField;
public class ItemWindowSpecialText extends ItemWindowBase
{
public function ItemWindowSpecialText(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super("specialCharHighlightCont",param1,param2,param3,param4,param5,param6,param7,param8);
}
override protected function setChildrenAndInitialConditions() : void
{
if(_currItem)
{
_window.txt.text = _currItem;
}
_window.txt.mouseEnabled = false;
_window.up.mouseEnabled = false;
_window.up.visible = false;
}
public function get txt() : TextField
{
return _window.txt;
}
public function setText(param1:String) : void
{
_currItem = param1;
_window.txt.text = param1;
}
}
}
@@ -0,0 +1,42 @@
package gui
{
import ecard.ECardImageBase;
public class ItemWindowStamp extends ItemWindowBase
{
private var stampImageBase:ECardImageBase;
public function ItemWindowStamp(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super("StampBtn",param1,param2,param3,param4,param5,param6,param7,param8);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(Boolean(_currItem) && !_isCurrItemLoaded)
{
_isCurrItemLoaded = true;
this.stampImageBase = new ECardImageBase();
this.stampImageBase.init(int(_currItem),this.onImageLoaded);
}
}
private function onImageLoaded() : void
{
if(_iconLayerName != "" && this.stampImageBase.hasOwnProperty(_iconLayerName))
{
_window.imgLayer.addChild(this.stampImageBase[_iconLayerName]);
}
this.stampImageBase[_iconLayerName].scaleX = 0.6;
this.stampImageBase[_iconLayerName].scaleY = 0.6;
}
override protected function setChildrenAndInitialConditions() : void
{
}
}
}
@@ -0,0 +1,35 @@
package gui
{
import flash.text.TextField;
public class ItemWindowTextBar extends ItemWindowBase
{
public function ItemWindowTextBar(param1:Function, param2:String, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super("userDenBtnCont",param1,param2,param3,param4,param5,param6,param7,param8);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
_itemYLocation = param1;
_itemXLocation = param2;
if(_currItem)
{
_window.txt.text = _currItem;
}
}
public function get txt() : TextField
{
return _window.txt;
}
public function setText(param1:String) : void
{
_currItem = param1;
_window.txt.text = param1;
}
}
}
@@ -0,0 +1,87 @@
package gui
{
import flash.events.MouseEvent;
public class ItemWindowTextNode extends ItemWindowBase
{
private var _originalText:String;
public function ItemWindowTextNode(param1:Function, param2:String, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super("chatTextNode",param1,param2,param3,param4,param5,param6,param7,param8);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
}
override protected function setChildrenAndInitialConditions() : void
{
if(_currItem)
{
this.setupText();
}
addEventListener(MouseEvent.ROLL_OVER,this.onRollOver,false,0,true);
addEventListener(MouseEvent.ROLL_OUT,this.onRollOut,false,0,true);
}
override protected function removeEventListeners() : void
{
removeEventListener(MouseEvent.ROLL_OVER,this.onRollOver);
removeEventListener(MouseEvent.ROLL_OUT,this.onRollOut);
super.removeEventListeners();
}
public function get text() : String
{
return this._originalText;
}
public function updateToBeCentered(param1:int) : void
{
_window.x += (param1 - _window.width) * 0.5;
}
private function setupText() : void
{
var _loc1_:int = 0;
var _loc2_:String = null;
_window.txt.text = _currItem;
this._originalText = String(_currItem);
if(_window.txt.textWidth > _window.txt.width)
{
_window.txt.text = "";
_loc1_ = 0;
_loc2_ = "";
while(_window.txt.textWidth < _window.txt.width)
{
_loc2_ += String(_currItem).charAt(_loc1_);
_window.txt.text = _loc2_ + "...";
_loc1_++;
}
_window.txt.text = _loc2_.slice(0,_loc2_.length - 1) + "...";
}
}
private function onRollOver(param1:MouseEvent) : void
{
param1.stopPropagation();
if(Boolean(_window) && _window.currentFrameLabel != "on")
{
_window.gotoAndStop("on");
AJAudio.playSubMenuBtnRollover();
}
}
private function onRollOut(param1:MouseEvent) : void
{
param1.stopPropagation();
if(Boolean(_window) && _window.currentFrameLabel != "off")
{
_window.gotoAndStop("off");
}
}
}
}
@@ -0,0 +1,345 @@
package gui
{
import achievement.AchievementXtCommManager;
import com.sbi.corelib.audio.SBAudio;
import den.DenXtCommManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import gamePlayFlow.GamePlay;
import localization.LocalizationManager;
import room.RoomManagerWorld;
public class ItemWindowToggle extends ItemWindowBase
{
private var _lock:MovieClip;
private var _currHeight:int;
public function ItemWindowToggle(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
{
super("mySettingsToggle|false",param1,param2,param3,param4,param5,param6,param7,param8);
}
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
{
}
override public function get height() : Number
{
return this._currHeight;
}
override protected function setChildrenAndInitialConditions() : void
{
this._currHeight = _window.height;
_window.goNowBtn.visible = false;
_window.woodenCursorBtn.visible = false;
_window.defaultCursorBtn.visible = false;
_window.toggleBtn.visible = false;
_window.toggleTxt.visible = false;
switch(_currItem.type)
{
case MySettings.TOGGLE_TYPE_TOGGLE_BTN:
_window.toggleBtn.visible = true;
_window.toggleBtn.toggleKnob.gotoAndStop("up");
_window.toggleBtn.toggleBG.gotoAndStop("up");
_window.icon.gotoAndStop(_currItem.frame);
_window.toggleBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.handleMouseDown,false,0,true);
_window.toggleBtn.addEventListener(MouseEvent.ROLL_OVER,this.handleMouseOver,false,0,true);
_window.toggleBtn.addEventListener(MouseEvent.ROLL_OUT,this.handleMouseOut,false,0,true);
break;
case MySettings.TOGGLE_TYPE_TEXT:
_window.toggleTxt.visible = true;
_window.icon.gotoAndStop(_currItem.frame);
break;
case MySettings.TOGGLE_TYPE_CURSOR:
_window.woodenCursorBtn.visible = true;
_window.defaultCursorBtn.visible = true;
_window.icon.visible = false;
if(Boolean(GuiManager.sharedObj) && (GuiManager.sharedObj.data.cursor == "custom" || GuiManager.sharedObj.data.cursor == null))
{
_window.woodenCursorBtn.upToDownState();
_window.woodenCursorBtn.mouseEnabled = false;
_window.woodenCursorBtn.mouseChildren = false;
}
else
{
_window.defaultCursorBtn.upToDownState();
_window.defaultCursorBtn.mouseEnabled = false;
_window.defaultCursorBtn.mouseChildren = false;
}
_window.woodenCursorBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.handleMouseDown,false,0,true);
_window.defaultCursorBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.handleMouseDown,false,0,true);
break;
case MySettings.TOGGLE_TYPE_JOIN:
_window.goNowBtn.visible = true;
_window.goNowBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.handleMouseDown,false,0,true);
_window.icon.gotoAndStop(_currItem.frame);
}
switch(_currItem.frame)
{
case "lock":
if(gMainFrame.userInfo.isMyDenPrivate)
{
_window.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
else
{
_window.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
LocalizationManager.translateId(_window.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "world":
_window.goNowBtn.down.txt.text = ServerSelector.getShardName(RoomManagerWorld.instance.shardId);
_window.goNowBtn.mouse.mouse.txt.text = ServerSelector.getShardName(RoomManagerWorld.instance.shardId);
_window.goNowBtn.mouse.up.txt.text = ServerSelector.getShardName(RoomManagerWorld.instance.shardId);
break;
case "music":
if(SBAudio.isMusicMuted || SBAudio.areSoundsMuted)
{
_window.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
else
{
_window.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
LocalizationManager.translateId(_window.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "buddyRequest":
if(Utility.isSettingOn(MySettings.SETTINGS_BUDDY_REQUESTS))
{
_window.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
else
{
_window.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
LocalizationManager.translateId(_window.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "gameInvites":
if(Utility.isSettingOn(MySettings.SETTINGS_GAME_INVITES))
{
_window.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
else
{
_window.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
LocalizationManager.translateId(_window.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "doorBell":
if(Utility.isSettingOn(MySettings.SETTINGS_DOOR_BELL))
{
_window.toggleBtn.gotoAndStop("startingOff");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
}
else
{
_window.toggleBtn.gotoAndStop("startingOn");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
}
LocalizationManager.translateId(_window.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
break;
case "intro":
}
LocalizationManager.translateId(_window.labelTxtCont.labelTxt,_currItem.labelTxt);
}
private function handleMouseDown(param1:MouseEvent) : void
{
var _loc2_:Number = NaN;
var _loc3_:int = 0;
param1.stopPropagation();
if(_currItem.type == MySettings.TOGGLE_TYPE_TOGGLE_BTN)
{
switch(_currItem.frame)
{
case "lock":
this._lock = MovieClip(param1.currentTarget);
GuiManager.onToggleDenLock(this.onDenLockUnlock);
break;
case "music":
SBAudio.toggleMuteAll();
GuiManager.toggleMuteVideo();
if(SBAudio.isMusicMuted || SBAudio.areSoundsMuted)
{
param1.currentTarget.gotoAndPlay("off");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("off");
GuiManager.depressSoundButton(true);
}
else
{
param1.currentTarget.gotoAndPlay("on");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("on");
GuiManager.depressSoundButton(false);
}
break;
case "buddyRequest":
case "gameInvites":
case "doorBell":
_loc2_ = Number(gMainFrame.userInfo.userVarCache.getUserVarValueById(AchievementXtCommManager.UV_SETTINGS));
_loc3_ = -1;
if(_currItem.frame == "buddyRequest")
{
_loc3_ = MySettings.SETTINGS_BUDDY_REQUESTS;
}
else if(_currItem.frame == "gameInvites")
{
_loc3_ = MySettings.SETTINGS_GAME_INVITES;
}
else if(_currItem.frame == "doorBell")
{
_loc3_ = MySettings.SETTINGS_DOOR_BELL;
}
if(_loc3_ != -1)
{
if(_loc2_ == -1)
{
if(_loc3_ == MySettings.SETTINGS_DOOR_BELL)
{
param1.currentTarget.gotoAndPlay("on");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("on");
}
else
{
param1.currentTarget.gotoAndPlay("off");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("off");
}
AchievementXtCommManager.requestSetUserVar(AchievementXtCommManager.UV_SETTINGS,_loc3_);
}
else if(param1.currentTarget.currentFrameLabel == "on" || param1.currentTarget.currentFrameLabel == "startingOn")
{
param1.currentTarget.gotoAndPlay("off");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("off");
if(_loc3_ == MySettings.SETTINGS_DOOR_BELL)
{
AchievementXtCommManager.requestSetUserVar(AchievementXtCommManager.UV_SETTINGS,_loc3_,null,false);
}
else
{
AchievementXtCommManager.requestSetUserVar(AchievementXtCommManager.UV_SETTINGS,_loc3_);
}
}
else
{
param1.currentTarget.gotoAndPlay("on");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("on");
if(_loc3_ == MySettings.SETTINGS_DOOR_BELL)
{
AchievementXtCommManager.requestSetUserVar(AchievementXtCommManager.UV_SETTINGS,_loc3_);
}
else
{
AchievementXtCommManager.requestSetUserVar(AchievementXtCommManager.UV_SETTINGS,_loc3_,null,false);
}
}
}
}
LocalizationManager.translateId(_window.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
LocalizationManager.translateId(_window.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
}
else if(_currItem.type == MySettings.TOGGLE_TYPE_CURSOR)
{
if(param1.currentTarget.mouse.currentFrame == 3)
{
param1.currentTarget.mouseEnabled = false;
param1.currentTarget.mouseChildren = false;
}
if(param1.currentTarget != _window.defaultCursorBtn)
{
GuiManager.setSharedObj("cursor","custom");
CursorManager.switchToCursor(CursorManager.CUSTOM_CURSOR);
_window.defaultCursorBtn.downToUpState();
_window.defaultCursorBtn.mouseEnabled = true;
_window.defaultCursorBtn.mouseChildren = true;
}
else
{
GuiManager.setSharedObj("cursor","default");
CursorManager.switchToCursor(CursorManager.DEFAULT_CURSOR);
_window.woodenCursorBtn.downToUpState();
_window.woodenCursorBtn.mouseEnabled = true;
_window.woodenCursorBtn.mouseChildren = true;
}
}
else if(_currItem.type == MySettings.TOGGLE_TYPE_JOIN)
{
switch(_currItem.frame)
{
case "world":
ServerSelector.init(GuiManager.guiLayer,null,GamePlay(gMainFrame.gamePlay).joinChosenShardIdNode);
break;
case "intro":
GuiManager.startFFM();
}
}
}
private function handleMouseOut(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_currItem.type == MySettings.TOGGLE_TYPE_TOGGLE_BTN)
{
if(param1.currentTarget.toggleBG.currentFrameLabel != "up")
{
param1.currentTarget.toggleBG.gotoAndStop("up");
}
if(param1.currentTarget.toggleKnob.currentFrameLabel != "up")
{
param1.currentTarget.toggleKnob.gotoAndStop("up");
}
}
}
private function handleMouseOver(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_currItem.type == MySettings.TOGGLE_TYPE_TOGGLE_BTN)
{
if(param1.currentTarget.toggleBG.currentFrameLabel != "over")
{
param1.currentTarget.toggleBG.gotoAndStop("over");
}
if(param1.currentTarget.toggleKnob.currentFrameLabel != "over")
{
param1.currentTarget.toggleKnob.gotoAndStop("over");
}
}
}
private function onDenLockUnlock(param1:Boolean = true) : void
{
if(param1)
{
gMainFrame.userInfo.isMyDenPrivate = !gMainFrame.userInfo.isMyDenPrivate;
DenXtCommManager.requestSetDenPrivacy(gMainFrame.userInfo.isMyDenPrivate,true);
GuiManager.refreshDenLockSettings();
}
if(gMainFrame.userInfo.isMyDenPrivate)
{
this._lock.gotoAndPlay("off");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("off");
}
else
{
this._lock.gotoAndPlay("on");
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("on");
}
}
}
}
@@ -0,0 +1,143 @@
package gui
{
public class JBManager
{
private static var _defPages:Array;
private static var _unseenPagesIds:Array;
private static var _currRoomJBItems:Array;
private static var _numUnclaimedGifts:int;
private static var _hasLoadedDefs:Boolean;
private static var _numUnseenPages:int;
private static const JB_FACT_LIST_ID:int = 54;
private static const JB_PAGE_BIT_IDX:int = 29;
private static const JB_KEEP_GIFT:int = 31;
private static const JB_DISCARD_GIFT:int = 30;
public function JBManager()
{
super();
}
public static function init() : void
{
_defPages = [];
_unseenPagesIds = [];
GenericListXtCommManager.requestGenericList(JB_FACT_LIST_ID,onFactListReceived);
}
public static function get numUnseenPages() : int
{
return _numUnseenPages;
}
public static function get numUnclaimedGifts() : int
{
return _numUnclaimedGifts;
}
public static function set numUnclaimedGifts(param1:int) : void
{
_numUnclaimedGifts = param1;
}
public static function removeUnseenPage(param1:int) : void
{
--_numUnseenPages;
delete _unseenPagesIds[param1];
}
public static function checkUnseenPage(param1:Array) : void
{
var _loc2_:Object = null;
var _loc3_:int = 0;
if(Boolean(param1) && param1.length > 0)
{
if(_hasLoadedDefs)
{
if(_unseenPagesIds.length > 0)
{
_currRoomJBItems = null;
for each(_loc2_ in param1)
{
for each(_loc3_ in _unseenPagesIds)
{
if(_loc3_ == _loc2_.refId)
{
GuiManager.showJBGlow(true);
break;
}
}
}
}
}
else
{
_currRoomJBItems = param1;
}
}
}
private static function onFactListReceived(param1:Array) : void
{
var _loc5_:Array = null;
var _loc6_:Object = null;
var _loc7_:int = 0;
_hasLoadedDefs = true;
var _loc2_:int = int(param1.length);
var _loc3_:int = 0;
var _loc4_:int = 0;
while(_loc4_ < _loc2_)
{
_loc6_ = param1[_loc4_];
if(!_defPages[_loc6_.userVarId])
{
_defPages[_loc6_.userVarId] = [];
if(!gMainFrame.userInfo.userVarCache.isBitSet(_loc6_.userVarId,JB_PAGE_BIT_IDX))
{
++_numUnseenPages;
_unseenPagesIds[_loc6_.userVarId] = _loc6_.id;
}
}
_defPages[_loc6_.userVarId].push(_loc6_);
NGFactManager.updateFactDefCache(_loc6_);
_loc4_++;
}
for each(_loc5_ in _defPages)
{
_loc7_ = 0;
_loc4_ = 0;
while(_loc4_ < _loc5_.length)
{
if(gMainFrame.userInfo.userVarCache.isBitSet(_loc5_[_loc4_].userVarId,_loc5_[_loc4_].bitIdx))
{
_loc7_++;
}
_loc4_++;
}
if(_loc7_ == _loc5_.length)
{
if(!(Boolean(gMainFrame.userInfo.userVarCache.isBitSet(_loc5_[_loc4_ - 1].userVarId,JB_KEEP_GIFT)) || Boolean(gMainFrame.userInfo.userVarCache.isBitSet(_loc5_[_loc4_ - 1].userVarId,JB_DISCARD_GIFT))))
{
++_numUnclaimedGifts;
}
}
}
if(_currRoomJBItems)
{
checkUnseenPage(_currRoomJBItems);
}
GuiManager.updateJBIcon();
}
}
}
@@ -0,0 +1,136 @@
package gui
{
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
public class LoadingSpiral extends MovieClip
{
public static var hasBeenLoaded:Boolean;
public static const LOADING_SPIRAL_MEDIA_ID:int = 44;
private var _isDarkenManagersSpiral:Boolean;
private var _loadingSpiral:MovieClip;
private var _loadingSpiralHelper:MediaHelper;
private var _parent:DisplayObjectContainer;
private var _addToParent:Boolean;
private var _displayPercentage:Boolean;
public function LoadingSpiral(param1:DisplayObjectContainer = null, param2:Number = 0, param3:Number = 0, param4:Boolean = false)
{
super();
if(param1)
{
this._parent = param1;
}
this._addToParent = true;
this.x = param2;
this.y = param3;
this._loadingSpiralHelper = new MediaHelper();
this._loadingSpiralHelper.init(LOADING_SPIRAL_MEDIA_ID,this.loadingSpiralHandler);
this.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDown,false,0,true);
this.addEventListener(MouseEvent.MOUSE_OVER,this.onMouseOver,false,0,true);
hasBeenLoaded = false;
this._displayPercentage = param4;
}
public function destroy() : void
{
if(Boolean(this._parent) && Boolean(this._loadingSpiral) && this.parent == this._parent)
{
this._parent.removeChild(this);
this._parent = null;
this._addToParent = false;
}
if(!this._isDarkenManagersSpiral)
{
this._parent = null;
}
this._displayPercentage = false;
}
public function set isDarkenManagersSpiral(param1:Boolean) : void
{
this._isDarkenManagersSpiral = param1;
}
public function setNewParent(param1:DisplayObjectContainer, param2:Number = 0, param3:Number = 0, param4:Boolean = false) : void
{
this._parent = param1;
this._addToParent = true;
if(Boolean(this._parent) && Boolean(this._loadingSpiral))
{
this._parent.addChild(this);
}
if(this._loadingSpiral)
{
if(param4)
{
this._loadingSpiral.txt.text = "0%";
this._loadingSpiral.txt.visible = true;
}
else
{
this._loadingSpiral.txt.visible = false;
}
}
this.x = param2;
this.y = param3;
}
public function updatePercentText(param1:String) : void
{
if(this._loadingSpiral)
{
this._loadingSpiral.txt.text = param1;
}
}
private function loadingSpiralHandler(param1:MovieClip) : void
{
if(this._addToParent)
{
this._loadingSpiral = param1;
this._loadingSpiral.txt.text = "0%";
if(this._loadingSpiral)
{
this.addChild(this._loadingSpiral);
}
if(this._parent)
{
this._parent.addChild(this);
}
if(!this._displayPercentage)
{
this._loadingSpiral.txt.visible = false;
}
else
{
this._loadingSpiral.txt.visible = true;
}
hasBeenLoaded = true;
this._loadingSpiralHelper.destroy();
this._loadingSpiralHelper = null;
}
}
private function onMouseDown(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onMouseOver(param1:MouseEvent) : void
{
param1.stopPropagation();
}
}
}
@@ -0,0 +1,261 @@
package gui
{
import com.sbi.analytics.SBTracker;
import com.sbi.popup.SBOkPopup;
import com.sbi.popup.SBYesNoPopup;
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
import item.ItemXtCommManager;
import loader.MediaHelper;
import localization.LocalizationManager;
public class MuseumDonation
{
private var _mediaHelper:MediaHelper;
private var _popup:MovieClip;
private var _guiLayer:DisplayLayer;
private var _closeCallback:Function;
private var _myGemCount:int;
private var _donationAmounts:Array;
private var _donationIndex:int;
private var _radioBtn1:MovieClip;
private var _radioBtn2:MovieClip;
private var _radioBtn3:MovieClip;
private var _lastChosenString:String;
public function MuseumDonation()
{
super();
}
public function init(param1:Function) : void
{
this._guiLayer = GuiManager.guiLayer;
DarkenManager.showLoadingSpiral(true);
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(1546,this.onMediaLoaded);
this._closeCallback = param1;
this._donationAmounts = [10,25,50,100,250,500,1000,2500,5000];
}
public function destroy() : void
{
this.removeEventListeners();
if(this._mediaHelper)
{
this._mediaHelper.destroy();
this._mediaHelper = null;
}
this._closeCallback = null;
DarkenManager.unDarken(this._popup);
this._guiLayer.removeChild(this._popup);
this._popup = null;
}
private function onMediaLoaded(param1:MovieClip) : void
{
if(param1)
{
this._popup = MovieClip(param1.getChildAt(0));
this._popup.x = MainFrame.VIEW_WIDTH * 0.5;
this._popup.y = MainFrame.VIEW_HEIGHT * 0.5;
this._myGemCount = gMainFrame.clientInfo.gemCount;
this._popup.donateRedBtn.visible = false;
this._radioBtn1 = this._popup.radioBtn1;
this._radioBtn2 = this._popup.radioBtn2;
this._radioBtn3 = this._popup.radioBtn3;
this._popup.donateBtn.activateGrayState(true);
this._radioBtn1._circle.visible = false;
this._radioBtn2._circle.visible = false;
this._radioBtn3._circle.visible = false;
this.addEventListeners();
DarkenManager.showLoadingSpiral(false);
this._guiLayer.addChild(this._popup);
DarkenManager.darken(this._popup);
}
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onClose(param1:MouseEvent) : void
{
if(param1)
{
param1.stopPropagation();
}
if(this._closeCallback != null)
{
this._closeCallback();
}
else
{
this.destroy();
}
}
private function onUpBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:int = int(this._popup.donationAmountTxt.text);
if(this._donationIndex < this._donationAmounts.length - 1)
{
++this._donationIndex;
_loc2_ = int(this._donationAmounts[this._donationIndex]);
}
if(_loc2_ > this._myGemCount)
{
this._popup.donateRedBtn.visible = true;
}
else
{
this._popup.donateRedBtn.visible = false;
}
this._popup.donationAmountTxt.text = _loc2_;
}
private function onDownBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:int = int(this._popup.donationAmountTxt.text);
if(this._donationIndex > 0)
{
--this._donationIndex;
_loc2_ = int(this._donationAmounts[this._donationIndex]);
}
if(_loc2_ > this._myGemCount)
{
this._popup.donateRedBtn.visible = true;
}
else
{
this._popup.donateRedBtn.visible = false;
}
this._popup.donationAmountTxt.text = _loc2_;
}
private function onDonateBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
if(this._myGemCount < this._popup.donationAmountTxt.text)
{
SBTracker.trackPageview("/game/play/popup/donate/donation/notEnoughGems/#" + this._myGemCount,-1,SBTracker.TYPE_EVENT);
new SBOkPopup(this._guiLayer,LocalizationManager.translateIdOnly(14770));
}
else
{
new SBYesNoPopup(this._guiLayer,LocalizationManager.translateIdAndInsertOnly(14771,Utility.convertNumberToString(this._popup.donationAmountTxt.text)),true,this.onConfirm);
}
}
private function onConfirm(param1:Object) : void
{
if(param1.status)
{
ItemXtCommManager.requestDonateGems(this._popup.donationAmountTxt.text,this.onDonateDone);
FeedbackManager.setupRequest(new UserImageUpload(),this._lastChosenString + "|" + this._popup.donationAmountTxt.text,FeedbackManager.TYPE_DONATION,0,this.onSuccess,this.onError);
}
}
private function onError(param1:Event) : void
{
}
private function onSuccess(param1:Event) : void
{
}
private function onDonateDone(param1:Boolean) : void
{
if(param1)
{
this._popup.visible = false;
SBTracker.trackPageview("/game/play/popup/donate/donation/#" + this._popup.donationAmountTxt.text);
new SBOkPopup(this._guiLayer,LocalizationManager.translateIdOnly(14772),true,this.onDonationThanks);
}
else
{
new SBOkPopup(this._guiLayer,LocalizationManager.translateIdOnly(14773));
}
}
private function onDonationThanks(param1:MouseEvent) : void
{
param1.stopPropagation();
SBOkPopup.destroyInParentChain(param1.target.parent);
this.onClose(null);
}
private function onRadioBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
this._radioBtn1._circle.visible = false;
this._radioBtn2._circle.visible = false;
this._radioBtn3._circle.visible = false;
var _loc2_:Object = param1.currentTarget;
_loc2_._circle.visible = !_loc2_._circle.visible;
if(_loc2_._circle.visible)
{
this._lastChosenString = this._popup["selectionLabelTxt" + _loc2_.name.substr(8)].text;
}
if(this._popup.donateBtn.isGray)
{
this._popup.donateBtn.activateGrayState(false);
}
}
private function onPlayMovBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
DarkenManager.showLoadingSpiral(true);
GenericListGuiManager.genericListVolumeClicked(param1.currentTarget.name.split("_")[1],{"shouldRepeat":false});
}
private function addEventListeners() : void
{
this._popup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
this._popup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
this._popup.upBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onUpBtn,false,0,true);
this._popup.downBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onDownBtn,false,0,true);
this._popup.donateBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onDonateBtn,false,0,true);
this._popup.donateRedBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onDonateBtn,false,0,true);
this._popup.radioBtn1.addEventListener(MouseEvent.MOUSE_DOWN,this.onRadioBtn,false,0,true);
this._popup.radioBtn2.addEventListener(MouseEvent.MOUSE_DOWN,this.onRadioBtn,false,0,true);
this._popup.radioBtn3.addEventListener(MouseEvent.MOUSE_DOWN,this.onRadioBtn,false,0,true);
this._popup.playMovBtn1_131.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlayMovBtn,false,0,true);
this._popup.playMovBtn2_130.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlayMovBtn,false,0,true);
this._popup.playMovBtn3_129.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlayMovBtn,false,0,true);
}
private function removeEventListeners() : void
{
this._popup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
this._popup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
this._popup.upBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onUpBtn);
this._popup.downBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onDownBtn);
this._popup.donateBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onDonateBtn);
this._popup.donateRedBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onDonateBtn);
this._popup.radioBtn1.removeEventListener(MouseEvent.MOUSE_DOWN,this.onRadioBtn);
this._popup.radioBtn2.removeEventListener(MouseEvent.MOUSE_DOWN,this.onRadioBtn);
this._popup.radioBtn3.removeEventListener(MouseEvent.MOUSE_DOWN,this.onRadioBtn);
this._popup.playMovBtn1_131.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPlayMovBtn);
this._popup.playMovBtn2_130.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPlayMovBtn);
this._popup.playMovBtn3_129.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPlayMovBtn);
}
}
}
@@ -0,0 +1,235 @@
package gui
{
import com.sbi.corelib.audio.SBAudio;
import flash.display.MovieClip;
import flash.events.*;
import flash.net.URLRequest;
import flash.net.navigateToURL;
import localization.LocalizationManager;
public class MySettings
{
public static var SETTINGS_BUDDY_REQUESTS:int = 0;
public static var SETTINGS_GAME_INVITES:int = 1;
public static var SETTINGS_DOOR_BELL:int = 2;
public static var TOGGLE_TYPE_TOGGLE_BTN:int = 0;
public static var TOGGLE_TYPE_TEXT:int = 1;
public static var TOGGLE_TYPE_CURSOR:int = 2;
public static var TOGGLE_TYPE_JOIN:int = 3;
private var _mySettings:MovieClip;
private var _popupLayer:DisplayLayer;
private var _closeCallback:Function;
private var _wallPrivacyDropDown:GuiDropdown;
private var _toggleWindows:WindowGenerator;
private var _toggleScrollBar:SBScrollbar;
public function MySettings()
{
super();
}
public function init(param1:DisplayLayer, param2:int, param3:int, param4:Function = null) : void
{
this._popupLayer = param1;
this._closeCallback = param4;
this._mySettings = GETDEFINITIONBYNAME("MySettings");
this._mySettings.x = param2;
this._mySettings.y = param3;
this._popupLayer.addChild(this._mySettings);
this.setupContent();
this.addEventListeners();
}
public function destroy() : void
{
this.removeEventListeners();
this._popupLayer.removeChild(this._mySettings);
this._closeCallback = null;
this._mySettings = null;
if(this._toggleWindows)
{
this._toggleWindows.destroy();
this._toggleWindows = null;
}
if(this._toggleScrollBar)
{
this._toggleScrollBar.destroy();
this._toggleWindows = null;
}
}
public function updateSoundBtn() : void
{
if(SBAudio.isMusicMuted || SBAudio.areSoundsMuted)
{
this._mySettings.musicToggle.toggleBtn.gotoAndPlay("off");
}
else
{
this._mySettings.musicToggle.toggleBtn.gotoAndPlay("on");
}
}
public function updateWorldMessage() : void
{
}
private function setupContent() : void
{
var _loc1_:int = 0;
var _loc2_:int = 0;
var _loc3_:int = 0;
var _loc5_:int = 0;
if(gMainFrame.userInfo.isMember)
{
this._mySettings.statusNonmember.visible = false;
_loc5_ = int(gMainFrame.clientInfo.numDaysLeftOnSubscription);
if(_loc5_ > 0)
{
this._mySettings.gotoAndStop("memberScrollSubscription");
_loc1_ = 5;
}
else
{
this._mySettings.gotoAndStop("memberScroll");
_loc1_ = 6;
}
_loc2_ = int(this._mySettings.itemWindow.height);
_loc3_ = int(this._mySettings.itemWindow.width);
if(_loc5_ > 0)
{
if(_loc5_ > 1)
{
LocalizationManager.translateIdAndInsert(this._mySettings.timeRemaining.timeTxt,11361,_loc5_);
}
else
{
LocalizationManager.translateIdAndInsert(this._mySettings.timeRemaining.timeTxt,11362,_loc5_);
}
}
}
else
{
this._mySettings.statusMember.visible = false;
this._mySettings.gotoAndStop("nonMemScroll");
this._mySettings.joinBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onJoinBtn,false,0,true);
_loc1_ = 5;
_loc2_ = int(this._mySettings.itemWindow.height);
_loc3_ = int(this._mySettings.itemWindow.width);
}
var _loc4_:Array = [{
"type":TOGGLE_TYPE_JOIN,
"frame":"world",
"labelTxt":6395,
"btnTxt":6366
},{
"type":TOGGLE_TYPE_TOGGLE_BTN,
"frame":"lock",
"labelTxt":6271,
"onTxt":6393,
"offTxt":6301
},{
"type":TOGGLE_TYPE_TOGGLE_BTN,
"frame":"doorBell",
"labelTxt":18420,
"onTxt":6324,
"offTxt":6322
},{
"type":TOGGLE_TYPE_TOGGLE_BTN,
"frame":"music",
"labelTxt":6373,
"onTxt":6324,
"offTxt":6322
},{
"type":TOGGLE_TYPE_CURSOR,
"frame":"",
"labelTxt":6269
},{
"type":TOGGLE_TYPE_TOGGLE_BTN,
"frame":"buddyRequest",
"labelTxt":6251,
"onTxt":6324,
"offTxt":6322
},{
"type":TOGGLE_TYPE_TOGGLE_BTN,
"frame":"gameInvites",
"labelTxt":6282,
"onTxt":6324,
"offTxt":6322
}];
this._toggleWindows = new WindowGenerator();
this._toggleWindows.init(1,_loc1_,_loc4_.length,0,4,0,ItemWindowToggle,_loc4_,null);
this._mySettings.itemWindow.addChild(this._toggleWindows);
this._toggleScrollBar = new SBScrollbar();
this._toggleScrollBar.init(this._toggleWindows,_loc3_,_loc2_,2,"scrollbar2",this._toggleWindows.boxHeight + 4);
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
if(this._closeCallback != null)
{
this._closeCallback();
}
else
{
this.destroy();
}
}
private function onJoinBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:String = gMainFrame.clientInfo.websiteURL + "membership";
var _loc3_:URLRequest = new URLRequest(_loc2_);
try
{
navigateToURL(_loc3_,"_blank");
}
catch(e:Error)
{
}
}
private function addEventListeners() : void
{
with(this._mySettings)
{
addEventListener(MouseEvent.MOUSE_DOWN,onPopup,false,0,true);
bx.addEventListener(MouseEvent.MOUSE_DOWN,onClose,false,0,true);
}
}
private function removeEventListeners() : void
{
with(this._mySettings)
{
removeEventListener(MouseEvent.MOUSE_DOWN,onPopup);
bx.removeEventListener(MouseEvent.MOUSE_DOWN,onClose);
if(joinBtn)
{
joinBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onJoinBtn);
}
}
}
}
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,97 @@
package gui
{
import diamond.DiamondItem;
import diamond.DiamondXtCommManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import item.Item;
import loader.MediaHelper;
import pet.PetManager;
public class PetAdoptionBanner
{
private static var _popupMediaHelper:MediaHelper;
private static var _popup:MovieClip;
private static var _diamondPetDef:int;
public function PetAdoptionBanner()
{
super();
}
public static function init(param1:int) : void
{
DarkenManager.showLoadingSpiral(true);
_diamondPetDef = param1;
_popupMediaHelper = new MediaHelper();
_popupMediaHelper.init(3759,onMediaLoaded);
}
public static function destroy() : void
{
if(_popupMediaHelper)
{
_popupMediaHelper.destroy();
_popupMediaHelper = null;
}
if(_popup)
{
_popup.removeEventListener(MouseEvent.MOUSE_DOWN,onPopup);
_popup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,onClose);
_popup.adoptBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onAdoptBtn);
DarkenManager.unDarken(_popup);
if(Boolean(_popup.parent) && _popup.parent == GuiManager.guiLayer)
{
GuiManager.guiLayer.removeChild(_popup);
}
_popup = null;
}
}
private static function onMediaLoaded(param1:MovieClip) : void
{
DarkenManager.showLoadingSpiral(false);
if(param1)
{
_popup = MovieClip(param1.getChildAt(0));
_popup.addEventListener(MouseEvent.MOUSE_DOWN,onPopup,false,0,true);
_popup.bx.addEventListener(MouseEvent.MOUSE_DOWN,onClose,false,0,true);
_popup.adoptBtn.addEventListener(MouseEvent.MOUSE_DOWN,onAdoptBtn,false,0,true);
_popup.x = MainFrame.VIEW_WIDTH * 0.5;
_popup.y = MainFrame.VIEW_HEIGHT * 0.5;
GuiManager.guiLayer.addChild(_popup);
DarkenManager.darken(_popup);
}
}
private static function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private static function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
destroy();
}
private static function onAdoptBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:DiamondItem = DiamondXtCommManager.getDiamondItem(_diamondPetDef);
if(_loc2_)
{
PetManager.openPetFinder(PetManager.petNameForDefId(_loc2_.refDefId),onPetFinderClose,false,null,_loc2_,Item.DIAMOND_CURRENCY,214);
}
}
private static function onPetFinderClose() : void
{
destroy();
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,699 @@
package gui
{
import avatar.AvatarManager;
import com.sbi.analytics.SBTracker;
import com.sbi.popup.SBOkPopup;
import com.sbi.popup.SBYesNoPopup;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import game.MinigameManager;
import loader.DefPacksDefHelper;
import loader.MediaHelper;
import localization.LocalizationManager;
import pet.GuiPet;
import pet.PetManager;
import pet.PetXtCommManager;
public class PetInventory
{
private static const LOADING_SPIRAL_SMALL:int = 397;
private static const EVT_ICON_ID:int = 44;
private const PET_INVENTORY_MEDIA_ID:int = 993;
private var _guiLayer:DisplayLayer;
private var _mediaHelpers:Array;
private var _loadingMediaHelper:MediaHelper;
private var _closeCallback:Function;
private var _petList:Array;
private var _petViews:Array;
private var _loadingSpiralBig:LoadingSpiral;
private var _inventoryMC:MovieClip;
private var _bigPet:GuiPet;
private var _scrollButtons:SBScrollbar;
private var _itemWindows:WindowGenerator;
private var _isRecycling:Boolean;
private var _activePetModified:Boolean;
private var _noCurrentActivePet:Boolean;
private var _idx:int;
private var _currSelectedIdx:int;
private var _initialPetInvId:int;
private var _recycleOneOnly:Boolean;
private var _hasRecycled:Boolean;
private var _shop:Shop;
private var _previousPetInvId:int;
public function PetInventory()
{
super();
}
public function init(param1:Function, param2:Boolean = false) : void
{
DarkenManager.showLoadingSpiral(true);
this._guiLayer = GuiManager.guiLayer;
this._closeCallback = param1;
this._mediaHelpers = [];
this._petViews = [];
this._petList = PetManager.myPetList;
this._idx = -1;
this._currSelectedIdx = -1;
this._recycleOneOnly = param2;
this._loadingSpiralBig = new LoadingSpiral();
SBTracker.push();
SBTracker.trackPageview("/game/play/popup/pet/inventory");
this._loadingMediaHelper = new MediaHelper();
this._loadingMediaHelper.init(this.PET_INVENTORY_MEDIA_ID,this.onMediaItemLoaded);
this._mediaHelpers.push(this._loadingMediaHelper);
}
public function destroy() : void
{
var _loc1_:int = 0;
this.removeEventListeners();
DarkenManager.unDarken(this._inventoryMC);
this._guiLayer.removeChild(this._inventoryMC);
SBTracker.pop();
this._activePetModified = false;
this._noCurrentActivePet = false;
this._idx = -1;
this._initialPetInvId = -1;
this._currSelectedIdx = -1;
this._isRecycling = false;
this._inventoryMC = null;
this._petList = null;
if(this._petViews)
{
_loc1_ = 0;
while(_loc1_ < this._petViews.length)
{
this._petViews[_loc1_].destroy();
_loc1_++;
}
}
this._petViews = null;
if(this._bigPet)
{
this._bigPet.destroy();
this._bigPet = null;
}
if(this._scrollButtons)
{
this._scrollButtons.destroy();
this._scrollButtons = null;
}
if(this._itemWindows)
{
this._itemWindows.destroy();
this._itemWindows = null;
}
_loc1_ = 0;
while(_loc1_ < this._mediaHelpers.length)
{
this._mediaHelpers[_loc1_].destroy();
_loc1_++;
}
this._mediaHelpers.splice();
if(this._closeCallback != null)
{
if(this._recycleOneOnly)
{
this._closeCallback(this._hasRecycled);
}
else
{
this._closeCallback();
}
this._closeCallback = null;
}
}
private function onMediaItemLoaded(param1:MovieClip) : void
{
var _loc2_:int = 0;
var _loc3_:Object = null;
DarkenManager.showLoadingSpiral(false);
if(param1)
{
this._inventoryMC = MovieClip(param1.getChildAt(0));
this._inventoryMC.petNameTxt.text = "";
this._inventoryMC.itemCounter.counterTxt.text = "0/" + PetManager.getPetInventoryMax();
this._inventoryMC.bMastery.visible = false;
this._inventoryMC.helpBubble.visible = false;
if(AvatarManager.roomEnviroType == SbiConstants.ENVIRO_OCEAN)
{
this._inventoryMC.shopBtn.visible = false;
}
if(Boolean(this._petList) && this._petList.length > 0)
{
if(PetManager.myActivePetInvId != 0)
{
_loc2_ = 0;
while(_loc2_ < this._petList.length)
{
if(this._petList[_loc2_].idx == PetManager.myActivePetInvId)
{
this._currSelectedIdx = _loc2_;
this._initialPetInvId = this._petList[_loc2_].idx;
if(!PetManager.canCurrAvatarUsePet(AvatarManager.playerAvatar.enviroTypeFlag,this._petList[_loc2_].type))
{
break;
}
_loc3_ = this._petList[_loc2_];
this._bigPet = new GuiPet(_loc3_.idx,_loc3_.lBits,_loc3_.uBits,_loc3_.eBits,_loc3_.type,_loc3_.name,this.onBigPetLoaded);
this._inventoryMC.itemWindowPet.addChild(this._bigPet);
this._inventoryMC.petNameTxt.text = this._bigPet.petName;
this._inventoryMC.butterfly.visible = false;
if(_loc3_.masteryCounter >= PetManager.MASTERY_ACHIV_MIN_COUNT)
{
this._inventoryMC.bMastery.visible = true;
this._inventoryMC.bMastery.icon.gotoAndStop(PetManager.petNameForDefId(_loc3_.defId) + "1");
if((_loc3_.uBits >> 8 & 0x0F) > 0)
{
this._inventoryMC.bMastery.mouse.visible = false;
this._inventoryMC.bMastery.down.visible = true;
}
}
break;
}
_loc2_++;
}
}
this._inventoryMC.itemCounter.counterTxt.text = this._petList.length + "/" + PetManager.getPetInventoryMax();
}
DarkenManager.showLoadingSpiral(false);
this._inventoryMC.x = MainFrame.VIEW_WIDTH * 0.5;
this._inventoryMC.y = MainFrame.VIEW_HEIGHT * 0.5;
this._guiLayer.addChild(this._inventoryMC);
DarkenManager.darken(this._inventoryMC);
this.createItemWindows();
this.addEventListeners();
}
}
private function onBigPetLoaded(param1:MovieClip, param2:GuiPet) : void
{
this._bigPet.scaleX = this._bigPet.scaleY = 5;
this._bigPet.y += 83;
}
private function createGuiPets() : void
{
this._petViews = [];
var _loc1_:int = 0;
while(_loc1_ < this._petList.length)
{
this._petViews.push(new GuiPet(this._petList[_loc1_].idx,this._petList[_loc1_].lBits,this._petList[_loc1_].uBits,this._petList[_loc1_].eBits,this._petList[_loc1_].type,this._petList[_loc1_].name,null));
_loc1_++;
}
}
private function createItemWindows() : void
{
if(this._scrollButtons)
{
this._scrollButtons.destroy();
this._scrollButtons = null;
}
if(this._itemWindows)
{
this._itemWindows.destroy();
this._itemWindows = null;
}
while(this._inventoryMC.itemWindow.numChildren > 0)
{
this._inventoryMC.itemWindow.removeChildAt(0);
}
this.createGuiPets();
var _loc1_:int = int(this._petList.length);
var _loc2_:Number = Math.min(PetManager.getPetInventoryMax(),4);
var _loc3_:int = Math.ceil(_loc2_ / 5);
this._itemWindows = new WindowGenerator();
this._itemWindows.init(_loc2_,_loc3_,PetManager.getPetInventoryMax(),2,2,1,ItemWindowPets,this._petList,"",{
"mouseDown":this.winMouseDown,
"mouseOver":this.winMouseOver,
"mouseOut":this.winMouseOut
},{"isRecycling":this._isRecycling || this._recycleOneOnly},null,false,false);
this._inventoryMC.itemWindow.addChild(this._itemWindows);
this._loadingSpiralBig.visible = false;
this._scrollButtons = new SBScrollbar();
this._scrollButtons.init(this._itemWindows,344,258,4,"scrollbar2",86);
}
private function onConfirmFreePet(param1:Object) : void
{
if(param1.status)
{
PetXtCommManager.sendPetDismissRequest(this._petList[param1.passback].idx,this.freePetCallback);
DarkenManager.showLoadingSpiral(true);
}
}
private function freePetCallback(param1:Boolean, param2:Boolean, param3:Boolean) : void
{
DarkenManager.showLoadingSpiral(false);
GuiManager.resetPetWindowListInDen();
if(param1)
{
if(param2)
{
SBTracker.trackPageview("/game/play/popup/pet/petInventory/free");
--this._idx;
--this._currSelectedIdx;
this._hasRecycled = true;
if(param3)
{
AvatarManager.playerAvatarWorldView.setActivePet(0,0,0,"");
this._activePetModified = true;
while(this._inventoryMC.itemWindowPet.numChildren > 0)
{
this._inventoryMC.itemWindowPet.removeChildAt(0);
}
this._inventoryMC.petNameTxt.text = "";
this._inventoryMC.butterfly.visible = true;
this._idx = -1;
this._currSelectedIdx = -1;
}
if(!this._recycleOneOnly)
{
this._petList = PetManager.myPetList;
this._inventoryMC.itemCounter.counterTxt.text = this._petList.length + "/" + PetManager.getPetInventoryMax();
this._isRecycling = false;
this._noCurrentActivePet = true;
this.createItemWindows();
}
else
{
this.destroy();
}
}
else
{
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14786));
}
}
}
private function onPetSwitch(param1:Boolean = true) : void
{
DarkenManager.showLoadingSpiral(false);
if(param1)
{
this.destroy();
}
else
{
PetManager.myActivePetInvId = this._previousPetInvId;
this.reloadPets();
}
}
private function winMouseDown(param1:MouseEvent) : void
{
var _loc2_:int = 0;
var _loc3_:Object = null;
var _loc4_:MovieClip = null;
param1.stopPropagation();
if((this._isRecycling || this._recycleOneOnly) && Boolean(param1.currentTarget.cageIcon.visible))
{
if(!(PetManager.canCurrAvatarUsePet(AvatarManager.playerAvatar.enviroTypeFlag,this._petList[param1.currentTarget.index].type) && PetManager.myActivePetInvId == this._petList[param1.currentTarget.index].idx && !PartyManager.canSwitchPet(true)))
{
new SBYesNoPopup(this._guiLayer,LocalizationManager.translateIdOnly(14787),true,this.onConfirmFreePet,param1.currentTarget.index);
}
}
else if(param1.currentTarget.newPetIcon.visible)
{
PetManager.openPetFinder("",this.onPetSwitch);
}
else
{
if(param1.currentTarget.gray.visible)
{
if(!gMainFrame.userInfo.isMember)
{
UpsellManager.displayPopup(UpsellManager.PETS,"equipMemberPet");
}
return;
}
while(this._inventoryMC.itemWindowPet.numChildren > 0)
{
this._inventoryMC.itemWindowPet.removeChildAt(0);
}
this._idx = param1.currentTarget.index;
this._currSelectedIdx = this._idx;
if((param1.currentTarget.cir.currentFrameLabel == "downMouse" || param1.currentTarget.cir.currentFrameLabel == "down") && PartyManager.canSwitchPet(true))
{
param1.currentTarget.cir.gotoAndStop("up");
if(this._initialPetInvId == 0)
{
this._idx = -1;
}
PetManager.myActivePetInvId = 0;
GuiManager.resetPetWindowListInDen();
this._activePetModified = false;
this._inventoryMC.petNameTxt.text = "";
this._inventoryMC.butterfly.visible = true;
this._inventoryMC.bMastery.visible = false;
this._bigPet.destroy();
this._bigPet = null;
}
else
{
this._activePetModified = true;
this._noCurrentActivePet = false;
_loc2_ = 0;
while(_loc2_ < this._itemWindows.numWindowsCreated)
{
_loc4_ = MovieClip(this._itemWindows.bg.getChildAt(_loc2_));
_loc4_.cir.gotoAndStop("up");
_loc2_++;
}
param1.currentTarget.cir.gotoAndStop("downMouse");
_loc3_ = this._petList[this._idx];
this._bigPet = new GuiPet(_loc3_.idx,_loc3_.lBits,_loc3_.uBits,_loc3_.eBits,_loc3_.type,_loc3_.name,this.onBigPetLoaded);
this._inventoryMC.itemWindowPet.addChild(this._bigPet);
this._inventoryMC.petNameTxt.text = this._bigPet.petName;
this._inventoryMC.butterfly.visible = false;
if(_loc3_.masteryCounter >= PetManager.MASTERY_ACHIV_MIN_COUNT)
{
this._inventoryMC.bMastery.visible = true;
this._inventoryMC.bMastery.icon.gotoAndStop(PetManager.petNameForDefId(_loc3_.defId) + "1");
if((_loc3_.uBits >> 8 & 0x0F) > 0)
{
this._inventoryMC.bMastery.mouse.visible = false;
this._inventoryMC.bMastery.down.visible = true;
}
else
{
this._inventoryMC.bMastery.mouse.visible = true;
this._inventoryMC.bMastery.down.visible = false;
}
}
else
{
this._inventoryMC.bMastery.visible = false;
this._inventoryMC.bMastery.mouse.visible = true;
this._inventoryMC.bMastery.down.visible = false;
}
this._previousPetInvId = PetManager.myActivePetInvId;
if(this._initialPetInvId == _loc3_.idx)
{
this._idx = -1;
PetManager.myActivePetInvId = this._initialPetInvId;
}
else
{
PetManager.myActivePetInvId = _loc3_.idx;
}
GuiManager.resetPetWindowListInDen();
}
}
}
private function winMouseOver(param1:MouseEvent) : void
{
param1.stopPropagation();
if(param1.currentTarget.numChildren >= 1)
{
if(param1.currentTarget.cir.currentFrameLabel == "down")
{
param1.currentTarget.cir.gotoAndStop("downMouse");
}
else if(param1.currentTarget.cir.currentFrameLabel != "downMouse")
{
param1.currentTarget.cir.gotoAndStop("over");
}
AJAudio.playSubMenuBtnRollover();
}
}
private function winMouseOut(param1:MouseEvent) : void
{
param1.stopPropagation();
if(param1.currentTarget.numChildren >= 1)
{
if(param1.currentTarget.cir.currentFrameLabel == "downMouse")
{
param1.currentTarget.cir.gotoAndStop("down");
}
else if(param1.currentTarget.cir.currentFrameLabel != "down")
{
param1.currentTarget.cir.gotoAndStop("up");
}
}
}
private function onCageBtn(param1:MouseEvent) : void
{
var _loc2_:int = 0;
var _loc3_:MovieClip = null;
param1.stopPropagation();
if(this._isRecycling)
{
this._isRecycling = false;
_loc2_ = 0;
while(_loc2_ < this._itemWindows.numWindowsCreated)
{
_loc3_ = MovieClip(this._itemWindows.bg.getChildAt(_loc2_));
_loc3_.cageIcon.visible = false;
_loc2_++;
}
}
else
{
this._isRecycling = true;
_loc2_ = 0;
while(_loc2_ < this._itemWindows.numWindowsCreated)
{
_loc3_ = MovieClip(this._itemWindows.bg.getChildAt(_loc2_));
if(_loc3_.hasPet)
{
_loc3_.cageIcon.visible = true;
}
_loc2_++;
}
}
}
private function onCageOverBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.toolTip.init(MovieClip(param1.currentTarget),LocalizationManager.translateIdOnly(14674),0,-30);
GuiManager.toolTip.startTimer(param1);
}
private function onCageOutBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.toolTip.resetTimerAndSetVisibility();
}
private function onMasteryBtn(param1:MouseEvent) : void
{
var _loc3_:int = 0;
var _loc4_:int = 0;
var _loc5_:int = 0;
var _loc6_:int = 0;
var _loc7_:int = 0;
var _loc8_:int = 0;
var _loc9_:int = 0;
param1.stopPropagation();
var _loc2_:Object = this._petList[this._currSelectedIdx];
if(_loc2_ != null)
{
_loc3_ = _loc2_.uBits >> 8 & 0x0F;
if(_loc3_ > 0)
{
_loc3_ = 0;
param1.currentTarget.mouse.visible = true;
param1.currentTarget.down.visible = false;
}
else
{
_loc3_ = 1;
param1.currentTarget.mouse.visible = false;
param1.currentTarget.down.visible = true;
}
_loc4_ = int(_loc2_.uBits);
_loc5_ = _loc4_ & 0x0F;
_loc6_ = _loc4_ >> 4 & 0x0F;
_loc7_ = _loc4_ >> 12 & 0x0F;
_loc8_ = _loc4_ >> 16 & 0x0F;
_loc9_ = _loc4_ >> 20 & 0x0F;
_loc4_ = _loc9_ << 20 | _loc8_ << 16 | _loc7_ << 12 | _loc3_ << 8 | _loc6_ << 4 | _loc5_;
_loc2_.uBits = _loc3_ << 8 | _loc4_;
if(this._petViews[this._currSelectedIdx] != null)
{
this._petViews[this._currSelectedIdx].updateUBits(_loc2_.uBits);
}
this._bigPet.updateAllBits(_loc2_.lBits,_loc2_.uBits,_loc2_.eBits);
DarkenManager.showLoadingSpiral(true);
PetXtCommManager.sendPetMasteryRequest(_loc3_,_loc2_.idx);
}
}
private function updateActivePet(param1:Boolean = false) : void
{
var _loc3_:Object = null;
var _loc2_:Function = null;
if(param1)
{
_loc2_ = this.onPetUpdate;
}
else
{
_loc2_ = this.onPetSwitch;
}
if(this._idx > -1)
{
if(Boolean(this._petList) && this._petList.length > 0)
{
_loc3_ = this._petList[this._idx];
if(_loc3_ != null)
{
if(this._activePetModified)
{
DarkenManager.showLoadingSpiral(true);
PetXtCommManager.sendPetSwitchRequest(_loc3_.idx,_loc2_);
this._activePetModified = false;
return;
}
if(PetManager.myActivePetInvId == 0 && MovieClip(this._itemWindows.bg.getChildAt(this._idx)).cir.currentFrameLabel == "up" && !this._noCurrentActivePet)
{
DarkenManager.showLoadingSpiral(true);
PetXtCommManager.sendPetSwitchRequest(0,_loc2_);
return;
}
}
}
}
if(AvatarManager.playerAvatarWorldView.getActivePet() != null)
{
if(this._bigPet == null)
{
AvatarManager.playerAvatarWorldView.setActivePet(0,0,0,"");
}
else
{
AvatarManager.playerAvatarWorldView.setActivePet(this._bigPet.getLBits(),this._bigPet.getUBits(),this._bigPet.getEBits(),this._bigPet.petName);
}
}
if(!param1)
{
this.destroy();
}
else
{
_loc2_(true);
}
}
private function reloadPets() : void
{
this._petList = PetManager.myPetList;
while(this._inventoryMC.itemWindowPet.numChildren > 0)
{
this._inventoryMC.itemWindowPet.removeChildAt(0);
}
var _loc1_:Object = PetManager.myActivePet;
this._bigPet = new GuiPet(_loc1_.idx,_loc1_.lBits,_loc1_.uBits,_loc1_.eBits,_loc1_.type,_loc1_.name,this.onBigPetLoaded);
this._inventoryMC.itemWindowPet.addChild(this._bigPet);
this._inventoryMC.petNameTxt.text = this._bigPet.petName;
this._inventoryMC.butterfly.visible = false;
this.createItemWindows();
if(AvatarManager.playerAvatarWorldView.getActivePet() != null)
{
AvatarManager.playerAvatarWorldView.setActivePet(this._bigPet.getLBits(),this._bigPet.getUBits(),this._bigPet.getEBits(),this._bigPet.petName);
}
}
private function onPetUpdate(param1:Boolean) : void
{
var _loc2_:Object = null;
DarkenManager.showLoadingSpiral(false);
if(param1)
{
_loc2_ = {"typeDefId":52};
MinigameManager.handleGameClick(_loc2_,null,false,this.reloadPets);
}
}
private function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
this.updateActivePet();
}
private function onShopBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
this._shop = new Shop();
if(AvatarManager.roomEnviroType == SbiConstants.ENVIRO_OCEAN)
{
this._shop.init(GenericListXtCommManager.DEN_ITEM_PET_OCEAN,DefPacksDefHelper.DEF_DEN_ITEM,AvatarManager.playerAvatar,this._guiLayer);
}
else
{
this._shop.init(GenericListXtCommManager.DEN_ITEM_PET_LAND,DefPacksDefHelper.DEF_DEN_ITEM,AvatarManager.playerAvatar,this._guiLayer);
}
}
private function onSalonBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
this.updateActivePet(true);
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function addEventListeners() : void
{
this._inventoryMC.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
this._inventoryMC.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
this._inventoryMC.cageBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onCageBtn,false,0,true);
this._inventoryMC.cageBtn.addEventListener(MouseEvent.MOUSE_OVER,this.onCageOverBtn,false,0,true);
this._inventoryMC.cageBtn.addEventListener(MouseEvent.MOUSE_OUT,this.onCageOutBtn,false,0,true);
this._inventoryMC.bMastery.addEventListener(MouseEvent.MOUSE_DOWN,this.onMasteryBtn,false,0,true);
this._inventoryMC.shopBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onShopBtn,false,0,true);
this._inventoryMC.salonBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onSalonBtn,false,0,true);
}
private function removeEventListeners() : void
{
this._inventoryMC.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
this._inventoryMC.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
this._inventoryMC.cageBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onCageBtn);
this._inventoryMC.cageBtn.removeEventListener(MouseEvent.MOUSE_OVER,this.onCageOverBtn);
this._inventoryMC.cageBtn.removeEventListener(MouseEvent.MOUSE_OUT,this.onCageOutBtn);
this._inventoryMC.bMastery.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMasteryBtn);
this._inventoryMC.shopBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onShopBtn);
this._inventoryMC.salonBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onSalonBtn);
}
}
}
@@ -0,0 +1,125 @@
package gui
{
import avatar.AvatarManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
import pet.GuiPet;
import pet.PetManager;
public class PetMastery
{
private const MASTERY_MEDIA_ID:int = 1381;
private var _masteryPopup:MovieClip;
private var _guiLayer:DisplayLayer;
private var _mediaHelper:MediaHelper;
private var _currPet:GuiPet;
public function PetMastery()
{
super();
}
public function init() : void
{
this._guiLayer = GuiManager.guiLayer;
}
public function displayMasteryPopup() : void
{
if(this._masteryPopup)
{
this.setupInitialConditions();
this._guiLayer.addChild(this._masteryPopup);
DarkenManager.darken(this._masteryPopup);
}
else
{
DarkenManager.showLoadingSpiral(true);
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(this.MASTERY_MEDIA_ID,this.onMediaLoaded);
}
}
private function onMediaLoaded(param1:MovieClip) : void
{
if(param1)
{
DarkenManager.showLoadingSpiral(false);
this._masteryPopup = MovieClip(param1.getChildAt(0));
this.setupInitialConditions();
this._masteryPopup.x = MainFrame.VIEW_WIDTH * 0.5;
this._masteryPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
this._guiLayer.addChild(this._masteryPopup);
DarkenManager.darken(this._masteryPopup);
this.addEventListeners();
}
}
private function setupInitialConditions() : void
{
var _loc2_:int = 0;
var _loc3_:int = 0;
var _loc4_:int = 0;
var _loc5_:int = 0;
var _loc6_:int = 0;
var _loc7_:int = 0;
var _loc8_:int = 0;
var _loc1_:Object = PetManager.myActivePet;
if(_loc1_)
{
_loc2_ = 1;
_loc3_ = int(_loc1_.uBits);
_loc4_ = _loc3_ & 0x0F;
_loc5_ = _loc3_ >> 4 & 0x0F;
_loc6_ = _loc3_ >> 12 & 0x0F;
_loc7_ = _loc3_ >> 16 & 0x0F;
_loc8_ = _loc3_ >> 20 & 0x0F;
_loc3_ = _loc8_ << 20 | _loc7_ << 16 | _loc6_ << 12 | _loc2_ << 8 | _loc5_ << 4 | _loc4_;
_loc1_.uBits = _loc2_ << 8 | _loc3_;
this._currPet = new GuiPet(_loc1_.idx,_loc1_.lBits,_loc1_.uBits,_loc1_.eBits,_loc1_.type,_loc1_.name,this.onPetLoaded);
while(this._masteryPopup.itemBlock.numChildren > 0)
{
this._masteryPopup.itemBlock.removeChildAt(0);
}
this._masteryPopup.itemBlock.addChild(this._currPet);
AvatarManager.playerAvatarWorldView.setActivePet(this._currPet.getLBits(),this._currPet.getUBits(),this._currPet.getEBits(),this._currPet.name);
}
}
private function onPetLoaded(param1:MovieClip, param2:GuiPet) : void
{
this._currPet.scaleX = this._currPet.scaleY = 2.5;
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onMasteryClose(param1:MouseEvent) : void
{
param1.stopPropagation();
DarkenManager.unDarken(this._masteryPopup);
this._guiLayer.removeChild(this._masteryPopup);
}
private function addEventListeners() : void
{
this._masteryPopup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
this._masteryPopup.xb.addEventListener(MouseEvent.MOUSE_DOWN,this.onMasteryClose,false,0,true);
}
private function removeEventListeners() : void
{
this._masteryPopup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
this._masteryPopup.xb.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMasteryClose);
}
}
}
@@ -0,0 +1,783 @@
package gui
{
import avatar.Avatar;
import avatar.AvatarEditorView;
import avatar.AvatarManager;
import avatar.AvatarSwitch;
import avatar.AvatarUtility;
import avatar.AvatarView;
import avatar.AvatarXtCommManager;
import com.sbi.analytics.SBTracker;
import com.sbi.client.KeepAlive;
import com.sbi.graphics.JPEGAsyncCompleteEvent;
import com.sbi.graphics.JpegAsynchEncoder;
import com.sbi.graphics.LayerAnim;
import com.sbi.popup.SBOkPopup;
import com.sbi.popup.SBYesNoPopup;
import flash.display.BitmapData;
import flash.display.MovieClip;
import flash.events.*;
import flash.filters.GlowFilter;
import flash.geom.Matrix;
import flash.geom.Point;
import loader.MediaHelper;
import localization.LocalizationManager;
import pet.GuiPet;
import pet.PetManager;
public class PhotoBooth
{
private static var _nameSaveIndex:int = 1;
private const IMAGE_WIDTH:int = 626;
private const IMAGE_HEIGHT:int = 470;
private var _mediaHelper:MediaHelper;
private var _currAvtView:AvatarEditorView;
private var _booth:MovieClip;
private var _myPet:GuiPet;
private var _guiLayer:DisplayLayer;
private var _closeCallback:Function;
private var _numBackgroundFrames:int;
private var _currBackgroundFrame:int;
private var _jpgEncoder:JpegAsynchEncoder;
private var _hudAvtView:AvatarView;
private var _startingFrame:int;
private var _petPosIndex:int;
private var _debugAvtIndex:int;
private var _loadingSpiralAvt:LoadingSpiral;
private var _flip:Boolean;
public function PhotoBooth()
{
super();
}
public function init(param1:Function = null) : void
{
DarkenManager.showLoadingSpiral(true);
this._closeCallback = param1;
this._guiLayer = GuiManager.guiLayer;
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(2017,this.onMediaLoaded);
}
public function destroy() : void
{
SBTracker.trackPageview("/game/play/popup/photobooth/exit");
KeepAlive.stopKATimer(this._booth);
SafeChatManager.destroy(this._booth.chatTree);
this.removeEventListeners();
DarkenManager.unDarken(this._booth);
this._guiLayer.removeChild(this._booth);
}
private function onMediaLoaded(param1:MovieClip) : void
{
DarkenManager.showLoadingSpiral(false);
if(param1)
{
SBTracker.trackPageview("/game/play/popup/photobooth/enter");
this._booth = MovieClip(param1.getChildAt(0));
KeepAlive.startKATimer(this._booth);
this.initializeNeededItems();
this.positionAndDrawAvatarView(true);
this.showHudAvt();
this.loadPetView();
this.addEventListeners();
this._booth.x = MainFrame.VIEW_WIDTH * 0.5;
this._booth.y = MainFrame.VIEW_HEIGHT * 0.5;
DarkenManager.showLoadingSpiral(false);
this._guiLayer.addChild(this._booth);
DarkenManager.darken(this._booth);
}
}
private function initializeNeededItems() : void
{
this._numBackgroundFrames = this._booth.imageCont.backgroundCont.totalFrames;
this._currBackgroundFrame = 1;
this._petPosIndex = -1;
this._booth.imageCont.msgTxt.filters = [new GlowFilter(16777215)];
this._booth.imageCont.petLShadow.visible = false;
this._booth.imageCont.petRShadow.visible = false;
this._booth.posBtn.activateGrayState(true);
this._booth.avtBtn.visible = false;
SafeChatManager.buildSafeChatTree(this._booth.chatTree,"ECardTextTreeNode",SafeChatManager.TREE_PHOTOBOOTH,this.onTextClose,null);
SafeChatManager.closeSafeChat(this._booth.chatTree);
this._booth.imageCont.chatBalloon.visible = false;
this._booth.textBtn.currTxt.text = SafeChatManager.photoBoothNodes[0];
this._booth.imageCont.msgTxt.text = SafeChatManager.photoBoothNodes[0];
this._booth.imageCont.chatBalloon.closeChatBtn.visible = false;
this._booth.bubbleLockToggle.toggleBtn.gotoAndStop("startingOff");
this._booth.bubbleLockToggle.toggleBtn.toggleKnob.gotoAndStop("up");
this._booth.bubbleLockToggle.toggleBtn.toggleBG.gotoAndStop("up");
this._loadingSpiralAvt = new LoadingSpiral(this._booth.imageCont.charBox);
}
private function positionAndDrawAvatarView(param1:Boolean = false) : void
{
var _loc2_:Point = null;
if(param1)
{
if(this._currAvtView)
{
this._startingFrame = this._currAvtView.frame;
if(this._currAvtView.parent)
{
this._booth.imageCont.charBox.removeChild(this._currAvtView);
}
}
this._loadingSpiralAvt.setNewParent(this._booth.imageCont.charBox);
this._loadingSpiralAvt.visible = true;
this._currAvtView = new AvatarEditorView();
this._currAvtView.init(AvatarManager.playerAvatar);
}
_loc2_ = AvatarUtility.getAvatarPhotoOffset(this._currAvtView.avTypeId);
this._currAvtView.x = _loc2_.x;
this._currAvtView.y = _loc2_.y;
this._currAvtView.visible = false;
this._currAvtView.playAnim(LayerAnim.AN_PHOTO,false,LayerAnim.PLAY_LOOP,this.onAvatarLoaded);
this._currAvtView.scaleX = this.IMAGE_WIDTH / 1024;
this._currAvtView.scaleY = this.IMAGE_HEIGHT / 768;
this._booth.imageCont.charBox.addChild(this._currAvtView);
}
private function loadPetView() : void
{
var _loc3_:Object = null;
var _loc1_:Array = PetManager.myPetList;
this._myPet = null;
var _loc2_:int = 0;
while(_loc2_ < _loc1_.length)
{
if(_loc1_[_loc2_].idx == PetManager.myActivePetInvId)
{
_loc3_ = _loc1_[_loc2_];
if(!PetManager.canCurrAvatarUsePet(AvatarManager.playerAvatar.enviroTypeFlag,_loc3_.type))
{
break;
}
this._booth.posBtn.activateGrayState(false);
this._myPet = new GuiPet(_loc3_.idx,_loc3_.lBits,_loc3_.uBits,_loc3_.eBits,_loc3_.type,_loc3_.name,this.onPetLoaded);
break;
}
_loc2_++;
}
if(this._myPet == null)
{
this._booth.posBtn.activateGrayState(true);
while(this._booth.imageCont.itemWindowPet2R.numChildren > 0)
{
this._booth.imageCont.itemWindowPet2R.removeChildAt(0);
}
while(this._booth.imageCont.itemWindowPet1R.numChildren > 0)
{
this._booth.imageCont.itemWindowPet1R.removeChildAt(0);
}
while(this._booth.imageCont.itemWindowPet2L.numChildren > 0)
{
this._booth.imageCont.itemWindowPet2L.removeChildAt(0);
}
while(this._booth.imageCont.itemWindowPet1L.numChildren > 0)
{
this._booth.imageCont.itemWindowPet1L.removeChildAt(0);
}
}
}
private function addEventListeners() : void
{
with(this._booth)
{
addEventListener(MouseEvent.MOUSE_DOWN,onPopup,false,0,true);
bx.addEventListener(MouseEvent.MOUSE_DOWN,onClose,false,0,true);
leftBtn.addEventListener(MouseEvent.MOUSE_DOWN,onLeftRightBtn,false,0,true);
rightBtn.addEventListener(MouseEvent.MOUSE_DOWN,onLeftRightBtn,false,0,true);
actionPose.addEventListener(MouseEvent.MOUSE_DOWN,onActionPoseBtn,false,0,true);
actionPose.addEventListener(MouseEvent.ROLL_OVER,onActionPoseOverHandler,false,0,true);
actionPose.addEventListener(MouseEvent.ROLL_OUT,onOutHandler,false,0,true);
posBtn.addEventListener(MouseEvent.MOUSE_DOWN,onPetPosBtn,false,0,true);
posBtn.addEventListener(MouseEvent.ROLL_OVER,onPetPosOverHandler,false,0,true);
posBtn.addEventListener(MouseEvent.ROLL_OUT,onOutHandler,false,0,true);
addTextBtn.addEventListener(MouseEvent.MOUSE_DOWN,onTextBtn,false,0,true);
camBtn.addEventListener(MouseEvent.MOUSE_DOWN,onSaveBtn,false,0,true);
camBtn.addEventListener(MouseEvent.ROLL_OVER,onSaveOverHandler,false,0,true);
camBtn.addEventListener(MouseEvent.ROLL_OUT,onOutHandler,false,0,true);
char.addEventListener(MouseEvent.MOUSE_DOWN,onCustomize,false,0,true);
char.addEventListener(MouseEvent.ROLL_OVER,charWindowOverHandler,false,0,true);
char.addEventListener(MouseEvent.ROLL_OUT,charWindowOutHandler,false,0,true);
bubbleLockToggle.toggleBtn.addEventListener(MouseEvent.MOUSE_DOWN,onToggleBtn,false,0,true);
bubbleLockToggle.toggleBtn.addEventListener(MouseEvent.MOUSE_OVER,onToggleOver,false,0,true);
bubbleLockToggle.toggleBtn.addEventListener(MouseEvent.MOUSE_OUT,onToggleOut,false,0,true);
}
}
private function removeEventListeners() : void
{
with(this._booth)
{
removeEventListener(MouseEvent.MOUSE_DOWN,onPopup);
bx.removeEventListener(MouseEvent.MOUSE_DOWN,onClose);
leftBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onLeftRightBtn);
rightBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onLeftRightBtn);
actionPose.removeEventListener(MouseEvent.MOUSE_DOWN,onActionPoseBtn);
actionPose.removeEventListener(MouseEvent.ROLL_OVER,onActionPoseOverHandler);
actionPose.removeEventListener(MouseEvent.ROLL_OUT,onOutHandler);
posBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onPetPosBtn);
posBtn.removeEventListener(MouseEvent.ROLL_OVER,onPetPosOverHandler);
posBtn.removeEventListener(MouseEvent.ROLL_OUT,onOutHandler);
addTextBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onTextBtn);
camBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onSaveBtn);
camBtn.removeEventListener(MouseEvent.ROLL_OVER,onSaveOverHandler);
camBtn.removeEventListener(MouseEvent.ROLL_OUT,onOutHandler);
char.removeEventListener(MouseEvent.MOUSE_DOWN,onCustomize);
bubbleLockToggle.toggleBtn.removeEventListener(MouseEvent.MOUSE_DOWN,onToggleBtn);
bubbleLockToggle.toggleBtn.removeEventListener(MouseEvent.MOUSE_OVER,onToggleOver);
bubbleLockToggle.toggleBtn.removeEventListener(MouseEvent.MOUSE_OUT,onToggleOut);
}
}
private function onTextClose(param1:String, param2:String) : void
{
this._booth.textBtn.currTxt.text = param1;
this._booth.imageCont.msgTxt.text = param1;
this.setTextVisibility();
SafeChatManager.closeSafeChat(this._booth.chatTree);
}
private function completeSaveAction() : void
{
DarkenManager.showLoadingSpiral(true,true);
var _loc1_:BitmapData = new BitmapData(1024,768);
var _loc2_:Matrix = new Matrix(1024 / this.IMAGE_WIDTH,0,0,768 / this.IMAGE_HEIGHT,0,0);
_loc1_.draw(this._booth.imageCont,_loc2_,null,null,null,true);
this._jpgEncoder = new JpegAsynchEncoder();
this._jpgEncoder.addEventListener(JPEGAsyncCompleteEvent.JPEGASYNC_COMPLETE,this.asyncEncodingComplete,false,0,true);
this._jpgEncoder.addEventListener(ProgressEvent.PROGRESS,this.onEncodingProgress,false,0,true);
this._jpgEncoder.PixelsPerIteration = 128;
this._jpgEncoder.JPEGAsyncEncoder(100);
this._jpgEncoder.encode(_loc1_);
}
private function showHudAvt() : void
{
var _loc1_:Avatar = AvatarManager.playerAvatar;
if(this._hudAvtView)
{
if(this._hudAvtView.parent == this._booth.char.charLayer)
{
this._booth.char.charLayer.removeChild(this._hudAvtView);
}
this._hudAvtView.destroy();
}
this._hudAvtView = new AvatarView();
this._hudAvtView.init(_loc1_);
this._hudAvtView.playAnim(LayerAnim.AN_HUD_AVT,false,LayerAnim.PLAY_ONE_SHOT);
var _loc2_:Point = AvatarUtility.getAvatarHudPosition(this._hudAvtView.avTypeId);
this._hudAvtView.x = _loc2_.x;
this._hudAvtView.y = _loc2_.y;
this._booth.char.charLayer.addChild(this._hudAvtView);
}
private function setTextVisibility() : void
{
if(this._booth.bubbleLockToggle.toggleBtn.currentFrameLabel == "on" || this._booth.bubbleLockToggle.toggleBtn.currentFrameLabel == "startingOn")
{
this._booth.imageCont.msgTxt.visible = false;
}
else
{
this._booth.imageCont.msgTxt.visible = true;
}
}
private function addPetToCorrectSpot(param1:int, param2:Boolean = false) : void
{
var _loc3_:Matrix = null;
if(param1 > 3)
{
param1 = 0;
}
var _loc4_:int = param1;
if(param2)
{
if(param1 % 2 != 0)
{
_loc4_ = param1 - 1;
}
}
switch(_loc4_)
{
case 0:
while(this._booth.imageCont.itemWindowPet2R.numChildren > 0)
{
this._booth.imageCont.itemWindowPet2R.removeChildAt(0);
}
while(this._booth.imageCont.itemWindowPet1R.numChildren > 0)
{
this._booth.imageCont.itemWindowPet1R.removeChildAt(0);
}
while(this._booth.imageCont.itemWindowPet2L.numChildren > 0)
{
this._booth.imageCont.itemWindowPet2L.removeChildAt(0);
}
while(this._booth.imageCont.itemWindowPet1L.numChildren > 0)
{
this._booth.imageCont.itemWindowPet1L.removeChildAt(0);
}
if(this._myPet.isGround())
{
this._booth.imageCont.itemWindowPet2L.addChild(this._myPet);
}
else
{
this._booth.imageCont.itemWindowPet1L.addChild(this._myPet);
}
if(_loc4_ == param1)
{
break;
}
case 1:
_loc3_ = this._myPet.transform.matrix;
_loc3_.scale(-1,1);
this._myPet.transform.matrix = _loc3_;
break;
case 2:
while(this._booth.imageCont.itemWindowPet2L.numChildren > 0)
{
this._booth.imageCont.itemWindowPet2L.removeChildAt(0);
}
while(this._booth.imageCont.itemWindowPet1L.numChildren > 0)
{
this._booth.imageCont.itemWindowPet1L.removeChildAt(0);
}
while(this._booth.imageCont.itemWindowPet2R.numChildren > 0)
{
this._booth.imageCont.itemWindowPet2R.removeChildAt(0);
}
while(this._booth.imageCont.itemWindowPet1R.numChildren > 0)
{
this._booth.imageCont.itemWindowPet1R.removeChildAt(0);
}
if(this._myPet.isGround())
{
this._booth.imageCont.itemWindowPet2R.addChild(this._myPet);
}
else
{
this._booth.imageCont.itemWindowPet1R.addChild(this._myPet);
}
if(_loc4_ == param1)
{
break;
}
case 3:
_loc3_ = this._myPet.transform.matrix;
_loc3_.scale(-1,1);
this._myPet.transform.matrix = _loc3_;
}
this._petPosIndex = param1;
}
private function loadDebugAvatar(param1:Avatar) : void
{
if(this._currAvtView)
{
this._startingFrame = this._currAvtView.frame;
if(this._currAvtView.parent)
{
this._booth.imageCont.charBox.removeChild(this._currAvtView);
}
}
this._loadingSpiralAvt.setNewParent(this._booth.imageCont.charBox);
this._loadingSpiralAvt.visible = true;
this._currAvtView = new AvatarEditorView();
this._currAvtView.init(param1);
var _loc2_:Point = AvatarUtility.getAvatarPhotoOffset(this._currAvtView.avTypeId);
this._currAvtView.x = _loc2_.x;
this._currAvtView.y = _loc2_.y;
this._currAvtView.visible = false;
this._currAvtView.playAnim(LayerAnim.AN_PHOTO,false,LayerAnim.PLAY_LOOP,this.onAvatarLoaded);
this._currAvtView.scaleX = this.IMAGE_WIDTH / 1024;
this._currAvtView.scaleY = this.IMAGE_HEIGHT / 768;
this._booth.imageCont.charBox.addChild(this._currAvtView);
}
private function onAvatarLoaded(param1:LayerAnim, param2:int) : void
{
var _loc3_:Matrix = null;
this._currAvtView.visible = true;
this._currAvtView.pauseAnim(true);
this._currAvtView.frame = this._startingFrame;
this._loadingSpiralAvt.visible = false;
if(this._flip)
{
_loc3_ = this._currAvtView.transform.matrix;
_loc3_.scale(-1,1);
this._currAvtView.transform.matrix = _loc3_;
}
else if(this._booth.imageCont.avtShadow.scaleX < 0)
{
this._booth.imageCont.avtShadow.scaleX *= -1;
}
}
private function onPetLoaded(param1:MovieClip, param2:GuiPet) : void
{
var _loc3_:Matrix = null;
this._myPet.scaleX = this._myPet.scaleY = 2;
if(this._petPosIndex < 2)
{
_loc3_ = this._myPet.transform.matrix;
_loc3_.scale(-1,1);
this._myPet.transform.matrix = _loc3_;
}
this.addPetToCorrectSpot(this._petPosIndex == -1 ? 0 : this._petPosIndex,true);
}
private function onAvatarEditorClose() : void
{
this.positionAndDrawAvatarView(true);
this.showHudAvt();
this.loadPetView();
}
private function flashComplete() : void
{
this.completeSaveAction();
}
private function onSaveImage(param1:Object) : void
{
if(param1.status)
{
SBTracker.trackPageview("/game/play/popup/photobooth/imageSaved");
DarkenManager.showLoadingSpiral(true);
AvatarXtCommManager.sendAvatarPhotoTake(this.onPhotoGemsSpent);
++_nameSaveIndex;
}
}
private function onPhotoGemsSpent(param1:Object) : void
{
gMainFrame.clientInfo.gemCount = int(param1[2]);
DarkenManager.showLoadingSpiral(false);
AJAudio.playShopCachingSound();
}
private function onSaveForGems(param1:Object) : void
{
SBTracker.trackPageview("/game/play/popup/photobooth/saveForGems");
if(param1.status)
{
DarkenManager.showLoadingSpiral(true);
AvatarXtCommManager.sendAvatarPhotoTakeCheck(this.onGemsSpent);
}
}
private function onGemsSpent(param1:Object) : void
{
DarkenManager.showLoadingSpiral(false);
if(param1[2] >= 0)
{
this._booth.flash.playFlash(this.flashComplete);
}
else
{
new SBOkPopup(this._guiLayer,LocalizationManager.translateIdOnly(14788));
}
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
if(this._closeCallback != null)
{
this._closeCallback();
this._closeCallback = null;
}
else
{
this.destroy();
}
}
private function onLeftRightBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
KeepAlive.inputReceivedHandler(null);
SBTracker.trackPageview("/game/play/popup/photobooth/leftRight");
if(param1.currentTarget.name == "leftBtn")
{
if(this._currBackgroundFrame - 1 < 1)
{
this._currBackgroundFrame = this._numBackgroundFrames;
}
else
{
--this._currBackgroundFrame;
}
}
else if(param1.currentTarget.name == "rightBtn")
{
if(this._currBackgroundFrame + 1 > this._numBackgroundFrames)
{
this._currBackgroundFrame = 1;
}
else
{
++this._currBackgroundFrame;
}
}
if(this._booth.imageCont.backgroundCont.currentLabels[this._currBackgroundFrame - 1].name.indexOf("ocean") >= 0)
{
if(!Utility.isOcean(AvatarManager.playerAvatar.enviroTypeFlag))
{
this.onLeftRightBtn(param1);
return;
}
}
else if(!Utility.isLand(AvatarManager.playerAvatar.enviroTypeFlag))
{
this.onLeftRightBtn(param1);
return;
}
this._booth.imageCont.backgroundCont.gotoAndStop(this._currBackgroundFrame);
}
private function onActionPoseBtn(param1:MouseEvent) : void
{
var _loc2_:Matrix = null;
param1.stopPropagation();
KeepAlive.inputReceivedHandler(null);
SBTracker.trackPageview("/game/play/popup/photobooth/poseBtn");
if(this._currAvtView)
{
_loc2_ = this._currAvtView.transform.matrix;
_loc2_.scale(-1,1);
this._currAvtView.transform.matrix = _loc2_;
this._flip = !this._flip;
this._booth.imageCont.avtShadow.scaleX *= -1;
}
}
private function onActionPoseOverHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.toolTip.init(this._guiLayer,LocalizationManager.translateIdOnly(14675),param1.currentTarget.x + param1.currentTarget.parent.x,param1.currentTarget.y + param1.currentTarget.parent.y - 27);
GuiManager.toolTip.startTimer(param1);
}
private function onPetPosBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
KeepAlive.inputReceivedHandler(null);
SBTracker.trackPageview("/game/play/popup/photobooth/petPose");
if(this._myPet)
{
this.addPetToCorrectSpot(this._petPosIndex + 1);
}
}
private function onPetPosOverHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(!param1.currentTarget.isGray)
{
GuiManager.toolTip.init(this._guiLayer,LocalizationManager.translateIdOnly(14676),param1.currentTarget.x + param1.currentTarget.parent.x,param1.currentTarget.y + param1.currentTarget.parent.y - 27);
GuiManager.toolTip.startTimer(param1);
}
}
private function onTextBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
if(!this._booth.chatTree.visible)
{
SafeChatManager.openSafeChat(false,this._booth.chatTree);
}
else
{
SafeChatManager.closeSafeChat(this._booth.chatTree);
}
}
private function onSaveBtn(param1:MouseEvent) : void
{
SBTracker.trackPageview("/game/play/popup/photobooth/save");
param1.stopPropagation();
KeepAlive.inputReceivedHandler(null);
new SBYesNoPopup(this._guiLayer,LocalizationManager.translateIdAndInsertOnly(14789,50),true,this.onSaveForGems);
}
private function onSaveOverHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.toolTip.init(this._guiLayer,LocalizationManager.translateIdOnly(14677),param1.currentTarget.x + param1.currentTarget.parent.x,param1.currentTarget.y + param1.currentTarget.parent.y - 41);
GuiManager.toolTip.startTimer(param1);
}
private function onOutHandler(param1:MouseEvent) : void
{
GuiManager.toolTip.resetTimerAndSetVisibility();
}
private function onEncodingProgress(param1:ProgressEvent) : void
{
DarkenManager.updateLoadingSpiralPercentage(Math.round(param1.bytesLoaded / param1.bytesTotal * 100) + "%");
}
private function asyncEncodingComplete(param1:JPEGAsyncCompleteEvent) : void
{
this._jpgEncoder.removeEventListener(JPEGAsyncCompleteEvent.JPEGASYNC_COMPLETE,this.asyncEncodingComplete);
this._jpgEncoder.removeEventListener(ProgressEvent.PROGRESS,this.onEncodingProgress);
DarkenManager.showLoadingSpiral(false);
new SBYesNoPopup(this._guiLayer,LocalizationManager.translateIdOnly(14790),true,this.onSaveImage,{
"FileReference":true,
"ImageData":this._jpgEncoder.ImageData,
"SaveName":"AnimalJam_" + _nameSaveIndex + ".jpg"
});
}
private function onCustomize(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.openAvatarEditor(this.onAvatarEditorClose);
GuiManager.toolTip.resetTimerAndSetVisibility();
}
private function charWindowOverHandler(param1:MouseEvent) : void
{
GuiManager.toolTip.init(this._guiLayer,LocalizationManager.translateIdOnly(14673),param1.currentTarget.x + param1.currentTarget.parent.x,param1.currentTarget.y + param1.currentTarget.parent.y - 55);
GuiManager.toolTip.startTimer(param1);
param1.currentTarget.gotoAndStop("over");
AJAudio.playHudBtnRollover();
}
private function charWindowOutHandler(param1:MouseEvent) : void
{
GuiManager.toolTip.resetTimerAndSetVisibility();
param1.currentTarget.gotoAndStop("up");
}
private function onChatBalloonOver(param1:MouseEvent) : void
{
param1.stopPropagation();
this._booth.imageCont.chatBalloon.closeChatBtn.visible = true;
}
private function onChatBalloonOut(param1:MouseEvent) : void
{
param1.stopPropagation();
this._booth.imageCont.chatBalloon.closeChatBtn.visible = false;
}
private function onCloseBalloon(param1:MouseEvent) : void
{
param1.stopPropagation();
this._booth.imageCont.chatBalloon.visible = false;
}
private function onToggleBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
SBTracker.trackPageview("/game/play/popup/photobooth/toggleText");
if(param1.currentTarget.currentFrameLabel == "on" || param1.currentTarget.currentFrameLabel == "startingOn")
{
param1.currentTarget.gotoAndPlay("off");
this._booth.imageCont.msgTxt.visible = true;
}
else
{
param1.currentTarget.gotoAndPlay("on");
this._booth.imageCont.msgTxt.visible = false;
}
}
private function onToggleOver(param1:MouseEvent) : void
{
param1.stopPropagation();
if(param1.currentTarget.toggleBG.currentFrameLabel != "over")
{
param1.currentTarget.toggleBG.gotoAndStop("over");
}
if(param1.currentTarget.toggleKnob.currentFrameLabel != "over")
{
param1.currentTarget.toggleKnob.gotoAndStop("over");
}
}
private function onToggleOut(param1:MouseEvent) : void
{
param1.stopPropagation();
if(param1.currentTarget.toggleBG.currentFrameLabel != "up")
{
param1.currentTarget.toggleBG.gotoAndStop("up");
}
if(param1.currentTarget.toggleKnob.currentFrameLabel != "up")
{
param1.currentTarget.toggleKnob.gotoAndStop("up");
}
}
private function onAvtDebugLoadBtn(param1:MouseEvent) : void
{
var _loc4_:Avatar = null;
param1.stopPropagation();
if(this._loadingSpiralAvt.visible)
{
return;
}
++this._debugAvtIndex;
var _loc2_:Array = AvatarSwitch.avatars;
if(this._debugAvtIndex >= AvatarUtility.numAvatarTypes)
{
this._debugAvtIndex = 0;
}
var _loc3_:int = AvatarUtility.getAvatarTypeByIndex(this._debugAvtIndex);
var _loc5_:int = 0;
while(_loc5_ < _loc2_.length)
{
if(_loc2_[_loc5_].avTypeId == _loc3_)
{
_loc4_ = _loc2_[_loc5_];
break;
}
_loc5_++;
}
if(_loc4_ == null)
{
_loc4_ = AvatarUtility.getAvatarByIndex(this._debugAvtIndex);
}
if(!Utility.isLand(_loc4_.enviroTypeFlag))
{
this.onAvtDebugLoadBtn(param1);
return;
}
this.loadDebugAvatar(_loc4_);
}
}
}
@@ -0,0 +1,152 @@
package gui
{
import com.sbi.analytics.SBTracker;
import den.DenXtCommManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
import room.RoomManagerWorld;
import room.RoomXtCommManager;
public class PlayerEngagement
{
private var _engagementMediaHelper:MediaHelper;
private var _closeCallBack:Function;
private var _engagementPopup:MovieClip;
private var _currShardId:int;
public function PlayerEngagement()
{
super();
}
public function init(param1:Function) : void
{
this._currShardId = RoomManagerWorld.instance.shardId;
this._engagementMediaHelper = new MediaHelper();
this._engagementMediaHelper.init(1567,this.onEngagementLoaded);
this._closeCallBack = param1;
}
public function destroy(param1:Boolean = false) : void
{
this.removeEventListeners();
DarkenManager.unDarken(this._engagementPopup);
GuiManager.guiLayer.removeChild(this._engagementPopup);
this._engagementPopup = null;
if(this._closeCallBack != null)
{
this._closeCallBack(param1);
this._closeCallBack = null;
}
}
private function onEngagementLoaded(param1:MovieClip) : void
{
this._engagementMediaHelper.destroy();
this._engagementPopup = MovieClip(param1.getChildAt(0));
this._engagementPopup.x = MainFrame.VIEW_WIDTH * 0.5;
this._engagementPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
GuiManager.guiLayer.addChild(this._engagementPopup);
this._engagementPopup.gotoAndStop("new");
DarkenManager.showLoadingSpiral(false);
DarkenManager.darken(this._engagementPopup);
this.addEventListeners();
}
private function onDenBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
DarkenManager.showLoadingSpiral(true);
SBTracker.trackPageview("/game/play/popup/playerEngagement/#den",-1,SBTracker.TYPE_EVENT);
DenXtCommManager.requestDenJoinFull("den" + gMainFrame.userInfo.myUserName);
this.destroy();
}
private function onVideoBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
DarkenManager.showLoadingSpiral(true);
SBTracker.trackPageview("/game/play/popup/playerEngagement/#video",-1,SBTracker.TYPE_EVENT);
RoomXtCommManager.sendNonDenRoomJoinRequest("sarepia.movie_theater#" + this._currShardId);
this.destroy();
}
private function onShoppingBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
DarkenManager.showLoadingSpiral(true);
SBTracker.trackPageview("/game/play/popup/playerEngagement/#shopping",-1,SBTracker.TYPE_EVENT);
RoomXtCommManager.sendNonDenRoomJoinRequest("jamaa_township.clothes_shop#" + this._currShardId);
this.destroy();
}
private function onGamesBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
DarkenManager.showLoadingSpiral(true);
SBTracker.trackPageview("/game/play/popup/playerEngagement/#games",-1,SBTracker.TYPE_EVENT);
RoomXtCommManager.sendNonDenRoomJoinRequest("jamaa_township.room_arcade#" + this._currShardId);
this.destroy();
}
private function onAdventureBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
SBTracker.trackPageview("/game/play/popup/playerEngagement/#adventure",-1,SBTracker.TYPE_EVENT);
RoomXtCommManager.sendNonDenRoomJoinRequest("adventures.queststaging_0_360#" + RoomManagerWorld.instance.shardId);
this.destroy();
}
private function onCloseBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
SBTracker.trackPageview("/game/play/popup/playerEngagement/#close",-1,SBTracker.TYPE_EVENT);
this.destroy();
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function addEventListeners() : void
{
this._engagementPopup.denBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onDenBtn,false,0,true);
if(this._engagementPopup.videoBtn)
{
this._engagementPopup.videoBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onVideoBtn,false,0,true);
}
if(this._engagementPopup.shoppingBtn)
{
this._engagementPopup.shoppingBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onShoppingBtn,false,0,true);
}
this._engagementPopup.gamesBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onGamesBtn,false,0,true);
this._engagementPopup.advBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onAdventureBtn,false,0,true);
this._engagementPopup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onCloseBtn,false,0,true);
this._engagementPopup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
}
private function removeEventListeners() : void
{
this._engagementPopup.denBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onDenBtn);
if(this._engagementPopup.videoBtn)
{
this._engagementPopup.videoBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onVideoBtn);
}
if(this._engagementPopup.shoppingBtn)
{
this._engagementPopup.shoppingBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onShoppingBtn);
}
this._engagementPopup.gamesBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onGamesBtn);
this._engagementPopup.advBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onAdventureBtn);
this._engagementPopup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onCloseBtn);
this._engagementPopup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
}
}
}
@@ -0,0 +1,202 @@
package gui
{
import avatar.AvatarXtCommManager;
import avatar.UserInfo;
import buddy.Buddy;
import com.sbi.client.SFClient;
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import loader.MediaHelper;
import localization.LocalizationManager;
public class PlayerSearch
{
public static const SEARCH_MEDIA_ID:int = 396;
public static const LOADING_SPIRAL_ID:int = 397;
private var _searchPopup:MovieClip;
private var _searchMediaHelper:MediaHelper;
private var _lastSearchedName:String;
public function PlayerSearch()
{
super();
}
public function init() : void
{
this._searchMediaHelper = new MediaHelper();
this._searchMediaHelper.init(SEARCH_MEDIA_ID,this.searchMediaCallback,true);
}
public function destroy() : void
{
this.removeListeners();
this._searchMediaHelper.destroy();
GuiManager.guiLayer.removeChild(this._searchPopup);
DarkenManager.unDarken(this._searchPopup);
this._searchPopup = null;
}
private function searchMediaCallback(param1:MovieClip) : void
{
this._searchPopup = MovieClip(param1.getChildAt(0));
this._searchPopup.x = MainFrame.VIEW_WIDTH * 0.5;
this._searchPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
GuiManager.guiLayer.addChild(this._searchPopup);
this.addListeners();
this.setInitialConditions();
DarkenManager.showLoadingSpiral(false);
DarkenManager.darken(this._searchPopup);
this._searchMediaHelper = new MediaHelper();
this._searchMediaHelper.init(LOADING_SPIRAL_ID,this.loadingSpiralCallback,true);
}
private function loadingSpiralCallback(param1:MovieClip) : void
{
if(this._searchPopup)
{
this._searchPopup.itemBlock.addChild(param1);
this._searchPopup.itemBlock.visible = false;
}
}
private function setInitialConditions() : void
{
this._searchPopup.userNameTxt.text = "";
this._searchPopup.userNameTxt.restrict = "A-Za-z0-9";
this._searchPopup.userNameTxt.maxChars = 32;
gMainFrame.stage.focus = this._searchPopup.userNameTxt;
this._searchPopup.notFoundTab.visible = false;
}
private function popupCloseHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
this.destroy();
}
private function onSearchBtnHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
this.performSearch();
}
private function keyDownListener(param1:KeyboardEvent) : void
{
param1.stopPropagation();
if(param1.keyCode == 13)
{
this.performSearch();
}
}
private function performSearch() : void
{
var _loc3_:Buddy = null;
this._searchPopup.notFoundTab.visible = true;
LocalizationManager.translateId(this._searchPopup.notFoundTab.getChildAt(1),11369);
var _loc1_:String = this._searchPopup.userNameTxt.text;
if(gMainFrame.userInfo.myUserName.toLowerCase() == _loc1_.toLowerCase())
{
LocalizationManager.translateId(this._searchPopup.notFoundTab.getChildAt(1),11370);
gMainFrame.stage.focus = this._searchPopup.userNameTxt;
return;
}
var _loc2_:String = _loc1_.toLowerCase();
if(this._lastSearchedName != _loc2_)
{
this._lastSearchedName = _loc2_;
_loc3_ = BuddyManager.getBuddyByUserName(_loc2_);
if(_loc3_)
{
this._searchPopup.notFoundTab.visible = false;
BuddyCard.showBuddyCard({
"userName":_loc3_.userName,
"onlineStatus":_loc3_.onlineStatus
});
this.destroy();
}
else
{
this._searchPopup.notFoundTab.visible = false;
this._searchPopup.itemBlock.visible = true;
AvatarXtCommManager.requestAvatarGet(_loc1_,this.onUserLookUpReceived,true);
}
}
}
private function onUserLookUpReceived(param1:String, param2:Boolean, param3:int) : void
{
var _loc4_:UserInfo = null;
if(this._searchPopup)
{
this._searchPopup.itemBlock.visible = false;
_loc4_ = gMainFrame.userInfo.getUserInfoByUserName(param1);
if(param2)
{
if(_loc4_)
{
if(_loc4_.userNameModeratedFlag > 0 && param1.toLowerCase() == this._searchPopup.userNameTxt.text.toLowerCase())
{
BuddyCard.showBuddyCard({
"userName":param1,
"onlineStatus":param3
});
this.destroy();
}
else
{
this._searchPopup.notFoundTab.visible = true;
gMainFrame.stage.focus = this._searchPopup.userNameTxt;
}
}
else
{
BuddyCard.showBuddyCard({
"userName":param1,
"onlineStatus":param3
});
this.destroy();
}
}
else if(param3 == SFClient.STATUS_DIFFERENT_VERSION)
{
this.destroy();
}
else
{
this._searchPopup.notFoundTab.visible = true;
gMainFrame.stage.focus = this._searchPopup.userNameTxt;
}
}
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function addListeners() : void
{
this._searchPopup["bx"].addEventListener(MouseEvent.MOUSE_DOWN,this.popupCloseHandler,false,0,true);
this._searchPopup.searchBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onSearchBtnHandler,false,0,true);
this._searchPopup.userNameTxt.addEventListener(KeyboardEvent.KEY_DOWN,this.keyDownListener,false,0,true);
this._searchPopup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
}
private function removeListeners() : void
{
this._searchPopup["bx"].removeEventListener(MouseEvent.MOUSE_DOWN,this.popupCloseHandler);
this._searchPopup.searchBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onSearchBtnHandler);
this._searchPopup.userNameTxt.removeEventListener(KeyboardEvent.KEY_DOWN,this.keyDownListener);
this._searchPopup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
}
}
}
@@ -0,0 +1,253 @@
package gui
{
import achievement.AchievementXtCommManager;
import com.sbi.analytics.SBTracker;
import com.sbi.popup.SBPollPopup;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
import loader.PollDefHelper;
import localization.LocalizationManager;
public class PollManager
{
private static var _pollDefCache:Array;
private static var _pollLocs:Array;
private static var _pollDefHelpers:Array;
private static var _pollParams:Array;
private static var _tabMediaHelper:MediaHelper;
private static var _tabTemplate:MovieClip;
private static var _dataToSetupPolls:Object;
private static var _guiLayer:DisplayLayer;
private static var _worldLayer:DisplayLayer;
private static var _pollPopup:SBPollPopup;
private static var _nonTabPollCloseCallback:Function;
private static const POLL_MEDIA_ID_TAB:int = 153;
private static const POLL_TAB_FRAME_LABEL:String = "poll";
private static const POLL_IMAGE_TAB_FRAME_LABEL:String = "tshirtPoll";
private static const POLL_COUNT_USERVAR:int = 113;
public function PollManager()
{
super();
}
public static function init(param1:DisplayLayer, param2:DisplayLayer) : void
{
_guiLayer = param1;
_worldLayer = param2;
_pollDefCache = [];
}
public static function setUpPolls(param1:Array, param2:Array, param3:Array) : void
{
var _loc4_:int = 0;
var _loc5_:Object = null;
var _loc6_:PollDefHelper = null;
_pollLocs = param2;
_pollParams = param3;
_pollDefHelpers = [];
if(_tabTemplate == null)
{
_dataToSetupPolls = {
"pollDefIds":param1,
"pollLocs":param2,
"pollParams":param3
};
_tabMediaHelper = new MediaHelper();
_tabMediaHelper.init(POLL_MEDIA_ID_TAB,mediaHelperHandler,true);
}
else
{
_loc4_ = 0;
while(_loc4_ < param1.length)
{
_loc5_ = _pollDefCache[param1[_loc4_]];
if(!_loc5_)
{
_loc6_ = new PollDefHelper();
_loc6_.init(param1[_loc4_],onPollDefReceived);
_pollDefHelpers[param1[_loc4_]] = _loc6_;
}
else
{
setUpPoll(_loc5_);
}
_loc4_++;
}
}
}
public static function setupNonTabPoll(param1:int, param2:Function = null) : void
{
var _loc4_:PollDefHelper = null;
DarkenManager.showLoadingSpiral(true);
_pollDefHelpers = [];
var _loc3_:Object = _pollDefCache[param1];
_nonTabPollCloseCallback = param2;
if(!_loc3_)
{
_loc4_ = new PollDefHelper();
_loc4_.init(param1,onNonTabPollDefReceived);
_pollDefHelpers[param1] = _loc4_;
}
else if(_pollDefHelpers[param1] == null)
{
setupNonTabPollPopup(_loc3_);
}
}
private static function onPollDefReceived(param1:PollDefHelper) : void
{
setUpPoll(onDefReceivedSetup(param1));
}
private static function onNonTabPollDefReceived(param1:PollDefHelper) : void
{
setupNonTabPollPopup(onDefReceivedSetup(param1));
}
private static function onDefReceivedSetup(param1:PollDefHelper) : Object
{
var _loc2_:Object = param1.def;
var _loc3_:Object = {
"id":int(_loc2_.id),
"mediaId":int(_loc2_.mediaRef),
"userVarId":int(_loc2_.userVarRef),
"poll":LocalizationManager.translateIdOnly(int(_loc2_.pollStrRef)),
"title":LocalizationManager.translateIdOnly(int(_loc2_.titleStrRef))
};
_pollDefCache[_loc3_.id] = _loc3_;
_pollDefHelpers[_loc3_.id] = null;
return _loc3_;
}
private static function setUpPoll(param1:Object) : void
{
var _loc2_:MovieClip = null;
var _loc3_:int = 0;
if(gMainFrame.userInfo.userVarCache.getUserVarValueById(int(param1.userVarId)) < 0)
{
if(_tabTemplate)
{
_loc2_ = new _tabTemplate.constructor();
_loc2_.def = param1;
_loc3_ = int(_loc2_.id = int(param1.id));
_loc2_.x = _pollLocs[_loc3_].x;
_loc2_.y = _pollLocs[_loc3_].y;
if(param1.id == 27)
{
_loc2_.gotoAndPlay(POLL_IMAGE_TAB_FRAME_LABEL);
}
else
{
_loc2_.gotoAndPlay(POLL_TAB_FRAME_LABEL);
}
_loc2_.addEventListener(MouseEvent.MOUSE_DOWN,onTabMouseDown,false,0,true);
_worldLayer.addChild(_loc2_);
}
}
}
private static function setupNonTabPollPopup(param1:Object) : void
{
var _loc2_:MovieClip = null;
if(_pollPopup == null)
{
DarkenManager.showLoadingSpiral(true);
_loc2_ = new MovieClip();
_loc2_.def = param1;
_loc2_.id = param1.id;
_pollPopup = new SBPollPopup();
_pollPopup.init(_guiLayer,_loc2_,SBPollPopup.POLL_POPUP_WOOD_MEDIA_ID,onPollVote,onPollDone,true);
}
}
private static function mediaHelperHandler(param1:MovieClip) : void
{
var _loc2_:int = int(param1.mediaHelper.id);
_tabTemplate = MovieClip(param1.getChildAt(0));
_tabMediaHelper.destroy();
_tabMediaHelper = null;
if(_dataToSetupPolls != null)
{
setUpPolls(_dataToSetupPolls.pollDefIds,_dataToSetupPolls.pollLocs,_dataToSetupPolls.pollParams);
_dataToSetupPolls = null;
}
}
private static function onTabMouseDown(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:MovieClip = MovieClip(param1.currentTarget);
if(param1.currentTarget.currentFrameLabel == POLL_IMAGE_TAB_FRAME_LABEL)
{
ImagePoll.displayPoll(_loc2_.def.userVarId,_pollParams[_loc2_.id],ImagePoll.POLL_MEDIA_ID,ImagePoll.TSHIRT_IMAGES_MEDIA_ID,10,3,_loc2_,onImagePollClose);
}
else
{
DarkenManager.showLoadingSpiral(true);
_pollPopup = new SBPollPopup();
_pollPopup.init(_guiLayer,_loc2_,SBPollPopup.POLL_POPUP_MEDIA_ID,onPollVote,onPollDone,true);
}
}
private static function onImagePollClose(param1:MovieClip) : void
{
if(param1.parent)
{
param1.parent.removeChild(param1);
}
param1.removeEventListener(MouseEvent.MOUSE_DOWN,onTabMouseDown);
}
private static function onPollVote(param1:MovieClip, param2:int) : void
{
if(param1.parent)
{
param1.parent.removeChild(param1);
}
param1.removeEventListener(MouseEvent.MOUSE_DOWN,onTabMouseDown);
if(param1.def.userVarId != 0)
{
AchievementXtCommManager.requestSetUserVar(param1.def.userVarId,_pollParams[param1.id]);
AchievementXtCommManager.requestSetUserVar(POLL_COUNT_USERVAR,1);
}
if(gMainFrame.server.isWorldZone)
{
SBTracker.trackPageview("/game/play/poll/#" + param1.def.id + "/#0/#" + param2);
}
else
{
SBTracker.trackPageview("/login/poll/#" + param1.def.id + "/#0/#" + param2,0);
}
}
private static function onPollDone() : void
{
_pollPopup.destroy();
_pollPopup = null;
if(_nonTabPollCloseCallback != null)
{
_nonTabPollCloseCallback();
_nonTabPollCloseCallback = null;
}
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,55 @@
package gui
{
public class PredictiveTextNode
{
public var char:String;
public var children:Vector.<PredictiveTextNode> = new Vector.<PredictiveTextNode>();
public var weight:int;
public var isSpecialCharacter:Boolean;
public var useType:int;
public var isSpecialLangChar:Boolean;
public function PredictiveTextNode(param1:String, param2:int, param3:Vector.<PredictiveTextNode>, param4:Boolean = false, param5:int = 0, param6:Boolean = false)
{
super();
this.char = param1;
this.weight = param2;
this.children = param3;
this.isSpecialCharacter = param4;
this.useType = param5;
this.isSpecialLangChar = param6;
}
public function destroy() : void
{
this.children = null;
}
public function contains(param1:String) : int
{
var _loc2_:int = 0;
var _loc3_:int = 0;
if(this.children != null)
{
_loc2_ = int(this.children.length);
_loc3_ = 0;
while(_loc3_ < _loc2_)
{
if(this.children[_loc3_].char == param1)
{
return _loc3_;
}
_loc3_++;
}
}
return -1;
}
}
}
@@ -0,0 +1,790 @@
package gui
{
import flash.utils.Dictionary;
public class PredictiveTextTree
{
private static var _defaultRoot:PredictiveTextNode;
private static var _lastKnowWordNode:PredictiveTextNode;
private static var _weightOfWord:int;
private static var _useType:int;
private static var _specialCharsRegEx:RegExp;
private static var _specialCharsMap:Dictionary;
private static var _optimizationString:String = "";
private static var _savedChildren:Vector.<PredictiveTextNode> = new Vector.<PredictiveTextNode>();
private var _root:PredictiveTextNode;
private var _currSearchNode:PredictiveTextNode;
private var _nodeCount:int = 0;
private var _nodeCountAfter:int = 0;
private var _numWordsPrinted:int = 0;
private var _charSearchIndex:int = 0;
private var _similarWordsIndex:int = 0;
private var _useType:int;
private var _isLastNode:Boolean;
private var _hasCompletedCheckingMyself:Boolean;
private var _searchChildren:Vector.<Object> = new Vector.<Object>();
private var _similarWords:Vector.<Object> = new Vector.<Object>();
public function PredictiveTextTree(param1:PredictiveTextNode, param2:int)
{
super();
this._root = param1;
this._currSearchNode = this._root;
this._useType = param2;
}
public static function init() : void
{
_defaultRoot = new PredictiveTextNode("",0,new Vector.<PredictiveTextNode>());
}
public static function setupSpecialCharsRegEx(param1:String) : void
{
_specialCharsRegEx = new RegExp("[" + param1 + "]","ig");
}
public static function setupConversionChars(param1:String) : void
{
var _loc3_:Array = null;
var _loc2_:Array = param1.split(",");
_specialCharsMap = new Dictionary();
var _loc4_:int = 0;
while(_loc4_ < _loc2_.length)
{
_loc3_ = _loc2_[_loc4_].split("|");
_specialCharsMap[_loc3_[0]] = _loc3_[1];
_loc4_++;
}
}
public static function addFromStart(param1:Array) : void
{
_weightOfWord = param1[1];
_useType = param1[2] == "" ? PredictiveTextManager.USE_TYPE_ALL : int(param1[2]);
add(param1[0].split(""),0,_defaultRoot);
}
public static function get defaultRoot() : PredictiveTextNode
{
return _defaultRoot;
}
public static function optimizeTree(param1:PredictiveTextNode) : void
{
var _loc2_:int = 0;
var _loc3_:int = 0;
var _loc4_:int = 0;
var _loc5_:Boolean = false;
var _loc6_:Boolean = false;
if(param1.children)
{
_loc2_ = int(param1.children.length);
_loc3_ = 0;
while(_loc3_ < _loc2_)
{
optimizeTree(param1.children[_loc3_]);
if(param1.weight > 0 || param1 == _defaultRoot || _loc2_ > 1)
{
if(_lastKnowWordNode)
{
_lastKnowWordNode.children = _savedChildren;
_lastKnowWordNode.weight = Math.max(1,_lastKnowWordNode.weight);
_lastKnowWordNode.char = reverseString(_optimizationString);
_lastKnowWordNode = null;
_savedChildren = null;
_optimizationString = "";
}
}
else if(_lastKnowWordNode)
{
_loc4_ = _lastKnowWordNode.weight;
_loc5_ = _lastKnowWordNode.isSpecialLangChar;
_loc6_ = _lastKnowWordNode.isSpecialCharacter;
_lastKnowWordNode = param1;
_lastKnowWordNode.weight = _loc4_;
_optimizationString += param1.char;
if(_loc5_)
{
_lastKnowWordNode.isSpecialLangChar = _loc5_;
}
if(_loc6_)
{
_lastKnowWordNode.isSpecialCharacter = _loc6_;
}
}
_loc3_++;
}
if(param1.weight > 0)
{
if(_lastKnowWordNode == null || param1.weight > _lastKnowWordNode.weight)
{
_savedChildren = param1.children;
_lastKnowWordNode = param1;
_optimizationString += param1.char;
if(!_lastKnowWordNode.isSpecialLangChar)
{
_lastKnowWordNode.isSpecialLangChar = param1.isSpecialLangChar;
}
if(!_lastKnowWordNode.isSpecialCharacter)
{
_lastKnowWordNode.isSpecialCharacter = param1.isSpecialCharacter;
}
}
}
}
}
private static function add(param1:Array, param2:int, param3:PredictiveTextNode) : void
{
var _loc4_:int = 0;
if(param2 == param1.length)
{
param3.weight = Math.max(1,_weightOfWord);
param3.useType = _useType;
}
else
{
_loc4_ = param3.contains(param1[param2]);
if(_loc4_ != -1)
{
add(param1,param2 + 1,param3.children[_loc4_]);
}
else
{
param3.children.push(new PredictiveTextNode(param1[param2],0,new Vector.<PredictiveTextNode>(),false,_useType,isSpecialLangCharacter(param1[param2])));
add(param1,param2 + 1,param3.children[param3.children.length - 1]);
}
}
}
private static function reverseString(param1:String) : String
{
var _loc2_:String = "";
var _loc3_:* = int(param1.length - 1);
while(_loc3_ >= 0)
{
_loc2_ += param1.charAt(_loc3_);
_loc3_--;
}
return _loc2_;
}
private static function isSpecialLangCharacter(param1:String) : Boolean
{
if(_specialCharsRegEx)
{
return param1.match(_specialCharsRegEx).length > 0;
}
return false;
}
public function destroy() : void
{
if(_lastKnowWordNode)
{
_lastKnowWordNode.destroy();
_lastKnowWordNode = null;
}
this._searchChildren = null;
this._similarWords = null;
_savedChildren = null;
}
public function updateRoot(param1:PredictiveTextNode) : void
{
this._root = param1;
this.clearWordSuggestions();
this.resetSearchTree();
}
public function containsString(param1:String) : int
{
var _loc2_:int = 0;
_loc2_ = this.checkMyself(param1);
if(_loc2_ > 0)
{
return _loc2_;
}
if(_loc2_ == -1)
{
return 0;
}
_loc2_ = this.checkMyChildren(param1);
if(_loc2_ > 0)
{
return _loc2_;
}
return 0;
}
public function checkCurrentWordValidity() : int
{
var _loc2_:Object = null;
var _loc1_:int = 0;
if(this._searchChildren.length > 0)
{
_loc2_ = this._searchChildren[this._searchChildren.length - 1];
if(_loc2_.node)
{
if(this._currSearchNode)
{
if(this._currSearchNode.isSpecialCharacter)
{
_loc1_ = 3;
}
else if(this._currSearchNode.char.length > 1)
{
if(this._charSearchIndex == _loc2_.node.char.length)
{
if(_loc2_.node.useType > PredictiveTextManager.USE_TYPE_ALL && this._useType == _loc2_.node.useType)
{
_loc1_ = this._currSearchNode.weight > 0 || this._currSearchNode.children.length > 0 ? 1 : 0;
}
else
{
_loc1_ = this._currSearchNode.weight > 0 ? 2 : 1;
}
}
else
{
_loc1_ = 1;
}
}
else if(this._currSearchNode.char.charAt(this._charSearchIndex) == _loc2_.node.char)
{
if(_loc2_.node.useType > PredictiveTextManager.USE_TYPE_ALL && this._useType == _loc2_.node.useType)
{
_loc1_ = this._currSearchNode.weight > 0 || this._currSearchNode.children.length > 0 ? 1 : 0;
}
else
{
_loc1_ = this._currSearchNode.weight > 0 ? 2 : 1;
}
}
else
{
_loc1_ = 1;
}
}
}
else
{
_loc1_ = 2;
}
}
return _loc1_;
}
public function showTopWord() : String
{
this.clearWordSuggestions();
this.findAllSimilarWords();
this._similarWords.sort(this.compare);
return this._similarWords.length > 0 ? this._similarWords[0].word : null;
}
public function resetSearchTree() : void
{
this._searchChildren = new Vector.<Object>();
this._currSearchNode = this._root;
}
public function clearWordSuggestions() : void
{
this._similarWords.splice(0,this._similarWords.length);
this._similarWordsIndex = 0;
}
public function backspaced() : void
{
var _loc1_:Object = null;
if(this._searchChildren.length > 0)
{
this._searchChildren.pop();
if(this._searchChildren.length == 0)
{
this._currSearchNode = this._root;
this._charSearchIndex = 0;
this._hasCompletedCheckingMyself = false;
}
else
{
_loc1_ = this._searchChildren[this._searchChildren.length - 1];
this._currSearchNode = _loc1_.node == null ? this._root : _loc1_.node;
this._charSearchIndex = _loc1_.wordIndex;
this._hasCompletedCheckingMyself = this._charSearchIndex > this._currSearchNode.char.length;
}
}
this.clearWordSuggestions();
}
public function onSpecialCharacter() : void
{
var _loc1_:PredictiveTextNode = new PredictiveTextNode(this._currSearchNode.char,this._currSearchNode.weight,this._currSearchNode.children,true);
this._searchChildren.push({
"node":_loc1_,
"wordIndex":0
});
this._hasCompletedCheckingMyself = false;
}
public function onSpacebar() : void
{
this._searchChildren.push({
"node":null,
"wordIndex":0
});
this._currSearchNode = this._root;
this._charSearchIndex = 0;
this._hasCompletedCheckingMyself = false;
}
public function get nodeCount() : Number
{
return this._nodeCount;
}
public function get nodeCountAfter() : Number
{
return this._nodeCountAfter;
}
public function get theRoot() : PredictiveTextNode
{
return this._root;
}
public function get numWords() : Number
{
return this._numWordsPrinted;
}
public function get currentRestriction() : String
{
var _loc2_:int = 0;
var _loc3_:String = null;
var _loc4_:Vector.<PredictiveTextNode> = null;
var _loc1_:String = "";
if(this._currSearchNode)
{
_loc2_ = 0;
while(_loc2_ < this._currSearchNode.char.length)
{
_loc3_ = this._currSearchNode.char.charAt(_loc2_);
if(_loc3_ == "-")
{
_loc1_ += "|\\-";
}
else
{
if(Boolean(_specialCharsMap) && Boolean(_specialCharsMap[_loc3_]))
{
_loc1_ += "|" + _specialCharsMap[_loc3_];
}
_loc1_ += "|" + _loc3_;
}
_loc2_++;
}
_loc4_ = this._currSearchNode.children;
_loc2_ = 0;
while(_loc2_ < _loc4_.length)
{
_loc3_ = _loc4_[_loc2_].char.charAt(0);
if(_loc3_ == "-")
{
_loc1_ += "|\\-";
}
else
{
if(Boolean(_specialCharsMap) && Boolean(_specialCharsMap[_loc3_]))
{
_loc1_ += "|" + _specialCharsMap[_loc3_];
}
_loc1_ += "|" + _loc3_;
}
_loc2_++;
}
}
return _loc1_;
}
private function checkMyself(param1:String) : int
{
if(this._currSearchNode)
{
if(this._currSearchNode.isSpecialCharacter)
{
return -1;
}
if(this._currSearchNode.char.length > 1 && !this._hasCompletedCheckingMyself)
{
if(this._currSearchNode.char.charAt(this._charSearchIndex) == param1)
{
++this._charSearchIndex;
if(this._charSearchIndex == this._currSearchNode.char.length)
{
this._searchChildren.push({
"node":this._currSearchNode,
"wordIndex":this._charSearchIndex
});
this._charSearchIndex = 0;
this._hasCompletedCheckingMyself = true;
if(this._currSearchNode.useType > PredictiveTextManager.USE_TYPE_ALL && this._useType == this._currSearchNode.useType)
{
return this._currSearchNode.weight > 0 || this._currSearchNode.children.length > 0 ? 1 : 0;
}
return this._currSearchNode.weight > 0 ? 2 : 1;
}
this._searchChildren.push({
"node":this._currSearchNode,
"wordIndex":this._charSearchIndex
});
if(this._currSearchNode.useType > PredictiveTextManager.USE_TYPE_ALL && this._useType == this._currSearchNode.useType)
{
return 0;
}
return 1;
}
this._searchChildren.push({
"node":this._currSearchNode,
"wordIndex":this._charSearchIndex
});
return -1;
}
return 0;
}
return 0;
}
private function checkMyChildren(param1:String) : int
{
var _loc2_:int = 0;
var _loc3_:int = 0;
var _loc4_:PredictiveTextNode = null;
if(this._currSearchNode)
{
_loc2_ = int(this._currSearchNode.children.length);
_loc3_ = 0;
while(_loc3_ < _loc2_)
{
this._hasCompletedCheckingMyself = false;
_loc4_ = this._currSearchNode.children[_loc3_];
if(_loc4_.isSpecialCharacter)
{
return 0;
}
if(_loc4_.char == param1)
{
this._searchChildren.push({
"node":_loc4_,
"wordIndex":0
});
this._currSearchNode = _loc4_;
if(_loc4_.useType > PredictiveTextManager.USE_TYPE_ALL && this._useType == _loc4_.useType)
{
return this._currSearchNode.weight > 0 || _loc4_.children.length > 0 ? 1 : 0;
}
return this._currSearchNode.weight > 0 ? 2 : 1;
}
if(_loc4_.char.length > 1)
{
if(_loc4_.char.charAt(this._charSearchIndex) == param1)
{
++this._charSearchIndex;
if(this._charSearchIndex == _loc4_.char.length)
{
this._searchChildren.push({
"node":_loc4_,
"wordIndex":this._charSearchIndex
});
this._currSearchNode = _loc4_;
this._charSearchIndex = 0;
}
else
{
this._searchChildren.push({
"node":_loc4_,
"wordIndex":this._charSearchIndex
});
this._currSearchNode = _loc4_;
}
if(_loc4_.useType > PredictiveTextManager.USE_TYPE_ALL && this._useType == _loc4_.useType)
{
return (this._currSearchNode.weight > 0 || _loc4_.children.length > 0) && this._charSearchIndex == 0 ? 1 : 0;
}
return this._currSearchNode.weight > 0 && this._charSearchIndex == 0 ? 2 : 1;
}
}
_loc3_++;
}
}
this._searchChildren.push({
"node":this._currSearchNode,
"wordIndex":this._charSearchIndex
});
return 0;
}
private function findAllSimilarWords(param1:PredictiveTextNode = null, param2:String = "", param3:PredictiveTextNode = null) : Vector.<Object>
{
var _loc5_:int = 0;
var _loc6_:int = 0;
var _loc4_:PredictiveTextNode = param1 != null ? param1 : this._currSearchNode;
if(_loc4_ == this._root)
{
return this._similarWords;
}
if(param3 == null)
{
param3 = this._currSearchNode;
}
if(_loc4_)
{
_loc5_ = int(this._searchChildren[this._searchChildren.length - 1].wordIndex);
if(_loc4_ == this._currSearchNode && this._currSearchNode.char.length > 1 && this._currSearchNode.weight > 0 && _loc5_ < this._currSearchNode.char.length)
{
if(!(_loc4_.useType > PredictiveTextManager.USE_TYPE_ALL && this._useType == _loc4_.useType))
{
this._similarWords.push({
"word":this.appendCompletionString(""),
"weight":this._currSearchNode.weight,
"index":_loc5_
});
++this._similarWordsIndex;
}
}
_loc6_ = 0;
while(_loc6_ < _loc4_.children.length)
{
if(_loc4_ != param3)
{
param2 += _loc4_.char;
param3 = _loc4_;
}
if(this._similarWords.length <= this._similarWordsIndex)
{
if(!(_loc4_.children[_loc6_].useType > PredictiveTextManager.USE_TYPE_ALL && this._useType == _loc4_.children[_loc6_].useType))
{
this._similarWords.push({
"word":param2,
"weight":_loc4_.children[_loc6_].weight
});
this._similarWords[this._similarWordsIndex].word += _loc4_.children[_loc6_].char;
this._similarWords[this._similarWordsIndex].weight = _loc4_.children[_loc6_].weight;
}
}
else
{
this._similarWords[this._similarWordsIndex].word += _loc4_.children[_loc6_].char;
this._similarWords[this._similarWordsIndex].weight = _loc4_.children[_loc6_].weight;
}
if(_loc4_.children[_loc6_].weight > 0 && this._similarWords.length > this._similarWordsIndex)
{
this._similarWords[this._similarWordsIndex].word = this.appendCompletionString(this._similarWords[this._similarWordsIndex].word);
this._similarWords[this._similarWordsIndex].weight = _loc4_.children[_loc6_].weight;
if(_loc4_ != this._currSearchNode)
{
return this._similarWords;
}
++this._similarWordsIndex;
}
else
{
this.findAllSimilarWords(_loc4_.children[_loc6_],param2);
++this._similarWordsIndex;
}
_loc6_++;
}
if(param1 == null && _loc4_.children.length == 0)
{
if(!(_loc4_.useType > PredictiveTextManager.USE_TYPE_ALL && this._useType == _loc4_.useType))
{
this._similarWords.push({
"word":this.appendCompletionString(""),
"weight":_loc4_.weight
});
}
}
--this._similarWordsIndex;
}
return this._similarWords;
}
public function findAllLanguageSpecialChars(param1:String) : Array
{
var _loc3_:int = 0;
var _loc4_:PredictiveTextNode = null;
var _loc5_:String = null;
var _loc2_:Array = [];
if(this._searchChildren.length > 0)
{
if(this._searchChildren.length == 1 || this._searchChildren[this._searchChildren.length - 2].node == null)
{
_loc4_ = this.theRoot;
}
else
{
_loc4_ = this._searchChildren[this._searchChildren.length - 2].node;
}
if(_loc4_.char.length > 1 && _loc4_.isSpecialLangChar)
{
_loc3_ = 0;
while(_loc3_ < _loc4_.char.length)
{
_loc5_ = _loc4_.char.charAt(_loc3_);
if(_specialCharsMap[_loc5_] == param1)
{
_loc2_.push(_loc4_.char.charAt(_loc3_));
}
_loc3_++;
}
}
_loc3_ = 0;
while(_loc3_ < _loc4_.children.length)
{
if(_loc4_.children[_loc3_].isSpecialLangChar)
{
_loc5_ = _loc4_.children[_loc3_].char.charAt(0);
if(_specialCharsMap[_loc5_] == param1)
{
_loc2_.push(_loc4_.children[_loc3_].char.charAt(0));
}
}
_loc3_++;
}
}
return _loc2_;
}
private function compare(param1:Object, param2:Object) : int
{
if(param1.weight > param2.weight)
{
return -1;
}
if(param1.weight < param2.weight)
{
return 1;
}
return 0;
}
private function appendCompletionString(param1:String) : String
{
var _loc3_:PredictiveTextNode = null;
var _loc4_:* = 0;
var _loc2_:String = "";
if(this._searchChildren)
{
_loc4_ = int(this._searchChildren.length - 1);
for(; _loc4_ >= 0; _loc4_--)
{
if(!(Boolean(this._searchChildren[_loc4_].node) && !this._searchChildren[_loc4_].node.isSpecialCharacter))
{
break;
}
if(_loc3_)
{
if(_loc3_ == this._searchChildren[_loc4_].node)
{
continue;
}
if(this._searchChildren[_loc4_].node.char.length > 1)
{
_loc2_ += reverseString(this._searchChildren[_loc4_].node.char);
}
else
{
_loc2_ += this._searchChildren[_loc4_].node.char;
}
_loc3_ = this._searchChildren[_loc4_].node;
}
else
{
if(this._searchChildren[_loc4_].node.char.length > 1)
{
_loc2_ += reverseString(this._searchChildren[_loc4_].node.char);
}
else
{
_loc2_ += this._searchChildren[_loc4_].node.char;
}
_loc3_ = this._searchChildren[_loc4_].node;
}
}
}
return reverseString(_loc2_) + param1;
}
private function countNodes(param1:PredictiveTextNode) : void
{
++this._nodeCount;
var _loc2_:int = 0;
while(_loc2_ < param1.children.length)
{
this.countNodes(param1.children[_loc2_]);
_loc2_++;
}
}
private function countNodesAfter(param1:PredictiveTextNode) : void
{
++this._nodeCountAfter;
var _loc2_:int = 0;
while(_loc2_ < param1.children.length)
{
this.countNodesAfter(param1.children[_loc2_]);
_loc2_++;
}
}
private function drawTree(param1:PredictiveTextNode, param2:String) : void
{
var _loc4_:int = 0;
var _loc3_:int = 0;
if(param1.children)
{
_loc4_ = 0;
while(_loc4_ < param1.children.length)
{
if(_loc3_ == _loc4_)
{
param2 += param1.char;
}
_loc3_ = _loc4_;
this.drawTree(param1.children[_loc4_],param2);
_loc4_++;
}
if(param1.children.length == 0)
{
param2 += param1.char;
}
if(param1.weight > 0)
{
++this._numWordsPrinted;
}
}
}
}
}
@@ -0,0 +1,248 @@
package gui
{
import avatar.AvatarManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
import quest.QuestXtCommManager;
public class PrivateAdventureJoin
{
private const MEDIA_ID:int = 2300;
private var _mediaHelper:MediaHelper;
private var _popup:MovieClip;
private var _guiLayer:DisplayLayer;
private var _closeCallback:Function;
private var _savedParams:Array;
private var _inParamsWaiting:Object;
private var _waitingAvatarWindows:WindowGenerator;
private var _windowScrollbar:SBScrollbar;
private var _scriptDefId:int;
public function PrivateAdventureJoin()
{
super();
}
public function init(param1:int, param2:Function) : void
{
if(GuiManager.chatHist)
{
GuiManager.chatHist.removeEmotesFromChatRepeat();
}
this._savedParams = [];
this._guiLayer = GuiManager.guiLayer;
this._closeCallback = param2;
this._scriptDefId = param1;
DarkenManager.showLoadingSpiral(true);
this._mediaHelper = new MediaHelper();
this._mediaHelper.init(this.MEDIA_ID,this.onMediaLoaded);
}
public function destroy() : void
{
GuiManager.grayOutHudItemsForPrivateLobby(false);
GuiManager.mainHud.emotesBtn.activateGrayState(false);
this.removeEventListeners();
this._mediaHelper.destroy();
this._mediaHelper = null;
this._guiLayer.removeChild(this._popup);
}
public function handleWaitResponse(param1:Object) : void
{
var _loc2_:Array = null;
if(this._popup)
{
if(this._waitingAvatarWindows)
{
this._waitingAvatarWindows.destroy();
this._waitingAvatarWindows = null;
}
_loc2_ = param1.slice(2);
this._waitingAvatarWindows = new WindowGenerator();
this._waitingAvatarWindows.init(1,4,_loc2_.length,0,0,0,ItemWindowCustPlayers,param1.slice(2),"",{
"mouseDown":this.onWindowDown,
"mouseOver":this.onWindowOver,
"mouseOut":this.onWindowOut,
"memberOnlyMouseDown":null
},{
"onBxBtn":this.onKickPlayerBtn,
"scriptDefId":this._scriptDefId
},this.onWindowLoaded,false,false);
}
else
{
this._inParamsWaiting = param1;
}
}
public function updateDisplayIndex(param1:Boolean = true) : void
{
var _loc2_:int = GuiManager.guiLayer.getChildIndex(GuiManager.mainHud);
var _loc3_:int = this._popup.parent.getChildIndex(this._popup);
if(param1)
{
if(_loc2_ < _loc3_)
{
this._popup.parent.setChildIndex(this._popup,_loc2_);
}
}
else if(_loc2_ > _loc3_)
{
this._popup.parent.setChildIndex(this._popup,_loc2_);
}
}
private function onMediaLoaded(param1:MovieClip) : void
{
if(param1)
{
GuiManager.mainHud.emotesBtn.activateGrayState(true);
DarkenManager.showLoadingSpiral(false);
this._popup = MovieClip(param1.getChildAt(0));
this.addEventListeners();
this._popup.x = this._popup.width * 0.5;
this._popup.y = MainFrame.VIEW_HEIGHT * 0.5 - 20;
this._guiLayer.addChild(this._popup);
GuiManager.closeAnyHudPopups();
if(this._inParamsWaiting != null)
{
this.handleWaitResponse(this._inParamsWaiting);
this._inParamsWaiting = null;
}
else
{
this._waitingAvatarWindows = new WindowGenerator();
this._waitingAvatarWindows.init(1,4,1,0,0,0,ItemWindowCustPlayers,[AvatarManager.playerSfsUserId],"",{
"mouseDown":this.onWindowDown,
"mouseOver":this.onWindowOver,
"mouseOut":this.onWindowOut,
"memberOnlyMouseDown":null
},{"onBxBtn":this.onKickPlayerBtn},this.onWindowLoaded,false,false);
}
}
}
private function onWindowLoaded() : void
{
if(this._popup.playerWindow.numChildren > 0)
{
this._popup.playerWindow.removeChildAt(0);
}
this._popup.playerWindow.addChild(this._waitingAvatarWindows);
if(this._windowScrollbar)
{
this._windowScrollbar.destroy();
this._windowScrollbar = null;
}
this._windowScrollbar = new SBScrollbar();
this._windowScrollbar.init(this._waitingAvatarWindows,this._waitingAvatarWindows.width,this._waitingAvatarWindows.boxHeight * 4 + 0 * 4 + 0 * 2,10,"scrollbar2",this._waitingAvatarWindows.boxHeight + 0);
}
private function close() : void
{
if(this._closeCallback != null)
{
this._closeCallback(false);
this._closeCallback = null;
}
else
{
this.destroy();
}
}
private function onWindowDown(param1:MouseEvent) : void
{
var _loc2_:Object = null;
param1.stopPropagation();
if(param1.currentTarget.userName != gMainFrame.userInfo.myUserName)
{
_loc2_ = {
"userName":param1.currentTarget.userName,
"onlineStatus":true
};
BuddyCard.showBuddyCard(_loc2_);
}
}
private function onWindowOver(param1:MouseEvent) : void
{
param1.stopPropagation();
if(param1.currentTarget.userName != gMainFrame.userInfo.myUserName)
{
param1.currentTarget.char.gotoAndStop("over");
param1.currentTarget.showXBtn(true);
}
}
private function onWindowOut(param1:MouseEvent) : void
{
param1.stopPropagation();
param1.currentTarget.char.gotoAndStop("up");
if(param1.currentTarget.userName != gMainFrame.userInfo.myUserName)
{
param1.currentTarget.showXBtn(false);
}
}
private function onKickPlayerBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
QuestXtCommManager.sendQuestPrivateKick(param1.currentTarget.parent.parent.userName);
}
private function onPopup(param1:MouseEvent) : void
{
param1.stopPropagation();
}
private function onPopupOver(param1:MouseEvent) : void
{
param1.stopPropagation();
this.updateDisplayIndex(false);
}
private function onCloseBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
QuestXtCommManager.sendQuestJoinCancel();
this.close();
}
private function onPlayBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
QuestXtCommManager.sendQuestStartRequest();
this.close();
}
private function addEventListeners() : void
{
this._popup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
this._popup.bx.addEventListener(MouseEvent.MOUSE_DOWN,this.onCloseBtn,false,0,true);
this._popup.playBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onPlayBtn,false,0,true);
this._popup.addEventListener(MouseEvent.MOUSE_OVER,this.onPopupOver,false,0,true);
}
private function removeEventListeners() : void
{
this._popup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
this._popup.bx.removeEventListener(MouseEvent.MOUSE_DOWN,this.onCloseBtn);
this._popup.playBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPlayBtn);
this._popup.removeEventListener(MouseEvent.MOUSE_OVER,this.onPopupOver);
}
}
}
@@ -0,0 +1,591 @@
package gui
{
import avatar.AvatarManager;
import com.sbi.popup.SBPopup;
import den.DenItem;
import den.DenXtCommManager;
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import item.ItemXtCommManager;
import localization.LocalizationManager;
public class RecycleItems
{
private static const RECYCLE_TUT_LIST_ID:int = 52;
public static const RECYCLE_ACCESSORIES:int = 0;
public static const RECYCLE_DEN_ITEMS:int = 1;
public static const RECYCLE_DEN_AUDIO:int = 2;
public static const RECYCLE_DEN_ITEMS_OCEAN_ONLY:int = 3;
public static const RECYCLE_DEN_ITEMS_LAND_ONLY:int = 4;
public static const RECYCLE_ACCESSORIES_OCEAN_ONLY:int = 5;
public static const RECYCLE_ACCESSORIES_LAND_ONLY:int = 6;
private static var _accessoriesScrollValue:Number = 0;
private static var _accessoriesOceanOnlyScrollValue:Number = 0;
private static var _accessoriesLandOnlyScrollValue:Number = 0;
private static var _denScrollValue:Number = 0;
private static var _denOceanOnlyScrollValue:Number = 0;
private static var _denLandOnlyScrollValue:Number = 0;
private static var _denAudioScrollValue:Number = 0;
private static var _scrollValue:Number = 0;
private var _recycle:MovieClip;
private var _recycleSmall:MovieClip;
private var _itemRecycleId:int;
private var _savedTradeIdx:int;
private var _recyclePopup:SBPopup;
private var _recyclePopupSmall:SBPopup;
private var _closeCallback:Function;
private var _onRecycleSuccessCallback:Function;
private var _recycleInventory:Array;
private var _scrollButtons:MovieClip;
private var _itemWindows:WindowGenerator;
private var _popupLayer:DisplayObjectContainer;
private var _idx:int;
private var _height:int;
private var _recycleOneItem:Boolean;
private var _hasRecycled:Boolean;
private var _isInCurrEnviro:Boolean;
private var _tempMC:Object;
private var _spirals:Array;
public function RecycleItems()
{
super();
}
private static function onInfoBtnOut(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.toolTip.resetTimerAndSetVisibility();
}
public function init(param1:int, param2:DisplayObjectContainer, param3:Boolean = false, param4:Function = null, param5:int = 450, param6:int = 250, param7:Boolean = false) : void
{
this._recycle = GETDEFINITIONBYNAME("RecyclePopupContent");
this._recycleSmall = GETDEFINITIONBYNAME("RecycleSmlPopupContent");
this._recycleSmall.itemBlock.gift.visible = false;
this._recycleSmall.itemBlock.addBtn.visible = false;
this._recycleSmall.itemBlock.removeBtn.visible = false;
this._recycleSmall.itemBlock.avtSpecificIcon.visible = false;
this._recycleSmall.itemBlock.avtSpecific.visible = false;
this._recycleSmall.itemBlock.avtSpecificHighlight.visible = false;
this._recycleSmall.itemBlock.rareDiamondTag.visible = false;
this._recycleSmall.itemBlock.diamond.visible = false;
this._itemRecycleId = param1;
this._popupLayer = param2;
this._recycleOneItem = param3;
this._isInCurrEnviro = param7;
this._recyclePopup = new SBPopup(param2,GETDEFINITIONBYNAME("RecyclePopupSkin"),this._recycle,true,true,false,false,true);
this._recyclePopupSmall = new SBPopup(param2,GETDEFINITIONBYNAME("RecycleSmlPopupSkin"),this._recycleSmall,false,true,false,false,true);
this._closeCallback = param4;
this._recyclePopup.x = param5;
this._recyclePopup.y = param6;
this._recyclePopup.bxClosesPopup = false;
this._height = this._recycle.itemBlock.height;
this._spirals = [];
this.addListeners();
AJAudio.playItemRecycledSound();
if(this._itemRecycleId == RECYCLE_DEN_ITEMS || this._itemRecycleId == RECYCLE_DEN_ITEMS_OCEAN_ONLY || this._itemRecycleId == RECYCLE_DEN_ITEMS_LAND_ONLY)
{
if(gMainFrame.userInfo.playerUserInfo.denItemsFull.length <= 0)
{
DenXtCommManager.requestDenItems(this.fillInventory);
}
}
this.fillInventory();
}
public function destroy() : void
{
var _loc1_:int = 0;
this.removeListeners();
if(this._recyclePopup)
{
this._recyclePopup.destroy();
this._recyclePopup = null;
}
if(this._recyclePopupSmall)
{
this._recyclePopupSmall.destroy();
this._recyclePopupSmall = null;
}
if(this._scrollButtons)
{
_scrollValue = this._scrollButtons.scrollYValue;
switch(this._itemRecycleId)
{
case RECYCLE_ACCESSORIES:
_accessoriesScrollValue = _scrollValue;
break;
case RECYCLE_ACCESSORIES_LAND_ONLY:
_accessoriesLandOnlyScrollValue = _scrollValue;
break;
case RECYCLE_ACCESSORIES_OCEAN_ONLY:
_accessoriesOceanOnlyScrollValue = _scrollValue;
break;
case RECYCLE_DEN_ITEMS:
_denScrollValue = _scrollValue;
break;
case RECYCLE_DEN_ITEMS_LAND_ONLY:
_denLandOnlyScrollValue = _scrollValue;
break;
case RECYCLE_DEN_ITEMS_OCEAN_ONLY:
_denOceanOnlyScrollValue = _scrollValue;
break;
case RECYCLE_DEN_AUDIO:
_denAudioScrollValue = _scrollValue;
}
this._scrollButtons.destroy();
this._scrollButtons = null;
}
if(this._itemWindows)
{
this._itemWindows.destroy();
this._itemWindows = null;
}
if(Boolean(this._spirals) && this._spirals.length > 0)
{
_loc1_ = 0;
while(_loc1_ < this._spirals.length)
{
this._spirals[_loc1_].destroy();
_loc1_++;
}
}
this._spirals = null;
this._hasRecycled = false;
this._tempMC = null;
this._closeCallback = null;
}
public function hasBeenInited() : Boolean
{
return this._recyclePopup != null;
}
private function fillInventory(param1:Boolean = false) : void
{
var _loc2_:Array = null;
var _loc3_:int = 0;
var _loc4_:int = 0;
if(!param1)
{
this._recycleInventory = [];
if(this._itemRecycleId == RECYCLE_ACCESSORIES)
{
this._recycleInventory = gMainFrame.userInfo.playerAvatarInfo.getFullItems();
_scrollValue = _accessoriesScrollValue;
}
else if(this._itemRecycleId == RECYCLE_ACCESSORIES_LAND_ONLY || this._itemRecycleId == RECYCLE_ACCESSORIES_OCEAN_ONLY)
{
_loc2_ = gMainFrame.userInfo.playerAvatarInfo.getFullItems();
if(this._itemRecycleId == RECYCLE_ACCESSORIES_LAND_ONLY)
{
_loc3_ = 0;
while(_loc3_ < _loc2_.length)
{
if(_loc2_[_loc3_].enviroType == SbiConstants.ENVIRO_LAND)
{
this._recycleInventory.push(_loc2_[_loc3_]);
}
_loc3_++;
}
_scrollValue = _accessoriesLandOnlyScrollValue;
}
else
{
_loc3_ = 0;
while(_loc3_ < _loc2_.length)
{
if(_loc2_[_loc3_].enviroType == SbiConstants.ENVIRO_OCEAN)
{
this._recycleInventory.push(_loc2_[_loc3_]);
}
_loc3_++;
}
_scrollValue = _accessoriesOceanOnlyScrollValue;
}
}
else
{
_loc2_ = gMainFrame.userInfo.playerUserInfo.denItemsFull;
if(this._itemRecycleId == RECYCLE_DEN_ITEMS_LAND_ONLY || this._itemRecycleId == RECYCLE_DEN_ITEMS_OCEAN_ONLY)
{
if(this._isInCurrEnviro)
{
_loc2_ = Utility.denItemListByEnviroType(_loc2_,AvatarManager.roomEnviroType);
}
}
this._recycleInventory = new Array();
_loc3_ = 0;
while(_loc3_ < _loc2_.length)
{
if(this._itemRecycleId == RECYCLE_DEN_AUDIO)
{
if(_loc2_[_loc3_].sortId == DenItem.SORT_AUDIO && _loc2_[_loc3_].itemDefId != DenItem.DEF_AUDIO_DEF_ID)
{
this._recycleInventory[_loc4_] = _loc2_[_loc3_].clone();
_loc4_++;
}
}
else if(_loc2_[_loc3_].sortId != DenItem.SORT_AUDIO)
{
if(this._itemRecycleId == RECYCLE_DEN_ITEMS || this._isInCurrEnviro)
{
this._recycleInventory[_loc4_] = _loc2_[_loc3_].clone();
_loc4_++;
}
else if(this._itemRecycleId == RECYCLE_DEN_ITEMS_LAND_ONLY && _loc2_[_loc3_].enviroType == SbiConstants.ENVIRO_LAND)
{
this._recycleInventory[_loc4_] = _loc2_[_loc3_].clone();
_loc4_++;
}
else if(_loc2_[_loc3_].enviroType == SbiConstants.ENVIRO_OCEAN)
{
this._recycleInventory[_loc4_] = _loc2_[_loc3_].clone();
_loc4_++;
}
}
_loc3_++;
}
if(this._itemRecycleId == RECYCLE_DEN_AUDIO)
{
_scrollValue = _denAudioScrollValue;
}
else if(this._itemRecycleId == RECYCLE_DEN_ITEMS)
{
_scrollValue = _denScrollValue;
}
else if(this._itemRecycleId == RECYCLE_DEN_ITEMS_LAND_ONLY)
{
_scrollValue = _denLandOnlyScrollValue;
}
else if(this._itemRecycleId == RECYCLE_DEN_ITEMS_OCEAN_ONLY)
{
_scrollValue = _denOceanOnlyScrollValue;
}
}
}
this.createWindows();
}
private function createWindows() : void
{
if(this._scrollButtons)
{
_scrollValue = this._scrollButtons.scrollYValue;
this._scrollButtons.destroy();
this._scrollButtons = null;
}
if(Boolean(this._itemWindows) && this._itemWindows.numChildren > 0)
{
while(this._itemWindows.bg.numChildren)
{
this._itemWindows.bg.removeChildAt(0);
}
}
if(this._itemWindows)
{
this._itemWindows.destroy();
this._itemWindows = null;
}
while(this._recycle.itemBlock.numChildren)
{
this._recycle.itemBlock.removeChildAt(0);
}
this._itemWindows = new WindowGenerator();
this._itemWindows.init(3,4,Math.max(this._recycleInventory.length,12),2,2,0,ItemWindowOriginal,this._recycleInventory,"icon",{
"mouseDown":this.onItemWindowDown,
"mouseOver":this.onItemRollOver,
"mouseOut":this.onItemRollOut
},{"isRecycling":true},null,false,false);
this._recycle.itemBlock.addChild(this._itemWindows);
this._scrollButtons = new SBScrollbar();
this._scrollButtons.init(this._itemWindows,this._itemWindows.width,84 * 4 + 2 * 4,5,"scrollbar2",this._itemWindows.boxHeight + 2,_scrollValue);
}
private function attemptToRecycleItem(param1:int) : void
{
var _loc2_:Object = this._recycleInventory[this._idx];
this._recycleSmall.itemBlock.iconLayer.addChild(this._tempMC.icon);
this._recycleSmall.itemBlock.ocean.visible = _loc2_.isOcean;
this._recycleSmall.itemBlock.avtSpecific.visible = false;
if(_loc2_.isRareDiamond)
{
this._recycleSmall.itemBlock.rareDiamondTag.visible = true;
}
else
{
this._recycleSmall.itemBlock.rare.visible = _loc2_.isRare;
this._recycleSmall.itemBlock.diamond.visible = _loc2_.isDiamond;
}
LocalizationManager.translateIdAndInsert(this._recycleSmall.bodyTxt,11371,Utility.convertNumberToString(_loc2_.recycleValue));
this._recyclePopupSmall.open();
}
private function sendRecycleRequest(param1:Boolean) : void
{
var _loc2_:int = 0;
var _loc3_:Object = null;
var _loc4_:Array = null;
var _loc5_:int = 0;
if(param1)
{
DarkenManager.showLoadingSpiral(true);
_loc2_ = int(this._recycleInventory[this._idx].invIdx);
_loc3_ = this._recycleInventory[this._idx];
_loc4_ = gMainFrame.userInfo.getMyTradeList();
this._savedTradeIdx = -1;
_loc5_ = 0;
while(_loc5_ < _loc4_.length)
{
if(_loc4_[_loc5_].type == this._itemRecycleId && _loc4_[_loc5_].invIdx == _loc2_)
{
this._savedTradeIdx = _loc5_;
break;
}
_loc5_++;
}
if(this._itemRecycleId == RECYCLE_ACCESSORIES || this._itemRecycleId == RECYCLE_ACCESSORIES_LAND_ONLY || this._itemRecycleId == RECYCLE_ACCESSORIES_OCEAN_ONLY)
{
ItemXtCommManager.requestItemRecycle(_loc2_,this.confirmRecycle,this.onRecycleListCallback);
}
else
{
DenXtCommManager.requestRecycle(true,_loc2_,this.confirmRecycle,this.onRecycleListCallback);
}
}
}
private function confirmRecycle(param1:Boolean) : void
{
if(param1)
{
if(this._tempMC.icon.parent)
{
this._tempMC.icon.parent.removeChild(this._tempMC.icon);
}
if(this._savedTradeIdx != -1)
{
gMainFrame.userInfo.removeFromMyTradeList(this._savedTradeIdx);
if(this._itemRecycleId == RECYCLE_ACCESSORIES || this._itemRecycleId == RECYCLE_ACCESSORIES_LAND_ONLY || this._itemRecycleId == RECYCLE_ACCESSORIES_OCEAN_ONLY)
{
TradeManager.adjustByOnNumClothingItemsInMyTradeList(-1);
}
else if(this._itemRecycleId == RECYCLE_DEN_ITEMS || this._itemRecycleId == RECYCLE_DEN_AUDIO || this._itemRecycleId == RECYCLE_DEN_ITEMS_LAND_ONLY || this._itemRecycleId == RECYCLE_DEN_ITEMS_OCEAN_ONLY)
{
TradeManager.adjustByOnNumDenItemsInMyTradeList(-1);
}
}
}
this._savedTradeIdx = -1;
}
private function onRecycleListCallback() : void
{
DarkenManager.showLoadingSpiral(false);
this._recycleInventory.splice(this._idx,1);
this._hasRecycled = true;
if(this._onRecycleSuccessCallback != null)
{
this._onRecycleSuccessCallback();
}
if(this._recycleOneItem)
{
this.applyAndClose(true);
}
else
{
_scrollValue = this._scrollButtons.scrollYValue;
this.fillInventory(true);
}
}
public function setOnRecycleSuccessCallback(param1:Function) : void
{
this._onRecycleSuccessCallback = param1;
}
private function applyAndClose(param1:Boolean = false) : void
{
ItemXtCommManager.recycleIlCallback = null;
DenXtCommManager.recycleDiCallback = null;
if(this._closeCallback != null)
{
this._closeCallback(param1);
}
else
{
this.destroy();
}
}
private function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
this.applyAndClose(this._hasRecycled);
}
private function onItemWindowDown(param1:MouseEvent) : void
{
param1.stopPropagation();
this._idx = param1.currentTarget.index;
this._tempMC = this._recycleInventory[this._idx].clone();
if(this._recycleInventory[this._idx].isMemberOnly)
{
if(!gMainFrame.userInfo.isMember)
{
this._recycleSmall.itemBlock.lockOpen.visible = false;
this._recycleSmall.itemBlock.lock.visible = true;
}
else
{
this._recycleSmall.itemBlock.lockOpen.visible = true;
this._recycleSmall.itemBlock.lock.visible = false;
}
this._recycleSmall.itemBlock.gray.visible = false;
}
else
{
this._recycleSmall.itemBlock.lock.visible = false;
this._recycleSmall.itemBlock.lockOpen.visible = false;
this._recycleSmall.itemBlock.gray.visible = false;
}
if(!this._recycleInventory[this._idx].isRare)
{
this._recycleSmall.itemBlock.rare.visible = false;
}
this.attemptToRecycleItem(this._recycleInventory[this._idx].value);
}
private function onItemRollOver(param1:MouseEvent) : void
{
if(param1)
{
param1.stopPropagation();
}
if(param1.currentTarget.cir.currentFrameLabel == "down")
{
param1.currentTarget.cir.gotoAndStop("downMouse");
}
else if(param1.currentTarget.cir.currentFrameLabel != "downMouse")
{
param1.currentTarget.cir.gotoAndStop("over");
}
AJAudio.playSubMenuBtnRollover();
}
private function onItemRollOut(param1:MouseEvent) : void
{
if(param1)
{
param1.stopPropagation();
}
if(param1.currentTarget.cir.currentFrameLabel == "downMouse")
{
param1.currentTarget.cir.gotoAndStop("down");
}
else if(param1.currentTarget.cir.currentFrameLabel != "down")
{
param1.currentTarget.cir.gotoAndStop("up");
}
}
private function onOkBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
this._recyclePopupSmall.close();
this.sendRecycleRequest(true);
}
private function onNoBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
this._recycleSmall.itemBlock.iconLayer.removeChild(this._tempMC.icon);
this._recyclePopupSmall.close();
}
private function onInfoBtnDown(param1:MouseEvent) : void
{
param1.stopPropagation();
GenericListGuiManager.genericListVolumeClicked(RECYCLE_TUT_LIST_ID);
}
private function onInfoBtnOver(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.toolTip.init(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14678),param1.currentTarget.x + this._recyclePopup.x,param1.currentTarget.y + this._recyclePopup.y + param1.currentTarget.height);
GuiManager.toolTip.startTimer(param1);
}
private function addListeners() : void
{
if(this._recyclePopup)
{
this._recyclePopup.skin.s["bx"].addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
}
if(this._recyclePopupSmall)
{
this._recyclePopupSmall.skin.s["bx"].addEventListener(MouseEvent.MOUSE_DOWN,this.onNoBtn,false,0,true);
}
this._recyclePopup.skin.s["infoBtn"].addEventListener(MouseEvent.MOUSE_DOWN,this.onInfoBtnDown,false,0,true);
this._recyclePopup.skin.s["infoBtn"].addEventListener(MouseEvent.MOUSE_OVER,this.onInfoBtnOver,false,0,true);
this._recyclePopup.skin.s["infoBtn"].addEventListener(MouseEvent.MOUSE_OUT,onInfoBtnOut,false,0,true);
this._recycleSmall.okBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onOkBtn,false,0,true);
this._recycleSmall.noBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onNoBtn,false,0,true);
}
private function removeListeners() : void
{
if(this._recyclePopup)
{
this._recyclePopup.skin.s["bx"].removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
}
if(this._recyclePopupSmall)
{
this._recyclePopupSmall.skin.s["bx"].removeEventListener(MouseEvent.MOUSE_DOWN,this.onNoBtn);
}
this._recycleSmall.okBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onOkBtn);
this._recycleSmall.noBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onNoBtn);
this._recyclePopup.skin.s["infoBtn"].removeEventListener(MouseEvent.MOUSE_DOWN,this.onInfoBtnDown);
this._recyclePopup.skin.s["infoBtn"].addEventListener(MouseEvent.MOUSE_OVER,this.onInfoBtnOver);
this._recyclePopup.skin.s["infoBtn"].addEventListener(MouseEvent.MOUSE_OUT,onInfoBtnOut);
}
}
}
@@ -0,0 +1,313 @@
package gui
{
import buddy.BuddyXtCommManager;
import com.sbi.popup.SBPopup;
import facilitator.FacilitatorXtCommManager;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import loader.MediaHelper;
import localization.LocalizationManager;
public class ReportAPlayer
{
private static var _popupLayer:DisplayLayer;
private static var _closeCallback:Function;
private static var _report:MovieClip;
private static var _reportFromCard:MovieClip;
private static var _reportPopup:SBPopup;
private static var _reportFromCardPopup:SBPopup;
private static var _reportFromCardConfirmPopup:MovieClip;
private static var _isFromPlayersCard:Boolean;
private static var _reportAPlayer:Boolean;
private static var _playersAvatarUserName:String;
private static var _playersModeratedAvatarUserName:String;
private static var _reasonArray:Array;
private static var _hasReported:Boolean;
private static var _reportConfirmMediaHelper:MediaHelper;
private static var _agreeBox:GuiCheckBox;
public function ReportAPlayer()
{
super();
}
public static function initReasonArray(param1:Array) : void
{
_reasonArray = param1;
}
public static function closeReportFromCardPopoup() : void
{
if(_reportFromCardPopup)
{
_reportFromCardPopup.close();
}
}
public function init(param1:DisplayLayer, param2:Function = null, param3:Boolean = false, param4:String = null, param5:String = null, param6:Boolean = true, param7:int = 450, param8:int = 275) : void
{
_popupLayer = param1;
_closeCallback = param2;
_isFromPlayersCard = param3;
_playersAvatarUserName = param4;
_playersModeratedAvatarUserName = param5;
_hasReported = false;
_reportAPlayer = param6;
_reasonArray = [LocalizationManager.translateIdOnly(11372),LocalizationManager.translateIdOnly(14791),LocalizationManager.translateIdOnly(14792),LocalizationManager.translateIdOnly(14793),LocalizationManager.translateIdOnly(14794),LocalizationManager.translateIdOnly(14795),LocalizationManager.translateIdOnly(15736),LocalizationManager.translateIdOnly(15737),LocalizationManager.translateIdOnly(20088)];
if(param3)
{
_reportFromCard = GETDEFINITIONBYNAME("ReportPopupReportContent");
_reportFromCardPopup = new SBPopup(_popupLayer,GETDEFINITIONBYNAME("ReportPopupReportSkin"),_reportFromCard,true,true,false,false,true);
_reportFromCardPopup.x = param7;
_reportFromCardPopup.y = param8;
_reportFromCardPopup.bxClosesPopup = false;
LocalizationManager.translateId(_reportFromCard.reasonTxt,11372);
LocalizationManager.translateIdAndInsert(_reportFromCard.titleTxt,11373,_playersModeratedAvatarUserName);
SafeChatManager.buildSafeChatTree(_reportFromCard.reasonChatTree,"ECardTextTreeNode",SafeChatManager.TREE_ECARDTEXT,this.onReasonTextClose,_reasonArray);
SafeChatManager.closeSafeChat(_reportFromCard.reasonChatTree);
}
else
{
_report = GETDEFINITIONBYNAME("ReportPopupHowToContent2");
_reportPopup = new SBPopup(_popupLayer,GETDEFINITIONBYNAME("ReportPopupHowToSkin"),_report);
_reportPopup.x = param7;
_reportPopup.y = param8;
_reportPopup.bxClosesPopup = false;
}
this.addListeners();
}
public function destroy() : void
{
this.removeListeners();
if(_reportFromCardPopup)
{
_reportFromCardPopup.destroy();
_reportFromCardPopup = null;
}
if(_reportPopup)
{
_reportPopup.destroy();
_reportPopup = null;
}
if(_reportFromCardConfirmPopup)
{
if(_agreeBox)
{
_agreeBox.destroy();
_agreeBox = null;
}
DarkenManager.unDarken(_reportFromCardConfirmPopup);
_popupLayer.removeChild(_reportFromCardConfirmPopup);
_reportFromCardConfirmPopup = null;
}
GuiManager.displayRulesPopup(false);
if(_reportFromCard)
{
SafeChatManager.destroy(_reportFromCard.reasonChatTree);
}
if(GuiManager.mainHud.reportBtn)
{
GuiManager.mainHud.reportBtn.downToUpState();
}
_closeCallback = null;
}
private function onClose(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_hasReported && _agreeBox.checked)
{
if(!BuddyManager.isBlocked(_playersAvatarUserName))
{
BuddyXtCommManager.sendBuddyBlockRequest(_playersAvatarUserName);
}
}
if(_closeCallback != null)
{
_closeCallback(_hasReported);
}
else
{
this.destroy();
}
}
private function onReportBtnHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(_reportAPlayer)
{
FacilitatorXtCommManager.sendReportAPlayerRequest(_playersAvatarUserName,this.reasonIdForReason(_reportFromCard.reasonTxt.text),this.reportAPlayerResponse);
}
else
{
FacilitatorXtCommManager.sendReportAPostRequest(_playersAvatarUserName,this.reasonIdForReason(_reportFromCard.reasonTxt.text),this.reportAPlayerResponse);
}
_reportFromCardPopup.close();
}
private function reasonIdForReason(param1:String) : int
{
switch(param1)
{
case _reasonArray[0]:
return FacilitatorXtCommManager.RULE_MEAN;
case _reasonArray[1]:
return FacilitatorXtCommManager.RULE_LANGUAGE;
case _reasonArray[2]:
return FacilitatorXtCommManager.RULE_BAD_DEN;
case _reasonArray[3]:
return FacilitatorXtCommManager.RULE_PERSONAL_INFO;
case _reasonArray[4]:
return FacilitatorXtCommManager.RULE_SECURITY;
case _reasonArray[5]:
return FacilitatorXtCommManager.RULE_SCAMMING;
case _reasonArray[6]:
return FacilitatorXtCommManager.RULE_RELATIONSHIP;
case _reasonArray[7]:
return FacilitatorXtCommManager.RULE_USERNAME;
case _reasonArray[8]:
return FacilitatorXtCommManager.RULE_JAM_A_GRAM;
default:
throw new Error("Reason for reporting is invalid. Reason: " + param1);
}
}
private function onNoHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
this.onClose(param1);
}
private function onReasonHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(!_reportFromCard.reasonChatTree.visible)
{
SafeChatManager.openSafeChat(true,_reportFromCard.reasonChatTree);
}
else
{
SafeChatManager.closeSafeChat(_reportFromCard.reasonChatTree);
}
}
private function onReasonTextClose(param1:String, param2:String) : void
{
_reportFromCard.reasonTxt.text = param1;
SafeChatManager.closeSafeChat(_reportFromCard.reasonChatTree);
}
private function onRules(param1:MouseEvent) : void
{
param1.stopPropagation();
GuiManager.displayRulesPopup(true);
}
private function reportAPlayerResponse(param1:Boolean) : void
{
DarkenManager.showLoadingSpiral(true);
_reportConfirmMediaHelper = new MediaHelper();
_reportConfirmMediaHelper.init(2694,this.onReportConfirmLoaded,param1);
}
private function onReportConfirmLoaded(param1:MovieClip) : void
{
DarkenManager.showLoadingSpiral(false);
_reportFromCardConfirmPopup = MovieClip(param1.getChildAt(0));
_reportFromCardConfirmPopup.x = _reportFromCardPopup.x;
_reportFromCardConfirmPopup.y = _reportFromCardPopup.y;
if(param1.passback)
{
LocalizationManager.translateId(_reportFromCardConfirmPopup.titleTxt,11374);
_hasReported = true;
}
else
{
LocalizationManager.translateId(_reportFromCardConfirmPopup.titleTxt,11375);
}
_reportFromCardConfirmPopup.okBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
_agreeBox = new GuiCheckBox(_reportFromCardConfirmPopup.agree_box);
_agreeBox.init(_reportFromCardConfirmPopup.bodyTxt);
_agreeBox.checked = true;
_reportConfirmMediaHelper.destroy();
_reportConfirmMediaHelper = null;
_popupLayer.addChild(_reportFromCardConfirmPopup);
DarkenManager.darken(_reportFromCardConfirmPopup);
}
public function get visible() : Boolean
{
if(_reportPopup)
{
return _reportPopup.visible;
}
return false;
}
private function addListeners() : void
{
if(_isFromPlayersCard)
{
if(_reportFromCardPopup)
{
_reportFromCardPopup.skin.s["bx"].addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
}
_reportFromCard.reportBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onReportBtnHandler,false,0,true);
_reportFromCard.noBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onNoHandler,false,0,true);
_reportFromCard.addTxtBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onReasonHandler,false,0,true);
}
else
{
if(_reportPopup)
{
_reportPopup.skin.s["bx"].addEventListener(MouseEvent.MOUSE_DOWN,this.onClose,false,0,true);
}
_report.rulesReportBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onRules,false,0,true);
}
}
private function removeListeners() : void
{
if(_isFromPlayersCard)
{
if(_reportFromCardPopup)
{
_reportFromCardPopup.skin.s["bx"].removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
}
if(_reportFromCardConfirmPopup)
{
_reportFromCardConfirmPopup.okBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
}
_reportFromCard.reportBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onReportBtnHandler);
_reportFromCard.noBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onNoHandler);
_reportFromCard.addTxtBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onReasonHandler);
}
else
{
if(_reportPopup)
{
_reportPopup.skin.s["bx"].removeEventListener(MouseEvent.MOUSE_DOWN,this.onClose);
}
_report.rulesReportBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onRules);
}
}
}
}
@@ -0,0 +1,566 @@
package gui
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.geom.Rectangle;
import gskinner.motion.GTween;
import gskinner.motion.easing.Quadratic;
public class SBScrollbar extends MovieClip
{
private const MIN_HANDLE_HEIGHT:int = 30;
private const EASE_TIME:Number = 0.001;
private const EASE_BUTTON_TIME:Number = 0.5;
private var _scrollContentMask:MovieClip;
private var _wheelScrollPercent:Number;
private var _wheelScrollChange:Number;
private var _scrollHeight:Number;
private var _bounds:Rectangle;
private var _scrollTween:GTween;
private var _scrollContent:MovieClip;
private var _scrollContentHeight:Number;
private var _track:MovieClip;
private var _scrollHandle:MovieClip;
private var _topBtn:MovieClip;
private var _bottomBtn:MovieClip;
private var _gap:Number;
private var _snapHeight:Number;
private var _viewableWidth:Number;
private var _viewableHeight:Number;
private var _adjTrackHeight:Number;
private var _handleMovementPercentage:Number;
private var _currContentY:Number;
private var _numRowsInView:int;
private var _fullScreenScrollChange:Number;
private var _numPerRow:int;
public function SBScrollbar()
{
super();
}
public function init(param1:MovieClip, param2:Number, param3:Number, param4:Number, param5:String, param6:Number, param7:Number = 0, param8:Number = -1) : void
{
this._scrollContent = param1;
this._scrollContent.y = 0;
this._scrollContent.x = 0;
var _loc9_:MovieClip = GETDEFINITIONBYNAME(param5);
if(Boolean(_loc9_.track) && Boolean(_loc9_.handle))
{
this._track = _loc9_.track;
this._scrollHandle = _loc9_.handle;
this._topBtn = _loc9_.topBtn;
this._bottomBtn = _loc9_.botBtn;
this._snapHeight = param6;
this._gap = param4;
this._viewableWidth = param2;
this._viewableHeight = param3;
this._numPerRow = Math.round(this._viewableWidth / this._scrollContent.boxWidth);
if(param8 < this._viewableHeight)
{
this._scrollContentHeight = this._scrollContent.height;
}
else
{
this._scrollContentHeight = param8;
}
this._scrollContentMask = this.createMask(this._viewableWidth,this._viewableHeight);
this._scrollContent.parent.addChild(this._scrollContentMask);
this._scrollContentMask.x = this._scrollContent.x;
this._scrollContentMask.y = this._scrollContent.y;
this._scrollContent.mask = this._scrollContentMask;
this._scrollHeight = this._scrollContentHeight - this._scrollContentMask.height;
if(param7 <= 0)
{
this._currContentY = 0;
}
else if(param7 > this._scrollHeight)
{
this._currContentY = this._scrollHeight;
}
else
{
this._currContentY = param7;
}
this.setupAllItems();
this._numRowsInView = Math.round(this._viewableHeight / this._snapHeight);
this._fullScreenScrollChange = this._snapHeight * (this._numRowsInView - 1);
this._handleMovementPercentage = 0;
this._bounds = new Rectangle(this._track.x,this._scrollContentMask.y,0,Math.round(this._bottomBtn.y - this._scrollHandle.height));
this._bounds.top = this._topBtn.height;
this._adjTrackHeight = this._track.height - this._scrollHandle.height;
this._wheelScrollPercent = this._snapHeight / (this._scrollContentHeight - this._scrollContentMask.height);
this._wheelScrollChange = this._wheelScrollPercent * (this._scrollContentMask.y + this._scrollContentMask.height - this._scrollHandle.height);
this.setScrollHandleLocation(this._currContentY);
this.updateLoadItems();
this._scrollContent.y = this._scrollContentMask.y - this._currContentY;
return;
}
throw new Error("Error: SBSCrollbar.init()- The 5th parameter must contain two symbols; \'track\' and \'handle\'.");
}
public function destroy() : void
{
if(this._scrollHandle)
{
this._scrollHandle.y = 0;
this._scrollContent.y = 0;
}
if(this._scrollContent)
{
if(this._scrollContent.stage)
{
this._scrollContent.stage.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUpHandler);
this._scrollContent.stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMoveHandler);
}
if(this._scrollContent.parent)
{
this._scrollContent.parent.removeEventListener(MouseEvent.MOUSE_WHEEL,this.onMouseWheelHandler);
if(this._scrollContent.stage)
{
this._scrollContent.parent.stage.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUpHandler);
}
if(this._scrollContent.parent.parent)
{
this._scrollContent.parent.parent.removeEventListener(MouseEvent.ROLL_OUT,this.onStageOut);
}
if(Boolean(this._scrollContent.parent) && Boolean(this._scrollContent.parent.parent) && Boolean(this._scrollContent.parent.parent.parent))
{
this._scrollContent.parent.parent.parent.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUpHandler);
}
if(Boolean(this._scrollContentMask) && Boolean(this._scrollContentMask.parent))
{
this._scrollContentMask.parent.removeChild(this._scrollContentMask);
}
if(Boolean(this._track) && Boolean(this._track.parent) && this._track.parent == this._scrollContent.parent)
{
this._scrollContent.parent.removeChild(this._track);
}
if(Boolean(this._scrollHandle) && Boolean(this._scrollHandle.parent) && this._scrollHandle.parent == this._scrollContent.parent)
{
this._scrollHandle.removeEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDownHandler);
this._scrollContent.parent.removeChild(this._scrollHandle);
}
if(Boolean(this._topBtn) && Boolean(this._topBtn.parent) && this._topBtn.parent == this._scrollContent.parent)
{
this._topBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onBtnClick);
this._scrollContent.parent.removeChild(this._topBtn);
}
if(Boolean(this._bottomBtn) && Boolean(this._bottomBtn.parent) && this._bottomBtn.parent == this._scrollContent.parent)
{
this._bottomBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onBtnClick);
this._scrollContent.parent.removeChild(this._bottomBtn);
}
}
}
this._track = null;
this._scrollHandle = null;
this._topBtn = null;
this._bottomBtn = null;
this._scrollContent = null;
this._scrollContentMask = null;
this._bounds = null;
this._gap = NaN;
this._snapHeight = NaN;
this._viewableWidth = NaN;
this._viewableHeight = NaN;
this._adjTrackHeight = NaN;
this._handleMovementPercentage = NaN;
this._currContentY = NaN;
this._numRowsInView = NaN;
this._fullScreenScrollChange = NaN;
}
public function get scrollHeight() : Number
{
return this._scrollHeight;
}
public function get getMaskHeight() : Number
{
return this._scrollContentMask.height;
}
public function get getMaskY() : Number
{
return this._scrollContentMask.y;
}
public function get scrollYValue() : Number
{
if(this._scrollContentHeight <= this._scrollContentMask.height)
{
this._currContentY = 0;
}
return this._currContentY;
}
public function get scrollYPercentage() : Number
{
if(this._scrollContentHeight <= this._scrollContentMask.height)
{
return this._currContentY = 0;
}
return this._currContentY / this._scrollHeight;
}
public function get getScrollContentParent() : MovieClip
{
return MovieClip(this._scrollContent.parent);
}
public function scrollToElement(param1:int, param2:Boolean = false) : void
{
if(param1 < 0 || param1 > this._scrollContentHeight / this._snapHeight)
{
throw new Error("Invalid index.");
}
var _loc3_:Number = Math.min(this._scrollHeight,param1 * this._snapHeight - this._currContentY);
this.updateContentPosition(_loc3_ < 0 ? 0 : _loc3_,param2);
}
private function setupAllItems() : void
{
this._scrollContent.parent.addChild(this._track);
this._track.x = Math.round(this._scrollContent.x + this._viewableWidth + this._gap + this._track.width * 0.5);
this._track.y = this._scrollContent.y + this._topBtn.height;
this._track.height = this._scrollContentMask.height - this._topBtn.height - this._bottomBtn.height;
this._scrollContent.parent.addChild(this._topBtn);
this._topBtn.x = this._track.x;
this._topBtn.y = this._scrollContent.y;
this._scrollContent.parent.addChild(this._bottomBtn);
this._bottomBtn.x = this._track.x;
this._bottomBtn.y = this._track.y + this._track.height;
this._scrollContent.parent.addChild(this._scrollHandle);
this._scrollHandle.x = this._track.x;
this._scrollHandle.y = this._track.y;
this.resizeHandle();
}
private function snapToPlace() : void
{
var _loc1_:Number = Math.round(this._scrollHeight * this._handleMovementPercentage / this._snapHeight);
_loc1_ = this._snapHeight * _loc1_;
var _loc2_:Number = _loc1_ / this._scrollHeight;
this._currContentY = this._scrollHeight * _loc2_;
new GTween(this._scrollContent,this.EASE_BUTTON_TIME,{"y":this._scrollContentMask.y - this._currContentY},{"ease":Quadratic.easeOut});
this.setScrollHandleLocation(this._currContentY);
var _loc3_:Number = Math.max(this._scrollHandle.y,this._track.y);
new GTween(this._scrollHandle,this.EASE_BUTTON_TIME,{"y":_loc3_},{"ease":Quadratic.easeOut});
}
private function setScrollHandleLocation(param1:Number) : void
{
var _loc2_:Number = Math.min(1,param1 / this._scrollHeight);
var _loc3_:Number = _loc2_ * this._scrollHeight;
_loc3_ /= this._snapHeight;
this._handleMovementPercentage = _loc3_ * this._snapHeight / this._scrollHeight;
this._scrollHandle.y = Math.max(this._handleMovementPercentage * this._adjTrackHeight + this._topBtn.height,this._track.y);
}
private function loadCurrViewableObjects(param1:Number) : void
{
var _loc2_:int = Math.ceil(param1 / this._snapHeight);
var _loc3_:int = _loc2_ * this._numPerRow;
var _loc4_:int = _loc3_ + this._numRowsInView * this._numPerRow;
var _loc5_:int = int(this._scrollContent.bg.numChildren);
var _loc6_:int = _loc3_;
while(_loc6_ < _loc4_)
{
if(_loc6_ < _loc5_)
{
this._scrollContent.bg.getChildAt(_loc6_).loadCurrItem(param1);
}
_loc6_++;
}
}
private function updateLoadItems(param1:Boolean = false) : void
{
var _loc2_:Number = NaN;
var _loc3_:Number = NaN;
if(this._scrollContent.hasOwnProperty("bg"))
{
if(!param1)
{
this.loadCurrViewableObjects(this._currContentY);
}
else
{
_loc2_ = Math.round(this._scrollHeight * this._handleMovementPercentage / this._snapHeight);
_loc2_ = this._snapHeight * _loc2_;
_loc3_ = _loc2_ / this._scrollHeight;
this.loadCurrViewableObjects(this._scrollHeight * _loc3_);
}
}
}
private function updateContentPosition(param1:Number = NaN, param2:Boolean = false) : void
{
if(!isNaN(param1))
{
this._currContentY += param1;
this.setScrollHandleLocation(this._currContentY);
this.updateLoadItems();
this._scrollTween = new GTween(this._scrollContent,param2 ? this.EASE_TIME : this.EASE_BUTTON_TIME,{"y":this._scrollContentMask.y - this._currContentY},{"ease":Quadratic.easeOut});
}
else
{
this._handleMovementPercentage = Math.min(1,(this._scrollHandle.y - this._topBtn.height) / this._adjTrackHeight);
this.updateLoadItems(true);
this._scrollTween = new GTween(this._scrollContent,this.EASE_TIME,{"y":this._scrollContentMask.y - this._scrollHeight * this._handleMovementPercentage},{"ease":Quadratic.easeOut});
}
}
private function onBtnClick(param1:MouseEvent) : void
{
param1.stopPropagation();
var _loc2_:Number = 0;
if(this._scrollTween)
{
this._scrollTween.end();
}
if(param1.currentTarget.name == this._topBtn.name)
{
_loc2_ = this.scrollUp();
}
else
{
_loc2_ = this.scrollDown();
}
if(_loc2_ != 0)
{
this.updateContentPosition(_loc2_);
}
}
private function scrollUp() : Number
{
var _loc2_:* = 0;
var _loc1_:int = 0;
if(this._currContentY > 0)
{
if(this._currContentY >= this._fullScreenScrollChange)
{
_loc1_ = -this._fullScreenScrollChange;
}
else
{
_loc2_ = int(this._numRowsInView - 2);
while(_loc2_ > 0)
{
if(this._currContentY >= this._snapHeight * _loc2_)
{
_loc1_ = -(this._snapHeight * _loc2_);
break;
}
_loc2_--;
}
if(_loc1_ > -this._currContentY)
{
_loc1_ = -this._currContentY;
}
}
}
return _loc1_;
}
private function scrollDown() : Number
{
var _loc3_:* = 0;
var _loc1_:Number = 0;
var _loc2_:Number = this._scrollContentHeight - this._currContentY - this._viewableHeight;
if(_loc2_ > 0)
{
if(_loc2_ >= this._fullScreenScrollChange)
{
_loc1_ = this._fullScreenScrollChange;
}
else
{
_loc3_ = int(this._numRowsInView - 2);
while(_loc3_ > 0)
{
if(_loc2_ >= this._snapHeight * _loc3_)
{
_loc1_ = this._snapHeight * _loc3_;
break;
}
_loc3_--;
}
if(_loc1_ < _loc2_)
{
_loc1_ = _loc2_;
}
}
}
return _loc1_;
}
private function onMouseDownHandler(param1:MouseEvent) : void
{
param1.stopPropagation();
if(this._scrollHandle.height < this._scrollContentHeight - 3)
{
this._scrollHandle.startDrag(false,this._bounds);
this._scrollContent.parent.parent.addEventListener(MouseEvent.ROLL_OUT,this.onStageOut,false,0,true);
this._scrollContent.stage.addEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMoveHandler,false,0,true);
this._scrollContent.parent.stage.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUpHandler,false,0,true);
this._scrollContent.parent.parent.parent.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUpHandler,false,0,true);
}
}
private function onStageOut(param1:MouseEvent) : void
{
param1.stopPropagation();
this.onMouseUpHandler(param1);
}
private function onMouseUpHandler(param1:MouseEvent = null) : void
{
if(param1)
{
param1.stopPropagation();
}
this._scrollHandle.stopDrag();
if(this._scrollTween)
{
this._scrollTween.end();
}
if(this._snapHeight > 0)
{
this.snapToPlace();
}
if(this._scrollContent.stage)
{
this._scrollContent.stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.onMouseMoveHandler);
}
if(this._scrollContent.parent.stage)
{
this._scrollContent.parent.stage.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUpHandler);
}
if(this._scrollContent.parent.parent)
{
this._scrollContent.parent.parent.removeEventListener(MouseEvent.ROLL_OUT,this.onStageOut);
}
if(this._scrollContent.parent.parent.parent)
{
this._scrollContent.parent.parent.parent.removeEventListener(MouseEvent.MOUSE_UP,this.onMouseUpHandler);
}
}
private function onTrackDown(param1:MouseEvent) : void
{
var _loc2_:Number = 0;
var _loc3_:Number = Math.ceil(param1.localY * param1.currentTarget.scaleY);
if(this._scrollTween)
{
this._scrollTween.end();
}
if(_loc3_ < this._scrollHandle.y + this._scrollHandle.height - this._topBtn.height)
{
_loc2_ = this.scrollUp();
}
else
{
_loc2_ = this.scrollDown();
}
if(_loc2_ != 0)
{
this.updateContentPosition(_loc2_);
}
}
private function onMouseMoveHandler(param1:MouseEvent) : void
{
this.updateContentPosition();
}
private function onMouseWheelHandler(param1:MouseEvent) : void
{
var _loc2_:Number = 0;
if(param1.delta > 0)
{
_loc2_ = this.scrollUp();
}
else
{
_loc2_ = this.scrollDown();
}
if(_loc2_ != 0)
{
this.updateContentPosition(_loc2_);
}
}
private function createMask(param1:Number, param2:Number) : MovieClip
{
var _loc3_:MovieClip = new MovieClip();
_loc3_.graphics.beginFill(16777215);
_loc3_.graphics.drawRect(0,0,param1,param2);
_loc3_.graphics.endFill();
return _loc3_;
}
private function resizeHandle() : void
{
var _loc1_:Number = NaN;
if(this._scrollContentHeight <= this._scrollContentMask.height || this._currContentY != this._scrollHeight && this._scrollContentHeight - this._currContentY - this._viewableHeight < this._snapHeight)
{
this._scrollHandle.visible = false;
if(Boolean(this._topBtn.hasGrayState) && Boolean(this._bottomBtn.hasGrayState))
{
this._topBtn.activateGrayState(true);
this._bottomBtn.activateGrayState(true);
}
if(this._scrollContent.parent.hasEventListener(MouseEvent.MOUSE_WHEEL))
{
this._scrollContent.parent.removeEventListener(MouseEvent.MOUSE_WHEEL,this.onMouseWheelHandler);
}
}
else
{
_loc1_ = this._scrollContentMask.height / this._scrollContentHeight * this._scrollContentMask.height - this._topBtn.height - this._bottomBtn.height;
this._topBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onBtnClick,false,0,true);
this._bottomBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onBtnClick,false,0,true);
this._scrollHandle.addEventListener(MouseEvent.MOUSE_DOWN,this.onMouseDownHandler,false,0,true);
this._track.addEventListener(MouseEvent.MOUSE_DOWN,this.onTrackDown,false,0,true);
this._scrollContent.parent.addEventListener(MouseEvent.MOUSE_WHEEL,this.onMouseWheelHandler,false,0,true);
if(_loc1_ < this.MIN_HANDLE_HEIGHT)
{
_loc1_ = this.MIN_HANDLE_HEIGHT;
}
this._scrollHandle.mid.height = _loc1_ - this._scrollHandle.top.height - this._scrollHandle.bot.height;
this._scrollHandle.top.y = 0;
this._scrollHandle.mid.y = this._scrollHandle.top.y + this._scrollHandle.top.height - 0.1;
this._scrollHandle.bot.y = this._scrollHandle.mid.y + this._scrollHandle.mid.height - 0.1;
}
}
}
}
@@ -0,0 +1,688 @@
package gui
{
import com.sbi.debug.DebugUtility;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.utils.getDefinitionByName;
import localization.LocalizationManager;
public class SafeChatManager
{
public static var sctNodes:Array;
public static var ctNodes:Array;
public static var photoBoothNodes:Array;
public static var adventureNodes:Array;
private static var SafeChatTreeNode:Class;
private static var _safeChatCallback:Function;
private static var _safeChatCallbackFromOtherSystem:Function;
private static var _safeChatBtn:MovieClip;
private static var _safeChatTree:MovieClip;
private static var _actionBtn:MovieClip;
private static var _actionWindow:Sprite;
private static var _emoteBtn:MovieClip;
private static var _emoteWindow:Sprite;
private static var _treeArray:Array;
private static var _nodeYLocation:Number;
private static var _lowestNodeYLocation:Number;
private static var _safeTreeNodeHeight:Number;
private static var _safeChatTreeNodes:MovieClip;
public static const TREE_SAFECHAT:int = 0;
public static const TREE_ECARDTEXT:int = 1;
public static const TREE_REPORTREASON:int = 2;
public static const TREE_PHOTOBOOTH:int = 3;
public static const TREE_ADVENTURE:int = 4;
private static const SCT_DIM_ALPHA:Number = 0.5;
private static const SCT_BRIGHT_ALPHA:Number = 1;
private static const JAG_LOCALIZATION_ID:int = 66;
private static const BC_LOCALIZATION_ID:int = 47;
private static const PHOTOBOOTH_LOCALIZATION_ID:int = 158;
private static const ADVENTURE_LOCALIZATION_ID:int = 170;
public function SafeChatManager()
{
super();
}
public static function init(param1:Function, param2:MovieClip, param3:MovieClip, param4:MovieClip, param5:Sprite, param6:MovieClip, param7:Sprite) : void
{
if(_safeChatCallback != null)
{
throw new Error("ERROR: Singleton SafeChatManager did not expect to be created twice!");
}
_safeChatCallback = param1;
_safeChatBtn = param2;
_safeChatTree = param3;
if(sctNodes)
{
buildSafeChatTree(_safeChatTree);
}
_safeChatTree.visible = false;
_actionBtn = param4;
_actionWindow = param5;
_emoteBtn = param6;
_emoteWindow = param7;
}
public static function reload(param1:Boolean, param2:MovieClip, param3:MovieClip, param4:MovieClip, param5:Sprite, param6:MovieClip, param7:Sprite) : void
{
_safeChatTree = param3;
_safeChatBtn = param2;
_safeChatTree.visible = false;
_actionBtn = param4;
_actionWindow = param5;
_emoteBtn = param6;
_emoteWindow = param7;
if(param1)
{
while(_safeChatTree.numChildren > 1)
{
_safeChatTree.removeChildAt(_safeChatTree.numChildren - 1);
}
ctNodes = sctNodes = photoBoothNodes = adventureNodes = null;
requestSafeChatLists();
}
else if(_safeChatTree.numChildren < 2)
{
_safeChatTree.addChild(_safeChatTreeNodes);
}
_safeChatBtn.downToUpState();
}
public static function buildSafeChatTree(param1:MovieClip, param2:String = null, param3:int = 0, param4:Function = null, param5:Array = null) : void
{
var _loc6_:MovieClip = null;
var _loc7_:int = 0;
var _loc8_:uint = 0;
var _loc9_:MovieClip = null;
_safeChatCallbackFromOtherSystem = param4;
if(param2 == null)
{
param2 = "SafeChatTreeNode";
}
SafeChatTreeNode = getDefinitionByName(param2) as Class;
if(param5 != null)
{
_treeArray = param5;
}
else if(param3 == TREE_ECARDTEXT)
{
_treeArray = ctNodes;
}
else if(param3 == TREE_PHOTOBOOTH)
{
_treeArray = photoBoothNodes;
}
else if(param3 == TREE_ADVENTURE)
{
_treeArray = adventureNodes;
}
else
{
_treeArray = sctNodes;
}
if(_treeArray)
{
_loc6_ = new SafeChatTreeNode();
_loc7_ = param1.height - (_treeArray.length * _loc6_.height - 1);
_safeChatTreeNodes = new MovieClip();
_loc8_ = 0;
while(_loc8_ < _treeArray.length)
{
_loc9_ = new SafeChatTreeNode();
_loc9_.x = 0;
_loc9_.y = _loc7_ + _loc8_ * (_loc9_.height - 1);
_safeChatTreeNodes.addChild(_loc9_);
_loc9_["menuNums"] = [_loc8_];
_loc9_.addEventListener(MouseEvent.MOUSE_DOWN,sctNodeMouseHandler,false,0,true);
if(_treeArray[_loc8_] is String)
{
LocalizationManager.updateToFit(_loc9_.sctNodeTxt,_treeArray[_loc8_]);
_loc9_.sctNodeBG.gotoAndStop(1);
}
else
{
if(!(_treeArray[_loc8_] is Array))
{
throw new Error("invalid type in sctNodes...");
}
_safeTreeNodeHeight = _loc9_.height;
_lowestNodeYLocation = _loc7_ + (_treeArray.length - 1) * (_safeTreeNodeHeight - 1);
_nodeYLocation = _loc9_.y;
LocalizationManager.updateToFit(_loc9_.sctNodeTxt,_treeArray[_loc8_][0]);
_loc9_.sctNodeBG.gotoAndStop(3);
buildChatTreeSubMenu(_treeArray[_loc8_],DisplayObjectContainer(_loc9_),0);
}
_loc8_++;
}
param1.addChild(_safeChatTreeNodes);
}
}
public static function requestSafeChatLists() : void
{
GenericListXtCommManager.requestGenericList(BC_LOCALIZATION_ID,onListLoaded);
GenericListXtCommManager.requestGenericList(JAG_LOCALIZATION_ID,onListLoaded);
GenericListXtCommManager.requestGenericList(PHOTOBOOTH_LOCALIZATION_ID,onListLoaded);
GenericListXtCommManager.requestGenericList(ADVENTURE_LOCALIZATION_ID,onListLoaded);
}
public static function containsInTreeArray(param1:String, param2:int = 0) : Boolean
{
var _loc3_:Object = null;
var _loc4_:Boolean = false;
var _loc5_:Array = null;
var _loc7_:int = 0;
if(param2 == TREE_ECARDTEXT)
{
_loc5_ = ctNodes;
}
else if(param2 == TREE_PHOTOBOOTH)
{
_loc5_ = photoBoothNodes;
}
else if(param2 == TREE_ADVENTURE)
{
_loc5_ = adventureNodes;
}
else
{
_loc5_ = sctNodes;
}
var _loc6_:int = 0;
while(_loc6_ < _loc5_.length)
{
_loc3_ = _loc5_[_loc6_];
if(_loc3_ is Array)
{
_loc7_ = 0;
while(_loc7_ < _loc3_.length)
{
if(_loc3_[_loc7_] == param1)
{
return true;
}
_loc7_++;
}
}
else if(_loc3_ == param1)
{
return true;
}
_loc6_++;
}
return false;
}
private static function onListLoaded(param1:int, param2:Array) : void
{
var _loc3_:RegExp = null;
var _loc5_:Array = null;
if(gMainFrame.server.isBlueboxMode())
{
_loc3_ = /&#10/g;
}
else
{
_loc3_ = /\r\n|\n|\r/g;
}
var _loc4_:Array = [];
var _loc6_:int = 0;
while(_loc6_ < param2.length)
{
_loc5_ = LocalizationManager.translateIdOnly(param2[_loc6_]).split(_loc3_);
if(_loc5_.length == 1)
{
_loc4_.push(_loc5_[0]);
}
else
{
_loc4_.push(_loc5_);
}
_loc6_++;
}
if(param1 == BC_LOCALIZATION_ID)
{
sctNodes = _loc4_;
}
else if(param1 == JAG_LOCALIZATION_ID)
{
ctNodes = _loc4_;
}
else if(param1 == PHOTOBOOTH_LOCALIZATION_ID)
{
photoBoothNodes = _loc4_;
}
else if(param1 == ADVENTURE_LOCALIZATION_ID)
{
adventureNodes = _loc4_;
}
else
{
DebugUtility.debugTrace("Loaded safe chat list that doesn\'t match!");
}
if(Boolean(ctNodes) && Boolean(sctNodes) && Boolean(photoBoothNodes) && Boolean(adventureNodes))
{
buildSafeChatTree(_safeChatTree);
}
}
private static function buildChatTreeSubMenu(param1:Array, param2:DisplayObjectContainer, param3:uint) : void
{
var _loc6_:MovieClip = null;
var _loc7_:uint = 0;
var _loc8_:DisplayObjectContainer = null;
param3++;
var _loc4_:Number = _nodeYLocation + (param1.length - 2) * (_safeTreeNodeHeight - 1);
if(_loc4_ > _lowestNodeYLocation)
{
_nodeYLocation -= _loc4_ - _lowestNodeYLocation;
}
var _loc5_:uint = 1;
while(_loc5_ < param1.length)
{
_loc6_ = new SafeChatTreeNode();
_loc6_.x = param3 * _loc6_.width - param2.x;
_loc6_.y = _nodeYLocation + (_loc5_ - 1) * (_loc6_.height - 1);
_loc7_ = param3;
_loc8_ = param2;
while(_loc7_ > 0)
{
_loc6_.y -= _loc8_.y;
_loc8_ = _loc8_.parent;
_loc7_--;
}
param2.addChild(_loc6_);
_loc6_.visible = false;
if(_loc6_.parent["menuNums"])
{
_loc6_["menuNums"] = _loc6_.parent["menuNums"].slice();
_loc6_["menuNums"].push(_loc5_);
}
else
{
_loc6_["menuNums"] = [_loc5_];
}
_loc6_.addEventListener(MouseEvent.MOUSE_DOWN,sctNodeMouseHandler,false,0,true);
if(param1[_loc5_] is String)
{
LocalizationManager.updateToFit(_loc6_.sctNodeTxt,param1[_loc5_]);
_loc6_.sctNodeBG.gotoAndStop(1);
}
else
{
if(!(param1[_loc5_] is Array))
{
throw new Error("invalid type in scSubTree...");
}
LocalizationManager.updateToFit(_loc6_.sctNodeTxt,param1[_loc5_][0]);
_loc6_.sctNodeBG.gotoAndStop(3);
buildChatTreeSubMenu(param1[_loc5_],DisplayObjectContainer(_loc6_),param3);
}
_loc5_++;
}
}
public static function destroy(param1:MovieClip = null) : void
{
if(param1 != null)
{
while(param1.numChildren > 1)
{
param1.getChildAt(param1.numChildren - 1).removeEventListener(MouseEvent.MOUSE_DOWN,sctNodeMouseHandler);
param1.removeChildAt(param1.numChildren - 1);
}
_safeChatCallbackFromOtherSystem = null;
param1.visible = false;
param1 = null;
}
else
{
while(_safeChatTree.numChildren > 0)
{
_safeChatTree.getChildAt(0).removeEventListener(MouseEvent.MOUSE_DOWN,sctNodeMouseHandler);
_safeChatTree.removeChildAt(0);
}
_safeChatBtn = null;
_safeChatTree.visible = false;
_safeChatTree = null;
_actionBtn = null;
_actionWindow = null;
_emoteBtn = null;
_emoteWindow = null;
}
}
public static function traceDisplayList(param1:DisplayObjectContainer, param2:String = "") : void
{
var _loc3_:DisplayObject = null;
var _loc4_:uint = 0;
while(_loc4_ < param1.numChildren)
{
_loc3_ = param1.getChildAt(_loc4_);
if(_loc3_ == null)
{
DebugUtility.debugTrace(param2 + "NULL?!");
}
else
{
DebugUtility.debugTrace(param2 + " " + _loc3_ + " " + _loc3_.name);
}
if(_loc3_ is DisplayObjectContainer)
{
traceDisplayList(DisplayObjectContainer(_loc3_),param2 + " ");
}
_loc4_++;
}
}
public static function resetSafeChatTree(param1:Boolean, param2:MovieClip = null) : void
{
var _loc5_:DisplayObject = null;
var _loc6_:DisplayObjectContainer = null;
var _loc7_:uint = 0;
var _loc8_:DisplayObject = null;
if(param1)
{
SafeChatTreeNode = getDefinitionByName("SafeChatTreeNode") as Class;
}
var _loc3_:MovieClip = MovieClip(_safeChatTree.getChildAt(1));
if(param2)
{
_loc3_ = param2;
}
var _loc4_:uint = 0;
while(_loc4_ < _loc3_.numChildren)
{
_loc5_ = _loc3_.getChildAt(_loc4_);
if((Boolean(_loc5_)) && _loc5_ is DisplayObjectContainer)
{
if(_loc5_ is SafeChatTreeNode)
{
if(SafeChatTreeNode(_loc5_).sctNodeBG.currentFrame == 4)
{
SafeChatTreeNode(_loc5_).sctNodeBG.gotoAndStop(3);
}
if(SafeChatTreeNode(_loc5_).sctNodeBG.currentFrame == 2)
{
SafeChatTreeNode(_loc5_).sctNodeBG.gotoAndStop(1);
}
}
_loc6_ = DisplayObjectContainer(_loc5_);
_loc7_ = 0;
while(_loc7_ < _loc6_.numChildren)
{
_loc8_ = _loc6_.getChildAt(_loc7_);
if((Boolean(_loc8_)) && _loc8_ is SafeChatTreeNode)
{
_loc8_.visible = false;
SafeChatTreeNode(_loc8_).sctNodeBG.gotoAndStop(1);
}
_loc7_++;
}
}
_loc4_++;
}
}
public static function showSafeChatInput(param1:Boolean) : void
{
_safeChatBtn.visible = param1;
_safeChatTree.visible = param1;
}
public static function safeChatCodeForString(param1:String, param2:int = -1) : String
{
var _loc3_:Array = null;
var _loc4_:String = null;
var _loc6_:int = 0;
if(param2 != -1 || _treeArray == null)
{
if(param2 == TREE_ECARDTEXT)
{
_loc3_ = ctNodes;
}
else if(param2 == TREE_PHOTOBOOTH)
{
_loc3_ = photoBoothNodes;
}
else if(param2 == TREE_ADVENTURE)
{
_loc3_ = adventureNodes;
}
else
{
_loc3_ = sctNodes;
}
}
else
{
_loc3_ = _treeArray;
}
var _loc5_:int = 0;
while(_loc5_ < _loc3_.length)
{
if(_loc3_[_loc5_] is String)
{
if(_loc3_[_loc5_] == param1)
{
return _loc5_ + "0";
}
}
else
{
_loc4_ = _loc3_[_loc5_][0];
if(param1 == _loc4_)
{
return String(_loc5_);
}
_loc6_ = 1;
while(_loc6_ < _loc3_[_loc5_].length)
{
if(_loc4_.indexOf("...") > -1)
{
if(param1 == _loc4_.substr(0,_loc4_.length - 3) + " " + _loc3_[_loc5_][_loc6_])
{
return _loc5_ + "," + _loc6_;
}
}
else if(_loc3_[_loc5_][_loc6_] == param1)
{
return _loc5_ + "," + _loc6_;
}
_loc6_++;
}
}
_loc5_++;
}
return null;
}
public static function safeChatStringForCode(param1:String, param2:int = -1) : String
{
var _loc5_:String = null;
var _loc3_:Array = param1.split(",");
if(param2 != -1 || _treeArray == null)
{
if(param2 == TREE_ECARDTEXT)
{
_treeArray = ctNodes;
}
else if(param2 == TREE_PHOTOBOOTH)
{
_treeArray = photoBoothNodes;
}
else if(param2 == TREE_ADVENTURE)
{
_treeArray = adventureNodes;
}
else
{
_treeArray = sctNodes;
}
}
else if(gMainFrame.clientInfo.roomType == SbiConstants.ROOMTYPE_QUEST)
{
_treeArray = adventureNodes;
}
else
{
_treeArray = sctNodes;
}
var _loc4_:Array = _treeArray;
var _loc6_:uint = 0;
while(_loc6_ < _loc3_.length)
{
if(_loc6_ >= _loc3_.length - 1)
{
if(_loc4_[_loc3_[_loc6_]] is String)
{
if(Boolean(_loc5_) && Boolean(_loc5_.indexOf("...") > 0) && _loc5_.indexOf("...") == _loc5_.length - 3)
{
return _loc5_.substr(0,_loc5_.length - 3) + " " + _loc4_[_loc3_[_loc6_]];
}
return _loc4_[_loc3_[_loc6_]];
}
if(_loc4_[_loc3_[_loc6_]] is Array)
{
return _loc4_[_loc3_[_loc6_]][0];
}
return null;
}
if(_loc4_[_loc3_[_loc6_]] is String)
{
return null;
}
if(!(_loc4_[_loc3_[_loc6_]] is Array))
{
return null;
}
_loc5_ = _loc4_[_loc3_[_loc6_]][0];
_loc4_ = _loc4_[_loc3_[_loc6_]];
_loc6_++;
}
return null;
}
public static function openSafeChat(param1:Boolean, param2:MovieClip = null) : void
{
if(Boolean(param2) && !param2.visible)
{
param2.visible = true;
resetSafeChatTree(param1,MovieClip(param2.getChildAt(1)));
}
else if(!_safeChatTree.visible)
{
_safeChatTree.visible = true;
resetSafeChatTree(param1);
brightenSafeChat();
}
}
public static function dimSafeChat() : void
{
if(_safeChatTree.visible && _safeChatTree.alpha != SCT_DIM_ALPHA)
{
_safeChatTree.alpha = SCT_DIM_ALPHA;
}
}
public static function brightenSafeChat() : void
{
if(_safeChatTree.alpha != SCT_BRIGHT_ALPHA)
{
_safeChatTree.alpha = SCT_BRIGHT_ALPHA;
}
}
public static function closeSafeChat(param1:MovieClip = null) : void
{
if(Boolean(param1) && param1.visible)
{
param1.visible = false;
}
if(_safeChatTree)
{
if(_safeChatTree.visible)
{
_safeChatTree.visible = false;
}
_safeChatBtn.downToUpState();
}
}
public static function showHide() : void
{
_safeChatTree.visible = !_safeChatTree.visible;
}
public static function sctNodeMouseHandler(param1:MouseEvent) : void
{
var _loc3_:String = null;
param1.stopPropagation();
brightenSafeChat();
if(!param1.currentTarget is SafeChatTreeNode)
{
DebugUtility.debugTrace("ERROR: illegal event type in sctNodeMouseHandler!");
return;
}
if(!Utility.canChat())
{
return;
}
var _loc2_:String = param1.currentTarget.sctNodeTxt.text;
if(_loc2_.indexOf("...") >= 0)
{
return;
}
if(param1.currentTarget.parent.sctNodeTxt)
{
_loc3_ = param1.currentTarget.parent.sctNodeTxt.text;
if(_loc3_.indexOf("...") > 0)
{
_loc2_ = _loc3_.slice(0,_loc3_.indexOf("...")) + " " + _loc2_;
}
}
if(_safeChatCallbackFromOtherSystem != null)
{
_safeChatCallbackFromOtherSystem(_loc2_,param1.currentTarget.menuNums.toString());
}
else
{
_safeChatCallback(_loc2_,param1.currentTarget.menuNums.toString());
}
}
}
}
@@ -0,0 +1,303 @@
package gui
{
import com.sbi.analytics.SBTracker;
import com.sbi.popup.SBPopup;
import flash.display.DisplayObjectContainer;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import localization.LocalizationManager;
import room.RoomXtCommManager;
public class ServerSelector
{
private static var _popupLayer:DisplayObjectContainer;
private static var _closeCallback:Function;
private static var _serverAllContent:MovieClip;
private static var _serverAll:MovieClip;
private static var _scrollButtons:SBScrollbar;
private static var _itemWindows:WindowGenerator;
private static var _serverAllPopup:SBPopup;
private static var _availShards:Array;
private static var _serverNames:Array;
private static var _numBuddies:Array;
private static var _languageIds:Array;
private static var _popuplation:Array;
private static var _nameIdx:int;
private static var _lastClickedShardTarget:Object;
private static const NUM_Y_WIN:int = 10;
public function ServerSelector()
{
super();
}
public static function init(param1:DisplayObjectContainer, param2:Object, param3:Function = null, param4:int = 450, param5:int = 275) : void
{
_popupLayer = param1;
_lastClickedShardTarget = null;
_closeCallback = param3;
_availShards = [];
_numBuddies = [];
_languageIds = [];
_popuplation = [];
_nameIdx = 0;
_serverAllContent = GETDEFINITIONBYNAME("ServerAllPopupContent");
_serverAllPopup = new SBPopup(_popupLayer,GETDEFINITIONBYNAME("ServerAllPopupSkin"),_serverAllContent,true,true,false,false,true);
_serverAllPopup.bxClosesPopup = false;
_serverAllPopup.x = param4;
_serverAllPopup.y = param5;
DarkenManager.showLoadingSpiral(true);
MovieClip(_serverAllPopup.content).helpNameBtn.visible = false;
fillNamesArray();
SBTracker.trackPageview("/game/play/shardDetail");
addListeners();
}
public static function isOpen() : Boolean
{
if(_serverAllPopup)
{
return _serverAllPopup.visible;
}
return false;
}
public static function destroy() : void
{
removeListeners();
if(_itemWindows)
{
_itemWindows.destroy();
_itemWindows = null;
}
if(_serverAllPopup)
{
_serverAllPopup.x = undefined;
_serverAllPopup.y = undefined;
_serverAllPopup.destroy();
_serverAllPopup = null;
}
_closeCallback = null;
}
public static function setupAllShards(param1:Object, param2:int) : void
{
var _loc5_:Boolean = false;
var _loc6_:int = 0;
var _loc10_:int = 0;
var _loc11_:int = 0;
var _loc3_:* = 0;
var _loc4_:int = 0;
var _loc7_:int = -1;
var _loc8_:int = 0;
var _loc9_:int = LocalizationManager.accountLanguage;
_availShards = [];
_languageIds = [];
_popuplation = [];
_numBuddies = [];
while(param1[_loc3_] != null)
{
_loc5_ = param1[_loc3_ + 2] == 0;
if(_loc5_)
{
_loc8_++;
}
if(_loc5_ && _loc8_ > 5)
{
if(_loc7_ == -1)
{
_loc7_ = int(param1[_loc3_]);
}
_loc3_ += 4;
}
else
{
_availShards[_loc4_] = param1[_loc3_++];
_languageIds[_loc4_] = param1[_loc3_++];
_loc6_ += int(param1[_loc3_]);
_popuplation[_loc4_] = param1[_loc3_++];
_numBuddies[_loc4_] = param1[_loc3_++];
_loc4_++;
}
}
if(_loc6_ >= _availShards.length * 4 && _loc4_ < _serverNames.length)
{
if(_loc7_ == -1)
{
_loc10_ = param2 + 1;
_loc11_ = _loc9_;
}
else
{
_loc10_ = _loc7_;
_loc11_ = int(_languageIds[_loc7_]);
}
_availShards.splice(0,0,String(_loc10_));
_languageIds.splice(0,0,String(_loc11_));
_popuplation.splice(0,0,String(0));
_numBuddies.splice(0,0,String(0));
}
createServerButtons();
}
public static function getShardName(param1:int) : String
{
var _loc2_:int = param1 - 1;
if(Boolean(_serverNames) && 0 <= _loc2_)
{
return LocalizationManager.translateIdOnly(_serverNames[_loc2_ % _serverNames.length]);
}
return "Nullandria" + param1;
}
public static function fillNamesArray(param1:Boolean = false) : void
{
if(_serverNames == null || _serverNames.length == 0)
{
GenericListXtCommManager.requestGenericList(16,onShardNamesCallback,null,param1);
}
else
{
RoomXtCommManager.sendMoreShardRequest();
}
}
public static function updatePopulationForRoomFullError() : void
{
if(_lastClickedShardTarget)
{
_lastClickedShardTarget.population = "4";
}
}
private static function setupMoreServers(param1:MovieClip) : void
{
var _loc3_:int = 0;
var _loc2_:int = (_availShards[_nameIdx] - 1) % _serverNames.length;
if(_loc2_ < _serverNames.length)
{
LocalizationManager.translateId(param1.textField,_serverNames[_loc2_]);
if(_numBuddies[param1.index] > 0)
{
param1.buddy = true;
}
else
{
param1.buddy = false;
}
_loc3_ = int(_languageIds[param1.index]);
if(_loc3_ == LocalizationManager.LANG_ENG)
{
_loc3_ = LocalizationManager.LANG_BLANK;
}
param1.flag = _loc3_ + 1;
if(_popuplation[param1.index] > 0)
{
param1.population = _popuplation[param1.index];
}
else
{
param1.population = "0";
}
++_nameIdx;
return;
}
_nameIdx = 0;
setupMoreServers(param1);
}
private static function createServerButtons() : void
{
var _loc5_:MovieClip = null;
if(_scrollButtons)
{
_scrollButtons.destroy();
_scrollButtons = null;
}
if(Boolean(_itemWindows) && _itemWindows.numChildren > 0)
{
_itemWindows.destroy();
_itemWindows = null;
}
var _loc1_:int = int(_availShards.length);
var _loc2_:int = Math.min(_loc1_,2);
var _loc3_:int = Math.min(_loc1_,NUM_Y_WIN);
_itemWindows = new WindowGenerator();
_itemWindows.init(_loc2_,_loc3_,_loc1_,20,8,10,ItemWindowServer,null,"",{"mouseDown":winMouseDown},null,null,false,false);
_serverAllContent.itemBlock.addChild(_itemWindows);
_itemWindows.x = 0;
_itemWindows.y = 0;
_nameIdx = 0;
var _loc4_:int = 0;
while(_loc4_ < _loc1_)
{
_loc5_ = MovieClip(_itemWindows.bg.getChildAt(_loc4_));
setupMoreServers(_loc5_);
_loc4_++;
}
_scrollButtons = new SBScrollbar();
_scrollButtons.init(_itemWindows,_serverAllContent.itemBlock.width - 31,_itemWindows.boxHeight * NUM_Y_WIN + 8 * NUM_Y_WIN,0,"scrollbar2",_itemWindows.boxHeight + 8);
DarkenManager.showLoadingSpiral(false);
}
private static function winMouseDown(param1:MouseEvent) : void
{
param1.stopPropagation();
DarkenManager.showLoadingSpiral(true);
_lastClickedShardTarget = param1.currentTarget;
if(param1.currentTarget.full)
{
if(_closeCallback != null)
{
_closeCallback(_availShards[param1.currentTarget.index]);
}
}
else if(_closeCallback != null)
{
_closeCallback(_availShards[param1.currentTarget.index]);
}
}
private static function onShardNamesCallback(param1:int, param2:Array) : void
{
_serverNames = param2;
}
private static function onCloseBtn(param1:MouseEvent) : void
{
destroy();
}
private static function onNamesBtn(param1:MouseEvent) : void
{
param1.stopPropagation();
FeedbackManager.openFeedbackPopup(FeedbackManager.TYPE_SERVERS);
}
private static function addListeners() : void
{
_serverAllPopup.skin.s["bx"].addEventListener(MouseEvent.MOUSE_DOWN,onCloseBtn,false,0,true);
}
private static function removeListeners() : void
{
_serverAllPopup.skin.s["bx"].removeEventListener(MouseEvent.MOUSE_DOWN,onCloseBtn);
}
}
}
@@ -0,0 +1,74 @@
package gui
{
public class SharedAvatarAnimalConstants
{
public static const AV_TIGER:int = 1;
public static const AV_EAGLE:int = 2;
public static const AV_DEER:int = 3;
public static const AV_WOLF:int = 4;
public static const AV_KOALA:int = 5;
public static const AV_PANDA:int = 6;
public static const AV_MONKEY:int = 7;
public static const AV_BUNNY:int = 8;
public static const AV_HYENA:int = 9;
public static const AV_OTTER:int = 10;
public static const AV_POLAR_BEAR:int = 11;
public static const AV_OWL:int = 12;
public static const AV_RHINO:int = 13;
public static const AV_LLAMA:int = 14;
public static const AV_CROC:int = 15;
public static const AV_ELEPHANT:int = 16;
public static const AV_LION:int = 17;
public static const AV_SEAL:int = 18;
public static const AV_DOLPHIN:int = 19;
public static const AV_SHARK:int = 20;
public static const AV_OCTOPUS:int = 21;
public static const AV_TURTLE:int = 22;
public static const AV_HORSE:int = 23;
public static const AV_PENGUIN:int = 24;
public static const AV_FOX:int = 25;
public static const AV_GIRAFFE:int = 26;
public static const AV_KANGAROO:int = 27;
public static const AV_ARCTIC_WOLF:int = 28;
public static const AV_SNOW_LEOPARD:int = 29;
public static const AV_RACCOON:int = 30;
public static const AV_CHEETAH:int = 31;
public function SharedAvatarAnimalConstants()
{
super();
}
}
}
Loaded 100 of 7925 files, more files were not shown because too many files have changed in this diff. Show more