mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-20 09:37:50 -05:00
Brought up to date with the private repository (feea4c7)
This commit is contained in:
1 parent
1aa738d692
commit
1b1df1ae48
7925 files changed
+2617237
-20
No files matched your search
@@ -0,0 +1,402 @@
|
||||
package gui
|
||||
{
|
||||
import achievement.Achievement;
|
||||
import achievement.AchievementManager;
|
||||
import achievement.AchievementXtCommManager;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormat;
|
||||
import gui.itemWindows.ItemWindowWithSeparators;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class AchievementViewer
|
||||
{
|
||||
|
||||
private var _achievementMediaHelper:MediaHelper;
|
||||
|
||||
private var _achievementPopupContent:MovieClip;
|
||||
|
||||
private var _itemWindows:WindowAndScrollbarGenerator;
|
||||
|
||||
private var _sectionItemWindows:Array;
|
||||
|
||||
private var _myAchievementsIndexed:Array;
|
||||
|
||||
private var _myAchievements:Array;
|
||||
|
||||
private var _allAchievementsIndexed:Object;
|
||||
|
||||
private var _xPos:int;
|
||||
|
||||
private var _yPos:int;
|
||||
|
||||
private var _numAchievementsLastDrawn:int;
|
||||
|
||||
private var _hasBeenInited:Boolean;
|
||||
|
||||
private var _loadingSpiral:LoadingSpiral;
|
||||
|
||||
private var _parent:MovieClip;
|
||||
|
||||
public function AchievementViewer()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:int, param2:int, param3:MovieClip, param4:int = -1, param5:Boolean = false) : void
|
||||
{
|
||||
_myAchievements = [];
|
||||
_myAchievementsIndexed = [];
|
||||
_xPos = param1;
|
||||
_yPos = param2;
|
||||
_parent = param3;
|
||||
if(!gMainFrame.userInfo.playerUserInfo.achievementsIndexed)
|
||||
{
|
||||
AchievementXtCommManager.requestAchievements(gMainFrame.userInfo.playerUserInfo.userName,achievementListCallback);
|
||||
if(_loadingSpiral)
|
||||
{
|
||||
_loadingSpiral.visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_myAchievementsIndexed = gMainFrame.userInfo.playerUserInfo.achievementsIndexed;
|
||||
_myAchievements = gMainFrame.userInfo.playerUserInfo.achievements;
|
||||
}
|
||||
if(param4 != -1 && _achievementPopupContent == null)
|
||||
{
|
||||
_achievementMediaHelper = new MediaHelper();
|
||||
_achievementMediaHelper.init(param4,mediaHelperCallback,param5);
|
||||
}
|
||||
else
|
||||
{
|
||||
_achievementPopupContent.x = 0;
|
||||
_achievementPopupContent.y = 0;
|
||||
}
|
||||
if(_achievementPopupContent)
|
||||
{
|
||||
open();
|
||||
_hasBeenInited = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(_achievementMediaHelper)
|
||||
{
|
||||
_achievementMediaHelper.destroy();
|
||||
}
|
||||
if(_itemWindows)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
if(_myAchievementsIndexed)
|
||||
{
|
||||
_myAchievementsIndexed = null;
|
||||
}
|
||||
if(_achievementPopupContent)
|
||||
{
|
||||
removeEventListeners();
|
||||
DarkenManager.unDarken(_achievementPopupContent);
|
||||
_parent.removeChild(_achievementPopupContent);
|
||||
_achievementPopupContent.visible = false;
|
||||
_achievementPopupContent = null;
|
||||
}
|
||||
_hasBeenInited = false;
|
||||
_parent.trophy.downToUpState();
|
||||
}
|
||||
|
||||
public function loadMedia(param1:int, param2:MovieClip) : void
|
||||
{
|
||||
if(param1 != 0)
|
||||
{
|
||||
_parent = param2;
|
||||
_achievementMediaHelper = new MediaHelper();
|
||||
_achievementMediaHelper.init(param1,initMediaCallback);
|
||||
}
|
||||
}
|
||||
|
||||
public function open() : void
|
||||
{
|
||||
_myAchievementsIndexed = gMainFrame.userInfo.playerUserInfo.achievementsIndexed;
|
||||
_myAchievements = gMainFrame.userInfo.playerUserInfo.achievements;
|
||||
if(_myAchievements && _numAchievementsLastDrawn < _myAchievements.length)
|
||||
{
|
||||
createWindows();
|
||||
_achievementPopupContent.counterTxt.text = _myAchievements.length;
|
||||
}
|
||||
_achievementPopupContent.parent.setChildIndex(_achievementPopupContent,_achievementPopupContent.parent.numChildren - 1);
|
||||
_achievementPopupContent.visible = true;
|
||||
DarkenManager.darken(_achievementPopupContent);
|
||||
}
|
||||
|
||||
public function close() : void
|
||||
{
|
||||
_parent.trophy.downToUpState();
|
||||
_achievementPopupContent.visible = false;
|
||||
DarkenManager.unDarken(_achievementPopupContent);
|
||||
}
|
||||
|
||||
public function get visible() : Boolean
|
||||
{
|
||||
if(_achievementPopupContent)
|
||||
{
|
||||
return _achievementPopupContent.visible;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get hasBeenInited() : Boolean
|
||||
{
|
||||
return _hasBeenInited;
|
||||
}
|
||||
|
||||
private function addAchievementCallback(param1:Array) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < param1.length)
|
||||
{
|
||||
_myAchievementsIndexed[_loc2_] = param1[_loc2_].image;
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function initMediaCallback(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_achievementPopupContent = MovieClip(param1.getChildAt(0));
|
||||
_achievementPopupContent.counterTxt.text = "";
|
||||
_parent.addChild(_achievementPopupContent);
|
||||
addEventListeners();
|
||||
_achievementPopupContent.visible = false;
|
||||
_loadingSpiral = new LoadingSpiral(_achievementPopupContent.itemBlockAll,_achievementPopupContent.itemBlockAll.width * 0.5,_achievementPopupContent.itemBlockAll.height * 0.5);
|
||||
_loadingSpiral.visible = false;
|
||||
_achievementMediaHelper.destroy();
|
||||
_achievementMediaHelper = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function mediaHelperCallback(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_achievementPopupContent = MovieClip(param1.getChildAt(0));
|
||||
_achievementPopupContent.x = 0;
|
||||
_achievementPopupContent.y = 0;
|
||||
_achievementPopupContent.counterTxt.text = "";
|
||||
_parent.addChild(_achievementPopupContent);
|
||||
addEventListeners();
|
||||
DarkenManager.darken(_achievementPopupContent);
|
||||
_loadingSpiral = new LoadingSpiral(_achievementPopupContent.itemBlockAll,_achievementPopupContent.itemBlockAll.width * 0.5,_achievementPopupContent.itemBlockAll.height * 0.5);
|
||||
_loadingSpiral.visible = false;
|
||||
if(param1.passback)
|
||||
{
|
||||
_achievementPopupContent.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_achievementPopupContent.counterTxt.text = _myAchievements.length;
|
||||
createWindows();
|
||||
_hasBeenInited = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function achievementListCallback(param1:Array, param2:Array) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_myAchievements = param1;
|
||||
_myAchievementsIndexed = param2;
|
||||
if(_achievementPopupContent)
|
||||
{
|
||||
_achievementPopupContent.counterTxt.text = _myAchievements.length;
|
||||
createWindows(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function createWindows(param1:Boolean = false) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc14_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc11_:MovieClip = null;
|
||||
var _loc6_:TextField = null;
|
||||
var _loc12_:Object = null;
|
||||
var _loc13_:int = 0;
|
||||
var _loc5_:WindowAndScrollbarGenerator = null;
|
||||
if(_itemWindows)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
_numAchievementsLastDrawn = _myAchievements.length;
|
||||
var _loc7_:Array = SbiConstants.ACHIEVEMENT_TYPE_NAMES;
|
||||
var _loc8_:Array = AchievementManager.typeNamesTranslatedAndSorted;
|
||||
_allAchievementsIndexed = AchievementManager.getAllAchievementsIndexed();
|
||||
_sectionItemWindows = [];
|
||||
var _loc2_:TextFormat = (_achievementPopupContent.titleTxt as TextField).getTextFormat();
|
||||
_loc2_.size = 22;
|
||||
var _loc9_:int = int(_achievementPopupContent.itemBlockAll.width);
|
||||
var _loc10_:int = int(_achievementPopupContent.itemBlockAll.height);
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc8_.length)
|
||||
{
|
||||
_loc12_ = _loc8_[_loc4_];
|
||||
_loc13_ = int(_allAchievementsIndexed[_loc12_.typeIndex].length);
|
||||
_loc14_ = Math.min(_loc13_,6);
|
||||
_loc3_ = Math.ceil(_loc14_ / 5);
|
||||
_loc11_ = new MovieClip();
|
||||
_loc6_ = new TextField();
|
||||
_loc6_.autoSize = "left";
|
||||
_loc6_.defaultTextFormat = _loc2_;
|
||||
_loc6_.embedFonts = true;
|
||||
_loc6_.antiAliasType = "advanced";
|
||||
_loc6_.setTextFormat(_loc2_);
|
||||
_loc6_.text = _loc12_.name;
|
||||
_loc11_.addChild(_loc6_);
|
||||
_loc5_ = new WindowAndScrollbarGenerator();
|
||||
_loc5_.init(_loc9_,_loc10_,0,0,1,1,0,0,0,5,0,ItemWindowWithSeparators,[_loc11_],"",0,null,null,null,true,false,false,true);
|
||||
_sectionItemWindows.push(_loc5_);
|
||||
_loc5_ = new WindowAndScrollbarGenerator();
|
||||
_loc5_.init(_loc9_,_loc10_,0,0,_loc14_,_loc3_,0,0,0,0,0,ItemWindowWithSeparators,_allAchievementsIndexed[_loc12_.typeIndex],"image",0,{
|
||||
"mouseOver":winMouseOver,
|
||||
"mouseOut":winMouseOut,
|
||||
"mouseDown":winMouseDown
|
||||
},{
|
||||
"itemClassName":"awardCont",
|
||||
"secondaryIndex":_loc4_ * 2 + 1,
|
||||
"myAchievementsByType":_myAchievementsIndexed[_loc12_.typeIndex]
|
||||
},null,true,false,false,true);
|
||||
_sectionItemWindows.push(_loc5_);
|
||||
_loc4_++;
|
||||
}
|
||||
_itemWindows = new WindowAndScrollbarGenerator();
|
||||
_itemWindows.init(_loc9_,_loc10_ - 8,0,0,1,_sectionItemWindows.length,0,0,0,0,0,ItemWindowWithSeparators,_sectionItemWindows,"");
|
||||
_itemWindows.y += 4;
|
||||
_achievementPopupContent.itemBlockAll.addChild(_itemWindows);
|
||||
selectAchievement(_sectionItemWindows[1].mediaWindows[0].currItemType,0);
|
||||
if(param1)
|
||||
{
|
||||
_loadingSpiral.visible = false;
|
||||
}
|
||||
if(_loadingSpiral)
|
||||
{
|
||||
_loadingSpiral.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function selectAchievement(param1:int, param2:int) : void
|
||||
{
|
||||
var _loc4_:Achievement = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc5_:Object = null;
|
||||
var _loc3_:Array = null;
|
||||
var _loc7_:int = 0;
|
||||
if(_allAchievementsIndexed[param1] && _allAchievementsIndexed[param1][param2])
|
||||
{
|
||||
while(_achievementPopupContent.itemBlockSingle.numChildren > 1)
|
||||
{
|
||||
_achievementPopupContent.itemBlockSingle.removeChildAt(_achievementPopupContent.itemBlockSingle.numChildren - 1);
|
||||
}
|
||||
_loc4_ = _allAchievementsIndexed[param1][param2].clone();
|
||||
LocalizationManager.updateToFit(_achievementPopupContent.achNameTxt,_loc4_.name);
|
||||
_loc6_ = Math.max(0,gMainFrame.userInfo.userVarCache.getUserVarValueById(_loc4_.userVarId));
|
||||
_loc5_ = AchievementManager.getAchievementDef(_loc4_.defId);
|
||||
if(_loc6_ == 0)
|
||||
{
|
||||
_loc3_ = _myAchievementsIndexed[param1];
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc3_.length)
|
||||
{
|
||||
if(_loc3_[_loc7_].defId == _loc4_.defId)
|
||||
{
|
||||
_loc6_ = 1;
|
||||
break;
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_loc6_ > _loc5_.triggeredAmount)
|
||||
{
|
||||
_loc6_ = int(_loc5_.triggeredAmount);
|
||||
}
|
||||
_achievementPopupContent.progressMeter.normalBar.width = (1 - _loc6_ / _loc5_.triggeredAmount) * _achievementPopupContent.progressMeter.greenBar.width;
|
||||
_achievementPopupContent.progressTxt.text = _loc6_ + "/" + _loc5_.triggeredAmount;
|
||||
_loc4_.setScale(2);
|
||||
_achievementPopupContent.itemBlockSingle.addChild(_loc4_.image);
|
||||
LocalizationManager.updateToFit(_achievementPopupContent.descText,_loc4_.descr);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopupDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
close();
|
||||
}
|
||||
|
||||
private function winMouseOver(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:Achievement = _allAchievementsIndexed[param1.currentTarget.currItemType][param1.currentTarget.index];
|
||||
GuiManager.toolTip.init(_achievementPopupContent.itemBlockAll,_loc2_.name,0,0);
|
||||
GuiManager.toolTip.startTimer(param1);
|
||||
var _loc3_:int = param1.currentTarget.y + (_itemWindows.mediaWindows[param1.currentTarget.secondaryIndex].y - _itemWindows.scrollYValue);
|
||||
if(_loc2_.baseImageMediaId == Achievement.BASE_RIBBON_ID)
|
||||
{
|
||||
_loc3_ += 42;
|
||||
}
|
||||
else if(_loc2_.baseImageMediaId == Achievement.BASE_MEDAL_ID)
|
||||
{
|
||||
_loc3_ += 56;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ += 57;
|
||||
}
|
||||
var _loc5_:int = param1.currentTarget.x + param1.currentTarget.width * 0.5;
|
||||
var _loc4_:Number = GuiManager.toolTip.width * 0.5 - _loc5_;
|
||||
if(_loc4_ > 15)
|
||||
{
|
||||
_loc5_ += _loc4_ - 15;
|
||||
}
|
||||
GuiManager.toolTip.setPos(_loc5_,_loc3_);
|
||||
}
|
||||
|
||||
private function winMouseDown(param1:MouseEvent) : void
|
||||
{
|
||||
selectAchievement(param1.currentTarget.currItemType,param1.currentTarget.index);
|
||||
}
|
||||
|
||||
private function winMouseOut(param1:MouseEvent) : void
|
||||
{
|
||||
GuiManager.toolTip.resetTimerAndSetVisibility();
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_achievementPopupContent.addEventListener("mouseDown",onPopupDownHandler,false,0,true);
|
||||
_achievementPopupContent.bx.addEventListener("mouseDown",onClose,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_achievementPopupContent.removeEventListener("mouseDown",onPopupDownHandler);
|
||||
_achievementPopupContent.bx.removeEventListener("mouseDown",onClose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,641 @@
|
||||
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 gui.itemWindows.ItemWindowGame;
|
||||
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(setActionCallback != null)
|
||||
{
|
||||
throw new Error("ERROR: Singleton ActionManager did not expect to be created twice!");
|
||||
}
|
||||
setActionCallback = param1;
|
||||
actionBtn = param2;
|
||||
actionBtn.addEventListener("mouseDown",actionBtnDownHandler,false,0,true);
|
||||
actionWindow = param3;
|
||||
_gameTab = param3.hudGameTab;
|
||||
_gameTab.gameCancelTabBtn.visible = false;
|
||||
if(Utility.canPVP())
|
||||
{
|
||||
_gameTab.gameTabBtn.addEventListener("mouseDown",onGameTab,false,0,true);
|
||||
_gameTab.gameCancelTabBtn.addEventListener("mouseDown",onCancelGameTab,false,0,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gameTab.gameTabBtn.activateGrayState(true);
|
||||
}
|
||||
LocalizationManager.translateId(_gameTab.buddyGamesTxt,6285);
|
||||
addAllActions();
|
||||
actionWindow.addChild(_actions);
|
||||
actionWindow.addChild(_petActions);
|
||||
_petActions.visible = false;
|
||||
actionWindow.poseBtns = _actions.poseBtns;
|
||||
actionWindow.diveBtn = _actions.diveBtn;
|
||||
actionWindow.swirlBtn = _actions.swirlBtn;
|
||||
actionWindow.sitBtns = _actions.sitBtns;
|
||||
actionWindow.visible = false;
|
||||
emoteBtn = param4;
|
||||
emoteWindow = param5;
|
||||
safeChatBtn = param6;
|
||||
safeChatTree = param7;
|
||||
setupTitleBanner();
|
||||
}
|
||||
|
||||
public function turnOnOceanActions(param1:Boolean) : void
|
||||
{
|
||||
actionWindow.poseBtns.visible = param1;
|
||||
actionWindow.diveBtn.visible = param1;
|
||||
actionWindow.swirlBtn.visible = param1;
|
||||
actionWindow.sitBtns.visible = !param1;
|
||||
}
|
||||
|
||||
public function turnOnPetActions(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_petActions.visible = true;
|
||||
_actions.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_petActions.visible = false;
|
||||
_actions.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function grayGameTab(param1:Boolean) : void
|
||||
{
|
||||
_gameTab.gameTabBtn.activateGrayState(param1);
|
||||
}
|
||||
|
||||
public function reload(param1:MovieClip, param2:MovieClip, param3:MovieClip, param4:Sprite, param5:MovieClip, param6:MovieClip, param7:Function) : void
|
||||
{
|
||||
setActionCallback = param7;
|
||||
if(actionBtn)
|
||||
{
|
||||
actionBtn.removeEventListener("mouseDown",actionBtnDownHandler);
|
||||
}
|
||||
actionBtn = param1;
|
||||
actionBtn.addEventListener("mouseDown",actionBtnDownHandler,false,0,true);
|
||||
while(actionWindow.numChildren > 2)
|
||||
{
|
||||
actionWindow.removeChildAt(actionWindow.numChildren - 1);
|
||||
}
|
||||
actionWindow = param2;
|
||||
_gameTab = param2.hudGameTab;
|
||||
if(_gameTab)
|
||||
{
|
||||
_gameTab.gameCancelTabBtn.visible = false;
|
||||
_gameTab.visible = !MinigameManager.inMinigame();
|
||||
if(Utility.canPVP())
|
||||
{
|
||||
_gameTab.gameTabBtn.addEventListener("mouseDown",onGameTab,false,0,true);
|
||||
_gameTab.gameCancelTabBtn.addEventListener("mouseDown",onCancelGameTab,false,0,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gameTab.gameTabBtn.activateGrayState(true);
|
||||
}
|
||||
LocalizationManager.translateId(_gameTab.buddyGamesTxt,6285);
|
||||
setupTitleBanner();
|
||||
}
|
||||
addAllActions();
|
||||
actionWindow.addChild(_actions);
|
||||
actionWindow.addChild(_petActions);
|
||||
_petActions.visible = false;
|
||||
actionWindow.poseBtns = _actions.poseBtns;
|
||||
actionWindow.diveBtn = _actions.diveBtn;
|
||||
actionWindow.swirlBtn = _actions.swirlBtn;
|
||||
actionWindow.sitBtns = _actions.sitBtns;
|
||||
actionWindow.visible = false;
|
||||
emoteBtn = param3;
|
||||
emoteWindow = param4;
|
||||
actionWindow = param2;
|
||||
safeChatBtn = param5;
|
||||
safeChatTree = param6;
|
||||
actionBtn.downToUpState();
|
||||
}
|
||||
|
||||
private function addAllActions() : void
|
||||
{
|
||||
var _loc14_:* = 0;
|
||||
_loc14_ = 10;
|
||||
var _loc11_:* = 0;
|
||||
_loc11_ = 25;
|
||||
var _loc13_:* = 0;
|
||||
_loc13_ = 40;
|
||||
var _loc5_:* = 0;
|
||||
_loc5_ = 91;
|
||||
var _loc2_:* = 0;
|
||||
_loc2_ = 2;
|
||||
var _loc1_:Number = NaN;
|
||||
_loc1_ = -72;
|
||||
var _loc4_:Number = NaN;
|
||||
_loc4_ = -50;
|
||||
var _loc10_:Number = NaN;
|
||||
_loc10_ = -88;
|
||||
var _loc15_:int = 0;
|
||||
_loc15_ = 4;
|
||||
var _loc16_:int = 0;
|
||||
_loc16_ = 2;
|
||||
var _loc7_:int = 0;
|
||||
_loc7_ = 8;
|
||||
var _loc6_:* = 0;
|
||||
var _loc3_:Sprite = null;
|
||||
var _loc12_:Sprite = null;
|
||||
var _loc8_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
_actions = new MovieClip();
|
||||
_petActions = new MovieClip();
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < actionSprites.length)
|
||||
{
|
||||
if(_loc6_ < 8)
|
||||
{
|
||||
_loc3_ = GETDEFINITIONBYNAME(_loc6_ < 4 ? "sitBtns" : actionSprites[_loc6_]);
|
||||
if(_loc6_ == 0)
|
||||
{
|
||||
_loc3_.x = actionWindow.ba.width * 0.5 + -72 - 25 - 5;
|
||||
_loc3_.y = 10 + Math.floor(_loc6_ / 2) * 40 + -50;
|
||||
_actions.addChild(_loc3_);
|
||||
_actions.sitBtns = _loc3_;
|
||||
_loc8_ = 1;
|
||||
while(_loc8_ <= 4)
|
||||
{
|
||||
_loc12_ = _loc3_["sit" + _loc8_ + "Btn"];
|
||||
_loc12_.buttonMode = true;
|
||||
_loc12_.useHandCursor = true;
|
||||
_loc12_.tabEnabled = true;
|
||||
_loc12_.tabChildren = false;
|
||||
_loc12_.addEventListener("mouseDown",actionClickHandler,false,0,true);
|
||||
_loc8_++;
|
||||
}
|
||||
}
|
||||
else if(_loc6_ >= 4)
|
||||
{
|
||||
_loc3_.x = 25 + (_loc6_ % 2 * 91 + -72);
|
||||
_loc3_.y = 10 + Math.floor(_loc6_ / 2) * 40 + -88;
|
||||
_actions.addChild(_loc3_);
|
||||
_loc3_.buttonMode = true;
|
||||
_loc3_.useHandCursor = true;
|
||||
_loc3_.tabEnabled = true;
|
||||
_loc3_.tabChildren = false;
|
||||
_loc3_.addEventListener("mouseDown",actionClickHandler,false,0,true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = GETDEFINITIONBYNAME(_loc6_ == 8 ? "poseBtns" : actionSprites[_loc6_]);
|
||||
if(_loc6_ == 8)
|
||||
{
|
||||
_loc3_.visible = false;
|
||||
_actions.poseBtns = _loc3_;
|
||||
_loc3_.x = actionWindow.ba.width * 0.5 + -72 - 25 - 5;
|
||||
_loc3_.y = 10 + Math.floor((_loc6_ - 8) / 2) * 40 + -50;
|
||||
_actions.addChild(_loc3_);
|
||||
_loc9_ = 1;
|
||||
while(_loc9_ <= 2)
|
||||
{
|
||||
_loc12_ = _loc3_["pose" + _loc9_ + "Btn"];
|
||||
_loc12_.buttonMode = true;
|
||||
_loc12_.useHandCursor = true;
|
||||
_loc12_.tabEnabled = true;
|
||||
_loc12_.tabChildren = false;
|
||||
_loc12_.addEventListener("mouseDown",actionClickHandler,false,0,true);
|
||||
_loc9_++;
|
||||
}
|
||||
}
|
||||
else if(_loc6_ >= 8 + 2)
|
||||
{
|
||||
_loc3_.visible = false;
|
||||
if(_loc6_ == actionSprites.length - 1)
|
||||
{
|
||||
_actions.diveBtn = _loc3_;
|
||||
}
|
||||
else
|
||||
{
|
||||
_actions.swirlBtn = _loc3_;
|
||||
}
|
||||
_loc3_.x = 25 + ((_loc6_ - 5) % 2 * 91 + -72);
|
||||
_loc3_.y = 10 + Math.floor((_loc6_ - 5) / 2) * 40 + -88;
|
||||
_actions.addChild(_loc3_);
|
||||
_loc3_.buttonMode = true;
|
||||
_loc3_.useHandCursor = true;
|
||||
_loc3_.tabEnabled = true;
|
||||
_loc3_.tabChildren = false;
|
||||
_loc3_.addEventListener("mouseDown",actionClickHandler,false,0,true);
|
||||
}
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
_loc3_ = GETDEFINITIONBYNAME("playPetAnim_btnCont");
|
||||
_loc3_.y = -31;
|
||||
_loc3_.buttonMode = true;
|
||||
_loc3_.useHandCursor = true;
|
||||
_loc3_.tabEnabled = true;
|
||||
_loc3_.tabChildren = false;
|
||||
_loc3_.addEventListener("mouseDown",onPetPlayBtn,false,0,true);
|
||||
_petActions.addChild(_loc3_);
|
||||
_loc3_ = GETDEFINITIONBYNAME("dancePetAnim_btnCont");
|
||||
_petActions.danceBtn = _loc3_;
|
||||
_loc3_.y = 31;
|
||||
_loc3_.buttonMode = true;
|
||||
_loc3_.useHandCursor = true;
|
||||
_loc3_.tabEnabled = true;
|
||||
_loc3_.tabChildren = false;
|
||||
_loc3_.addEventListener("mouseDown",actionClickHandler,false,0,true);
|
||||
_petActions.addChild(_loc3_);
|
||||
actionStrings = {};
|
||||
actionStrings["sit1BtnCont"] = actionStrings["pose1BtnCont"] = [":sitNW:",":poseLeft:"];
|
||||
actionStrings["sit2BtnCont"] = [":sitNE:"];
|
||||
actionStrings["sit3BtnCont"] = [":sitSE:"];
|
||||
actionStrings["sit4BtnCont"] = actionStrings["pose2BtnCont"] = [":sitSW:",":poseRight:"];
|
||||
actionStrings["danceAnim_btnCont"] = actionStrings["dancePetAnim_btnCont"] = [":dance:"];
|
||||
actionStrings["sleepAnim_btnCont"] = actionStrings["diveAnim_btnCont"] = [":sleep:",":dive:"];
|
||||
actionStrings["hopAnim_btnCont"] = actionStrings["swirlAnim_btnCont"] = [":hop:",":swirl:"];
|
||||
actionStrings["playAnim_btnCont"] = [":play:"];
|
||||
}
|
||||
|
||||
private function setupTitleBanner() : void
|
||||
{
|
||||
var _loc1_:Sprite = GETDEFINITIONBYNAME("AnimsTitleBanner");
|
||||
_loc1_.x = -91.75;
|
||||
_loc1_.y = -91.25;
|
||||
actionWindow.addChild(_loc1_);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
setActionCallback = null;
|
||||
actionBtn.removeEventListener("mouseDown",actionBtnDownHandler);
|
||||
actionBtn = null;
|
||||
actionWindow.visible = false;
|
||||
actionWindow = null;
|
||||
emoteBtn = null;
|
||||
emoteWindow = null;
|
||||
safeChatBtn = null;
|
||||
safeChatTree = null;
|
||||
}
|
||||
|
||||
public function getActionString(param1:Sprite) : String
|
||||
{
|
||||
var _loc2_:String = param1["constructor"].toString();
|
||||
var _loc3_:String = _loc2_.slice(7,_loc2_.length - 1);
|
||||
if(actionStrings[_loc3_])
|
||||
{
|
||||
if(actionStrings[_loc3_].length > 1)
|
||||
{
|
||||
return actionStrings[_loc2_.slice(7,_loc2_.length - 1)][AvatarManager.roomEnviroType == 0 ? 0 : 1];
|
||||
}
|
||||
return actionStrings[_loc2_.slice(7,_loc2_.length - 1)][0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function matchActionString(param1:String) : Sprite
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
for each(var _loc2_:String in actionSprites)
|
||||
{
|
||||
_loc3_ = int(actionStrings[_loc2_].indexOf(param1));
|
||||
if(_loc3_ != -1)
|
||||
{
|
||||
if(actionStrings[_loc2_].length <= 1)
|
||||
{
|
||||
return GETDEFINITIONBYNAME(_loc2_);
|
||||
}
|
||||
if(AvatarManager.roomEnviroType == 0 ? _loc3_ == 0 : _loc3_ == 1)
|
||||
{
|
||||
return GETDEFINITIONBYNAME(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function openActions() : void
|
||||
{
|
||||
if(!actionWindow.visible)
|
||||
{
|
||||
actionWindow.visible = true;
|
||||
brightenActions();
|
||||
}
|
||||
}
|
||||
|
||||
public function dimActions() : void
|
||||
{
|
||||
if(actionWindow.visible && actionWindow.alpha != 0.5)
|
||||
{
|
||||
actionWindow.alpha = 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
public function brightenActions() : void
|
||||
{
|
||||
if(actionWindow.alpha != 1)
|
||||
{
|
||||
actionWindow.alpha = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function closeActions() : void
|
||||
{
|
||||
if(actionWindow.visible)
|
||||
{
|
||||
actionWindow.visible = false;
|
||||
brightenActions();
|
||||
actionBtn.downToUpState();
|
||||
closeSideMenu(_gameTab);
|
||||
}
|
||||
}
|
||||
|
||||
public function hideCancelBtn() : void
|
||||
{
|
||||
if(_gameTab)
|
||||
{
|
||||
_gameTab.gameCancelTabBtn.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function grayOutPetDanceBtn(param1:Boolean) : void
|
||||
{
|
||||
if(_petActions)
|
||||
{
|
||||
_petActions.danceBtn.activateGrayState(param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function actionBtnDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
if(actionWindow.visible)
|
||||
{
|
||||
closeActions();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(safeChatTree.visible)
|
||||
{
|
||||
safeChatBtn.dispatchEvent(param1);
|
||||
}
|
||||
if(emoteWindow.visible)
|
||||
{
|
||||
emoteBtn.dispatchEvent(param1);
|
||||
}
|
||||
openActions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onGameTab(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
if(!_isGameTabOpen)
|
||||
{
|
||||
if(_pvpItemWindows == null)
|
||||
{
|
||||
_pvpGameList = MinigameManager.minigameInfoCache.getAllReadyForPvpGameDefs();
|
||||
createPVPWindows();
|
||||
getPVPIcons();
|
||||
}
|
||||
else
|
||||
{
|
||||
_gameTab.itemWindow.addChild(_pvpItemWindows);
|
||||
if(_pvpScrollBar)
|
||||
{
|
||||
_pvpScrollBar.destroy();
|
||||
}
|
||||
_pvpScrollBar = new SBScrollbar();
|
||||
_pvpScrollBar.init(_pvpItemWindows,155,156,3,"scrollbar2",78);
|
||||
}
|
||||
openSideMenu(_gameTab);
|
||||
}
|
||||
else
|
||||
{
|
||||
closeSideMenu(_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(!_isGameTabOpen)
|
||||
{
|
||||
new GTween(param1,0.5,{"x":param1.x + 175},{
|
||||
"ease":TweenManager.quadratic,
|
||||
"onComplete":sideMenuComplete
|
||||
});
|
||||
_sideMenuTweenFinished = false;
|
||||
_isGameTabOpen = true;
|
||||
AJAudio.playBuddyCardOpen();
|
||||
}
|
||||
}
|
||||
|
||||
private function closeSideMenu(param1:MovieClip) : void
|
||||
{
|
||||
if(_isGameTabOpen && _sideMenuTweenFinished)
|
||||
{
|
||||
new GTween(param1,0.5,{"x":param1.x - 175},{
|
||||
"ease":TweenManager.quadratic,
|
||||
"onComplete":sideMenuComplete
|
||||
});
|
||||
_sideMenuTweenFinished = false;
|
||||
_isGameTabOpen = false;
|
||||
AJAudio.playBuddyCardClose();
|
||||
}
|
||||
}
|
||||
|
||||
private function createPVPWindows() : void
|
||||
{
|
||||
if(_pvpScrollBar)
|
||||
{
|
||||
_pvpScrollBar.destroy();
|
||||
_pvpScrollBar = null;
|
||||
}
|
||||
if(_pvpItemWindows && _pvpItemWindows.numChildren > 0)
|
||||
{
|
||||
_pvpItemWindows.destroy();
|
||||
_pvpItemWindows = null;
|
||||
}
|
||||
var _loc1_:int = int(_pvpGameList.length);
|
||||
var _loc2_:int = Math.min(_loc1_,2);
|
||||
_pvpItemWindows = new WindowGenerator();
|
||||
_pvpItemWindows.init(_loc2_,_loc2_,_loc1_,2,2,0,ItemWindowGame,null,"",{
|
||||
"mouseDown":sideMenuMouseDown,
|
||||
"mouseOver":sideMenuMouseOver,
|
||||
"mouseOut":winMouseOut
|
||||
},null,null,false,false);
|
||||
_gameTab.itemWindow.addChild(_pvpItemWindows);
|
||||
_pvpScrollBar = new SBScrollbar();
|
||||
_pvpScrollBar.init(_pvpItemWindows,155,156,3,"scrollbar2",78,0,Math.ceil(_loc1_ / _loc2_) * 78);
|
||||
}
|
||||
|
||||
private function getPVPIcons() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:MediaHelper = null;
|
||||
_views = [];
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _pvpGameList.length)
|
||||
{
|
||||
_loc2_ = new MediaHelper();
|
||||
_loc2_.init(_pvpGameList[_loc1_].gameCardMediaId,mediaHelperCallback,true);
|
||||
_views[_loc1_] = _loc2_;
|
||||
_loc1_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function mediaHelperCallback(param1:MovieClip) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:MovieClip = null;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _views.length)
|
||||
{
|
||||
if(_views[_loc3_] == param1.mediaHelper)
|
||||
{
|
||||
_loc2_ = MovieClip(_pvpItemWindows.bg.getChildAt(_loc3_));
|
||||
_loc2_.itemLayer.addChild(param1);
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function sideMenuComplete(param1:GTween) : void
|
||||
{
|
||||
_sideMenuTweenFinished = true;
|
||||
}
|
||||
|
||||
private function sideMenuMouseDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(MinigameManager.minigameInfoCache.currMinigameId == _pvpGameList[param1.currentTarget.index].gameDefId)
|
||||
{
|
||||
UserCommXtCommManager.sendCustomPVPMessage(false,_pvpGameList[param1.currentTarget.index].gameDefId);
|
||||
MinigameManager.readySelfForCustomPVPGame(-1,"");
|
||||
_gameTab.gameCancelTabBtn.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
UserCommXtCommManager.sendCustomPVPMessage(true,_pvpGameList[param1.currentTarget.index].gameDefId);
|
||||
MinigameManager.readySelfForCustomPVPGame(_pvpGameList[param1.currentTarget.index].gameDefId,"");
|
||||
_gameTab.gameCancelTabBtn.visible = true;
|
||||
}
|
||||
closeActions();
|
||||
}
|
||||
|
||||
private function sideMenuMouseOver(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:Point = null;
|
||||
param1.stopPropagation();
|
||||
if(_sideMenuTweenFinished)
|
||||
{
|
||||
_loc2_ = param1.currentTarget.localToGlobal(new Point(0,0));
|
||||
GuiManager.toolTip.init(actionWindow,LocalizationManager.translateIdOnly(_pvpGameList[param1.currentTarget.index].titleStrId),_loc2_.x - actionWindow.x + actionWindow.hudGameTab.x + actionWindow.hudGameTab.itemWindow.x - param1.currentTarget.width,_loc2_.y - actionWindow.y + param1.currentTarget.height + _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(!actionBtn.isGray && !param1.currentTarget.isGray)
|
||||
{
|
||||
setActionCallback(new param1.currentTarget.constructor());
|
||||
actionBtn.dispatchEvent(new MouseEvent("mouseDown"));
|
||||
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);
|
||||
}
|
||||
}
|
||||
actionBtn.dispatchEvent(new MouseEvent("mouseDown"));
|
||||
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 const ADVENTURE_EXPERT_ID:int = 2288;
|
||||
|
||||
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;
|
||||
|
||||
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(2288,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 = 900 * 0.5;
|
||||
_difficultyPopup.y = 550 * 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(_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("diamondShop","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(_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("diamondShop","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("mouseDown",onPopup,false,0,true);
|
||||
_difficultyPopup.bx.addEventListener("mouseDown",onCloseBtn,false,0,true);
|
||||
_difficultyPopup.dModeCont.normalBtn.addEventListener("mouseDown",onDifficulty,false,0,true);
|
||||
_difficultyPopup.dModeCont.hardBtn.addEventListener("mouseDown",onDifficulty,false,0,true);
|
||||
_difficultyPopup.dModeCont.bx.addEventListener("mouseDown",onCloseModeCont,false,0,true);
|
||||
_difficultyPopup.joinBtn.addEventListener("mouseDown",onJoinTypeBtn,false,0,true);
|
||||
_difficultyPopup.hostBtn.addEventListener("mouseDown",onJoinTypeBtn,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
private static function removeEventListeners() : void
|
||||
{
|
||||
if(_difficultyPopup)
|
||||
{
|
||||
_difficultyPopup.removeEventListener("mouseDown",onPopup);
|
||||
_difficultyPopup.bx.removeEventListener("mouseDown",onCloseBtn);
|
||||
_difficultyPopup.dModeCont.normalBtn.removeEventListener("mouseDown",onDifficulty);
|
||||
_difficultyPopup.dModeCont.hardBtn.removeEventListener("mouseDown",onDifficulty);
|
||||
_difficultyPopup.dModeCont.bx.removeEventListener("mouseDown",onCloseModeCont);
|
||||
_difficultyPopup.joinBtn.removeEventListener("mouseDown",onJoinTypeBtn);
|
||||
_difficultyPopup.hostBtn.removeEventListener("mouseDown",onJoinTypeBtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,509 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.Avatar;
|
||||
import avatar.AvatarInfo;
|
||||
import avatar.AvatarManager;
|
||||
import avatar.AvatarUtility;
|
||||
import avatar.AvatarView;
|
||||
import avatar.AvatarXtCommManager;
|
||||
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
|
||||
{
|
||||
_savedParams = [];
|
||||
_scriptDef = QuestXtCommManager.getScriptDef(param1);
|
||||
_type = param2;
|
||||
_difficulty = param3;
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
_closeCallback = param4;
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(2249,onMediaLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
SBPopupManager.closeAll();
|
||||
TradeManager.closeAllTradingRelatedPopups();
|
||||
removeEventListeners();
|
||||
if(_bigPet)
|
||||
{
|
||||
_bigPet.destroy();
|
||||
_bigPet = null;
|
||||
}
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
if(_popup)
|
||||
{
|
||||
DarkenManager.unDarken(_popup);
|
||||
_guiLayer.removeChild(_popup);
|
||||
_popup = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function handleWaitResponse(param1:Object) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc6_:Avatar = null;
|
||||
var _loc8_:AvatarInfo = null;
|
||||
if(_popup && (_type == "normal" || _type == "custParty"))
|
||||
{
|
||||
_loc4_ = int(_scriptDef.avatarLimit);
|
||||
_loc5_ = 1;
|
||||
_loc2_ = 1;
|
||||
while(_loc2_ < _loc4_ + 1)
|
||||
{
|
||||
while(_numPlayersMC["p" + _loc2_].char.charLayer.numChildren > 0)
|
||||
{
|
||||
_numPlayersMC["p" + _loc2_].char.charLayer.removeChildAt(0);
|
||||
}
|
||||
_numPlayersMC["p" + _loc2_].char.gotoAndPlay("waiting");
|
||||
_numPlayersMC["p" + _loc2_].char.nameBar.lastName_txt.text = "";
|
||||
_loc2_++;
|
||||
}
|
||||
_loc7_ = 2;
|
||||
for(; _loc7_ < _loc4_ + 2; _loc7_++)
|
||||
{
|
||||
if(_loc7_ < param1.length)
|
||||
{
|
||||
_loc3_ = int(param1[_loc7_]);
|
||||
_numPlayersMC["p" + (_loc7_ - 1)].char.gotoAndPlay("up");
|
||||
_loc6_ = AvatarManager.getAvatarBySfsUserId(_loc3_);
|
||||
if(_loc6_)
|
||||
{
|
||||
_loc8_ = gMainFrame.userInfo.getAvatarInfoByUserName(_loc6_.userName);
|
||||
}
|
||||
if(_loc6_ == null || _loc8_ == null)
|
||||
{
|
||||
_savedParams[_loc3_] = _numPlayersMC["p" + (_loc7_ - 1)];
|
||||
AvatarXtCommManager.requestAvatarGetBySfsId(_loc3_,onAvatarGetReceived);
|
||||
continue;
|
||||
}
|
||||
setupAvatar(_numPlayersMC["p" + (_loc7_ - 1)],_loc6_,_loc8_.currPet);
|
||||
}
|
||||
else
|
||||
{
|
||||
_numPlayersMC["p" + (_loc7_ - 1)].char.gotoAndPlay("waiting");
|
||||
LocalizationManager.translateId(_numPlayersMC["p" + (_loc7_ - 1)].char.nameBar.firstName_txt,11101);
|
||||
_numPlayersMC["p" + (_loc7_ - 1)].char.nameBar.lastName_txt.text = "";
|
||||
}
|
||||
_numPlayersMC["p" + (_loc7_ - 1)].char.nameBar.visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_inParamsWaiting = param1;
|
||||
}
|
||||
}
|
||||
|
||||
private function setupAvatar(param1:MovieClip, param2:Avatar, param3:Object) : void
|
||||
{
|
||||
var _loc9_:GuiPet = null;
|
||||
var _loc7_:AvatarView = null;
|
||||
var _loc6_:Point = null;
|
||||
var _loc8_:String = null;
|
||||
var _loc10_:int = 0;
|
||||
var _loc4_:String = null;
|
||||
var _loc5_:String = null;
|
||||
if(_scriptDef.playAsPet)
|
||||
{
|
||||
_loc9_ = new GuiPet(0,param3.lBits,param3.uBits,param3.eBits,param3.type,param3.name,onBigPetLoaded);
|
||||
param1.char.charLayer.addChild(_loc9_);
|
||||
param1.char.nameBar.firstName_txt.text = _loc9_.petName;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc7_ = new AvatarView();
|
||||
_loc7_.init(param2);
|
||||
_loc7_.playAnim(15,false,0,null,true);
|
||||
_loc7_.scaleX = 0.7;
|
||||
_loc7_.scaleY = 0.7;
|
||||
_loc6_ = AvatarUtility.getAvatarMinigameLobbyOffset(_loc7_.avTypeId);
|
||||
_loc7_.x = _loc6_.x;
|
||||
_loc7_.y = _loc6_.y + 5;
|
||||
param1.char.charLayer.addChild(_loc7_);
|
||||
_loc8_ = param2.avName;
|
||||
_loc10_ = _loc8_.indexOf(" ");
|
||||
if(_loc10_ != -1)
|
||||
{
|
||||
_loc4_ = _loc8_.substr(0,_loc10_);
|
||||
_loc5_ = _loc8_.substr(_loc10_ + 1,_loc8_.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ = _loc8_;
|
||||
}
|
||||
param1.char.nameBar.firstName_txt.text = _loc4_;
|
||||
if(_loc5_)
|
||||
{
|
||||
param1.char.nameBar.lastName_txt.text = _loc5_;
|
||||
}
|
||||
}
|
||||
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(_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);
|
||||
}
|
||||
setupAvatar(_savedParams[param4],_loc7_,_loc5_.currPet);
|
||||
delete _savedParams[param4];
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var _loc4_:AvatarView = null;
|
||||
var _loc6_:String = null;
|
||||
var _loc7_:int = 0;
|
||||
var _loc2_:String = null;
|
||||
var _loc3_:String = null;
|
||||
var _loc5_:int = 0;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_popup = MovieClip(param1.getChildAt(0));
|
||||
if(_type == "noPlayers")
|
||||
{
|
||||
_popup.gotoAndStop("noPlayers");
|
||||
LocalizationManager.translateId(_popup.contTxt,_scriptDef.descStrId);
|
||||
_artLoadingSpiral = new LoadingSpiral(_popup.artWindow,_popup.artWindow.width * 0.5,_popup.artWindow.height * 0.5);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(_scriptDef.mediaRefId,onArtLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
_popup.gotoAndStop("normal");
|
||||
switch(_scriptDef.avatarLimit)
|
||||
{
|
||||
case 4:
|
||||
_numPlayersMC = _popup.fourPlayers;
|
||||
_popup.sixPlayers.visible = false;
|
||||
_popup.eightPlayers.visible = false;
|
||||
_popup.twelvePlayers.visible = false;
|
||||
break;
|
||||
case 6:
|
||||
_numPlayersMC = _popup.sixPlayers;
|
||||
_popup.fourPlayers.visible = false;
|
||||
_popup.eightPlayers.visible = false;
|
||||
_popup.twelvePlayers.visible = false;
|
||||
break;
|
||||
case 8:
|
||||
_numPlayersMC = _popup.eightPlayers;
|
||||
_popup.sixPlayers.visible = false;
|
||||
_popup.fourPlayers.visible = false;
|
||||
_popup.twelvePlayers.visible = false;
|
||||
break;
|
||||
case 12:
|
||||
_numPlayersMC = _popup.twelvePlayers;
|
||||
_popup.sixPlayers.visible = false;
|
||||
_popup.fourPlayers.visible = false;
|
||||
_popup.eightPlayers.visible = false;
|
||||
}
|
||||
LocalizationManager.translateId(_numPlayersMC.contTxt,_scriptDef.descStrId);
|
||||
_artLoadingSpiral = new LoadingSpiral(_popup.artWindow,_popup.artWindow.width * 0.5,_popup.artWindow.height * 0.5);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(_scriptDef.mediaRefId,onArtLoaded);
|
||||
if(_type == "normal" || _type == "custParty")
|
||||
{
|
||||
_loc4_ = new AvatarView();
|
||||
_loc4_.init(AvatarManager.playerAvatar);
|
||||
_loc4_.playAnim(15,false,0,null,true);
|
||||
_numPlayersMC.p1.char.charLayer.addChild(_loc4_);
|
||||
if(_type == "custParty")
|
||||
{
|
||||
_popup.playBtn.visible = false;
|
||||
_popup.playBg.visible = false;
|
||||
}
|
||||
_loc6_ = AvatarManager.playerAvatar.avName;
|
||||
_loc7_ = _loc6_.indexOf(" ");
|
||||
if(_loc7_ != -1)
|
||||
{
|
||||
_loc2_ = _loc6_.substr(0,_loc7_);
|
||||
_loc3_ = _loc6_.substr(_loc7_ + 1,_loc6_.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = _loc6_;
|
||||
}
|
||||
_numPlayersMC.p1.char.nameBar.firstName_txt.text = _loc2_;
|
||||
if(_loc3_)
|
||||
{
|
||||
_numPlayersMC.p1.char.nameBar.lastName_txt.text = _loc3_;
|
||||
}
|
||||
_numPlayersMC.p1.char.nameBar.visible = false;
|
||||
_loc5_ = 2;
|
||||
while(_loc5_ < _scriptDef.avatarLimit + 1)
|
||||
{
|
||||
_numPlayersMC["p" + _loc5_].char.gotoAndPlay("waiting");
|
||||
LocalizationManager.translateId(_numPlayersMC["p" + _loc5_].char.nameBar.firstName_txt,11101);
|
||||
_numPlayersMC["p" + _loc5_].char.nameBar.lastName_txt.text = "";
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
else if(_type == "custSettings")
|
||||
{
|
||||
_modeDropDown = new GuiDropdown(_popup.mode.dropdown);
|
||||
_modeDropDown.init(0,0);
|
||||
}
|
||||
}
|
||||
if(_difficulty == 0)
|
||||
{
|
||||
_popup.hardMode.visible = false;
|
||||
}
|
||||
LocalizationManager.translateId(_popup.titleTxt,_scriptDef.titleStrId);
|
||||
addEventListeners();
|
||||
_popup.x = 900 * 0.5;
|
||||
_popup.y = 550 * 0.5;
|
||||
_guiLayer.addChild(_popup);
|
||||
DarkenManager.darken(_popup);
|
||||
if(_inParamsWaiting != null)
|
||||
{
|
||||
handleWaitResponse(_inParamsWaiting);
|
||||
_inParamsWaiting = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onArtLoaded(param1:MovieClip) : void
|
||||
{
|
||||
while(_popup.artWindow.numChildren > 0)
|
||||
{
|
||||
_popup.artWindow.removeChildAt(0);
|
||||
}
|
||||
_popup.artWindow.addChild(param1);
|
||||
if(_artLoadingSpiral != null)
|
||||
{
|
||||
_artLoadingSpiral.destroy();
|
||||
_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(_popup)
|
||||
{
|
||||
_popup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_popup.bx.addEventListener("mouseDown",onCloseBtn,false,0,true);
|
||||
if(_type == "noPlayers")
|
||||
{
|
||||
_popup.playBtn.addEventListener("mouseDown",onPlayBtn,false,0,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = 1;
|
||||
while(_loc1_ < _scriptDef.avatarLimit + 1)
|
||||
{
|
||||
_numPlayersMC["p" + _loc1_].char.addEventListener("rollOver",onCharRollOver,false,0,true);
|
||||
_numPlayersMC["p" + _loc1_].char.addEventListener("rollOut",onCharRollOut,false,0,true);
|
||||
_loc1_++;
|
||||
}
|
||||
if(_type == "normal")
|
||||
{
|
||||
_popup.playBtn.addEventListener("mouseDown",onPlayBtn,false,0,true);
|
||||
}
|
||||
else if(_type == "custSettings")
|
||||
{
|
||||
_popup.buddiesOnly.toggleBtn.addEventListener("mouseDown",onBuddyToggle,false,0,true);
|
||||
_modeDropDown.currDropDown.addEventListener("mouseDown",onDropDown,false,0,true);
|
||||
_popup.inviteBtn.addEventListener("mouseDown",onInviteBtn,false,0,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(_popup)
|
||||
{
|
||||
_popup.removeEventListener("mouseDown",onPopup);
|
||||
_popup.bx.removeEventListener("mouseDown",onCloseBtn);
|
||||
if(_type == "noPlayers")
|
||||
{
|
||||
_popup.playBtn.removeEventListener("mouseDown",onPlayBtn);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = 1;
|
||||
while(_loc1_ < _scriptDef.avatarLimit + 1)
|
||||
{
|
||||
_numPlayersMC["p" + _loc1_].char.removeEventListener("rollOver",onCharRollOver);
|
||||
_numPlayersMC["p" + _loc1_].char.removeEventListener("rollOut",onCharRollOut);
|
||||
_loc1_++;
|
||||
}
|
||||
if(_type == "normal")
|
||||
{
|
||||
_popup.playBtn.removeEventListener("mouseDown",onPlayBtn);
|
||||
}
|
||||
else if(_type == "custSettings")
|
||||
{
|
||||
_popup.buddiesOnly.toggleBtn.removeEventListener("mouseDown",onBuddyToggle);
|
||||
_modeDropDown.currDropDown.removeEventListener("mouseDown",onDropDown);
|
||||
_popup.inviteBtn.removeEventListener("mouseDown",onInviteBtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onCloseBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
QuestXtCommManager.sendQuestJoinCancel();
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
_closeCallback = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
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(_loc2_ && _loc2_.questLevel < _scriptDef.levelMin)
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdAndInsertOnly(14697,_scriptDef.levelMin));
|
||||
return;
|
||||
}
|
||||
if(_type == "custSettings")
|
||||
{
|
||||
QuestXtCommManager.sendQuestCreatePrivate(_scriptDef.defId,_modeDropDown.selectedIdx,false);
|
||||
}
|
||||
else if(_type == "normal")
|
||||
{
|
||||
QuestXtCommManager.sendQuestStartRequest();
|
||||
}
|
||||
else if(_type == "noPlayers")
|
||||
{
|
||||
QuestXtCommManager.sendQuestCreateJoinPublic(_scriptDef.defId,0);
|
||||
}
|
||||
}
|
||||
|
||||
private function onInviteBtn(param1:MouseEvent) : void
|
||||
{
|
||||
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,499 @@
|
||||
package gui
|
||||
{
|
||||
import buddy.Buddy;
|
||||
import buddy.BuddyXtCommManager;
|
||||
import com.sbi.popup.SBPopup;
|
||||
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 gui.itemWindows.ItemWindowBuddyList;
|
||||
import localization.LocalizationManager;
|
||||
import room.RoomManagerWorld;
|
||||
|
||||
public class BuddyList
|
||||
{
|
||||
|
||||
private static const BUDDY_LIST_X_OFFSET:int = 5;
|
||||
|
||||
private static const BUDDY_LIST_Y_OFFSET:int = 49;
|
||||
|
||||
private static var _playerSearch:PlayerSearch;
|
||||
|
||||
private static var _buddyListPopup:SBPopup;
|
||||
|
||||
private static var _buddyListContent:MovieClip;
|
||||
|
||||
private static var _buddyListBtn:MovieClip;
|
||||
|
||||
private static var _buddyListWorldPopup:MovieClip;
|
||||
|
||||
private static var _requestingForWorldBuddyList:Boolean;
|
||||
|
||||
private static var _worldSelectCallback:Function;
|
||||
|
||||
private static var _currentSelectedUsername:String;
|
||||
|
||||
private static var _currentSelectedItem:Object;
|
||||
|
||||
private static var _currentSelectedIndex:int;
|
||||
|
||||
private static var _itemWindowBuddyList:WindowAndScrollbarGenerator;
|
||||
|
||||
private static var _itemWindowBuddyListWorld:WindowAndScrollbarGenerator;
|
||||
|
||||
private static var _glowTimer:Timer;
|
||||
|
||||
private static var _popupLayer:DisplayLayer;
|
||||
|
||||
private static var _loadingSpiral:LoadingSpiral;
|
||||
|
||||
private static var _worldPopupLoadingSpiral:LoadingSpiral;
|
||||
|
||||
public static var listRequested:Boolean;
|
||||
|
||||
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) + "/" + "200";
|
||||
_buddyListPopup = new SBPopup(_popupLayer,GETDEFINITIONBYNAME("BuddyListPopup"),_buddyListContent,false,true,false,false);
|
||||
_buddyListPopup.closeCallback = buddyListClosedCallback;
|
||||
_buddyListPopup.x = _buddyListPopup.width * 0.5 + 5;
|
||||
_buddyListPopup.y = _buddyListPopup.skin.s.ba.height * 0.5 + 49;
|
||||
_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("mouseDown",buddyListBtnHandler);
|
||||
}
|
||||
_buddyListBtn = param1;
|
||||
if(Utility.canBuddy())
|
||||
{
|
||||
_buddyListBtn.addEventListener("mouseDown",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;
|
||||
removeListeners();
|
||||
_buddyListContent = null;
|
||||
if(_itemWindowBuddyList)
|
||||
{
|
||||
_itemWindowBuddyList.destroy();
|
||||
_itemWindowBuddyList = null;
|
||||
}
|
||||
if(_buddyListPopup)
|
||||
{
|
||||
_buddyListPopup.destroy();
|
||||
_buddyListPopup = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function get visible() : Boolean
|
||||
{
|
||||
return _buddyListPopup.visible;
|
||||
}
|
||||
|
||||
public static function closeBuddyList() : void
|
||||
{
|
||||
if(_buddyListPopup && _buddyListPopup.visible)
|
||||
{
|
||||
_buddyListPopup.close();
|
||||
GuiManager.toolTip.resetTimerAndSetVisibility();
|
||||
_buddyListBtn.downToUpState();
|
||||
}
|
||||
onPlayerSearchClose();
|
||||
}
|
||||
|
||||
public static function updateBuddyTimeLeftHosting() : void
|
||||
{
|
||||
if(_itemWindowBuddyList)
|
||||
{
|
||||
_itemWindowBuddyList.callUpdateInWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private static function onBuddyListChange(param1:Event) : void
|
||||
{
|
||||
if(_buddyListWorldPopup)
|
||||
{
|
||||
buildInWorldBuddyList(null,_currentSelectedItem,null,_currentSelectedUsername);
|
||||
}
|
||||
_loadingSpiral.visible = false;
|
||||
_buddyListContent.counterTxt.text = String(BuddyManager.buddyCount) + "/" + "200";
|
||||
var _loc2_:Number = -1;
|
||||
if(_itemWindowBuddyList)
|
||||
{
|
||||
_loc2_ = _itemWindowBuddyList.scrollYValue;
|
||||
(_buddyListPopup.content as MovieClip).itemBlock.removeChild(_itemWindowBuddyList);
|
||||
_itemWindowBuddyList.destroy();
|
||||
}
|
||||
_itemWindowBuddyList = new WindowAndScrollbarGenerator();
|
||||
_itemWindowBuddyList.init((_buddyListPopup.content as MovieClip).itemBlock.width,(_buddyListPopup.content as MovieClip).itemBlock.height,-5,_loc2_,1,5,BuddyManager.buddyCount,0,2,0,9,ItemWindowBuddyList,buildBuddyList(),"",0,{
|
||||
"mouseDown":buddyListClickOnBuddyHandler,
|
||||
"mouseOver":buddyListOverBuddyHandler,
|
||||
"mouseOut":buddyListOutBuddyHandler
|
||||
},null,null,true,false,false,false,false);
|
||||
(_buddyListPopup.content as MovieClip).itemBlock.addChild(_itemWindowBuddyList);
|
||||
}
|
||||
|
||||
public static function buildBuddyList() : Array
|
||||
{
|
||||
var _loc4_:Array = [];
|
||||
var _loc2_:Dictionary = BuddyManager.buddyList;
|
||||
var _loc3_:int = BuddyManager.buddyCount;
|
||||
_buddyListContent.counterTxt.text = String(BuddyManager.buddyCount) + "/" + "200";
|
||||
if(_loc2_ && _loc3_ > 0)
|
||||
{
|
||||
for each(var _loc1_:Buddy in _loc2_)
|
||||
{
|
||||
_loc4_.push({
|
||||
"userName":_loc1_.userName,
|
||||
"moderatedUserName":_loc1_.userNameModerated,
|
||||
"moderatedUserNameFlag":_loc1_.userNameModeratedFlag,
|
||||
"onlineStatus":_loc1_.onlineStatus,
|
||||
"accountType":_loc1_.accountType,
|
||||
"uuid":_loc1_.uuid,
|
||||
"timeLeftHostingCustomParty":_loc1_.timeLeftHostingCustomParty
|
||||
});
|
||||
}
|
||||
_loc4_.sortOn(["onlineStatus","userName"],[2,1]);
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
public static function buildInWorldBuddyList(param1:MovieClip, param2:Object, param3:Function, param4:String) : void
|
||||
{
|
||||
var _loc8_:Array = null;
|
||||
var _loc6_:Dictionary = null;
|
||||
var _loc7_:int = 0;
|
||||
if(!param1 || 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 || !_itemWindowBuddyListWorld || _currentSelectedItem != param2)
|
||||
{
|
||||
_loc8_ = [];
|
||||
_loc6_ = BuddyManager.buddyList;
|
||||
_loc7_ = BuddyManager.buddyCount;
|
||||
if(_loc6_ && _loc7_ > 0)
|
||||
{
|
||||
for each(var _loc5_:Buddy in _loc6_)
|
||||
{
|
||||
_loc8_.push({
|
||||
"userName":_loc5_.userName,
|
||||
"moderatedUserName":_loc5_.userNameModerated,
|
||||
"moderatedUserNameFlag":_loc5_.userNameModeratedFlag,
|
||||
"uuid":_loc5_.uuid
|
||||
});
|
||||
}
|
||||
_loc8_.sortOn(["userName"],[2,1]);
|
||||
}
|
||||
_currentSelectedUsername = param4;
|
||||
_currentSelectedItem = param2;
|
||||
_currentSelectedIndex = -1;
|
||||
if(_itemWindowBuddyListWorld)
|
||||
{
|
||||
_itemWindowBuddyListWorld.destroy();
|
||||
_itemWindowBuddyListWorld = null;
|
||||
}
|
||||
while(_buddyListWorldPopup.numChildren > 2)
|
||||
{
|
||||
_buddyListWorldPopup.removeChildAt(_buddyListWorldPopup.numChildren - 1);
|
||||
}
|
||||
_itemWindowBuddyListWorld = new WindowAndScrollbarGenerator();
|
||||
_itemWindowBuddyListWorld.init(_buddyListWorldPopup.itemBlock.width,_buddyListWorldPopup.itemBlock.height,0,0,1,5,0,0,2,0,1,ItemWindowBuddyList,_loc8_,"",0,{"mouseDown":worldBuddyListClickOnBuddyHandler},{
|
||||
"isSelection":true,
|
||||
"currSelectedUsername":param4
|
||||
},null,true,false,false,false,false);
|
||||
_buddyListWorldPopup.itemBlock.addChild(_itemWindowBuddyListWorld);
|
||||
}
|
||||
_worldPopupLoadingSpiral.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function updateWorldBuddyListPosition(param1:MovieClip) : void
|
||||
{
|
||||
if(_buddyListWorldPopup && _buddyListWorldPopup.parent)
|
||||
{
|
||||
_buddyListWorldPopup.x = param1.x - _buddyListWorldPopup.width * 0.5;
|
||||
_buddyListWorldPopup.y = param1.y + 30;
|
||||
}
|
||||
}
|
||||
|
||||
public static function closeWorldBuddyList() : Boolean
|
||||
{
|
||||
if(_buddyListWorldPopup && _buddyListWorldPopup.parent)
|
||||
{
|
||||
_buddyListWorldPopup.parent.removeChild(_buddyListWorldPopup);
|
||||
_worldSelectCallback = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function isOverWorldBuddyList(param1:int, param2:int) : Boolean
|
||||
{
|
||||
var _loc3_:Point = null;
|
||||
if(_buddyListWorldPopup && _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;
|
||||
if(_itemWindowBuddyListWorld)
|
||||
{
|
||||
_itemWindowBuddyListWorld.destroy();
|
||||
_itemWindowBuddyListWorld = null;
|
||||
}
|
||||
_worldSelectCallback = null;
|
||||
_currentSelectedUsername = "";
|
||||
_currentSelectedItem = null;
|
||||
}
|
||||
|
||||
public static function requestBuddyListIfNeeded(param1:Function) : void
|
||||
{
|
||||
if(!listRequested)
|
||||
{
|
||||
BuddyXtCommManager.sendBuddyListRequest(param1);
|
||||
listRequested = true;
|
||||
}
|
||||
else if(param1 != null)
|
||||
{
|
||||
param1();
|
||||
}
|
||||
}
|
||||
|
||||
public static function updateSelectedInWorldBuddyIndex(param1:int) : void
|
||||
{
|
||||
_currentSelectedIndex = param1;
|
||||
}
|
||||
|
||||
private static function worldBuddyListClickOnBuddyHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_worldSelectCallback != null)
|
||||
{
|
||||
if(_currentSelectedUsername != "" && _currentSelectedUsername.toLowerCase() == param1.currentTarget.buddyPortalUsername())
|
||||
{
|
||||
param1.currentTarget.turnOffBuddySelection();
|
||||
_currentSelectedIndex = -1;
|
||||
_currentSelectedUsername = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_currentSelectedIndex != -1)
|
||||
{
|
||||
MovieClip(_itemWindowBuddyListWorld.bg.getChildAt(_currentSelectedIndex)).turnOffBuddySelection();
|
||||
}
|
||||
param1.currentTarget.setBuddySelection();
|
||||
_currentSelectedIndex = param1.currentTarget.index;
|
||||
_currentSelectedUsername = param1.currentTarget.getBuddy().userName;
|
||||
}
|
||||
_worldSelectCallback(_currentSelectedUsername);
|
||||
}
|
||||
}
|
||||
|
||||
private static function buddyListClickOnBuddyHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
var _loc3_:MovieClip = MovieClip(param1.currentTarget);
|
||||
var _loc2_:Buddy = param1.currentTarget.getBuddy();
|
||||
if(_loc2_.userName.indexOf("Liza") < 0)
|
||||
{
|
||||
BuddyManager.showBuddyCard({
|
||||
"userName":_loc2_.userName,
|
||||
"onlineStatus":_loc2_.onlineStatus
|
||||
});
|
||||
}
|
||||
GuiManager.toolTip.resetTimerAndSetVisibility();
|
||||
AJAudio.playSubMenuBtnClick();
|
||||
}
|
||||
|
||||
private static function buddyListOverBuddyHandler(param1:MouseEvent) : void
|
||||
{
|
||||
(param1.currentTarget as ItemWindowBuddyList).showRecycleBtn(true);
|
||||
}
|
||||
|
||||
private static function buddyListOutBuddyHandler(param1:MouseEvent) : void
|
||||
{
|
||||
(param1.currentTarget as ItemWindowBuddyList).showRecycleBtn(false);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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(onPlayerSearchClose);
|
||||
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 onPlayerSearchClose() : void
|
||||
{
|
||||
if(_playerSearch)
|
||||
{
|
||||
_playerSearch.destroy();
|
||||
_playerSearch = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function addListeners() : void
|
||||
{
|
||||
_glowTimer.addEventListener("timer",glowTimerHandler,false,0,true);
|
||||
BuddyManager.eventDispatcher.addEventListener("OnBuddyList",onBuddyListChange,false,0,true);
|
||||
BuddyManager.eventDispatcher.addEventListener("OnBuddyChanged",onBuddyListChange,false,0,true);
|
||||
if(Utility.canBuddy())
|
||||
{
|
||||
_buddyListBtn.addEventListener("mouseDown",buddyListBtnHandler,false,0,true);
|
||||
}
|
||||
_buddyListContent.searchBtn.addEventListener("mouseDown",onSearchBtn,false,0,true);
|
||||
_buddyListContent.searchBtn.addEventListener("mouseOver",onSearchBtnOver,false,0,true);
|
||||
_buddyListContent.searchBtn.addEventListener("mouseOut",onSearchBtnOut,false,0,true);
|
||||
}
|
||||
|
||||
private static function removeListeners() : void
|
||||
{
|
||||
if(Utility.canBuddy())
|
||||
{
|
||||
_buddyListBtn.removeEventListener("mouseDown",buddyListBtnHandler);
|
||||
}
|
||||
_glowTimer.removeEventListener("timer",glowTimerHandler);
|
||||
BuddyManager.eventDispatcher.removeEventListener("OnBuddyList",onBuddyListChange);
|
||||
BuddyManager.eventDispatcher.removeEventListener("OnBuddyChanged",onBuddyListChange);
|
||||
if(_buddyListContent)
|
||||
{
|
||||
_buddyListContent.searchBtn.removeEventListener("mouseDown",onSearchBtn);
|
||||
_buddyListContent.searchBtn.removeEventListener("mouseOver",onSearchBtnOver);
|
||||
_buddyListContent.searchBtn.removeEventListener("mouseOut",onSearchBtnOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,722 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.Avatar;
|
||||
import avatar.AvatarInfo;
|
||||
import avatar.UserInfo;
|
||||
import buddy.Buddy;
|
||||
import buddy.BuddyEvent;
|
||||
import buddy.BuddyTimer;
|
||||
import buddy.BuddyXtCommManager;
|
||||
import collection.IitemCollection;
|
||||
import com.sbi.debug.DebugUtility;
|
||||
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;
|
||||
import playerWall.PlayerWallManager;
|
||||
|
||||
public class BuddyManager
|
||||
{
|
||||
|
||||
public static const MAX_BUDDY_COUNT:int = 200;
|
||||
|
||||
public static const WARNING_BUDDY_COUNT:int = 195;
|
||||
|
||||
private static const PERMISSION_TIMEOUT:int = 20000;
|
||||
|
||||
private static const BUDDY_REQUEST_TIMEOUT:int = 30000;
|
||||
|
||||
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;
|
||||
|
||||
private static var _timeSinceLastHostingUpdate:Number;
|
||||
|
||||
private static var _buddyCard:BuddyCard;
|
||||
|
||||
private static var _buddyCardCloseCallback:Function;
|
||||
|
||||
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);
|
||||
_timeSinceLastHostingUpdate = 0;
|
||||
_popupLayer = param1;
|
||||
_eventDispatcher = new EventDispatcher();
|
||||
BuddyList.init(_popupLayer,param2);
|
||||
_buddyRequestCleanupTimer = new Timer(30000);
|
||||
_buddyRequestCleanupTimer.addEventListener("timer",buddyRequestCleanupTimerHandler,false,0,true);
|
||||
_buddyRequestCleanupTimer.start();
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
for each(var _loc1_:Buddy in _buddyList)
|
||||
{
|
||||
_loc1_ = null;
|
||||
}
|
||||
for each(var _loc4_:Object in _blockedList)
|
||||
{
|
||||
_loc4_ = null;
|
||||
}
|
||||
for each(var _loc2_:Object in _buddyRequestList)
|
||||
{
|
||||
_loc2_ = null;
|
||||
}
|
||||
for each(var _loc3_:Object in _buddyRequestPopups)
|
||||
{
|
||||
_loc3_ = null;
|
||||
}
|
||||
for each(var _loc5_:Object in _confirmBuddyRequestPopups)
|
||||
{
|
||||
_loc5_ = null;
|
||||
}
|
||||
_eventDispatcher = null;
|
||||
_buddyList = null;
|
||||
_blockedList = null;
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.destroy();
|
||||
}
|
||||
BuddyList.destroy();
|
||||
}
|
||||
|
||||
public static function heartbeat(param1:int) : void
|
||||
{
|
||||
_timeSinceLastHostingUpdate += param1 / 1000;
|
||||
if(_timeSinceLastHostingUpdate >= 10)
|
||||
{
|
||||
for each(var _loc2_:Buddy in _buddyList)
|
||||
{
|
||||
_loc2_.timeLeftHostingCustomParty -= 10;
|
||||
}
|
||||
BuddyList.updateBuddyTimeLeftHosting();
|
||||
_timeSinceLastHostingUpdate = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static function get eventDispatcher() : EventDispatcher
|
||||
{
|
||||
return _eventDispatcher;
|
||||
}
|
||||
|
||||
public static function isBuddy(param1:String) : Boolean
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _buddyList[param1.toLowerCase()] != null;
|
||||
}
|
||||
|
||||
public static function isBlocked(param1:String) : Boolean
|
||||
{
|
||||
if(param1 == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _blockedList[param1.toLowerCase()] != null;
|
||||
}
|
||||
|
||||
public static function getBuddyByUserName(param1:String) : Buddy
|
||||
{
|
||||
return _buddyList[param1.toLowerCase()];
|
||||
}
|
||||
|
||||
public static function get buddyCount() : int
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
for(var _loc2_:Object in _buddyList)
|
||||
{
|
||||
_loc1_++;
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
public static function showBuddyCard(param1:Object, param2:Boolean = false, param3:Function = null) : void
|
||||
{
|
||||
if("userName" in param1)
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
if(_buddyCard.currBuddyCardUserName == param1.userName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_buddyCard.destroy();
|
||||
}
|
||||
_buddyCardCloseCallback = param3;
|
||||
_buddyCard = new BuddyCard();
|
||||
_buddyCard.init(param1,param2,destroyBuddyCard);
|
||||
}
|
||||
}
|
||||
|
||||
public static function destroyBuddyCard() : void
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
if(_buddyCardCloseCallback != null)
|
||||
{
|
||||
_buddyCardCloseCallback();
|
||||
_buddyCardCloseCallback = null;
|
||||
}
|
||||
_buddyCard.destroy();
|
||||
_buddyCard = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function updateDropDown(param1:String) : void
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.updateDropDown(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function avatarLeftRoom(param1:String) : void
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.avatarLeftRoom(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function updateCurrBuddyCardAvatar(param1:Avatar = null) : void
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.updateCurrBuddyCardAvatar(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function grayOutGoToDenBtn(param1:Boolean, param2:String = "") : void
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.grayOutGoToDenBtn(param1,param2);
|
||||
}
|
||||
}
|
||||
|
||||
public static function resetBuddyCardForArchiveMode(param1:String) : void
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.resetBuddyCardForArchiveMode(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function onTradeListReceived(param1:String, param2:IitemCollection) : void
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.onTradeListReceived(param1,param2);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getTradeListFromBuddyCard() : IitemCollection
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
return _buddyCard.getTradeList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function buddyBlockInfoResponseHandler(param1:String, param2:Boolean) : void
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.buddyBlockInfoResponseHandler(param1,param2);
|
||||
}
|
||||
}
|
||||
|
||||
public static function buddyRoomResponseHandler(param1:String, param2:String, param3:int, param4:Boolean) : void
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.buddyRoomResponseHandler(param1,param2,param3,param4);
|
||||
}
|
||||
}
|
||||
|
||||
public static function setPlayerWallLoading(param1:Boolean) : void
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.setPlayerWallLoading(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function onDenPrivacyResponse(param1:String, param2:Boolean) : void
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.onDenPrivacyResponse(param1,param2);
|
||||
}
|
||||
}
|
||||
|
||||
public static function joinBuddyInQuest() : void
|
||||
{
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.joinBuddyInQuest();
|
||||
}
|
||||
}
|
||||
|
||||
public static function addRemoveBuddy(param1:String, param2:String, param3:Boolean) : void
|
||||
{
|
||||
var _loc6_:String = null;
|
||||
var _loc4_:* = null;
|
||||
var _loc5_:Object = null;
|
||||
if(gMainFrame.clientInfo.extCallsActive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param3)
|
||||
{
|
||||
_loc6_ = param1.toLowerCase();
|
||||
if(buddyCount < 200)
|
||||
{
|
||||
_loc5_ = _buddyRequestList[_loc6_];
|
||||
if(_loc5_ == null || _loc5_.expires < new Date().getTime())
|
||||
{
|
||||
BuddyXtCommManager.sendBuddyAddRequest(param1);
|
||||
_buddyRequestList[_loc6_] = {
|
||||
"userName":param1,
|
||||
"expires":new Date().getTime() + 30000,
|
||||
"isAccepting":true
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_buddyRequestList[_loc6_] != null)
|
||||
{
|
||||
if(!_buddyRequestList[_loc6_].isAccepting)
|
||||
{
|
||||
_buddyRequestPopups[_loc6_] = new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14706,param2));
|
||||
return;
|
||||
}
|
||||
}
|
||||
_buddyRequestPopups[_loc6_] = new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14707,param2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(_popupLayer,LocalizationManager.translateIdOnly(14708));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BuddyXtCommManager.sendBuddyDeleteRequest(param1);
|
||||
delete PlayerWallManager.tokenMap[param1.toLowerCase()];
|
||||
}
|
||||
}
|
||||
|
||||
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(gMainFrame.clientInfo.extCallsActive)
|
||||
{
|
||||
BuddyXtCommManager.sendBuddyConfirmRequest(param1.passback,false);
|
||||
}
|
||||
else if(buddyCount < 200)
|
||||
{
|
||||
BuddyXtCommManager.sendBuddyConfirmRequest(param1.passback,param1.status);
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(_popupLayer,LocalizationManager.translateIdOnly(14708));
|
||||
}
|
||||
}
|
||||
|
||||
public static function buddyListResponseHandler(param1:Object) : void
|
||||
{
|
||||
var _loc10_:int = 0;
|
||||
var _loc15_:Buddy = null;
|
||||
var _loc13_:String = null;
|
||||
var _loc14_:String = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:String = null;
|
||||
var _loc8_:int = 0;
|
||||
var _loc16_:int = 0;
|
||||
var _loc18_:int = 0;
|
||||
var _loc2_:UserInfo = null;
|
||||
var _loc4_:AvatarInfo = null;
|
||||
var _loc17_:Buddy = null;
|
||||
var _loc3_:String = null;
|
||||
var _loc21_:String = null;
|
||||
var _loc12_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
_buddyList = new Dictionary(true);
|
||||
var _loc5_:int = 3;
|
||||
var _loc19_:int = int(param1[_loc5_++]);
|
||||
_loc10_ = 0;
|
||||
while(_loc10_ < _loc19_)
|
||||
{
|
||||
_loc15_ = new Buddy();
|
||||
_loc13_ = param1[_loc5_++];
|
||||
_loc14_ = param1[_loc5_++];
|
||||
_loc6_ = int(param1[_loc5_++]);
|
||||
_loc7_ = param1[_loc5_++];
|
||||
_loc8_ = int(param1[_loc5_++]);
|
||||
_loc16_ = int(param1[_loc5_++]);
|
||||
_loc18_ = int(param1[_loc5_++]);
|
||||
_loc15_.init(_loc13_,_loc14_,_loc6_,1,_loc16_,_loc18_);
|
||||
_buddyList[_loc13_.toLowerCase()] = _loc15_;
|
||||
_loc2_ = gMainFrame.userInfo.getUserInfoByUserName(_loc13_);
|
||||
if(!_loc2_)
|
||||
{
|
||||
if(_loc8_ > -1)
|
||||
{
|
||||
_loc4_ = new AvatarInfo();
|
||||
_loc4_.init(_loc8_,_loc7_,_loc13_,_loc14_);
|
||||
_loc2_ = new UserInfo();
|
||||
_loc2_.init(_loc13_,_loc14_,null,_loc8_,_loc16_,_loc6_,_loc18_);
|
||||
_loc2_.addAvatarToList(_loc4_);
|
||||
gMainFrame.userInfo.setUserInfoByUserName(_loc13_,_loc2_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_loc8_ > -1 && !_loc2_.getAvatarInfoByPerUserAvId(_loc8_))
|
||||
{
|
||||
_loc4_ = new AvatarInfo();
|
||||
_loc4_.init(_loc8_,_loc7_,_loc13_,_loc14_);
|
||||
_loc2_.addAvatarToList(_loc4_);
|
||||
}
|
||||
_loc2_.uuid = _loc14_;
|
||||
_loc2_.userNameModeratedFlag = _loc6_;
|
||||
_loc2_.accountType = _loc16_;
|
||||
_loc2_.timeLeftHostingCustomParty = _loc18_;
|
||||
if(_loc8_ > -1)
|
||||
{
|
||||
_loc2_.currPerUserAvId = _loc8_;
|
||||
}
|
||||
}
|
||||
_loc10_++;
|
||||
}
|
||||
var _loc11_:int = int(param1[_loc5_++]);
|
||||
_loc10_ = 0;
|
||||
while(_loc10_ < _loc11_)
|
||||
{
|
||||
_loc17_ = new Buddy();
|
||||
_loc3_ = param1[_loc5_++];
|
||||
_loc21_ = param1[_loc5_++];
|
||||
_loc12_ = int(param1[_loc5_++]);
|
||||
_loc9_ = int(param1[_loc5_++]);
|
||||
_loc17_.init(_loc3_,_loc21_,_loc12_,0,_loc9_);
|
||||
_buddyList[_loc3_.toLowerCase()] = _loc17_;
|
||||
_loc10_++;
|
||||
}
|
||||
BuddyList.listRequested = true;
|
||||
var _loc20_:BuddyEvent = new BuddyEvent("OnBuddyList");
|
||||
_eventDispatcher.dispatchEvent(_loc20_);
|
||||
}
|
||||
|
||||
public static function blockedListResponseHandler(param1:Object) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc3_:int = 3;
|
||||
var _loc2_:int = int(param1[_loc3_++]);
|
||||
_blockedList = new Dictionary(true);
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc2_)
|
||||
{
|
||||
_blockedList[param1[_loc3_++].toLowerCase()] = "1";
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
|
||||
public static function buddyAddRequestResponseHandler(param1:int, param2:String, param3:int) : void
|
||||
{
|
||||
var _loc4_:AvatarInfo = null;
|
||||
var _loc5_:BuddyTimer = null;
|
||||
var _loc6_:String = param3 > 0 ? param2 : LocalizationManager.translateIdOnly(11098);
|
||||
if(param1 == 0)
|
||||
{
|
||||
if(!_buddyList[param2.toLowerCase()])
|
||||
{
|
||||
_loc4_ = gMainFrame.userInfo.getAvatarInfoByUserName(param2);
|
||||
_loc5_ = new BuddyTimer(30000);
|
||||
_loc5_.userName = param2.toLowerCase();
|
||||
_loc5_.addEventListener("timer",confirmPopupTimerHandler,false,0,true);
|
||||
_confirmBuddyRequestPopups[param2.toLowerCase()] = {
|
||||
"popup":new BuddyRequest(param2,buddyAddRequestCallback,1),
|
||||
"timer":_loc5_
|
||||
};
|
||||
_loc5_.start();
|
||||
}
|
||||
}
|
||||
else if(param1 == 1)
|
||||
{
|
||||
_buddyRequestPopups[param2.toLowerCase()] = new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14707,_loc6_));
|
||||
}
|
||||
else if(param1 == 2)
|
||||
{
|
||||
new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14710,_loc6_));
|
||||
}
|
||||
else if(param1 == 3)
|
||||
{
|
||||
if(_buddyRequestList[param2.toLowerCase()] != null)
|
||||
{
|
||||
_buddyRequestList[param2.toLowerCase()].isAccepting = false;
|
||||
}
|
||||
new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14706,_loc6_));
|
||||
}
|
||||
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, param10:int = -1) : void
|
||||
{
|
||||
var _loc12_:AvatarInfo = null;
|
||||
var _loc14_:String = null;
|
||||
DebugUtility.debugTrace("buddyStatusResponseHandler - userName:" + param1 + ",uuid:" + param2 + ",userNameModerationFlag:" + param3 + ",isOnline:" + param4 + ",accountTypeId:" + param5 + ",buddyFlag:" + param6 + ",newUserName:" + param7 + ",avName:" + param8 + ",perUserAvId:" + param9 + ",timeLeftHostingCustomParty:" + param10);
|
||||
var _loc13_:String = param1.toLowerCase();
|
||||
var _loc15_:Buddy = _buddyList[_loc13_];
|
||||
var _loc11_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(param1);
|
||||
if(!_loc11_)
|
||||
{
|
||||
_loc11_ = new UserInfo();
|
||||
_loc11_.init(param1,param2);
|
||||
_loc11_.userNameModeratedFlag = param3;
|
||||
_loc11_.timeLeftHostingCustomParty = param10;
|
||||
gMainFrame.userInfo.setUserInfoByUserName(param1,_loc11_);
|
||||
}
|
||||
_loc11_.accountType = param5;
|
||||
if(param8)
|
||||
{
|
||||
_loc12_ = _loc11_.getAvatarInfoByPerUserAvId(param9);
|
||||
if(param9 > 0)
|
||||
{
|
||||
if(!_loc12_)
|
||||
{
|
||||
_loc12_ = new AvatarInfo();
|
||||
_loc12_.init(param9,param8,param1,param2);
|
||||
_loc11_.addAvatarToList(_loc12_);
|
||||
}
|
||||
_loc11_.currPerUserAvId = param9;
|
||||
}
|
||||
}
|
||||
if(param6 != 3 && param6 != 4)
|
||||
{
|
||||
if(_loc15_)
|
||||
{
|
||||
_loc15_.userName = param1;
|
||||
_loc15_.userNameModeratedFlag = param3;
|
||||
_loc15_.timeLeftHostingCustomParty = param10;
|
||||
if(_loc15_.isOnline && !param4)
|
||||
{
|
||||
_numOnlineBuddies = _numOnlineBuddies - 1;
|
||||
}
|
||||
else if(!_loc15_.isOnline && param4)
|
||||
{
|
||||
if(Utility.canBuddy())
|
||||
{
|
||||
BuddyList.startBuddyListBtnGlow();
|
||||
}
|
||||
_numOnlineBuddies = _numOnlineBuddies + 1;
|
||||
}
|
||||
_loc15_.onlineStatus = param4 ? 1 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc15_ = new Buddy();
|
||||
_loc15_.init(param1,param2,param3,param4 ? 1 : 0,param5,param10);
|
||||
_buddyList[_loc13_] = _loc15_;
|
||||
if(param6 == 1)
|
||||
{
|
||||
if(_buddyRequestPopups[_loc13_] != null)
|
||||
{
|
||||
_buddyRequestPopups[_loc13_].destroy();
|
||||
delete _buddyRequestPopups[_loc13_];
|
||||
}
|
||||
SBPopupManager.nonSBPopups.push(new BuddyRequest(param1,null,2));
|
||||
}
|
||||
else if(param6 == 2)
|
||||
{
|
||||
SBPopupManager.nonSBPopups.push(new BuddyRequest(param1,null,2));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_loc15_)
|
||||
{
|
||||
_loc15_.userName = param7;
|
||||
_loc15_.userNameModeratedFlag = param3;
|
||||
_loc15_.timeLeftHostingCustomParty = param10;
|
||||
if(_loc15_.isOnline && !param4)
|
||||
{
|
||||
_numOnlineBuddies = _numOnlineBuddies - 1;
|
||||
}
|
||||
else if(!_loc15_.isOnline && param4)
|
||||
{
|
||||
BuddyList.startBuddyListBtnGlow();
|
||||
_numOnlineBuddies = _numOnlineBuddies + 1;
|
||||
}
|
||||
_loc15_.onlineStatus = param4 ? 1 : 0;
|
||||
delete _buddyList[_loc13_];
|
||||
_buddyList[param7.toLowerCase()] = _loc15_;
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.userNameChange(param1,param7,_loc15_.userNameModerated);
|
||||
}
|
||||
gMainFrame.userInfo.changeUserName(param1,param7,param3);
|
||||
param1 = param7;
|
||||
}
|
||||
if(isBlocked(_loc13_))
|
||||
{
|
||||
_loc14_ = param3 > 0 ? param7 : LocalizationManager.translateIdOnly(11098);
|
||||
if(_buddyCard)
|
||||
{
|
||||
_buddyCard.userNameChange(param1,param7,_loc14_);
|
||||
}
|
||||
gMainFrame.userInfo.changeUserName(param1,param7,param3);
|
||||
param1 = param7;
|
||||
delete _blockedList[_loc13_];
|
||||
_blockedList[param7.toLowerCase()] = "1";
|
||||
}
|
||||
}
|
||||
var _loc16_:BuddyEvent = new BuddyEvent("OnBuddyChanged");
|
||||
_loc16_.userName = param1;
|
||||
_eventDispatcher.dispatchEvent(_loc16_);
|
||||
}
|
||||
|
||||
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("OnBuddyChanged");
|
||||
_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("OnBuddyChanged");
|
||||
_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("OnBuddyChanged");
|
||||
_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("OnBuddyList");
|
||||
BuddyManager.eventDispatcher.dispatchEvent(_loc1_);
|
||||
}
|
||||
|
||||
private static function buddyRequestCleanupTimerHandler(param1:TimerEvent) : void
|
||||
{
|
||||
var _loc3_:String = null;
|
||||
for each(var _loc2_:Object 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,262 @@
|
||||
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);
|
||||
_playerUserName = param1;
|
||||
_requestCallback = param2;
|
||||
_popupType = param3;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(2778,onMediaLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
SBPopupManager.destroySpecificNonSBPopup(this);
|
||||
if(_mediaHelper)
|
||||
{
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
}
|
||||
if(_mainAvatarView)
|
||||
{
|
||||
_mainAvatarView.destroy();
|
||||
_mainAvatarView = null;
|
||||
}
|
||||
_mainAvatar = null;
|
||||
removeEventListeners();
|
||||
DarkenManager.unDarken(_requestPopup);
|
||||
if(_requestPopup.parent == GuiManager.guiLayer)
|
||||
{
|
||||
GuiManager.guiLayer.removeChild(_requestPopup);
|
||||
}
|
||||
_requestPopup = null;
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param1)
|
||||
{
|
||||
_requestPopup = MovieClip(param1.getChildAt(0));
|
||||
_requestPopup.x = 900 * 0.5;
|
||||
_requestPopup.y = 550 * 0.5;
|
||||
GuiManager.guiLayer.addChild(_requestPopup);
|
||||
DarkenManager.darken(_requestPopup);
|
||||
setupRequestPopup();
|
||||
addEventListeners();
|
||||
}
|
||||
}
|
||||
|
||||
private function setupRequestPopup() : void
|
||||
{
|
||||
_requestPopup.gotoAndStop(_popupType);
|
||||
_loadingSpiralAvatar = new LoadingSpiral(_requestPopup.charBox);
|
||||
var _loc1_:AvatarInfo = gMainFrame.userInfo.getAvatarInfoByUserName(_playerUserName);
|
||||
if(!_loc1_)
|
||||
{
|
||||
AvatarXtCommManager.requestAvatarGet(_playerUserName,onAvatarGetReceived);
|
||||
}
|
||||
else
|
||||
{
|
||||
onAvatarGetReceived(_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() == _playerUserName.toLowerCase())
|
||||
{
|
||||
if(!param4)
|
||||
{
|
||||
param4 = gMainFrame.userInfo.getAvatarInfoByUserName(param1);
|
||||
if(!param4)
|
||||
{
|
||||
throw new Error("onAvatarGetReceived and avInfo is null");
|
||||
}
|
||||
}
|
||||
_loc5_ = gMainFrame.userInfo.getUserInfoByUserName(_playerUserName);
|
||||
if(param4.isMember)
|
||||
{
|
||||
_requestPopup.nonmember.visible = false;
|
||||
_requestPopup.userName_txt.visible = false;
|
||||
_requestPopup.member.setNubType("buddy",false);
|
||||
_requestPopup.member.setColorAndBadge(_loc5_.nameBarData);
|
||||
_requestPopup.member.isBlocked = false;
|
||||
_requestPopup.member.setAvName(_loc5_.getModeratedUserName(),Utility.isSettingOn(MySettings.SETTINGS_USERNAME_BADGE),_loc5_,false);
|
||||
_requestPopup.member.mouseEnabled = false;
|
||||
_requestPopup.member.mouseChildren = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_requestPopup.member.visible = false;
|
||||
_requestPopup.userName_txt.visible = true;
|
||||
_requestPopup.userName_txt.text = _loc5_.getModeratedUserName();
|
||||
}
|
||||
if(_popupType == 2)
|
||||
{
|
||||
_loc6_ = BuddyManager.buddyCount;
|
||||
if(_loc6_ >= 195)
|
||||
{
|
||||
LocalizationManager.translateIdAndInsert(_requestPopup.txt,18509,200 - _loc6_);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalizationManager.translateId(_requestPopup.txt,9491);
|
||||
}
|
||||
}
|
||||
_mainAvatar = AvatarManager.getAvatarByUserName(_playerUserName);
|
||||
if(_mainAvatar == null)
|
||||
{
|
||||
_mainAvatar = AvatarUtility.generateNew(param4.perUserAvId,null,_playerUserName,-1,0,onAvatarItemData);
|
||||
}
|
||||
drawMainAvatar(_mainAvatar);
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
public function onAvatarItemData(param1:Boolean) : void
|
||||
{
|
||||
if(param1 && _mainAvatar != null)
|
||||
{
|
||||
drawMainAvatar(_mainAvatar);
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function drawMainAvatar(param1:Avatar) : void
|
||||
{
|
||||
if(Utility.isOcean(param1.enviroTypeFlag))
|
||||
{
|
||||
if(Utility.isLand(param1.enviroTypeFlag))
|
||||
{
|
||||
_requestPopup.charBox.gotoAndStop(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
_requestPopup.charBox.gotoAndStop(2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_requestPopup.charBox.gotoAndStop(1);
|
||||
}
|
||||
_mainAvatarView = new AvatarView();
|
||||
_mainAvatarView.init(param1);
|
||||
if(param1.avTypeId >= 0)
|
||||
{
|
||||
_mainAvatarView.playAnim(13,false,1,positionAndAddMainAvatarView);
|
||||
}
|
||||
}
|
||||
|
||||
private function positionAndAddMainAvatarView(param1:LayerAnim, param2:int) : void
|
||||
{
|
||||
var _loc3_:Point = null;
|
||||
if(_mainAvatarView)
|
||||
{
|
||||
_loc3_ = AvatarUtility.getAvOffsetByDefId(_mainAvatarView.avTypeId);
|
||||
_mainAvatarView.x = _loc3_.x;
|
||||
_mainAvatarView.y = _loc3_.y;
|
||||
if(_requestPopup)
|
||||
{
|
||||
_requestPopup.charBox.addChild(_mainAvatarView);
|
||||
}
|
||||
}
|
||||
if(_loadingSpiralAvatar)
|
||||
{
|
||||
_loadingSpiralAvatar.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
if(_requestPopup.currentFrame == 1)
|
||||
{
|
||||
_requestPopup.cancelBtn.addEventListener("mouseDown",onCancelBtn,false,0,true);
|
||||
}
|
||||
_requestPopup.okBtn.addEventListener("mouseDown",onOkBtn,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
if(_requestPopup.currentFrame == 1)
|
||||
{
|
||||
_requestPopup.cancelBtn.removeEventListener("mouseDown",onCancelBtn);
|
||||
}
|
||||
_requestPopup.okBtn.removeEventListener("mouseDown",onOkBtn);
|
||||
}
|
||||
|
||||
private function onOkBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_requestPopup.currentFrame == 1)
|
||||
{
|
||||
_requestCallback({
|
||||
"status":true,
|
||||
"passback":_playerUserName
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function onCancelBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_requestCallback({
|
||||
"status":false,
|
||||
"passback":_playerUserName
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,925 @@
|
||||
package gui
|
||||
{
|
||||
import collection.IntItemCollection;
|
||||
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.events.MouseEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Rectangle;
|
||||
import flash.text.TextField;
|
||||
import flash.utils.Timer;
|
||||
import game.MinigameManager;
|
||||
import loader.JCDefHelper;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class BulletinBoard
|
||||
{
|
||||
|
||||
private static const BBOARD_MEDIA_ID:int = 563;
|
||||
|
||||
private static const WHATS_NEW_MEDIA_ID:int = 4428;
|
||||
|
||||
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 WHAT_NEW_IMAGES_ID:int = 369;
|
||||
|
||||
private static const WHATS_NEW_VIDEOS_ID:int = 389;
|
||||
|
||||
private static const EVT_LOC_ID:int = 670;
|
||||
|
||||
private static const DESC_TXT_Y_POS:Number = 181.35;
|
||||
|
||||
private var _bulletinBoardPopup:MovieClip;
|
||||
|
||||
private var _whatsNewPopup:MovieClip;
|
||||
|
||||
private var _whatsNewImageIds:Array;
|
||||
|
||||
private var _whatsNewImageIndex:int;
|
||||
|
||||
private var _whatsNewImageLoadingSpiral:LoadingSpiral;
|
||||
|
||||
private var _whatsNewVideoLoadingSpiral:LoadingSpiral;
|
||||
|
||||
private var _whatsNewStreamId:int;
|
||||
|
||||
private var _whatsNewStreamText:String;
|
||||
|
||||
private var _whatsNewStreamSubtitleId:int;
|
||||
|
||||
private var _whatsNewStreamThumbId:int;
|
||||
|
||||
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);
|
||||
_guiLayer = param1;
|
||||
_closeCallback = param2;
|
||||
_mediaHelpers = [];
|
||||
_artObjects = {};
|
||||
_tutorialSpiral = new LoadingSpiral();
|
||||
_artSpiral = new LoadingSpiral();
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(563,onMediaItemLoaded,true);
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(_bulletinBoardPopup)
|
||||
{
|
||||
removeBoardListeners();
|
||||
_guiLayer.removeChild(_bulletinBoardPopup);
|
||||
DarkenManager.unDarken(_bulletinBoardPopup);
|
||||
KeepAlive.stopKATimer(_bulletinBoardPopup);
|
||||
_bulletinBoardPopup = null;
|
||||
}
|
||||
if(_artGalleryPopup)
|
||||
{
|
||||
removeGalleryListeners();
|
||||
if(_artGalleryPopup.parent && _artGalleryPopup.parent == _guiLayer)
|
||||
{
|
||||
_guiLayer.removeChild(_artGalleryPopup);
|
||||
}
|
||||
DarkenManager.unDarken(_artGalleryPopup);
|
||||
_artGalleryPopup = null;
|
||||
}
|
||||
if(_whatsNewPopup)
|
||||
{
|
||||
removeWhatsNewListeners();
|
||||
_whatsNewVideoLoadingSpiral.destroy();
|
||||
_whatsNewVideoLoadingSpiral = null;
|
||||
_whatsNewImageLoadingSpiral.destroy();
|
||||
_whatsNewImageLoadingSpiral = null;
|
||||
if(_whatsNewPopup.parent && _whatsNewPopup.parent == _guiLayer)
|
||||
{
|
||||
_guiLayer.removeChild(_whatsNewPopup);
|
||||
}
|
||||
DarkenManager.unDarken(_whatsNewPopup);
|
||||
_whatsNewPopup = null;
|
||||
}
|
||||
if(_costumePopup)
|
||||
{
|
||||
if(_costumePopup.parent && _costumePopup.parent == _guiLayer)
|
||||
{
|
||||
_guiLayer.removeChild(_costumePopup);
|
||||
}
|
||||
_costumePopup = null;
|
||||
}
|
||||
if(_loadingMediaHelper)
|
||||
{
|
||||
_loadingMediaHelper.destroy();
|
||||
_loadingMediaHelper = null;
|
||||
}
|
||||
if(_tutorialSpiral)
|
||||
{
|
||||
_tutorialSpiral.destroy();
|
||||
_tutorialSpiral = null;
|
||||
}
|
||||
if(_artSpiral)
|
||||
{
|
||||
_artSpiral.destroy();
|
||||
_artSpiral = null;
|
||||
}
|
||||
if(_intro)
|
||||
{
|
||||
_intro.removeEventListener("mouseDown",onPopupDown);
|
||||
_intro = null;
|
||||
}
|
||||
if(_introCloseBtn)
|
||||
{
|
||||
_introCloseBtn.removeEventListener("mouseDown",onIntroClose);
|
||||
_introCloseBtn = null;
|
||||
}
|
||||
if(_howlTimer)
|
||||
{
|
||||
_howlTimer.reset();
|
||||
_howlTimer = null;
|
||||
}
|
||||
_artObjects = null;
|
||||
_artMediaIds = null;
|
||||
_mediaHelpers = null;
|
||||
}
|
||||
|
||||
public function refresh() : void
|
||||
{
|
||||
if(_bulletinBoardPopup)
|
||||
{
|
||||
if(_artGalleryPopup && _artGalleryPopup.visible)
|
||||
{
|
||||
removeGalleryListeners();
|
||||
if(_artGalleryPopup.parent && _artGalleryPopup.parent == _guiLayer)
|
||||
{
|
||||
_guiLayer.removeChild(_artGalleryPopup);
|
||||
}
|
||||
DarkenManager.unDarken(_artGalleryPopup);
|
||||
_artGalleryPopup = null;
|
||||
}
|
||||
_artSpiral.setNewParent(_bulletinBoardPopup.artItemWindow,_bulletinBoardPopup.artItemWindow.width * 0.5,_bulletinBoardPopup.artItemWindow.height * 0.5);
|
||||
_artSpiral.visible = true;
|
||||
_jcLoader = new JCDefHelper();
|
||||
_jcLoader.init(1,onArtGLReceived);
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(14712));
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaItemLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:MovieClip = null;
|
||||
var _loc4_:Number = NaN;
|
||||
if(param1)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(true)
|
||||
{
|
||||
if(_loc3_ < _mediaHelpers.length)
|
||||
{
|
||||
if(_mediaHelpers[_loc3_] == param1.mediaHelper)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
switch(param1.mediaHelper.id)
|
||||
{
|
||||
case 563:
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_bulletinBoardPopup = MovieClip(param1.getChildAt(0));
|
||||
_howlTextField = _bulletinBoardPopup.howlTxt;
|
||||
_bulletinBoardPopup.x = 900 * 0.5;
|
||||
_bulletinBoardPopup.y = 550;
|
||||
_artSpiral.setNewParent(_bulletinBoardPopup.artItemWindow,_bulletinBoardPopup.artItemWindow.width * 0.5,_bulletinBoardPopup.artItemWindow.height * 0.5);
|
||||
_tutorialSpiral.setNewParent(_bulletinBoardPopup.videoItemWindow);
|
||||
_bulletinBoardPopup.playMovBtn.visible = false;
|
||||
_guiLayer.addChild(_bulletinBoardPopup);
|
||||
DarkenManager.darken(_bulletinBoardPopup);
|
||||
KeepAlive.startKATimer(_bulletinBoardPopup);
|
||||
addBoardListeners();
|
||||
if(_tutorialMediaId > 0)
|
||||
{
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(_tutorialMediaId,onMediaItemLoaded,true);
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
}
|
||||
_jcLoader = new JCDefHelper();
|
||||
_jcLoader.init(LocalizationManager.currentLanguage,onArtGLReceived);
|
||||
GenericListXtCommManager.requestStreamList(8,onTutorialGLReceived);
|
||||
break;
|
||||
case _tutorialMediaId:
|
||||
case _whatsNewStreamThumbId:
|
||||
if(param1.mediaHelper.id == _tutorialMediaId)
|
||||
{
|
||||
_loc2_ = _bulletinBoardPopup;
|
||||
_tutorialSpiral.destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = _whatsNewPopup;
|
||||
_whatsNewVideoLoadingSpiral.visible = false;
|
||||
}
|
||||
if(_loc2_)
|
||||
{
|
||||
_loc4_ = _loc2_.videoItemWindow.width / param1.width;
|
||||
param1.scaleX = _loc4_;
|
||||
param1.scaleY = _loc4_;
|
||||
_loc2_.videoItemWindow.addChild(param1);
|
||||
_loc2_.playMovBtn.visible = true;
|
||||
}
|
||||
break;
|
||||
case _introCloseId:
|
||||
_introCloseBtn = MovieClip(param1.getChildAt(0));
|
||||
_guiLayer.addChild(_introCloseBtn);
|
||||
_introCloseBtn.x = 855;
|
||||
_introCloseBtn.y = 10;
|
||||
_introCloseBtn.addEventListener("mouseDown",onIntroClose,false,0,true);
|
||||
break;
|
||||
case 565:
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_artGalleryPopup = MovieClip(param1.getChildAt(0));
|
||||
onGalleryLeftRightDown(null);
|
||||
addGalleryListeners();
|
||||
_guiLayer.addChild(_artGalleryPopup);
|
||||
_artGalleryPopup.x = 900 * 0.5;
|
||||
_artGalleryPopup.y = 550 * 0.5;
|
||||
DarkenManager.darken(_artGalleryPopup);
|
||||
break;
|
||||
case 4428:
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_whatsNewPopup = MovieClip(param1.getChildAt(0));
|
||||
_whatsNewImageLoadingSpiral = new LoadingSpiral(_whatsNewPopup.photoItemWindow,_whatsNewPopup.photoItemWindow.width * 0.5,_whatsNewPopup.photoItemWindow.height * 0.5);
|
||||
_whatsNewVideoLoadingSpiral = new LoadingSpiral(_whatsNewPopup.videoItemWindow,_whatsNewPopup.videoItemWindow.width * 0.5,_whatsNewPopup.videoItemWindow.height * 0.5);
|
||||
_whatsNewPopup.playMovBtn.visible = false;
|
||||
addWhatsNewListeners();
|
||||
_guiLayer.addChild(_whatsNewPopup);
|
||||
_whatsNewPopup.x = 900 * 0.5;
|
||||
_whatsNewPopup.y = 550 * 0.5;
|
||||
DarkenManager.darken(_whatsNewPopup);
|
||||
GenericListXtCommManager.requestGenericList(369,onWhatsNewImagesListLoaded);
|
||||
GenericListXtCommManager.requestStreamList(389,onWhatsNewVideosLoaded);
|
||||
break;
|
||||
case 1634:
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_costumePopup = MovieClip(param1.getChildAt(0));
|
||||
_costumePopup.addEventListener("mouseDown",onPopupDown,false,0,true);
|
||||
_costumePopup.bx.addEventListener("mouseDown",onPopupClose,false,0,true);
|
||||
_guiLayer.addChild(_costumePopup);
|
||||
_costumePopup.x = 900 * 0.5;
|
||||
_costumePopup.y = 550 * 0.5;
|
||||
DarkenManager.darken(_costumePopup);
|
||||
}
|
||||
param1.mediaHelper.destroy();
|
||||
delete param1.mediaHelper;
|
||||
_mediaHelpers.splice(_loc3_,1);
|
||||
}
|
||||
}
|
||||
|
||||
private function displayText(param1:int) : void
|
||||
{
|
||||
if(_artGalleryPopup)
|
||||
{
|
||||
_artGalleryPopup.descTxt.text = _artObjects[param1].desc;
|
||||
_artGalleryPopup.descTxt.y = 181.35;
|
||||
if(_artGalleryPopup.descTxt.numLines == 1)
|
||||
{
|
||||
_artGalleryPopup.descTxt.y += 11;
|
||||
}
|
||||
_artGalleryPopup.titleTxt.text = _artObjects[param1].title;
|
||||
}
|
||||
}
|
||||
|
||||
private function onArtDataLoaded(param1:Object) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc2_:String = null;
|
||||
var _loc3_:String = null;
|
||||
var _loc5_:String = null;
|
||||
if(param1 && _bulletinBoardPopup)
|
||||
{
|
||||
_loc2_ = param1.data.text;
|
||||
_loc4_ = _loc2_.indexOf("|");
|
||||
_loc3_ = _loc2_.substr(0,_loc4_);
|
||||
_loc5_ = _loc2_.substr(_loc4_ + 1,_loc2_.length);
|
||||
_loc5_ = LocalizationManager.translateAvatarName(_loc5_);
|
||||
_artObjects[param1.data.imageId] = {
|
||||
"img":null,
|
||||
"title":LocalizationManager.translateIdOnly(int(_loc3_)),
|
||||
"desc":_loc5_.toUpperCase()
|
||||
};
|
||||
displayText(param1.data.imageId);
|
||||
_jcLoader.destroy();
|
||||
_jcLoader = null;
|
||||
_jcLoader = new JCDefHelper();
|
||||
_jcLoader.init(_artMediaIds[_artPageNum],onArtLoaded,true,true);
|
||||
}
|
||||
}
|
||||
|
||||
private function onArtLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var _loc3_:Number = NaN;
|
||||
var _loc2_:Object = null;
|
||||
if(param1 && _bulletinBoardPopup)
|
||||
{
|
||||
if(_artGalleryPopup && _artGalleryPopup.visible)
|
||||
{
|
||||
_loc2_ = _artObjects[param1.defHelper.id];
|
||||
_loc3_ = _artGalleryPopup.itemWindow.height / _artGalleryPopup.itemWindow.width;
|
||||
if(param1.width * _loc3_ > param1.height)
|
||||
{
|
||||
_loc3_ = _artGalleryPopup.itemWindow.width / param1.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = _artGalleryPopup.itemWindow.height / param1.height;
|
||||
}
|
||||
param1.width *= _loc3_;
|
||||
param1.height *= _loc3_;
|
||||
param1.y = (_artGalleryPopup.itemWindow.height - param1.height) * 0.5;
|
||||
param1.x = (_artGalleryPopup.itemWindow.width - param1.width) * 0.5;
|
||||
_loc2_.img = param1;
|
||||
while(_artGalleryPopup.itemWindow.numChildren > 1)
|
||||
{
|
||||
_artGalleryPopup.itemWindow.removeChildAt(_artGalleryPopup.itemWindow.numChildren - 1);
|
||||
}
|
||||
_artSpiral.visible = false;
|
||||
_artGalleryPopup.itemWindow.addChild(param1);
|
||||
_artGalleryPopup.descTxt.text = _loc2_.desc;
|
||||
_artGalleryPopup.titleTxt.text = _loc2_.title;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = _bulletinBoardPopup.artItemWindow.height / _bulletinBoardPopup.artItemWindow.width;
|
||||
if(param1.width * _loc3_ > param1.height)
|
||||
{
|
||||
_loc3_ = _bulletinBoardPopup.artItemWindow.width / param1.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = _bulletinBoardPopup.artItemWindow.height / param1.height;
|
||||
}
|
||||
param1.width *= _loc3_;
|
||||
param1.height *= _loc3_;
|
||||
param1.y = (_bulletinBoardPopup.artItemWindow.height - param1.height) * 0.5;
|
||||
param1.x = (_bulletinBoardPopup.artItemWindow.width - param1.width) * 0.5;
|
||||
while(_bulletinBoardPopup.artItemWindow.numChildren > 1)
|
||||
{
|
||||
_bulletinBoardPopup.artItemWindow.removeChildAt(_bulletinBoardPopup.artItemWindow.numChildren - 1);
|
||||
}
|
||||
_bulletinBoardPopup.artItemWindow.addChild(param1);
|
||||
_artSpiral.visible = false;
|
||||
}
|
||||
param1.defHelper.destroy();
|
||||
delete param1.defHelper;
|
||||
}
|
||||
}
|
||||
|
||||
private function onIntroLoaded(param1:MovieClip) : void
|
||||
{
|
||||
gMainFrame.stage.quality = "high";
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(!SBAudio.isMusicMuted || !SBAudio.areSoundsMuted)
|
||||
{
|
||||
SBAudio.muteMusic(false);
|
||||
SBAudio.muteSounds();
|
||||
_musicMutedByPlayer = true;
|
||||
}
|
||||
_intro = param1;
|
||||
_intro.addEventListener("mouseDown",onPopupDown,false,0,true);
|
||||
_guiLayer.addChild(_intro);
|
||||
DarkenManager.darken(_intro);
|
||||
_intro.playMovie(onIntroClose);
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(_introCloseId,onMediaItemLoaded,true);
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
_introMediaHelper.destroy();
|
||||
_introMediaHelper = null;
|
||||
}
|
||||
|
||||
private function onIntroClose(param1:MouseEvent = null) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(_intro.parent == _guiLayer)
|
||||
{
|
||||
_guiLayer.removeChild(_intro);
|
||||
}
|
||||
if(_intro)
|
||||
{
|
||||
_intro.stopMovie();
|
||||
DarkenManager.unDarken(_intro);
|
||||
}
|
||||
if(_introCloseBtn && _introCloseBtn.parent == _guiLayer)
|
||||
{
|
||||
_guiLayer.removeChild(_introCloseBtn);
|
||||
}
|
||||
if(_musicMutedByPlayer)
|
||||
{
|
||||
_musicMutedByPlayer = false;
|
||||
SBAudio.unmuteMusic(false);
|
||||
SBAudio.unmuteSounds();
|
||||
}
|
||||
gMainFrame.stage.quality = "medium";
|
||||
}
|
||||
|
||||
private function onTutorialGLReceived(param1:int, param2:IntItemCollection, param3:IntItemCollection, param4:Array, param5:Array, param6:IntItemCollection, param7:IntItemCollection) : void
|
||||
{
|
||||
_tutorialStreamId = param2.getIntItem(0);
|
||||
_introCloseId = 178;
|
||||
LocalizationManager.translateId(_bulletinBoardPopup.videoTitleTxt,param4[0]);
|
||||
_tutorialText = param4[0];
|
||||
_tutorialMediaId = param3.getIntItem(0);
|
||||
_tutorialSubtitleId = param7.getIntItem(0);
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(_tutorialMediaId,onMediaItemLoaded,true);
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
}
|
||||
|
||||
private function onArtGLReceived(param1:Object) : void
|
||||
{
|
||||
var _loc4_:Array = null;
|
||||
var _loc3_:int = 0;
|
||||
var _loc5_:Array = null;
|
||||
var _loc2_:int = 0;
|
||||
if(_bulletinBoardPopup)
|
||||
{
|
||||
_artMediaIds = param1.data.jammerCentralGallery;
|
||||
_loc4_ = param1.data.jammerCentralHowls.split(/\"\|/g);
|
||||
_loc3_ = 0;
|
||||
shuffle(_loc4_);
|
||||
_howlsTextArray = [];
|
||||
_loc2_ = 0;
|
||||
for(; _loc2_ < _loc4_.length; _loc2_++)
|
||||
{
|
||||
if(_howlsTextArray[_loc3_] == null)
|
||||
{
|
||||
_howlsTextArray[_loc3_] = new String();
|
||||
}
|
||||
else if(_howlsTextArray[_loc3_].length > 1700)
|
||||
{
|
||||
_loc2_--;
|
||||
_loc3_++;
|
||||
continue;
|
||||
}
|
||||
_loc5_ = _loc4_[_loc2_].split(":");
|
||||
_loc5_[0] = LocalizationManager.translateAvatarName(_loc5_[0]).toUpperCase();
|
||||
_loc4_[_loc2_] = _loc5_.join(":");
|
||||
_loc4_[_loc2_] = _loc4_[_loc2_].replace(/\n/g,"");
|
||||
_howlsTextArray[_loc3_] += _loc4_[_loc2_] + "\" - ";
|
||||
}
|
||||
_howlIndex = 0;
|
||||
setUpHowls();
|
||||
_artPageNum = 0;
|
||||
_jcLoader = new JCDefHelper();
|
||||
_jcLoader.init(_artMediaIds[_artPageNum],onArtDataLoaded);
|
||||
}
|
||||
}
|
||||
|
||||
private function onWhatsNewImagesListLoaded(param1:int, param2:Array, param3:Array) : void
|
||||
{
|
||||
_whatsNewImageIds = param2;
|
||||
_whatsNewImageIndex = 0;
|
||||
loadWhatsNewImage();
|
||||
}
|
||||
|
||||
private function onWhatsNewVideosLoaded(param1:int, param2:IntItemCollection, param3:IntItemCollection, param4:Array, param5:Array, param6:IntItemCollection, param7:IntItemCollection) : void
|
||||
{
|
||||
_whatsNewStreamId = param2.getIntItem(0);
|
||||
_whatsNewStreamText = param4[0];
|
||||
_whatsNewStreamThumbId = param3.getIntItem(0);
|
||||
_whatsNewStreamSubtitleId = param7.getIntItem(0);
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(_whatsNewStreamThumbId,onMediaItemLoaded,true);
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
}
|
||||
|
||||
private function loadWhatsNewImage() : void
|
||||
{
|
||||
_whatsNewImageLoadingSpiral.visible = true;
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(_whatsNewImageIds[_whatsNewImageIndex],onWhatsNewImagesLoaded);
|
||||
}
|
||||
|
||||
private function onWhatsNewImagesLoaded(param1:MovieClip) : void
|
||||
{
|
||||
_whatsNewImageLoadingSpiral.visible = false;
|
||||
while(_whatsNewPopup.photoItemWindow.numChildren > 1)
|
||||
{
|
||||
_whatsNewPopup.photoItemWindow.removeChildAt(_whatsNewPopup.photoItemWindow.numChildren - 1);
|
||||
}
|
||||
_whatsNewPopup.photoItemWindow.addChild(param1);
|
||||
}
|
||||
|
||||
private function shuffle(param1:Array) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:String = null;
|
||||
var _loc4_:int = 0;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < param1.length)
|
||||
{
|
||||
_loc2_ = param1[_loc3_];
|
||||
_loc4_ = Math.floor(Math.random() * param1.length);
|
||||
param1[_loc3_] = param1[_loc4_];
|
||||
param1[_loc4_] = _loc2_;
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopupDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onPopupClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBTracker.pop();
|
||||
switch(param1.currentTarget.parent)
|
||||
{
|
||||
case _whatsNewPopup:
|
||||
_guiLayer.removeChild(_whatsNewPopup);
|
||||
DarkenManager.unDarken(_whatsNewPopup);
|
||||
break;
|
||||
case _artGalleryPopup:
|
||||
_guiLayer.removeChild(_artGalleryPopup);
|
||||
DarkenManager.unDarken(_artGalleryPopup);
|
||||
_artGalleryPopup.visible = false;
|
||||
_artSpiral.visible = false;
|
||||
break;
|
||||
case _bulletinBoardPopup:
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
break;
|
||||
case _costumePopup:
|
||||
_guiLayer.removeChild(_costumePopup);
|
||||
DarkenManager.unDarken(_costumePopup);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPlayMovieDown(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:IntItemCollection = null;
|
||||
var _loc3_:IntItemCollection = null;
|
||||
param1.stopPropagation();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
if(_bulletinBoardPopup && param1.currentTarget == _bulletinBoardPopup.playMovBtn)
|
||||
{
|
||||
_loc2_ = new IntItemCollection();
|
||||
_loc2_.pushIntItem(_tutorialStreamId);
|
||||
_loc3_ = new IntItemCollection();
|
||||
_loc3_.pushIntItem(_tutorialSubtitleId);
|
||||
GuiManager.initMoviePlayer(39,_loc2_,[_tutorialText],_loc3_,false,768,432);
|
||||
GuiManager.setVideoPlayerSkin(5);
|
||||
}
|
||||
else if(_whatsNewPopup && param1.currentTarget == _whatsNewPopup.playMovBtn)
|
||||
{
|
||||
_loc2_ = new IntItemCollection();
|
||||
_loc2_.pushIntItem(_whatsNewStreamId);
|
||||
_loc3_ = new IntItemCollection();
|
||||
_loc3_.pushIntItem(_whatsNewStreamSubtitleId);
|
||||
GuiManager.initMoviePlayer(39,_loc2_,[_whatsNewStreamText],_loc3_,false,768,432);
|
||||
GuiManager.setVideoPlayerSkin(5);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMinigameInfoResponse() : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
MinigameManager.handleGameClick(_gameLaunchObj,null,false);
|
||||
}
|
||||
|
||||
private function onCostumeBtnDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("/game/play/popup/jammerCentral/costumeCorner",-1,1);
|
||||
if(_costumePopup)
|
||||
{
|
||||
_guiLayer.addChild(_costumePopup);
|
||||
DarkenManager.darken(_costumePopup);
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(1634,onMediaItemLoaded,true);
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
}
|
||||
}
|
||||
|
||||
private function onWhatsNewBtnDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("/game/play/popup/jammerCentral/whatNew",-1,1);
|
||||
if(_whatsNewPopup)
|
||||
{
|
||||
_guiLayer.addChild(_whatsNewPopup);
|
||||
DarkenManager.darken(_whatsNewPopup);
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(4428,onMediaItemLoaded,true);
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
}
|
||||
}
|
||||
|
||||
private function onSubmitHowlDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("/game/play/popup/jammerCentral/submit/howl",-1,1);
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
FeedbackManager.openFeedbackPopup(3);
|
||||
}
|
||||
|
||||
private function onSubmitWorkDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("/game/play/popup/jammerCentral/submit/art",-1,1);
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
FeedbackManager.openFeedbackPopup(4);
|
||||
}
|
||||
|
||||
private function onArtGalleryDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_artSpiral && _artSpiral.visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("/game/play/popup/jammerCentral/artGallery/#page1",-1,1);
|
||||
if(_artGalleryPopup)
|
||||
{
|
||||
_guiLayer.addChild(_artGalleryPopup);
|
||||
DarkenManager.darken(_artGalleryPopup);
|
||||
_artGalleryPopup.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(565,onMediaItemLoaded,true);
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
}
|
||||
}
|
||||
|
||||
private function onGalleryLeftRightDown(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:Object = null;
|
||||
if(!_artSpiral.visible)
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.name == "lBtn")
|
||||
{
|
||||
if(_artPageNum - 1 < 0)
|
||||
{
|
||||
_artPageNum = _artMediaIds.length - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_artPageNum = _artPageNum - 1;
|
||||
}
|
||||
}
|
||||
else if(_artPageNum + 1 >= _artMediaIds.length)
|
||||
{
|
||||
_artPageNum = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_artPageNum = _artPageNum + 1;
|
||||
}
|
||||
SBTracker.trackPageview("/game/play/popup/jammerCentral/artGallery/#page" + (_artPageNum + 1),-1,1);
|
||||
}
|
||||
_loc3_ = int(_artMediaIds[_artPageNum]);
|
||||
_loc2_ = _artObjects[_loc3_];
|
||||
if(_loc2_ && _loc2_.img != null)
|
||||
{
|
||||
while(_artGalleryPopup.itemWindow.numChildren > 1)
|
||||
{
|
||||
_artGalleryPopup.itemWindow.removeChildAt(1);
|
||||
}
|
||||
_artGalleryPopup.itemWindow.addChild(_loc2_.img);
|
||||
displayText(_loc3_);
|
||||
}
|
||||
else
|
||||
{
|
||||
_artSpiral.setNewParent(_artGalleryPopup.itemWindow,_artGalleryPopup.itemWindow.width * 0.5,_artGalleryPopup.itemWindow.height * 0.5);
|
||||
_artSpiral.visible = true;
|
||||
_jcLoader = new JCDefHelper();
|
||||
_jcLoader.init(_artMediaIds[_artPageNum],onArtDataLoaded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onLeftRightWhatsNew(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget == _whatsNewPopup.leftBtn)
|
||||
{
|
||||
_whatsNewImageIndex = _whatsNewImageIndex - 1;
|
||||
if(_whatsNewImageIndex < 0)
|
||||
{
|
||||
_whatsNewImageIndex = _whatsNewImageIds.length - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_whatsNewImageIndex = _whatsNewImageIndex + 1;
|
||||
if(_whatsNewImageIndex > _whatsNewImageIds.length - 1)
|
||||
{
|
||||
_whatsNewImageIndex = 0;
|
||||
}
|
||||
}
|
||||
loadWhatsNewImage();
|
||||
}
|
||||
|
||||
private function setUpHowls() : void
|
||||
{
|
||||
_howlTextField.cacheAsBitmap = true;
|
||||
_howlTextField.autoSize = "left";
|
||||
_howlTextField.antiAliasType = "advanced";
|
||||
_howlTextField.text = _howlsTextArray[_howlIndex];
|
||||
_howlTextField.scrollRect = new Rectangle(0,0,564,18);
|
||||
_scrollRect = _howlTextField.scrollRect;
|
||||
_scrollRect.x = -564;
|
||||
_howlTextField.scrollRect = _scrollRect;
|
||||
if(_howlTimer)
|
||||
{
|
||||
_howlTimer.reset();
|
||||
_howlTimer.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_howlTimer = new Timer(41.666666666666664);
|
||||
_howlTimer.addEventListener("timer",onTimerEvent,false,0,true);
|
||||
_howlTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
private function onTimerEvent(param1:TimerEvent) : void
|
||||
{
|
||||
if(_scrollRect.x >= _howlTextField.textWidth)
|
||||
{
|
||||
_scrollRect.x = -564;
|
||||
if(_howlIndex < _howlsTextArray.length - 1)
|
||||
{
|
||||
_howlIndex = _howlIndex + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_howlIndex = 0;
|
||||
}
|
||||
_howlTextField.text = _howlsTextArray[_howlIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
_scrollRect.x += 1;
|
||||
}
|
||||
_howlTextField.scrollRect = _scrollRect;
|
||||
param1.updateAfterEvent();
|
||||
}
|
||||
|
||||
private function addGalleryListeners() : void
|
||||
{
|
||||
_artGalleryPopup.addEventListener("mouseDown",onPopupDown,false,0,true);
|
||||
_artGalleryPopup.bx.addEventListener("mouseDown",onPopupClose,false,0,true);
|
||||
_artGalleryPopup.lBtn.addEventListener("mouseDown",onGalleryLeftRightDown,false,0,true);
|
||||
_artGalleryPopup.rBtn.addEventListener("mouseDown",onGalleryLeftRightDown,false,0,true);
|
||||
}
|
||||
|
||||
private function removeGalleryListeners() : void
|
||||
{
|
||||
_artGalleryPopup.removeEventListener("mouseDown",onPopupDown);
|
||||
_artGalleryPopup.bx.removeEventListener("mouseDown",onPopupClose);
|
||||
_artGalleryPopup.lBtn.removeEventListener("mouseDown",onGalleryLeftRightDown);
|
||||
_artGalleryPopup.rBtn.removeEventListener("mouseDown",onGalleryLeftRightDown);
|
||||
}
|
||||
|
||||
private function addWhatsNewListeners() : void
|
||||
{
|
||||
_whatsNewPopup.addEventListener("mouseDown",onPopupDown,false,0,true);
|
||||
_whatsNewPopup.bx.addEventListener("mouseDown",onPopupClose,false,0,true);
|
||||
_whatsNewPopup.leftBtn.addEventListener("mouseDown",onLeftRightWhatsNew,false,0,true);
|
||||
_whatsNewPopup.rightBtn.addEventListener("mouseDown",onLeftRightWhatsNew,false,0,true);
|
||||
_whatsNewPopup.playMovBtn.addEventListener("mouseDown",onPlayMovieDown,false,0,true);
|
||||
}
|
||||
|
||||
private function removeWhatsNewListeners() : void
|
||||
{
|
||||
_whatsNewPopup.removeEventListener("mouseDown",onPopupDown);
|
||||
_whatsNewPopup.bx.removeEventListener("mouseDown",onPopupClose);
|
||||
_whatsNewPopup.leftBtn.removeEventListener("mouseDown",onLeftRightWhatsNew);
|
||||
_whatsNewPopup.rightBtn.removeEventListener("mouseDown",onLeftRightWhatsNew);
|
||||
_whatsNewPopup.playMovBtn.removeEventListener("mouseDown",onPlayMovieDown);
|
||||
}
|
||||
|
||||
private function addBoardListeners() : void
|
||||
{
|
||||
_bulletinBoardPopup.addEventListener("mouseDown",onPopupDown,false,0,true);
|
||||
_bulletinBoardPopup.bx.addEventListener("mouseDown",onPopupClose,false,0,true);
|
||||
_bulletinBoardPopup.playMovBtn.addEventListener("mouseDown",onPlayMovieDown,false,0,true);
|
||||
_bulletinBoardPopup.whatsNewBtn.addEventListener("mouseDown",onWhatsNewBtnDown,false,0,true);
|
||||
_bulletinBoardPopup.submitHowlBtn.addEventListener("mouseDown",onSubmitHowlDown,false,0,true);
|
||||
_bulletinBoardPopup.submitWorkBtn.addEventListener("mouseDown",onSubmitWorkDown,false,0,true);
|
||||
_bulletinBoardPopup.artBtn.addEventListener("mouseDown",onArtGalleryDown,false,0,true);
|
||||
}
|
||||
|
||||
private function removeBoardListeners() : void
|
||||
{
|
||||
_bulletinBoardPopup.removeEventListener("mouseDown",onPopupDown);
|
||||
_bulletinBoardPopup.bx.removeEventListener("mouseDown",onPopupClose);
|
||||
_bulletinBoardPopup.playMovBtn.removeEventListener("mouseDown",onPlayMovieDown);
|
||||
_bulletinBoardPopup.whatsNewBtn.removeEventListener("mouseDown",onWhatsNewBtnDown);
|
||||
_bulletinBoardPopup.submitHowlBtn.removeEventListener("mouseDown",onSubmitHowlDown);
|
||||
_bulletinBoardPopup.submitWorkBtn.removeEventListener("mouseDown",onSubmitWorkDown);
|
||||
_bulletinBoardPopup.artBtn.removeEventListener("mouseDown",onArtGalleryDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,457 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Point;
|
||||
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;
|
||||
|
||||
private var _msgTxt:Object;
|
||||
|
||||
private 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
|
||||
{
|
||||
_originalFrameId = param4;
|
||||
this.gotoAndStop(param4);
|
||||
_balloonBG = this["balloon_bg"];
|
||||
_msgTxt = this["message_txt"];
|
||||
_onCustomAdventureBtn = param6;
|
||||
_onCustomPVPBtn = param7;
|
||||
_emoteBGOffsetFunc = param2;
|
||||
_avType = param1;
|
||||
visible = false;
|
||||
_msgTxt.autoSize = "center";
|
||||
if(param3)
|
||||
{
|
||||
_maxAlpha = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_maxAlpha = 0.75;
|
||||
}
|
||||
_emoteBG = GETDEFINITIONBYNAME("emo_bubble");
|
||||
setEmoteBgOffsets();
|
||||
}
|
||||
|
||||
public function setText(param1:String, param2:Boolean = false, param3:Boolean = true) : void
|
||||
{
|
||||
if(_emote)
|
||||
{
|
||||
_permEmoteMediaId = -1;
|
||||
_emoteBG.itemWindow.removeChild(_emote);
|
||||
_emote = null;
|
||||
}
|
||||
if(contains(_emoteBG))
|
||||
{
|
||||
removeChild(_emoteBG);
|
||||
}
|
||||
if(param1 != _msgTxt.text && _hasSbTextfield)
|
||||
{
|
||||
_balloonBG.visible = false;
|
||||
setAlpha(_maxAlpha);
|
||||
this.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_balloonBG.visible = true;
|
||||
setAlpha(_maxAlpha);
|
||||
this.visible = true;
|
||||
}
|
||||
_msgTxt.text = param1;
|
||||
_msgTxt.height;
|
||||
if(!_hasSbTextfield)
|
||||
{
|
||||
if(param3)
|
||||
{
|
||||
_balloonBG.m.height = Math.ceil(_msgTxt.height);
|
||||
_balloonBG.m.y = _balloonBG.b.y - _balloonBG.m.height;
|
||||
_balloonBG.t.y = _balloonBG.m.y - _balloonBG.t.height;
|
||||
_msgTxt.y = -_balloonBG.b.height - _balloonBG.m.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
_balloonBG.m.height = Math.ceil(_msgTxt.height);
|
||||
_balloonBG.b.y = _balloonBG.m.y + _balloonBG.m.height;
|
||||
_msgTxt.y = _balloonBG.t.height + 3;
|
||||
}
|
||||
if(this.currentFrameLabel == "advBtn")
|
||||
{
|
||||
_btnBallonBG.y = _balloonBG.y + _balloonBG.t.y - _btnBallonBG.height + _balloonBG.t.height;
|
||||
}
|
||||
}
|
||||
if(param2)
|
||||
{
|
||||
_msgTxt.textColor = 13369344;
|
||||
}
|
||||
else
|
||||
{
|
||||
_msgTxt.textColor = 4477529;
|
||||
}
|
||||
_timeout = 8000;
|
||||
if(param3 && 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(_emote && _emoteBG)
|
||||
{
|
||||
_emoteBG.itemWindow.removeChild(_emote);
|
||||
_emote = null;
|
||||
if(contains(_emoteBG))
|
||||
{
|
||||
removeChild(_emoteBG);
|
||||
}
|
||||
}
|
||||
if(this.currentFrameLabel != "advBtn")
|
||||
{
|
||||
this.gotoAndStop("advBtn");
|
||||
}
|
||||
_balloonBG = this["balloon_bg"];
|
||||
_btnBallonBG = this["btnBalloon_bg"];
|
||||
_btnBalloonMouseBG = _btnBallonBG.mouse.mouse;
|
||||
_btnBalloonUpBG = _btnBallonBG.mouse.up;
|
||||
_btnBalloonDownBg = _btnBallonBG.down;
|
||||
_btnBalloonGrayBG = _btnBallonBG.gray;
|
||||
_btnBallonBG.isForPVP = param5;
|
||||
_btnBallonBG.PVPGameId = _loc6_;
|
||||
_btnBallonBG.scriptDefId = _loc7_;
|
||||
_btnBallonBG.addEventListener("mouseDown",onBtnBG,false,0,true);
|
||||
_msgTxt = this["message_txt"];
|
||||
_msgTxt.autoSize = "center";
|
||||
LocalizationManager.translateId(_btnBalloonMouseBG.message_txt,11259);
|
||||
LocalizationManager.translateId(_btnBalloonUpBG.message_txt,11259);
|
||||
LocalizationManager.translateId(_btnBalloonDownBg.message_txt,11259);
|
||||
LocalizationManager.translateId(_btnBalloonGrayBG.message_txt,11259);
|
||||
if(param3 > 0)
|
||||
{
|
||||
_btnBalloonMouseBG.message_txt.x = 3;
|
||||
_btnBalloonUpBG.message_txt.x = 3;
|
||||
_btnBalloonDownBg.message_txt.x = 3;
|
||||
_btnBalloonGrayBG.message_txt.x = 3;
|
||||
_btnBallonBG["redDot"].visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_btnBalloonMouseBG.message_txt.x = 17;
|
||||
_btnBalloonUpBG.message_txt.x = 17;
|
||||
_btnBalloonDownBg.message_txt.x = 17;
|
||||
_btnBalloonGrayBG.message_txt.x = 17;
|
||||
_btnBallonBG["redDot"].visible = false;
|
||||
}
|
||||
_msgTxt.text = param1;
|
||||
_originalCustomMsgText = param1;
|
||||
_balloonBG.m.height = _msgTxt.height;
|
||||
_balloonBG.m.y = _balloonBG.b.y - _msgTxt.height;
|
||||
_balloonBG.t.y = _balloonBG.m.y - _balloonBG.t.height;
|
||||
_msgTxt.y = -_balloonBG.b.height - _msgTxt.height;
|
||||
_btnBallonBG.y = _balloonBG.y + _balloonBG.t.y - _btnBallonBG.height + _balloonBG.t.height;
|
||||
if(this.itemWindow)
|
||||
{
|
||||
this.itemWindow.y = _btnBallonBG.y;
|
||||
}
|
||||
_balloonBG.t.alpha = 0;
|
||||
setAlpha(_maxAlpha);
|
||||
this.visible = true;
|
||||
_timeout = 8000;
|
||||
if(this.parent)
|
||||
{
|
||||
this.parent.addChild(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_btnBallonBG)
|
||||
{
|
||||
if(_btnBallonBG.isForPVP != param5)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_btnBallonBG.removeEventListener("mouseDown",onBtnBG);
|
||||
}
|
||||
if(this.currentFrameLabel == "advBtn")
|
||||
{
|
||||
this.gotoAndStop(_originalFrameId);
|
||||
}
|
||||
_balloonBG = this["balloon_bg"];
|
||||
_msgTxt = this["message_txt"];
|
||||
_msgTxt.autoSize = "center";
|
||||
this.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function get msgTxt() : Object
|
||||
{
|
||||
return _msgTxt;
|
||||
}
|
||||
|
||||
public function get isPvpCustom() : Boolean
|
||||
{
|
||||
if(_btnBallonBG)
|
||||
{
|
||||
return _btnBallonBG.isForPVP;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get pvpGameId() : int
|
||||
{
|
||||
if(_btnBallonBG)
|
||||
{
|
||||
return _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)
|
||||
{
|
||||
_onCustomPVPBtn(param1.currentTarget.PVPGameId);
|
||||
}
|
||||
else
|
||||
{
|
||||
_onCustomAdventureBtn(param1.currentTarget.scriptDefId);
|
||||
}
|
||||
}
|
||||
|
||||
private function updateCustAdventureBGSize(param1:MovieClip, param2:Object) : void
|
||||
{
|
||||
_balloonBG.m.height = _msgTxt.height;
|
||||
_balloonBG.m.y = _balloonBG.b.y - _msgTxt.height;
|
||||
_balloonBG.t.y = _balloonBG.m.y - _balloonBG.t.height;
|
||||
_msgTxt.y = -_balloonBG.b.height - _msgTxt.height;
|
||||
_btnBallonBG.y = _balloonBG.y + _balloonBG.t.y - _btnBallonBG.height + _balloonBG.t.height;
|
||||
if(this.itemWindow)
|
||||
{
|
||||
this.itemWindow.y = _btnBallonBG.y;
|
||||
}
|
||||
}
|
||||
|
||||
private function updateSizeFunction() : void
|
||||
{
|
||||
_balloonBG.m.height = _msgTxt.height;
|
||||
_balloonBG.m.y = _balloonBG.b.y - _msgTxt.height;
|
||||
_balloonBG.t.y = _balloonBG.m.y - _balloonBG.t.height;
|
||||
var _loc1_:Number = Number(_msgTxt.y);
|
||||
_msgTxt.y = -_balloonBG.b.height - _msgTxt.height;
|
||||
_msgTxt.adjustSmileys(_loc1_ - _msgTxt.y);
|
||||
_balloonBG.visible = true;
|
||||
this.visible = true;
|
||||
}
|
||||
|
||||
public function setEmote(param1:Sprite, param2:int = -1) : void
|
||||
{
|
||||
if(this.currentFrameLabel != "advBtn")
|
||||
{
|
||||
_permEmoteMediaId = param2;
|
||||
if(_emote)
|
||||
{
|
||||
_emoteBG.itemWindow.removeChild(_emote);
|
||||
_emote = null;
|
||||
}
|
||||
if(_permEmoteMediaId >= 0)
|
||||
{
|
||||
param1 = new Sprite();
|
||||
_permEmoteMediaHelper = new MediaHelper();
|
||||
_permEmoteMediaHelper.init(_permEmoteMediaId,permEmoteMediaCallback);
|
||||
}
|
||||
if(param1)
|
||||
{
|
||||
_msgTxt.text = "";
|
||||
addChild(_emoteBG);
|
||||
_emote = param1;
|
||||
_emote.y = -5;
|
||||
_emoteBG.itemWindow.addChild(_emote);
|
||||
if(_emote is MovieClip)
|
||||
{
|
||||
MovieClip(_emote).gotoAndPlay(1);
|
||||
}
|
||||
if(this.currentFrameLabel != "advBtn")
|
||||
{
|
||||
_timeout = 8000;
|
||||
}
|
||||
_balloonBG.visible = false;
|
||||
setAlpha(1);
|
||||
_emoteBG.bubble.alpha = _maxAlpha;
|
||||
_emoteBG.itemWindow.alpha = 1;
|
||||
this.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setReadyForClear() : void
|
||||
{
|
||||
if(this.visible && _timeout > 1000)
|
||||
{
|
||||
_timeout = 1000;
|
||||
}
|
||||
_permEmoteMediaId = -1;
|
||||
}
|
||||
|
||||
public function setPos(param1:int, param2:int) : void
|
||||
{
|
||||
this.x = param1;
|
||||
this.y = param2;
|
||||
}
|
||||
|
||||
public function heartbeat(param1:int) : void
|
||||
{
|
||||
if(_timeout && _permEmoteMediaId < 0)
|
||||
{
|
||||
if(param1 >= _timeout)
|
||||
{
|
||||
_timeout = 0;
|
||||
if(_emote)
|
||||
{
|
||||
_emoteBG.itemWindow.removeChild(_emote);
|
||||
_emote = null;
|
||||
}
|
||||
if(this.currentFrameLabel != "advBtn")
|
||||
{
|
||||
this.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_msgTxt.text = _originalCustomMsgText;
|
||||
updateCustAdventureBGSize(_balloonBG,_msgTxt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_timeout -= param1;
|
||||
if(this.currentFrameLabel != "advBtn" && _timeout < 1000)
|
||||
{
|
||||
setAlpha(_timeout / 1000 * _maxAlpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function set avType(param1:int) : void
|
||||
{
|
||||
if(param1 != _avType)
|
||||
{
|
||||
_avType = param1;
|
||||
setEmoteBgOffsets();
|
||||
}
|
||||
}
|
||||
|
||||
public function updateEmoteBgOffsets() : void
|
||||
{
|
||||
setEmoteBgOffsets();
|
||||
}
|
||||
|
||||
private function setAlpha(param1:Number) : void
|
||||
{
|
||||
this.alpha = param1;
|
||||
_msgTxt.alpha = 1;
|
||||
}
|
||||
|
||||
private function permEmoteMediaCallback(param1:MovieClip) : void
|
||||
{
|
||||
if(param1 && _emote && _permEmoteMediaId >= 0)
|
||||
{
|
||||
param1.scaleX = 0.5;
|
||||
param1.scaleY = 0.5;
|
||||
param1.x = -(param1.width * 0.5);
|
||||
param1.y = -(param1.height * 0.5);
|
||||
_emote.addChild(param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function setEmoteBgOffsets() : void
|
||||
{
|
||||
var _loc1_:Point = _emoteBGOffsetFunc(_avType);
|
||||
_emoteBG.x = _loc1_.x;
|
||||
_emoteBG.y = _loc1_.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,180 @@
|
||||
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
|
||||
{
|
||||
_id = param1;
|
||||
_width = param2;
|
||||
_height = param3;
|
||||
_colorValues = param6;
|
||||
_colorIndexes = param7;
|
||||
_numCols = param4;
|
||||
_numRows = param5;
|
||||
_cellWidth = _width / _numCols;
|
||||
_cellHeight = _height / _numRows;
|
||||
_colorChangeCallback = param9;
|
||||
_secretColorIdx = param10;
|
||||
_bmd = new BitmapData(_width,_height,false,0);
|
||||
fillColorTable();
|
||||
_currColor = param8;
|
||||
setCurrentColorSwatch(_currColor);
|
||||
addEventListener("mouseDown",colorTableClickHandler,false,0,true);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(_bm)
|
||||
{
|
||||
this.removeChild(_bm);
|
||||
_bm = null;
|
||||
}
|
||||
if(_bmd)
|
||||
{
|
||||
_bmd = null;
|
||||
}
|
||||
_colorIndexes = null;
|
||||
_colorValues = null;
|
||||
removeEventListener("mouseDown",colorTableClickHandler);
|
||||
}
|
||||
|
||||
private function fillColorTable() : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc1_:Rectangle = null;
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _colorIndexes.length)
|
||||
{
|
||||
_loc2_ = _loc4_ % _numCols * (_width / _numCols);
|
||||
_loc3_ = Math.floor(_loc4_ / _numCols) * (_height / _numRows);
|
||||
_loc1_ = new Rectangle(_loc2_,_loc3_,_width / _numCols,_height / _numRows);
|
||||
_bmd.fillRect(_loc1_,_colorValues[_colorIndexes[_loc4_]]);
|
||||
_loc4_++;
|
||||
}
|
||||
_bm = new Bitmap(_bmd);
|
||||
this.addChild(_bm);
|
||||
}
|
||||
|
||||
private function setCurrentColorSwatch(param1:int) : void
|
||||
{
|
||||
var x:int;
|
||||
var y:int;
|
||||
var color:int = param1;
|
||||
var idxInPalette:int = -1;
|
||||
var i:int = 0;
|
||||
while(i < _colorIndexes.length)
|
||||
{
|
||||
if(_colorIndexes[i] == color)
|
||||
{
|
||||
idxInPalette = i;
|
||||
break;
|
||||
}
|
||||
i = i + 1;
|
||||
}
|
||||
if(_currColorSwatch)
|
||||
{
|
||||
this.removeChild(_currColorSwatch);
|
||||
_currColorSwatch = null;
|
||||
}
|
||||
if(idxInPalette >= 0)
|
||||
{
|
||||
x = idxInPalette % _numCols * _cellWidth;
|
||||
y = Math.floor(idxInPalette / _numCols) * _cellHeight;
|
||||
_currColorSwatch = new Sprite();
|
||||
with(_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(_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 == _width)
|
||||
{
|
||||
if(_secretColorIdx == -1)
|
||||
{
|
||||
_loc2_.x = _width - 1;
|
||||
}
|
||||
else if(_loc2_.y < _cellHeight * (_numRows - 1))
|
||||
{
|
||||
_loc2_.x = _width - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = _secretColorIdx;
|
||||
}
|
||||
}
|
||||
if(_loc3_ < 0)
|
||||
{
|
||||
_loc4_ = Math.floor(_loc2_.x / _cellWidth) + Math.floor(_loc2_.y / _cellHeight) * _numCols;
|
||||
_loc3_ = int(_colorIndexes[_loc4_]);
|
||||
}
|
||||
if(_currColor != _loc3_)
|
||||
{
|
||||
_currColor = _loc3_;
|
||||
setCurrentColorSwatch(_loc3_);
|
||||
if(_colorChangeCallback != null)
|
||||
{
|
||||
_colorChangeCallback(_id,_loc3_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
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.MouseCursorData;
|
||||
|
||||
public class CursorManager extends Sprite
|
||||
{
|
||||
|
||||
public static const CUSTOM_CURSOR:String = "custom_cursor";
|
||||
|
||||
public static const DEFAULT_I_CURSOR:String = "ibeam";
|
||||
|
||||
public static const DEFAULT_CURSOR:String = "Default_Cursor";
|
||||
|
||||
private static var _customCursor:Sprite;
|
||||
|
||||
private static var _mcd:MouseCursorData;
|
||||
|
||||
private static var _previousCursor:String;
|
||||
|
||||
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 "ibeam":
|
||||
Mouse.cursor = "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("ibeam");
|
||||
}
|
||||
else
|
||||
{
|
||||
switchToCursor(_previousCursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function convertToBitmapData(param1:DisplayObject) : BitmapData
|
||||
{
|
||||
var _loc3_:Rectangle = new Rectangle(0,0,19,24);
|
||||
var _loc2_:BitmapData = new BitmapData(19,24,true,0);
|
||||
_loc2_.draw(param1);
|
||||
return _loc2_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,378 @@
|
||||
package gui
|
||||
{
|
||||
import achievement.AchievementXtCommManager;
|
||||
import com.sbi.analytics.SBTracker;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import currency.UserCurrency;
|
||||
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
|
||||
{
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
_closeCallback = param2;
|
||||
_giftIndex = param1;
|
||||
_giftingPopupMediaHelper = new MediaHelper();
|
||||
_giftingPopupMediaHelper.init(2539,giftingPopupCallback);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
removeEventListeners();
|
||||
if(_giftPopup)
|
||||
{
|
||||
_giftPopup.destroy();
|
||||
_giftPopup = null;
|
||||
}
|
||||
_giftDataToStillBeDisplayed = null;
|
||||
if(_giftingPopupContent)
|
||||
{
|
||||
DarkenManager.unDarken(_giftingPopupContent.parent);
|
||||
_guiLayer.removeChild(_giftingPopupContent.parent);
|
||||
_giftingPopupContent.visible = false;
|
||||
_giftingPopupContent = null;
|
||||
_giftingPopupMediaHelper = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function giftingPopupCallback(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_giftingPopupContent = MovieClip(param1.getChildAt(0));
|
||||
param1.x = 900 * 0.5;
|
||||
param1.y = 550 * 0.5;
|
||||
_additionalDiamond = new Array(false,false,true,false,true,false,false,true,false,false,true,false,false,true,false,true,false,false,false,false,false,false,true,false,true,false,false,true,false,false,false);
|
||||
setupPopup();
|
||||
addEventListeners();
|
||||
_guiLayer.addChild(param1);
|
||||
DarkenManager.darken(param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function setupPopup() : void
|
||||
{
|
||||
var _loc3_:MovieClip = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc1_:Number = Number(gMainFrame.userInfo.userVarCache.getUserVarValueById(373));
|
||||
_loc2_ = 1;
|
||||
while(_loc2_ <= 31)
|
||||
{
|
||||
_loc3_ = _giftingPopupContent["gift" + _loc2_];
|
||||
if(_loc2_ < _giftIndex + 1)
|
||||
{
|
||||
if(_loc1_ != -1 && (_loc1_ & 1 << _loc2_ - 1) > 0)
|
||||
{
|
||||
_loc3_.gotoAndStop("opened");
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_.gotoAndStop("missed");
|
||||
_loc3_.missedGift.diamond.visible = _additionalDiamond[_loc2_ - 1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_loc2_ > _giftIndex + 1)
|
||||
{
|
||||
_loc3_.gotoAndStop("unopened");
|
||||
_loc3_.unopenedGift.highlight.visible = false;
|
||||
_loc3_.unopenedGift.openTag.visible = false;
|
||||
_loc3_.unopenedGift.currIndex = _loc2_;
|
||||
_loc3_.unopenedGift.shine.visible = false;
|
||||
_loc3_.unopenedGift.gift.addEventListener("mouseDown",onFutureGiftDown,false,0,true);
|
||||
_loc3_.unopenedGift.diamond.addEventListener("mouseDown",onFutureGiftDown,false,0,true);
|
||||
}
|
||||
else if(_loc2_ == _giftIndex + 1)
|
||||
{
|
||||
_loc3_.gotoAndStop("unopened");
|
||||
_loc3_.unopenedGift.openTag.visible = true;
|
||||
_loc3_.unopenedGift.highlight.visible = false;
|
||||
_loc3_.unopenedGift.highlight.mouseChildren = false;
|
||||
_loc3_.unopenedGift.highlight.mouseEnabled = false;
|
||||
_loc3_.unopenedGift.shine.mouseChildren = false;
|
||||
_loc3_.unopenedGift.shine.mouseEnabled = false;
|
||||
_loc3_.unopenedGift.gift.addEventListener("mouseDown",onGiftDown,false,0,true);
|
||||
_loc3_.unopenedGift.gift.addEventListener("rollOver",onGiftOver,false,0,true);
|
||||
_loc3_.unopenedGift.gift.addEventListener("rollOut",onGiftOut,false,0,true);
|
||||
_loc3_.unopenedGift.diamond.addEventListener("mouseDown",onGiftDown,false,0,true);
|
||||
}
|
||||
if(!gMainFrame.userInfo.isMember)
|
||||
{
|
||||
_loc3_.unopenedGift.diamond.gotoAndStop("nonMember");
|
||||
}
|
||||
_loc3_.unopenedGift.diamond.visible = _additionalDiamond[_loc2_ - 1];
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
|
||||
public function setupGiftPopup() : void
|
||||
{
|
||||
var _loc7_:Object = null;
|
||||
var _loc2_:Object = null;
|
||||
var _loc8_:int = 0;
|
||||
var _loc10_:int = 0;
|
||||
var _loc1_:int = 1;
|
||||
var _loc3_:int = 2;
|
||||
var _loc9_:int = 3;
|
||||
var _loc6_:Array = new Array(_loc1_,_loc1_,_loc10_,_loc1_,_loc10_,_loc10_,_loc1_,_loc1_,_loc10_,_loc1_,_loc1_,_loc10_,_loc1_,_loc10_,_loc1_,_loc1_,_loc10_,_loc1_,_loc1_,_loc1_,_loc10_,_loc10_,_loc10_,_loc10_,_loc10_,_loc1_,_loc1_,_loc1_,_loc10_,_loc1_,_loc1_);
|
||||
var _loc4_:Array = new Array(2439,2453,851,2450,1051,852,1825,2436,527,1810,1842,850,1806,525,1808,2456,249,1164,1165,1844,692,853,854,1052,691,1833,1832,1826,526,1827,2458);
|
||||
var _loc11_:int = 0;
|
||||
var _loc5_:int = int(gMainFrame.clientInfo.dailyGiftIndex);
|
||||
if(_loc5_ <= _loc6_.length)
|
||||
{
|
||||
if(_loc6_[_giftIndex] == _loc10_)
|
||||
{
|
||||
_loc2_ = ItemXtCommManager.getItemDef(_loc4_[_loc5_]);
|
||||
_randColorIndex = (_loc2_.colors.length - 1) * Math.random();
|
||||
_loc7_ = new Item();
|
||||
_loc7_.init(_loc2_.defId,0,_loc2_.colors[_randColorIndex],0,0,true);
|
||||
_loc8_ = 1;
|
||||
}
|
||||
else if(_loc6_[_giftIndex] == _loc1_)
|
||||
{
|
||||
_loc2_ = DenXtCommManager.getDenItemDef(_loc4_[_loc5_]);
|
||||
_loc7_ = new DenItem();
|
||||
_loc7_.initShopItem(_loc2_.id,0);
|
||||
_loc8_ = 2;
|
||||
}
|
||||
else if(_loc6_[_giftIndex] == _loc3_)
|
||||
{
|
||||
_loc8_ = 0;
|
||||
}
|
||||
else if(_loc6_[_giftIndex] == _loc9_)
|
||||
{
|
||||
_loc8_ = 8;
|
||||
}
|
||||
if(_additionalDiamond[_giftIndex])
|
||||
{
|
||||
_diamondAmount = 1;
|
||||
_giftingPopupMediaHelper = new MediaHelper();
|
||||
_giftingPopupMediaHelper.init(2221,onDiamondIconLoaded);
|
||||
_giftDataToStillBeDisplayed = {
|
||||
"currItem":_loc7_,
|
||||
"defIdOrAmount":_loc4_[_loc5_],
|
||||
"giftType":_loc8_
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
checkAndInitializeGiftPopup(_loc8_,_loc7_,_loc4_[_loc5_]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
}
|
||||
}
|
||||
|
||||
private function checkAndInitializeGiftPopup(param1:int, param2:Object, param3:int) : void
|
||||
{
|
||||
if(param1 == 0)
|
||||
{
|
||||
_gemAmount = param3;
|
||||
_giftingPopupMediaHelper = new MediaHelper();
|
||||
_giftingPopupMediaHelper.init(1086,onGemIconLoaded);
|
||||
}
|
||||
else if(param1 == 8)
|
||||
{
|
||||
_diamondAmount = param3;
|
||||
_giftingPopupMediaHelper = new MediaHelper();
|
||||
_giftingPopupMediaHelper.init(2221,onDiamondIconLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
_giftPopup = new GiftPopup();
|
||||
_giftPopup.init(_guiLayer,param2.largeIcon,param2.name,param3,4,param1,keepGiftCallback,rejectGiftCallback);
|
||||
}
|
||||
}
|
||||
|
||||
private function onGemIconLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_giftPopup = new GiftPopup();
|
||||
_giftPopup.init(_guiLayer,param1,LocalizationManager.translateIdAndInsertOnly(_gemAmount == 1 ? 11114 : 11097,_gemAmount),_gemAmount,4,0,null,keepGiftCallback,null,false,1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onDiamondIconLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_giftPopup = new GiftPopup();
|
||||
_giftPopup.init(_guiLayer,param1,LocalizationManager.translateIdAndInsertOnly(_diamondAmount == 1 ? 11116 : 11103,_diamondAmount),_diamondAmount,4,8,null,keepDiamondGiftCallback,null,false,1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBTracker.trackPageview("game/play/popup/dailyGift/close");
|
||||
close();
|
||||
}
|
||||
|
||||
private function keepDiamondGiftCallback() : void
|
||||
{
|
||||
if(_giftDataToStillBeDisplayed != null)
|
||||
{
|
||||
_giftPopup.destroy();
|
||||
checkAndInitializeGiftPopup(_giftDataToStillBeDisplayed.giftType,_giftDataToStillBeDisplayed.currItem,_giftDataToStillBeDisplayed.defIdOrAmount);
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_giftingPopupContent.visible = false;
|
||||
AchievementXtCommManager.requestSetUserVar(214,_randColorIndex,setVarCallback);
|
||||
AchievementXtCommManager.requestSetUserVar(373,_giftIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private function keepGiftCallback() : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_giftingPopupContent.visible = false;
|
||||
AchievementXtCommManager.requestSetUserVar(214,_randColorIndex,setVarCallback);
|
||||
AchievementXtCommManager.requestSetUserVar(373,_giftIndex);
|
||||
}
|
||||
|
||||
private function rejectGiftCallback() : void
|
||||
{
|
||||
if(_giftDataToStillBeDisplayed)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_giftingPopupContent.visible = false;
|
||||
AchievementXtCommManager.requestSetUserVar(214,666,setVarCallback);
|
||||
AchievementXtCommManager.requestSetUserVar(373,_giftIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
private function setVarCallback(param1:int, param2:int) : void
|
||||
{
|
||||
if(_gemAmount > 0)
|
||||
{
|
||||
UserCurrency.setCurrency(UserCurrency.getCurrency(0) + _gemAmount,0);
|
||||
}
|
||||
if(_diamondAmount > 0)
|
||||
{
|
||||
UserCurrency.setCurrency(UserCurrency.getCurrency(3) + _diamondAmount,3);
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
close();
|
||||
}
|
||||
|
||||
private function close() : void
|
||||
{
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
_closeCallback = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function onGiftDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBTracker.trackPageview("game/play/popup/dailyGift/" + param1.currentTarget.name);
|
||||
setupGiftPopup();
|
||||
}
|
||||
|
||||
private function onFutureGiftDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
var _loc2_:int = param1.currentTarget.parent.currIndex - (_giftIndex + 1);
|
||||
new SBOkPopup(_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
|
||||
{
|
||||
_giftingPopupContent.bx.addEventListener("mouseDown",onClose,false,0,true);
|
||||
_giftingPopupContent.addEventListener("mouseDown",onPopupDown,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
var _loc2_:MovieClip = null;
|
||||
var _loc1_:int = 0;
|
||||
_giftingPopupContent.bx.removeEventListener("mouseDown",onClose);
|
||||
_giftingPopupContent.removeEventListener("mouseDown",onPopupDown);
|
||||
_loc1_ = _giftIndex + 1;
|
||||
while(_loc1_ <= 25)
|
||||
{
|
||||
_loc2_ = _giftingPopupContent["gift" + _loc1_];
|
||||
_loc2_.unopenedGift.gift.removeEventListener("mouseDown",onGiftDown);
|
||||
_loc2_.unopenedGift.gift.removeEventListener("rollOver",onGiftOver);
|
||||
_loc2_.unopenedGift.gift.removeEventListener("rollOut",onGiftOut);
|
||||
_loc2_.unopenedGift.gift.removeEventListener("mouseDown",onFutureGiftDown);
|
||||
_loc2_.unopenedGift.diamond.removeEventListener("mouseDown",onFutureGiftDown);
|
||||
_loc1_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,280 @@
|
||||
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;
|
||||
|
||||
private static var _checkParentForPosition:Boolean;
|
||||
|
||||
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("resize",onStageResize,false,0,true);
|
||||
_spiral = new LoadingSpiral(null);
|
||||
_spiral.isDarkenManagersSpiral = true;
|
||||
_layer = param1;
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
_darkBG.removeEventListener("mouseDown",blockMouseHandler);
|
||||
_stageDarkBG.removeEventListener("mouseDown",blockMouseHandler);
|
||||
_stageBlockBG.removeEventListener("mouseDown",blockMouseHandler);
|
||||
_loc1_ = 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();
|
||||
_checkParentForPosition = true;
|
||||
}
|
||||
|
||||
public static function addListeners() : void
|
||||
{
|
||||
_darkBG.addEventListener("mouseDown",blockMouseHandler,false,0,true);
|
||||
_stageDarkBG.addEventListener("mouseDown",blockMouseHandler,false,0,true);
|
||||
_stageBlockBG.addEventListener("mouseDown",blockMouseHandler,false,0,true);
|
||||
}
|
||||
|
||||
public static function makeDarkShape() : void
|
||||
{
|
||||
_darkBG.graphics.beginFill(0,0.5);
|
||||
_darkBG.graphics.drawRect(0,0,900,550);
|
||||
_darkBG.graphics.endFill();
|
||||
_darkBG.x = -450;
|
||||
_darkBG.y = -275;
|
||||
}
|
||||
|
||||
public static function set checkParentForPosition(param1:Boolean) : void
|
||||
{
|
||||
_checkParentForPosition = param1;
|
||||
}
|
||||
|
||||
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 + 900 * 0.5;
|
||||
_stageBlockBG.y = -gMainFrame.stage.stageHeight * 0.5 + 550 * 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 + 900 * 0.5;
|
||||
_stageDarkBG.y = -gMainFrame.stage.stageHeight * 0.5 + 550 * 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, param2:Boolean = false) : void
|
||||
{
|
||||
param1.addChildAt(_darkBG,0);
|
||||
var _loc3_:DisplayObjectContainer = param1;
|
||||
if(_checkParentForPosition)
|
||||
{
|
||||
while(_loc3_ != null && _loc3_.parent != _layer)
|
||||
{
|
||||
if(_loc3_.parent == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc3_ = _loc3_.parent;
|
||||
}
|
||||
}
|
||||
else if(param2)
|
||||
{
|
||||
if(_loc3_.parent != null)
|
||||
{
|
||||
_loc3_ = _loc3_.parent;
|
||||
}
|
||||
}
|
||||
_darkBG.x = -_loc3_.x;
|
||||
_darkBG.y = -_loc3_.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);
|
||||
if(_checkParentForPosition)
|
||||
{
|
||||
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_:int = 0;
|
||||
var _loc2_:Boolean = false;
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _darken.length)
|
||||
{
|
||||
if(_darken[_loc1_].visible)
|
||||
{
|
||||
_loc2_ = true;
|
||||
break;
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
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
|
||||
{
|
||||
_demotionMessage = new MediaHelper();
|
||||
_demotionMessage.init(156,demotionCallback);
|
||||
_closeCallBack = param1;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
removeListeners();
|
||||
DarkenManager.unDarken(_newMemberPopup);
|
||||
if(_demotionMessage)
|
||||
{
|
||||
_demotionMessage.destroy();
|
||||
}
|
||||
_newMemberPopup.visible = false;
|
||||
_newMemberPopup = null;
|
||||
_content.visible = false;
|
||||
_content = null;
|
||||
if(_closeCallBack != null)
|
||||
{
|
||||
_closeCallBack();
|
||||
}
|
||||
if(_currSoundChannel)
|
||||
{
|
||||
_currSoundChannel.stop();
|
||||
_currSoundChannel = null;
|
||||
}
|
||||
_closeCallBack = null;
|
||||
}
|
||||
|
||||
public function goToNextPage() : void
|
||||
{
|
||||
nextBtnHandler(null);
|
||||
}
|
||||
|
||||
public function set hasChosen(param1:Boolean) : void
|
||||
{
|
||||
_hasChosen = param1;
|
||||
}
|
||||
|
||||
private function demotionCallback(param1:MovieClip) : void
|
||||
{
|
||||
_newMemberPopup = param1;
|
||||
_newMemberPopup.x = 900 * 0.5;
|
||||
_newMemberPopup.y = 550 * 0.5;
|
||||
_newMemberPopup.addEventListener("mouseDown",demotionMouseDownHandler,false,0,true);
|
||||
GuiManager.guiLayer.addChild(_newMemberPopup);
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
DarkenManager.darken(_newMemberPopup);
|
||||
_content = _newMemberPopup.getChildAt(1)["c"];
|
||||
_content.soundBtn.addEventListener("mouseDown",soundBtnHandler,false,0,true);
|
||||
_content.chooseBtn.addEventListener("mouseDown",chooseBtnHandler,false,0,true);
|
||||
_content.renewBtn.addEventListener("mouseDown",joinBtnHandler,false,0,true);
|
||||
_content.nextBtn.addEventListener("mouseDown",nextBtnHandler,false,0,true);
|
||||
_content.noThanksBtn.addEventListener("mouseDown",demotionCloseHandler,false,0,true);
|
||||
_content.chooseBtn.visible = false;
|
||||
_content.noThanksBtn.visible = false;
|
||||
switch(LocalizationManager.currentLanguage)
|
||||
{
|
||||
case LocalizationManager.LANG_ENG:
|
||||
_startingIndex = 67;
|
||||
break;
|
||||
case LocalizationManager.LANG_SPA:
|
||||
_startingIndex = 675;
|
||||
break;
|
||||
case LocalizationManager.LANG_POR:
|
||||
_startingIndex = 630;
|
||||
break;
|
||||
case LocalizationManager.LANG_FRE:
|
||||
_startingIndex = 625;
|
||||
break;
|
||||
case LocalizationManager.LANG_DE:
|
||||
_startingIndex = 620;
|
||||
break;
|
||||
default:
|
||||
_startingIndex = 67;
|
||||
}
|
||||
_idx = 1;
|
||||
_gaIdx = 2;
|
||||
_currSound = new Sound();
|
||||
_currSound.load(LoaderCache.fetchCDNURLRequest("streams/" + (_startingIndex + _idx) + ".mp3"));
|
||||
playSoundCallback();
|
||||
}
|
||||
|
||||
private function playSoundCallback() : void
|
||||
{
|
||||
_wasMusicMuted = SBAudio.isMusicMuted;
|
||||
if(!_wasMusicMuted)
|
||||
{
|
||||
SBAudio.muteMusic();
|
||||
}
|
||||
_currSoundChannel = _currSound.play();
|
||||
}
|
||||
|
||||
private function nextBtnHandler(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc9_:Array = null;
|
||||
var _loc4_:Array = null;
|
||||
var _loc3_:* = 0;
|
||||
var _loc2_:* = 0;
|
||||
var _loc6_:Boolean = false;
|
||||
var _loc7_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("/game/play/popup/demotion/#page" + _gaIdx);
|
||||
var _loc8_:Boolean = AvatarSwitch.shouldChoose();
|
||||
_gaIdx = _gaIdx + 1;
|
||||
_idx = _idx + 1;
|
||||
if(!_hasChosen && !_loc8_ && _idx > 2)
|
||||
{
|
||||
_idx = _idx + 1;
|
||||
_loc9_ = AvatarSwitch.avatars;
|
||||
_loc4_ = [];
|
||||
_loc7_ = AvatarSwitch.numNonMemberAvatars;
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc9_.length)
|
||||
{
|
||||
if(_loc9_[_loc5_])
|
||||
{
|
||||
if(!AvatarSwitch.isMemberOnlyAvatar(_loc5_))
|
||||
{
|
||||
_loc6_ = true;
|
||||
}
|
||||
}
|
||||
else if(_loc5_ >= _loc7_ - 1)
|
||||
{
|
||||
_loc6_ = true;
|
||||
}
|
||||
if(_loc6_)
|
||||
{
|
||||
_loc6_ = false;
|
||||
if(_loc4_[0] == null && _loc9_[_loc5_])
|
||||
{
|
||||
_loc4_[0] = _loc3_ = _loc5_;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_[1] = _loc2_ = _loc5_;
|
||||
}
|
||||
if(_loc4_[0] != null && _loc4_[1] != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
if(_loc4_[1] != null && _loc9_[_loc2_])
|
||||
{
|
||||
AvatarSwitch.adjustAvailSlotFlags(AvatarXtCommManager.avSlotInfo[_loc9_[_loc3_].perUserAvId].avInvId,true);
|
||||
AvatarSwitch.adjustAvailSlotFlags(AvatarXtCommManager.avSlotInfo[_loc9_[_loc2_].perUserAvId].avInvId,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
AvatarSwitch.adjustAvailSlotFlags(AvatarXtCommManager.avSlotInfo[_loc9_[_loc3_].perUserAvId].avInvId,true);
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_content.nextBtn.visible = false;
|
||||
AvatarSwitch.chooseTwo(_loc4_,onAvatarChooseCallback);
|
||||
return;
|
||||
}
|
||||
if(_idx == 3)
|
||||
{
|
||||
_content.renewBtn.visible = false;
|
||||
_content.nextBtn.visible = false;
|
||||
_content.chooseBtn.visible = true;
|
||||
}
|
||||
if(_idx == 4 && _loc8_)
|
||||
{
|
||||
_content.chooseBtn.visible = false;
|
||||
_content.nextBtn.visible = false;
|
||||
_content.noThanksBtn.visible = true;
|
||||
}
|
||||
if(_currSoundChannel)
|
||||
{
|
||||
_currSoundChannel.stop();
|
||||
}
|
||||
_currSound = new Sound();
|
||||
_currSound.load(LoaderCache.fetchCDNURLRequest("streams/" + (_startingIndex + _idx) + ".mp3"));
|
||||
_currSoundChannel = _currSound.play();
|
||||
_content.gotoAndStop("p" + _idx);
|
||||
}
|
||||
|
||||
private function onAvatarChooseCallback(param1:Boolean) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(_currSoundChannel)
|
||||
{
|
||||
_currSoundChannel.stop();
|
||||
}
|
||||
if(param1)
|
||||
{
|
||||
_content.chooseBtn.visible = false;
|
||||
_content.nextBtn.visible = false;
|
||||
_content.noThanksBtn.visible = true;
|
||||
_currSound = new Sound();
|
||||
_currSound.load(LoaderCache.fetchCDNURLRequest("streams/" + (_startingIndex + _idx) + ".mp3"));
|
||||
_currSoundChannel = _currSound.play();
|
||||
_content.gotoAndStop("p" + _idx);
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(11233));
|
||||
_content.nextBtn.removeEventListener("mouseDown",nextBtnHandler);
|
||||
_content.nextBtn.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private function joinBtnHandler(param1:MouseEvent) : void
|
||||
{
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("/game/play/popup/demotion/renew");
|
||||
param1.stopPropagation();
|
||||
var _loc3_:String = gMainFrame.clientInfo.websiteURL + "membership";
|
||||
var _loc2_:URLRequest = new URLRequest(_loc3_);
|
||||
try
|
||||
{
|
||||
navigateToURL(_loc2_,"_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(_currSoundChannel)
|
||||
{
|
||||
_currSoundChannel.stop();
|
||||
}
|
||||
GuiManager.openAvatarChoose();
|
||||
_content.chooseBtn.visible = false;
|
||||
_content.renewBtn.visible = true;
|
||||
_content.noThanksBtn.visible = true;
|
||||
}
|
||||
|
||||
private function soundBtnHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_currSoundChannel)
|
||||
{
|
||||
_currSoundChannel.stop();
|
||||
_currSoundChannel = _currSound.play();
|
||||
}
|
||||
else
|
||||
{
|
||||
_currSoundChannel = _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(_currSoundChannel)
|
||||
{
|
||||
_currSoundChannel.stop();
|
||||
_currSoundChannel = _currSound.play();
|
||||
}
|
||||
else
|
||||
{
|
||||
_currSoundChannel = _currSound.play();
|
||||
}
|
||||
if(!_wasMusicMuted)
|
||||
{
|
||||
SBAudio.unmuteMusic();
|
||||
}
|
||||
param1.stopPropagation();
|
||||
destroy();
|
||||
}
|
||||
|
||||
private function removeListeners() : void
|
||||
{
|
||||
_content.chooseBtn.removeEventListener("mouseDown",chooseBtnHandler);
|
||||
_content.renewBtn.removeEventListener("mouseDown",joinBtnHandler);
|
||||
_content.nextBtn.removeEventListener("mouseDown",nextBtnHandler);
|
||||
_content.noThanksBtn.removeEventListener("mouseDown",demotionCloseHandler);
|
||||
_newMemberPopup.removeEventListener("mouseDown",demotionMouseDownHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,175 @@
|
||||
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 var _currentShop:Shop;
|
||||
|
||||
private var _buyAndBackBtns:MovieClip;
|
||||
|
||||
private var _loadingMediaHelper:MediaHelper;
|
||||
|
||||
private var _currDenSwitcherCallback:Function;
|
||||
|
||||
public function DenPreviewManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function setCurrentShop(param1:Shop) : void
|
||||
{
|
||||
_currentShop = param1;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(_buyAndBackBtns)
|
||||
{
|
||||
_buyAndBackBtns.backBtn.removeEventListener("mouseDown",onBackBtn);
|
||||
_buyAndBackBtns.buyBtn.removeEventListener("mouseDown",onBuyBtn);
|
||||
GuiManager.guiLayer.removeChild(_buyAndBackBtns);
|
||||
}
|
||||
}
|
||||
|
||||
public function handleAllRequiredVisibilities(param1:Boolean) : void
|
||||
{
|
||||
GuiManager.toggleHud();
|
||||
handleDenSwitcherandShopVisibility(param1);
|
||||
GuiManager.showDenHudItems(param1);
|
||||
if(_buyAndBackBtns)
|
||||
{
|
||||
_buyAndBackBtns.visible = !param1;
|
||||
}
|
||||
else if(!param1)
|
||||
{
|
||||
showBuyAndBackBtns(true);
|
||||
}
|
||||
}
|
||||
|
||||
public function handleDenPurchase() : void
|
||||
{
|
||||
if(_buyAndBackBtns && _buyAndBackBtns.visible)
|
||||
{
|
||||
RoomManagerWorld.instance.reloadCurrentNormalRoom();
|
||||
_buyAndBackBtns.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public 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 function exitPreview() : void
|
||||
{
|
||||
onBackBtn(null);
|
||||
}
|
||||
|
||||
private function handleDenSwitcherandShopVisibility(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
GuiManager.showDenSwitcher(true);
|
||||
if(GuiManager.currDenSwitcher)
|
||||
{
|
||||
GuiManager.currDenSwitcher.rebuildWithRecyclingOnly(_currDenSwitcherCallback);
|
||||
}
|
||||
if(_currentShop)
|
||||
{
|
||||
_currentShop.showShop(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_currentShop)
|
||||
{
|
||||
_currentShop.showShop(false);
|
||||
}
|
||||
GuiManager.showDenSwitcher(false);
|
||||
if(GuiManager.currDenSwitcher)
|
||||
{
|
||||
_currDenSwitcherCallback = GuiManager.currDenSwitcher.currCloseCallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onBuyAndBackBtnsLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_buyAndBackBtns = param1;
|
||||
_buyAndBackBtns.backBtn.addEventListener("mouseDown",onBackBtn,false,0,true);
|
||||
_buyAndBackBtns.buyBtn.addEventListener("mouseDown",onBuyBtn,false,0,true);
|
||||
GuiManager.guiLayer.addChild(_buyAndBackBtns);
|
||||
}
|
||||
}
|
||||
|
||||
private function onBackBtn(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(_buyAndBackBtns && _buyAndBackBtns.visible)
|
||||
{
|
||||
RoomManagerWorld.instance.reloadCurrentNormalRoom();
|
||||
_buyAndBackBtns.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function onBuyBtn(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
param1.stopPropagation();
|
||||
if(_currentShop)
|
||||
{
|
||||
if(_currentShop.isCurrentItemDiamond)
|
||||
{
|
||||
_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 function onPreviewBuy(param1:Object) : void
|
||||
{
|
||||
if(param1.status)
|
||||
{
|
||||
if(_currentShop)
|
||||
{
|
||||
_currentShop.attemptToBuyCurrrentItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.UserInfo;
|
||||
import collection.DenRoomItemCollection;
|
||||
import collection.IntItemCollection;
|
||||
import den.DenXtCommManager;
|
||||
|
||||
public class DenSwitch
|
||||
{
|
||||
|
||||
public static const RECYCLE_DEN_ROOM:int = 99;
|
||||
|
||||
public static var activeDenIdx:int;
|
||||
|
||||
public static var playerUserInfo:UserInfo;
|
||||
|
||||
public static var playerUsername:String;
|
||||
|
||||
public static var playerSfsUserId:int;
|
||||
|
||||
private static var _denList:DenRoomItemCollection;
|
||||
|
||||
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 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;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _denList.length)
|
||||
{
|
||||
if(_denList.getDenRoomItem(_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.getDenRoomItem(_switchIdx).invIdx;
|
||||
DenXtCommManager.requestDenChange(param1,param2);
|
||||
}
|
||||
|
||||
public static function reTrySwitchDensAfterAddingAvatar() : void
|
||||
{
|
||||
DenXtCommManager.requestDenChange(_switchIdx,_switchDensCallback);
|
||||
}
|
||||
|
||||
public static function denListResponse(param1:DenRoomItemCollection) : void
|
||||
{
|
||||
_denList = param1;
|
||||
}
|
||||
|
||||
public static function removeDen(param1:int, param2:Function) : void
|
||||
{
|
||||
var _loc3_:IntItemCollection = null;
|
||||
if(param1 < 0 || param1 >= _denList.length)
|
||||
{
|
||||
throw new Error("Invalid removeIdx:" + param1);
|
||||
}
|
||||
_removeCallback = param2;
|
||||
_removeIdx = param1;
|
||||
if(_denList.getDenRoomItem(param1).invIdx != activeDenIdx && _denList.getDenRoomItem(param1).invIdx > 0)
|
||||
{
|
||||
_loc3_ = new IntItemCollection();
|
||||
_loc3_.pushIntItem(_denList.getDenRoomItem(param1).invIdx);
|
||||
DenXtCommManager.requestRecycle(false,_loc3_,denRecycleResponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
denRecycleResponse(0);
|
||||
}
|
||||
}
|
||||
|
||||
public static function denRecycleResponse(param1:int) : void
|
||||
{
|
||||
if(param1 > 0)
|
||||
{
|
||||
_denList.setDenRoomItem(_removeIdx,null);
|
||||
}
|
||||
if(_removeCallback != null)
|
||||
{
|
||||
_removeCallback(param1 > 0,_removeIdx);
|
||||
}
|
||||
_removeIdx = -1;
|
||||
}
|
||||
|
||||
public static function get denList() : DenRoomItemCollection
|
||||
{
|
||||
return _denList;
|
||||
}
|
||||
|
||||
public static function get nextFreeSlotIdx() : int
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < 28)
|
||||
{
|
||||
if(!_denList.getDenRoomItem(_loc1_))
|
||||
{
|
||||
return _loc1_;
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static function haveOceanDen() : Boolean
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _denList.length)
|
||||
{
|
||||
if(_denList.getDenRoomItem(_loc1_) && _denList.getDenRoomItem(_loc1_).enviroType == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,688 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.Avatar;
|
||||
import com.sbi.client.KeepAlive;
|
||||
import com.sbi.popup.SBYesNoPopup;
|
||||
import den.DenRoomItem;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import gui.itemWindows.ItemWindowAnimal;
|
||||
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);
|
||||
_playerAvatar = param1;
|
||||
_guiLayer = param2;
|
||||
_closeCallback = param5;
|
||||
_recyclingOnly = param3;
|
||||
_openStoreOnly = param4;
|
||||
_firstOpenIdx = param6;
|
||||
_storeItemIndex = param8;
|
||||
_numTotalSlots = 28;
|
||||
_mediaHelpers = [];
|
||||
if(param7 == -1)
|
||||
{
|
||||
_glId = 13;
|
||||
}
|
||||
else
|
||||
{
|
||||
_glId = param7;
|
||||
}
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(1168,onMediaItemLoaded,true);
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
removeListeners();
|
||||
KeepAlive.stopKATimer(_switchContent);
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _views.length)
|
||||
{
|
||||
if(_views[_loc1_])
|
||||
{
|
||||
_views[_loc1_].destroy();
|
||||
_views[_loc1_] = null;
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
if(_shop)
|
||||
{
|
||||
_shop.destroy();
|
||||
_shop = null;
|
||||
}
|
||||
if(_switchContent)
|
||||
{
|
||||
if(_switchContent.root.parent == _guiLayer)
|
||||
{
|
||||
_guiLayer.removeChild(_switchContent.root);
|
||||
}
|
||||
DarkenManager.unDarken(MovieClip(_switchContent.root));
|
||||
_switchContent.root.removeEventListener("mouseDown",onPopup);
|
||||
_switchContent = null;
|
||||
if(_closeBtn)
|
||||
{
|
||||
_closeBtn = null;
|
||||
}
|
||||
if(_contentItems)
|
||||
{
|
||||
_contentItems = null;
|
||||
}
|
||||
}
|
||||
if(_itemWindows)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
_recyclingOnly = false;
|
||||
_recycling = false;
|
||||
_closeCallback = null;
|
||||
}
|
||||
|
||||
public function close() : void
|
||||
{
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
public function get idx() : int
|
||||
{
|
||||
return _idx;
|
||||
}
|
||||
|
||||
public function showDenSwitcher(param1:Boolean, param2:int = -1) : void
|
||||
{
|
||||
if(_switchContent && _switchContent.root.visible != param1)
|
||||
{
|
||||
_switchContent.root.visible = param1;
|
||||
if(param1)
|
||||
{
|
||||
DarkenManager.darken(MovieClip(_switchContent.root));
|
||||
}
|
||||
else if(param2 == -1)
|
||||
{
|
||||
DarkenManager.unDarken(MovieClip(_switchContent.root));
|
||||
}
|
||||
if(param2 != -1)
|
||||
{
|
||||
_switchContent.root.parent.setChildIndex(_switchContent.root,param2);
|
||||
_switchContent.root.visible = true;
|
||||
}
|
||||
}
|
||||
else if(param1)
|
||||
{
|
||||
_switchContent.root.parent.setChildIndex(_switchContent.root,_switchContent.root.parent.numChildren - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public function rebuildWithRecyclingOnly(param1:Function) : void
|
||||
{
|
||||
_closeCallback = param1;
|
||||
_recyclingOnly = true;
|
||||
buildWindows();
|
||||
}
|
||||
|
||||
public function get currCloseCallback() : Function
|
||||
{
|
||||
return _closeCallback;
|
||||
}
|
||||
|
||||
private function onMediaItemLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var _loc2_:Boolean = false;
|
||||
if(param1)
|
||||
{
|
||||
_closeBtn = MovieClip(param1.getChildAt(0)).bx;
|
||||
_switchContent = MovieClip(param1.getChildAt(0)).c;
|
||||
KeepAlive.startKATimer(_switchContent);
|
||||
_guiLayer.addChild(param1);
|
||||
param1.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
param1.x = 900 * 0.5;
|
||||
param1.y = 550 * 0.5;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
DarkenManager.darken(param1);
|
||||
addListeners();
|
||||
_loc2_ = _firstOpenIdx != -1;
|
||||
initVisibilityAndStates();
|
||||
buildWindows();
|
||||
if(_openStoreOnly)
|
||||
{
|
||||
param1.visible = false;
|
||||
onItemWindowDown(null);
|
||||
}
|
||||
else if(_loc2_)
|
||||
{
|
||||
onItemWindowDown(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function initVisibilityAndStates() : void
|
||||
{
|
||||
_activeIdx = DenSwitch.activeDenIdx;
|
||||
_switchContent.buyPopup.tag.visible = false;
|
||||
_switchContent.oopsPopup.body_txt.text = "";
|
||||
LocalizationManager.translateId(_switchContent.switchTitleTxt,11271);
|
||||
_switchContent.buyPopup.tag.txt.text = "";
|
||||
_switchContent.buyPopup.paw.gray.visible = false;
|
||||
_switchContent.buyPopup.banner.visible = false;
|
||||
_switchContent.buyPopup.lock.visible = false;
|
||||
_switchContent.buyPopup.lockOpen.visible = false;
|
||||
_switchContent.buyPopup.colorChange_btn.visible = false;
|
||||
_switchContent.buyPopup.paw.visible = true;
|
||||
_switchContent.buyPopup.visible = false;
|
||||
_switchContent.oopsPopup.visible = false;
|
||||
_switchContent.oopsCostPopup.visible = false;
|
||||
_switchContent.denShopTag.visible = false;
|
||||
_switchContent.saveAmlTag.visible = false;
|
||||
}
|
||||
|
||||
private function buildWindows() : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc2_:MovieClip = null;
|
||||
var _loc1_:MediaHelper = null;
|
||||
if(_scrollButtons)
|
||||
{
|
||||
_scrollButtons.destroy();
|
||||
_scrollButtons = null;
|
||||
}
|
||||
if(_itemWindows)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
var _loc6_:int = _numTotalSlots;
|
||||
var _loc7_:int = Math.min(_loc6_,4);
|
||||
var _loc3_:int = Math.ceil(_loc7_ / 2);
|
||||
_itemWindows = new WindowGenerator();
|
||||
_itemWindows.init(_loc7_,_loc3_,_loc6_,1,2,0,ItemWindowAnimal,DenSwitch.denList.getCoreArray(),"icon",{
|
||||
"mouseDown":onItemWindowDown,
|
||||
"mouseOver":onItemWindowOver,
|
||||
"mouseOut":onItemWindowOut
|
||||
},{"recylingOnly":_recyclingOnly},null,false,false);
|
||||
_switchContent.itemBlock.addChild(_itemWindows);
|
||||
_views = new Array(_numTotalSlots);
|
||||
_contentItems = new Array(_numTotalSlots);
|
||||
_activeIdx = DenSwitch.activeDenIdx;
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _numTotalSlots)
|
||||
{
|
||||
_loc2_ = MovieClip(_itemWindows.bg.getChildAt(_loc5_));
|
||||
_contentItems[_loc5_] = _loc2_;
|
||||
if(DenSwitch.denList.getDenRoomItem(_loc5_) != null)
|
||||
{
|
||||
_loc1_ = new MediaHelper();
|
||||
_loc1_.init(DenSwitch.denList.getDenRoomItem(_loc5_).mediaId,mediaHelperCallback,DenSwitch.denList.getDenRoomItem(_loc5_).isMemberOnly);
|
||||
_views[_loc5_] = _loc1_;
|
||||
}
|
||||
else if(_firstOpenIdx == -1)
|
||||
{
|
||||
_firstOpenIdx = _loc5_;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
if(_firstOpenIdx == -1)
|
||||
{
|
||||
_firstOpenIdx = 0;
|
||||
}
|
||||
var _loc4_:int = DenSwitch.numDens;
|
||||
if(_loc4_ > 1)
|
||||
{
|
||||
_switchContent.recycleBtn.gray.visible = false;
|
||||
_switchContent.recycleBtn.mouse.visible = true;
|
||||
_switchContent.recycleBtn.down.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_switchContent.recycleBtn.gray.visible = true;
|
||||
_switchContent.recycleBtn.mouse.visible = false;
|
||||
_switchContent.recycleBtn.down.visible = false;
|
||||
}
|
||||
if(_recyclingOnly)
|
||||
{
|
||||
_recycling = true;
|
||||
}
|
||||
if(_loc4_ >= _numTotalSlots && !_recyclingOnly)
|
||||
{
|
||||
_switchContent.denShopTag.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_switchContent.denShopTag.visible = false;
|
||||
}
|
||||
_scrollButtons = new SBScrollbar();
|
||||
_scrollButtons.init(_itemWindows,840,440,-6,"scrollbar2",221.95);
|
||||
}
|
||||
|
||||
public function switchDenCallback(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
close();
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.darken(_switchContent.oopsPopup);
|
||||
LocalizationManager.translateId(_switchContent.oopsPopup.body_txt,11272);
|
||||
_switchContent.oopsPopup.visible = true;
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
}
|
||||
|
||||
private function recycleDenCallback(param1:Boolean, param2:int) : void
|
||||
{
|
||||
var _loc3_:MovieClip = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
if(_recyclingOnly)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = _contentItems[param2];
|
||||
if(_views[param2])
|
||||
{
|
||||
_views[param2].destroy();
|
||||
_views[param2] = null;
|
||||
}
|
||||
_recycling = false;
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _numTotalSlots)
|
||||
{
|
||||
_contentItems[_loc5_].recycle.visible = false;
|
||||
_loc5_++;
|
||||
}
|
||||
_loc3_.resetWindow(param2);
|
||||
_loc4_ = DenSwitch.numDens;
|
||||
if(_loc4_ <= 1)
|
||||
{
|
||||
_switchContent.recycleBtn.gray.visible = true;
|
||||
_switchContent.recycleBtn.mouse.visible = false;
|
||||
_switchContent.recycleBtn.down.visible = false;
|
||||
}
|
||||
if(_loc4_ >= _numTotalSlots)
|
||||
{
|
||||
_switchContent.denShopTag.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_switchContent.denShopTag.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.darken(_switchContent.oopsPopup);
|
||||
LocalizationManager.translateId(_switchContent.oopsPopup.body_txt,11273);
|
||||
_switchContent.oopsPopup.visible = true;
|
||||
_recycling = true;
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
}
|
||||
|
||||
private function purchasedDenRoomCallback() : void
|
||||
{
|
||||
if(_shop)
|
||||
{
|
||||
_shop.onDenPurchase();
|
||||
}
|
||||
if(!_openStoreOnly)
|
||||
{
|
||||
closeDenShop(true);
|
||||
}
|
||||
var _loc2_:DenRoomItem = DenSwitch.denList.getDenRoomItem(_idx);
|
||||
MovieClip(_itemWindows).bg.getChildAt(_idx).currItem = _loc2_;
|
||||
var _loc3_:MovieClip = _contentItems[_idx];
|
||||
_loc3_.buyDen.visible = false;
|
||||
_loc3_.den.visible = true;
|
||||
_loc3_.den.txt.text = _loc2_.name;
|
||||
_loc3_.den.sel.visible = false;
|
||||
var _loc1_:MediaHelper = new MediaHelper();
|
||||
_loc1_.init(_loc2_.mediaId,mediaHelperCallback,_loc2_.isMemberOnly);
|
||||
_views[_idx] = _loc1_;
|
||||
var _loc4_:int = DenSwitch.numDens;
|
||||
if(_loc4_ >= _numTotalSlots)
|
||||
{
|
||||
_switchContent.denShopTag.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_switchContent.denShopTag.visible = false;
|
||||
}
|
||||
if(_loc4_ > 1)
|
||||
{
|
||||
_switchContent.recycleBtn.gray.visible = false;
|
||||
_switchContent.recycleBtn.mouse.visible = true;
|
||||
_switchContent.recycleBtn.down.visible = false;
|
||||
}
|
||||
if(_shop)
|
||||
{
|
||||
_shop.denItemIdx = _firstOpenIdx = Math.max(0,DenSwitch.nextFreeSlotIdx);
|
||||
}
|
||||
}
|
||||
|
||||
public function closeDenShop(param1:Boolean = false) : void
|
||||
{
|
||||
if(_shop)
|
||||
{
|
||||
_shop.destroy();
|
||||
_shop = null;
|
||||
}
|
||||
if(_openStoreOnly)
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
private function mediaHelperCallback(param1:MovieClip) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _views.length)
|
||||
{
|
||||
if(_views[_loc2_] == param1.mediaHelper)
|
||||
{
|
||||
if(param1.passback && !gMainFrame.userInfo.isMember)
|
||||
{
|
||||
_contentItems[_loc2_].gray.amlMask.amlBox.addChild(param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
(_contentItems[_loc2_].den as MovieClip).itemBlock.addChild(param1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function confirmRecycleHandler(param1:Object) : void
|
||||
{
|
||||
if(param1.status)
|
||||
{
|
||||
DenSwitch.removeDen(_idx,recycleDenCallback);
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
}
|
||||
}
|
||||
|
||||
private function onItemWindowDown(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_idx = param1.currentTarget.index;
|
||||
}
|
||||
else
|
||||
{
|
||||
_idx = _firstOpenIdx;
|
||||
}
|
||||
if(_contentItems[_idx].buyDen.visible || _openStoreOnly)
|
||||
{
|
||||
if(!GenericListGuiManager.isWorldShopOpen())
|
||||
{
|
||||
_shop = new Shop();
|
||||
_shop.init(_glId,1060,_playerAvatar,_guiLayer,closeDenShop,_idx,purchasedDenRoomCallback,_openStoreOnly,_storeItemIndex);
|
||||
}
|
||||
}
|
||||
else if(_contentItems[_idx].gray.visible == true && !_recycling)
|
||||
{
|
||||
if(!gMainFrame.userInfo.isMember)
|
||||
{
|
||||
UpsellManager.displayPopup("dens","useLockedDen/" + DenSwitch.denList.getDenRoomItem(_idx).name);
|
||||
}
|
||||
}
|
||||
else if(_recycling)
|
||||
{
|
||||
if(_idx == _activeIdx)
|
||||
{
|
||||
DarkenManager.darken(_switchContent.oopsPopup);
|
||||
LocalizationManager.translateId(_switchContent.oopsPopup.body_txt,11274);
|
||||
_switchContent.oopsPopup.visible = true;
|
||||
}
|
||||
else if(_idx == 0)
|
||||
{
|
||||
DarkenManager.darken(_switchContent.oopsPopup);
|
||||
LocalizationManager.translateId(_switchContent.oopsPopup.body_txt,11275);
|
||||
_switchContent.oopsPopup.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBYesNoPopup(_guiLayer,LocalizationManager.translateIdAndInsertOnly(14715,Utility.convertNumberToString(DenSwitch.denList.getDenRoomItem(idx).recycleValue)),true,confirmRecycleHandler);
|
||||
}
|
||||
}
|
||||
else if((_contentItems[_idx].den as MovieClip).visible == true)
|
||||
{
|
||||
if(_idx != _activeIdx)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
DenSwitch.switchDens(_idx,switchDenCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onItemWindowOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_idx = param1.currentTarget.index;
|
||||
if((_contentItems[_idx].den as MovieClip).currentFrameLabel != "mouse")
|
||||
{
|
||||
(_contentItems[_idx].den as MovieClip).gotoAndPlay("mouse");
|
||||
}
|
||||
AJAudio.playSubMenuBtnRollover();
|
||||
}
|
||||
|
||||
private function onItemWindowOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_idx = param1.currentTarget.index;
|
||||
if((_contentItems[_idx].den as MovieClip).currentFrameLabel != "out")
|
||||
{
|
||||
(_contentItems[_idx].den as MovieClip).gotoAndPlay("out");
|
||||
}
|
||||
}
|
||||
|
||||
private function onOopsClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
DarkenManager.unDarken(_switchContent.oopsPopup);
|
||||
_switchContent.oopsPopup.visible = false;
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
close();
|
||||
}
|
||||
|
||||
private function onRecycleDown(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
param1.stopPropagation();
|
||||
if(!_recyclingOnly)
|
||||
{
|
||||
if(_recycling)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _numTotalSlots)
|
||||
{
|
||||
_contentItems[_loc2_].recycle.visible = false;
|
||||
_loc2_++;
|
||||
}
|
||||
_recycling = false;
|
||||
}
|
||||
else if(!_switchContent.recycleBtn.gray.visible)
|
||||
{
|
||||
_recycling = true;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _numTotalSlots)
|
||||
{
|
||||
if(_views[_loc3_])
|
||||
{
|
||||
if(!_contentItems[_loc3_].buyDen.visible)
|
||||
{
|
||||
_contentItems[_loc3_].recycle.visible = true;
|
||||
}
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_switchContent.recycleBtn.mouse.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onRecycleOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
GuiManager.toolTip.init(_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(!_recyclingOnly)
|
||||
{
|
||||
_shop = new Shop();
|
||||
_shop.init(_glId,1040,_playerAvatar,_guiLayer,closeDenShop,_idx,purchasedDenRoomCallback);
|
||||
}
|
||||
}
|
||||
|
||||
private function addListeners() : void
|
||||
{
|
||||
if(_closeBtn)
|
||||
{
|
||||
_closeBtn.addEventListener("mouseDown",onClose,false,0,true);
|
||||
}
|
||||
if(_switchContent)
|
||||
{
|
||||
_switchContent.recycleBtn.addEventListener("mouseDown",onRecycleDown,false,0,true);
|
||||
_switchContent.recycleBtn.addEventListener("mouseOver",onRecycleOver,false,0,true);
|
||||
_switchContent.recycleBtn.addEventListener("mouseOut",onRecycleOut,false,0,true);
|
||||
_switchContent.oopsPopup.closeBtn.addEventListener("mouseDown",onOopsClose,false,0,true);
|
||||
_switchContent.denShopTag.denShopBtn.addEventListener("mouseDown",onMoreDenDown,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
private function removeListeners() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _numTotalSlots)
|
||||
{
|
||||
if(_contentItems[_loc1_])
|
||||
{
|
||||
_contentItems[_loc1_].removeEventListener("mouseDown",onItemWindowDown);
|
||||
_contentItems[_loc1_].removeEventListener("rollOver",onItemWindowOver);
|
||||
_contentItems[_loc1_].removeEventListener("rollOut",onItemWindowOut);
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
if(_closeBtn)
|
||||
{
|
||||
_closeBtn.removeEventListener("mouseDown",onClose);
|
||||
}
|
||||
if(_switchContent)
|
||||
{
|
||||
_switchContent.recycleBtn.removeEventListener("mouseDown",onRecycleDown);
|
||||
_switchContent.recycleBtn.removeEventListener("mouseOver",onRecycleOver);
|
||||
_switchContent.recycleBtn.removeEventListener("mouseOut",onRecycleOut);
|
||||
_switchContent.oopsPopup.closeBtn.removeEventListener("mouseDown",onOopsClose);
|
||||
_switchContent.denShopTag.denShopBtn.removeEventListener("mouseDown",onMoreDenDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.system.ApplicationDomain;
|
||||
import gui.itemWindows.ItemWindowBook;
|
||||
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";
|
||||
|
||||
public static const COMBINED_TYPE:String = "combined";
|
||||
|
||||
private static const LAND_LIST_ID:int = 353;
|
||||
|
||||
private static const OCEAN_LIST_ID:int = 354;
|
||||
|
||||
private static const AIR_LIST_ID:int = 355;
|
||||
|
||||
private static const COMBINED_LIST_ID:int = 356;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _popup:MovieClip;
|
||||
|
||||
private var _itemWindows:WindowAndScrollbarGenerator;
|
||||
|
||||
private var _currLoaderAppDomain:ApplicationDomain;
|
||||
|
||||
private var _type:String;
|
||||
|
||||
private var _currEBooks:Array;
|
||||
|
||||
public function EBookChooser()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:String, param2:Function) : void
|
||||
{
|
||||
_type = param1;
|
||||
_closeCallback = param2;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(3836,onPopupLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
_closeCallback = null;
|
||||
if(_mediaHelper)
|
||||
{
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
}
|
||||
if(_itemWindows)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
if(_popup)
|
||||
{
|
||||
DarkenManager.unDarken(_popup);
|
||||
if(_popup.parent && GuiManager.guiLayer == _popup.parent)
|
||||
{
|
||||
GuiManager.guiLayer.removeChild(_popup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopupLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_currLoaderAppDomain = param1.loaderInfo.applicationDomain;
|
||||
_popup = MovieClip(param1.getChildAt(0));
|
||||
_popup.logo.gotoAndStop(_type);
|
||||
_popup.x = 900 * 0.5;
|
||||
_popup.y = 550 * 0.5;
|
||||
GuiManager.guiLayer.addChild(_popup);
|
||||
DarkenManager.darken(_popup);
|
||||
addEventListeners();
|
||||
loadBooks();
|
||||
}
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_popup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_popup.xBtn.addEventListener("mouseDown",onClose,false,0,true);
|
||||
}
|
||||
|
||||
private function loadBooks() : void
|
||||
{
|
||||
setupBooksObject();
|
||||
}
|
||||
|
||||
private function setupBooksObject() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
switch(_type)
|
||||
{
|
||||
case "land":
|
||||
_loc1_ = 353;
|
||||
break;
|
||||
case "ocean":
|
||||
_loc1_ = 354;
|
||||
break;
|
||||
case "air":
|
||||
_loc1_ = 355;
|
||||
break;
|
||||
case "combined":
|
||||
_loc1_ = 356;
|
||||
}
|
||||
if(_loc1_ != 0)
|
||||
{
|
||||
GenericListXtCommManager.requestGenericList(_loc1_,onBookListLoaded);
|
||||
}
|
||||
}
|
||||
|
||||
private function onBookListLoaded(param1:int, param2:Array, param3:Array, param4:Array, param5:Object) : void
|
||||
{
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
_currEBooks = [];
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < param2.length)
|
||||
{
|
||||
_currEBooks.push({
|
||||
"ebookId":param2[_loc7_],
|
||||
"mediaId":param3[_loc7_],
|
||||
"listId":param4[_loc7_]
|
||||
});
|
||||
_loc7_++;
|
||||
}
|
||||
if(_currEBooks.length > 0)
|
||||
{
|
||||
_loc8_ = 5;
|
||||
_loc6_ = 2;
|
||||
_itemWindows = new WindowAndScrollbarGenerator();
|
||||
if(_currEBooks.length > 10)
|
||||
{
|
||||
_popup.gotoAndStop("scroll");
|
||||
}
|
||||
else
|
||||
{
|
||||
_popup.gotoAndStop("noScroll");
|
||||
}
|
||||
_itemWindows.init(_popup.itemWindow.width,_popup.itemWindow.height,-2,0,_loc8_,_loc6_,0,12,16,2,2,ItemWindowBook,_currEBooks,"",0,null,{"currLoaderAppDomain":_currLoaderAppDomain},null,true,false,false,false,true);
|
||||
_popup.itemWindow.addChild(_itemWindows);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
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,246 @@
|
||||
package gui
|
||||
{
|
||||
import achievement.AchievementXtCommManager;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.text.TextField;
|
||||
import flash.utils.Timer;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
import verification.VerificationXtCommManager;
|
||||
|
||||
public class EmailConfirmation
|
||||
{
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _closeCallBack:Function;
|
||||
|
||||
private var _emailConfirmPopup:MovieClip;
|
||||
|
||||
private var _parentEmailPopup:MovieClip;
|
||||
|
||||
private var _emailStsTracking:Object;
|
||||
|
||||
private var _emailSts:MovieClip;
|
||||
|
||||
private var _emailTxt:TextField;
|
||||
|
||||
private var _lastCheckedEmail:String;
|
||||
|
||||
private var _delaySuggestionTimer:Timer;
|
||||
|
||||
private var _suggestedDomain:String;
|
||||
|
||||
private var _displayCodeRedemptionString:Boolean;
|
||||
|
||||
public function EmailConfirmation()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:Function, param2:MovieClip, param3:Boolean = false) : void
|
||||
{
|
||||
_closeCallBack = param1;
|
||||
_displayCodeRedemptionString = param3;
|
||||
if(param2 == null)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(4573,onPopupLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
onPopupLoaded(param2);
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy(param1:Boolean = true) : void
|
||||
{
|
||||
removeEventListeners();
|
||||
DarkenManager.unDarken(_emailConfirmPopup);
|
||||
GuiManager.guiLayer.removeChild(_emailConfirmPopup);
|
||||
_emailConfirmPopup = null;
|
||||
_parentEmailPopup = null;
|
||||
if(_closeCallBack != null)
|
||||
{
|
||||
_closeCallBack(param1);
|
||||
_closeCallBack = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopupLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(_mediaHelper)
|
||||
{
|
||||
_mediaHelper.destroy();
|
||||
}
|
||||
AchievementXtCommManager.requestSetUserVar(428,gMainFrame.clientInfo.jamaaDate);
|
||||
_emailConfirmPopup = MovieClip(param1.getChildAt(0));
|
||||
_emailConfirmPopup.x = 900 * 0.5;
|
||||
_emailConfirmPopup.y = 550 * 0.5;
|
||||
_parentEmailPopup = _emailConfirmPopup.parentEmailPopup;
|
||||
_parentEmailPopup.visible = false;
|
||||
if(_displayCodeRedemptionString)
|
||||
{
|
||||
LocalizationManager.translateId(_emailConfirmPopup.bodyTxt,24884);
|
||||
}
|
||||
_emailTxt = _parentEmailPopup.email_txt;
|
||||
_emailSts = _parentEmailPopup.email_status;
|
||||
_emailStsTracking = {
|
||||
"xTracking":false,
|
||||
"waitTracking":false,
|
||||
"checkTracking":false
|
||||
};
|
||||
GuiStatusIcon.initClipOff(_emailSts,_emailStsTracking);
|
||||
_parentEmailPopup.emailCheckPopup.visible = false;
|
||||
_parentEmailPopup.resendBtn.activateGrayState(true);
|
||||
_delaySuggestionTimer = new Timer(1000,1);
|
||||
LocalizationManager.translateIdAndInsert(_emailConfirmPopup.countTitleTxt,6260,gMainFrame.clientInfo.numDaysBeforeExpiring);
|
||||
_emailTxt.text = gMainFrame.clientInfo.userEmail;
|
||||
emailKeyUpHandler(null);
|
||||
GuiManager.guiLayer.addChild(_emailConfirmPopup);
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
DarkenManager.darken(_emailConfirmPopup);
|
||||
addEventListeners();
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_emailConfirmPopup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_emailConfirmPopup.bx.addEventListener("mouseDown",onCloseBtn,false,0,true);
|
||||
_emailConfirmPopup.okBtn.addEventListener("mouseDown",onCloseBtn,false,0,true);
|
||||
_emailConfirmPopup.resendBtn.addEventListener("mouseDown",onResendBtn,false,0,true);
|
||||
_parentEmailPopup.resendBtn.addEventListener("mouseDown",onResendBtn,false,0,true);
|
||||
_parentEmailPopup.bx.addEventListener("mouseDown",onParentEmailClose,false,0,true);
|
||||
_emailTxt.addEventListener("keyUp",emailKeyUpHandler,false,0,true);
|
||||
_delaySuggestionTimer.addEventListener("timer",onSuggestionTimer,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_emailConfirmPopup.removeEventListener("mouseDown",onPopup);
|
||||
_emailConfirmPopup.bx.removeEventListener("mouseDown",onCloseBtn);
|
||||
_emailConfirmPopup.okBtn.removeEventListener("mouseDown",onCloseBtn);
|
||||
_emailConfirmPopup.resendBtn.removeEventListener("mouseDown",onResendBtn);
|
||||
_parentEmailPopup.resendBtn.removeEventListener("mouseDown",onResendBtn);
|
||||
_parentEmailPopup.bx.removeEventListener("mouseDown",onParentEmailClose);
|
||||
_emailTxt.removeEventListener("keyUp",emailKeyUpHandler);
|
||||
_delaySuggestionTimer.removeEventListener("timer",onSuggestionTimer);
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onCloseBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
destroy();
|
||||
}
|
||||
|
||||
private function onResendBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
if(param1.currentTarget == _emailConfirmPopup.resendBtn)
|
||||
{
|
||||
_parentEmailPopup.visible = true;
|
||||
gMainFrame.stage.focus = _emailTxt;
|
||||
_emailTxt.setSelection(_emailTxt.length,_emailTxt.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
if(_emailTxt.text != gMainFrame.clientInfo.userEmail)
|
||||
{
|
||||
VerificationXtCommManager.requestRenameAndResendActivationEmail(_emailTxt.text,onResendComplete);
|
||||
}
|
||||
else
|
||||
{
|
||||
VerificationXtCommManager.requestResendActivationEmail(onResendComplete);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onParentEmailClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_parentEmailPopup.visible = false;
|
||||
}
|
||||
|
||||
private function onSuggestionTimer(param1:TimerEvent) : void
|
||||
{
|
||||
if(_suggestedDomain != "")
|
||||
{
|
||||
_parentEmailPopup.emailCheckPopup.visible = true;
|
||||
LocalizationManager.translateIdAndInsert(_parentEmailPopup.emailCheckPopup.suggestTxt,11165,_suggestedDomain);
|
||||
}
|
||||
}
|
||||
|
||||
private function emailKeyUpHandler(param1:KeyboardEvent) : void
|
||||
{
|
||||
var _loc3_:Boolean = false;
|
||||
var _loc2_:Object = null;
|
||||
if(_emailTxt.text == "")
|
||||
{
|
||||
GuiStatusIcon.initClipOff(_emailSts,_emailStsTracking);
|
||||
_emailConfirmPopup.textBar.visible = true;
|
||||
_lastCheckedEmail = _emailTxt.text;
|
||||
_parentEmailPopup.resendBtn.activateGrayState(true);
|
||||
return;
|
||||
}
|
||||
if(_emailTxt.text != _lastCheckedEmail)
|
||||
{
|
||||
_emailSts.visible = true;
|
||||
_lastCheckedEmail = _emailTxt.text;
|
||||
_suggestedDomain = "";
|
||||
_loc3_ = !SbiConstants.EMAIL_REGEX.test(_emailTxt.text);
|
||||
if(_loc3_)
|
||||
{
|
||||
GuiStatusIcon.showX(_emailSts,_emailStsTracking);
|
||||
_parentEmailPopup.textBar.visible = false;
|
||||
_parentEmailPopup.emailCheckPopup.visible = false;
|
||||
_parentEmailPopup.resendBtn.activateGrayState(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiStatusIcon.showCheck(_emailSts,_emailStsTracking);
|
||||
_parentEmailPopup.textBar.visible = true;
|
||||
_loc2_ = Utility.checkEmailDomain(_emailTxt.text);
|
||||
if(_loc2_.suggestions.length > 0)
|
||||
{
|
||||
_suggestedDomain = _loc2_.suggestions[0];
|
||||
_delaySuggestionTimer.reset();
|
||||
_delaySuggestionTimer.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_parentEmailPopup.emailCheckPopup.visible = false;
|
||||
}
|
||||
_parentEmailPopup.resendBtn.activateGrayState(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onResendComplete(param1:Boolean) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param1)
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(22626));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
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 emoteType:int;
|
||||
|
||||
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:int, param2:Function, param3:MovieClip, param4:MovieClip, param5:MovieClip, param6:Sprite, param7:MovieClip, param8:MovieClip, param9:Boolean = true)
|
||||
{
|
||||
super();
|
||||
_useMemberOnlyEmotes = param9;
|
||||
emoteType = param1;
|
||||
setEmoteCallback = param2;
|
||||
emoteBtn = param3;
|
||||
emoteBtn.addEventListener("mouseDown",emoteBtnDownHandler,false,0,true);
|
||||
emoteWindow = param4;
|
||||
addAllEmotes();
|
||||
emoteWindow.visible = false;
|
||||
actionBtn = param5;
|
||||
actionWindow = param6;
|
||||
safeChatBtn = param7;
|
||||
safeChatTree = param8;
|
||||
emoteBtnsBg = GETDEFINITIONBYNAME("emo_mouse");
|
||||
emoteWindow.addChild(emoteBtnsBg);
|
||||
emoteBtnsBg.visible = false;
|
||||
if(param4.titleTxt)
|
||||
{
|
||||
LocalizationManager.translateId(param4.titleTxt,6308);
|
||||
}
|
||||
}
|
||||
|
||||
public function reload(param1:MovieClip, param2:MovieClip, param3:MovieClip, param4:Sprite, param5:MovieClip, param6:MovieClip, param7:Function) : void
|
||||
{
|
||||
if(emoteBtn)
|
||||
{
|
||||
emoteBtn.removeEventListener("mouseDown",emoteBtnDownHandler);
|
||||
}
|
||||
emoteBtn = param1;
|
||||
emoteBtn.addEventListener("mouseDown",emoteBtnDownHandler,false,0,true);
|
||||
emoteWindow = param2;
|
||||
emoteWindow.addChild(_emotes);
|
||||
emoteWindow.addChild(emoteBtnsBg);
|
||||
emoteWindow.visible = false;
|
||||
actionBtn = param3;
|
||||
actionWindow = param4;
|
||||
safeChatBtn = param5;
|
||||
safeChatTree = param6;
|
||||
emoteBtnsBg.visible = false;
|
||||
resetEmotePrivs();
|
||||
LocalizationManager.translateId(param2.titleTxt,6308);
|
||||
emoteBtn.downToUpState();
|
||||
setEmoteCallback = param7;
|
||||
}
|
||||
|
||||
public function resetEmotePrivs() : void
|
||||
{
|
||||
if(gMainFrame.userInfo.isMember)
|
||||
{
|
||||
emoteWindow.locked.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
emoteWindow.locked.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function reAddAllEmotes(param1:Boolean = true) : void
|
||||
{
|
||||
_useMemberOnlyEmotes = param1;
|
||||
if(_emotes.parent == emoteWindow)
|
||||
{
|
||||
emoteWindow.removeChild(_emotes);
|
||||
}
|
||||
_emotes = EmoticonUtility.setupEmotes(emoteType,emoteWindow,_useMemberOnlyEmotes,smileyClickHandler,smileyRollOverHandler,smileyRollOutHandler);
|
||||
emoteWindow.addChild(_emotes);
|
||||
}
|
||||
|
||||
private function addAllEmotes() : void
|
||||
{
|
||||
_emotes = EmoticonUtility.setupEmotes(emoteType,emoteWindow,_useMemberOnlyEmotes,smileyClickHandler,smileyRollOverHandler,smileyRollOutHandler);
|
||||
emoteWindow.addChild(_emotes);
|
||||
if(emoteWindow.hasOwnProperty("locked"))
|
||||
{
|
||||
if(_useMemberOnlyEmotes)
|
||||
{
|
||||
emoteWindow.setChildIndex(emoteWindow.locked,emoteWindow.numChildren - 1);
|
||||
emoteWindow.locked.mouseChidren = false;
|
||||
emoteWindow.locked.mouseEnabled = false;
|
||||
if(gMainFrame.userInfo.isMember)
|
||||
{
|
||||
emoteWindow.locked.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
emoteWindow.locked.visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
emoteWindow.titleTxt.visible = false;
|
||||
emoteWindow.memEmoteTop.visible = false;
|
||||
emoteWindow.locked.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
setEmoteCallback = null;
|
||||
emoteBtn.removeEventListener("mouseDown",emoteBtnDownHandler);
|
||||
emoteBtn = null;
|
||||
emoteWindow.visible = false;
|
||||
emoteWindow = null;
|
||||
actionBtn = null;
|
||||
actionWindow = null;
|
||||
safeChatBtn = null;
|
||||
safeChatTree = null;
|
||||
}
|
||||
|
||||
public function openEmotes() : void
|
||||
{
|
||||
if(!emoteWindow.visible)
|
||||
{
|
||||
emoteWindow.visible = true;
|
||||
emoteWindow.gotoAndPlay(1);
|
||||
brightenEmotes();
|
||||
}
|
||||
}
|
||||
|
||||
public function dimEmotes() : void
|
||||
{
|
||||
if(emoteWindow.visible && emoteWindow.alpha != 0.5)
|
||||
{
|
||||
emoteWindow.alpha = 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
public function brightenEmotes() : void
|
||||
{
|
||||
if(emoteWindow.alpha != 1)
|
||||
{
|
||||
emoteWindow.alpha = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function closeEmotes(param1:Boolean = false) : void
|
||||
{
|
||||
if(emoteWindow.visible)
|
||||
{
|
||||
if(GuiManager.isInFFM && !param1)
|
||||
{
|
||||
emoteWindow.parent.setChildIndex(emoteWindow,emoteWindow.parent.numChildren - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
emoteWindow.visible = false;
|
||||
brightenEmotes();
|
||||
emoteBtn.downToUpState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function emoteBtnDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
if(emoteWindow.visible)
|
||||
{
|
||||
closeEmotes(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(safeChatTree && safeChatTree.visible)
|
||||
{
|
||||
safeChatBtn.dispatchEvent(param1);
|
||||
}
|
||||
if(actionWindow && actionWindow.visible)
|
||||
{
|
||||
actionBtn.dispatchEvent(param1);
|
||||
}
|
||||
openEmotes();
|
||||
if(GuiManager.isInFFM)
|
||||
{
|
||||
emoteBtn.mouseEnabled = false;
|
||||
emoteBtn.mouseChildren = false;
|
||||
emoteBtn.removeEventListener("mouseDown",emoteBtnDownHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function smileyClickHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!emoteBtn.isGray)
|
||||
{
|
||||
if(GuiManager.isInFFM)
|
||||
{
|
||||
emoteBtn.mouseEnabled = true;
|
||||
emoteBtn.mouseChildren = true;
|
||||
emoteBtn.addEventListener("mouseDown",emoteBtnDownHandler,false,0,true);
|
||||
}
|
||||
emoteBtn.dispatchEvent(new MouseEvent("mouseDown"));
|
||||
EmoticonUtility.handleSmileyClick(param1.target,setEmoteCallback);
|
||||
AJAudio.playSubMenuBtnClick();
|
||||
}
|
||||
}
|
||||
|
||||
private function smileyRollOverHandler(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1.target is MovieClip)
|
||||
{
|
||||
MovieClip(param1.target).gotoAndPlay(1);
|
||||
}
|
||||
AJAudio.playSubMenuBtnRollover();
|
||||
emoteWindow.setChildIndex(emoteBtnsBg,1);
|
||||
emoteBtnsBg.x = param1.currentTarget.x;
|
||||
emoteBtnsBg.y = param1.currentTarget.y;
|
||||
emoteBtnsBg.visible = true;
|
||||
}
|
||||
|
||||
private function smileyRollOutHandler(param1:MouseEvent) : void
|
||||
{
|
||||
emoteBtnsBg.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,437 @@
|
||||
package gui
|
||||
{
|
||||
import avmplus.getQualifiedClassName;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
|
||||
public class EmoticonUtility
|
||||
{
|
||||
|
||||
public static const NORMAL_TYPE:int = 0;
|
||||
|
||||
public static const PLAYER_WALL_TYPE:int = 1;
|
||||
|
||||
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 NUM_MEMBER_EMOTES:int = 14;
|
||||
|
||||
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 displaySpritesNotAllowedInPlayerWall: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_confused_sml","emo_love_sml","emo_rainy_sml","emo_sick_sml","emo_hearts_sml","emo_brokenHeart_sml","emo_sword_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 = {};
|
||||
|
||||
private static var _emoteChatStrings:Object = {};
|
||||
|
||||
_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["emoMO_angry"] = [":mad:"];
|
||||
_emoteChatStrings["emoMO_combat"] = [":scuffle:"];
|
||||
_emoteChatStrings["emoMO_laugh"] = [":joy:"];
|
||||
_emoteChatStrings["emoMO_phantom"] = [":phantom:"];
|
||||
_emoteChatStrings["emoMO_sad"] = [":sad:"];
|
||||
_emoteChatStrings["emoMO_sleep"] = [":sleepy:"];
|
||||
_emoteChatStrings["emoMO_heartbreak"] = [":breakingheart:"];
|
||||
_emoteChatStrings["emoMO_lovesick"] = [":lovesick:"];
|
||||
_emoteChatStrings["emoMO_ninja"] = [":ninja:"];
|
||||
_emoteChatStrings["emoMO_sick"] = [":queasy:"];
|
||||
_emoteChatStrings["emoMO_smiley"] = [":smiley:"];
|
||||
_emoteChatStrings["emoMO_sunglasses"] = [":sunglasses:"];
|
||||
_emoteChatStrings["emoMO_vampire"] = [":vampire:"];
|
||||
_emoteChatStrings["emo_peace"] = [":peace:"];
|
||||
_emoteChatStrings["emo_angry"] = [":angry:"];
|
||||
_emoteChatStrings["emo_blush"] = [":blush:"];
|
||||
_emoteChatStrings["emo_burger"] = [":burger:"];
|
||||
_emoteChatStrings["emo_cool"] = [":cool:"];
|
||||
_emoteChatStrings["emo_cry"] = [":cry:"];
|
||||
_emoteChatStrings["emo_evil"] = [":evil:"];
|
||||
_emoteChatStrings["emo_game"] = [":game:"];
|
||||
_emoteChatStrings["emo_grin"] = [":D",":grin:"];
|
||||
_emoteChatStrings["emo_happy"] = [":)",":happy:"];
|
||||
_emoteChatStrings["emo_icecream"] = [":icecream:"];
|
||||
_emoteChatStrings["emo_laugh"] = [":laugh:",":))"];
|
||||
_emoteChatStrings["emo_sleep"] = [":tired:","|)","|-)",":zzz:","-_-","-_-zzz","--_"];
|
||||
_emoteChatStrings["emo_sneaky"] = [":sneaky:"];
|
||||
_emoteChatStrings["emo_surprise"] = [":surprise:",":O",":-O"];
|
||||
_emoteChatStrings["emo_think"] = [":think:"];
|
||||
_emoteChatStrings["emo_tongue"] = [":P",":tongue:"];
|
||||
_emoteChatStrings["emo_wink"] = [":wink:",";)",";-)"];
|
||||
_emoteChatStrings["emo_star1"] = [":singlestar:"];
|
||||
_emoteChatStrings["emo_star2"] = [":doublestar:"];
|
||||
_emoteChatStrings["emo_star3"] = [":triplestar:"];
|
||||
|
||||
public function EmoticonUtility()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function setupEmotes(param1:int, param2:MovieClip, param3:Boolean, param4:Function, param5:Function, param6:Function) : MovieClip
|
||||
{
|
||||
var _loc9_:* = 0;
|
||||
var _loc7_:Sprite = null;
|
||||
var _loc12_:int = param3 ? 0 : 7 * 2;
|
||||
var _loc8_:Number = param1 == 0 ? -55 : 15;
|
||||
var _loc11_:MovieClip = new MovieClip();
|
||||
var _loc10_:int = 0;
|
||||
_loc9_ = 0;
|
||||
for(; _loc9_ < displaySprites.length; _loc9_++)
|
||||
{
|
||||
if(param1 == 0 || displaySpritesNotAllowedInPlayerWall.indexOf(displaySprites[_loc9_]) == -1)
|
||||
{
|
||||
_loc7_ = GETDEFINITIONBYNAME(displaySprites[_loc9_]);
|
||||
if(param1 == 0 && _loc10_ < 7 * 2)
|
||||
{
|
||||
if(!param3)
|
||||
{
|
||||
_loc10_++;
|
||||
continue;
|
||||
}
|
||||
_loc7_.x = 11 + _loc10_ % 7 * 33 + -109;
|
||||
_loc7_.y = 14 + Math.floor(_loc10_ / 7) * 23 + -70;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc7_.x = 11 + _loc10_ % 7 * 33 + -109;
|
||||
_loc7_.y = 14 + Math.floor((_loc10_ - _loc12_) / 7) * 23 + _loc8_;
|
||||
if(!param3)
|
||||
{
|
||||
_loc7_.y += 35;
|
||||
}
|
||||
}
|
||||
_loc11_.addChild(_loc7_);
|
||||
_loc7_.addChild(GETDEFINITIONBYNAME("emo_place_holder"));
|
||||
_loc7_.buttonMode = true;
|
||||
_loc7_.useHandCursor = true;
|
||||
_loc7_.mouseChildren = false;
|
||||
_loc7_.tabEnabled = true;
|
||||
_loc7_.tabChildren = false;
|
||||
_loc7_.addEventListener("click",param4,false,0,true);
|
||||
_loc7_.addEventListener("rollOver",param5,false,0,true);
|
||||
_loc7_.addEventListener("rollOut",param5,false,0,true);
|
||||
_loc10_++;
|
||||
}
|
||||
}
|
||||
return _loc11_;
|
||||
}
|
||||
|
||||
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_:* = null;
|
||||
for each(var _loc4_:String in emoteSprites)
|
||||
{
|
||||
if(_emoteStrings[_loc4_].indexOf(param1) != -1)
|
||||
{
|
||||
if(param2 == false && _loc4_.slice(3,5) == "MO" && !gMainFrame.userInfo.isMember)
|
||||
{
|
||||
UpsellManager.displayPopup("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
|
||||
{
|
||||
for each(var _loc2_:String 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_ < 14 && !gMainFrame.userInfo.isMember)
|
||||
{
|
||||
UpsellManager.displayPopup("emotes","useLockedEmote");
|
||||
}
|
||||
else
|
||||
{
|
||||
param2(GETDEFINITIONBYNAME(emoteSprites[_loc3_]));
|
||||
}
|
||||
}
|
||||
|
||||
public static function formatStringForSmiley(param1:String, param2:int, param3:Array, param4:Boolean) : Object
|
||||
{
|
||||
var _loc23_:* = null;
|
||||
var _loc21_:String = null;
|
||||
var _loc8_:Boolean = false;
|
||||
var _loc7_:Boolean = false;
|
||||
var _loc10_:String = null;
|
||||
var _loc16_:int = 0;
|
||||
var _loc9_:RegExp = null;
|
||||
var _loc14_:* = null;
|
||||
var _loc17_:String = null;
|
||||
var _loc24_:MovieClip = null;
|
||||
var _loc22_:String = null;
|
||||
var _loc12_:* = null;
|
||||
var _loc18_:String = null;
|
||||
var _loc13_:String = null;
|
||||
var _loc11_:int = 0;
|
||||
var _loc5_:Boolean = false;
|
||||
var _loc19_:Array = null;
|
||||
var _loc20_:Array = [];
|
||||
for each(_loc23_ in _emoteChatStrings)
|
||||
{
|
||||
for each(_loc21_ in _loc23_)
|
||||
{
|
||||
_loc9_ = new RegExp(escapeRegExp(_loc21_),"gm");
|
||||
_loc20_ = param1.split(_loc9_);
|
||||
if(param4)
|
||||
{
|
||||
param1 = _loc20_.join("|*|" + _loc21_);
|
||||
}
|
||||
else if(_loc20_.length > 1)
|
||||
{
|
||||
param1 = "";
|
||||
_loc16_ = 0;
|
||||
while(_loc16_ < _loc20_.length)
|
||||
{
|
||||
_loc10_ = _loc20_[_loc16_];
|
||||
if(_loc16_ == 0 && _loc10_ != " ")
|
||||
{
|
||||
param1 += _loc10_;
|
||||
}
|
||||
else if(!_loc8_)
|
||||
{
|
||||
if(_loc10_ != "" && _loc10_ != " ")
|
||||
{
|
||||
param1 += "|*|" + _loc21_ + _loc10_;
|
||||
}
|
||||
else
|
||||
{
|
||||
param1 += "|*|" + _loc21_;
|
||||
}
|
||||
_loc8_ = true;
|
||||
}
|
||||
else if(_loc10_ != "" && _loc10_ != " ")
|
||||
{
|
||||
param1 += _loc10_;
|
||||
}
|
||||
_loc16_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var _loc15_:Array = param1.split("|*|");
|
||||
if(_loc15_[0] == "")
|
||||
{
|
||||
_loc15_.shift();
|
||||
}
|
||||
var _loc6_:Boolean = _loc15_.length == 1;
|
||||
var _loc25_:String = "false";
|
||||
for(_loc21_ in _loc15_)
|
||||
{
|
||||
if(_loc21_ == "0" && _loc15_[_loc21_] == "")
|
||||
{
|
||||
_loc25_ = "true";
|
||||
}
|
||||
loop4:
|
||||
for(_loc17_ in _emoteChatStrings)
|
||||
{
|
||||
var _loc31_:int = 0;
|
||||
var _loc30_:* = _emoteChatStrings[_loc17_];
|
||||
loop5:
|
||||
do
|
||||
{
|
||||
for each(_loc14_ in _loc30_)
|
||||
{
|
||||
_loc18_ = _loc15_[_loc21_];
|
||||
if(!(_loc18_ == "" || _loc18_.charAt() == " "))
|
||||
{
|
||||
continue loop5;
|
||||
}
|
||||
continue loop4;
|
||||
}
|
||||
}
|
||||
while(_loc12_ = _loc14_, _loc11_ = int(_loc18_.indexOf(_loc12_)), if(_loc11_ != -1)
|
||||
{
|
||||
_loc13_ = "";
|
||||
_loc16_ = 0;
|
||||
while(_loc16_ < _loc14_.length)
|
||||
{
|
||||
_loc13_ += _loc18_.charAt(_loc11_ + _loc16_);
|
||||
_loc16_++;
|
||||
}
|
||||
}, _loc13_ != _loc12_);
|
||||
if(!(_loc17_.slice(3,5) == "MO" && !gMainFrame.userInfo.isMember))
|
||||
{
|
||||
_loc13_ = "";
|
||||
_loc24_ = GETDEFINITIONBYNAME(_loc17_ + "_sml");
|
||||
_loc24_.y = _loc24_.y - 3;
|
||||
if(_loc25_ == "false" && _loc15_[_loc21_].charAt(_loc15_[_loc21_].length - 1) != "")
|
||||
{
|
||||
_loc5_ = true;
|
||||
}
|
||||
if(_loc24_.width <= 20)
|
||||
{
|
||||
_loc22_ = " . ";
|
||||
}
|
||||
else if(_loc24_.width <= 22)
|
||||
{
|
||||
_loc22_ = " . ";
|
||||
}
|
||||
else if(_loc24_.width <= 25)
|
||||
{
|
||||
_loc22_ = " . ";
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc22_ = " . ";
|
||||
}
|
||||
_loc15_[_loc21_] = _loc22_ + (_loc5_ == true ? " " : "");
|
||||
param3.push({
|
||||
"strindex":param2,
|
||||
"emoticon":_loc24_,
|
||||
"added":false,
|
||||
"smileystart":_loc25_
|
||||
});
|
||||
}
|
||||
}
|
||||
_loc19_ = _loc15_[_loc21_].split("");
|
||||
param2 += _loc19_.length;
|
||||
}
|
||||
return {
|
||||
"str":_loc15_.join(""),
|
||||
"smileyArray":param3,
|
||||
"stringIndex":param2,
|
||||
"hasOnlyOne":_loc6_
|
||||
};
|
||||
}
|
||||
|
||||
public static function getSmallSmileyMCForEmoteString(param1:String) : MovieClip
|
||||
{
|
||||
var _loc2_:String = null;
|
||||
var _loc3_:* = null;
|
||||
loop0:
|
||||
for(_loc2_ in _emoteStrings)
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:* = _emoteStrings[_loc2_];
|
||||
do
|
||||
{
|
||||
for each(_loc3_ in _loc4_)
|
||||
{
|
||||
}
|
||||
continue loop0;
|
||||
}
|
||||
while(_loc3_ != param1);
|
||||
if(_loc2_.slice(3,5) == "MO" && !gMainFrame.userInfo.isMember)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return GETDEFINITIONBYNAME(_loc2_ + "_sml");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static function escapeRegExp(param1:String) : String
|
||||
{
|
||||
return param1.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,570 @@
|
||||
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.MouseEvent;
|
||||
import flash.net.URLLoader;
|
||||
import flash.net.URLRequest;
|
||||
import flash.net.URLRequestHeader;
|
||||
import flash.utils.ByteArray;
|
||||
import loader.FeedbackDefHelper;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class FeedbackManager
|
||||
{
|
||||
|
||||
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;
|
||||
|
||||
public static const TYPE_CHAT_EXPERIENCE:int = 19;
|
||||
|
||||
public static const TYPE_MASTERPIECES:int = 20;
|
||||
|
||||
public static const TYPE_ASK_CAMI:int = 21;
|
||||
|
||||
private static const TAB_MEDIA_ID:int = 153;
|
||||
|
||||
private static const POPUP_MEDIA_ID:int = 457;
|
||||
|
||||
private static const TAB_FRAME_LABEL:String = "answer";
|
||||
|
||||
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 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(153,mediaHelperCallback,true);
|
||||
_imageUploader = new UserImageUpload();
|
||||
_imageUploader.init();
|
||||
}
|
||||
|
||||
public static function setUpOrbs(param1:Array, param2:Array) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc3_:Object = null;
|
||||
var _loc5_:FeedbackDefHelper = null;
|
||||
_feedbackLocs = param2;
|
||||
_feedbackDefHelpers = [];
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < param1.length)
|
||||
{
|
||||
if(param1[_loc4_] == 0)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
throw new Error("Id == 0");
|
||||
}
|
||||
_loc3_ = _feedbackDefCache[param1[_loc4_]];
|
||||
if(!_loc3_)
|
||||
{
|
||||
_loc5_ = new FeedbackDefHelper();
|
||||
_loc5_.init(param1[_loc4_],onDefReceived);
|
||||
_feedbackDefHelpers[param1[_loc4_]] = _loc5_;
|
||||
}
|
||||
else
|
||||
{
|
||||
setUpOrb(_loc3_);
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
|
||||
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 _loc5_:Object = param1.def;
|
||||
var _loc4_:String = LocalizationManager.translateIdOnly(int(_loc5_.defaultStrRef));
|
||||
var _loc3_:RegExp = /\r\n/g;
|
||||
_loc4_ = _loc4_.replace(_loc3_,"\n");
|
||||
_loc3_ = /\r/g;
|
||||
_loc4_ = _loc4_.replace(_loc3_,"\n");
|
||||
var _loc2_:Object = {
|
||||
"id":int(_loc5_.id),
|
||||
"titleTxt":LocalizationManager.translateIdOnly(int(_loc5_.titleStrRef)),
|
||||
"defaultTxt":_loc4_,
|
||||
"thanksTxt":LocalizationManager.translateIdOnly(int(_loc5_.thankStrRef)),
|
||||
"allowImg":Boolean(int(_loc5_.bAcceptImage)),
|
||||
"userVarId":int(_loc5_.userVarRef),
|
||||
"bitIdx":int(_loc5_.bitIndex)
|
||||
};
|
||||
_feedbackDefCache[_loc2_.id] = _loc2_;
|
||||
_feedbackDefHelpers[_loc2_.id] = null;
|
||||
_loc2_.seen = gMainFrame.userInfo.userVarCache.isBitSet(_loc2_.userVarId,_loc2_.bitIdx);
|
||||
if(_loc2_.id == 1 || _loc2_.id == 11 || _loc2_.id == 3 || _loc2_.id == 4 || _loc2_.id == 5 || _loc2_.id == 18 || _loc2_.id == 19 || _loc2_.id == 21)
|
||||
{
|
||||
displayFeedbackPopup(_loc2_);
|
||||
}
|
||||
else
|
||||
{
|
||||
setUpOrb(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function setUpOrb(param1:Object) : void
|
||||
{
|
||||
var _loc3_:MovieClip = null;
|
||||
var _loc2_:int = 0;
|
||||
if(_tabTemplate)
|
||||
{
|
||||
_loc3_ = new _tabTemplate.constructor();
|
||||
_loc3_.def = param1;
|
||||
_loc2_ = int(_loc3_.id = int(param1.id));
|
||||
_loc3_.x = _feedbackLocs[_loc2_].x;
|
||||
_loc3_.y = _feedbackLocs[_loc2_].y;
|
||||
if(param1.seen)
|
||||
{
|
||||
_loc3_.gotoAndPlay("answerDim");
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_.gotoAndPlay("answer");
|
||||
}
|
||||
_loc3_.addEventListener("mouseDown",onTabMouseDown,false,0,true);
|
||||
_worldLayer.addChild(_loc3_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function mediaHelperCallback(param1:MovieClip) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
if(param1.mediaHelper.id == 153)
|
||||
{
|
||||
_loc2_ = int(param1.mediaHelper.id);
|
||||
_tabTemplate = MovieClip(param1.getChildAt(0));
|
||||
_tabMediaHelper.destroy();
|
||||
_tabMediaHelper = null;
|
||||
}
|
||||
else if(param1.mediaHelper.id == 457)
|
||||
{
|
||||
_popup = param1;
|
||||
_popupMediaHelper.destroy();
|
||||
_popupMediaHelper = null;
|
||||
_popup.x = 900 * 0.5;
|
||||
_popup.y = 550 * 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("answerDim");
|
||||
}
|
||||
displayFeedbackPopup(_loc3_);
|
||||
}
|
||||
|
||||
public static function displayFeedbackPopup(param1:Object) : void
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
var _loc2_:int = int(param1.id);
|
||||
if(!_popup)
|
||||
{
|
||||
_popupMediaHelper.init(457,mediaHelperCallback,param1);
|
||||
return;
|
||||
}
|
||||
if(!param1.seen)
|
||||
{
|
||||
param1.seen = true;
|
||||
AchievementXtCommManager.requestSetUserVar(param1.userVarId,param1.bitIdx);
|
||||
}
|
||||
_popup.gotoAndStop(frameLabelForType(_loc2_));
|
||||
_popup.submitBtn.addEventListener("mouseDown",onMouseDown,false,0,true);
|
||||
_popup.bx.addEventListener("mouseDown",onMouseDown,false,0,true);
|
||||
_popup.addEventListener("mouseDown",onMouseDown,false,0,true);
|
||||
_popup.txt.addEventListener("mouseDown",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("mouseDown",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_ == 18)
|
||||
{
|
||||
_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 1:
|
||||
return 1;
|
||||
case 3:
|
||||
case 19:
|
||||
return 2;
|
||||
case 4:
|
||||
case 2:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 13:
|
||||
case 15:
|
||||
case 16:
|
||||
case 17:
|
||||
break;
|
||||
case 11:
|
||||
return 4;
|
||||
case 18:
|
||||
return 6;
|
||||
case 21:
|
||||
return 7;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
private static function maxCharsForType(param1:int) : int
|
||||
{
|
||||
switch(param1)
|
||||
{
|
||||
case 1:
|
||||
case 11:
|
||||
case 21:
|
||||
return 150;
|
||||
case 3:
|
||||
return 50;
|
||||
case 4:
|
||||
return 3000;
|
||||
case 2:
|
||||
case 5:
|
||||
case 6:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 13:
|
||||
case 15:
|
||||
case 16:
|
||||
case 12:
|
||||
case 7:
|
||||
case 14:
|
||||
break;
|
||||
case 17:
|
||||
case 19:
|
||||
return 200;
|
||||
case 18:
|
||||
return 25;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
|
||||
private static function onRemoveFileBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_imageUploader.resetUploader();
|
||||
_popup.addFileBtn.visible = true;
|
||||
}
|
||||
|
||||
private static function onMouseDown(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc3_:String = null;
|
||||
var _loc2_: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")
|
||||
{
|
||||
_loc3_ = _popup.txt.text;
|
||||
_loc2_ = /\r\n/g;
|
||||
_loc3_ = _loc3_.replace(_loc2_,"\n");
|
||||
_loc2_ = /\r/g;
|
||||
_loc3_ = _loc3_.replace(_loc2_,"\n");
|
||||
if(_loc3_.length > 0 && _loc3_ != _popup.defaultTxt || _imageUploader.fileName != "")
|
||||
{
|
||||
if(_loc3_ == _popup.def.defaultTxt)
|
||||
{
|
||||
_loc3_ = _popup.txt.text = "";
|
||||
}
|
||||
setupRequest(_imageUploader,_loc3_,_popup.def.id,_secondaryType,onSendComplete,onSendError);
|
||||
}
|
||||
}
|
||||
_popup.removeEventListener("mouseDown",onMouseDown);
|
||||
_popup.bx.removeEventListener("mouseDown",onMouseDown);
|
||||
_popup.submitBtn.removeEventListener("mouseDown",onMouseDown);
|
||||
_popup.txt.removeEventListener("mouseDown",onMouseDown);
|
||||
if(_popup.def.allowImg)
|
||||
{
|
||||
_imageUploader.resetUploader();
|
||||
_popup.addFileBtn.visible = true;
|
||||
_popup.removeFileBtn.removeEventListener("mouseDown",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 _loc10_:Object = {
|
||||
"userName":gMainFrame.userInfo.myUserName,
|
||||
"type":param3,
|
||||
"message":param2,
|
||||
"secondaryType":param4,
|
||||
"languageId":LocalizationManager.currentLanguage
|
||||
};
|
||||
var _loc8_:URLRequest = new URLRequest(gMainFrame.clientInfo.mdUrl + "fb");
|
||||
_loc8_.contentType = "multipart/form-data; boundary=" + _loc7_;
|
||||
_loc8_.requestHeaders.push(new URLRequestHeader("Cache-Control","no-cache"));
|
||||
_loc8_.method = "POST";
|
||||
_loc8_.data = createPostData(param1.fileName,param1.uploadedImage,_loc7_,_loc10_);
|
||||
var _loc9_:URLLoader = new URLLoader();
|
||||
_loc9_.dataFormat = "binary";
|
||||
_loc9_.addEventListener("complete",param5);
|
||||
_loc9_.addEventListener("ioError",param6);
|
||||
_loc9_.load(_loc8_);
|
||||
}
|
||||
|
||||
public static function createPostData(param1:String, param2:ByteArray, param3:String, param4:Object = null) : ByteArray
|
||||
{
|
||||
var _loc5_:String = null;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:ByteArray = new ByteArray();
|
||||
_loc8_.endian = "bigEndian";
|
||||
if(param4 == null)
|
||||
{
|
||||
param4 = {};
|
||||
}
|
||||
for(var _loc6_:String in param4)
|
||||
{
|
||||
writeBoundary(_loc8_,param3);
|
||||
writeLineBreak(_loc8_);
|
||||
_loc5_ = "Content-Disposition: form-data; name=\"" + _loc6_ + "\"";
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc5_.length)
|
||||
{
|
||||
_loc8_.writeByte(_loc5_.charCodeAt(_loc7_));
|
||||
_loc7_++;
|
||||
}
|
||||
writeLineBreak(_loc8_);
|
||||
writeLineBreak(_loc8_);
|
||||
_loc8_.writeUTFBytes(param4[_loc6_]);
|
||||
writeLineBreak(_loc8_);
|
||||
}
|
||||
if(param2)
|
||||
{
|
||||
writeBoundary(_loc8_,param3);
|
||||
writeLineBreak(_loc8_);
|
||||
_loc5_ = "Content-Disposition: form-data; name=\"image\"; filename=\"" + param1 + "\"";
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc5_.length)
|
||||
{
|
||||
_loc8_.writeByte(_loc5_.charCodeAt(_loc7_));
|
||||
_loc7_++;
|
||||
}
|
||||
writeLineBreak(_loc8_);
|
||||
_loc5_ = "Content-Type: image/jpeg";
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc5_.length)
|
||||
{
|
||||
_loc8_.writeByte(_loc5_.charCodeAt(_loc7_));
|
||||
_loc7_++;
|
||||
}
|
||||
writeLineBreak(_loc8_);
|
||||
writeLineBreak(_loc8_);
|
||||
_loc8_.writeBytes(param2,0,param2.length);
|
||||
writeLineBreak(_loc8_);
|
||||
}
|
||||
writeBoundary(_loc8_,param3);
|
||||
writeDoubleDash(_loc8_);
|
||||
writeLineBreak(_loc8_);
|
||||
return _loc8_;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
writeDoubleDash(param1);
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < param2.length)
|
||||
{
|
||||
param1.writeByte(param2.charCodeAt(_loc3_));
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
private static function onSendComplete(param1:Event) : void
|
||||
{
|
||||
trace("w00t!");
|
||||
}
|
||||
|
||||
private static function onSendError(param1:Event) : void
|
||||
{
|
||||
trace("Argh! Error sending....");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,638 @@
|
||||
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 const LEADERBOARD_TYPE_ALLTIME:int = 1;
|
||||
|
||||
private static const LEADERBOARD_TYPE_THISWEEK:int = 2;
|
||||
|
||||
private static const LEADERBOARD_TYPE_BUDDY:int = 3;
|
||||
|
||||
private static var instrObjs:Object;
|
||||
|
||||
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);
|
||||
_parent = param1;
|
||||
_joinGameObj = param2;
|
||||
_gameCard = param2.mi.gameCardScreen;
|
||||
_onStartClicked = param3;
|
||||
_onCloseCallback = param4;
|
||||
var _loc5_:int = int(_joinGameObj.mi.proModeUserVarRefId);
|
||||
_showProModeBtn = _loc5_ > 0;
|
||||
_proModeValue = gMainFrame.userInfo.userVarCache.getUserVarValueById(_loc5_);
|
||||
_isMultiplayer = _joinGameObj.mi.maxPlayers > 1;
|
||||
_gameName = _joinGameObj.swfName;
|
||||
_showLeaderBoard = false;
|
||||
if(instrObjs == null)
|
||||
{
|
||||
setupInstructions();
|
||||
}
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(3754,onGameCardLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
removeEventListeners();
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
DarkenManager.unDarken(_thePopup);
|
||||
_parent.removeChild(_thePopup);
|
||||
_thePopup = null;
|
||||
}
|
||||
|
||||
private function setupInstructions() : void
|
||||
{
|
||||
instrObjs = {};
|
||||
var _loc1_:Object = instrObjs["Pachinko"] = {};
|
||||
_loc1_.name = 11284;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11285;
|
||||
_loc1_.instrTxts[1] = 11286;
|
||||
_loc1_ = instrObjs["MiniGame_Memory"] = {};
|
||||
_loc1_.name = 11287;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11288;
|
||||
_loc1_.instrTxts[1] = 11289;
|
||||
_loc1_ = instrObjs["MoatMadness"] = {};
|
||||
_loc1_.name = 11290;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11291;
|
||||
_loc1_.instrTxts[1] = 11292;
|
||||
_loc1_ = instrObjs["ParachuteGlider"] = {};
|
||||
_loc1_.name = 11293;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11294;
|
||||
_loc1_.instrTxts[1] = 11295;
|
||||
_loc1_ = instrObjs["QuestParachuteGlider"] = {};
|
||||
_loc1_.name = 11293;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11294;
|
||||
_loc1_.instrTxts[1] = 11295;
|
||||
_loc1_ = instrObjs["Trivia"] = {};
|
||||
_loc1_.name = 11299;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11297;
|
||||
_loc1_.instrTxts[1] = 11298;
|
||||
_loc1_ = instrObjs["PhantomFighter"] = {};
|
||||
_loc1_.name = 11300;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11301;
|
||||
_loc1_.instrTxts[1] = 11302;
|
||||
_loc1_ = instrObjs["SpiderShooter"] = {};
|
||||
_loc1_.name = 11303;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11304;
|
||||
_loc1_.instrTxts[1] = 11305;
|
||||
_loc1_ = instrObjs["RiverRace"] = {};
|
||||
_loc1_.name = 11306;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11307;
|
||||
_loc1_.instrTxts[1] = 11308;
|
||||
_loc1_ = instrObjs["WindRider"] = {};
|
||||
_loc1_.name = 11309;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11310;
|
||||
_loc1_.instrTxts[1] = 11311;
|
||||
_loc1_ = instrObjs["DistanceChallenge"] = {};
|
||||
_loc1_.name = 11312;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11313;
|
||||
_loc1_.instrTxts[1] = 11314;
|
||||
_loc1_ = instrObjs["Twister"] = {};
|
||||
_loc1_.name = 11315;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11316;
|
||||
_loc1_.instrTxts[1] = 11317;
|
||||
_loc1_ = instrObjs["MicroMiraSays"] = {};
|
||||
_loc1_.name = 11318;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11319;
|
||||
_loc1_.instrTxts[1] = 11320;
|
||||
_loc1_ = instrObjs["GemBreaker"] = {};
|
||||
_loc1_.name = 11321;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11322;
|
||||
_loc1_.instrTxts[1] = 11323;
|
||||
_loc1_ = instrObjs["SuperSort"] = {};
|
||||
_loc1_.name = 11324;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11325;
|
||||
_loc1_.instrTxts[1] = 11326;
|
||||
_loc1_ = instrObjs["TowerDefense"] = {};
|
||||
_loc1_.name = 11327;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11328;
|
||||
_loc1_.instrTxts[1] = 11329;
|
||||
_loc1_ = instrObjs["FortSmasher"] = {};
|
||||
_loc1_.name = 11330;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11331;
|
||||
_loc1_.instrTxts[1] = 11332;
|
||||
_loc1_ = instrObjs["PillBugs"] = {};
|
||||
_loc1_.name = 11333;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11334;
|
||||
_loc1_.instrTxts[1] = 11335;
|
||||
_loc1_ = instrObjs["FeedingFrenzy"] = {};
|
||||
_loc1_.name = 11336;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11337;
|
||||
_loc1_.instrTxts[1] = 11338;
|
||||
_loc1_ = instrObjs["PhantomsTreasure"] = {};
|
||||
_loc1_.name = 11339;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11340;
|
||||
_loc1_.instrTxts[1] = 11341;
|
||||
_loc1_ = instrObjs["FashionShow"] = {};
|
||||
_loc1_.name = 11342;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11343;
|
||||
_loc1_.instrTxts[1] = 11344;
|
||||
_loc1_ = instrObjs["Adventure"] = {};
|
||||
_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"] = {};
|
||||
_loc1_.name = 11348;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11349;
|
||||
_loc1_.instrTxts[1] = 11350;
|
||||
_loc1_ = instrObjs["FallingPhantoms"] = {};
|
||||
_loc1_.name = 11351;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11352;
|
||||
_loc1_.instrTxts[1] = 11353;
|
||||
_loc1_ = instrObjs["HedgeHog"] = {};
|
||||
_loc1_.name = 11354;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11355;
|
||||
_loc1_.instrTxts[1] = 11356;
|
||||
_loc1_ = instrObjs["DolphinRace"] = {};
|
||||
_loc1_.name = 11357;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 11358;
|
||||
_loc1_.instrTxts[1] = 11359;
|
||||
_loc1_ = instrObjs["EagleFlap"] = {};
|
||||
_loc1_.name = 15735;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 15740;
|
||||
_loc1_.instrTxts[1] = 15741;
|
||||
_loc1_ = instrObjs["SpotOn"] = {};
|
||||
_loc1_.name = 19654;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 19686;
|
||||
_loc1_.instrTxts[1] = 19687;
|
||||
_loc1_ = instrObjs["ArtStudioPainting"] = {};
|
||||
_loc1_.name = 25289;
|
||||
_loc1_.instrTxts = [];
|
||||
_loc1_.instrTxts[0] = 25291;
|
||||
_loc1_.instrTxts[1] = 25292;
|
||||
_loc1_.startBtnStrId = 25290;
|
||||
}
|
||||
|
||||
private function onGameCardLoaded(param1:MovieClip) : void
|
||||
{
|
||||
_thePopup = MovieClip(param1.getChildAt(0));
|
||||
_joinGamePopup = _thePopup.joinGame;
|
||||
_instructionsPopup = _thePopup.instructions;
|
||||
_parent.addChild(_thePopup);
|
||||
DarkenManager.darken(_thePopup);
|
||||
if(_showProModeBtn)
|
||||
{
|
||||
_joinGamePopup.gotoAndPlay("pro");
|
||||
if(_proModeValue <= 0)
|
||||
{
|
||||
_joinGamePopup.proStartBtn.activateGrayState(true);
|
||||
}
|
||||
}
|
||||
addEventListeners();
|
||||
if(_joinGamePopup.msg)
|
||||
{
|
||||
_joinGamePopup.msg.visible = false;
|
||||
}
|
||||
_instructionsPopup.visible = false;
|
||||
_joinGamePopup.visible = true;
|
||||
if(_joinGamePopup.hasOwnProperty("gameTitle") && _gameCard != null)
|
||||
{
|
||||
_joinGamePopup.gameTitle.addChild(_gameCard);
|
||||
}
|
||||
if(_isMultiplayer && !Utility.canMultiplayer())
|
||||
{
|
||||
_joinGamePopup.startBtn.activateGrayState(true);
|
||||
_joinGamePopup.proStartBtn.activateGrayState(true);
|
||||
}
|
||||
_instrInfo = instrObjs[_gameName];
|
||||
if(_instrInfo && "startBtnStrId" in _instrInfo)
|
||||
{
|
||||
(_joinGamePopup.startBtn as GuiSoundBtnSubMenu).setTextInLayer(LocalizationManager.translateIdOnly(_instrInfo.startBtnStrId),"txt");
|
||||
if(_joinGamePopup.proStartBtn)
|
||||
{
|
||||
(_joinGamePopup.proStartBtn as GuiSoundBtnSubMenu).setTextInLayer(LocalizationManager.translateIdOnly(_instrInfo.startBtnStrId),"txt");
|
||||
}
|
||||
}
|
||||
_thePopup.x = 900 * 0.5;
|
||||
_thePopup.y = 550 * 0.5;
|
||||
_originalBX = _thePopup.bx.y;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
}
|
||||
|
||||
private function getVisibleLeaderBoard() : int
|
||||
{
|
||||
if(_thePopup.leaderboards_popup.thisWeekUp.visible)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if(_thePopup.leaderboards_popup.allTimeUp.visible)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_thePopup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_thePopup.bx.addEventListener("mouseDown",onClose,false,0,true);
|
||||
if(_joinGamePopup.startBtn)
|
||||
{
|
||||
_joinGamePopup.startBtn.addEventListener("mouseDown",onAnyStartClicked,false,0,true);
|
||||
}
|
||||
else if(_joinGamePopup.startPlayBtn)
|
||||
{
|
||||
_joinGamePopup.startPlayBtn.addEventListener("mouseDown",onAnyStartClicked,false,0,true);
|
||||
}
|
||||
if(_joinGamePopup.proStartBtn)
|
||||
{
|
||||
_joinGamePopup.proStartBtn.addEventListener("mouseDown",onAnyStartClicked,false,0,true);
|
||||
}
|
||||
_joinGamePopup.instrBtn.addEventListener("mouseDown",onInstructionsClicked,false,0,true);
|
||||
if(_showLeaderBoard)
|
||||
{
|
||||
_joinGamePopup.leaderboardsButton.gotoAndStop("active");
|
||||
_joinGamePopup.leaderboards_popup.thisWeekDown.addEventListener("mouseDown",thisWeekClicked,false,0,true);
|
||||
_joinGamePopup.leaderboards_popup.buddiesDown.addEventListener("mouseDown",buddiesClicked,false,0,true);
|
||||
_joinGamePopup.leaderboards_popup.allTimeDown.addEventListener("mouseDown",allTimeClicked,false,0,true);
|
||||
_joinGamePopup.leaderboards_popup.bx.addEventListener("mouseDown",leaderBoardBXClicked,false,0,true);
|
||||
_joinGamePopup.leaderboardsButton.btn.addEventListener("mouseDown",leaderBoardClicked,false,0,true);
|
||||
}
|
||||
_instructionsPopup.backBtn.addEventListener("mouseDown",backHandler,false,0,true);
|
||||
_instructionsPopup.backToMainBtn.addEventListener("mouseDown",backBtnHandlerOnFirstScreen,false,0,true);
|
||||
_instructionsPopup.nextBtn.addEventListener("mouseDown",nextHandler,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_thePopup.removeEventListener("mouseDown",onPopup);
|
||||
_thePopup.bx.removeEventListener("mouseDown",onClose);
|
||||
if(_joinGamePopup.startBtn)
|
||||
{
|
||||
_joinGamePopup.startBtn.removeEventListener("mouseDown",onAnyStartClicked);
|
||||
}
|
||||
else if(_joinGamePopup.startPlayBtn)
|
||||
{
|
||||
_joinGamePopup.startPlayBtn.removeEventListener("mouseDown",onAnyStartClicked);
|
||||
}
|
||||
if(_joinGamePopup.proStartBtn)
|
||||
{
|
||||
_joinGamePopup.proStartBtn.removeEventListener("mouseDown",onAnyStartClicked);
|
||||
}
|
||||
_joinGamePopup.instrBtn.removeEventListener("mouseDown",onInstructionsClicked);
|
||||
if(_showLeaderBoard)
|
||||
{
|
||||
_joinGamePopup.leaderboards_popup.thisWeekDown.removeEventListener("mouseDown",thisWeekClicked);
|
||||
_joinGamePopup.leaderboards_popup.buddiesDown.removeEventListener("mouseDown",buddiesClicked);
|
||||
_joinGamePopup.leaderboards_popup.allTimeDown.removeEventListener("mouseDown",allTimeClicked);
|
||||
_joinGamePopup.leaderboards_popup.bx.removeEventListener("mouseDown",leaderBoardBXClicked);
|
||||
_joinGamePopup.leaderboardsButton.btn.removeEventListener("mouseDown",leaderBoardClicked);
|
||||
}
|
||||
_instructionsPopup.backBtn.removeEventListener("mouseDown",backHandler);
|
||||
_instructionsPopup.backToMainBtn.removeEventListener("mouseDown",backBtnHandlerOnFirstScreen);
|
||||
_instructionsPopup.nextBtn.removeEventListener("mouseDown",nextHandler);
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_instructionsPopup.visible)
|
||||
{
|
||||
backBtnHandlerOnFirstScreen(param1);
|
||||
}
|
||||
else if(_onCloseCallback != null)
|
||||
{
|
||||
_onCloseCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function thisWeekClicked(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_joinGamePopup.leaderboards_popup.thisWeekUp.visible = true;
|
||||
_joinGamePopup.leaderboards_popup.allTimeUp.visible = false;
|
||||
_joinGamePopup.leaderboards_popup.buddiesUp.visible = false;
|
||||
onLeaderBoardSelected();
|
||||
}
|
||||
|
||||
private function buddiesClicked(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_joinGamePopup.leaderboards_popup.thisWeekUp.visible = false;
|
||||
_joinGamePopup.leaderboards_popup.allTimeUp.visible = false;
|
||||
_joinGamePopup.leaderboards_popup.buddiesUp.visible = true;
|
||||
onLeaderBoardSelected();
|
||||
}
|
||||
|
||||
private function allTimeClicked(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_joinGamePopup.leaderboards_popup.thisWeekUp.visible = false;
|
||||
_joinGamePopup.leaderboards_popup.allTimeUp.visible = true;
|
||||
_joinGamePopup.leaderboards_popup.buddiesUp.visible = false;
|
||||
onLeaderBoardSelected();
|
||||
}
|
||||
|
||||
private function leaderBoardClicked(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_joinGamePopup.leaderboardsButton.gotoAndPlay("off");
|
||||
_joinGamePopup.gotoAndPlay("normal_l");
|
||||
_joinGamePopup.gotoAndPlay("pro_l");
|
||||
_thePopup.bx.y = -1000;
|
||||
if(_joinGameObj != null && _joinGameObj.typeDefId != -1)
|
||||
{
|
||||
onLeaderBoardSelected();
|
||||
}
|
||||
}
|
||||
|
||||
private function leaderBoardBXClicked(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_joinGamePopup.leaderboardsButton.gotoAndPlay("on");
|
||||
_joinGamePopup.gotoAndPlay("normal_l_close");
|
||||
_joinGamePopup.gotoAndPlay("pro_l_close");
|
||||
_thePopup.bx.y = _originalBX;
|
||||
}
|
||||
|
||||
public function onLeaderBoardSelected() : void
|
||||
{
|
||||
if(_thePopup != null && _joinGameObj != null && _joinGameObj.typeDefId != -1)
|
||||
{
|
||||
_leaderBoardCache = MinigameManager.getLeaderBoardCache();
|
||||
if(_leaderBoardCache[_joinGameObj.typeDefId] != null && getTimer() - _leaderBoardCache[_joinGameObj.typeDefId]._cacheTime < 60000)
|
||||
{
|
||||
switch(getVisibleLeaderBoard() - 1)
|
||||
{
|
||||
case 0:
|
||||
populateLeaderBoard(_leaderBoardCache[_joinGameObj.typeDefId]._allTime);
|
||||
break;
|
||||
case 1:
|
||||
populateLeaderBoard(_leaderBoardCache[_joinGameObj.typeDefId]._thisWeek);
|
||||
break;
|
||||
case 2:
|
||||
populateLeaderBoard(_leaderBoardCache[_joinGameObj.typeDefId]._buddy);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
populateLeaderBoard(null);
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
MinigameXtCommManager.sendMinigameLeaderboardRequest(_joinGameObj.typeDefId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function populateLeaderBoard(param1:Array) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(param1 != null && param1.length > 0)
|
||||
{
|
||||
if(param1[0]._score != -1)
|
||||
{
|
||||
_joinGamePopup.leaderboards_popup["p11"].text = param1[0]._name;
|
||||
_joinGamePopup.leaderboards_popup["s11"].text = param1[0]._score;
|
||||
}
|
||||
else
|
||||
{
|
||||
_joinGamePopup.leaderboards_popup["p11"].text = "";
|
||||
_joinGamePopup.leaderboards_popup["s11"].text = "";
|
||||
}
|
||||
_loc2_ = 1;
|
||||
while(_loc2_ < 11)
|
||||
{
|
||||
if(_loc2_ < param1.length)
|
||||
{
|
||||
_joinGamePopup.leaderboards_popup["p" + _loc2_].text = param1[_loc2_]._name;
|
||||
_joinGamePopup.leaderboards_popup["s" + _loc2_].text = param1[_loc2_]._score;
|
||||
if(param1[_loc2_]._name == param1[0]._name)
|
||||
{
|
||||
_joinGamePopup.leaderboards_popup["p" + _loc2_].textColor = 26265;
|
||||
_joinGamePopup.leaderboards_popup["s" + _loc2_].textColor = 26265;
|
||||
}
|
||||
else
|
||||
{
|
||||
_joinGamePopup.leaderboards_popup["p" + _loc2_].textColor = 4137240;
|
||||
_joinGamePopup.leaderboards_popup["s" + _loc2_].textColor = 4137240;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_joinGamePopup.leaderboards_popup["p" + _loc2_].text = "";
|
||||
_joinGamePopup.leaderboards_popup["s" + _loc2_].text = "";
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = 1;
|
||||
while(_loc2_ <= 11)
|
||||
{
|
||||
_joinGamePopup.leaderboards_popup["p" + _loc2_].text = "";
|
||||
_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" || param1.currentTarget.name == "startPlayBtn")
|
||||
{
|
||||
_onStartClicked(0);
|
||||
}
|
||||
else if(param1.currentTarget.name == "proStartBtn")
|
||||
{
|
||||
_onStartClicked(1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onInstructionsClicked(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_instructionsPopup.visible = true;
|
||||
_joinGamePopup.visible = false;
|
||||
_instructionsPopup.startBtn.visible = false;
|
||||
_instrInfo = instrObjs[_gameName];
|
||||
if(_instrInfo == null)
|
||||
{
|
||||
throw new Error("InstructionScreenBuilder could not find instrObjs[\"" + _gameName + "\"]!");
|
||||
}
|
||||
_instrInfo.displayName = _gameName;
|
||||
_numScreens = _instrInfo.instrTxts.length;
|
||||
_currScreen = 0;
|
||||
updateInstrScreen();
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function backHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_currScreen > 0)
|
||||
{
|
||||
_currScreen = _currScreen - 1;
|
||||
updateInstrScreen();
|
||||
return;
|
||||
}
|
||||
throw new Error("Tried to go back on first instr screen!");
|
||||
}
|
||||
|
||||
private function nextHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_currScreen < _numScreens - 1)
|
||||
{
|
||||
_currScreen = _currScreen + 1;
|
||||
updateInstrScreen();
|
||||
return;
|
||||
}
|
||||
throw new Error("Tried to go next on last instr screen!");
|
||||
}
|
||||
|
||||
private function backBtnHandlerOnFirstScreen(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_instructionsPopup.visible = false;
|
||||
_joinGamePopup.visible = true;
|
||||
}
|
||||
|
||||
private function updateInstrScreen() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
LocalizationManager.translateId(_instructionsPopup.gameName.gameNameTxt,instrObjs[_instrInfo.displayName].name);
|
||||
LocalizationManager.translateId(_instructionsPopup.gameInstr.gameInstrTxt,_instrInfo.instrTxts[_currScreen]);
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _instructionsPopup.instrImg.numChildren)
|
||||
{
|
||||
_instructionsPopup.instrImg.getChildAt(_loc1_).visible = false;
|
||||
_loc1_++;
|
||||
}
|
||||
if(_instructionsPopup.instrImg[_instrInfo.name + _currScreen])
|
||||
{
|
||||
_instructionsPopup.instrImg[_instrInfo.name + _currScreen].visible = true;
|
||||
}
|
||||
if(_currScreen == 0)
|
||||
{
|
||||
if(_numScreens > 1)
|
||||
{
|
||||
_instructionsPopup.nextBtn.visible = true;
|
||||
_instructionsPopup.nextTxt.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_instructionsPopup.nextBtn.visible = false;
|
||||
_instructionsPopup.nextTxt.visible = false;
|
||||
}
|
||||
_instructionsPopup.backToMainBtn.visible = true;
|
||||
_instructionsPopup.backBtn.visible = false;
|
||||
}
|
||||
else if(_currScreen == _numScreens - 1)
|
||||
{
|
||||
_instructionsPopup.backBtn.visible = true;
|
||||
_instructionsPopup.backTxt.visible = true;
|
||||
_instructionsPopup.nextBtn.visible = false;
|
||||
_instructionsPopup.nextTxt.visible = false;
|
||||
_instructionsPopup.backToMainBtn.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_instructionsPopup.backBtn.visible = true;
|
||||
_instructionsPopup.backTxt.visible = true;
|
||||
_instructionsPopup.nextBtn.visible = true;
|
||||
_instructionsPopup.nextTxt.visible = true;
|
||||
_instructionsPopup.backToMainBtn.visible = false;
|
||||
}
|
||||
_instructionsPopup.page.pageTxt.text = _currScreen + 1 + " / " + _numScreens;
|
||||
_instructionsPopup.nextTxt.visible = false;
|
||||
_instructionsPopup.backTxt.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
package gui
|
||||
{
|
||||
import com.greensock.TweenLite;
|
||||
import com.greensock.easing.Back;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import game.MinigameManager;
|
||||
import game.MinigameXtCommManager;
|
||||
import gui.itemWindows.ItemWindowGameIcon;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class GameJoinPopup
|
||||
{
|
||||
|
||||
private static const JOIN_POPUP_ID:int = 4145;
|
||||
|
||||
private static const GAME_LIST_ID:int = 341;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _joinPopup:MovieClip;
|
||||
|
||||
private var _guiLayer:DisplayLayer;
|
||||
|
||||
private var _loadingSpiral:LoadingSpiral;
|
||||
|
||||
private var _gameDefIds:Array;
|
||||
|
||||
private var _itemWindows:WindowAndScrollbarGenerator;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
private var _iconTween:TweenLite;
|
||||
|
||||
private var _doubleGemsTween:TweenLite;
|
||||
|
||||
public function GameJoinPopup(param1:Function)
|
||||
{
|
||||
super();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_closeCallback = param1;
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
_loadingSpiral = new LoadingSpiral();
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(4145,onPopupLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
removeEventListeners();
|
||||
DarkenManager.unDarken(_joinPopup);
|
||||
if(_joinPopup && _guiLayer && _joinPopup.parent == _guiLayer)
|
||||
{
|
||||
_guiLayer.removeChild(_joinPopup);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopupLoaded(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
_joinPopup = param1.getChildAt(0) as MovieClip;
|
||||
_joinPopup.x = 900 * 0.5;
|
||||
_joinPopup.y = 550 * 0.5;
|
||||
_loadingSpiral.setNewParent(_joinPopup);
|
||||
buildItemWindows();
|
||||
addEventListeners();
|
||||
_guiLayer.addChild(_joinPopup);
|
||||
DarkenManager.darken(_joinPopup);
|
||||
_doubleGemsTween = null;
|
||||
_iconTween = null;
|
||||
}
|
||||
|
||||
private function buildItemWindows() : void
|
||||
{
|
||||
GenericListXtCommManager.requestGenericList(341,onGameListLoaded);
|
||||
}
|
||||
|
||||
private function onGameListLoaded(param1:int, param2:Array, param3:Object) : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
_gameDefIds = param2;
|
||||
var _loc4_:Array = [];
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _gameDefIds.length)
|
||||
{
|
||||
if(!MinigameManager.minigameInfoCache.getMinigameInfo(_gameDefIds[_loc5_]))
|
||||
{
|
||||
_loc4_.push(_gameDefIds[_loc5_]);
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
if(_loc4_.length > 0)
|
||||
{
|
||||
MinigameXtCommManager.sendMinigameInfoRequest(_loc4_,false,onMinigameInfoResponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
_itemWindows = new WindowAndScrollbarGenerator();
|
||||
_itemWindows.init(_joinPopup.itemWindow.width,_joinPopup.itemWindow.height - 4,-2,0,4,Math.max(1,_gameDefIds.length / 4),0,10,14,7,7,ItemWindowGameIcon,_gameDefIds,"",0,{
|
||||
"mouseDown":onIconDown,
|
||||
"mouseOver":onIconOver,
|
||||
"mouseOut":onIconOut
|
||||
},null,onWindowsLoaded);
|
||||
_joinPopup.itemWindow.addChild(_itemWindows);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMinigameInfoResponse() : void
|
||||
{
|
||||
onGameListLoaded(0,_gameDefIds,null);
|
||||
}
|
||||
|
||||
private function onWindowsLoaded() : void
|
||||
{
|
||||
_loadingSpiral.destroy();
|
||||
_loadingSpiral = null;
|
||||
}
|
||||
|
||||
private function onIconDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
MinigameManager.handleGameClick((param1.currentTarget as ItemWindowGameIcon).gameLaunchObject,null,false);
|
||||
onClosePopup(null);
|
||||
}
|
||||
|
||||
private function onIconOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
var _loc2_:ItemWindowGameIcon = param1.currentTarget as ItemWindowGameIcon;
|
||||
if(_loc2_.currItem)
|
||||
{
|
||||
if(_itemWindows.isIndexInView(_loc2_.index))
|
||||
{
|
||||
_itemWindows.toolTip.init(_joinPopup,_loc2_.toolTipName,_loc2_.x + _itemWindows.boxWidth * 0.5 + _itemWindows.parent.x + _loc2_.itemXLocation,Math.min(200,_loc2_.y + _itemWindows.boxHeight - _loc2_.itemYLocation + _itemWindows.parent.y - 5));
|
||||
_itemWindows.toolTip.startTimer(param1);
|
||||
}
|
||||
if(_iconTween)
|
||||
{
|
||||
_iconTween.progress(0);
|
||||
}
|
||||
if(_doubleGemsTween)
|
||||
{
|
||||
_doubleGemsTween.progress(0);
|
||||
}
|
||||
_iconTween = new TweenLite(_loc2_.currItem,0.15,{
|
||||
"scaleX":1.1,
|
||||
"scaleY":1.1,
|
||||
"ease":Back.easeIn
|
||||
});
|
||||
_doubleGemsTween = new TweenLite(_loc2_.doubleGems,0.15,{
|
||||
"scaleX":1.1,
|
||||
"scaleY":1.1,
|
||||
"ease":Back.easeIn
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private function onIconOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_itemWindows.toolTip.resetTimerAndSetVisibility();
|
||||
if(param1.currentTarget.currItem)
|
||||
{
|
||||
if(_iconTween)
|
||||
{
|
||||
_iconTween.progress(1);
|
||||
}
|
||||
if(_doubleGemsTween)
|
||||
{
|
||||
_doubleGemsTween.progress(1);
|
||||
}
|
||||
_iconTween = new TweenLite(param1.currentTarget.currItem,0.15,{
|
||||
"scaleX":1,
|
||||
"scaleY":1,
|
||||
"ease":Back.easeOut
|
||||
});
|
||||
_doubleGemsTween = new TweenLite(param1.currentTarget.doubleGems,0.15,{
|
||||
"scaleX":1,
|
||||
"scaleY":1,
|
||||
"ease":Back.easeOut
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClosePopup(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_joinPopup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_joinPopup.bx.addEventListener("mouseDown",onClosePopup,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_joinPopup.removeEventListener("mouseDown",onPopup);
|
||||
_joinPopup.bx.removeEventListener("mouseDown",onClosePopup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,320 @@
|
||||
package gui
|
||||
{
|
||||
import achievement.AchievementXtCommManager;
|
||||
import com.sbi.analytics.SBTracker;
|
||||
import currency.UserCurrency;
|
||||
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
|
||||
{
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
_callback = param2;
|
||||
_mediaHelpers = [];
|
||||
_wheelNumbers = [500,100,25,50,1,75,25,100,0,100,25,50,1,75,25,100];
|
||||
_displayTimer = new Timer(375);
|
||||
_displayTimer.addEventListener("timer",onTimerComplete,false,0,true);
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(1025,onMediaItemLoaded,param1);
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
removeGeneralEventListeners();
|
||||
DarkenManager.unDarken(_spinWheelMC);
|
||||
if(_spinWheelMC && _guiLayer && _spinWheelMC.parent == _guiLayer)
|
||||
{
|
||||
_guiLayer.removeChild(_spinWheelMC);
|
||||
}
|
||||
_guiLayer = null;
|
||||
_mediaHelpers = null;
|
||||
}
|
||||
|
||||
public function setupValuesAndSpin(param1:uint) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_gems = convertToGemsValue(param1 >> 24);
|
||||
_multiplier = param1 >> 16 & 0xFF;
|
||||
_spinEndPoint = calculateSpinEndPoint(_gems);
|
||||
if(!_isGift)
|
||||
{
|
||||
if(_isDiamond)
|
||||
{
|
||||
UserCurrency.setCurrency(UserCurrency.getCurrency(3) + _gems * _multiplier,3);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserCurrency.setCurrency(UserCurrency.getCurrency(0) + _gems * _multiplier,0);
|
||||
}
|
||||
}
|
||||
_loc2_ = 1;
|
||||
while(_loc2_ < 4)
|
||||
{
|
||||
if(_multiplier < _loc2_)
|
||||
{
|
||||
_spinWheelMC["x" + _loc2_ + "_on"].visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_spinWheelMC["x" + _loc2_ + "_on"].visible = true;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
if(_isDiamond)
|
||||
{
|
||||
_spinWheelMC.earnGifts(0);
|
||||
_spinWheelMC.earnDiamonds(_gems * _multiplier);
|
||||
}
|
||||
else if(_isGift)
|
||||
{
|
||||
_spinWheelMC.earnDiamonds(0);
|
||||
_spinWheelMC.earnGifts(1 * _multiplier);
|
||||
}
|
||||
else
|
||||
{
|
||||
_spinWheelMC.earnDiamonds(0);
|
||||
_spinWheelMC.earnGifts(0);
|
||||
}
|
||||
_spinWheelMC.spin(_spinEndPoint,onSpinComplete);
|
||||
AJAudio.playDailySpinSpin();
|
||||
}
|
||||
|
||||
private function onMediaItemLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var _loc3_:ApplicationDomain = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("game/play/popup/spinBonus");
|
||||
_spinWheelMC = MovieClip(param1.getChildAt(0));
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(!AJAudio.hasLoadedDailySpinSfx)
|
||||
{
|
||||
_loc3_ = param1.loaderInfo.applicationDomain;
|
||||
AJAudio.loadSfx("DailySpinSpin",_loc3_.getDefinition("DailySpinSpin") as Class,0.5);
|
||||
AJAudio.loadSfx("DailySpinBub1",_loc3_.getDefinition("DailySpinBub1") as Class,0.5);
|
||||
AJAudio.loadSfx("DailySpinBub2",_loc3_.getDefinition("DailySpinBub2") as Class,0.5);
|
||||
AJAudio.loadSfx("DailySpinBub3",_loc3_.getDefinition("DailySpinBub3") as Class,0.5);
|
||||
AJAudio.hasLoadedDailySpinSfx = true;
|
||||
}
|
||||
_spinWheelMC.spinTxtAnim.spinTxt.text = "";
|
||||
_spinWheelMC.bonusTxtAnim.bonusTxt.text = "";
|
||||
_spinWheelMC.totalTxtAnim.totalTxt.text = "";
|
||||
if(gMainFrame.clientInfo.jamaaDate - (param1.passback & 0xFFFF) == 1)
|
||||
{
|
||||
_loc2_ = Math.min((param1.passback >> 16 & 0xFF) + 1,3);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = 1;
|
||||
}
|
||||
_loc4_ = 1;
|
||||
while(_loc4_ < 4)
|
||||
{
|
||||
if(_loc2_ < _loc4_)
|
||||
{
|
||||
_spinWheelMC["x" + _loc4_ + "_on"].visible = false;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
_spinWheelMC.x = 900 * 0.5;
|
||||
_spinWheelMC.y = 550 * 0.5;
|
||||
_guiLayer.addChild(_spinWheelMC);
|
||||
DarkenManager.darken(_spinWheelMC);
|
||||
_mediaHelpers = [];
|
||||
addGeneralEventListeners();
|
||||
}
|
||||
}
|
||||
|
||||
private function convertToGemsValue(param1:int) : int
|
||||
{
|
||||
if(param1 < 4)
|
||||
{
|
||||
return (param1 + 1) * 25;
|
||||
}
|
||||
if(param1 == 4)
|
||||
{
|
||||
return 500;
|
||||
}
|
||||
if(param1 == 5)
|
||||
{
|
||||
_isDiamond = true;
|
||||
return 1;
|
||||
}
|
||||
if(param1 == 6)
|
||||
{
|
||||
_isGift = true;
|
||||
return 0;
|
||||
}
|
||||
return 25;
|
||||
}
|
||||
|
||||
private function calculateSpinEndPoint(param1:int) : int
|
||||
{
|
||||
var _loc2_:Number = Math.random();
|
||||
_loc2_ = int(_wheelNumbers.length * _loc2_);
|
||||
while(_wheelNumbers[_loc2_] != param1)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
_loc2_ + 1 >= _wheelNumbers.length ? _loc2_ : _loc2_++;
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent = null) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(_gems > 0)
|
||||
{
|
||||
SBTracker.trackPageview("game/play/popup/spinBonus/close/didSpin",-1,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
SBTracker.trackPageview("game/play/popup/spinBonus/close/noSpin",-1,1);
|
||||
}
|
||||
SBTracker.pop();
|
||||
if(_callback != null)
|
||||
{
|
||||
_callback();
|
||||
_callback = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function onSpinBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBTracker.trackPageview("game/play/popup/spinBonus/spin",-1,1);
|
||||
_spinWheelMC.spinBtn.mouse.visible = false;
|
||||
_spinWheelMC.spinBtn.down.visible = true;
|
||||
_spinWheelMC.spinBtn.down.gotoAndStop(3);
|
||||
_spinWheelMC.spinBtn.mouseEnabled = false;
|
||||
_spinWheelMC.spinBtn.mouseChildren = false;
|
||||
_spinWheelMC.spinBtn.removeEventListener("mouseDown",onSpinBtn);
|
||||
_spinWheelMC.bx.mouse.visible = false;
|
||||
_spinWheelMC.bx.down.visible = true;
|
||||
_spinWheelMC.bx.down.gotoAndStop(3);
|
||||
_spinWheelMC.bx.mouseEnabled = false;
|
||||
_spinWheelMC.bx.mouseChildren = false;
|
||||
_spinWheelMC.bx.removeEventListener("mouseDown",onClose);
|
||||
AchievementXtCommManager.requestSetUserVar(214,1);
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
}
|
||||
|
||||
private function onSpinComplete() : void
|
||||
{
|
||||
_displayTimer.start();
|
||||
}
|
||||
|
||||
private function onTimerComplete(param1:TimerEvent) : void
|
||||
{
|
||||
if(_spinWheelMC.spinTxtAnim.spinTxt.text == "")
|
||||
{
|
||||
_spinWheelMC.spinTxtAnim.spinTxt.text = _gems;
|
||||
_spinWheelMC.popupObject(0);
|
||||
AJAudio.playDailySpinBub1();
|
||||
}
|
||||
else if(_spinWheelMC.bonusTxtAnim.bonusTxt.text == "")
|
||||
{
|
||||
_spinWheelMC.bonusTxtAnim.bonusTxt.text = _multiplier;
|
||||
_displayTimer.delay = 750;
|
||||
_spinWheelMC.popupObject(1);
|
||||
AJAudio.playDailySpinBub2();
|
||||
}
|
||||
else if(_spinWheelMC.totalTxtAnim.totalTxt.text == "")
|
||||
{
|
||||
_spinWheelMC.totalTxtAnim.totalTxt.text = Utility.convertNumberToString(_gems * _multiplier);
|
||||
_displayTimer.delay = 3000;
|
||||
_spinWheelMC.popupObject(2);
|
||||
AJAudio.playDailySpinBub3();
|
||||
_spinWheelMC.bx.mouse.visible = true;
|
||||
_spinWheelMC.bx.down.visible = false;
|
||||
_spinWheelMC.bx.down.gotoAndStop(3);
|
||||
_spinWheelMC.bx.mouseEnabled = true;
|
||||
_spinWheelMC.bx.mouseChildren = true;
|
||||
_spinWheelMC.bx.addEventListener("mouseDown",onClose,false,0,true);
|
||||
if(_isGift)
|
||||
{
|
||||
GuiManager.initMessagePopups(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_displayTimer.reset();
|
||||
_displayTimer.removeEventListener("timerComplete",onTimerComplete);
|
||||
if(!_isGift)
|
||||
{
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function addGeneralEventListeners() : void
|
||||
{
|
||||
_spinWheelMC.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_spinWheelMC.bx.addEventListener("mouseDown",onClose,false,0,true);
|
||||
_spinWheelMC.spinBtn.addEventListener("mouseDown",onSpinBtn,false,0,true);
|
||||
}
|
||||
|
||||
private function removeGeneralEventListeners() : void
|
||||
{
|
||||
_spinWheelMC.removeEventListener("mouseDown",onPopup);
|
||||
_spinWheelMC.bx.removeEventListener("mouseDown",onClose);
|
||||
_spinWheelMC.spinBtn.removeEventListener("mouseDown",onSpinBtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
import collection.IntItemCollection;
|
||||
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 1000:
|
||||
case 1030:
|
||||
case 1051:
|
||||
case 1054:
|
||||
case 1060:
|
||||
if(!RoomManagerWorld.instance.inPreviewMode && (param2 == null || !param2.hasOwnProperty("volName") || QuestManager.onShopClick(param2.volName)))
|
||||
{
|
||||
launchStore(param1,_loc3_);
|
||||
}
|
||||
break;
|
||||
case 1040:
|
||||
GuiManager.openDenRoomSwitcher(false,null,true,-1,param1);
|
||||
break;
|
||||
case 1037:
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
GenericListXtCommManager.requestStreamList(param1,launchMovies,param2);
|
||||
break;
|
||||
case 1023:
|
||||
case 1033:
|
||||
case 1035:
|
||||
}
|
||||
}
|
||||
|
||||
public static function launchMovies(param1:int, param2:IntItemCollection, param3:IntItemCollection, param4:Array, param5:Array, param6:IntItemCollection, param7:IntItemCollection, param8:Object = null) : void
|
||||
{
|
||||
var _loc10_:Array = null;
|
||||
var _loc9_:Boolean = false;
|
||||
if(param2.length > 1)
|
||||
{
|
||||
GenericListXtCommManager.filterTypedList(1037,param2,{
|
||||
"thumbIds":param3,
|
||||
"baseTitles":param4,
|
||||
"indivTitles":param5,
|
||||
"statusIds":param6,
|
||||
"subtitleIds":param7
|
||||
});
|
||||
if(movieSelector && 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,202,39,onMovieSelectorClose);
|
||||
if(param8)
|
||||
{
|
||||
movieSelector.setSkinFrame(frameIdForMsg(param8.msg));
|
||||
if(param8.msg == "bb" || param8.msg == "tt" || param8.msg == "cami")
|
||||
{
|
||||
movieSelector.setQuestionBtn();
|
||||
}
|
||||
if(param8.titleTxt)
|
||||
{
|
||||
movieSelector.setTitleTxt(param8.titleTxt);
|
||||
}
|
||||
if(param8.msg.indexOf("autoplay") != -1)
|
||||
{
|
||||
movieSelector.chooseRandom(true,frameIdForMsg(param8.msg),param8.shouldRepeat != null ? param8.shouldRepeat : false);
|
||||
}
|
||||
if(param8.shouldRepeat != null)
|
||||
{
|
||||
movieSelector.setShouldRepeat(param8.shouldRepeat);
|
||||
}
|
||||
if(param8.width && 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(param8.width && param8.height)
|
||||
{
|
||||
GuiManager.initMoviePlayer(39,param2,param4,param7,_loc9_,param8.width,param8.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiManager.initMoviePlayer(39,param2,param4,param7,_loc9_);
|
||||
}
|
||||
if(_loc10_)
|
||||
{
|
||||
GuiManager.setVideoPlayerSkin(frameIdForMsg(_loc10_[0]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiManager.initMoviePlayer(39,param2,param4,param7,false);
|
||||
}
|
||||
}
|
||||
|
||||
public static function onRoomExit() : void
|
||||
{
|
||||
if(movieSelector)
|
||||
{
|
||||
movieSelector.destroy();
|
||||
movieSelector = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function togglePlayPauseVideoPlayer(param1:Boolean) : void
|
||||
{
|
||||
if(movieSelector)
|
||||
{
|
||||
movieSelector.togglePlayPauseVideoPlayer(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function isWorldShopOpen() : Boolean
|
||||
{
|
||||
return _shop != null;
|
||||
}
|
||||
|
||||
public static function closeWorldShop() : void
|
||||
{
|
||||
if(_shop)
|
||||
{
|
||||
_shop.destroy();
|
||||
_shop = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function frameIdForMsg(param1:String) : int
|
||||
{
|
||||
param1 = param1.toLowerCase();
|
||||
if(param1 == "bb" || param1 == "bb_experiments")
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if(param1 == "tt" || param1 == "tt_autoplay")
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
if(param1 == "biggerframe")
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
if(param1 == "cami")
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static function onMovieSelectorClose() : void
|
||||
{
|
||||
if(movieSelector)
|
||||
{
|
||||
movieSelector.toggleVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
private static function launchStore(param1:int, param2:int) : void
|
||||
{
|
||||
if(_shop)
|
||||
{
|
||||
_shop.destroy();
|
||||
}
|
||||
if((param2 == 1000 || param1 == 168 || param1 == 415) && param1 != 338)
|
||||
{
|
||||
_shop = new ShopWithPreview();
|
||||
_shop.init(param1,param2,AvatarManager.playerAvatar,GuiManager.guiLayer,onShopClose);
|
||||
}
|
||||
else
|
||||
{
|
||||
_shop = new Shop();
|
||||
_shop.init(param1,param2,AvatarManager.playerAvatar,GuiManager.guiLayer,onShopClose);
|
||||
}
|
||||
}
|
||||
|
||||
private static function onShopClose(param1:Boolean) : void
|
||||
{
|
||||
if(_shop)
|
||||
{
|
||||
_shop.destroy();
|
||||
_shop = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function init() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,913 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
import avatar.UserInfo;
|
||||
import collection.AccItemCollection;
|
||||
import collection.DenItemCollection;
|
||||
import collection.DenRoomItemCollection;
|
||||
import com.sbi.analytics.SBTracker;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import com.sbi.popup.SBYesNoPopup;
|
||||
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 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 POPUP_TYPE_ADVENTURES_BITTERSWEETS:int = 17;
|
||||
|
||||
public static const POPUP_TYPE_ADVENTURES_LUCKY2:int = 18;
|
||||
|
||||
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 == 4)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(param1 == 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if(param1 == 3)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if(param1 == 5)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
if(param1 == 6)
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
if(param1 == 99)
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
if(param1 == 8)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
if(param1 == 9)
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
if(param1 == 10)
|
||||
{
|
||||
return 9;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static function buttonsTypeForECardType(param1:int) : int
|
||||
{
|
||||
if(param1 == 8)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
if(param1 == 4 || param1 == 6 || param1 == 9 || param1 == 10)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
_guiLayer = param1;
|
||||
_icon = param2;
|
||||
_name = param3;
|
||||
_enviroType = param12;
|
||||
_denyForNonMem = param10;
|
||||
_buttonsType = param11;
|
||||
_onCloseMsg = param13;
|
||||
_giftDefIdOrAmount = param4 == 0 ? param3 : String(param4);
|
||||
translateNonItemNameForTracking();
|
||||
_popupType = param5;
|
||||
_giftType = param6;
|
||||
_keepCallback = param7;
|
||||
_rejectCallback = param8;
|
||||
_closeCallback = param9;
|
||||
_msgText = param14;
|
||||
_giftDataArray = param15;
|
||||
_isFromStartup = param16;
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(1084,onMediaItemLoaded,_name);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
_popupContent.removeEventListener("mouseDown",onGiftPopup);
|
||||
if(_popupContent.buttons.keepBtn.visible)
|
||||
{
|
||||
_guiLayer.stage.removeEventListener("keyDown",keepKeyDown);
|
||||
_popupContent.buttons.keepBtn.removeEventListener("mouseDown",keepBtnDownHandler);
|
||||
_guiLayer.stage.removeEventListener("keyDown",rejectKeyDown);
|
||||
_popupContent.buttons.discardBtn.removeEventListener("mouseDown",rejectBtnDownHandler);
|
||||
}
|
||||
if(_popupContent.buttons.okBtn.visible)
|
||||
{
|
||||
_guiLayer.stage.removeEventListener("keyDown",rejectFromOkKeyDown);
|
||||
_popupContent.buttons.okBtn.removeEventListener("mouseDown",rejectFromOkButtonDownHandler);
|
||||
}
|
||||
if(_popupContent.bx.visible)
|
||||
{
|
||||
_popupContent.bx.removeEventListener("mouseDown",onXBtnDown);
|
||||
}
|
||||
_guiLayer.removeChild(_popupContent);
|
||||
DarkenManager.unDarken(_popupContent);
|
||||
_popupContent = null;
|
||||
_guiLayer = null;
|
||||
_icon = null;
|
||||
_keepCallback = null;
|
||||
_rejectCallback = null;
|
||||
_closeCallback = null;
|
||||
}
|
||||
|
||||
public function close() : void
|
||||
{
|
||||
if(_onCloseMsg)
|
||||
{
|
||||
_closeMsgOkPopup = new SBOkPopup(_guiLayer,_onCloseMsg,true,onCloseMsgOkBtnDown);
|
||||
_onCloseMsg = null;
|
||||
return;
|
||||
}
|
||||
SBTracker.pop();
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaItemLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var _loc2_:String = null;
|
||||
if(param1)
|
||||
{
|
||||
_loc2_ = _enviroType == 1 ? "_Ocean" : "";
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("game/play/popup/gift/" + popupTypeToString(_popupType) + "/#" + _giftDefIdOrAmount,-1,1);
|
||||
_popupContent = MovieClip(param1.getChildAt(0));
|
||||
_popupContent.itemLayer.addChild(_icon);
|
||||
LocalizationManager.updateToFit(_popupContent.buttons.giftNameTxt,param1.passback);
|
||||
_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("potOgoldPopUp",param1.loaderInfo.applicationDomain.getDefinition("potOgoldPopUp") as Class,0.6);
|
||||
AJAudio.loadSfx("TreasureGoldenEgg",param1.loaderInfo.applicationDomain.getDefinition("TreasureGoldenEgg") as Class,0.68);
|
||||
AJAudio.hasLoadedGiftUnwrapSfx = true;
|
||||
}
|
||||
_guiLayer.addChild(_popupContent);
|
||||
if(_popupType == 1)
|
||||
{
|
||||
_popupContent.buttons.treasureNameTxt.visible = false;
|
||||
_popupContent.buttons.treasureTxtBox.visible = false;
|
||||
if(_name.indexOf("Diamond") != -1)
|
||||
{
|
||||
LocalizationManager.translateId(_popupContent.mailboxTitleTxt,23913);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalizationManager.translateId(_popupContent.mailboxTitleTxt,11281);
|
||||
}
|
||||
_popupContent.present.addEventListener("mouseDown",onPresentDownHandler,false,0,true);
|
||||
_popupContent.buttons.visible = false;
|
||||
}
|
||||
else if(_popupType == 6)
|
||||
{
|
||||
_popupContent.buttons.treasureNameTxt.visible = false;
|
||||
_popupContent.buttons.treasureTxtBox.visible = false;
|
||||
_popupContent.present.addEventListener("mouseDown",onPresentDownHandler,false,0,true);
|
||||
if(!_isFromStartup)
|
||||
{
|
||||
_popupContent.bx.visible = true;
|
||||
_popupContent.bx.addEventListener("mouseDown",onXBtnDown,false,0,true);
|
||||
}
|
||||
_popupContent.gotoAndPlay("offMessage");
|
||||
if(_msgText)
|
||||
{
|
||||
_popupContent.messageTxt.text = _msgText;
|
||||
}
|
||||
_popupContent.buttons.visible = false;
|
||||
}
|
||||
else if(isPopUpTypeTreasure())
|
||||
{
|
||||
_popupContent.buttons.giftNameTxt.visible = false;
|
||||
_popupContent.buttons.giftTxtBox.visible = false;
|
||||
_popupContent.buttons.treasureNameTxt.text = param1.passback;
|
||||
_popupContent.gotoAndStop("offTreasureMessage" + _loc2_ + popUpColor());
|
||||
_popupContent.present.addEventListener("mouseDown",onPresentDownHandler,false,0,true);
|
||||
_popupContent.bx.addEventListener("mouseDown",onXBtnDown,false,0,true);
|
||||
_popupContent.buttons.visible = false;
|
||||
}
|
||||
else if(_popupType == 8)
|
||||
{
|
||||
_popupContent.buttons.giftNameTxt.visible = false;
|
||||
_popupContent.buttons.giftTxtBox.visible = false;
|
||||
_popupContent.buttons.treasureNameTxt.text = param1.passback;
|
||||
_popupContent.gotoAndPlay("onChooseTreasure" + _loc2_);
|
||||
AJAudio.playTreasureUnwrap();
|
||||
}
|
||||
else if(_popupType == 14)
|
||||
{
|
||||
_popupContent.buttons.giftNameTxt.visible = false;
|
||||
_popupContent.buttons.giftTxtBox.visible = false;
|
||||
_popupContent.buttons.treasureNameTxt.text = param1.passback;
|
||||
_popupContent.gotoAndPlay("onChooseTreasure" + _loc2_);
|
||||
AJAudio.playTreasureUnwrap();
|
||||
}
|
||||
else if(_popupType == 15)
|
||||
{
|
||||
_popupContent.buttons.giftNameTxt.visible = false;
|
||||
_popupContent.buttons.giftTxtBox.visible = false;
|
||||
_popupContent.buttons.treasureNameTxt.text = param1.passback;
|
||||
_popupContent.gotoAndPlay("onTreasureLucky" + _loc2_);
|
||||
AJAudio.playTreasureLuckyUnwrap();
|
||||
}
|
||||
else if(_popupType == 18)
|
||||
{
|
||||
_popupContent.buttons.giftNameTxt.visible = false;
|
||||
_popupContent.buttons.giftTxtBox.visible = false;
|
||||
_popupContent.buttons.treasureNameTxt.text = param1.passback;
|
||||
_popupContent.gotoAndPlay("onTreasurePotOfGold" + _loc2_);
|
||||
AJAudio.playTreasureLucky2Unwrap();
|
||||
}
|
||||
else if(_popupType == 16)
|
||||
{
|
||||
_popupContent.buttons.giftNameTxt.visible = false;
|
||||
_popupContent.buttons.giftTxtBox.visible = false;
|
||||
_popupContent.buttons.treasureNameTxt.text = param1.passback;
|
||||
_popupContent.gotoAndPlay("onTreasureGoldEgg" + _loc2_);
|
||||
AJAudio.playTreasureEggUnwrap();
|
||||
}
|
||||
else if(_popupType == 17)
|
||||
{
|
||||
_popupContent.buttons.giftNameTxt.visible = false;
|
||||
_popupContent.buttons.giftTxtBox.visible = false;
|
||||
_popupContent.buttons.treasureNameTxt.text = param1.passback;
|
||||
_popupContent.gotoAndPlay("onTreasurePhantom" + _loc2_);
|
||||
AJAudio.playTreasureUnwrap();
|
||||
}
|
||||
else
|
||||
{
|
||||
_popupContent.buttons.treasureNameTxt.visible = false;
|
||||
_popupContent.buttons.treasureTxtBox.visible = false;
|
||||
if(_popupType == 0 || _popupType == 3 || _popupType == 5)
|
||||
{
|
||||
if(_popupType == 5)
|
||||
{
|
||||
LocalizationManager.translateId(_popupContent.mailboxTitleTxt,11282);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalizationManager.translateId(_popupContent.mailboxTitleTxt,11283);
|
||||
}
|
||||
_popupContent.bx.visible = true;
|
||||
_popupContent.bx.addEventListener("mouseDown",onXBtnDown,false,0,true);
|
||||
}
|
||||
else if(_popupType == 4)
|
||||
{
|
||||
LocalizationManager.translateId(_popupContent.mailboxTitleTxt,11283);
|
||||
}
|
||||
else if(_popupType == 2)
|
||||
{
|
||||
LocalizationManager.translateId(_popupContent.mailboxTitleTxt,11282);
|
||||
}
|
||||
_popupContent.gotoAndStop("lastFrame");
|
||||
AJAudio.playGiftUnwrap();
|
||||
}
|
||||
_popupContent.addEventListener("mouseDown",onGiftPopup,false,0,true);
|
||||
if(_buttonsType == 0)
|
||||
{
|
||||
_guiLayer.stage.addEventListener("keyDown",keepKeyDown,false,0,true);
|
||||
_popupContent.buttons.keepBtn.addEventListener("mouseDown",keepBtnDownHandler,false,0,true);
|
||||
_guiLayer.stage.addEventListener("keyDown",rejectKeyDown,false,0,true);
|
||||
_popupContent.buttons.discardBtn.addEventListener("mouseDown",rejectBtnDownHandler,false,0,true);
|
||||
_popupContent.buttons.okBtn.visible = false;
|
||||
_popupContent.buttons.createBtn.visible = false;
|
||||
if(_popupContent.buttons.takeBtn)
|
||||
{
|
||||
_popupContent.buttons.takeBtn.visible = false;
|
||||
}
|
||||
if(_popupContent.buttons.leaveBtn)
|
||||
{
|
||||
_popupContent.buttons.leaveBtn.visible = false;
|
||||
}
|
||||
}
|
||||
else if(_buttonsType == 1)
|
||||
{
|
||||
_guiLayer.stage.addEventListener("keyDown",rejectFromOkKeyDown,false,0,true);
|
||||
_popupContent.buttons.okBtn.addEventListener("mouseDown",rejectFromOkButtonDownHandler,false,0,true);
|
||||
_popupContent.buttons.keepBtn.visible = false;
|
||||
_popupContent.buttons.discardBtn.visible = false;
|
||||
_popupContent.buttons.createBtn.visible = false;
|
||||
if(_popupContent.buttons.takeBtn)
|
||||
{
|
||||
_popupContent.buttons.takeBtn.visible = false;
|
||||
}
|
||||
if(_popupContent.buttons.leaveBtn)
|
||||
{
|
||||
_popupContent.buttons.leaveBtn.visible = false;
|
||||
}
|
||||
}
|
||||
else if(_buttonsType == 2)
|
||||
{
|
||||
_popupContent.buttons.createBtn.addEventListener("mouseDown",onCreateButton,false,0,true);
|
||||
_popupContent.buttons.createBtn.visible = true;
|
||||
_popupContent.buttons.keepBtn.visible = false;
|
||||
_popupContent.buttons.discardBtn.visible = false;
|
||||
_popupContent.buttons.okBtn.visible = false;
|
||||
if(_popupContent.buttons.takeBtn)
|
||||
{
|
||||
_popupContent.buttons.takeBtn.visible = false;
|
||||
}
|
||||
if(_popupContent.buttons.leaveBtn)
|
||||
{
|
||||
_popupContent.buttons.leaveBtn.visible = false;
|
||||
}
|
||||
}
|
||||
else if(_buttonsType == 3)
|
||||
{
|
||||
_guiLayer.stage.addEventListener("keyDown",keepKeyDown,false,0,true);
|
||||
_popupContent.buttons.takeBtn.addEventListener("mouseDown",keepBtnDownHandler,false,0,true);
|
||||
_guiLayer.stage.addEventListener("keyDown",rejectKeyDown,false,0,true);
|
||||
_popupContent.buttons.leaveBtn.addEventListener("mouseDown",rejectBtnDownHandler,false,0,true);
|
||||
_popupContent.buttons.okBtn.visible = false;
|
||||
_popupContent.buttons.createBtn.visible = false;
|
||||
_popupContent.buttons.keepBtn.visible = false;
|
||||
_popupContent.buttons.discardBtn.visible = false;
|
||||
}
|
||||
_popupContent.x = 900 * 0.5;
|
||||
_popupContent.y = 550 * 0.5;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
DarkenManager.darken(_popupContent);
|
||||
}
|
||||
}
|
||||
|
||||
private function keepKeyDown(param1:KeyboardEvent) : void
|
||||
{
|
||||
if(_popupActive == false)
|
||||
{
|
||||
switch(param1.keyCode)
|
||||
{
|
||||
case 13:
|
||||
case 32:
|
||||
if(_popupContent && _popupContent.buttons && !_popupContent.buttons.visible)
|
||||
{
|
||||
handlePresentDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
keepBtnDownHandler(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function rejectKeyDown(param1:KeyboardEvent) : void
|
||||
{
|
||||
if(_popupActive == false)
|
||||
{
|
||||
switch(param1.keyCode)
|
||||
{
|
||||
case 8:
|
||||
case 46:
|
||||
case 27:
|
||||
rejectBtnDownHandler(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function rejectFromOkKeyDown(param1:KeyboardEvent) : void
|
||||
{
|
||||
if(_popupActive == false)
|
||||
{
|
||||
switch(param1.keyCode)
|
||||
{
|
||||
case 32:
|
||||
case 8:
|
||||
case 46:
|
||||
case 27:
|
||||
if(_popupContent && _popupContent.buttons && !_popupContent.buttons.visible)
|
||||
{
|
||||
handlePresentDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
rejectFromOkButtonDownHandler(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onGiftPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onXBtnDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
close();
|
||||
}
|
||||
|
||||
private function isPopUpTypeTreasure() : Boolean
|
||||
{
|
||||
return _popupType == 7 || _popupType == 10 || _popupType == 9 || _popupType == 11 || _popupType == 12 || _popupType == 13;
|
||||
}
|
||||
|
||||
private function popUpColor() : String
|
||||
{
|
||||
switch(_popupType - 9)
|
||||
{
|
||||
case 0:
|
||||
return "Red";
|
||||
case 1:
|
||||
return "Blue";
|
||||
case 2:
|
||||
return "Orange";
|
||||
case 3:
|
||||
return "Green";
|
||||
case 4:
|
||||
return "Bag";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private function handlePresentDown() : void
|
||||
{
|
||||
var _loc1_:String = _enviroType == 1 ? "_Ocean" : "";
|
||||
_popupContent.buttons.visible = true;
|
||||
_popupContent.present.removeEventListener("mouseDown",onPresentDownHandler);
|
||||
_popupContent.gotoAndPlay(_popupType == 6 ? "onMessage" : (isPopUpTypeTreasure() ? "onTreasureMessage" + _loc1_ + popUpColor() : "on"));
|
||||
if(isPopUpTypeTreasure())
|
||||
{
|
||||
if(_popupType == 13)
|
||||
{
|
||||
AJAudio.playTreasureBagUnwrap();
|
||||
}
|
||||
else
|
||||
{
|
||||
AJAudio.playTreasureUnwrap();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AJAudio.playGiftUnwrap();
|
||||
}
|
||||
}
|
||||
|
||||
private function onPresentDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
handlePresentDown();
|
||||
}
|
||||
|
||||
private function keepBtnDownHandler(param1:Event) : void
|
||||
{
|
||||
var _loc8_:int = 0;
|
||||
var _loc10_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc2_:AccItemCollection = null;
|
||||
var _loc9_:AccItemCollection = null;
|
||||
var _loc6_:DenItemCollection = null;
|
||||
var _loc3_:UserInfo = null;
|
||||
var _loc4_:DenItemCollection = null;
|
||||
var _loc11_:DenRoomItemCollection = null;
|
||||
var _loc7_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(_denyForNonMem && !gMainFrame.userInfo.isMember)
|
||||
{
|
||||
UpsellManager.displayPopup("jamagram","Receiving_Gift");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_giftType == 1)
|
||||
{
|
||||
if(gMainFrame.userInfo.playerAvatarInfo)
|
||||
{
|
||||
_loc2_ = gMainFrame.userInfo.playerAvatarInfo.getFullItems();
|
||||
}
|
||||
if(_enviroType == 0)
|
||||
{
|
||||
if(_loc2_.length > 0)
|
||||
{
|
||||
_loc9_ = Utility.clothingItemListByEnviroType(_loc2_,0);
|
||||
}
|
||||
_loc5_ = 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_loc2_.length > 0)
|
||||
{
|
||||
_loc9_ = Utility.clothingItemListByEnviroType(_loc2_,1);
|
||||
}
|
||||
_loc5_ = 5;
|
||||
}
|
||||
if(_loc9_)
|
||||
{
|
||||
_loc8_ = int(_loc9_.length);
|
||||
}
|
||||
_loc10_ = Shop.maxItems;
|
||||
}
|
||||
else if(_giftType == 2)
|
||||
{
|
||||
if(_enviroType == 0)
|
||||
{
|
||||
if(gMainFrame.userInfo.playerUserInfo)
|
||||
{
|
||||
_loc3_ = gMainFrame.userInfo.playerUserInfo;
|
||||
if(_loc3_.denItemsFull.length > 0)
|
||||
{
|
||||
_loc6_ = Utility.denItemListByEnviroType(_loc3_.denItemsFull,0);
|
||||
}
|
||||
}
|
||||
_loc5_ = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(gMainFrame.userInfo.playerUserInfo && gMainFrame.userInfo.playerUserInfo.denItemsFull.length > 0)
|
||||
{
|
||||
_loc6_ = Utility.denItemListByEnviroType(gMainFrame.userInfo.playerUserInfo.denItemsFull,1);
|
||||
}
|
||||
_loc5_ = 3;
|
||||
}
|
||||
if(_loc6_)
|
||||
{
|
||||
_loc8_ = int(_loc6_.length);
|
||||
}
|
||||
_loc10_ = Shop.maxDenItems;
|
||||
}
|
||||
else if(_giftType == 5)
|
||||
{
|
||||
if(gMainFrame.userInfo.playerUserInfo && gMainFrame.userInfo.playerUserInfo.denItemsFull.length > 0)
|
||||
{
|
||||
_loc4_ = Utility.denItemListByEnviroType(gMainFrame.userInfo.playerUserInfo.denItemsFull,-1,true);
|
||||
}
|
||||
_loc5_ = 2;
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc8_ = int(_loc4_.length);
|
||||
}
|
||||
_loc10_ = Shop.maxAudioItems;
|
||||
}
|
||||
else if(_giftType == 3)
|
||||
{
|
||||
_loc11_ = DenSwitch.denList;
|
||||
_loc5_ = 99;
|
||||
if(_loc11_)
|
||||
{
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc11_.length)
|
||||
{
|
||||
if(_loc11_.getDenRoomItem(_loc7_))
|
||||
{
|
||||
_loc8_++;
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
}
|
||||
_loc10_ = 28;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_popupType == 8 || _popupType == 14 || _popupType == 15 || _popupType == 18 || _popupType == 16 || _popupType == 17)
|
||||
{
|
||||
if(_giftType == 0 || _giftType == 7)
|
||||
{
|
||||
keepItem();
|
||||
return;
|
||||
}
|
||||
}
|
||||
trace("Invalid type for GiftPopup keep button. type=" + _giftType);
|
||||
}
|
||||
if(Utility.canGift() || _popupType != 0)
|
||||
{
|
||||
if(_loc8_ >= _loc10_)
|
||||
{
|
||||
_popupActive = true;
|
||||
new SBYesNoPopup(_guiLayer,LocalizationManager.translateIdOnly(14746),true,confirmRecycleHandler,_loc5_);
|
||||
}
|
||||
else
|
||||
{
|
||||
keepItem();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_popupActive = true;
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(14747),true,okPopupComplete);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function okPopupComplete(param1:MouseEvent) : void
|
||||
{
|
||||
_popupActive = false;
|
||||
SBOkPopup.destroyInParentChain(param1.target.parent);
|
||||
}
|
||||
|
||||
private function rejectFromOkButtonDownHandler(param1:Event) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
SBTracker.trackPageview("game/play/popup/gift/" + popupTypeToString(_popupType) + "/#" + _giftDefIdOrAmount + "/ok",-1,1);
|
||||
if(_rejectCallback != null)
|
||||
{
|
||||
_rejectCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
private function rejectBtnDownHandler(param1:Event) : void
|
||||
{
|
||||
var _loc2_:String = null;
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(!isPopUpTypeTreasure())
|
||||
{
|
||||
if(_popupType == 1)
|
||||
{
|
||||
_loc2_ = LocalizationManager.translateIdAndInsertOnly(14748,_popupContent.mailboxTitleTxt.text.toLowerCase());
|
||||
}
|
||||
else if(_popupType == 6)
|
||||
{
|
||||
_loc2_ = LocalizationManager.translateIdOnly(14749);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = LocalizationManager.translateIdAndInsertOnly(14750,_popupContent.mailboxTitleTxt.text.toLowerCase());
|
||||
}
|
||||
_popupActive = true;
|
||||
new SBYesNoPopup(_guiLayer,_loc2_,true,onConfirmReject);
|
||||
}
|
||||
else
|
||||
{
|
||||
_popupActive = true;
|
||||
new SBYesNoPopup(_guiLayer,LocalizationManager.translateIdOnly(14919),true,onConfirmReject);
|
||||
}
|
||||
}
|
||||
|
||||
private function onCreateButton(param1:MouseEvent) : void
|
||||
{
|
||||
PetManager.openPetFinder(_name.toLowerCase().replace(/[\s\r\n]*/gim,""),onPetCreated,true,_giftDataArray);
|
||||
}
|
||||
|
||||
private function onPetCreated() : void
|
||||
{
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
}
|
||||
}
|
||||
|
||||
private function onConfirmReject(param1:Object) : void
|
||||
{
|
||||
if(param1.status)
|
||||
{
|
||||
SBTracker.trackPageview("game/play/popup/gift/" + popupTypeToString(_popupType) + "/#" + _giftDefIdOrAmount + "/reject",-1,1);
|
||||
if(_rejectCallback != null)
|
||||
{
|
||||
_rejectCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
_popupActive = false;
|
||||
}
|
||||
|
||||
private function keepItem() : void
|
||||
{
|
||||
SBTracker.trackPageview("game/play/popup/gift/" + popupTypeToString(_popupType) + "/#" + _giftDefIdOrAmount + "/keep",-1,1);
|
||||
if(_keepCallback != null)
|
||||
{
|
||||
_keepCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
private function onCloseMsgOkBtnDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_closeMsgOkPopup.destroy();
|
||||
_closeMsgOkPopup = null;
|
||||
close();
|
||||
}
|
||||
|
||||
private function confirmRecycleHandler(param1:Object) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(param1.status)
|
||||
{
|
||||
_loc2_ = int(param1.passback);
|
||||
if(_loc2_ == 99)
|
||||
{
|
||||
GuiManager.openDenRoomSwitcher(true,onDenRoomRecycleClose);
|
||||
}
|
||||
else
|
||||
{
|
||||
_recyclePopup = new RecycleItems();
|
||||
_recyclePopup.init(_loc2_,_guiLayer,true,onRecycleClose,900 * 0.5,550 * 0.5,_enviroType == AvatarManager.roomEnviroType);
|
||||
}
|
||||
}
|
||||
_popupActive = false;
|
||||
}
|
||||
|
||||
private function onRecycleClose(param1:Boolean = false) : void
|
||||
{
|
||||
if(_recyclePopup)
|
||||
{
|
||||
_recyclePopup.destroy();
|
||||
_recyclePopup = null;
|
||||
}
|
||||
if(param1)
|
||||
{
|
||||
keepItem();
|
||||
}
|
||||
}
|
||||
|
||||
private function onDenRoomRecycleClose(param1:Boolean = false) : void
|
||||
{
|
||||
GuiManager.onDenSwitchClose(true);
|
||||
if(param1)
|
||||
{
|
||||
keepItem();
|
||||
}
|
||||
}
|
||||
|
||||
private function popupTypeToString(param1:int) : String
|
||||
{
|
||||
switch(param1)
|
||||
{
|
||||
case 0:
|
||||
return "JAG";
|
||||
case 1:
|
||||
return "Promo";
|
||||
case 2:
|
||||
return "Prize";
|
||||
case 3:
|
||||
return "JB";
|
||||
case 5:
|
||||
return "TouchPool";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private function translateNonItemNameForTracking() : void
|
||||
{
|
||||
if(_giftType == 0)
|
||||
{
|
||||
_giftDefIdOrAmount += " gems";
|
||||
}
|
||||
else if(_giftType == 7)
|
||||
{
|
||||
_giftDefIdOrAmount += " crystals";
|
||||
}
|
||||
else if(_giftType == 8)
|
||||
{
|
||||
_giftDefIdOrAmount += " diamonds";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,164 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.KeyboardEvent;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.filters.GlowFilter;
|
||||
import flash.text.TextField;
|
||||
|
||||
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();
|
||||
_currCheckBox = param1;
|
||||
_checkCallback = param2;
|
||||
}
|
||||
|
||||
public function init(param1:TextField = null) : void
|
||||
{
|
||||
chkTxt = param1;
|
||||
box = _currCheckBox["_box"];
|
||||
check = box["_check"];
|
||||
grayBox = _currCheckBox["_boxGray"];
|
||||
if(grayBox)
|
||||
{
|
||||
grayBox.visible = false;
|
||||
}
|
||||
if(!(box && check))
|
||||
{
|
||||
throw new Error("GuiCheckBox is missing parts or they are named incorrectly!");
|
||||
}
|
||||
box.stop();
|
||||
check.stop();
|
||||
_currCheckBox.tabEnabled = true;
|
||||
_glow = new GlowFilter(5562619,1,6,6,2,2);
|
||||
_currCheckBox.addEventListener("keyDown",checkBoxKeyDownHandler,false,0,true);
|
||||
_currCheckBox.addEventListener("mouseDown",checkBoxClickHandler,false,0,true);
|
||||
_currCheckBox.addEventListener("rollOver",onRollOver,false,0,true);
|
||||
_currCheckBox.addEventListener("rollOut",onRollOut,false,0,true);
|
||||
if(chkTxt != null)
|
||||
{
|
||||
chkTxt.addEventListener("mouseDown",checkBoxClickHandler,false,0,true);
|
||||
chkTxt.addEventListener("rollOver",onRollOver,false,0,true);
|
||||
chkTxt.addEventListener("rollOut",onRollOut,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
_currCheckBox.removeEventListener("keyDown",checkBoxKeyDownHandler);
|
||||
_currCheckBox.removeEventListener("mouseDown",checkBoxClickHandler);
|
||||
_currCheckBox.removeEventListener("rollOver",onRollOver);
|
||||
_currCheckBox.removeEventListener("rollOut",onRollOut);
|
||||
if(chkTxt != null)
|
||||
{
|
||||
chkTxt.removeEventListener("mouseDown",checkBoxClickHandler);
|
||||
chkTxt.removeEventListener("rollOver",onRollOver);
|
||||
chkTxt.removeEventListener("rollOut",onRollOut);
|
||||
}
|
||||
_currCheckBox = null;
|
||||
_checkCallback = null;
|
||||
}
|
||||
|
||||
public function get currCheckBox() : MovieClip
|
||||
{
|
||||
return _currCheckBox;
|
||||
}
|
||||
|
||||
public function get gray() : Boolean
|
||||
{
|
||||
if(grayBox)
|
||||
{
|
||||
return grayBox.visible;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function set gray(param1:Boolean) : void
|
||||
{
|
||||
if(grayBox)
|
||||
{
|
||||
grayBox.visible = param1;
|
||||
box.visible = !param1;
|
||||
}
|
||||
}
|
||||
|
||||
public function get checked() : Boolean
|
||||
{
|
||||
return check.visible;
|
||||
}
|
||||
|
||||
public function set checked(param1:Boolean) : void
|
||||
{
|
||||
check.visible = param1;
|
||||
}
|
||||
|
||||
private function checkBoxKeyDownHandler(param1:KeyboardEvent) : void
|
||||
{
|
||||
if(!gray)
|
||||
{
|
||||
if(param1.keyCode == 32)
|
||||
{
|
||||
checked = !checked;
|
||||
}
|
||||
if(_checkCallback != null)
|
||||
{
|
||||
_checkCallback(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function checkBoxClickHandler(param1:MouseEvent) : void
|
||||
{
|
||||
if(!gray)
|
||||
{
|
||||
checked = !checked;
|
||||
if(_checkCallback != null)
|
||||
{
|
||||
_checkCallback(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onRollOver(param1:MouseEvent) : void
|
||||
{
|
||||
if(!gray)
|
||||
{
|
||||
box.filters = [_glow];
|
||||
if(chkTxt)
|
||||
{
|
||||
chkTxt.filters = [_glow];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onRollOut(param1:MouseEvent) : void
|
||||
{
|
||||
if(!gray)
|
||||
{
|
||||
box.filters = null;
|
||||
if(chkTxt)
|
||||
{
|
||||
chkTxt.filters = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
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;
|
||||
|
||||
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_:int = 0;
|
||||
var _loc2_:DisplayObject = null;
|
||||
super();
|
||||
currDropDown = param1;
|
||||
dropdownTxt = currDropDown.dropdown_txt;
|
||||
dropdownBtn = currDropDown.dropdown_btn;
|
||||
dropdown = currDropDown._dropdown;
|
||||
scrollContent = dropdown.scroll_content;
|
||||
highlight = scrollContent.dropdown_h;
|
||||
mouseHighlight = scrollContent.mouse;
|
||||
scrollView = dropdown.scroll_view;
|
||||
scrollItems = [];
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < scrollContent.numChildren)
|
||||
{
|
||||
_loc2_ = scrollContent.getChildAt(_loc3_);
|
||||
if(_loc2_.name.indexOf("_item") == 0)
|
||||
{
|
||||
_loc2_.addEventListener("mouseDown",itemMouseDownHandler,false,0,true);
|
||||
if(mouseHighlight)
|
||||
{
|
||||
_loc2_.addEventListener("mouseOver",itemMouseOverHandler,false,0,true);
|
||||
_loc2_.addEventListener("mouseOut",itemMouseOutHandler,false,0,true);
|
||||
}
|
||||
scrollItems[int(_loc2_.name.substr(5)) - 1] = _loc2_;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
public function init(param1:Number, param2:int = 0, param3:String = null) : void
|
||||
{
|
||||
dropdown.visible = false;
|
||||
if(scrollContent.height > scrollView.height)
|
||||
{
|
||||
scrollbar = new SBScrollbar();
|
||||
scrollbar.init(scrollContent,scrollView.width,scrollView.height,param1,"scrollbar2",scrollContent["_item2"].y - scrollContent["_item1"].y);
|
||||
}
|
||||
if(param3)
|
||||
{
|
||||
this.selectedIdx = -1;
|
||||
dropdownTxt.text = param3;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.selectedIdx = selectedIdx;
|
||||
selectedTxt = scrollItems[param2];
|
||||
dropdownTxt.text = selectedTxt.text;
|
||||
}
|
||||
if(param2 > 0)
|
||||
{
|
||||
if(scrollbar)
|
||||
{
|
||||
scrollbar.scrollToElement(param2 - (param2 >= 2 ? 2 : 0));
|
||||
}
|
||||
selectedIdx = param2;
|
||||
selectedTxt = scrollItems[param2];
|
||||
highlight.visible = true;
|
||||
highlight.y = selectedTxt.y + highlight.height * 0.5;
|
||||
}
|
||||
mouseHighlight.visible = false;
|
||||
scrollView.visible = false;
|
||||
dropdownBtn.addEventListener("mouseDown",dropdownBtnMouseDownHandler,false,0,true);
|
||||
currDropDown.addEventListener("keyDown",keyDownHandler,false,0,true);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc1_:DisplayObject = null;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < scrollContent.numChildren)
|
||||
{
|
||||
_loc1_ = scrollContent.getChildAt(_loc2_);
|
||||
if(_loc1_.name.indexOf("_item") == 0)
|
||||
{
|
||||
_loc1_.removeEventListener("mouseDown",itemMouseDownHandler);
|
||||
if(mouseHighlight)
|
||||
{
|
||||
_loc1_.removeEventListener("mouseOver",itemMouseOverHandler);
|
||||
_loc1_.removeEventListener("mouseOut",itemMouseOutHandler);
|
||||
}
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
scrollItems = null;
|
||||
if(scrollbar)
|
||||
{
|
||||
scrollbar.destroy();
|
||||
scrollbar = null;
|
||||
}
|
||||
dropdownBtn.removeEventListener("mouseDown",dropdownBtnMouseDownHandler);
|
||||
currDropDown.removeEventListener("keyDown",keyDownHandler);
|
||||
}
|
||||
|
||||
public function reset(param1:int = 0, param2:String = null) : void
|
||||
{
|
||||
if(scrollbar)
|
||||
{
|
||||
scrollbar.scrollToElement(param1);
|
||||
}
|
||||
if(param1)
|
||||
{
|
||||
if(scrollbar)
|
||||
{
|
||||
scrollbar.scrollToElement(param1);
|
||||
}
|
||||
selectedIdx = param1;
|
||||
selectedTxt = scrollItems[param1];
|
||||
highlight.visible = true;
|
||||
highlight.y = selectedTxt.y + highlight.height * 0.5;
|
||||
}
|
||||
if(param2)
|
||||
{
|
||||
this.selectedIdx = -1;
|
||||
dropdownTxt.text = param2;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.selectedIdx = selectedIdx;
|
||||
selectedTxt = scrollItems[param1];
|
||||
dropdownTxt.text = selectedTxt.text;
|
||||
}
|
||||
}
|
||||
|
||||
public function closeDropdownSilent() : void
|
||||
{
|
||||
focusOutHandler(null);
|
||||
GuiSoundToggleButton(dropdownBtn).downToUpState();
|
||||
}
|
||||
|
||||
private function keyDownHandler(param1:KeyboardEvent) : void
|
||||
{
|
||||
if(param1.keyCode == 32)
|
||||
{
|
||||
dropdownBtnMouseDownHandler(null);
|
||||
}
|
||||
}
|
||||
|
||||
private function dropdownBtnMouseDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
dropdown.visible = !dropdown.visible;
|
||||
}
|
||||
|
||||
private function focusOutHandler(param1:FocusEvent) : void
|
||||
{
|
||||
if(dropdown.visible)
|
||||
{
|
||||
dropdown.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function itemMouseOverHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
mouseHighlight.visible = true;
|
||||
mouseHighlight.y = param1.currentTarget.y + mouseHighlight.height * 0.5;
|
||||
}
|
||||
|
||||
private function itemMouseOutHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
mouseHighlight.visible = false;
|
||||
}
|
||||
|
||||
private function itemMouseDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!blockItemDown)
|
||||
{
|
||||
selectedTxt = TextField(param1.currentTarget);
|
||||
selectedIdx = int(selectedTxt.name.substr(5)) - 1;
|
||||
dropdownTxt.text = selectedTxt.text;
|
||||
highlight.visible = true;
|
||||
highlight.y = selectedTxt.y + highlight.height * 0.5;
|
||||
dropdownBtn.dispatchEvent(new MouseEvent("mouseDown"));
|
||||
dropdownBtn.dispatchEvent(new MouseEvent("rollOut"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(scrollItems && scrollItems.length > 0 && _numDaysShow != param1)
|
||||
{
|
||||
_loc2_ = scrollContent["_item2"].y - scrollContent["_item1"].y;
|
||||
_loc3_ = 0;
|
||||
_loc4_ = null;
|
||||
_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_ = "-";
|
||||
}
|
||||
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,124 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.text.TextField;
|
||||
|
||||
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();
|
||||
soundBtn = this["soundBtn"];
|
||||
txt = this["txt"];
|
||||
tl = this["tl"];
|
||||
tr = this["tr"];
|
||||
bl = this["bl"];
|
||||
bl2 = this["bl2"];
|
||||
br = this["br"];
|
||||
bubble = this["bubble"];
|
||||
if(!soundBtn)
|
||||
{
|
||||
throw new Error("GuiHelpTextBubble MAIN BUTTONS is missing part or they are named incorrectly!");
|
||||
}
|
||||
if(!(tl && tr && bl && bl2 && br && bubble))
|
||||
{
|
||||
throw new Error("GuiHelpTextBubble MAIN CONTENTS section is missing parts or they are named incorrectly!");
|
||||
}
|
||||
if(!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;
|
||||
txt.autoSize = "center";
|
||||
}
|
||||
|
||||
public function setText(param1:String) : void
|
||||
{
|
||||
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)
|
||||
{
|
||||
tl.visible = false;
|
||||
tr.visible = false;
|
||||
bl.visible = false;
|
||||
br.visible = false;
|
||||
bl2.visible = true;
|
||||
}
|
||||
else if(param1)
|
||||
{
|
||||
if(param2)
|
||||
{
|
||||
tl.visible = true;
|
||||
tr.visible = false;
|
||||
bl.visible = false;
|
||||
br.visible = false;
|
||||
bl2.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
tl.visible = false;
|
||||
tr.visible = true;
|
||||
bl.visible = false;
|
||||
br.visible = false;
|
||||
bl2.visible = false;
|
||||
}
|
||||
}
|
||||
else if(param2)
|
||||
{
|
||||
tl.visible = false;
|
||||
tr.visible = false;
|
||||
bl.visible = true;
|
||||
br.visible = false;
|
||||
bl2.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
tl.visible = false;
|
||||
tr.visible = false;
|
||||
bl.visible = false;
|
||||
br.visible = true;
|
||||
bl2.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
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 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;
|
||||
|
||||
private var append:String;
|
||||
|
||||
public function GuiHud()
|
||||
{
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
public function init(param1:Boolean = false) : void
|
||||
{
|
||||
append = currentFrameLabel == "quest" ? "Quest" : "";
|
||||
charWindow = this["char"];
|
||||
charNameTxt = this["text01_charName"];
|
||||
safeChatTreeWindow = this["safeChatTree" + append];
|
||||
actionsWindow = this["actionWindow" + append];
|
||||
emotesWindow = this["emoteWindow" + append];
|
||||
chatBar = this["hud01_chat" + append];
|
||||
sendChatBtn = chatBar != null ? chatBar.but01_send : null;
|
||||
ansChatBtn = chatBar != null ? chatBar.but01_ans : null;
|
||||
chatTxt = chatBar != null ? chatBar.text01_chat : null;
|
||||
chatHist = this["chat" + append];
|
||||
chatHistUpDownBtn = chatHist != null ? chatHist.chatHistoryBG.chatHistBox.hud01_chatHistory.chatUpDown : null;
|
||||
chatHistTxt = chatHist != null ? chatHist.chatHistoryBG["chatHistoryTxtCont" + append].text01_chatHistory : null;
|
||||
chatRepeatBtn = this["chatRepeat" + append];
|
||||
chatRepeatWindow = this["chatRepeatWindow" + append];
|
||||
swapBtn = this["swap"];
|
||||
actionsBtn = this["anim" + append];
|
||||
safeChatBtn = this["speedChat" + append];
|
||||
emotesBtn = this["emote" + append];
|
||||
denBtn = this["home"];
|
||||
worldMapBtn = this["world"];
|
||||
soundBtn = this["sound_btn" + append];
|
||||
furnBtn = this["furnBtn"];
|
||||
eCardBtn = this["mail"];
|
||||
buddyListBtn = this["buddyList"];
|
||||
newsBtn = this["news"];
|
||||
reportBtn = this["report"];
|
||||
mySettingsBtn = this["mySettings"];
|
||||
zoneName = this["zoneName"];
|
||||
zoneNameTxt = zoneName != null ? zoneName.mouse.name_txt : null;
|
||||
eCardCount = eCardBtn != null ? eCardBtn.newEcardCount : null;
|
||||
eCardCountTxt = eCardCount != null ? eCardCount.eCardCountTxt : null;
|
||||
partyBtn = this["party"];
|
||||
playerWallBtn = this["playerWall"];
|
||||
combatCardDeckBtn = this["cardDeck_btn"];
|
||||
questExitBtn = this["questingExit_btn" + append];
|
||||
questPlayersBtn = this["questPlayersBtn"];
|
||||
if(this["objBar"] != null)
|
||||
{
|
||||
questObjectiveTxt = this["objBar"].objTxt;
|
||||
}
|
||||
if(!param1)
|
||||
{
|
||||
if(!(eCardBtn && buddyListBtn && newsBtn && zoneName && mySettingsBtn && reportBtn && playerWallBtn))
|
||||
{
|
||||
throw new Error("GuiHud TOP BAR section is missing parts or they are named incorrectly!");
|
||||
}
|
||||
if(!(swapBtn && actionsBtn && safeChatBtn && emotesBtn && denBtn && worldMapBtn && soundBtn && charNameTxt && eCardCount && eCardCountTxt))
|
||||
{
|
||||
throw new Error("GuiHud MAIN BUTTONS section is missing parts or they are named incorrectly!");
|
||||
}
|
||||
if(!(actionsWindow && safeChatTreeWindow && emotesWindow && charWindow))
|
||||
{
|
||||
throw new Error("GuiHud WINDOWS section is missing parts or they are named incorrectly!");
|
||||
}
|
||||
if(!(zoneName && zoneName.mouse.mid && zoneName.mouse.left && zoneName.mouse.right))
|
||||
{
|
||||
throw new Error("GuiHud ZONE NAME section is missing parts or they are named incorrectly!");
|
||||
}
|
||||
if(!(chatBar && sendChatBtn && ansChatBtn && chatTxt))
|
||||
{
|
||||
throw new Error("GuiHud CHAT BAR section is missing parts or they are named incorrectly!");
|
||||
}
|
||||
if(!(chatHist && chatHistUpDownBtn && chatHistTxt && chatRepeatBtn && chatRepeatWindow))
|
||||
{
|
||||
throw new Error("GuiHud CHAT HISTORY 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,133 @@
|
||||
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 _loc4_:DisplayObject = null;
|
||||
var _loc2_:DisplayObject = null;
|
||||
super();
|
||||
currRadioButton = param1;
|
||||
if(currRadioButton.numChildren <= 1)
|
||||
{
|
||||
throw new Error("GuiRadioButtonGroup requires two or more radio buttons!");
|
||||
}
|
||||
radioButtons = [];
|
||||
var _loc3_:int = 0;
|
||||
while(_loc3_ < currRadioButton.numChildren)
|
||||
{
|
||||
_loc4_ = currRadioButton.getChildAt(_loc3_);
|
||||
radioButtons.push(_loc4_);
|
||||
if(_loc4_ is MovieClip)
|
||||
{
|
||||
MovieClip(_loc4_).stop();
|
||||
}
|
||||
_loc4_.addEventListener("click",checkBoxClickHandler,false,0,true);
|
||||
_loc4_.addEventListener("mouseOver",boxOverHandler,false,0,true);
|
||||
_loc4_.addEventListener("mouseOut",boxOutHandler,false,0,true);
|
||||
if(_loc4_["mouse"])
|
||||
{
|
||||
_loc4_["mouse"].visible = false;
|
||||
}
|
||||
_loc2_ = _loc4_["_circle"];
|
||||
_loc2_.visible = false;
|
||||
if(_loc2_ is MovieClip)
|
||||
{
|
||||
MovieClip(_loc2_).stop();
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc2_:DisplayObject = null;
|
||||
var _loc1_:int = 0;
|
||||
while(_loc1_ < currRadioButton.numChildren)
|
||||
{
|
||||
_loc2_ = currRadioButton.getChildAt(_loc1_);
|
||||
_loc2_.removeEventListener("click",checkBoxClickHandler);
|
||||
_loc2_.removeEventListener("mouseOver",boxOverHandler);
|
||||
_loc2_.removeEventListener("mouseOut",boxOutHandler);
|
||||
_loc1_++;
|
||||
}
|
||||
radioButtons = null;
|
||||
}
|
||||
|
||||
public function get selected() : int
|
||||
{
|
||||
return radioButtons.indexOf(_selectedRadioButton);
|
||||
}
|
||||
|
||||
public function set selected(param1:int) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = int(radioButtons.length);
|
||||
if(param1 == selected || param1 < 0 || param1 >= _loc3_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
while(_loc2_ < _loc3_)
|
||||
{
|
||||
if(_loc2_ != param1)
|
||||
{
|
||||
radioButtons[_loc2_]["_circle"].visible = false;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
setSelectedRadioButton(radioButtons[param1]);
|
||||
}
|
||||
|
||||
public function reset() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < radioButtons.length)
|
||||
{
|
||||
radioButtons[_loc1_]["_circle"].visible = false;
|
||||
_loc1_++;
|
||||
}
|
||||
_selectedRadioButton = null;
|
||||
}
|
||||
|
||||
private function setSelectedRadioButton(param1:DisplayObject) : void
|
||||
{
|
||||
_selectedRadioButton = param1;
|
||||
_selectedRadioButton["_circle"].visible = true;
|
||||
}
|
||||
|
||||
private function checkBoxClickHandler(param1:MouseEvent) : void
|
||||
{
|
||||
selected = radioButtons.indexOf(param1.currentTarget);
|
||||
param1.currentTarget.dispatchEvent(new MouseEvent("mouseDown"));
|
||||
}
|
||||
|
||||
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();
|
||||
currRadioButton = param1;
|
||||
chkTxt = param2;
|
||||
bg = currRadioButton["bg"];
|
||||
circle = currRadioButton["_circle"];
|
||||
grayBg = currRadioButton["bgGray"];
|
||||
gray = false;
|
||||
circle.visible = false;
|
||||
_glow = new GlowFilter(5562619,1,6,6,2,2);
|
||||
currRadioButton.addEventListener("mouseDown",checkBoxClickHandler,false,0,true);
|
||||
currRadioButton.addEventListener("rollOver",onRollOver,false,0,true);
|
||||
currRadioButton.addEventListener("rollOut",onRollOut,false,0,true);
|
||||
if(chkTxt)
|
||||
{
|
||||
chkTxt.addEventListener("mouseDown",checkBoxClickHandler,false,0,true);
|
||||
chkTxt.addEventListener("rollOver",onRollOver,false,0,true);
|
||||
chkTxt.addEventListener("rollOut",onRollOut,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
currRadioButton.removeEventListener("mouseDown",checkBoxClickHandler);
|
||||
currRadioButton.removeEventListener("rollOver",onRollOver);
|
||||
currRadioButton.removeEventListener("rollOut",onRollOut);
|
||||
if(chkTxt)
|
||||
{
|
||||
chkTxt.removeEventListener("mouseDown",checkBoxClickHandler);
|
||||
chkTxt.removeEventListener("rollOver",onRollOver);
|
||||
chkTxt.removeEventListener("rollOut",onRollOut);
|
||||
}
|
||||
}
|
||||
|
||||
public function get gray() : Boolean
|
||||
{
|
||||
if(grayBg)
|
||||
{
|
||||
return grayBg.visible;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function set gray(param1:Boolean) : void
|
||||
{
|
||||
if(grayBg)
|
||||
{
|
||||
grayBg.visible = param1;
|
||||
bg.visible = !param1;
|
||||
circle.visible = !param1;
|
||||
}
|
||||
}
|
||||
|
||||
public function get selected() : Boolean
|
||||
{
|
||||
return circle.visible;
|
||||
}
|
||||
|
||||
public function set selected(param1:Boolean) : void
|
||||
{
|
||||
circle.visible = param1;
|
||||
}
|
||||
|
||||
private function checkBoxClickHandler(param1:MouseEvent) : void
|
||||
{
|
||||
if(!gray)
|
||||
{
|
||||
selected = !selected;
|
||||
}
|
||||
}
|
||||
|
||||
private function onRollOver(param1:MouseEvent) : void
|
||||
{
|
||||
if(!gray)
|
||||
{
|
||||
bg.filters = [_glow];
|
||||
if(chkTxt)
|
||||
{
|
||||
chkTxt.filters = [_glow];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onRollOut(param1:MouseEvent) : void
|
||||
{
|
||||
if(!gray)
|
||||
{
|
||||
bg.filters = null;
|
||||
if(chkTxt)
|
||||
{
|
||||
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,413 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
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 loadingCont: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();
|
||||
mouse = this["mouse"];
|
||||
down = this["down"];
|
||||
gray = this["gray"];
|
||||
glowArrow = this["glowArrow"];
|
||||
glow = this["glow"];
|
||||
loadingCont = this["loadingCont"];
|
||||
if(!mouse)
|
||||
{
|
||||
throw new Error("GuiSoundButton is missing parts or they are named incorrectly!");
|
||||
}
|
||||
mouse.stop();
|
||||
mouse.visible = true;
|
||||
if(down)
|
||||
{
|
||||
down.stop();
|
||||
down.visible = false;
|
||||
}
|
||||
if(gray)
|
||||
{
|
||||
hasGrayState = true;
|
||||
gray.visible = false;
|
||||
}
|
||||
if(glowArrow)
|
||||
{
|
||||
hasGlowArrowState = true;
|
||||
glowArrow.visible = false;
|
||||
}
|
||||
if(glow)
|
||||
{
|
||||
glow.visible = false;
|
||||
}
|
||||
if(loadingCont)
|
||||
{
|
||||
loadingCont.visible = false;
|
||||
}
|
||||
mouseEnabled = false;
|
||||
addEventListener("mouseDown",btnDownHandler,false,1,true);
|
||||
addEventListener("rollOver",btnOverHandler,false,1,true);
|
||||
addEventListener("rollOut",btnOutHandler,false,1,true);
|
||||
}
|
||||
|
||||
public function initToolTip(param1:DisplayObjectContainer, param2:String, param3:int, param4:int, param5:Boolean = true) : void
|
||||
{
|
||||
if(!_toolTip)
|
||||
{
|
||||
_toolTip = GETDEFINITIONBYNAME("Tooltip");
|
||||
}
|
||||
_toolTip.init(param1,param2,this.x + param3,this.y + param4,param5);
|
||||
}
|
||||
|
||||
public function activateGrayState(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(hasGrayState && !isGray)
|
||||
{
|
||||
btnOutHandler(null);
|
||||
isGray = gray.visible = true;
|
||||
_mouseVisibleOnEnableGray = mouse.visible;
|
||||
mouse.visible = false;
|
||||
if(down)
|
||||
{
|
||||
down.visible = false;
|
||||
}
|
||||
removeEventListener("rollOver",btnOverHandler);
|
||||
removeEventListener("rollOut",btnOutHandler);
|
||||
removeEventListener("mouseDown",btnDownHandler);
|
||||
}
|
||||
}
|
||||
else if(hasGrayState && isGray)
|
||||
{
|
||||
isGray = gray.visible = false;
|
||||
if(_mouseVisibleOnEnableGray)
|
||||
{
|
||||
mouse.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse.visible = false;
|
||||
}
|
||||
if(down)
|
||||
{
|
||||
down.visible = !mouse.visible;
|
||||
}
|
||||
addEventListener("rollOver",btnOverHandler,false,1,true);
|
||||
addEventListener("rollOut",btnOutHandler,false,1,true);
|
||||
addEventListener("mouseDown",btnDownHandler,false,1,true);
|
||||
}
|
||||
}
|
||||
|
||||
public function activateGlowArrowState(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(hasGlowArrowState)
|
||||
{
|
||||
isGlowArrow = true;
|
||||
glowArrow.visible = true;
|
||||
glowArrow.mouseChildren = false;
|
||||
glowArrow.mouseEnabled = false;
|
||||
}
|
||||
}
|
||||
else if(hasGlowArrowState)
|
||||
{
|
||||
isGlowArrow = false;
|
||||
glowArrow.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function activateLoadingState(param1:Boolean, param2:MovieClip = null) : void
|
||||
{
|
||||
if(loadingCont)
|
||||
{
|
||||
if(param2)
|
||||
{
|
||||
param2.visible = !param1;
|
||||
}
|
||||
loadingCont.visible = param1;
|
||||
activateGrayState(param1);
|
||||
if(!param1)
|
||||
{
|
||||
downToUpState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function activateSpecifiedItem(param1:Boolean, param2:String, param3:String = null) : void
|
||||
{
|
||||
findAssetsAndSet(mouse,param1,param2,param3);
|
||||
if(down)
|
||||
{
|
||||
findAssetsAndSet(down,param1,param2,param3);
|
||||
}
|
||||
if(gray)
|
||||
{
|
||||
findAssetsAndSet(gray,param1,param2,param3);
|
||||
}
|
||||
}
|
||||
|
||||
private function findAssetsAndSet(param1:Object, param2:Boolean, param3:String, param4:String = null, param5:Object = null, param6:String = null, param7:int = 0) : void
|
||||
{
|
||||
if(param1 is MovieClip || param1 is Sprite)
|
||||
{
|
||||
if(param3 in param1)
|
||||
{
|
||||
if(param4)
|
||||
{
|
||||
param1[param3].gotoAndStop(param4);
|
||||
}
|
||||
param1[param3].visible = param2;
|
||||
if(param5)
|
||||
{
|
||||
while(param1[param3].numChildren > 2)
|
||||
{
|
||||
param1[param3].removeChildAt(param1[param3].numChildren - 1);
|
||||
}
|
||||
param1[param3].addChild(param5.clone().icon);
|
||||
}
|
||||
if(param6)
|
||||
{
|
||||
param1[param3].text = param6;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(param1.numChildren > param7)
|
||||
{
|
||||
findAssetsAndSet(param1.getChildAt(param7),param2,param3,param4,param5,param6);
|
||||
param7++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function insertIitem(param1:Object, param2:String) : void
|
||||
{
|
||||
findAssetsAndSet(mouse,true,param2,null,null);
|
||||
if(down)
|
||||
{
|
||||
findAssetsAndSet(down,true,param2,null,null);
|
||||
}
|
||||
if(gray)
|
||||
{
|
||||
findAssetsAndSet(gray,true,param2,null,null);
|
||||
}
|
||||
}
|
||||
|
||||
public function setTextInLayer(param1:String, param2:String) : void
|
||||
{
|
||||
findAssetsAndSet(mouse,true,param2,null,null,param1);
|
||||
if(down)
|
||||
{
|
||||
findAssetsAndSet(down,true,param2,null,null,param1);
|
||||
}
|
||||
if(gray)
|
||||
{
|
||||
findAssetsAndSet(gray,true,param2,null,null,param1);
|
||||
}
|
||||
}
|
||||
|
||||
public function setButtonState(param1:int) : void
|
||||
{
|
||||
activateGlowArrowState(false);
|
||||
activateGrayState(false);
|
||||
switch(param1)
|
||||
{
|
||||
case 0:
|
||||
if(glow)
|
||||
{
|
||||
glow.visible = false;
|
||||
}
|
||||
activateGrayState(true);
|
||||
break;
|
||||
case 1:
|
||||
activateGlowArrowState(false);
|
||||
break;
|
||||
case 2:
|
||||
activateGlowArrowState(true);
|
||||
}
|
||||
}
|
||||
|
||||
public function btnOverHandler(param1:MouseEvent) : void
|
||||
{
|
||||
hazMouse = true;
|
||||
if(mouse.visible)
|
||||
{
|
||||
if(mouse.hasEventListener("enterFrame"))
|
||||
{
|
||||
mouse.removeEventListener("enterFrame",pbFrameHandler);
|
||||
}
|
||||
mouse.gotoAndPlay(1);
|
||||
if(soundsEnabled && param1 != null)
|
||||
{
|
||||
playRolloverSound();
|
||||
}
|
||||
if(_toolTip && _toolTip.enabled)
|
||||
{
|
||||
_toolTip.startTimer(param1);
|
||||
_toolTip.bringToolToFront();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function btnOutHandler(param1:MouseEvent) : void
|
||||
{
|
||||
hazMouse = false;
|
||||
if(mouse.visible)
|
||||
{
|
||||
if(mouse.currentFrame > 1)
|
||||
{
|
||||
playBackwards(mouse);
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse.stop();
|
||||
}
|
||||
if(_toolTip && _toolTip.toolTipTimer && _toolTip.isTimerRunning())
|
||||
{
|
||||
_toolTip.resetTimerAndSetVisibility();
|
||||
}
|
||||
else if(_toolTip)
|
||||
{
|
||||
_toolTip.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function btnDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
if(isGray)
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(down && !down.visible)
|
||||
{
|
||||
down.visible = true;
|
||||
mouse.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse.visible = true;
|
||||
mouse.gotoAndPlay(1);
|
||||
if(down)
|
||||
{
|
||||
down.visible = false;
|
||||
}
|
||||
}
|
||||
if(soundsEnabled && param1 != null)
|
||||
{
|
||||
playClickSound();
|
||||
}
|
||||
if(_toolTip && _toolTip.toolTipTimer && _toolTip.isTimerRunning())
|
||||
{
|
||||
_toolTip.resetTimerAndSetVisibility();
|
||||
}
|
||||
else if(_toolTip)
|
||||
{
|
||||
_toolTip.visible = false;
|
||||
}
|
||||
downToUpState();
|
||||
}
|
||||
|
||||
public function setTimer(param1:Boolean) : void
|
||||
{
|
||||
_useTimer = param1;
|
||||
}
|
||||
|
||||
private function playBackwards(param1:MovieClip) : void
|
||||
{
|
||||
param1.addEventListener("enterFrame",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("enterFrame",pbFrameHandler);
|
||||
return;
|
||||
}
|
||||
_loc2_.prevFrame();
|
||||
}
|
||||
}
|
||||
|
||||
public function downToUpState() : void
|
||||
{
|
||||
if(down)
|
||||
{
|
||||
down.visible = false;
|
||||
}
|
||||
if(!isGray)
|
||||
{
|
||||
mouse.visible = true;
|
||||
mouse.gotoAndStop(1);
|
||||
if(hazMouse)
|
||||
{
|
||||
btnOverHandler(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function upToDownState() : void
|
||||
{
|
||||
if(down && !down.visible)
|
||||
{
|
||||
down.visible = true;
|
||||
mouse.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function playClickSound() : void
|
||||
{
|
||||
AJAudio.playHudBtnClick();
|
||||
}
|
||||
|
||||
public function playRolloverSound() : void
|
||||
{
|
||||
AJAudio.playHudBtnRollover();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,538 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
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 loadingCont: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();
|
||||
mouse = this["mouse"];
|
||||
down = this["down"];
|
||||
gray = this["gray"];
|
||||
glowArrow = this["glowArrow"];
|
||||
glow = this["glow"];
|
||||
loadingCont = this["loadingCont"];
|
||||
if(!mouse)
|
||||
{
|
||||
throw new Error("GuiSoundToggleButton is missing parts or they are named incorrectly!");
|
||||
}
|
||||
mouse.stop();
|
||||
mouse.visible = true;
|
||||
if(down)
|
||||
{
|
||||
down.stop();
|
||||
down.visible = false;
|
||||
}
|
||||
if(gray)
|
||||
{
|
||||
hasGrayState = true;
|
||||
gray.visible = false;
|
||||
}
|
||||
if(glowArrow)
|
||||
{
|
||||
hasGlowArrowState = true;
|
||||
glowArrow.visible = false;
|
||||
}
|
||||
if(glow)
|
||||
{
|
||||
glow.visible = false;
|
||||
}
|
||||
if(loadingCont)
|
||||
{
|
||||
loadingCont.visible = false;
|
||||
}
|
||||
mouseEnabled = false;
|
||||
addEventListener("mouseDown",btnDownHandler,false,1,true);
|
||||
addEventListener("rollOver",btnOverHandler,false,1,true);
|
||||
addEventListener("rollOut",btnOutHandler,false,1,true);
|
||||
}
|
||||
|
||||
public function initToolTip(param1:DisplayObjectContainer, param2:String, param3:int, param4:int, param5:Boolean = true) : void
|
||||
{
|
||||
if(!_toolTip)
|
||||
{
|
||||
_toolTip = GETDEFINITIONBYNAME("Tooltip");
|
||||
}
|
||||
_toolTip.init(param1,param2,this.x + param3,this.y + param4,param5);
|
||||
}
|
||||
|
||||
public function activateGrayState(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(hasGrayState && !isGray)
|
||||
{
|
||||
isGray = gray.visible = true;
|
||||
_mouseVisibleOnEnableGray = mouse.visible;
|
||||
mouse.visible = false;
|
||||
if(down)
|
||||
{
|
||||
down.visible = false;
|
||||
}
|
||||
removeEventListener("rollOver",btnOverHandler);
|
||||
removeEventListener("rollOut",btnOutHandler);
|
||||
removeEventListener("mouseDown",btnDownHandler);
|
||||
}
|
||||
}
|
||||
else if(hasGrayState && isGray)
|
||||
{
|
||||
isGray = gray.visible = false;
|
||||
if(_mouseVisibleOnEnableGray)
|
||||
{
|
||||
mouse.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse.visible = false;
|
||||
}
|
||||
if(down)
|
||||
{
|
||||
down.visible = !mouse.visible;
|
||||
}
|
||||
addEventListener("rollOver",btnOverHandler,false,1,true);
|
||||
addEventListener("rollOut",btnOutHandler,false,1,true);
|
||||
addEventListener("mouseDown",btnDownHandler,false,1,true);
|
||||
}
|
||||
}
|
||||
|
||||
public function activateGlowArrowState(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(hasGlowArrowState)
|
||||
{
|
||||
isGlowArrow = true;
|
||||
glowArrow.visible = true;
|
||||
glowArrow.mouseChildren = false;
|
||||
glowArrow.mouseEnabled = false;
|
||||
}
|
||||
}
|
||||
else if(hasGlowArrowState)
|
||||
{
|
||||
isGlowArrow = false;
|
||||
glowArrow.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function activateLoadingState(param1:Boolean) : void
|
||||
{
|
||||
if(loadingCont)
|
||||
{
|
||||
loadingCont.visible = param1;
|
||||
activateGrayState(param1);
|
||||
if(!param1)
|
||||
{
|
||||
downToUpState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setButtonState(param1:int) : void
|
||||
{
|
||||
activateGlowArrowState(false);
|
||||
activateGrayState(false);
|
||||
switch(param1)
|
||||
{
|
||||
case 0:
|
||||
if(glow)
|
||||
{
|
||||
glow.visible = false;
|
||||
}
|
||||
activateGrayState(true);
|
||||
break;
|
||||
case 1:
|
||||
activateGlowArrowState(false);
|
||||
break;
|
||||
case 2:
|
||||
activateGlowArrowState(true);
|
||||
}
|
||||
}
|
||||
|
||||
public function pulseButton(param1:Boolean, param2:int = -1) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
mouse.addEventListener("enterFrame",pulseFrameHandler,false,0,true);
|
||||
_repetitions = param2;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse.removeEventListener("enterFrame",pulseFrameHandler);
|
||||
_repetitions = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private function pulseFrameHandler(param1:Event) : void
|
||||
{
|
||||
var _loc2_:MovieClip = MovieClip(param1.target);
|
||||
if(_repetitions > 0)
|
||||
{
|
||||
if(_pulseForward && _loc2_.currentFrame <= _loc2_.totalFrames - 1)
|
||||
{
|
||||
if(_pulseExtraFrames > 10)
|
||||
{
|
||||
_loc2_.nextFrame();
|
||||
}
|
||||
else
|
||||
{
|
||||
_pulseExtraFrames = _pulseExtraFrames + 1;
|
||||
}
|
||||
if(_loc2_.currentFrame == _loc2_.totalFrames)
|
||||
{
|
||||
_repetitions = _repetitions - 1;
|
||||
_pulseForward = false;
|
||||
_pulseExtraFrames = 0;
|
||||
}
|
||||
}
|
||||
else if(_pulseExtraFrames >= 10)
|
||||
{
|
||||
_loc2_.prevFrame();
|
||||
if(_loc2_.currentFrame == 1)
|
||||
{
|
||||
_repetitions = _repetitions - 1;
|
||||
_pulseForward = true;
|
||||
_pulseExtraFrames = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_pulseExtraFrames = _pulseExtraFrames + 1;
|
||||
}
|
||||
}
|
||||
else if(_repetitions == -1)
|
||||
{
|
||||
if(_pulseForward && _loc2_.currentFrame <= _loc2_.totalFrames - 1)
|
||||
{
|
||||
if(_pulseExtraFrames > 10)
|
||||
{
|
||||
_loc2_.nextFrame();
|
||||
}
|
||||
else
|
||||
{
|
||||
_pulseExtraFrames = _pulseExtraFrames + 1;
|
||||
}
|
||||
if(_loc2_.currentFrame == _loc2_.totalFrames)
|
||||
{
|
||||
_pulseForward = false;
|
||||
_pulseExtraFrames = 0;
|
||||
}
|
||||
}
|
||||
else if(_pulseExtraFrames >= 10)
|
||||
{
|
||||
_loc2_.prevFrame();
|
||||
if(_loc2_.currentFrame == 1)
|
||||
{
|
||||
_pulseForward = true;
|
||||
_pulseExtraFrames = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_pulseExtraFrames = _pulseExtraFrames + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse.removeEventListener("enterFrame",pulseFrameHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private function btnOverHandler(param1:MouseEvent) : void
|
||||
{
|
||||
hazMouse = true;
|
||||
if(mouse.visible)
|
||||
{
|
||||
if(mouse.hasEventListener("enterFrame"))
|
||||
{
|
||||
mouse.removeEventListener("enterFrame",pbFrameHandler);
|
||||
}
|
||||
mouse.gotoAndPlay(1);
|
||||
if(soundsEnabled && param1 != null)
|
||||
{
|
||||
playRolloverSound();
|
||||
}
|
||||
if(_toolTip && _toolTip.enabled)
|
||||
{
|
||||
_toolTip.startTimer(param1);
|
||||
_toolTip.bringToolToFront();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function btnOutHandler(param1:MouseEvent) : void
|
||||
{
|
||||
hazMouse = false;
|
||||
if(mouse.visible)
|
||||
{
|
||||
if(mouse.currentFrame > 1)
|
||||
{
|
||||
playBackwards(mouse);
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse.stop();
|
||||
}
|
||||
if(_toolTip && _toolTip.toolTipTimer && _toolTip.isTimerRunning())
|
||||
{
|
||||
_toolTip.resetTimerAndSetVisibility();
|
||||
}
|
||||
else if(_toolTip)
|
||||
{
|
||||
_toolTip.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function btnDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
if(isGray)
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(down && !down.visible)
|
||||
{
|
||||
down.visible = true;
|
||||
mouse.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse.visible = true;
|
||||
mouse.gotoAndPlay(1);
|
||||
if(down)
|
||||
{
|
||||
down.visible = false;
|
||||
}
|
||||
}
|
||||
if(soundsEnabled && param1 != null)
|
||||
{
|
||||
playClickSound();
|
||||
}
|
||||
if(_toolTip && _toolTip.toolTipTimer && _toolTip.isTimerRunning())
|
||||
{
|
||||
_toolTip.resetTimerAndSetVisibility();
|
||||
}
|
||||
else if(_toolTip)
|
||||
{
|
||||
_toolTip.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function setTimer(param1:Boolean) : void
|
||||
{
|
||||
_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(hazMouse)
|
||||
{
|
||||
mouse.gotoAndPlay(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse.gotoAndStop(1);
|
||||
}
|
||||
mouse.visible = true;
|
||||
_loc2_.gotoAndStop(1);
|
||||
_loc2_.visible = false;
|
||||
_loc2_.removeEventListener("enterFrame",selWatcher);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function queueClick(param1:MovieClip) : void
|
||||
{
|
||||
clickQueued = true;
|
||||
param1.addEventListener("enterFrame",qcFrameHandler,false,0,true);
|
||||
}
|
||||
|
||||
private function queueClickCallback() : void
|
||||
{
|
||||
if(!down.visible)
|
||||
{
|
||||
down.visible = true;
|
||||
mouse.visible = false;
|
||||
}
|
||||
down.gotoAndPlay(1);
|
||||
}
|
||||
|
||||
private function qcFrameHandler(param1:Event) : void
|
||||
{
|
||||
var _loc2_:MovieClip = null;
|
||||
if(clickQueued && param1.target as MovieClip)
|
||||
{
|
||||
_loc2_ = MovieClip(param1.target);
|
||||
if(_loc2_.currentFrame == _loc2_.totalFrames)
|
||||
{
|
||||
clickQueued = false;
|
||||
queueClickCallback();
|
||||
_loc2_.removeEventListener("enterFrame",qcFrameHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function playBackwards(param1:MovieClip) : void
|
||||
{
|
||||
param1.addEventListener("enterFrame",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("enterFrame",pbFrameHandler);
|
||||
return;
|
||||
}
|
||||
_loc2_.prevFrame();
|
||||
}
|
||||
}
|
||||
|
||||
public function downToUpState() : void
|
||||
{
|
||||
if(down)
|
||||
{
|
||||
down.visible = false;
|
||||
}
|
||||
if(!isGray)
|
||||
{
|
||||
mouse.visible = true;
|
||||
mouse.gotoAndStop(1);
|
||||
}
|
||||
}
|
||||
|
||||
public function upToDownState() : void
|
||||
{
|
||||
if(down && !down.visible)
|
||||
{
|
||||
down.visible = true;
|
||||
mouse.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function playClickSound() : void
|
||||
{
|
||||
AJAudio.playHudBtnClick();
|
||||
}
|
||||
|
||||
public function playRolloverSound() : void
|
||||
{
|
||||
AJAudio.playHudBtnRollover();
|
||||
}
|
||||
|
||||
public function activateSpecifiedItem(param1:Boolean, param2:String, param3:String = null) : void
|
||||
{
|
||||
findAssetsAndSet(mouse,param1,param2,param3);
|
||||
if(down)
|
||||
{
|
||||
findAssetsAndSet(down,param1,param2,param3);
|
||||
}
|
||||
if(gray)
|
||||
{
|
||||
findAssetsAndSet(gray,param1,param2,param3);
|
||||
}
|
||||
}
|
||||
|
||||
private function findAssetsAndSet(param1:Object, param2:Boolean, param3:String, param4:String = null, param5:Object = null, param6:int = 0) : void
|
||||
{
|
||||
if(param1 is MovieClip || param1 is Sprite)
|
||||
{
|
||||
if(param3 in param1)
|
||||
{
|
||||
if(param4)
|
||||
{
|
||||
param1[param3].gotoAndStop(param4);
|
||||
}
|
||||
param1[param3].visible = param2;
|
||||
while(param1[param3].numChildren > 2)
|
||||
{
|
||||
param1[param3].removeChildAt(param1[param3].numChildren - 1);
|
||||
}
|
||||
if(param5)
|
||||
{
|
||||
param1[param3].addChild(param5.clone().icon);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while(param1.numChildren > param6)
|
||||
{
|
||||
findAssetsAndSet(param1.getChildAt(param6),param2,param3,param4,param5);
|
||||
param6++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function insertIitem(param1:Object, param2:String) : void
|
||||
{
|
||||
findAssetsAndSet(mouse,true,param2,null,param1);
|
||||
if(down)
|
||||
{
|
||||
findAssetsAndSet(down,true,param2,null,param1);
|
||||
}
|
||||
if(gray)
|
||||
{
|
||||
findAssetsAndSet(gray,true,param2,null,param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,233 @@
|
||||
package gui
|
||||
{
|
||||
import achievement.AchievementXtCommManager;
|
||||
import collection.IntItemCollection;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
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);
|
||||
_closeCallback = param1;
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
_userVarIdToCheck = param3;
|
||||
_videoGenericListId = param2;
|
||||
_popupMediaHelper = new MediaHelper();
|
||||
_popupMediaHelper.init(2418,onMediaLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
DarkenManager.unDarken(_popup);
|
||||
_guiLayer.removeChild(_popup);
|
||||
if(_popupMediaHelper)
|
||||
{
|
||||
_popupMediaHelper.destroy();
|
||||
_popupMediaHelper = null;
|
||||
}
|
||||
if(_imageMediaHelper)
|
||||
{
|
||||
_imageMediaHelper.destroy();
|
||||
_imageMediaHelper = null;
|
||||
}
|
||||
if(_loadingSpiral)
|
||||
{
|
||||
_loadingSpiral.destroy();
|
||||
_loadingSpiral = null;
|
||||
}
|
||||
removeEventListeners();
|
||||
_popup = null;
|
||||
_closeCallback = null;
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
_popup = param1.getChildAt(0) as MovieClip;
|
||||
_popup.info.visible = false;
|
||||
_popup.darkBg.visible = false;
|
||||
_itemWindow = _popup.greatNatureProject.itemWindow;
|
||||
_loadingSpiral = new LoadingSpiral(_itemWindow);
|
||||
_imageMediaHelper = new MediaHelper();
|
||||
_popup.x = 900 * 0.5;
|
||||
_popup.y = 550 * 0.5;
|
||||
_popup.greatNatureProject.artistName.autoSize = "right";
|
||||
GenericListXtCommManager.requestStreamList(_videoGenericListId,onTutorialGLReceived);
|
||||
GenericListXtCommManager.requestGenericList(182,onImagesListReceived);
|
||||
addEventListeners();
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_guiLayer.addChild(_popup);
|
||||
DarkenManager.darken(_popup);
|
||||
}
|
||||
|
||||
private function onImagesListReceived(param1:int, param2:Array, param3:Array) : void
|
||||
{
|
||||
_imageIds = param2;
|
||||
_locStrs = param3;
|
||||
loadImage(null);
|
||||
}
|
||||
|
||||
private function onTutorialGLReceived(param1:int, param2:IntItemCollection, param3:IntItemCollection, param4:Array, param5:Array, param6:IntItemCollection, param7:IntItemCollection) : void
|
||||
{
|
||||
_tutorialStreamId = param2.getIntItem(0);
|
||||
_tutorialText = param4[0];
|
||||
_tutorialSubtitleId = param7.getIntItem(0);
|
||||
if(gMainFrame.userInfo.userVarCache.getUserVarValueById(_userVarIdToCheck) < 0)
|
||||
{
|
||||
onInfo(null);
|
||||
AchievementXtCommManager.requestSetUserVar(_userVarIdToCheck,1);
|
||||
}
|
||||
}
|
||||
|
||||
private function loadImage(param1:MouseEvent) : void
|
||||
{
|
||||
if(_popup)
|
||||
{
|
||||
_loadingSpiral.visible = true;
|
||||
if(param1)
|
||||
{
|
||||
if(param1.currentTarget == _popup.greatNatureProject.lArrow)
|
||||
{
|
||||
if(--_mediaIndex < 0)
|
||||
{
|
||||
_mediaIndex = _imageIds.length - 1;
|
||||
}
|
||||
}
|
||||
else if(param1.currentTarget == _popup.greatNatureProject.rArrow)
|
||||
{
|
||||
if(++_mediaIndex > _imageIds.length - 1)
|
||||
{
|
||||
_mediaIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
_popup.greatNatureProject.lArrow.activateGrayState(true);
|
||||
_popup.greatNatureProject.rArrow.activateGrayState(true);
|
||||
LocalizationManager.translateId(_popup.greatNatureProject.artistName,_locStrs[_mediaIndex]);
|
||||
_popup.greatNatureProject.photoCredit.x = _popup.greatNatureProject.artistName.x - _popup.greatNatureProject.photoCredit.width - 2;
|
||||
_imageMediaHelper.init(_imageIds[_mediaIndex],onImageLoaded);
|
||||
}
|
||||
}
|
||||
|
||||
private function onImageLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(_popup)
|
||||
{
|
||||
while(_itemWindow.numChildren > 0)
|
||||
{
|
||||
_itemWindow.removeChildAt(0);
|
||||
}
|
||||
_itemWindow.addChild(param1);
|
||||
_loadingSpiral.visible = false;
|
||||
_popup.greatNatureProject.lArrow.activateGrayState(false);
|
||||
_popup.greatNatureProject.rArrow.activateGrayState(false);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onArrow(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
loadImage(param1);
|
||||
}
|
||||
|
||||
private function onInfo(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
var _loc2_:IntItemCollection = new IntItemCollection();
|
||||
_loc2_.pushIntItem(_tutorialStreamId);
|
||||
var _loc3_:IntItemCollection = new IntItemCollection();
|
||||
_loc3_.pushIntItem(_tutorialSubtitleId);
|
||||
GuiManager.initMoviePlayer(39,_loc2_,[_tutorialText],_loc3_,false);
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget == _popup.info.xBtn)
|
||||
{
|
||||
_popup.darkBg.visible = false;
|
||||
_popup.info.visible = false;
|
||||
}
|
||||
else if(param1.currentTarget == _popup.greatNatureProject.xBtn)
|
||||
{
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_popup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_popup.greatNatureProject.lArrow.addEventListener("mouseDown",onArrow,false,0,true);
|
||||
_popup.greatNatureProject.rArrow.addEventListener("mouseDown",onArrow,false,0,true);
|
||||
_popup.greatNatureProject.infoBtn.addEventListener("mouseDown",onInfo,false,0,true);
|
||||
_popup.greatNatureProject.xBtn.addEventListener("mouseDown",onClose,false,0,true);
|
||||
_popup.info.xBtn.addEventListener("mouseDown",onClose,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_popup.removeEventListener("mouseDown",onPopup);
|
||||
_popup.greatNatureProject.lArrow.removeEventListener("mouseDown",onArrow);
|
||||
_popup.greatNatureProject.rArrow.removeEventListener("mouseDown",onArrow);
|
||||
_popup.greatNatureProject.infoBtn.removeEventListener("mouseDown",onInfo);
|
||||
_popup.greatNatureProject.xBtn.removeEventListener("mouseDown",onClose);
|
||||
_popup.info.xBtn.removeEventListener("mouseDown",onClose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,434 @@
|
||||
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
|
||||
{
|
||||
|
||||
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;
|
||||
|
||||
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 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;
|
||||
_loc2_ = 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 _loc3_:Object = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
if(param1)
|
||||
{
|
||||
if(param1.mediaHelper.id == _pollPopupMediaId)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_imgPopup = MovieClip(param1.getChildAt(0));
|
||||
_imgPopup.x = 900 * 0.5;
|
||||
_imgPopup.y = 550 * 0.5;
|
||||
_imgPopup.imageViewerPopup.visible = false;
|
||||
_imgPopup.scrim.visible = false;
|
||||
if(_imgPopup.doneBtn.hasGrayState)
|
||||
{
|
||||
_imgPopup.doneBtn.activateGrayState(true);
|
||||
}
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
_mediaHolder = [];
|
||||
_itemImages = [];
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _numImageWindow)
|
||||
{
|
||||
_loc3_ = _imgPopup["pollItem" + _loc2_];
|
||||
_loc3_.index = _loc2_;
|
||||
_loc3_.ItemHL.itemSelectedHL.visible = false;
|
||||
_loc3_.ItemHL.mouseOverHL.gotoAndStop("out");
|
||||
_loc3_.checkbox.checkmark.visible = false;
|
||||
_loc3_.checkbox.mouse.visible = false;
|
||||
if(_mediaIds)
|
||||
{
|
||||
_spirals[_loc2_] = new LoadingSpiral(_loc3_.itemBlock);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(_mediaIds[_loc2_],onMediaReceived,_loc2_);
|
||||
_mediaHolder.push(_mediaHelper);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(_mediaIds[_loc2_],onMediaReceived,_loc2_ + 10);
|
||||
_mediaHolder.push(_mediaHelper);
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
_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 _loc3_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
if(param1.currentTarget.name == "doneBtn")
|
||||
{
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _checkedItems.length)
|
||||
{
|
||||
if(_checkedItems[_loc2_] != null)
|
||||
{
|
||||
if(_randOptionLookup)
|
||||
{
|
||||
_loc3_ |= 1 << _randOptionLookup[_checkedItems[_loc2_]];
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ |= 1 << _checkedItems[_loc2_];
|
||||
}
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
SBTracker.trackPageview("/game/play/imageVote/#" + _loc3_);
|
||||
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 _loc4_:Boolean = false;
|
||||
var _loc3_:int = 0;
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.name == "checkbox")
|
||||
{
|
||||
param1.currentTarget.checkmark.visible = _loc4_ = !param1.currentTarget.checkmark.visible;
|
||||
_loc2_ = int(param1.currentTarget.parent.index);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = int(param1.currentTarget.parent.currPollIndex);
|
||||
_imgPopup["pollItem" + _loc2_].checkbox.checkmark.visible = _loc4_ = !_imgPopup["pollItem" + _loc2_].checkbox.checkmark.visible;
|
||||
}
|
||||
if(_loc4_)
|
||||
{
|
||||
_checkedItems.push(_loc2_);
|
||||
if(_checkedItems.length > _numAllowedVotes)
|
||||
{
|
||||
_loc3_ = int(_checkedItems[0]);
|
||||
_checkedItems.shift();
|
||||
_imgPopup["pollItem" + _loc3_].checkbox.checkmark.visible = false;
|
||||
_imgPopup["pollItem" + _loc3_].ItemHL.itemSelectedHL.visible = false;
|
||||
}
|
||||
if(_checkedItems.length > 0)
|
||||
{
|
||||
if(_imgPopup.doneBtn.hasGrayState && _imgPopup.doneBtn.isGray)
|
||||
{
|
||||
_imgPopup.doneBtn.activateGrayState(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_checkedItems.splice(_checkedItems.indexOf(_loc2_),1);
|
||||
if(_imgPopup.doneBtn.hasGrayState && !_imgPopup.doneBtn.isGray && _checkedItems.length == 0)
|
||||
{
|
||||
_imgPopup.doneBtn.activateGrayState(true);
|
||||
}
|
||||
}
|
||||
_imgPopup["pollItem" + _loc2_].ItemHL.itemSelectedHL.visible = _loc4_;
|
||||
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 = int(param1.currentTarget.name == "zoomBtn" ? param1.currentTarget.parent.index : 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 _loc7_:String = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc3_:int = int(param1.length);
|
||||
var _loc4_:Array = param1.slice();
|
||||
while(_loc6_ < _loc3_)
|
||||
{
|
||||
_loc7_ = _loc4_[_loc6_];
|
||||
_loc2_ = Math.floor(Math.random() * _loc3_);
|
||||
if(_loc6_ != _loc2_)
|
||||
{
|
||||
_loc4_[_loc6_] = _loc4_[_loc2_];
|
||||
_loc4_[_loc2_] = _loc7_;
|
||||
_loc5_ = int(_randOptionLookup[_loc6_]);
|
||||
_randOptionLookup[_loc6_] = _randOptionLookup[_loc2_];
|
||||
_randOptionLookup[_loc2_] = _loc5_;
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
private static function addListeners() : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
var _loc1_:int = 0;
|
||||
_imgPopup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_imgPopup.bx.addEventListener("mouseDown",onClose,false,0,true);
|
||||
_imgPopup.doneBtn.addEventListener("mouseDown",onClose,false,0,true);
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _numImageWindow)
|
||||
{
|
||||
_loc2_ = _imgPopup["pollItem" + _loc1_];
|
||||
_loc2_.addEventListener("mouseOut",onItemOut,false,0,true);
|
||||
_loc2_.addEventListener("mouseOver",onItemOver,false,0,true);
|
||||
_loc2_.addEventListener("mouseDown",onItemZoom,false,0,true);
|
||||
_loc2_.zoomBtn.addEventListener("mouseDown",onItemZoom,false,0,true);
|
||||
_loc2_.checkbox.addEventListener("rollOver",onCheckOver,false,0,true);
|
||||
_loc2_.checkbox.addEventListener("rollOut",onCheckOut,false,0,true);
|
||||
_loc2_.checkbox.addEventListener("mouseDown",onCheckOrVote,false,0,true);
|
||||
_loc1_++;
|
||||
}
|
||||
_imgPopup.imageViewerPopup.bx.addEventListener("mouseDown",onCloseViewer,false,0,true);
|
||||
_imgPopup.imageViewerPopup.voteBtn.addEventListener("mouseDown",onCheckOrVote,false,0,true);
|
||||
}
|
||||
|
||||
private static function removeListeners() : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
var _loc1_:int = 0;
|
||||
_imgPopup.removeEventListener("mouseDown",onPopup);
|
||||
_imgPopup.bx.removeEventListener("mouseDown",onClose);
|
||||
_imgPopup.doneBtn.removeEventListener("mouseDown",onClose);
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _numImageWindow)
|
||||
{
|
||||
_loc2_ = _imgPopup["pollItem" + _loc1_];
|
||||
_loc2_.removeEventListener("mouseOut",onItemOut);
|
||||
_loc2_.removeEventListener("mouseOver",onItemOver);
|
||||
_loc2_.removeEventListener("mouseDown",onItemZoom);
|
||||
_loc2_.zoomBtn.removeEventListener("mouseDown",onItemZoom);
|
||||
_loc2_.checkbox.removeEventListener("rollOver",onCheckOver);
|
||||
_loc2_.checkbox.removeEventListener("rollOut",onCheckOut);
|
||||
_loc2_.checkbox.removeEventListener("mouseDown",onCheckOrVote);
|
||||
_loc1_++;
|
||||
}
|
||||
_imgPopup.imageViewerPopup.bx.removeEventListener("mouseDown",onCloseViewer);
|
||||
_imgPopup.imageViewerPopup.voteBtn.removeEventListener("mouseDown",onCheckOrVote);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import inventory.Iitem;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class ItemReceivedPopup
|
||||
{
|
||||
|
||||
private const POPUP_MEDIA_ID:uint = 4820;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _currItem:Iitem;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
private var _itemReceivedPopup:MovieClip;
|
||||
|
||||
private var _guiLayer:DisplayObjectContainer;
|
||||
|
||||
private var _itemLayer:MovieClip;
|
||||
|
||||
private var _okBtn:MovieClip;
|
||||
|
||||
private var _closeBtn:MovieClip;
|
||||
|
||||
private var _loadingSpiral:LoadingSpiral;
|
||||
|
||||
public function ItemReceivedPopup(param1:Iitem, param2:DisplayObjectContainer, param3:Function)
|
||||
{
|
||||
super();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_currItem = param1;
|
||||
_closeCallback = param3;
|
||||
_guiLayer = param2;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(4820,onPopupLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc1_:Function = null;
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_loc1_ = _closeCallback;
|
||||
_closeCallback = null;
|
||||
_loc1_();
|
||||
return;
|
||||
}
|
||||
DarkenManager.unDarken(_itemReceivedPopup);
|
||||
_guiLayer.removeChild(_itemReceivedPopup);
|
||||
removeEventListeners();
|
||||
if(_mediaHelper)
|
||||
{
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
}
|
||||
_itemReceivedPopup = _itemLayer = _closeBtn = _okBtn = null;
|
||||
}
|
||||
|
||||
private function onPopupLoaded(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_itemReceivedPopup = param1.getChildAt(0) as MovieClip;
|
||||
_itemLayer = _itemReceivedPopup.itemLayer;
|
||||
_closeBtn = _itemReceivedPopup.bx;
|
||||
_okBtn = _itemReceivedPopup.okBtn;
|
||||
_itemReceivedPopup.x = 900 * 0.5;
|
||||
_itemReceivedPopup.y = 550 * 0.5;
|
||||
_guiLayer.addChild(_itemReceivedPopup);
|
||||
DarkenManager.darken(_itemReceivedPopup);
|
||||
addEventListeners();
|
||||
setupItem();
|
||||
}
|
||||
|
||||
private function setupItem() : void
|
||||
{
|
||||
if(!_currItem.isIconLoaded)
|
||||
{
|
||||
_currItem.imageLoadedCallback = onImageLoaded;
|
||||
_loadingSpiral = new LoadingSpiral(_itemLayer);
|
||||
}
|
||||
_itemLayer.addChild(_currItem.largeIcon);
|
||||
}
|
||||
|
||||
private function onImageLoaded() : void
|
||||
{
|
||||
_loadingSpiral.destroy();
|
||||
_loadingSpiral = null;
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_itemReceivedPopup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_closeBtn.addEventListener("mouseDown",onClose,false,0,true);
|
||||
_okBtn.addEventListener("mouseDown",onClose,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_itemReceivedPopup.removeEventListener("mouseDown",onPopup);
|
||||
_closeBtn.removeEventListener("mouseDown",onClose);
|
||||
_okBtn.removeEventListener("mouseDown",onClose);
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
package gui
|
||||
{
|
||||
public class JBManager
|
||||
{
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
public function JBManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init() : void
|
||||
{
|
||||
_defPages = [];
|
||||
_unseenPagesIds = [];
|
||||
GenericListXtCommManager.requestGenericList(54,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 = _numUnseenPages - 1;
|
||||
delete _unseenPagesIds[param1];
|
||||
}
|
||||
|
||||
public static function checkUnseenPage(param1:Array) : void
|
||||
{
|
||||
if(param1 && param1.length > 0)
|
||||
{
|
||||
if(_hasLoadedDefs)
|
||||
{
|
||||
if(_unseenPagesIds.length > 0)
|
||||
{
|
||||
_currRoomJBItems = null;
|
||||
loop0:
|
||||
for each(var _loc3_:Object in param1)
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:Array = _unseenPagesIds;
|
||||
do
|
||||
{
|
||||
for each(var _loc2_:int in _loc4_)
|
||||
{
|
||||
}
|
||||
continue loop0;
|
||||
}
|
||||
while(_loc2_ != _loc3_.refId);
|
||||
GuiManager.showJBGlow(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_currRoomJBItems = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function onFactListReceived(param1:Array) : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
var _loc3_:int = 0;
|
||||
_hasLoadedDefs = true;
|
||||
var _loc2_:int = int(param1.length);
|
||||
var _loc7_:int = 0;
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc2_)
|
||||
{
|
||||
_loc4_ = param1[_loc5_];
|
||||
if(!_defPages[_loc4_.userVarId])
|
||||
{
|
||||
_defPages[_loc4_.userVarId] = [];
|
||||
if(!gMainFrame.userInfo.userVarCache.isBitSet(_loc4_.userVarId,29))
|
||||
{
|
||||
_numUnseenPages = _numUnseenPages + 1;
|
||||
_unseenPagesIds[_loc4_.userVarId] = _loc4_.id;
|
||||
}
|
||||
}
|
||||
_defPages[_loc4_.userVarId].push(_loc4_);
|
||||
NGFactManager.updateFactDefCache(_loc4_);
|
||||
_loc5_++;
|
||||
}
|
||||
for each(var _loc6_:Array in _defPages)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc6_.length)
|
||||
{
|
||||
if(gMainFrame.userInfo.userVarCache.isBitSet(_loc6_[_loc5_].userVarId,_loc6_[_loc5_].bitIdx))
|
||||
{
|
||||
_loc3_++;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
if(_loc3_ == _loc6_.length)
|
||||
{
|
||||
if(!(gMainFrame.userInfo.userVarCache.isBitSet(_loc6_[_loc5_ - 1].userVarId,31) || Boolean(gMainFrame.userInfo.userVarCache.isBitSet(_loc6_[_loc5_ - 1].userVarId,30))))
|
||||
{
|
||||
_numUnclaimedGifts = _numUnclaimedGifts + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_currRoomJBItems)
|
||||
{
|
||||
checkUnseenPage(_currRoomJBItems);
|
||||
}
|
||||
GuiManager.updateJBIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class LoadingSpiral extends MovieClip
|
||||
{
|
||||
|
||||
public static const LOADING_SPIRAL_MEDIA_ID:int = 44;
|
||||
|
||||
public static var hasBeenLoaded:Boolean;
|
||||
|
||||
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)
|
||||
{
|
||||
_parent = param1;
|
||||
}
|
||||
_addToParent = true;
|
||||
this.x = param2;
|
||||
this.y = param3;
|
||||
_loadingSpiralHelper = new MediaHelper();
|
||||
_loadingSpiralHelper.init(44,loadingSpiralHandler);
|
||||
this.addEventListener("mouseDown",onMouseDown,false,0,true);
|
||||
this.addEventListener("mouseOver",onMouseOver,false,0,true);
|
||||
hasBeenLoaded = false;
|
||||
_displayPercentage = param4;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(_parent && this.parent == _parent)
|
||||
{
|
||||
_parent.removeChild(this);
|
||||
}
|
||||
_addToParent = false;
|
||||
if(!_isDarkenManagersSpiral)
|
||||
{
|
||||
_parent = null;
|
||||
}
|
||||
_displayPercentage = false;
|
||||
}
|
||||
|
||||
public function set isDarkenManagersSpiral(param1:Boolean) : void
|
||||
{
|
||||
_isDarkenManagersSpiral = param1;
|
||||
}
|
||||
|
||||
public function setNewParent(param1:DisplayObjectContainer, param2:Number = 0, param3:Number = 0, param4:Boolean = false) : void
|
||||
{
|
||||
_parent = param1;
|
||||
_addToParent = true;
|
||||
if(_parent && _loadingSpiral)
|
||||
{
|
||||
_parent.addChild(this);
|
||||
}
|
||||
if(_loadingSpiral)
|
||||
{
|
||||
if(param4)
|
||||
{
|
||||
_loadingSpiral.txt.text = "0%";
|
||||
_loadingSpiral.txt.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loadingSpiral.txt.visible = false;
|
||||
}
|
||||
}
|
||||
this.x = param2;
|
||||
this.y = param3;
|
||||
}
|
||||
|
||||
public function updatePercentText(param1:String) : void
|
||||
{
|
||||
if(_loadingSpiral)
|
||||
{
|
||||
_loadingSpiral.txt.text = param1;
|
||||
}
|
||||
}
|
||||
|
||||
override public function set visible(param1:Boolean) : void
|
||||
{
|
||||
super.visible = param1;
|
||||
if(param1)
|
||||
{
|
||||
bringToFront();
|
||||
}
|
||||
}
|
||||
|
||||
private function bringToFront() : void
|
||||
{
|
||||
if(this.parent == _parent)
|
||||
{
|
||||
_parent.setChildIndex(this,_parent.numChildren - 1);
|
||||
}
|
||||
}
|
||||
|
||||
private function loadingSpiralHandler(param1:MovieClip) : void
|
||||
{
|
||||
if(_addToParent)
|
||||
{
|
||||
_loadingSpiral = param1;
|
||||
_loadingSpiral.txt.text = "0%";
|
||||
if(_loadingSpiral)
|
||||
{
|
||||
this.addChild(_loadingSpiral);
|
||||
}
|
||||
if(_parent)
|
||||
{
|
||||
_parent.addChild(this);
|
||||
}
|
||||
if(!_displayPercentage)
|
||||
{
|
||||
_loadingSpiral.txt.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loadingSpiral.txt.visible = true;
|
||||
}
|
||||
hasBeenLoaded = true;
|
||||
_loadingSpiralHelper.destroy();
|
||||
_loadingSpiralHelper = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onMouseOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,423 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarXtCommManager;
|
||||
import buddy.Buddy;
|
||||
import currency.UserCurrency;
|
||||
import diamond.DiamondXtCommManager;
|
||||
import flash.display.Bitmap;
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import loader.MasterpieceDefHelper;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class MasterpiecePreview
|
||||
{
|
||||
|
||||
private static var _masterpiecePreviewIconStrIds:Array;
|
||||
|
||||
private static var _masterpiecePreviewIconsOrdered:Array;
|
||||
|
||||
private static var _masterpiecePreviewIconIdsOrdered:Array;
|
||||
|
||||
private const POPUP_MEDIA_ID:int = 4810;
|
||||
|
||||
private var _guiLayer:DisplayObjectContainer;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
private var _masterpieceMediaHelper:MasterpieceDefHelper;
|
||||
|
||||
private var _previewLoadingSpiral:LoadingSpiral;
|
||||
|
||||
private var _reportAPlayer:ReportAPlayer;
|
||||
|
||||
private var _previewImage:Sprite;
|
||||
|
||||
private var _previewPopup:MovieClip;
|
||||
|
||||
private var _itemLayer:MovieClip;
|
||||
|
||||
private var _buyBtnGreen:MovieClip;
|
||||
|
||||
private var _buyBtnRed:MovieClip;
|
||||
|
||||
private var _closeBtn:MovieClip;
|
||||
|
||||
private var _itemVersion:int;
|
||||
|
||||
private var _hasLoadedIcons:Boolean;
|
||||
|
||||
private var _isBuying:Boolean;
|
||||
|
||||
private var _creatorUsername:String;
|
||||
|
||||
private var _uniqueImageId:String;
|
||||
|
||||
public function MasterpiecePreview(param1:DisplayObjectContainer, param2:String, param3:String, param4:int, param5:Function, param6:Object = null, param7:Boolean = false)
|
||||
{
|
||||
super();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_guiLayer = param1;
|
||||
_itemVersion = param4;
|
||||
_uniqueImageId = param2;
|
||||
_creatorUsername = param3;
|
||||
if(param6 != null)
|
||||
{
|
||||
if(param6 is Bitmap)
|
||||
{
|
||||
_previewImage = new Sprite();
|
||||
_previewImage.addChild(param6 as Bitmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
_previewImage = param6 as Sprite;
|
||||
}
|
||||
}
|
||||
_isBuying = param7;
|
||||
if(_masterpiecePreviewIconIdsOrdered == null)
|
||||
{
|
||||
GenericListXtCommManager.requestGenericList(424,onMasterpieceIconOrderListLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
_hasLoadedIcons = true;
|
||||
}
|
||||
_closeCallback = param5;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(4810,onPreviewLoaded);
|
||||
}
|
||||
|
||||
public static function get masterpiecePreviewIconStrIds() : Array
|
||||
{
|
||||
return _masterpiecePreviewIconStrIds;
|
||||
}
|
||||
|
||||
public static function set masterpiecePreviewIconStrIds(param1:Array) : void
|
||||
{
|
||||
_masterpiecePreviewIconStrIds = param1;
|
||||
}
|
||||
|
||||
public static function set masterpiecePreviewIconIdsOrdered(param1:Array) : void
|
||||
{
|
||||
_masterpiecePreviewIconIdsOrdered = param1;
|
||||
}
|
||||
|
||||
public static function get masterpiecePreviewIconIdsOrdered() : Array
|
||||
{
|
||||
return _masterpiecePreviewIconIdsOrdered;
|
||||
}
|
||||
|
||||
public function destroy(param1:Boolean = false) : void
|
||||
{
|
||||
var _loc3_:Function = null;
|
||||
var _loc2_:MovieClip = null;
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_loc3_ = _closeCallback;
|
||||
_closeCallback = null;
|
||||
_loc3_(param1);
|
||||
return;
|
||||
}
|
||||
if(_masterpiecePreviewIconsOrdered)
|
||||
{
|
||||
_loc2_ = _masterpiecePreviewIconsOrdered[_itemVersion];
|
||||
if(_loc2_)
|
||||
{
|
||||
if(_previewImage)
|
||||
{
|
||||
_loc2_.itemWindow.removeChild(_previewImage);
|
||||
}
|
||||
if(!_isBuying)
|
||||
{
|
||||
_loc2_.report_btn.removeEventListener("mouseDown",onReportDown);
|
||||
}
|
||||
_loc2_.removeEventListener("mouseOver",onIconOver);
|
||||
_loc2_.removeEventListener("mouseOut",onIconOut);
|
||||
_loc2_.nameBar.removeEventListener("mouseDown",onNameBarDown);
|
||||
}
|
||||
}
|
||||
removeEventListeners();
|
||||
if(_mediaHelper)
|
||||
{
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
}
|
||||
if(_previewLoadingSpiral)
|
||||
{
|
||||
_previewLoadingSpiral.destroy();
|
||||
_previewLoadingSpiral = null;
|
||||
}
|
||||
if(_masterpieceMediaHelper)
|
||||
{
|
||||
_masterpieceMediaHelper.destroy();
|
||||
_masterpieceMediaHelper = null;
|
||||
}
|
||||
DarkenManager.unDarken(_previewPopup);
|
||||
_guiLayer.removeChild(_previewPopup);
|
||||
_previewPopup = _itemLayer = _buyBtnGreen = _buyBtnRed = _closeBtn = null;
|
||||
}
|
||||
|
||||
public function set closeCallback(param1:Function) : void
|
||||
{
|
||||
_closeCallback = param1;
|
||||
}
|
||||
|
||||
private function onMasterpieceIconOrderListLoaded(param1:int, param2:Array, param3:Array) : void
|
||||
{
|
||||
_masterpiecePreviewIconIdsOrdered = param2;
|
||||
_masterpiecePreviewIconStrIds = param3;
|
||||
_hasLoadedIcons = true;
|
||||
if(_previewPopup)
|
||||
{
|
||||
setupPreview();
|
||||
}
|
||||
}
|
||||
|
||||
private function onPreviewLoaded(param1:MovieClip) : void
|
||||
{
|
||||
_previewPopup = param1.getChildAt(0) as MovieClip;
|
||||
_itemLayer = _previewPopup.itemLayer;
|
||||
_buyBtnGreen = _previewPopup.diamond_buy_btn_green;
|
||||
_buyBtnRed = _previewPopup.diamond_buy_btn_red;
|
||||
_closeBtn = _previewPopup.bx;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_previewPopup.x = 900 * 0.5;
|
||||
_previewPopup.y = 550 * 0.5;
|
||||
setupPreview();
|
||||
addEventListeners();
|
||||
_guiLayer.addChild(_previewPopup);
|
||||
DarkenManager.darken(_previewPopup);
|
||||
}
|
||||
|
||||
private function setupPreview() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
if(_hasLoadedIcons)
|
||||
{
|
||||
if(_masterpiecePreviewIconsOrdered && _masterpiecePreviewIconsOrdered[_itemVersion])
|
||||
{
|
||||
_previewLoadingSpiral = new LoadingSpiral(_itemLayer);
|
||||
if(_previewImage)
|
||||
{
|
||||
onPreviewImageLoaded(_previewImage);
|
||||
}
|
||||
else if(_uniqueImageId)
|
||||
{
|
||||
_masterpieceMediaHelper = new MasterpieceDefHelper();
|
||||
_masterpieceMediaHelper.init(_uniqueImageId,onPreviewImageLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
onPreviewImageLoaded(null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(_masterpiecePreviewIconIdsOrdered[_itemVersion],onPreviewIconLoaded);
|
||||
}
|
||||
}
|
||||
if(_isBuying)
|
||||
{
|
||||
_loc1_ = DiamondXtCommManager.getDiamondDef(221);
|
||||
if(!UserCurrency.hasEnoughCurrency(3,_loc1_.value))
|
||||
{
|
||||
_buyBtnGreen.visible = false;
|
||||
_buyBtnRed.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_buyBtnGreen.visible = true;
|
||||
_buyBtnRed.visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_buyBtnGreen.visible = false;
|
||||
_buyBtnRed.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPreviewIconLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(_masterpiecePreviewIconsOrdered == null)
|
||||
{
|
||||
_masterpiecePreviewIconsOrdered = [];
|
||||
}
|
||||
_masterpiecePreviewIconsOrdered[_itemVersion] = param1.getChildAt(0);
|
||||
setupPreview();
|
||||
}
|
||||
|
||||
private function onPreviewImageLoaded(param1:Sprite) : void
|
||||
{
|
||||
_previewImage = param1;
|
||||
if(_previewLoadingSpiral)
|
||||
{
|
||||
_previewLoadingSpiral.destroy();
|
||||
_previewLoadingSpiral = null;
|
||||
}
|
||||
var _loc3_:MovieClip = _masterpiecePreviewIconsOrdered[_itemVersion];
|
||||
var _loc2_:Number = _loc3_.itemWindow.scaleX - 1;
|
||||
var _loc4_:Number = _loc3_.itemWindow.scaleY - 1;
|
||||
if(_previewImage)
|
||||
{
|
||||
_previewImage.width = _loc3_.itemWindow.width - _loc3_.itemWindow.width * _loc2_;
|
||||
_previewImage.height = _loc3_.itemWindow.height - _loc3_.itemWindow.height * _loc4_;
|
||||
_previewImage.x = -_previewImage.width * 0.5;
|
||||
_previewImage.y = -_previewImage.height * 0.5;
|
||||
_loc3_.itemWindow.addChild(_previewImage);
|
||||
if(_isBuying || _creatorUsername == "" || _creatorUsername == gMainFrame.userInfo.myUserName)
|
||||
{
|
||||
_loc3_.nameBar.mouseChildren = false;
|
||||
_loc3_.nameBar.mouseEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_.nameBar.mouseChildren = true;
|
||||
_loc3_.nameBar.mouseEnabled = true;
|
||||
_loc3_.addEventListener("mouseOver",onIconOver,false,0,true);
|
||||
_loc3_.addEventListener("mouseOut",onIconOut,false,0,true);
|
||||
_loc3_.nameBar.addEventListener("mouseDown",onNameBarDown,false,0,true);
|
||||
}
|
||||
_loc3_.report_btn.visible = false;
|
||||
if(_creatorUsername == null || _creatorUsername == "")
|
||||
{
|
||||
(_loc3_.nameBar as GuiSoundButton).setTextInLayer(LocalizationManager.translateIdOnly(25212),"name_txt");
|
||||
}
|
||||
else
|
||||
{
|
||||
(_loc3_.nameBar as GuiSoundButton).setTextInLayer(_creatorUsername,"name_txt");
|
||||
}
|
||||
if(!_isBuying)
|
||||
{
|
||||
_loc3_.report_btn.addEventListener("mouseDown",onReportDown,false,0,true);
|
||||
_loc3_.nameBar.visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_.nameBar.visible = false;
|
||||
_loc3_.report_btn.visible = false;
|
||||
while(_loc3_.itemWindow.numChildren > 1)
|
||||
{
|
||||
_loc3_.itemWindow.removeChildAt(_loc3_.itemWindow.numChildren - 1);
|
||||
}
|
||||
}
|
||||
if("frame" in _loc3_)
|
||||
{
|
||||
_loc3_.frame.filters = null;
|
||||
}
|
||||
_itemLayer.addChild(_loc3_);
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_previewPopup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_buyBtnGreen.addEventListener("mouseDown",onBuyBtn,false,0,true);
|
||||
_buyBtnRed.addEventListener("mouseDown",onBuyBtn,false,0,true);
|
||||
_closeBtn.addEventListener("mouseDown",onCloseBtn,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_previewPopup.removeEventListener("mouseDown",onPopup);
|
||||
_buyBtnGreen.removeEventListener("mouseDown",onBuyBtn);
|
||||
_buyBtnRed.removeEventListener("mouseDown",onBuyBtn);
|
||||
_closeBtn.removeEventListener("mouseDown",onCloseBtn);
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onBuyBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget == _buyBtnRed)
|
||||
{
|
||||
UpsellManager.displayPopup("","extraDiamonds");
|
||||
}
|
||||
else if(!gMainFrame.userInfo.isMember)
|
||||
{
|
||||
UpsellManager.displayPopup("denArt","den_art");
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy(true);
|
||||
}
|
||||
}
|
||||
|
||||
private function onCloseBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
destroy();
|
||||
}
|
||||
|
||||
private function onReportDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_reportAPlayer = new ReportAPlayer();
|
||||
_reportAPlayer.init(4,_guiLayer,onPostReport,true,_creatorUsername,_creatorUsername,false,_uniqueImageId,7);
|
||||
}
|
||||
|
||||
private function onPostReport(param1:Boolean) : void
|
||||
{
|
||||
if(_reportAPlayer)
|
||||
{
|
||||
_reportAPlayer.destroy();
|
||||
_reportAPlayer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onIconOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.currentTarget.report_btn.visible = true;
|
||||
}
|
||||
|
||||
private function onIconOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.currentTarget.report_btn.visible = false;
|
||||
}
|
||||
|
||||
private function onNameBarDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_previewPopup && _creatorUsername.toLowerCase() != gMainFrame.userInfo.myUserName.toLowerCase())
|
||||
{
|
||||
BuddyList.requestBuddyListIfNeeded(onBuddyListRequested);
|
||||
}
|
||||
}
|
||||
|
||||
private function onBuddyListRequested() : void
|
||||
{
|
||||
var _loc1_:Buddy = BuddyManager.getBuddyByUserName(_creatorUsername);
|
||||
if(_loc1_)
|
||||
{
|
||||
BuddyManager.showBuddyCard({
|
||||
"userName":_loc1_.userName,
|
||||
"onlineStatus":_loc1_.onlineStatus
|
||||
});
|
||||
return;
|
||||
}
|
||||
AvatarXtCommManager.requestAvatarGet(_creatorUsername,onUserLookUpReceived,true);
|
||||
}
|
||||
|
||||
private function onUserLookUpReceived(param1:String, param2:Boolean, param3:int) : void
|
||||
{
|
||||
if(param2)
|
||||
{
|
||||
BuddyManager.showBuddyCard({
|
||||
"userName":param1,
|
||||
"onlineStatus":param3
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
package gui
|
||||
{
|
||||
import com.sbi.analytics.SBTracker;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import com.sbi.popup.SBYesNoPopup;
|
||||
import currency.UserCurrency;
|
||||
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
|
||||
{
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(1546,onMediaLoaded);
|
||||
_closeCallback = param1;
|
||||
_donationAmounts = [10,25,50,100,250,500,1000,2500,5000];
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
removeEventListeners();
|
||||
if(_mediaHelper)
|
||||
{
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
}
|
||||
_closeCallback = null;
|
||||
DarkenManager.unDarken(_popup);
|
||||
_guiLayer.removeChild(_popup);
|
||||
_popup = null;
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_popup = MovieClip(param1.getChildAt(0));
|
||||
_popup.x = 900 * 0.5;
|
||||
_popup.y = 550 * 0.5;
|
||||
_myGemCount = UserCurrency.getCurrency(0);
|
||||
_popup.donateRedBtn.visible = false;
|
||||
_radioBtn1 = _popup.radioBtn1;
|
||||
_radioBtn2 = _popup.radioBtn2;
|
||||
_radioBtn3 = _popup.radioBtn3;
|
||||
_popup.donateBtn.activateGrayState(true);
|
||||
_radioBtn1._circle.visible = false;
|
||||
_radioBtn2._circle.visible = false;
|
||||
_radioBtn3._circle.visible = false;
|
||||
addEventListeners();
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_guiLayer.addChild(_popup);
|
||||
DarkenManager.darken(_popup);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function onUpBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
var _loc2_:int = int(_popup.donationAmountTxt.text);
|
||||
if(_donationIndex < _donationAmounts.length - 1)
|
||||
{
|
||||
_donationIndex = _donationIndex + 1;
|
||||
_loc2_ = int(_donationAmounts[_donationIndex]);
|
||||
}
|
||||
if(_loc2_ > _myGemCount)
|
||||
{
|
||||
_popup.donateRedBtn.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_popup.donateRedBtn.visible = false;
|
||||
}
|
||||
_popup.donationAmountTxt.text = _loc2_;
|
||||
}
|
||||
|
||||
private function onDownBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
var _loc2_:int = int(_popup.donationAmountTxt.text);
|
||||
if(_donationIndex > 0)
|
||||
{
|
||||
_donationIndex = _donationIndex - 1;
|
||||
_loc2_ = int(_donationAmounts[_donationIndex]);
|
||||
}
|
||||
if(_loc2_ > _myGemCount)
|
||||
{
|
||||
_popup.donateRedBtn.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_popup.donateRedBtn.visible = false;
|
||||
}
|
||||
_popup.donationAmountTxt.text = _loc2_;
|
||||
}
|
||||
|
||||
private function onDonateBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
if(_myGemCount < _popup.donationAmountTxt.text)
|
||||
{
|
||||
SBTracker.trackPageview("/game/play/popup/donate/donation/notEnoughGems/#" + _myGemCount,-1,1);
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(14770));
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBYesNoPopup(_guiLayer,LocalizationManager.translateIdAndInsertOnly(14771,Utility.convertNumberToString(_popup.donationAmountTxt.text)),true,onConfirm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onConfirm(param1:Object) : void
|
||||
{
|
||||
if(param1.status)
|
||||
{
|
||||
ItemXtCommManager.requestDonateGems(_popup.donationAmountTxt.text,onDonateDone);
|
||||
FeedbackManager.setupRequest(new UserImageUpload(),_lastChosenString + "|" + _popup.donationAmountTxt.text,12,0,onSuccess,onError);
|
||||
}
|
||||
}
|
||||
|
||||
private function onError(param1:Event) : void
|
||||
{
|
||||
}
|
||||
|
||||
private function onSuccess(param1:Event) : void
|
||||
{
|
||||
}
|
||||
|
||||
private function onDonateDone(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_popup.visible = false;
|
||||
SBTracker.trackPageview("/game/play/popup/donate/donation/#" + _popup.donationAmountTxt.text);
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(14772),true,onDonationThanks);
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(14773));
|
||||
}
|
||||
}
|
||||
|
||||
private function onDonationThanks(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBOkPopup.destroyInParentChain(param1.target.parent);
|
||||
onClose(null);
|
||||
}
|
||||
|
||||
private function onRadioBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_radioBtn1._circle.visible = false;
|
||||
_radioBtn2._circle.visible = false;
|
||||
_radioBtn3._circle.visible = false;
|
||||
var _loc2_:Object = param1.currentTarget;
|
||||
_loc2_._circle.visible = !_loc2_._circle.visible;
|
||||
if(_loc2_._circle.visible)
|
||||
{
|
||||
_lastChosenString = _popup["selectionLabelTxt" + _loc2_.name.substr(8)].text;
|
||||
}
|
||||
if(_popup.donateBtn.isGray)
|
||||
{
|
||||
_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
|
||||
{
|
||||
_popup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_popup.bx.addEventListener("mouseDown",onClose,false,0,true);
|
||||
_popup.upBtn.addEventListener("mouseDown",onUpBtn,false,0,true);
|
||||
_popup.downBtn.addEventListener("mouseDown",onDownBtn,false,0,true);
|
||||
_popup.donateBtn.addEventListener("mouseDown",onDonateBtn,false,0,true);
|
||||
_popup.donateRedBtn.addEventListener("mouseDown",onDonateBtn,false,0,true);
|
||||
_popup.radioBtn1.addEventListener("mouseDown",onRadioBtn,false,0,true);
|
||||
_popup.radioBtn2.addEventListener("mouseDown",onRadioBtn,false,0,true);
|
||||
_popup.radioBtn3.addEventListener("mouseDown",onRadioBtn,false,0,true);
|
||||
_popup.playMovBtn1_131.addEventListener("mouseDown",onPlayMovBtn,false,0,true);
|
||||
_popup.playMovBtn2_130.addEventListener("mouseDown",onPlayMovBtn,false,0,true);
|
||||
_popup.playMovBtn3_129.addEventListener("mouseDown",onPlayMovBtn,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_popup.removeEventListener("mouseDown",onPopup);
|
||||
_popup.bx.removeEventListener("mouseDown",onClose);
|
||||
_popup.upBtn.removeEventListener("mouseDown",onUpBtn);
|
||||
_popup.downBtn.removeEventListener("mouseDown",onDownBtn);
|
||||
_popup.donateBtn.removeEventListener("mouseDown",onDonateBtn);
|
||||
_popup.donateRedBtn.removeEventListener("mouseDown",onDonateBtn);
|
||||
_popup.radioBtn1.removeEventListener("mouseDown",onRadioBtn);
|
||||
_popup.radioBtn2.removeEventListener("mouseDown",onRadioBtn);
|
||||
_popup.radioBtn3.removeEventListener("mouseDown",onRadioBtn);
|
||||
_popup.playMovBtn1_131.removeEventListener("mouseDown",onPlayMovBtn);
|
||||
_popup.playMovBtn2_130.removeEventListener("mouseDown",onPlayMovBtn);
|
||||
_popup.playMovBtn3_129.removeEventListener("mouseDown",onPlayMovBtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.*;
|
||||
import flash.net.URLRequest;
|
||||
import flash.net.navigateToURL;
|
||||
import gui.itemWindows.ItemWindowToggle;
|
||||
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 SETTINGS_AUTO_SERVER_TRAVEL:int = 3;
|
||||
|
||||
public static var SETTINGS_USERNAME_BADGE:int = 4;
|
||||
|
||||
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
|
||||
{
|
||||
_popupLayer = param1;
|
||||
_closeCallback = param4;
|
||||
_mySettings = GETDEFINITIONBYNAME("MySettings");
|
||||
_mySettings.x = param2;
|
||||
_mySettings.y = param3;
|
||||
_popupLayer.addChild(_mySettings);
|
||||
setupContent();
|
||||
addEventListeners();
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
removeEventListeners();
|
||||
_popupLayer.removeChild(_mySettings);
|
||||
_closeCallback = null;
|
||||
_mySettings = null;
|
||||
if(_toggleWindows)
|
||||
{
|
||||
_toggleWindows.destroy();
|
||||
_toggleWindows = null;
|
||||
}
|
||||
if(_toggleScrollBar)
|
||||
{
|
||||
_toggleScrollBar.destroy();
|
||||
_toggleWindows = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function updateSoundBtn() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _toggleWindows.bg.numChildren)
|
||||
{
|
||||
if((_toggleWindows.bg.getChildAt(_loc1_) as ItemWindowToggle).currFrameLabel == "music")
|
||||
{
|
||||
(_toggleWindows.bg.getChildAt(_loc1_) as ItemWindowToggle).resetConditions();
|
||||
break;
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
}
|
||||
|
||||
public function updateWorldMessage() : void
|
||||
{
|
||||
}
|
||||
|
||||
private function setupContent() : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc1_:int = 0;
|
||||
if(gMainFrame.userInfo.isMember)
|
||||
{
|
||||
_mySettings.statusNonmember.visible = false;
|
||||
_loc1_ = int(gMainFrame.clientInfo.numDaysLeftOnSubscription);
|
||||
if(_loc1_ > 0)
|
||||
{
|
||||
_mySettings.gotoAndStop("memberScrollSubscription");
|
||||
_loc2_ = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
_mySettings.gotoAndStop("memberScroll");
|
||||
_loc2_ = 6;
|
||||
}
|
||||
_loc5_ = int(_mySettings.itemWindow.height);
|
||||
_loc3_ = int(_mySettings.itemWindow.width);
|
||||
if(_loc1_ > 0)
|
||||
{
|
||||
if(_loc1_ > 1)
|
||||
{
|
||||
LocalizationManager.translateIdAndInsert(_mySettings.timeRemaining.timeTxt,11361,_loc1_);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalizationManager.translateIdAndInsert(_mySettings.timeRemaining.timeTxt,11362,_loc1_);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_mySettings.statusMember.visible = false;
|
||||
_mySettings.gotoAndStop("nonMemScroll");
|
||||
_mySettings.joinBtn.addEventListener("mouseDown",onJoinBtn,false,0,true);
|
||||
_loc2_ = 5;
|
||||
_loc5_ = int(_mySettings.itemWindow.height);
|
||||
_loc3_ = int(_mySettings.itemWindow.width);
|
||||
}
|
||||
var _loc4_:Array = [{
|
||||
"type":TOGGLE_TYPE_JOIN,
|
||||
"frame":"redeemCode",
|
||||
"labelTxt":24819,
|
||||
"btnTxt":24820
|
||||
},{
|
||||
"type":TOGGLE_TYPE_JOIN,
|
||||
"frame":"world",
|
||||
"labelTxt":6395,
|
||||
"btnTxt":6366
|
||||
},{
|
||||
"type":TOGGLE_TYPE_TOGGLE_BTN,
|
||||
"frame":"nameBadge",
|
||||
"labelTxt":23912,
|
||||
"onTxt":6241,
|
||||
"offTxt":23918
|
||||
},{
|
||||
"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
|
||||
},{
|
||||
"type":TOGGLE_TYPE_TOGGLE_BTN,
|
||||
"frame":"autoServer",
|
||||
"labelTxt":23667,
|
||||
"onTxt":6324,
|
||||
"offTxt":6322
|
||||
}];
|
||||
_toggleWindows = new WindowGenerator();
|
||||
_toggleWindows.init(1,_loc2_,_loc4_.length,0,4,0,ItemWindowToggle,_loc4_,null,null,{"onClose":onClose});
|
||||
_mySettings.itemWindow.addChild(_toggleWindows);
|
||||
_toggleScrollBar = new SBScrollbar();
|
||||
_toggleScrollBar.init(_toggleWindows,_loc3_,_loc5_,2,"scrollbar2",_toggleWindows.boxHeight + 4);
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function onJoinBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
var _loc3_:String = gMainFrame.clientInfo.websiteURL + "membership";
|
||||
var _loc2_:URLRequest = new URLRequest(_loc3_);
|
||||
try
|
||||
{
|
||||
navigateToURL(_loc2_,"_blank");
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
with(_mySettings)
|
||||
{
|
||||
addEventListener(MouseEvent.MOUSE_DOWN,onPopup,false,0,true);
|
||||
bx.addEventListener(MouseEvent.MOUSE_DOWN,onClose,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
with(_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
@@ -0,0 +1,142 @@
|
||||
package gui
|
||||
{
|
||||
import Party.PartyManager;
|
||||
import customParty.CustomPartyCreatePopup;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
import room.RoomManagerWorld;
|
||||
|
||||
public class PartyPreviewManager
|
||||
{
|
||||
|
||||
private var _createPopup:CustomPartyCreatePopup;
|
||||
|
||||
private var _hostAndBackBtns:MovieClip;
|
||||
|
||||
private var _loadingMediaHelper:MediaHelper;
|
||||
|
||||
public function PartyPreviewManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function setCreatePopup(param1:CustomPartyCreatePopup) : void
|
||||
{
|
||||
_createPopup = param1;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(_hostAndBackBtns)
|
||||
{
|
||||
_hostAndBackBtns.backBtn.removeEventListener("mouseDown",onBackBtn);
|
||||
_hostAndBackBtns.buyBtn.removeEventListener("mouseDown",onHostBtn);
|
||||
GuiManager.guiLayer.removeChild(_hostAndBackBtns);
|
||||
}
|
||||
}
|
||||
|
||||
public function handleAllRequiredVisibilities(param1:Boolean) : void
|
||||
{
|
||||
GuiManager.toggleHud();
|
||||
handlePartyAndCustomCreateVisibility(param1);
|
||||
if(_hostAndBackBtns)
|
||||
{
|
||||
_hostAndBackBtns.visible = !param1;
|
||||
}
|
||||
else if(!param1)
|
||||
{
|
||||
showBuyAndBackBtns(true);
|
||||
}
|
||||
}
|
||||
|
||||
public function handlePartyPurchase(param1:Boolean = false) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
RoomManagerWorld.instance.reloadCurrentNormalRoom();
|
||||
}
|
||||
if(_hostAndBackBtns && _hostAndBackBtns.visible)
|
||||
{
|
||||
_hostAndBackBtns.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function showBuyAndBackBtns(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(_hostAndBackBtns)
|
||||
{
|
||||
_hostAndBackBtns.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(2969,onHostAndBackBtnsLoaded);
|
||||
}
|
||||
}
|
||||
else if(_hostAndBackBtns)
|
||||
{
|
||||
_hostAndBackBtns.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function exitPreview() : void
|
||||
{
|
||||
onBackBtn(null);
|
||||
}
|
||||
|
||||
private function handlePartyAndCustomCreateVisibility(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
PartyManager.showPartyPopup(true);
|
||||
if(_createPopup)
|
||||
{
|
||||
_createPopup.showPopup(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onHostAndBackBtnsLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_hostAndBackBtns = param1;
|
||||
_hostAndBackBtns.backBtn.addEventListener("mouseDown",onBackBtn,false,0,true);
|
||||
_hostAndBackBtns.buyBtn.addEventListener("mouseDown",onHostBtn,false,0,true);
|
||||
_hostAndBackBtns.buyBtn.visible = false;
|
||||
LocalizationManager.translateId(_hostAndBackBtns.buyBtn.mouse.mouse.txt,24223,false,false);
|
||||
LocalizationManager.translateId(_hostAndBackBtns.buyBtn.mouse.up.txt,24223,false,false);
|
||||
LocalizationManager.translateId(_hostAndBackBtns.buyBtn.down.txt,24223,false,false);
|
||||
GuiManager.guiLayer.addChild(_hostAndBackBtns);
|
||||
}
|
||||
}
|
||||
|
||||
private function onBackBtn(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(_hostAndBackBtns && _hostAndBackBtns.visible)
|
||||
{
|
||||
RoomManagerWorld.instance.reloadCurrentNormalRoom();
|
||||
_hostAndBackBtns.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function onHostBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_createPopup)
|
||||
{
|
||||
_createPopup.tryToHostPartyFromPreview();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package gui
|
||||
{
|
||||
import diamond.DiamondXtCommManager;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import loader.MediaHelper;
|
||||
import pet.PetItem;
|
||||
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("mouseDown",onPopup);
|
||||
_popup.bx.removeEventListener("mouseDown",onClose);
|
||||
_popup.adoptBtn.removeEventListener("mouseDown",onAdoptBtn);
|
||||
DarkenManager.unDarken(_popup);
|
||||
if(_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("mouseDown",onPopup,false,0,true);
|
||||
_popup.bx.addEventListener("mouseDown",onClose,false,0,true);
|
||||
_popup.adoptBtn.addEventListener("mouseDown",onAdoptBtn,false,0,true);
|
||||
_popup.x = 900 * 0.5;
|
||||
_popup.y = 550 * 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_:PetItem = new PetItem();
|
||||
_loc2_.diamondItem = DiamondXtCommManager.getDiamondItem(_diamondPetDef);
|
||||
if(_loc2_.diamondItem)
|
||||
{
|
||||
PetManager.openPetFinder(PetManager.petNameForDefId(_loc2_.diamondItem.refDefId),onPetFinderClose,false,null,_loc2_,3,214);
|
||||
}
|
||||
}
|
||||
|
||||
private static function onPetFinderClose() : void
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,688 @@
|
||||
package gui
|
||||
{
|
||||
import Party.PartyManager;
|
||||
import adoptAPet.AdoptAPetManager;
|
||||
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 gui.itemWindows.ItemWindowPets;
|
||||
import gui.jazwares.CheckListPopup;
|
||||
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 _closeCallback:Function;
|
||||
|
||||
private var _petList:Array;
|
||||
|
||||
private var _inventoryMC:MovieClip;
|
||||
|
||||
private var _loadingMediaHelper:MediaHelper;
|
||||
|
||||
private var _loadingSpiralBig:LoadingSpiral;
|
||||
|
||||
private var _bigPet:GuiPet;
|
||||
|
||||
private var _itemWindows:WindowAndScrollbarGenerator;
|
||||
|
||||
private var _shop:Shop;
|
||||
|
||||
private var _checkListPopup:CheckListPopup;
|
||||
|
||||
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 _previousPetInvId:int;
|
||||
|
||||
private var _petIndexBeingDeleted:int;
|
||||
|
||||
private var _openCheckListImmediately:Boolean;
|
||||
|
||||
public function PetInventory()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:Function, param2:Boolean = false, param3:Boolean = false) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
_closeCallback = param1;
|
||||
_petList = PetManager.myPetList.concat();
|
||||
_idx = -1;
|
||||
_currSelectedIdx = -1;
|
||||
_recycleOneOnly = param2;
|
||||
_openCheckListImmediately = param3;
|
||||
_loadingSpiralBig = new LoadingSpiral();
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("/game/play/popup/pet/inventory");
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(993,onMediaItemLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
removeEventListeners();
|
||||
DarkenManager.unDarken(_inventoryMC);
|
||||
_guiLayer.removeChild(_inventoryMC);
|
||||
SBTracker.pop();
|
||||
onCheckListClose();
|
||||
_activePetModified = false;
|
||||
_noCurrentActivePet = false;
|
||||
_idx = -1;
|
||||
_initialPetInvId = -1;
|
||||
_currSelectedIdx = -1;
|
||||
_isRecycling = false;
|
||||
_inventoryMC = null;
|
||||
_petList = null;
|
||||
if(_bigPet)
|
||||
{
|
||||
_bigPet.destroy();
|
||||
_bigPet = null;
|
||||
}
|
||||
if(_itemWindows)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
if(_recycleOneOnly)
|
||||
{
|
||||
_closeCallback(_hasRecycled);
|
||||
}
|
||||
else
|
||||
{
|
||||
_closeCallback();
|
||||
}
|
||||
_closeCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaItemLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:Object = null;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param1)
|
||||
{
|
||||
_inventoryMC = MovieClip(param1.getChildAt(0));
|
||||
_inventoryMC.petNameTxt.text = "";
|
||||
_inventoryMC.itemCounter.counterTxt.text = "0/" + PetManager.getPetInventoryMax();
|
||||
_inventoryMC.bMastery.visible = false;
|
||||
_loadingMediaHelper.destroy();
|
||||
_loadingMediaHelper = null;
|
||||
_inventoryMC.helpBubble.visible = false;
|
||||
if(AvatarManager.roomEnviroType == 1)
|
||||
{
|
||||
_inventoryMC.shopBtn.visible = false;
|
||||
}
|
||||
if(AdoptAPetManager.hasAtLeastOneUsableAdoptAPet)
|
||||
{
|
||||
_inventoryMC.checklistBtn.visible = true;
|
||||
_inventoryMC.newBurst.visible = AdoptAPetManager.hasUnseenPetData;
|
||||
}
|
||||
else
|
||||
{
|
||||
_inventoryMC.checklistBtn.visible = false;
|
||||
_inventoryMC.newBurst.visible = false;
|
||||
}
|
||||
if(_petList && _petList.length > 0)
|
||||
{
|
||||
if(PetManager.myActivePetInvId != 0)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _petList.length)
|
||||
{
|
||||
if(_petList[_loc2_].idx == PetManager.myActivePetInvId)
|
||||
{
|
||||
_currSelectedIdx = _loc2_;
|
||||
_initialPetInvId = _petList[_loc2_].idx;
|
||||
if(PetManager.canCurrAvatarUsePet(AvatarManager.playerAvatar.enviroTypeFlag,_petList[_loc2_].type))
|
||||
{
|
||||
_loc3_ = _petList[_loc2_];
|
||||
_bigPet = new GuiPet(_loc3_.idx,_loc3_.lBits,_loc3_.uBits,_loc3_.eBits,_loc3_.type,_loc3_.name,onBigPetLoaded);
|
||||
_inventoryMC.itemWindowPet.addChild(_bigPet);
|
||||
_inventoryMC.petNameTxt.text = _bigPet.petName;
|
||||
_inventoryMC.butterfly.visible = false;
|
||||
if(_loc3_.masteryCounter >= 100)
|
||||
{
|
||||
_inventoryMC.bMastery.visible = true;
|
||||
_inventoryMC.bMastery.icon.gotoAndStop(PetManager.petNameForDefId(_loc3_.defId) + "1");
|
||||
if((_loc3_.uBits >> 8 & 0x0F) > 0)
|
||||
{
|
||||
_inventoryMC.bMastery.mouse.visible = false;
|
||||
_inventoryMC.bMastery.down.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
_inventoryMC.itemCounter.counterTxt.text = _petList.length + "/" + PetManager.getPetInventoryMax();
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_inventoryMC.x = 900 * 0.5;
|
||||
_inventoryMC.y = 550 * 0.5;
|
||||
_guiLayer.addChild(_inventoryMC);
|
||||
DarkenManager.darken(_inventoryMC);
|
||||
createItemWindows();
|
||||
addEventListeners();
|
||||
if(_openCheckListImmediately)
|
||||
{
|
||||
onChecklistBtn(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onBigPetLoaded(param1:MovieClip, param2:GuiPet) : void
|
||||
{
|
||||
_bigPet.scaleX = _bigPet.scaleY = 5;
|
||||
_bigPet.y += 83;
|
||||
}
|
||||
|
||||
private function createItemWindows() : void
|
||||
{
|
||||
if(_itemWindows)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
while(_inventoryMC.itemWindow.numChildren > 1)
|
||||
{
|
||||
_inventoryMC.itemWindow.removeChildAt(_inventoryMC.itemWindow.numChildren - 1);
|
||||
}
|
||||
var _loc2_:int = int(_petList.length);
|
||||
var _loc3_:Number = Math.min(PetManager.getPetInventoryMax(),4);
|
||||
var _loc1_:int = Math.ceil(_loc3_ / 5);
|
||||
_itemWindows = new WindowAndScrollbarGenerator();
|
||||
_itemWindows.init(_inventoryMC.itemWindow.width,_inventoryMC.itemWindow.height,4,0,_loc3_,_loc1_,PetManager.getPetInventoryMax(),2,2,1,0.5,ItemWindowPets,_petList,"",0,{
|
||||
"mouseDown":winMouseDown,
|
||||
"mouseOver":winMouseOver,
|
||||
"mouseOut":winMouseOut
|
||||
},{"isRecycling":_isRecycling || _recycleOneOnly},null,false,false,false);
|
||||
_inventoryMC.itemWindow.addChild(_itemWindows);
|
||||
_loadingSpiralBig.visible = false;
|
||||
}
|
||||
|
||||
private function onConfirmFreePet(param1:Object) : void
|
||||
{
|
||||
if(param1.status)
|
||||
{
|
||||
_petIndexBeingDeleted = param1.passback;
|
||||
PetXtCommManager.sendPetDismissRequest(_petList[param1.passback].idx,freePetCallback);
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
}
|
||||
}
|
||||
|
||||
private function freePetCallback(param1:Boolean, param2:Boolean, param3:Boolean) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param1)
|
||||
{
|
||||
if(param2)
|
||||
{
|
||||
SBTracker.trackPageview("/game/play/popup/pet/petInventory/free");
|
||||
_idx = _idx - 1;
|
||||
_currSelectedIdx = _currSelectedIdx - 1;
|
||||
_hasRecycled = true;
|
||||
if(param3)
|
||||
{
|
||||
AvatarManager.playerAvatarWorldView.setActivePet(0,0,0,"");
|
||||
_activePetModified = true;
|
||||
while(_inventoryMC.itemWindowPet.numChildren > 0)
|
||||
{
|
||||
_inventoryMC.itemWindowPet.removeChildAt(0);
|
||||
}
|
||||
_inventoryMC.petNameTxt.text = "";
|
||||
_inventoryMC.butterfly.visible = true;
|
||||
_idx = -1;
|
||||
_currSelectedIdx = -1;
|
||||
}
|
||||
if(!_recycleOneOnly)
|
||||
{
|
||||
_itemWindows.deleteItem(_petIndexBeingDeleted,_petList);
|
||||
_inventoryMC.itemCounter.counterTxt.text = _petList.length + "/" + PetManager.getPetInventoryMax();
|
||||
_noCurrentActivePet = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14786));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onPetSwitch(param1:Boolean = true) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param1)
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
PetManager.myActivePetInvId = _previousPetInvId;
|
||||
reloadPets();
|
||||
}
|
||||
}
|
||||
|
||||
private function winMouseDown(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:MovieClip = null;
|
||||
var _loc4_:Object = null;
|
||||
param1.stopPropagation();
|
||||
if((_isRecycling || _recycleOneOnly) && param1.currentTarget.cageIcon.visible)
|
||||
{
|
||||
if(!(PetManager.canCurrAvatarUsePet(AvatarManager.playerAvatar.enviroTypeFlag,_petList[param1.currentTarget.index].type) && PetManager.myActivePetInvId == _petList[param1.currentTarget.index].idx && !PartyManager.canSwitchPet(true)))
|
||||
{
|
||||
new SBYesNoPopup(_guiLayer,LocalizationManager.translateIdOnly(14787),true,onConfirmFreePet,param1.currentTarget.index);
|
||||
}
|
||||
}
|
||||
else if(param1.currentTarget.newPetIcon.visible)
|
||||
{
|
||||
PetManager.openPetFinder("",onPetSwitch);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(param1.currentTarget.gray.visible)
|
||||
{
|
||||
if(!gMainFrame.userInfo.isMember)
|
||||
{
|
||||
UpsellManager.displayPopup("pets","equipMemberPet");
|
||||
}
|
||||
return;
|
||||
}
|
||||
while(_inventoryMC.itemWindowPet.numChildren > 0)
|
||||
{
|
||||
_inventoryMC.itemWindowPet.removeChildAt(0);
|
||||
}
|
||||
_idx = param1.currentTarget.index;
|
||||
_currSelectedIdx = _idx;
|
||||
if((param1.currentTarget.cir.currentFrameLabel == "downMouse" || param1.currentTarget.cir.currentFrameLabel == "down") && PartyManager.canSwitchPet(true))
|
||||
{
|
||||
param1.currentTarget.cir.gotoAndStop("up");
|
||||
if(_initialPetInvId == 0)
|
||||
{
|
||||
_idx = -1;
|
||||
}
|
||||
PetManager.myActivePetInvId = 0;
|
||||
GuiManager.resetPetWindowListAndUpdateBtns();
|
||||
_activePetModified = false;
|
||||
_inventoryMC.petNameTxt.text = "";
|
||||
_inventoryMC.butterfly.visible = true;
|
||||
_inventoryMC.bMastery.visible = false;
|
||||
_bigPet.destroy();
|
||||
_bigPet = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_activePetModified = true;
|
||||
_noCurrentActivePet = false;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _petList.length)
|
||||
{
|
||||
_loc2_ = MovieClip(_itemWindows.bg.getChildAt(_loc3_));
|
||||
_loc2_.cir.gotoAndStop("up");
|
||||
_loc3_++;
|
||||
}
|
||||
param1.currentTarget.cir.gotoAndStop("downMouse");
|
||||
_loc4_ = _petList[_idx];
|
||||
_bigPet = new GuiPet(_loc4_.idx,_loc4_.lBits,_loc4_.uBits,_loc4_.eBits,_loc4_.type,_loc4_.name,onBigPetLoaded);
|
||||
_inventoryMC.itemWindowPet.addChild(_bigPet);
|
||||
_inventoryMC.petNameTxt.text = _bigPet.petName;
|
||||
_inventoryMC.butterfly.visible = false;
|
||||
if(_loc4_.masteryCounter >= 100)
|
||||
{
|
||||
_inventoryMC.bMastery.visible = true;
|
||||
_inventoryMC.bMastery.icon.gotoAndStop(PetManager.petNameForDefId(_loc4_.defId) + "1");
|
||||
if((_loc4_.uBits >> 8 & 0x0F) > 0)
|
||||
{
|
||||
_inventoryMC.bMastery.mouse.visible = false;
|
||||
_inventoryMC.bMastery.down.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_inventoryMC.bMastery.mouse.visible = true;
|
||||
_inventoryMC.bMastery.down.visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_inventoryMC.bMastery.visible = false;
|
||||
_inventoryMC.bMastery.mouse.visible = true;
|
||||
_inventoryMC.bMastery.down.visible = false;
|
||||
}
|
||||
_previousPetInvId = PetManager.myActivePetInvId;
|
||||
if(_initialPetInvId == _loc4_.idx)
|
||||
{
|
||||
_idx = -1;
|
||||
PetManager.myActivePetInvId = _initialPetInvId;
|
||||
}
|
||||
else
|
||||
{
|
||||
PetManager.myActivePetInvId = _loc4_.idx;
|
||||
}
|
||||
GuiManager.resetPetWindowListAndUpdateBtns();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function winMouseOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.hasPet)
|
||||
{
|
||||
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.hasPet)
|
||||
{
|
||||
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 _loc3_:int = 0;
|
||||
var _loc2_:* = null;
|
||||
param1.stopPropagation();
|
||||
if(_isRecycling)
|
||||
{
|
||||
_isRecycling = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isRecycling = true;
|
||||
}
|
||||
_itemWindows.callUpdateInWindowWithInput({"isRecycling":_isRecycling});
|
||||
}
|
||||
|
||||
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 _loc6_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
param1.stopPropagation();
|
||||
var _loc4_:Object = _petList[_currSelectedIdx];
|
||||
if(_loc4_ != null)
|
||||
{
|
||||
_loc6_ = _loc4_.uBits >> 8 & 0x0F;
|
||||
if(_loc6_ > 0)
|
||||
{
|
||||
_loc6_ = 0;
|
||||
param1.currentTarget.mouse.visible = true;
|
||||
param1.currentTarget.down.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc6_ = 1;
|
||||
param1.currentTarget.mouse.visible = false;
|
||||
param1.currentTarget.down.visible = true;
|
||||
}
|
||||
_loc5_ = int(_loc4_.uBits);
|
||||
_loc8_ = _loc5_ & 0x0F;
|
||||
_loc9_ = _loc5_ >> 4 & 0x0F;
|
||||
_loc7_ = _loc5_ >> 12 & 0x0F;
|
||||
_loc2_ = _loc5_ >> 16 & 0x0F;
|
||||
_loc3_ = _loc5_ >> 20 & 0x0F;
|
||||
_loc5_ = _loc3_ << 20 | _loc2_ << 16 | _loc7_ << 12 | _loc6_ << 8 | _loc9_ << 4 | _loc8_;
|
||||
_loc4_.uBits = _loc6_ << 8 | _loc5_;
|
||||
_itemWindows.callUpdateOnWindowWithInput(_currSelectedIdx,{"petObject":_loc4_});
|
||||
_bigPet.updateAllBits(_loc4_.lBits,_loc4_.uBits,_loc4_.eBits);
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
PetXtCommManager.sendPetMasteryRequest(_loc6_,_loc4_.idx);
|
||||
}
|
||||
}
|
||||
|
||||
private function updateActivePet(param1:Boolean = false) : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
var _loc2_:Function = null;
|
||||
if(param1)
|
||||
{
|
||||
_loc2_ = onPetUpdate;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = onPetSwitch;
|
||||
}
|
||||
if(_idx > -1)
|
||||
{
|
||||
if(_petList && _petList.length > 0)
|
||||
{
|
||||
_loc3_ = _petList[_idx];
|
||||
if(_loc3_ != null)
|
||||
{
|
||||
if(_activePetModified)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
PetXtCommManager.sendPetSwitchRequest(_loc3_.idx,_loc2_);
|
||||
_activePetModified = false;
|
||||
return;
|
||||
}
|
||||
if(PetManager.myActivePetInvId == 0 && MovieClip(_itemWindows.bg.getChildAt(_idx)).cir.currentFrameLabel == "up" && !_noCurrentActivePet)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
PetXtCommManager.sendPetSwitchRequest(0,_loc2_);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(AvatarManager.playerAvatarWorldView.getActivePet() != null)
|
||||
{
|
||||
if(_bigPet == null)
|
||||
{
|
||||
AvatarManager.playerAvatarWorldView.setActivePet(0,0,0,"");
|
||||
}
|
||||
else
|
||||
{
|
||||
AvatarManager.playerAvatarWorldView.setActivePet(_bigPet.getLBits(),_bigPet.getUBits(),_bigPet.getEBits(),_bigPet.petName);
|
||||
}
|
||||
}
|
||||
if(!param1)
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_(true);
|
||||
}
|
||||
}
|
||||
|
||||
private function reloadPets() : void
|
||||
{
|
||||
_petList = PetManager.myPetList.concat();
|
||||
while(_inventoryMC.itemWindowPet.numChildren > 0)
|
||||
{
|
||||
_inventoryMC.itemWindowPet.removeChildAt(0);
|
||||
}
|
||||
var _loc1_:Object = PetManager.myActivePet;
|
||||
if(_bigPet)
|
||||
{
|
||||
_bigPet = new GuiPet(_loc1_.idx,_loc1_.lBits,_loc1_.uBits,_loc1_.eBits,_loc1_.type,_loc1_.name,onBigPetLoaded);
|
||||
_inventoryMC.itemWindowPet.addChild(_bigPet);
|
||||
_inventoryMC.petNameTxt.text = _bigPet.petName;
|
||||
}
|
||||
_inventoryMC.butterfly.visible = false;
|
||||
createItemWindows();
|
||||
if(_bigPet && AvatarManager.playerAvatarWorldView.getActivePet() != null)
|
||||
{
|
||||
AvatarManager.playerAvatarWorldView.setActivePet(_bigPet.getLBits(),_bigPet.getUBits(),_bigPet.getEBits(),_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,reloadPets);
|
||||
}
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
updateActivePet();
|
||||
}
|
||||
|
||||
private function onShopBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_shop = new Shop();
|
||||
if(AvatarManager.roomEnviroType == 1)
|
||||
{
|
||||
_shop.init(89,1030,AvatarManager.playerAvatar,_guiLayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
_shop.init(85,1030,AvatarManager.playerAvatar,_guiLayer);
|
||||
}
|
||||
}
|
||||
|
||||
private function onSalonBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
updateActivePet(true);
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onChecklistBtn(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(_checkListPopup)
|
||||
{
|
||||
onCheckListClose();
|
||||
}
|
||||
_checkListPopup = new CheckListPopup();
|
||||
_checkListPopup.init(onCheckListClose);
|
||||
}
|
||||
|
||||
private function onCheckListClose() : void
|
||||
{
|
||||
if(_checkListPopup)
|
||||
{
|
||||
_checkListPopup.destroy();
|
||||
_checkListPopup = null;
|
||||
}
|
||||
_inventoryMC.newBurst.visible = AdoptAPetManager.hasUnseenPetData;
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_inventoryMC.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_inventoryMC.bx.addEventListener("mouseDown",onClose,false,0,true);
|
||||
_inventoryMC.cageBtn.addEventListener("mouseDown",onCageBtn,false,0,true);
|
||||
_inventoryMC.cageBtn.addEventListener("mouseOver",onCageOverBtn,false,0,true);
|
||||
_inventoryMC.cageBtn.addEventListener("mouseOut",onCageOutBtn,false,0,true);
|
||||
_inventoryMC.bMastery.addEventListener("mouseDown",onMasteryBtn,false,0,true);
|
||||
_inventoryMC.shopBtn.addEventListener("mouseDown",onShopBtn,false,0,true);
|
||||
_inventoryMC.salonBtn.addEventListener("mouseDown",onSalonBtn,false,0,true);
|
||||
_inventoryMC.checklistBtn.addEventListener("mouseDown",onChecklistBtn,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_inventoryMC.removeEventListener("mouseDown",onPopup);
|
||||
_inventoryMC.bx.removeEventListener("mouseDown",onClose);
|
||||
_inventoryMC.cageBtn.removeEventListener("mouseDown",onCageBtn);
|
||||
_inventoryMC.cageBtn.removeEventListener("mouseOver",onCageOverBtn);
|
||||
_inventoryMC.cageBtn.removeEventListener("mouseOut",onCageOutBtn);
|
||||
_inventoryMC.bMastery.removeEventListener("mouseDown",onMasteryBtn);
|
||||
_inventoryMC.shopBtn.removeEventListener("mouseDown",onShopBtn);
|
||||
_inventoryMC.salonBtn.removeEventListener("mouseDown",onSalonBtn);
|
||||
_inventoryMC.checklistBtn.removeEventListener("mouseDown",onChecklistBtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
}
|
||||
|
||||
public function displayMasteryPopup() : void
|
||||
{
|
||||
if(_masteryPopup)
|
||||
{
|
||||
setupInitialConditions();
|
||||
_guiLayer.addChild(_masteryPopup);
|
||||
DarkenManager.darken(_masteryPopup);
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(1381,onMediaLoaded);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_masteryPopup = MovieClip(param1.getChildAt(0));
|
||||
setupInitialConditions();
|
||||
_masteryPopup.x = 900 * 0.5;
|
||||
_masteryPopup.y = 550 * 0.5;
|
||||
_guiLayer.addChild(_masteryPopup);
|
||||
DarkenManager.darken(_masteryPopup);
|
||||
addEventListeners();
|
||||
}
|
||||
}
|
||||
|
||||
private function setupInitialConditions() : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:Object = PetManager.myActivePet;
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc5_ = 1;
|
||||
_loc4_ = int(_loc3_.uBits);
|
||||
_loc7_ = _loc4_ & 0x0F;
|
||||
_loc8_ = _loc4_ >> 4 & 0x0F;
|
||||
_loc6_ = _loc4_ >> 12 & 0x0F;
|
||||
_loc1_ = _loc4_ >> 16 & 0x0F;
|
||||
_loc2_ = _loc4_ >> 20 & 0x0F;
|
||||
_loc4_ = _loc2_ << 20 | _loc1_ << 16 | _loc6_ << 12 | _loc5_ << 8 | _loc8_ << 4 | _loc7_;
|
||||
_loc3_.uBits = _loc5_ << 8 | _loc4_;
|
||||
_currPet = new GuiPet(_loc3_.idx,_loc3_.lBits,_loc3_.uBits,_loc3_.eBits,_loc3_.type,_loc3_.name,onPetLoaded);
|
||||
while(_masteryPopup.itemBlock.numChildren > 0)
|
||||
{
|
||||
_masteryPopup.itemBlock.removeChildAt(0);
|
||||
}
|
||||
_masteryPopup.itemBlock.addChild(_currPet);
|
||||
AvatarManager.playerAvatarWorldView.setActivePet(_currPet.getLBits(),_currPet.getUBits(),_currPet.getEBits(),_currPet.name);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPetLoaded(param1:MovieClip, param2:GuiPet) : void
|
||||
{
|
||||
_currPet.scaleX = _currPet.scaleY = 2.5;
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onMasteryClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
DarkenManager.unDarken(_masteryPopup);
|
||||
_guiLayer.removeChild(_masteryPopup);
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_masteryPopup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_masteryPopup.xb.addEventListener("mouseDown",onMasteryClose,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_masteryPopup.removeEventListener("mouseDown",onPopup);
|
||||
_masteryPopup.xb.removeEventListener("mouseDown",onMasteryClose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,792 @@
|
||||
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 currency.UserCurrency;
|
||||
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);
|
||||
_closeCallback = param1;
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(2017,onMediaLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
SBTracker.trackPageview("/game/play/popup/photobooth/exit");
|
||||
KeepAlive.stopKATimer(_booth);
|
||||
SafeChatManager.destroy(_booth.chatTree);
|
||||
removeEventListeners();
|
||||
DarkenManager.unDarken(_booth);
|
||||
_guiLayer.removeChild(_booth);
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param1)
|
||||
{
|
||||
SBTracker.trackPageview("/game/play/popup/photobooth/enter");
|
||||
_booth = MovieClip(param1.getChildAt(0));
|
||||
KeepAlive.startKATimer(_booth);
|
||||
initializeNeededItems();
|
||||
positionAndDrawAvatarView(true);
|
||||
showHudAvt();
|
||||
loadPetView();
|
||||
addEventListeners();
|
||||
_booth.x = 900 * 0.5;
|
||||
_booth.y = 550 * 0.5;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_guiLayer.addChild(_booth);
|
||||
DarkenManager.darken(_booth);
|
||||
}
|
||||
}
|
||||
|
||||
private function initializeNeededItems() : void
|
||||
{
|
||||
_numBackgroundFrames = _booth.imageCont.backgroundCont.totalFrames;
|
||||
_currBackgroundFrame = 1;
|
||||
_petPosIndex = -1;
|
||||
_booth.imageCont.msgTxt.filters = [new GlowFilter(16777215)];
|
||||
_booth.imageCont.petLShadow.visible = false;
|
||||
_booth.imageCont.petRShadow.visible = false;
|
||||
_booth.posBtn.activateGrayState(true);
|
||||
_booth.avtBtn.visible = false;
|
||||
SafeChatManager.buildSafeChatTree(_booth.chatTree,"ECardTextTreeNode",3,onTextClose,null);
|
||||
SafeChatManager.closeSafeChat(_booth.chatTree);
|
||||
_booth.imageCont.chatBalloon.visible = false;
|
||||
_booth.textBtn.currTxt.text = SafeChatManager.photoBoothNodes[0];
|
||||
_booth.imageCont.msgTxt.text = SafeChatManager.photoBoothNodes[0];
|
||||
_booth.imageCont.chatBalloon.closeChatBtn.visible = false;
|
||||
_booth.bubbleLockToggle.toggleBtn.gotoAndStop("startingOff");
|
||||
_booth.bubbleLockToggle.toggleBtn.toggleKnob.gotoAndStop("up");
|
||||
_booth.bubbleLockToggle.toggleBtn.toggleBG.gotoAndStop("up");
|
||||
_loadingSpiralAvt = new LoadingSpiral(_booth.imageCont.charBox);
|
||||
}
|
||||
|
||||
private function positionAndDrawAvatarView(param1:Boolean = false) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(_currAvtView)
|
||||
{
|
||||
_startingFrame = _currAvtView.frame;
|
||||
if(_currAvtView.parent)
|
||||
{
|
||||
_booth.imageCont.charBox.removeChild(_currAvtView);
|
||||
}
|
||||
}
|
||||
_loadingSpiralAvt.setNewParent(_booth.imageCont.charBox);
|
||||
_loadingSpiralAvt.visible = true;
|
||||
_currAvtView = new AvatarEditorView();
|
||||
_currAvtView.init(AvatarManager.playerAvatar);
|
||||
}
|
||||
var _loc2_:Point = AvatarUtility.getAvatarPhotoOffset(_currAvtView.avTypeId);
|
||||
_currAvtView.x = _loc2_.x;
|
||||
_currAvtView.y = _loc2_.y;
|
||||
_currAvtView.visible = false;
|
||||
_currAvtView.playAnim(42,false,0,onAvatarLoaded);
|
||||
_currAvtView.scaleX = 626 / 1024;
|
||||
_currAvtView.scaleY = 470 / 768;
|
||||
_booth.imageCont.charBox.addChild(_currAvtView);
|
||||
}
|
||||
|
||||
private function loadPetView() : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:Object = null;
|
||||
var _loc1_:Array = PetManager.myPetList;
|
||||
_myPet = null;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _loc1_.length)
|
||||
{
|
||||
if(_loc1_[_loc2_].idx == PetManager.myActivePetInvId)
|
||||
{
|
||||
_loc3_ = _loc1_[_loc2_];
|
||||
if(PetManager.canCurrAvatarUsePet(AvatarManager.playerAvatar.enviroTypeFlag,_loc3_.type))
|
||||
{
|
||||
_booth.posBtn.activateGrayState(false);
|
||||
_myPet = new GuiPet(_loc3_.idx,_loc3_.lBits,_loc3_.uBits,_loc3_.eBits,_loc3_.type,_loc3_.name,onPetLoaded);
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
if(_myPet == null)
|
||||
{
|
||||
_booth.posBtn.activateGrayState(true);
|
||||
while(_booth.imageCont.itemWindowPet2R.numChildren > 0)
|
||||
{
|
||||
_booth.imageCont.itemWindowPet2R.removeChildAt(0);
|
||||
}
|
||||
while(_booth.imageCont.itemWindowPet1R.numChildren > 0)
|
||||
{
|
||||
_booth.imageCont.itemWindowPet1R.removeChildAt(0);
|
||||
}
|
||||
while(_booth.imageCont.itemWindowPet2L.numChildren > 0)
|
||||
{
|
||||
_booth.imageCont.itemWindowPet2L.removeChildAt(0);
|
||||
}
|
||||
while(_booth.imageCont.itemWindowPet1L.numChildren > 0)
|
||||
{
|
||||
_booth.imageCont.itemWindowPet1L.removeChildAt(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
with(_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(_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
|
||||
{
|
||||
_booth.textBtn.currTxt.text = param1;
|
||||
_booth.imageCont.msgTxt.text = param1;
|
||||
setTextVisibility();
|
||||
SafeChatManager.closeSafeChat(_booth.chatTree);
|
||||
}
|
||||
|
||||
private function completeSaveAction() : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true,true);
|
||||
var _loc1_:BitmapData = new BitmapData(1024,768);
|
||||
var _loc2_:Matrix = new Matrix(1024 / 626,0,0,768 / 470,0,0);
|
||||
_loc1_.draw(_booth.imageCont,_loc2_,null,null,null,true);
|
||||
_jpgEncoder = new JpegAsynchEncoder();
|
||||
_jpgEncoder.addEventListener("JPEGAsyncComplete",asyncEncodingComplete,false,0,true);
|
||||
_jpgEncoder.addEventListener("progress",onEncodingProgress,false,0,true);
|
||||
_jpgEncoder.PixelsPerIteration = 128;
|
||||
_jpgEncoder.JPEGAsyncEncoder(100);
|
||||
_jpgEncoder.encode(_loc1_);
|
||||
}
|
||||
|
||||
private function showHudAvt() : void
|
||||
{
|
||||
var _loc2_:Avatar = AvatarManager.playerAvatar;
|
||||
if(_hudAvtView)
|
||||
{
|
||||
if(_hudAvtView.parent == _booth.char.charLayer)
|
||||
{
|
||||
_booth.char.charLayer.removeChild(_hudAvtView);
|
||||
}
|
||||
_hudAvtView.destroy();
|
||||
}
|
||||
_hudAvtView = new AvatarView();
|
||||
_hudAvtView.init(_loc2_,null,onHudViewChanged);
|
||||
_hudAvtView.playAnim(15,false,1,null,true);
|
||||
var _loc1_:Point = AvatarUtility.getAvatarHudPosition(_hudAvtView.avTypeId);
|
||||
_hudAvtView.x = _loc1_.x;
|
||||
_hudAvtView.y = _loc1_.y;
|
||||
_booth.char.charLayer.addChild(_hudAvtView);
|
||||
}
|
||||
|
||||
private function onHudViewChanged(param1:AvatarView) : void
|
||||
{
|
||||
if(_hudAvtView)
|
||||
{
|
||||
_hudAvtView.playAnim(15,false,1,null,true);
|
||||
}
|
||||
}
|
||||
|
||||
private function setTextVisibility() : void
|
||||
{
|
||||
if(_booth.bubbleLockToggle.toggleBtn.currentFrameLabel == "on" || _booth.bubbleLockToggle.toggleBtn.currentFrameLabel == "startingOn")
|
||||
{
|
||||
_booth.imageCont.msgTxt.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_booth.imageCont.msgTxt.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
private function addPetToCorrectSpot(param1:int, param2:Boolean = false) : void
|
||||
{
|
||||
var _loc4_:Matrix = null;
|
||||
if(param1 > 3)
|
||||
{
|
||||
param1 = 0;
|
||||
}
|
||||
var _loc3_:int = param1;
|
||||
if(param2)
|
||||
{
|
||||
if(param1 % 2 != 0)
|
||||
{
|
||||
_loc3_ = param1 - 1;
|
||||
}
|
||||
}
|
||||
switch(_loc3_)
|
||||
{
|
||||
case 0:
|
||||
while(_booth.imageCont.itemWindowPet2R.numChildren > 0)
|
||||
{
|
||||
_booth.imageCont.itemWindowPet2R.removeChildAt(0);
|
||||
}
|
||||
while(_booth.imageCont.itemWindowPet1R.numChildren > 0)
|
||||
{
|
||||
_booth.imageCont.itemWindowPet1R.removeChildAt(0);
|
||||
}
|
||||
while(_booth.imageCont.itemWindowPet2L.numChildren > 0)
|
||||
{
|
||||
_booth.imageCont.itemWindowPet2L.removeChildAt(0);
|
||||
}
|
||||
while(_booth.imageCont.itemWindowPet1L.numChildren > 0)
|
||||
{
|
||||
_booth.imageCont.itemWindowPet1L.removeChildAt(0);
|
||||
}
|
||||
if(_myPet.isGround())
|
||||
{
|
||||
_booth.imageCont.itemWindowPet2L.addChild(_myPet);
|
||||
}
|
||||
else
|
||||
{
|
||||
_booth.imageCont.itemWindowPet1L.addChild(_myPet);
|
||||
}
|
||||
if(_loc3_ == param1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
_loc4_ = _myPet.transform.matrix;
|
||||
_loc4_.scale(-1,1);
|
||||
_myPet.transform.matrix = _loc4_;
|
||||
break;
|
||||
case 2:
|
||||
while(_booth.imageCont.itemWindowPet2L.numChildren > 0)
|
||||
{
|
||||
_booth.imageCont.itemWindowPet2L.removeChildAt(0);
|
||||
}
|
||||
while(_booth.imageCont.itemWindowPet1L.numChildren > 0)
|
||||
{
|
||||
_booth.imageCont.itemWindowPet1L.removeChildAt(0);
|
||||
}
|
||||
while(_booth.imageCont.itemWindowPet2R.numChildren > 0)
|
||||
{
|
||||
_booth.imageCont.itemWindowPet2R.removeChildAt(0);
|
||||
}
|
||||
while(_booth.imageCont.itemWindowPet1R.numChildren > 0)
|
||||
{
|
||||
_booth.imageCont.itemWindowPet1R.removeChildAt(0);
|
||||
}
|
||||
if(_myPet.isGround())
|
||||
{
|
||||
_booth.imageCont.itemWindowPet2R.addChild(_myPet);
|
||||
}
|
||||
else
|
||||
{
|
||||
_booth.imageCont.itemWindowPet1R.addChild(_myPet);
|
||||
}
|
||||
if(_loc3_ == param1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
_loc4_ = _myPet.transform.matrix;
|
||||
_loc4_.scale(-1,1);
|
||||
_myPet.transform.matrix = _loc4_;
|
||||
}
|
||||
_petPosIndex = param1;
|
||||
}
|
||||
|
||||
private function loadDebugAvatar(param1:Avatar) : void
|
||||
{
|
||||
if(_currAvtView)
|
||||
{
|
||||
_startingFrame = _currAvtView.frame;
|
||||
if(_currAvtView.parent)
|
||||
{
|
||||
_booth.imageCont.charBox.removeChild(_currAvtView);
|
||||
}
|
||||
}
|
||||
_loadingSpiralAvt.setNewParent(_booth.imageCont.charBox);
|
||||
_loadingSpiralAvt.visible = true;
|
||||
_currAvtView = new AvatarEditorView();
|
||||
_currAvtView.init(param1);
|
||||
var _loc2_:Point = AvatarUtility.getAvatarPhotoOffset(_currAvtView.avTypeId);
|
||||
_currAvtView.x = _loc2_.x;
|
||||
_currAvtView.y = _loc2_.y;
|
||||
_currAvtView.visible = false;
|
||||
_currAvtView.playAnim(42,false,0,onAvatarLoaded);
|
||||
_currAvtView.scaleX = 626 / 1024;
|
||||
_currAvtView.scaleY = 470 / 768;
|
||||
_booth.imageCont.charBox.addChild(_currAvtView);
|
||||
}
|
||||
|
||||
private function onAvatarLoaded(param1:LayerAnim, param2:int) : void
|
||||
{
|
||||
var _loc3_:Matrix = null;
|
||||
_currAvtView.visible = true;
|
||||
_currAvtView.pauseAnim(true);
|
||||
_currAvtView.frame = _startingFrame;
|
||||
_loadingSpiralAvt.visible = false;
|
||||
if(_flip)
|
||||
{
|
||||
_loc3_ = _currAvtView.transform.matrix;
|
||||
_loc3_.scale(-1,1);
|
||||
_currAvtView.transform.matrix = _loc3_;
|
||||
}
|
||||
else if(_booth.imageCont.avtShadow.scaleX < 0)
|
||||
{
|
||||
_booth.imageCont.avtShadow.scaleX *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPetLoaded(param1:MovieClip, param2:GuiPet) : void
|
||||
{
|
||||
var _loc3_:Matrix = null;
|
||||
_myPet.scaleX = _myPet.scaleY = 2;
|
||||
if(_petPosIndex < 2)
|
||||
{
|
||||
_loc3_ = _myPet.transform.matrix;
|
||||
_loc3_.scale(-1,1);
|
||||
_myPet.transform.matrix = _loc3_;
|
||||
}
|
||||
addPetToCorrectSpot(_petPosIndex == -1 ? 0 : _petPosIndex,true);
|
||||
}
|
||||
|
||||
private function onAvatarEditorClose() : void
|
||||
{
|
||||
positionAndDrawAvatarView(true);
|
||||
showHudAvt();
|
||||
loadPetView();
|
||||
}
|
||||
|
||||
private function flashComplete() : void
|
||||
{
|
||||
completeSaveAction();
|
||||
}
|
||||
|
||||
private function onSaveImage(param1:Object) : void
|
||||
{
|
||||
if(param1.status)
|
||||
{
|
||||
SBTracker.trackPageview("/game/play/popup/photobooth/imageSaved");
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
AvatarXtCommManager.sendAvatarPhotoTake(onPhotoGemsSpent);
|
||||
_nameSaveIndex = _nameSaveIndex + 1;
|
||||
}
|
||||
}
|
||||
|
||||
private function onPhotoGemsSpent(param1:Object) : void
|
||||
{
|
||||
UserCurrency.setCurrency(int(param1[2]),0);
|
||||
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(onGemsSpent);
|
||||
}
|
||||
}
|
||||
|
||||
private function onGemsSpent(param1:Object) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(param1[2] >= 0)
|
||||
{
|
||||
_booth.flash.playFlash(flashComplete);
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdOnly(14788));
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback();
|
||||
_closeCallback = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
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(_currBackgroundFrame - 1 < 1)
|
||||
{
|
||||
_currBackgroundFrame = _numBackgroundFrames;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currBackgroundFrame = _currBackgroundFrame - 1;
|
||||
}
|
||||
}
|
||||
else if(param1.currentTarget.name == "rightBtn")
|
||||
{
|
||||
if(_currBackgroundFrame + 1 > _numBackgroundFrames)
|
||||
{
|
||||
_currBackgroundFrame = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currBackgroundFrame = _currBackgroundFrame + 1;
|
||||
}
|
||||
}
|
||||
if(_booth.imageCont.backgroundCont.currentLabels[_currBackgroundFrame - 1].name.indexOf("ocean") >= 0)
|
||||
{
|
||||
if(!Utility.isOcean(AvatarManager.playerAvatar.enviroTypeFlag))
|
||||
{
|
||||
onLeftRightBtn(param1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if(!Utility.isLand(AvatarManager.playerAvatar.enviroTypeFlag))
|
||||
{
|
||||
onLeftRightBtn(param1);
|
||||
return;
|
||||
}
|
||||
_booth.imageCont.backgroundCont.gotoAndStop(_currBackgroundFrame);
|
||||
}
|
||||
|
||||
private function onActionPoseBtn(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:Matrix = null;
|
||||
param1.stopPropagation();
|
||||
KeepAlive.inputReceivedHandler(null);
|
||||
SBTracker.trackPageview("/game/play/popup/photobooth/poseBtn");
|
||||
if(_currAvtView)
|
||||
{
|
||||
_loc2_ = _currAvtView.transform.matrix;
|
||||
_loc2_.scale(-1,1);
|
||||
_currAvtView.transform.matrix = _loc2_;
|
||||
_flip = !_flip;
|
||||
_booth.imageCont.avtShadow.scaleX *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
private function onActionPoseOverHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
GuiManager.toolTip.init(_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(_myPet)
|
||||
{
|
||||
addPetToCorrectSpot(_petPosIndex + 1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPetPosOverHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
GuiManager.toolTip.init(_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(!_booth.chatTree.visible)
|
||||
{
|
||||
SafeChatManager.openSafeChat(false,_booth.chatTree);
|
||||
}
|
||||
else
|
||||
{
|
||||
SafeChatManager.closeSafeChat(_booth.chatTree);
|
||||
}
|
||||
}
|
||||
|
||||
private function onSaveBtn(param1:MouseEvent) : void
|
||||
{
|
||||
SBTracker.trackPageview("/game/play/popup/photobooth/save");
|
||||
param1.stopPropagation();
|
||||
KeepAlive.inputReceivedHandler(null);
|
||||
new SBYesNoPopup(_guiLayer,LocalizationManager.translateIdAndInsertOnly(14789,50),true,onSaveForGems);
|
||||
}
|
||||
|
||||
private function onSaveOverHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
GuiManager.toolTip.init(_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
|
||||
{
|
||||
_jpgEncoder.removeEventListener("JPEGAsyncComplete",asyncEncodingComplete);
|
||||
_jpgEncoder.removeEventListener("progress",onEncodingProgress);
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
new SBYesNoPopup(_guiLayer,LocalizationManager.translateIdOnly(14790),true,onSaveImage,{
|
||||
"FileReference":true,
|
||||
"ImageData":_jpgEncoder.ImageData,
|
||||
"SaveName":"AnimalJam_" + _nameSaveIndex + ".jpg"
|
||||
});
|
||||
}
|
||||
|
||||
private function onCustomize(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
GuiManager.openAvatarEditor(onAvatarEditorClose);
|
||||
GuiManager.toolTip.resetTimerAndSetVisibility();
|
||||
}
|
||||
|
||||
private function charWindowOverHandler(param1:MouseEvent) : void
|
||||
{
|
||||
GuiManager.toolTip.init(_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();
|
||||
_booth.imageCont.chatBalloon.closeChatBtn.visible = true;
|
||||
}
|
||||
|
||||
private function onChatBalloonOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_booth.imageCont.chatBalloon.closeChatBtn.visible = false;
|
||||
}
|
||||
|
||||
private function onCloseBalloon(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_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");
|
||||
_booth.imageCont.msgTxt.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
param1.currentTarget.gotoAndPlay("on");
|
||||
_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;
|
||||
var _loc2_:int = 0;
|
||||
param1.stopPropagation();
|
||||
if(_loadingSpiralAvt.visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_debugAvtIndex = _debugAvtIndex + 1;
|
||||
var _loc5_:Array = AvatarSwitch.avatars;
|
||||
if(_debugAvtIndex >= AvatarUtility.numAvatarTypes)
|
||||
{
|
||||
_debugAvtIndex = 0;
|
||||
}
|
||||
var _loc3_:int = AvatarUtility.getAvatarTypeByIndex(_debugAvtIndex);
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _loc5_.length)
|
||||
{
|
||||
if(_loc5_[_loc2_].avTypeId == _loc3_)
|
||||
{
|
||||
_loc4_ = _loc5_[_loc2_];
|
||||
break;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
if(_loc4_ == null)
|
||||
{
|
||||
_loc4_ = AvatarUtility.getAvatarByIndex(_debugAvtIndex);
|
||||
}
|
||||
if(!Utility.isLand(_loc4_.enviroTypeFlag))
|
||||
{
|
||||
onAvtDebugLoadBtn(param1);
|
||||
return;
|
||||
}
|
||||
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
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_currShardId = RoomManagerWorld.instance.shardId;
|
||||
_engagementMediaHelper = new MediaHelper();
|
||||
_engagementMediaHelper.init(1567,onEngagementLoaded);
|
||||
_closeCallBack = param1;
|
||||
}
|
||||
|
||||
public function destroy(param1:Boolean = false) : void
|
||||
{
|
||||
removeEventListeners();
|
||||
DarkenManager.unDarken(_engagementPopup);
|
||||
GuiManager.guiLayer.removeChild(_engagementPopup);
|
||||
_engagementPopup = null;
|
||||
if(_closeCallBack != null)
|
||||
{
|
||||
_closeCallBack(param1);
|
||||
_closeCallBack = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onEngagementLoaded(param1:MovieClip) : void
|
||||
{
|
||||
_engagementMediaHelper.destroy();
|
||||
_engagementPopup = MovieClip(param1.getChildAt(0));
|
||||
_engagementPopup.x = 900 * 0.5;
|
||||
_engagementPopup.y = 550 * 0.5;
|
||||
GuiManager.guiLayer.addChild(_engagementPopup);
|
||||
_engagementPopup.gotoAndStop("new");
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
DarkenManager.darken(_engagementPopup);
|
||||
addEventListeners();
|
||||
}
|
||||
|
||||
private function onDenBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
SBTracker.trackPageview("/game/play/popup/playerEngagement/#den",-1,1);
|
||||
DenXtCommManager.requestDenJoinFull("den" + gMainFrame.userInfo.myUserName);
|
||||
destroy();
|
||||
}
|
||||
|
||||
private function onVideoBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
SBTracker.trackPageview("/game/play/popup/playerEngagement/#video",-1,1);
|
||||
RoomXtCommManager.sendNonDenRoomJoinRequest("sarepia.movie_theater#" + _currShardId);
|
||||
destroy();
|
||||
}
|
||||
|
||||
private function onShoppingBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
SBTracker.trackPageview("/game/play/popup/playerEngagement/#shopping",-1,1);
|
||||
RoomXtCommManager.sendNonDenRoomJoinRequest("jamaa_township.clothes_shop#" + _currShardId);
|
||||
destroy();
|
||||
}
|
||||
|
||||
private function onGamesBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBTracker.trackPageview("/game/play/popup/playerEngagement/#games",-1,1);
|
||||
GuiManager.openJoinGamesPopup();
|
||||
destroy();
|
||||
}
|
||||
|
||||
private function onAdventureBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBTracker.trackPageview("/game/play/popup/playerEngagement/#adventure",-1,1);
|
||||
RoomXtCommManager.sendNonDenRoomJoinRequest("adventures.queststaging_0_360#" + RoomManagerWorld.instance.shardId);
|
||||
destroy();
|
||||
}
|
||||
|
||||
private function onCloseBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
SBTracker.trackPageview("/game/play/popup/playerEngagement/#close",-1,1);
|
||||
destroy();
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_engagementPopup.denBtn.addEventListener("mouseDown",onDenBtn,false,0,true);
|
||||
if(_engagementPopup.videoBtn)
|
||||
{
|
||||
_engagementPopup.videoBtn.addEventListener("mouseDown",onVideoBtn,false,0,true);
|
||||
}
|
||||
if(_engagementPopup.shoppingBtn)
|
||||
{
|
||||
_engagementPopup.shoppingBtn.addEventListener("mouseDown",onShoppingBtn,false,0,true);
|
||||
}
|
||||
_engagementPopup.gamesBtn.addEventListener("mouseDown",onGamesBtn,false,0,true);
|
||||
_engagementPopup.advBtn.addEventListener("mouseDown",onAdventureBtn,false,0,true);
|
||||
_engagementPopup.bx.addEventListener("mouseDown",onCloseBtn,false,0,true);
|
||||
_engagementPopup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_engagementPopup.denBtn.removeEventListener("mouseDown",onDenBtn);
|
||||
if(_engagementPopup.videoBtn)
|
||||
{
|
||||
_engagementPopup.videoBtn.removeEventListener("mouseDown",onVideoBtn);
|
||||
}
|
||||
if(_engagementPopup.shoppingBtn)
|
||||
{
|
||||
_engagementPopup.shoppingBtn.removeEventListener("mouseDown",onShoppingBtn);
|
||||
}
|
||||
_engagementPopup.gamesBtn.removeEventListener("mouseDown",onGamesBtn);
|
||||
_engagementPopup.advBtn.removeEventListener("mouseDown",onAdventureBtn);
|
||||
_engagementPopup.bx.removeEventListener("mouseDown",onCloseBtn);
|
||||
_engagementPopup.removeEventListener("mouseDown",onPopup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarXtCommManager;
|
||||
import avatar.UserInfo;
|
||||
import buddy.Buddy;
|
||||
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;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
public function PlayerSearch()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:Function) : void
|
||||
{
|
||||
_closeCallback = param1;
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_searchMediaHelper = new MediaHelper();
|
||||
_searchMediaHelper.init(396,searchMediaCallback,true);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc1_:Function = null;
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_loc1_ = _closeCallback;
|
||||
_closeCallback = null;
|
||||
_loc1_();
|
||||
return;
|
||||
}
|
||||
_searchMediaHelper.destroy();
|
||||
if(_searchPopup)
|
||||
{
|
||||
removeListeners();
|
||||
GuiManager.guiLayer.removeChild(_searchPopup);
|
||||
DarkenManager.unDarken(_searchPopup);
|
||||
_searchPopup = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function searchMediaCallback(param1:MovieClip) : void
|
||||
{
|
||||
_searchPopup = MovieClip(param1.getChildAt(0));
|
||||
_searchPopup.x = 900 * 0.5;
|
||||
_searchPopup.y = 550 * 0.5;
|
||||
GuiManager.guiLayer.addChild(_searchPopup);
|
||||
addListeners();
|
||||
setInitialConditions();
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
DarkenManager.darken(_searchPopup);
|
||||
_searchMediaHelper = new MediaHelper();
|
||||
_searchMediaHelper.init(397,loadingSpiralCallback,true);
|
||||
}
|
||||
|
||||
private function loadingSpiralCallback(param1:MovieClip) : void
|
||||
{
|
||||
if(_searchPopup)
|
||||
{
|
||||
_searchPopup.itemBlock.addChild(param1);
|
||||
_searchPopup.itemBlock.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function setInitialConditions() : void
|
||||
{
|
||||
_searchPopup.userNameTxt.text = "";
|
||||
_searchPopup.userNameTxt.restrict = Utility.getUsernameRestrictions();
|
||||
_searchPopup.userNameTxt.maxChars = 32;
|
||||
gMainFrame.stage.focus = _searchPopup.userNameTxt;
|
||||
_searchPopup.notFoundTab.visible = false;
|
||||
}
|
||||
|
||||
private function popupCloseHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
destroy();
|
||||
}
|
||||
|
||||
private function onSearchBtnHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
performSearch();
|
||||
}
|
||||
|
||||
private function keyDownListener(param1:KeyboardEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.keyCode == 13)
|
||||
{
|
||||
performSearch();
|
||||
}
|
||||
}
|
||||
|
||||
private function performSearch() : void
|
||||
{
|
||||
var _loc1_:Buddy = null;
|
||||
_searchPopup.notFoundTab.visible = true;
|
||||
LocalizationManager.translateId(_searchPopup.notFoundTab.getChildAt(1),11369);
|
||||
var _loc3_:String = _searchPopup.userNameTxt.text;
|
||||
if(gMainFrame.userInfo.myUserName.toLowerCase() == _loc3_.toLowerCase())
|
||||
{
|
||||
LocalizationManager.translateId(_searchPopup.notFoundTab.getChildAt(1),11370);
|
||||
gMainFrame.stage.focus = _searchPopup.userNameTxt;
|
||||
return;
|
||||
}
|
||||
var _loc2_:String = _loc3_.toLowerCase();
|
||||
if(_lastSearchedName != _loc2_)
|
||||
{
|
||||
_lastSearchedName = _loc2_;
|
||||
_loc1_ = BuddyManager.getBuddyByUserName(_loc2_);
|
||||
if(_loc1_)
|
||||
{
|
||||
_searchPopup.notFoundTab.visible = false;
|
||||
BuddyManager.showBuddyCard({
|
||||
"userName":_loc1_.userName,
|
||||
"onlineStatus":_loc1_.onlineStatus
|
||||
});
|
||||
destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
_searchPopup.notFoundTab.visible = false;
|
||||
_searchPopup.itemBlock.visible = true;
|
||||
AvatarXtCommManager.requestAvatarGet(_loc3_,onUserLookUpReceived,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onUserLookUpReceived(param1:String, param2:Boolean, param3:int) : void
|
||||
{
|
||||
var _loc4_:UserInfo = null;
|
||||
if(_searchPopup)
|
||||
{
|
||||
_searchPopup.itemBlock.visible = false;
|
||||
_loc4_ = gMainFrame.userInfo.getUserInfoByUserName(param1);
|
||||
if(param2)
|
||||
{
|
||||
if(_loc4_)
|
||||
{
|
||||
if(_loc4_.userNameModeratedFlag > 0 && param1.toLowerCase() == _searchPopup.userNameTxt.text.toLowerCase())
|
||||
{
|
||||
BuddyManager.showBuddyCard({
|
||||
"userName":param1,
|
||||
"onlineStatus":param3
|
||||
});
|
||||
destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
_searchPopup.notFoundTab.visible = true;
|
||||
gMainFrame.stage.focus = _searchPopup.userNameTxt;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BuddyManager.showBuddyCard({
|
||||
"userName":param1,
|
||||
"onlineStatus":param3
|
||||
});
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
else if(param3 == -3)
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
_searchPopup.notFoundTab.visible = true;
|
||||
gMainFrame.stage.focus = _searchPopup.userNameTxt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function addListeners() : void
|
||||
{
|
||||
_searchPopup["bx"].addEventListener("mouseDown",popupCloseHandler,false,0,true);
|
||||
_searchPopup.searchBtn.addEventListener("mouseDown",onSearchBtnHandler,false,0,true);
|
||||
_searchPopup.userNameTxt.addEventListener("keyDown",keyDownListener,false,0,true);
|
||||
_searchPopup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
}
|
||||
|
||||
private function removeListeners() : void
|
||||
{
|
||||
_searchPopup["bx"].removeEventListener("mouseDown",popupCloseHandler);
|
||||
_searchPopup.searchBtn.removeEventListener("mouseDown",onSearchBtnHandler);
|
||||
_searchPopup.userNameTxt.removeEventListener("keyDown",keyDownListener);
|
||||
_searchPopup.addEventListener("mouseDown",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 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;
|
||||
|
||||
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;
|
||||
|
||||
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 _loc6_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
var _loc5_:PollDefHelper = null;
|
||||
_pollLocs = param2;
|
||||
_pollParams = param3;
|
||||
_pollDefHelpers = [];
|
||||
if(_tabTemplate == null)
|
||||
{
|
||||
_dataToSetupPolls = {
|
||||
"pollDefIds":param1,
|
||||
"pollLocs":param2,
|
||||
"pollParams":param3
|
||||
};
|
||||
_tabMediaHelper = new MediaHelper();
|
||||
_tabMediaHelper.init(153,mediaHelperHandler,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < param1.length)
|
||||
{
|
||||
_loc4_ = _pollDefCache[param1[_loc6_]];
|
||||
if(!_loc4_)
|
||||
{
|
||||
_loc5_ = new PollDefHelper();
|
||||
_loc5_.init(param1[_loc6_],onPollDefReceived);
|
||||
_pollDefHelpers[param1[_loc6_]] = _loc5_;
|
||||
}
|
||||
else
|
||||
{
|
||||
setUpPoll(_loc4_);
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 _loc3_:Object = param1.def;
|
||||
var _loc2_:Object = {
|
||||
"id":int(_loc3_.id),
|
||||
"mediaId":int(_loc3_.mediaRef),
|
||||
"userVarId":int(_loc3_.userVarRef),
|
||||
"poll":LocalizationManager.translateIdOnly(int(_loc3_.pollStrRef)),
|
||||
"title":LocalizationManager.translateIdOnly(int(_loc3_.titleStrRef))
|
||||
};
|
||||
_pollDefCache[_loc2_.id] = _loc2_;
|
||||
_pollDefHelpers[_loc2_.id] = null;
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
private static function setUpPoll(param1:Object) : void
|
||||
{
|
||||
var _loc3_:MovieClip = null;
|
||||
var _loc2_:int = 0;
|
||||
if(gMainFrame.userInfo.userVarCache.getUserVarValueById(int(param1.userVarId)) < 0)
|
||||
{
|
||||
if(_tabTemplate)
|
||||
{
|
||||
_loc3_ = new _tabTemplate.constructor();
|
||||
_loc3_.def = param1;
|
||||
_loc2_ = int(_loc3_.id = int(param1.id));
|
||||
_loc3_.x = _pollLocs[_loc2_].x;
|
||||
_loc3_.y = _pollLocs[_loc2_].y;
|
||||
if(param1.id == 27)
|
||||
{
|
||||
_loc3_.gotoAndPlay("tshirtPoll");
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_.gotoAndPlay("poll");
|
||||
}
|
||||
_loc3_.addEventListener("mouseDown",onTabMouseDown,false,0,true);
|
||||
_worldLayer.addChild(_loc3_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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_,3931,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 == "tshirtPoll")
|
||||
{
|
||||
ImagePoll.displayPoll(_loc2_.def.userVarId,_pollParams[_loc2_.id],1355,76,10,3,_loc2_,onImagePollClose);
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_pollPopup = new SBPollPopup();
|
||||
_pollPopup.init(_guiLayer,_loc2_,369,onPollVote,onPollDone,true);
|
||||
}
|
||||
}
|
||||
|
||||
private static function onImagePollClose(param1:MovieClip) : void
|
||||
{
|
||||
if(param1.parent)
|
||||
{
|
||||
param1.parent.removeChild(param1);
|
||||
}
|
||||
param1.removeEventListener("mouseDown",onTabMouseDown);
|
||||
}
|
||||
|
||||
private static function onPollVote(param1:MovieClip, param2:int) : void
|
||||
{
|
||||
if(param1.parent)
|
||||
{
|
||||
param1.parent.removeChild(param1);
|
||||
}
|
||||
param1.removeEventListener("mouseDown",onTabMouseDown);
|
||||
if(param1.def.userVarId != 0)
|
||||
{
|
||||
AchievementXtCommManager.requestSetUserVar(param1.def.userVarId,_pollParams[param1.id]);
|
||||
AchievementXtCommManager.requestSetUserVar(113,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();
|
||||
char = param1;
|
||||
weight = param2;
|
||||
children = param3;
|
||||
isSpecialCharacter = param4;
|
||||
useType = param5;
|
||||
isSpecialLangChar = param6;
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
children = null;
|
||||
}
|
||||
|
||||
public function contains(param1:String) : int
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
if(children != null)
|
||||
{
|
||||
_loc3_ = int(children.length);
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _loc3_)
|
||||
{
|
||||
if(children[_loc2_].char == param1)
|
||||
{
|
||||
return _loc2_;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,749 @@
|
||||
package gui
|
||||
{
|
||||
import flash.utils.Dictionary;
|
||||
|
||||
public class PredictiveTextTree
|
||||
{
|
||||
|
||||
private static var _defaultRoot:PredictiveTextNode;
|
||||
|
||||
private static var _lastKnowWordNode:PredictiveTextNode;
|
||||
|
||||
private static var _optimizationString:String = "";
|
||||
|
||||
private static var _weightOfWord:int;
|
||||
|
||||
private static var _useType:int;
|
||||
|
||||
private static var _specialCharsRegEx:RegExp;
|
||||
|
||||
private static var _specialCharsMap:Dictionary;
|
||||
|
||||
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();
|
||||
_root = param1;
|
||||
_currSearchNode = _root;
|
||||
_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 _loc2_:Array = null;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Array = param1.split(",");
|
||||
_specialCharsMap = new Dictionary();
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc4_.length)
|
||||
{
|
||||
_loc2_ = _loc4_[_loc3_].split("|");
|
||||
_specialCharsMap[_loc2_[0]] = _loc2_[1];
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
public static function addFromStart(param1:Array) : void
|
||||
{
|
||||
_weightOfWord = param1[1];
|
||||
_useType = param1[2] == "" ? 0 : param1[2];
|
||||
add(param1[0].split(""),0,_defaultRoot);
|
||||
}
|
||||
|
||||
public static function get defaultRoot() : PredictiveTextNode
|
||||
{
|
||||
return _defaultRoot;
|
||||
}
|
||||
|
||||
public static function optimizeTree(param1:PredictiveTextNode) : void
|
||||
{
|
||||
var _loc6_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc5_:Boolean = false;
|
||||
var _loc4_:Boolean = false;
|
||||
if(param1.children)
|
||||
{
|
||||
_loc6_ = int(param1.children.length);
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _loc6_)
|
||||
{
|
||||
optimizeTree(param1.children[_loc2_]);
|
||||
if(param1.weight > 0 || param1 == _defaultRoot || _loc6_ > 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)
|
||||
{
|
||||
_loc3_ = _lastKnowWordNode.weight;
|
||||
_loc5_ = _lastKnowWordNode.isSpecialLangChar;
|
||||
_loc4_ = _lastKnowWordNode.isSpecialCharacter;
|
||||
_lastKnowWordNode = param1;
|
||||
_lastKnowWordNode.weight = _loc3_;
|
||||
_optimizationString += param1.char;
|
||||
if(_loc5_)
|
||||
{
|
||||
_lastKnowWordNode.isSpecialLangChar = _loc5_;
|
||||
}
|
||||
if(_loc4_)
|
||||
{
|
||||
_lastKnowWordNode.isSpecialCharacter = _loc4_;
|
||||
}
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
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 _loc3_:int = 0;
|
||||
var _loc2_:String = "";
|
||||
_loc3_ = 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;
|
||||
}
|
||||
_searchChildren = null;
|
||||
_similarWords = null;
|
||||
_savedChildren = null;
|
||||
}
|
||||
|
||||
public function updateRoot(param1:PredictiveTextNode) : void
|
||||
{
|
||||
_root = param1;
|
||||
clearWordSuggestions();
|
||||
resetSearchTree();
|
||||
}
|
||||
|
||||
public function containsString(param1:String) : int
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
_loc2_ = checkMyself(param1);
|
||||
if(_loc2_ > 0)
|
||||
{
|
||||
return _loc2_;
|
||||
}
|
||||
if(_loc2_ == -1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
_loc2_ = checkMyChildren(param1);
|
||||
if(_loc2_ > 0)
|
||||
{
|
||||
return _loc2_;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function checkCurrentWordValidity() : int
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
var _loc1_:int = 0;
|
||||
if(_searchChildren.length > 0)
|
||||
{
|
||||
_loc2_ = _searchChildren[_searchChildren.length - 1];
|
||||
if(_loc2_.node)
|
||||
{
|
||||
if(_currSearchNode)
|
||||
{
|
||||
if(_currSearchNode.isSpecialCharacter)
|
||||
{
|
||||
_loc1_ = 3;
|
||||
}
|
||||
else if(_currSearchNode.char.length > 1)
|
||||
{
|
||||
if(_charSearchIndex == _loc2_.node.char.length)
|
||||
{
|
||||
_loc1_ = canThisTypeUseThisWord(_loc2_.node);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = 1;
|
||||
}
|
||||
}
|
||||
else if(_currSearchNode.char.charAt(_charSearchIndex) == _loc2_.node.char)
|
||||
{
|
||||
_loc1_ = canThisTypeUseThisWord(_loc2_.node);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = 2;
|
||||
}
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
public function showTopWord() : String
|
||||
{
|
||||
clearWordSuggestions();
|
||||
findAllSimilarWords();
|
||||
_similarWords.sort(compare);
|
||||
return _similarWords.length > 0 ? _similarWords[0].word : null;
|
||||
}
|
||||
|
||||
public function resetSearchTree() : void
|
||||
{
|
||||
_searchChildren = new Vector.<Object>();
|
||||
_currSearchNode = _root;
|
||||
}
|
||||
|
||||
public function clearWordSuggestions() : void
|
||||
{
|
||||
if(_similarWords)
|
||||
{
|
||||
_similarWords.splice(0,_similarWords.length);
|
||||
}
|
||||
_similarWordsIndex = 0;
|
||||
}
|
||||
|
||||
public function backspaced() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
if(_searchChildren.length > 0)
|
||||
{
|
||||
_searchChildren.pop();
|
||||
if(_searchChildren.length == 0)
|
||||
{
|
||||
_currSearchNode = _root;
|
||||
_charSearchIndex = 0;
|
||||
_hasCompletedCheckingMyself = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = _searchChildren[_searchChildren.length - 1];
|
||||
_currSearchNode = _loc1_.node == null ? _root : _loc1_.node;
|
||||
_charSearchIndex = _loc1_.wordIndex;
|
||||
_hasCompletedCheckingMyself = _charSearchIndex >= _currSearchNode.char.length;
|
||||
}
|
||||
}
|
||||
clearWordSuggestions();
|
||||
}
|
||||
|
||||
public function onSpecialCharacter() : void
|
||||
{
|
||||
var _loc1_:PredictiveTextNode = new PredictiveTextNode(_currSearchNode.char,_currSearchNode.weight,_currSearchNode.children,true);
|
||||
_searchChildren.push({
|
||||
"node":_loc1_,
|
||||
"wordIndex":0
|
||||
});
|
||||
_hasCompletedCheckingMyself = false;
|
||||
}
|
||||
|
||||
public function onSpacebar() : void
|
||||
{
|
||||
_searchChildren.push({
|
||||
"node":null,
|
||||
"wordIndex":0
|
||||
});
|
||||
_currSearchNode = _root;
|
||||
_charSearchIndex = 0;
|
||||
_hasCompletedCheckingMyself = false;
|
||||
}
|
||||
|
||||
public function get nodeCount() : Number
|
||||
{
|
||||
return _nodeCount;
|
||||
}
|
||||
|
||||
public function get nodeCountAfter() : Number
|
||||
{
|
||||
return _nodeCountAfter;
|
||||
}
|
||||
|
||||
public function get theRoot() : PredictiveTextNode
|
||||
{
|
||||
return _root;
|
||||
}
|
||||
|
||||
public function get numWords() : Number
|
||||
{
|
||||
return _numWordsPrinted;
|
||||
}
|
||||
|
||||
public function get currentRestriction() : String
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc1_:String = null;
|
||||
var _loc2_:* = undefined;
|
||||
var _loc3_:String = "";
|
||||
if(_currSearchNode)
|
||||
{
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _currSearchNode.char.length)
|
||||
{
|
||||
_loc1_ = _currSearchNode.char.charAt(_loc4_);
|
||||
if(_loc1_ == "-")
|
||||
{
|
||||
_loc3_ += "|\\-";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_specialCharsMap && _specialCharsMap[_loc1_])
|
||||
{
|
||||
_loc3_ += "|" + _specialCharsMap[_loc1_];
|
||||
}
|
||||
_loc3_ += "|" + _loc1_;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
_loc2_ = _currSearchNode.children;
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc2_.length)
|
||||
{
|
||||
_loc1_ = _loc2_[_loc4_].char.charAt(0);
|
||||
if(_loc1_ == "-")
|
||||
{
|
||||
_loc3_ += "|\\-";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_specialCharsMap && _specialCharsMap[_loc1_])
|
||||
{
|
||||
_loc3_ += "|" + _specialCharsMap[_loc1_];
|
||||
}
|
||||
_loc3_ += "|" + _loc1_;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
private function checkMyself(param1:String) : int
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(_currSearchNode)
|
||||
{
|
||||
if(_currSearchNode.isSpecialCharacter)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if(_currSearchNode.char.length > 1 && !_hasCompletedCheckingMyself)
|
||||
{
|
||||
if(_currSearchNode.char.charAt(_charSearchIndex) == param1)
|
||||
{
|
||||
_charSearchIndex = _charSearchIndex + 1;
|
||||
if(_charSearchIndex == _currSearchNode.char.length)
|
||||
{
|
||||
_searchChildren.push({
|
||||
"node":_currSearchNode,
|
||||
"wordIndex":_charSearchIndex
|
||||
});
|
||||
_charSearchIndex = 0;
|
||||
_hasCompletedCheckingMyself = true;
|
||||
return canThisTypeUseThisWord(_currSearchNode);
|
||||
}
|
||||
_searchChildren.push({
|
||||
"node":_currSearchNode,
|
||||
"wordIndex":_charSearchIndex
|
||||
});
|
||||
_loc2_ = canThisTypeUseThisWord(_currSearchNode,false,false) - 1;
|
||||
if(_loc2_ == 0 && _currSearchNode.children.length == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
_searchChildren.push({
|
||||
"node":_currSearchNode,
|
||||
"wordIndex":_charSearchIndex
|
||||
});
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function checkMyChildren(param1:String) : int
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc5_:PredictiveTextNode = null;
|
||||
var _loc4_:int = 0;
|
||||
if(_currSearchNode)
|
||||
{
|
||||
_loc2_ = int(_currSearchNode.children.length);
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc2_)
|
||||
{
|
||||
_hasCompletedCheckingMyself = false;
|
||||
_loc5_ = _currSearchNode.children[_loc3_];
|
||||
if(_loc5_.isSpecialCharacter)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(_loc5_.char == param1)
|
||||
{
|
||||
_searchChildren.push({
|
||||
"node":_loc5_,
|
||||
"wordIndex":0
|
||||
});
|
||||
_currSearchNode = _loc5_;
|
||||
return canThisTypeUseThisWord(_loc5_);
|
||||
}
|
||||
if(_loc5_.char.length > 1)
|
||||
{
|
||||
_loc4_ = _charSearchIndex;
|
||||
if(_currSearchNode.char != _loc5_.char)
|
||||
{
|
||||
_charSearchIndex = 0;
|
||||
}
|
||||
if(_loc5_.char.charAt(_charSearchIndex) == param1)
|
||||
{
|
||||
_charSearchIndex = _charSearchIndex + 1;
|
||||
if(_charSearchIndex == _loc5_.char.length)
|
||||
{
|
||||
_searchChildren.push({
|
||||
"node":_loc5_,
|
||||
"wordIndex":_charSearchIndex
|
||||
});
|
||||
_currSearchNode = _loc5_;
|
||||
_charSearchIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_searchChildren.push({
|
||||
"node":_loc5_,
|
||||
"wordIndex":_charSearchIndex
|
||||
});
|
||||
_currSearchNode = _loc5_;
|
||||
}
|
||||
return canThisTypeUseThisWord(_loc5_,true);
|
||||
}
|
||||
_charSearchIndex = _loc4_;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
_searchChildren.push({
|
||||
"node":_currSearchNode,
|
||||
"wordIndex":_charSearchIndex
|
||||
});
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function findAllSimilarWords(param1:PredictiveTextNode = null, param2:String = "", param3:PredictiveTextNode = null) : Vector.<Object>
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc6_:PredictiveTextNode = param1 != null ? param1 : _currSearchNode;
|
||||
if(_loc6_ == _root)
|
||||
{
|
||||
return _similarWords;
|
||||
}
|
||||
if(param3 == null)
|
||||
{
|
||||
param3 = _currSearchNode;
|
||||
}
|
||||
if(_loc6_)
|
||||
{
|
||||
_loc5_ = int(_searchChildren[_searchChildren.length - 1].wordIndex);
|
||||
if(_loc6_ == _currSearchNode && _currSearchNode.char.length > 1 && _currSearchNode.weight > 0 && _loc5_ < _currSearchNode.char.length)
|
||||
{
|
||||
if(canThisTypeUseThisWord(_loc6_,false,false) == 2)
|
||||
{
|
||||
_similarWords.push({
|
||||
"word":appendCompletionString(""),
|
||||
"weight":_currSearchNode.weight,
|
||||
"index":_loc5_
|
||||
});
|
||||
_similarWordsIndex = _similarWordsIndex + 1;
|
||||
}
|
||||
}
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc6_.children.length)
|
||||
{
|
||||
if(_loc6_ != param3)
|
||||
{
|
||||
param2 += _loc6_.char;
|
||||
param3 = _loc6_;
|
||||
}
|
||||
if(_similarWords.length <= _similarWordsIndex)
|
||||
{
|
||||
if(canThisTypeUseThisWord(_loc6_.children[_loc4_],false,false) == 2)
|
||||
{
|
||||
_similarWords.push({
|
||||
"word":param2,
|
||||
"weight":_loc6_.children[_loc4_].weight
|
||||
});
|
||||
_similarWords[_similarWordsIndex].word += _loc6_.children[_loc4_].char;
|
||||
_similarWords[_similarWordsIndex].weight = _loc6_.children[_loc4_].weight;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_similarWords[_similarWordsIndex].word += _loc6_.children[_loc4_].char;
|
||||
_similarWords[_similarWordsIndex].weight = _loc6_.children[_loc4_].weight;
|
||||
}
|
||||
if(_loc6_.children[_loc4_].weight > 0 && _similarWords.length > _similarWordsIndex)
|
||||
{
|
||||
_similarWords[_similarWordsIndex].word = appendCompletionString(_similarWords[_similarWordsIndex].word);
|
||||
_similarWords[_similarWordsIndex].weight = _loc6_.children[_loc4_].weight;
|
||||
if(_loc6_ != _currSearchNode)
|
||||
{
|
||||
return _similarWords;
|
||||
}
|
||||
_similarWordsIndex = _similarWordsIndex + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
findAllSimilarWords(_loc6_.children[_loc4_],param2);
|
||||
_similarWordsIndex = _similarWordsIndex + 1;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
if(param1 == null && _loc6_.children.length == 0)
|
||||
{
|
||||
if(canThisTypeUseThisWord(_loc6_,false,false) == 2)
|
||||
{
|
||||
_similarWords.push({
|
||||
"word":appendCompletionString(""),
|
||||
"weight":_loc6_.weight
|
||||
});
|
||||
}
|
||||
}
|
||||
_similarWordsIndex = _similarWordsIndex - 1;
|
||||
}
|
||||
return _similarWords;
|
||||
}
|
||||
|
||||
public function findAllLanguageSpecialChars(param1:String) : Array
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc2_:PredictiveTextNode = null;
|
||||
var _loc3_:String = null;
|
||||
var _loc5_:Array = [];
|
||||
if(_searchChildren.length > 0)
|
||||
{
|
||||
if(_searchChildren.length == 1 || _searchChildren[_searchChildren.length - 2].node == null)
|
||||
{
|
||||
_loc2_ = theRoot;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = _searchChildren[_searchChildren.length - 2].node;
|
||||
}
|
||||
if(_loc2_.char.length > 1 && _loc2_.isSpecialLangChar)
|
||||
{
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc2_.char.length)
|
||||
{
|
||||
_loc3_ = _loc2_.char.charAt(_loc4_);
|
||||
if(_specialCharsMap[_loc3_] == param1)
|
||||
{
|
||||
_loc5_.push(_loc2_.char.charAt(_loc4_));
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc2_.children.length)
|
||||
{
|
||||
if(_loc2_.children[_loc4_].isSpecialLangChar)
|
||||
{
|
||||
_loc3_ = _loc2_.children[_loc4_].char.charAt(0);
|
||||
if(_specialCharsMap[_loc3_] == param1)
|
||||
{
|
||||
_loc5_.push(_loc2_.children[_loc4_].char.charAt(0));
|
||||
}
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
return _loc5_;
|
||||
}
|
||||
|
||||
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_:int = 0;
|
||||
var _loc2_:String = "";
|
||||
if(_searchChildren)
|
||||
{
|
||||
_loc4_ = _searchChildren.length - 1;
|
||||
for(; _loc4_ >= 0; _loc4_--)
|
||||
{
|
||||
if(!(_searchChildren[_loc4_].node && !_searchChildren[_loc4_].node.isSpecialCharacter))
|
||||
{
|
||||
break;
|
||||
}
|
||||
if(_loc3_)
|
||||
{
|
||||
if(_loc3_ == _searchChildren[_loc4_].node)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(_searchChildren[_loc4_].node.char.length > 1)
|
||||
{
|
||||
_loc2_ += reverseString(_searchChildren[_loc4_].node.char);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ += _searchChildren[_loc4_].node.char;
|
||||
}
|
||||
_loc3_ = _searchChildren[_loc4_].node;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_searchChildren[_loc4_].node.char.length > 1)
|
||||
{
|
||||
_loc2_ += reverseString(_searchChildren[_loc4_].node.char);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ += _searchChildren[_loc4_].node.char;
|
||||
}
|
||||
_loc3_ = _searchChildren[_loc4_].node;
|
||||
}
|
||||
}
|
||||
}
|
||||
return reverseString(_loc2_) + param1;
|
||||
}
|
||||
|
||||
private function canThisTypeUseThisWord(param1:Object, param2:Boolean = false, param3:Boolean = true) : int
|
||||
{
|
||||
if(param1.useType == 0)
|
||||
{
|
||||
return (param3 ? _currSearchNode.weight > 0 && (param2 ? _charSearchIndex == 0 : true) : true) ? 2 : 1;
|
||||
}
|
||||
if(param1.useType > 0)
|
||||
{
|
||||
if((_useType & param1.useType) > 0)
|
||||
{
|
||||
return (param3 ? _currSearchNode.weight > 0 || param1.children.length > 0 : true) && (param2 ? _charSearchIndex != 0 : true) ? 1 : 0;
|
||||
}
|
||||
return (param3 ? _currSearchNode.weight > 0 && (param2 ? _charSearchIndex == 0 : true) : true) ? 2 : 1;
|
||||
}
|
||||
if((_useType & param1.useType * -1) > 0)
|
||||
{
|
||||
return (param3 ? _currSearchNode.weight > 0 && (param2 ? _charSearchIndex == 0 : true) : true) ? 2 : 1;
|
||||
}
|
||||
return (param3 ? _currSearchNode.weight > 0 || param1.children.length > 0 : true) && (param2 ? _charSearchIndex != 0 : true) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,247 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import gui.itemWindows.ItemWindowCustPlayers;
|
||||
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();
|
||||
}
|
||||
_savedParams = [];
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
_closeCallback = param2;
|
||||
_scriptDefId = param1;
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(2300,onMediaLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
GuiManager.grayOutHudItemsForPrivateLobby(false);
|
||||
GuiManager.mainHud.emotesBtn.activateGrayState(false);
|
||||
removeEventListeners();
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
_guiLayer.removeChild(_popup);
|
||||
}
|
||||
|
||||
public function handleWaitResponse(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Array = null;
|
||||
if(_popup)
|
||||
{
|
||||
if(_waitingAvatarWindows)
|
||||
{
|
||||
_waitingAvatarWindows.destroy();
|
||||
_waitingAvatarWindows = null;
|
||||
}
|
||||
_loc2_ = param1.slice(2);
|
||||
_waitingAvatarWindows = new WindowGenerator();
|
||||
_waitingAvatarWindows.init(1,4,_loc2_.length,0,0,0,ItemWindowCustPlayers,param1.slice(2),"",{
|
||||
"mouseDown":onWindowDown,
|
||||
"mouseOver":onWindowOver,
|
||||
"mouseOut":onWindowOut,
|
||||
"memberOnlyMouseDown":null
|
||||
},{
|
||||
"onBxBtn":onKickPlayerBtn,
|
||||
"scriptDefId":_scriptDefId
|
||||
},onWindowLoaded,false,false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_inParamsWaiting = param1;
|
||||
}
|
||||
}
|
||||
|
||||
public function updateDisplayIndex(param1:Boolean = true) : void
|
||||
{
|
||||
var _loc2_:int = GuiManager.guiLayer.getChildIndex(GuiManager.mainHud);
|
||||
var _loc3_:int = _popup.parent.getChildIndex(_popup);
|
||||
if(param1)
|
||||
{
|
||||
if(_loc2_ < _loc3_)
|
||||
{
|
||||
_popup.parent.setChildIndex(_popup,_loc2_);
|
||||
}
|
||||
}
|
||||
else if(_loc2_ > _loc3_)
|
||||
{
|
||||
_popup.parent.setChildIndex(_popup,_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
GuiManager.mainHud.emotesBtn.activateGrayState(true);
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_popup = MovieClip(param1.getChildAt(0));
|
||||
addEventListeners();
|
||||
_popup.x = _popup.width * 0.5;
|
||||
_popup.y = 255;
|
||||
_guiLayer.addChild(_popup);
|
||||
GuiManager.closeAnyHudPopups();
|
||||
if(_inParamsWaiting != null)
|
||||
{
|
||||
handleWaitResponse(_inParamsWaiting);
|
||||
_inParamsWaiting = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_waitingAvatarWindows = new WindowGenerator();
|
||||
_waitingAvatarWindows.init(1,4,1,0,0,0,ItemWindowCustPlayers,[AvatarManager.playerSfsUserId],"",{
|
||||
"mouseDown":onWindowDown,
|
||||
"mouseOver":onWindowOver,
|
||||
"mouseOut":onWindowOut,
|
||||
"memberOnlyMouseDown":null
|
||||
},{"onBxBtn":onKickPlayerBtn},onWindowLoaded,false,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onWindowLoaded() : void
|
||||
{
|
||||
if(_popup.playerWindow.numChildren > 0)
|
||||
{
|
||||
_popup.playerWindow.removeChildAt(0);
|
||||
}
|
||||
_popup.playerWindow.addChild(_waitingAvatarWindows);
|
||||
if(_windowScrollbar)
|
||||
{
|
||||
_windowScrollbar.destroy();
|
||||
_windowScrollbar = null;
|
||||
}
|
||||
_windowScrollbar = new SBScrollbar();
|
||||
_windowScrollbar.init(_waitingAvatarWindows,_waitingAvatarWindows.width,_waitingAvatarWindows.boxHeight * 4 + 0 + 0,10,"scrollbar2",_waitingAvatarWindows.boxHeight + 0);
|
||||
}
|
||||
|
||||
private function close() : void
|
||||
{
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback(false);
|
||||
_closeCallback = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function onWindowDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.userName != gMainFrame.userInfo.myUserName)
|
||||
{
|
||||
BuddyManager.showBuddyCard({
|
||||
"userName":param1.currentTarget.userName,
|
||||
"onlineStatus":true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
updateDisplayIndex(false);
|
||||
}
|
||||
|
||||
private function onCloseBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
QuestXtCommManager.sendQuestJoinCancel();
|
||||
close();
|
||||
}
|
||||
|
||||
private function onPlayBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
QuestXtCommManager.sendQuestStartRequest();
|
||||
close();
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_popup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_popup.bx.addEventListener("mouseDown",onCloseBtn,false,0,true);
|
||||
_popup.playBtn.addEventListener("mouseDown",onPlayBtn,false,0,true);
|
||||
_popup.addEventListener("mouseOver",onPopupOver,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_popup.removeEventListener("mouseDown",onPopup);
|
||||
_popup.bx.removeEventListener("mouseDown",onCloseBtn);
|
||||
_popup.playBtn.removeEventListener("mouseDown",onPlayBtn);
|
||||
_popup.removeEventListener("mouseOver",onPopupOver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,680 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
import collection.AccItemCollection;
|
||||
import collection.DenItemCollection;
|
||||
import collection.IitemCollection;
|
||||
import collection.IntItemCollection;
|
||||
import collection.TradeItemCollection;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import den.DenItem;
|
||||
import den.DenXtCommManager;
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import gui.itemWindows.ItemWindowOriginal;
|
||||
import inventory.Iitem;
|
||||
import item.ItemXtCommManager;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class RecycleItems
|
||||
{
|
||||
|
||||
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 const POPUP_MEDIA_ID:int = 4618;
|
||||
|
||||
private const RECYCLE_TUT_LIST_ID:int = 52;
|
||||
|
||||
private var _popupLayer:DisplayObjectContainer;
|
||||
|
||||
private var _recyclePopup:MovieClip;
|
||||
|
||||
private var _confirmPopup:MovieClip;
|
||||
|
||||
private var _recycleInventory:IitemCollection;
|
||||
|
||||
private var _itemsToRecycle:IitemCollection;
|
||||
|
||||
private var _itemWindows:WindowAndScrollbarGenerator;
|
||||
|
||||
private var _confirmWindows:WindowAndScrollbarGenerator;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _itemRecycleId:int;
|
||||
|
||||
private var _savedTradeIndexes:IntItemCollection;
|
||||
|
||||
private var _recycleOneItem:Boolean;
|
||||
|
||||
private var _hasRecycled:Boolean;
|
||||
|
||||
private var _isInCurrEnviro:Boolean;
|
||||
|
||||
private var _recycleTotal:int;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
private var _onRecycleSuccessCallback:Function;
|
||||
|
||||
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
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_itemRecycleId = param1;
|
||||
_popupLayer = param2;
|
||||
_recycleOneItem = param3;
|
||||
_isInCurrEnviro = param7;
|
||||
_closeCallback = param4;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(4618,onPopupLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
removeListeners();
|
||||
confirmRemoveEventListeners();
|
||||
if(_itemWindows)
|
||||
{
|
||||
_scrollValue = _itemWindows.scrollYValue;
|
||||
switch(_itemRecycleId)
|
||||
{
|
||||
case 0:
|
||||
_accessoriesScrollValue = _scrollValue;
|
||||
break;
|
||||
case 1:
|
||||
_denScrollValue = _scrollValue;
|
||||
break;
|
||||
case 2:
|
||||
_denAudioScrollValue = _scrollValue;
|
||||
break;
|
||||
case 3:
|
||||
_denOceanOnlyScrollValue = _scrollValue;
|
||||
break;
|
||||
case 4:
|
||||
_denLandOnlyScrollValue = _scrollValue;
|
||||
break;
|
||||
case 5:
|
||||
_accessoriesOceanOnlyScrollValue = _scrollValue;
|
||||
break;
|
||||
case 6:
|
||||
_accessoriesLandOnlyScrollValue = _scrollValue;
|
||||
}
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
DarkenManager.unDarken(_confirmPopup);
|
||||
DarkenManager.unDarken(_recyclePopup);
|
||||
_popupLayer.removeChild(_recyclePopup);
|
||||
_hasRecycled = false;
|
||||
_closeCallback = null;
|
||||
}
|
||||
|
||||
public function hasBeenInited() : Boolean
|
||||
{
|
||||
return _recyclePopup != null;
|
||||
}
|
||||
|
||||
private function onPopupLoaded(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_recyclePopup = param1.getChildAt(0) as MovieClip;
|
||||
_confirmPopup = _recyclePopup.confirmPopup;
|
||||
_confirmPopup.visible = false;
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
_recyclePopup.recycleBtn.activateGrayState(true);
|
||||
_recyclePopup.currencyToolTip.text = 0;
|
||||
addListeners();
|
||||
_recyclePopup.x = 900 * 0.5;
|
||||
_recyclePopup.y = 550 * 0.5;
|
||||
_popupLayer.addChild(_recyclePopup);
|
||||
DarkenManager.darken(_recyclePopup);
|
||||
_itemsToRecycle = new IitemCollection();
|
||||
_savedTradeIndexes = new IntItemCollection();
|
||||
AJAudio.playItemRecycledSound();
|
||||
if(_itemRecycleId == 1 || _itemRecycleId == 3 || _itemRecycleId == 4)
|
||||
{
|
||||
if(gMainFrame.userInfo.playerUserInfo.denItemsFull.length <= 0)
|
||||
{
|
||||
DenXtCommManager.requestDenItems(fillInventory);
|
||||
}
|
||||
else
|
||||
{
|
||||
fillInventory();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fillInventory();
|
||||
}
|
||||
}
|
||||
|
||||
private function fillInventory(param1:Boolean = false) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc5_:AccItemCollection = null;
|
||||
var _loc2_:DenItemCollection = null;
|
||||
var _loc4_:int = 0;
|
||||
if(!param1)
|
||||
{
|
||||
_recycleInventory = new IitemCollection();
|
||||
if(_itemRecycleId == 0)
|
||||
{
|
||||
_recycleInventory = new IitemCollection((gMainFrame.userInfo.playerAvatarInfo.getFullItems() as IitemCollection).concatCollection(null));
|
||||
_scrollValue = _accessoriesScrollValue;
|
||||
}
|
||||
else if(_itemRecycleId == 6 || _itemRecycleId == 5)
|
||||
{
|
||||
_loc5_ = gMainFrame.userInfo.playerAvatarInfo.getFullItems();
|
||||
if(_itemRecycleId == 6)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc5_.length)
|
||||
{
|
||||
if(_loc5_.getAccItem(_loc3_).enviroType == 0)
|
||||
{
|
||||
_recycleInventory.pushIitem(_loc5_.getAccItem(_loc3_).clone());
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
_scrollValue = _accessoriesLandOnlyScrollValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc5_.length)
|
||||
{
|
||||
if(_loc5_.getAccItem(_loc3_).enviroType == 1)
|
||||
{
|
||||
_recycleInventory.pushIitem(_loc5_.getAccItem(_loc3_).clone());
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
_scrollValue = _accessoriesOceanOnlyScrollValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = gMainFrame.userInfo.playerUserInfo.denItemsFull;
|
||||
if(_itemRecycleId == 4 || _itemRecycleId == 3)
|
||||
{
|
||||
if(_isInCurrEnviro)
|
||||
{
|
||||
_loc2_ = Utility.denItemListByEnviroType(_loc2_,AvatarManager.roomEnviroType);
|
||||
}
|
||||
}
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc2_.length)
|
||||
{
|
||||
if(_itemRecycleId == 2)
|
||||
{
|
||||
if(_loc2_.getDenItem(_loc3_).sortId == 4 && _loc2_.getDenItem(_loc3_).defId != 617)
|
||||
{
|
||||
_recycleInventory.setIitem(_loc4_,_loc2_.getDenItem(_loc3_).clone());
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
else if(_loc2_.getDenItem(_loc3_).sortId != 4)
|
||||
{
|
||||
if(_itemRecycleId == 1 || _isInCurrEnviro)
|
||||
{
|
||||
_recycleInventory.setIitem(_loc4_,_loc2_.getDenItem(_loc3_).clone());
|
||||
_loc4_++;
|
||||
}
|
||||
else if(_itemRecycleId == 4 && _loc2_.getDenItem(_loc3_).enviroType == 0)
|
||||
{
|
||||
_recycleInventory.setIitem(_loc4_,_loc2_.getDenItem(_loc3_).clone());
|
||||
_loc4_++;
|
||||
}
|
||||
else if(_loc2_.getDenItem(_loc3_).enviroType == 1)
|
||||
{
|
||||
_recycleInventory.setIitem(_loc4_,_loc2_.getDenItem(_loc3_).clone());
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
if(_itemRecycleId == 2)
|
||||
{
|
||||
_scrollValue = _denAudioScrollValue;
|
||||
}
|
||||
else if(_itemRecycleId == 1)
|
||||
{
|
||||
_scrollValue = _denScrollValue;
|
||||
}
|
||||
else if(_itemRecycleId == 4)
|
||||
{
|
||||
_scrollValue = _denLandOnlyScrollValue;
|
||||
}
|
||||
else if(_itemRecycleId == 3)
|
||||
{
|
||||
_scrollValue = _denOceanOnlyScrollValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
createWindows();
|
||||
}
|
||||
|
||||
private function createWindows() : void
|
||||
{
|
||||
if(_itemWindows)
|
||||
{
|
||||
_scrollValue = _itemWindows.scrollYValue;
|
||||
}
|
||||
if(_itemWindows)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
while(_recyclePopup.itemBlock.numChildren > 1)
|
||||
{
|
||||
_recyclePopup.itemBlock.removeChildAt(_recyclePopup.itemBlock.numChildren - 1);
|
||||
}
|
||||
_itemWindows = new WindowAndScrollbarGenerator();
|
||||
_itemWindows.init(_recyclePopup.itemBlock.width,_recyclePopup.itemBlock.height,4,_scrollValue,3,4,12,2,2,0,1,ItemWindowOriginal,_recycleInventory.getCoreArray(),"icon",0,{
|
||||
"mouseDown":onItemWindowDown,
|
||||
"mouseOver":onItemRollOver,
|
||||
"mouseOut":onItemRollOut
|
||||
},{"isRecycling":true},null,true,false,false);
|
||||
_recyclePopup.itemBlock.addChild(_itemWindows);
|
||||
}
|
||||
|
||||
private function sendRecycleRequest(param1:Boolean) : void
|
||||
{
|
||||
var _loc4_:Array = null;
|
||||
var _loc6_:IntItemCollection = null;
|
||||
var _loc7_:TradeItemCollection = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_loc4_ = _itemsToRecycle.getCoreArray();
|
||||
_loc6_ = new IntItemCollection();
|
||||
_loc7_ = gMainFrame.userInfo.getMyTradeList();
|
||||
_loc2_ = -1;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc4_.length)
|
||||
{
|
||||
if(_loc4_[_loc3_])
|
||||
{
|
||||
_loc2_ = (_loc4_[_loc3_] as Iitem).invIdx;
|
||||
_loc6_.pushIntItem(_loc2_);
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc7_.length)
|
||||
{
|
||||
if(_loc7_.getTradeItem(_loc5_).itemType == _itemRecycleId && _loc7_.getTradeItem(_loc5_).invIdx == _loc2_)
|
||||
{
|
||||
_savedTradeIndexes.pushIntItem(_loc5_);
|
||||
break;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
if(_itemRecycleId == 0 || _itemRecycleId == 6 || _itemRecycleId == 5)
|
||||
{
|
||||
ItemXtCommManager.requestItemRecycle(_loc6_,confirmRecycle,onRecycleListCallback);
|
||||
}
|
||||
else
|
||||
{
|
||||
DenXtCommManager.requestRecycle(true,_loc6_,confirmRecycle,onRecycleListCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function confirmRecycle(param1:int) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(param1 > 0)
|
||||
{
|
||||
if(_savedTradeIndexes.length > 0)
|
||||
{
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _savedTradeIndexes.length)
|
||||
{
|
||||
gMainFrame.userInfo.removeFromMyTradeList(_savedTradeIndexes.getIntItem(_loc2_));
|
||||
if(_itemRecycleId == 0 || _itemRecycleId == 6 || _itemRecycleId == 5)
|
||||
{
|
||||
TradeManager.adjustByOnNumClothingItemsInMyTradeList(-1);
|
||||
}
|
||||
else if(_itemRecycleId == 1 || _itemRecycleId == 2 || _itemRecycleId == 4 || _itemRecycleId == 3)
|
||||
{
|
||||
TradeManager.adjustByOnNumDenItemsInMyTradeList(-1);
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
}
|
||||
if(param1 < 2)
|
||||
{
|
||||
new SBOkPopup(_popupLayer,LocalizationManager.translateIdOnly(24788));
|
||||
}
|
||||
_savedTradeIndexes = new IntItemCollection();
|
||||
}
|
||||
|
||||
private function onRecycleListCallback() : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc1_:int = 0;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_hasRecycled = true;
|
||||
if(_onRecycleSuccessCallback != null)
|
||||
{
|
||||
_onRecycleSuccessCallback();
|
||||
}
|
||||
if(_recycleOneItem)
|
||||
{
|
||||
applyAndClose(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _itemsToRecycle.length)
|
||||
{
|
||||
if(_itemsToRecycle.getIitem(_loc1_))
|
||||
{
|
||||
_itemWindows.deleteItem(_loc1_ - _loc2_,_recycleInventory.getCoreArray());
|
||||
_loc2_++;
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
_itemsToRecycle = new IitemCollection();
|
||||
_recycleTotal = 0;
|
||||
_recyclePopup.currencyToolTip.text = Utility.convertNumberToString(_recycleTotal);
|
||||
_recyclePopup.recycleBtn.activateGrayState(true);
|
||||
}
|
||||
}
|
||||
|
||||
public function setOnRecycleSuccessCallback(param1:Function) : void
|
||||
{
|
||||
_onRecycleSuccessCallback = param1;
|
||||
}
|
||||
|
||||
private function applyAndClose(param1:Boolean = false) : void
|
||||
{
|
||||
ItemXtCommManager.recycleIlCallback = null;
|
||||
DenXtCommManager.recycleDiCallback = null;
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback(param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopupDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
applyAndClose(_hasRecycled);
|
||||
}
|
||||
|
||||
private function onItemWindowDown(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:ItemWindowOriginal = null;
|
||||
var _loc3_:Iitem = null;
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.name == "previewBtn")
|
||||
{
|
||||
_loc2_ = param1.currentTarget.parent.parent as ItemWindowOriginal;
|
||||
_loc3_ = _loc2_.currItem as Iitem;
|
||||
if(_loc3_ is DenItem)
|
||||
{
|
||||
GuiManager.openMasterpiecePreview((_loc3_ as DenItem).uniqueImageId,(_loc3_ as DenItem).uniqueImageCreator,(_loc3_ as DenItem).version);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = param1.currentTarget as ItemWindowOriginal;
|
||||
if((_loc2_.currItem as Iitem).isApproved)
|
||||
{
|
||||
if(_loc2_.cir.currentFrameLabel != "green" && _loc2_.cir.currentFrameLabel != "greenMouse")
|
||||
{
|
||||
_loc2_.cir.gotoAndStop("greenMouse");
|
||||
_recycleTotal += (_loc2_.currItem as Iitem).recycleValue as int;
|
||||
_itemsToRecycle.setIitem(_loc2_.index,(_loc2_.currItem as Iitem).clone());
|
||||
_recyclePopup.recycleBtn.activateGrayState(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_loc2_.isInUse)
|
||||
{
|
||||
_loc2_.cir.gotoAndStop("down");
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_.cir.gotoAndStop("up");
|
||||
}
|
||||
_recycleTotal -= (_loc2_.currItem as Iitem).recycleValue as int;
|
||||
_itemsToRecycle.getCoreArray().splice(_loc2_.index,1);
|
||||
if(_recycleTotal <= 0)
|
||||
{
|
||||
_recyclePopup.recycleBtn.activateGrayState(true);
|
||||
}
|
||||
}
|
||||
_recyclePopup.currencyToolTip.text = Utility.convertNumberToString(_recycleTotal);
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(_popupLayer,LocalizationManager.translateIdOnly(25196));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 == "green")
|
||||
{
|
||||
param1.currentTarget.cir.gotoAndStop("greenMouse");
|
||||
}
|
||||
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 == "greenMouse")
|
||||
{
|
||||
param1.currentTarget.cir.gotoAndStop("green");
|
||||
}
|
||||
else if(param1.currentTarget.cir.currentFrameLabel != "down")
|
||||
{
|
||||
param1.currentTarget.cir.gotoAndStop("up");
|
||||
}
|
||||
}
|
||||
|
||||
private function onRecycleBtn(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc4_:IitemCollection = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
if(gMainFrame.clientInfo.extCallsActive)
|
||||
{
|
||||
return;
|
||||
}
|
||||
DarkenManager.unDarken(_recyclePopup);
|
||||
DarkenManager.darken(_confirmPopup,true);
|
||||
_confirmPopup.visible = true;
|
||||
confirmAddEventListeners();
|
||||
_loc4_ = new IitemCollection();
|
||||
_loc2_ = int(_itemsToRecycle.length);
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc2_)
|
||||
{
|
||||
if(_itemsToRecycle.getIitem(_loc3_))
|
||||
{
|
||||
_loc4_.pushIitem(_itemsToRecycle.getIitem(_loc3_));
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
_confirmWindows = new WindowAndScrollbarGenerator();
|
||||
_confirmWindows.init(_confirmPopup.itemBlock.width,_confirmPopup.itemBlock.height,3,0,2,2,0,2,2,0,1,ItemWindowOriginal,_loc4_.getCoreArray(),"icon",0,{
|
||||
"mouseDown":null,
|
||||
"mouseOver":onItemRollOver,
|
||||
"mouseOut":onItemRollOut
|
||||
},{"isRecycling":true},null,true,false,false);
|
||||
_confirmPopup.itemBlock.addChild(_confirmWindows);
|
||||
LocalizationManager.translateIdAndInsert(_confirmPopup.bodyTxtCont.bodyTxt,_loc4_.length == 1 ? 11371 : 24764,Utility.convertNumberToString(_recycleTotal));
|
||||
LocalizationManager.translateIdAndInsert(_confirmPopup.txtCounter_ba.counterTxt,_loc4_.length == 1 ? 23696 : 23695,_loc4_.length);
|
||||
_loc4_ = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onConfirmOkBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
onConfirmNoOrExit(param1);
|
||||
sendRecycleRequest(true);
|
||||
}
|
||||
|
||||
private function onConfirmNoOrExit(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
DarkenManager.unDarken(_confirmPopup);
|
||||
DarkenManager.darken(_recyclePopup);
|
||||
_confirmPopup.visible = false;
|
||||
while(_confirmPopup.itemBlock.numChildren > 2)
|
||||
{
|
||||
_confirmPopup.itemBlock.removeChildAt(_confirmPopup.itemBlock.numChildren - 1);
|
||||
}
|
||||
if(_confirmWindows)
|
||||
{
|
||||
_confirmWindows.destroy();
|
||||
_confirmWindows = null;
|
||||
}
|
||||
confirmRemoveEventListeners();
|
||||
}
|
||||
|
||||
private function onInfoBtnDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
GenericListGuiManager.genericListVolumeClicked(52);
|
||||
}
|
||||
|
||||
private function onInfoBtnOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
GuiManager.toolTip.init(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14678),param1.currentTarget.x + _recyclePopup.x,param1.currentTarget.y + _recyclePopup.y + param1.currentTarget.height);
|
||||
GuiManager.toolTip.startTimer(param1);
|
||||
}
|
||||
|
||||
private function addListeners() : void
|
||||
{
|
||||
_recyclePopup.addEventListener("mouseDown",onPopupDown,false,0,true);
|
||||
_recyclePopup.bx.addEventListener("mouseDown",onClose,false,0,true);
|
||||
_recyclePopup.infoBtn.addEventListener("mouseDown",onInfoBtnDown,false,0,true);
|
||||
_recyclePopup.infoBtn.addEventListener("mouseOver",onInfoBtnOver,false,0,true);
|
||||
_recyclePopup.infoBtn.addEventListener("mouseOut",onInfoBtnOut,false,0,true);
|
||||
_recyclePopup.recycleBtn.addEventListener("mouseDown",onRecycleBtn,false,0,true);
|
||||
}
|
||||
|
||||
private function confirmAddEventListeners() : void
|
||||
{
|
||||
if(_confirmPopup)
|
||||
{
|
||||
_confirmPopup.addEventListener("mouseDown",onPopupDown,false,0,true);
|
||||
_confirmPopup.bx.addEventListener("mouseDown",onConfirmNoOrExit,false,0,true);
|
||||
_confirmPopup.okBtn.addEventListener("mouseDown",onConfirmOkBtn,false,0,true);
|
||||
_confirmPopup.noBtn.addEventListener("mouseDown",onConfirmNoOrExit,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
private function removeListeners() : void
|
||||
{
|
||||
_recyclePopup.removeEventListener("mouseDown",onPopupDown);
|
||||
_recyclePopup.bx.removeEventListener("mouseDown",onClose);
|
||||
_recyclePopup.infoBtn.removeEventListener("mouseDown",onInfoBtnDown);
|
||||
_recyclePopup.infoBtn.removeEventListener("mouseOver",onInfoBtnOver);
|
||||
_recyclePopup.infoBtn.removeEventListener("mouseOut",onInfoBtnOut);
|
||||
_recyclePopup.recycleBtn.removeEventListener("mouseDown",onRecycleBtn);
|
||||
}
|
||||
|
||||
private function confirmRemoveEventListeners() : void
|
||||
{
|
||||
if(_confirmPopup)
|
||||
{
|
||||
_confirmPopup.removeEventListener("mouseDown",onPopupDown);
|
||||
_confirmPopup.bx.removeEventListener("mouseDown",onConfirmNoOrExit);
|
||||
_confirmPopup.okBtn.removeEventListener("mouseDown",onConfirmOkBtn);
|
||||
_confirmPopup.noBtn.removeEventListener("mouseDown",onConfirmNoOrExit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,360 @@
|
||||
package gui
|
||||
{
|
||||
import buddy.BuddyXtCommManager;
|
||||
import com.sbi.popup.SBPopup;
|
||||
import facilitator.FacilitatorXtCommManager;
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
import playerWall.PlayerWallManager;
|
||||
|
||||
public class ReportAPlayer
|
||||
{
|
||||
|
||||
public static const REASONS_ALL:int = 0;
|
||||
|
||||
public static const REASONS_PLAYER_CARD:int = 1;
|
||||
|
||||
public static const REASONS_ECARD:int = 2;
|
||||
|
||||
public static const REASONS_PLAYER_WALL:int = 3;
|
||||
|
||||
public static const REASONS_MASTERPIECE:int = 4;
|
||||
|
||||
private static var _reportFromCardPopup:SBPopup;
|
||||
|
||||
private var _popupLayer:DisplayObjectContainer;
|
||||
|
||||
private var _reportPopup:SBPopup;
|
||||
|
||||
private var _agreeBox:GuiCheckBox;
|
||||
|
||||
private var _reportConfirmMediaHelper:MediaHelper;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
private var _dataToPassAlong:Object;
|
||||
|
||||
private var _report:MovieClip;
|
||||
|
||||
private var _reportFromCard:MovieClip;
|
||||
|
||||
private var _reportFromCardConfirmPopup:MovieClip;
|
||||
|
||||
private var _isFromPlayersCard:Boolean;
|
||||
|
||||
private var _reportAPlayer:Boolean;
|
||||
|
||||
private var _hasReported:Boolean;
|
||||
|
||||
private var _playersAvatarUserName:String;
|
||||
|
||||
private var _playersModeratedAvatarUserName:String;
|
||||
|
||||
private var _reasonArray:Array;
|
||||
|
||||
private var _reasonToId:Vector.<String>;
|
||||
|
||||
private var _reasonsType:int;
|
||||
|
||||
public function ReportAPlayer()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function closeReportFromCardPopoup() : void
|
||||
{
|
||||
if(_reportFromCardPopup)
|
||||
{
|
||||
_reportFromCardPopup.close();
|
||||
}
|
||||
}
|
||||
|
||||
public function init(param1:int, param2:DisplayObjectContainer, param3:Function = null, param4:Boolean = false, param5:String = null, param6:String = null, param7:Boolean = true, param8:* = null, param9:int = -1, param10:int = 450, param11:int = 275) : void
|
||||
{
|
||||
_popupLayer = param2;
|
||||
_closeCallback = param3;
|
||||
_isFromPlayersCard = param4;
|
||||
_playersAvatarUserName = param5;
|
||||
_playersModeratedAvatarUserName = param6;
|
||||
_hasReported = false;
|
||||
_reportAPlayer = param7;
|
||||
_dataToPassAlong = param8;
|
||||
_reasonsType = param1;
|
||||
if(param4)
|
||||
{
|
||||
_reasonArray = [LocalizationManager.translateIdOnly(11372),LocalizationManager.translateIdOnly(14791),LocalizationManager.translateIdOnly(14793),LocalizationManager.translateIdOnly(14794),LocalizationManager.translateIdOnly(14795),LocalizationManager.translateIdOnly(15736),LocalizationManager.translateIdOnly(15737)];
|
||||
if(param1 == 0)
|
||||
{
|
||||
_reasonArray.push(LocalizationManager.translateIdOnly(14792));
|
||||
_reasonArray.push(LocalizationManager.translateIdOnly(20088));
|
||||
_reasonArray.push(LocalizationManager.translateIdOnly(23217));
|
||||
}
|
||||
else if(param1 == 1)
|
||||
{
|
||||
_reasonArray.push(LocalizationManager.translateIdOnly(14792));
|
||||
}
|
||||
else if(param1 == 2)
|
||||
{
|
||||
_reasonArray.push(LocalizationManager.translateIdOnly(20088));
|
||||
}
|
||||
else if(param1 == 3)
|
||||
{
|
||||
_reasonArray.push(LocalizationManager.translateIdOnly(23217));
|
||||
}
|
||||
else if(param1 == 4)
|
||||
{
|
||||
_reasonArray.push(LocalizationManager.translateIdOnly(25195));
|
||||
}
|
||||
_reasonToId = new <String>[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),LocalizationManager.translateIdOnly(23217),LocalizationManager.translateIdOnly(25195)];
|
||||
_reportFromCard = GETDEFINITIONBYNAME("ReportPopupReportContent");
|
||||
_reportFromCardPopup = new SBPopup(_popupLayer,GETDEFINITIONBYNAME("ReportPopupReportSkin"),_reportFromCard,true,true,false,false,true);
|
||||
_reportFromCardPopup.x = param10;
|
||||
_reportFromCardPopup.y = param11;
|
||||
_reportFromCardPopup.bxClosesPopup = false;
|
||||
LocalizationManager.translateId(_reportFromCard.reasonTxt,11372);
|
||||
LocalizationManager.translateIdAndInsert(_reportFromCard.titleTxt,11373,_playersModeratedAvatarUserName);
|
||||
SafeChatManager.buildSafeChatTree(_reportFromCard.reasonChatTree,"ECardTextTreeNode",1,onReasonTextClose,_reasonArray);
|
||||
SafeChatManager.closeSafeChat(_reportFromCard.reasonChatTree);
|
||||
if(param9 != -1)
|
||||
{
|
||||
_reportFromCard.reasonTxt.text = _reasonArray[param9];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_report = GETDEFINITIONBYNAME("ReportPopupHowToContent2");
|
||||
_reportPopup = new SBPopup(_popupLayer,GETDEFINITIONBYNAME("ReportPopupHowToSkin"),_report);
|
||||
_reportPopup.x = param10;
|
||||
_reportPopup.y = param11;
|
||||
_reportPopup.bxClosesPopup = false;
|
||||
}
|
||||
addListeners();
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
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) && _playersAvatarUserName != null && _playersAvatarUserName.length > 0)
|
||||
{
|
||||
BuddyXtCommManager.sendBuddyBlockRequest(_playersAvatarUserName);
|
||||
delete PlayerWallManager.tokenMap[_playersAvatarUserName.toLowerCase()];
|
||||
}
|
||||
}
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback(_hasReported);
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private function onReportBtnHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_reportAPlayer)
|
||||
{
|
||||
FacilitatorXtCommManager.sendReportAPlayerRequest(_playersAvatarUserName,reasonIdForReason(_reportFromCard.reasonTxt.text),reportAPlayerResponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
FacilitatorXtCommManager.sendReportWithAdditionalDataRequest(_playersAvatarUserName,_reasonsType == 3 ? 7 : 8,reasonIdForReason(_reportFromCard.reasonTxt.text),_dataToPassAlong as String,reportAPlayerResponse);
|
||||
}
|
||||
_reportFromCardPopup.close();
|
||||
}
|
||||
|
||||
private function reasonIdForReason(param1:String) : int
|
||||
{
|
||||
switch(param1)
|
||||
{
|
||||
case _reasonToId[0]:
|
||||
return 1;
|
||||
case _reasonToId[1]:
|
||||
return 2;
|
||||
case _reasonToId[2]:
|
||||
return 5;
|
||||
case _reasonToId[3]:
|
||||
return 3;
|
||||
case _reasonToId[4]:
|
||||
return 4;
|
||||
case _reasonToId[5]:
|
||||
return 6;
|
||||
case _reasonToId[6]:
|
||||
return 7;
|
||||
case _reasonToId[7]:
|
||||
return 13;
|
||||
case _reasonToId[8]:
|
||||
return 14;
|
||||
case _reasonToId[9]:
|
||||
return 15;
|
||||
case _reasonToId[10]:
|
||||
return 16;
|
||||
default:
|
||||
throw new Error("Reason for reporting is invalid. Reason: " + param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function onNoHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
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,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("mouseDown",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("mouseDown",onClose,false,0,true);
|
||||
}
|
||||
_reportFromCard.reportBtn.addEventListener("mouseDown",onReportBtnHandler,false,0,true);
|
||||
_reportFromCard.noBtn.addEventListener("mouseDown",onNoHandler,false,0,true);
|
||||
_reportFromCard.addTxtBtn.addEventListener("mouseDown",onReasonHandler,false,0,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_reportPopup)
|
||||
{
|
||||
_reportPopup.skin.s["bx"].addEventListener("mouseDown",onClose,false,0,true);
|
||||
}
|
||||
_report.rulesReportBtn.addEventListener("mouseDown",onRules,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
private function removeListeners() : void
|
||||
{
|
||||
if(_isFromPlayersCard)
|
||||
{
|
||||
if(_reportFromCardPopup)
|
||||
{
|
||||
_reportFromCardPopup.skin.s["bx"].removeEventListener("mouseDown",onClose);
|
||||
}
|
||||
if(_reportFromCardConfirmPopup)
|
||||
{
|
||||
_reportFromCardConfirmPopup.okBtn.addEventListener("mouseDown",onClose);
|
||||
}
|
||||
_reportFromCard.reportBtn.removeEventListener("mouseDown",onReportBtnHandler);
|
||||
_reportFromCard.noBtn.removeEventListener("mouseDown",onNoHandler);
|
||||
_reportFromCard.addTxtBtn.addEventListener("mouseDown",onReasonHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_reportPopup)
|
||||
{
|
||||
_reportPopup.skin.s["bx"].removeEventListener("mouseDown",onClose);
|
||||
}
|
||||
_report.rulesReportBtn.removeEventListener("mouseDown",onRules);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,568 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
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
|
||||
{
|
||||
_scrollContent = param1;
|
||||
_scrollContent.y = 0;
|
||||
_scrollContent.x = 0;
|
||||
var _loc9_:MovieClip = GETDEFINITIONBYNAME(param5);
|
||||
if(_loc9_.track && _loc9_.handle)
|
||||
{
|
||||
_track = _loc9_.track;
|
||||
_scrollHandle = _loc9_.handle;
|
||||
_topBtn = _loc9_.topBtn;
|
||||
_bottomBtn = _loc9_.botBtn;
|
||||
_snapHeight = param6;
|
||||
_gap = param4;
|
||||
_viewableWidth = param2;
|
||||
_viewableHeight = param3;
|
||||
_numPerRow = Math.round(_viewableWidth / _scrollContent.boxWidth);
|
||||
if(param8 < _viewableHeight)
|
||||
{
|
||||
_scrollContentHeight = _scrollContent.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
_scrollContentHeight = param8;
|
||||
}
|
||||
_scrollContentMask = createMask(_viewableWidth,_viewableHeight);
|
||||
_scrollContent.parent.addChild(_scrollContentMask);
|
||||
_scrollContentMask.x = _scrollContent.x;
|
||||
_scrollContentMask.y = _scrollContent.y;
|
||||
_scrollContent.mask = _scrollContentMask;
|
||||
_scrollHeight = _scrollContentHeight - _scrollContentMask.height;
|
||||
if(param7 <= 0)
|
||||
{
|
||||
_currContentY = 0;
|
||||
}
|
||||
else if(param7 > _scrollHeight)
|
||||
{
|
||||
_currContentY = _scrollHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currContentY = param7;
|
||||
}
|
||||
setupAllItems();
|
||||
_numRowsInView = Math.round(_viewableHeight / _snapHeight);
|
||||
_fullScreenScrollChange = _snapHeight * (_numRowsInView - 1);
|
||||
_handleMovementPercentage = 0;
|
||||
_bounds = new Rectangle(_track.x,_scrollContentMask.y,0,Math.round(_bottomBtn.y - _scrollHandle.height));
|
||||
_bounds.top = _topBtn.height;
|
||||
_adjTrackHeight = _track.height - _scrollHandle.height;
|
||||
_wheelScrollPercent = _snapHeight / (_scrollContentHeight - _scrollContentMask.height);
|
||||
_wheelScrollChange = _wheelScrollPercent * (_scrollContentMask.y + _scrollContentMask.height - _scrollHandle.height);
|
||||
setScrollHandleLocation(_currContentY);
|
||||
updateLoadItems();
|
||||
_scrollContent.y = _scrollContentMask.y - _currContentY;
|
||||
return;
|
||||
}
|
||||
throw new Error("Error: SBSCrollbar.init()- The 5th parameter must contain two symbols; \'track\' and \'handle\'.");
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
if(_scrollHandle)
|
||||
{
|
||||
_scrollHandle.y = 0;
|
||||
_scrollContent.y = 0;
|
||||
}
|
||||
if(_scrollContent)
|
||||
{
|
||||
if(_scrollContent.stage)
|
||||
{
|
||||
_scrollContent.stage.removeEventListener("mouseUp",onMouseUpHandler);
|
||||
_scrollContent.stage.removeEventListener("mouseMove",onMouseMoveHandler);
|
||||
}
|
||||
if(_scrollContent.parent)
|
||||
{
|
||||
_scrollContent.parent.removeEventListener("mouseWheel",onMouseWheelHandler);
|
||||
if(_scrollContent.stage)
|
||||
{
|
||||
_scrollContent.parent.stage.removeEventListener("mouseUp",onMouseUpHandler);
|
||||
}
|
||||
if(_scrollContent.parent.parent)
|
||||
{
|
||||
_scrollContent.parent.parent.removeEventListener("rollOut",onStageOut);
|
||||
}
|
||||
if(_scrollContent.parent && _scrollContent.parent.parent && _scrollContent.parent.parent.parent)
|
||||
{
|
||||
_scrollContent.parent.parent.parent.removeEventListener("mouseUp",onMouseUpHandler);
|
||||
}
|
||||
if(_scrollContentMask && _scrollContentMask.parent)
|
||||
{
|
||||
_scrollContentMask.parent.removeChild(_scrollContentMask);
|
||||
}
|
||||
if(_track && _track.parent && _track.parent == _scrollContent.parent)
|
||||
{
|
||||
_scrollContent.parent.removeChild(_track);
|
||||
}
|
||||
if(_scrollHandle && _scrollHandle.parent && _scrollHandle.parent == _scrollContent.parent)
|
||||
{
|
||||
_scrollHandle.removeEventListener("mouseDown",onMouseDownHandler);
|
||||
_scrollContent.parent.removeChild(_scrollHandle);
|
||||
}
|
||||
if(_topBtn && _topBtn.parent && _topBtn.parent == _scrollContent.parent)
|
||||
{
|
||||
_topBtn.removeEventListener("mouseDown",onBtnClick);
|
||||
_scrollContent.parent.removeChild(_topBtn);
|
||||
}
|
||||
if(_bottomBtn && _bottomBtn.parent && _bottomBtn.parent == _scrollContent.parent)
|
||||
{
|
||||
_bottomBtn.removeEventListener("mouseDown",onBtnClick);
|
||||
_scrollContent.parent.removeChild(_bottomBtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
_track = null;
|
||||
_scrollHandle = null;
|
||||
_topBtn = null;
|
||||
_bottomBtn = null;
|
||||
_scrollContent = null;
|
||||
_scrollContentMask = null;
|
||||
_bounds = null;
|
||||
_gap = NaN;
|
||||
_snapHeight = NaN;
|
||||
_viewableWidth = NaN;
|
||||
_viewableHeight = NaN;
|
||||
_adjTrackHeight = NaN;
|
||||
_handleMovementPercentage = NaN;
|
||||
_currContentY = NaN;
|
||||
_numRowsInView = NaN;
|
||||
_fullScreenScrollChange = NaN;
|
||||
}
|
||||
|
||||
public function get scrollHeight() : Number
|
||||
{
|
||||
return _scrollHeight;
|
||||
}
|
||||
|
||||
public function get getMaskHeight() : Number
|
||||
{
|
||||
return _scrollContentMask.height;
|
||||
}
|
||||
|
||||
public function get getMaskY() : Number
|
||||
{
|
||||
return _scrollContentMask.y;
|
||||
}
|
||||
|
||||
public function get scrollYValue() : Number
|
||||
{
|
||||
if(_scrollContentHeight <= _scrollContentMask.height)
|
||||
{
|
||||
_currContentY = 0;
|
||||
}
|
||||
return _currContentY;
|
||||
}
|
||||
|
||||
public function get scrollYPercentage() : Number
|
||||
{
|
||||
if(_scrollContentHeight <= _scrollContentMask.height)
|
||||
{
|
||||
return _currContentY = 0;
|
||||
}
|
||||
return _currContentY / _scrollHeight;
|
||||
}
|
||||
|
||||
public function get getScrollContentParent() : MovieClip
|
||||
{
|
||||
return MovieClip(_scrollContent.parent);
|
||||
}
|
||||
|
||||
public function scrollToElement(param1:int, param2:Boolean = false) : void
|
||||
{
|
||||
if(param1 < 0 || param1 > _scrollContentHeight / _snapHeight)
|
||||
{
|
||||
throw new Error("Invalid index.");
|
||||
}
|
||||
var _loc3_:Number = Math.min(_scrollHeight,param1 * _snapHeight - _currContentY);
|
||||
updateContentPosition(_loc3_ < 0 ? 0 : _loc3_,param2);
|
||||
}
|
||||
|
||||
private function setupAllItems() : void
|
||||
{
|
||||
_scrollContent.parent.addChild(_track);
|
||||
_track.x = Math.round(_scrollContent.x + _viewableWidth + _gap + _track.width * 0.5);
|
||||
_track.y = _scrollContent.y + _topBtn.height;
|
||||
_track.height = _scrollContentMask.height - _topBtn.height - _bottomBtn.height;
|
||||
_scrollContent.parent.addChild(_topBtn);
|
||||
_topBtn.x = _track.x;
|
||||
_topBtn.y = _scrollContent.y;
|
||||
_scrollContent.parent.addChild(_bottomBtn);
|
||||
_bottomBtn.x = _track.x;
|
||||
_bottomBtn.y = _track.y + _track.height;
|
||||
_scrollContent.parent.addChild(_scrollHandle);
|
||||
_scrollHandle.x = _track.x;
|
||||
_scrollHandle.y = _track.y;
|
||||
resizeHandle();
|
||||
}
|
||||
|
||||
private function snapToPlace() : void
|
||||
{
|
||||
var _loc3_:Number = Math.round(_scrollHeight * _handleMovementPercentage / _snapHeight);
|
||||
_loc3_ = _snapHeight * _loc3_;
|
||||
var _loc1_:Number = _loc3_ / _scrollHeight;
|
||||
_currContentY = _scrollHeight * _loc1_;
|
||||
new GTween(_scrollContent,0.5,{"y":_scrollContentMask.y - _currContentY},{"ease":Quadratic.easeOut});
|
||||
setScrollHandleLocation(_currContentY);
|
||||
var _loc2_:Number = Math.max(_scrollHandle.y,_track.y);
|
||||
new GTween(_scrollHandle,0.5,{"y":_loc2_},{"ease":Quadratic.easeOut});
|
||||
}
|
||||
|
||||
private function setScrollHandleLocation(param1:Number) : void
|
||||
{
|
||||
var _loc2_:Number = Math.min(1,param1 / _scrollHeight);
|
||||
var _loc3_:Number = _loc2_ * _scrollHeight;
|
||||
_loc3_ /= _snapHeight;
|
||||
_handleMovementPercentage = _loc3_ * _snapHeight / _scrollHeight;
|
||||
_scrollHandle.y = Math.max(_handleMovementPercentage * _adjTrackHeight + _topBtn.height,_track.y);
|
||||
}
|
||||
|
||||
private function loadCurrViewableObjects(param1:Number) : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc2_:int = Math.ceil(param1 / _snapHeight);
|
||||
var _loc6_:int = _loc2_ * _numPerRow;
|
||||
var _loc3_:int = _loc6_ + _numRowsInView * _numPerRow;
|
||||
var _loc4_:int = int(_scrollContent.bg.numChildren);
|
||||
_loc5_ = _loc6_;
|
||||
while(_loc5_ < _loc3_)
|
||||
{
|
||||
if(_loc5_ < _loc4_)
|
||||
{
|
||||
_scrollContent.bg.getChildAt(_loc5_).loadCurrItem(param1);
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function updateLoadItems(param1:Boolean = false) : void
|
||||
{
|
||||
var _loc3_:Number = NaN;
|
||||
var _loc2_:Number = NaN;
|
||||
if(_scrollContent.hasOwnProperty("bg"))
|
||||
{
|
||||
if(!param1)
|
||||
{
|
||||
loadCurrViewableObjects(_currContentY);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = Math.round(_scrollHeight * _handleMovementPercentage / _snapHeight);
|
||||
_loc3_ = _snapHeight * _loc3_;
|
||||
_loc2_ = _loc3_ / _scrollHeight;
|
||||
loadCurrViewableObjects(_scrollHeight * _loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function updateContentPosition(param1:Number = NaN, param2:Boolean = false) : void
|
||||
{
|
||||
if(!isNaN(param1))
|
||||
{
|
||||
_currContentY += param1;
|
||||
setScrollHandleLocation(_currContentY);
|
||||
updateLoadItems();
|
||||
_scrollTween = new GTween(_scrollContent,param2 ? 0.001 : 0.5,{"y":_scrollContentMask.y - _currContentY},{"ease":Quadratic.easeOut});
|
||||
}
|
||||
else
|
||||
{
|
||||
_handleMovementPercentage = Math.min(1,(_scrollHandle.y - _topBtn.height) / _adjTrackHeight);
|
||||
updateLoadItems(true);
|
||||
_scrollTween = new GTween(_scrollContent,0.001,{"y":_scrollContentMask.y - _scrollHeight * _handleMovementPercentage},{"ease":Quadratic.easeOut});
|
||||
}
|
||||
}
|
||||
|
||||
private function onBtnClick(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
var _loc2_:Number = 0;
|
||||
if(_scrollTween)
|
||||
{
|
||||
_scrollTween.end();
|
||||
}
|
||||
if(param1.currentTarget.name == _topBtn.name)
|
||||
{
|
||||
_loc2_ = scrollUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = scrollDown();
|
||||
}
|
||||
if(_loc2_ != 0)
|
||||
{
|
||||
updateContentPosition(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private function scrollUp() : Number
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
if(_currContentY > 0)
|
||||
{
|
||||
if(_currContentY >= _fullScreenScrollChange)
|
||||
{
|
||||
_loc2_ = -_fullScreenScrollChange;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = _numRowsInView - 2;
|
||||
while(_loc1_ > 0)
|
||||
{
|
||||
if(_currContentY >= _snapHeight * _loc1_)
|
||||
{
|
||||
_loc2_ = -(_snapHeight * _loc1_);
|
||||
break;
|
||||
}
|
||||
_loc1_--;
|
||||
}
|
||||
if(_loc2_ > -_currContentY)
|
||||
{
|
||||
_loc2_ = -_currContentY;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
private function scrollDown() : Number
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:Number = 0;
|
||||
var _loc1_:Number = _scrollContentHeight - _currContentY - _viewableHeight;
|
||||
if(_loc1_ > 0)
|
||||
{
|
||||
if(_loc1_ >= _fullScreenScrollChange)
|
||||
{
|
||||
_loc3_ = _fullScreenScrollChange;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = _numRowsInView - 2;
|
||||
while(_loc2_ > 0)
|
||||
{
|
||||
if(_loc1_ >= _snapHeight * _loc2_)
|
||||
{
|
||||
_loc3_ = _snapHeight * _loc2_;
|
||||
break;
|
||||
}
|
||||
_loc2_--;
|
||||
}
|
||||
if(_loc3_ < _loc1_)
|
||||
{
|
||||
_loc3_ = _loc1_;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
private function onMouseDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_scrollHandle.height < _scrollContentHeight - 3)
|
||||
{
|
||||
_scrollHandle.startDrag(false,_bounds);
|
||||
_scrollContent.parent.parent.addEventListener("rollOut",onStageOut,false,0,true);
|
||||
_scrollContent.stage.addEventListener("mouseMove",onMouseMoveHandler,false,0,true);
|
||||
_scrollContent.parent.stage.addEventListener("mouseUp",onMouseUpHandler,false,0,true);
|
||||
_scrollContent.parent.parent.parent.addEventListener("mouseUp",onMouseUpHandler,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
private function onStageOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
onMouseUpHandler(param1);
|
||||
}
|
||||
|
||||
private function onMouseUpHandler(param1:MouseEvent = null) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
_scrollHandle.stopDrag();
|
||||
if(_scrollTween)
|
||||
{
|
||||
_scrollTween.end();
|
||||
}
|
||||
if(_snapHeight > 0)
|
||||
{
|
||||
snapToPlace();
|
||||
}
|
||||
if(_scrollContent.stage)
|
||||
{
|
||||
_scrollContent.stage.removeEventListener("mouseMove",onMouseMoveHandler);
|
||||
}
|
||||
if(_scrollContent.parent.stage)
|
||||
{
|
||||
_scrollContent.parent.stage.removeEventListener("mouseUp",onMouseUpHandler);
|
||||
}
|
||||
if(_scrollContent.parent.parent)
|
||||
{
|
||||
_scrollContent.parent.parent.removeEventListener("rollOut",onStageOut);
|
||||
}
|
||||
if(_scrollContent.parent.parent.parent)
|
||||
{
|
||||
_scrollContent.parent.parent.parent.removeEventListener("mouseUp",onMouseUpHandler);
|
||||
}
|
||||
}
|
||||
|
||||
private function onTrackDown(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:Number = 0;
|
||||
var _loc3_:Number = Math.ceil(param1.localY * param1.currentTarget.scaleY);
|
||||
if(_scrollTween)
|
||||
{
|
||||
_scrollTween.end();
|
||||
}
|
||||
if(_loc3_ < _scrollHandle.y + _scrollHandle.height - _topBtn.height)
|
||||
{
|
||||
_loc2_ = scrollUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = scrollDown();
|
||||
}
|
||||
if(_loc2_ != 0)
|
||||
{
|
||||
updateContentPosition(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private function onMouseMoveHandler(param1:MouseEvent) : void
|
||||
{
|
||||
updateContentPosition();
|
||||
}
|
||||
|
||||
private function onMouseWheelHandler(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:Number = 0;
|
||||
if(param1.delta > 0)
|
||||
{
|
||||
_loc2_ = scrollUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = scrollDown();
|
||||
}
|
||||
if(_loc2_ != 0)
|
||||
{
|
||||
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(_scrollContentHeight <= _scrollContentMask.height || _currContentY != _scrollHeight && _scrollContentHeight - _currContentY - _viewableHeight < _snapHeight)
|
||||
{
|
||||
_scrollHandle.visible = false;
|
||||
if(_topBtn.hasGrayState && _bottomBtn.hasGrayState)
|
||||
{
|
||||
_topBtn.activateGrayState(true);
|
||||
_bottomBtn.activateGrayState(true);
|
||||
}
|
||||
if(_scrollContent.parent.hasEventListener("mouseWheel"))
|
||||
{
|
||||
_scrollContent.parent.removeEventListener("mouseWheel",onMouseWheelHandler);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_ = _scrollContentMask.height / _scrollContentHeight * _scrollContentMask.height - _topBtn.height - _bottomBtn.height;
|
||||
_topBtn.addEventListener("mouseDown",onBtnClick,false,0,true);
|
||||
_bottomBtn.addEventListener("mouseDown",onBtnClick,false,0,true);
|
||||
_scrollHandle.addEventListener("mouseDown",onMouseDownHandler,false,0,true);
|
||||
_track.addEventListener("mouseDown",onTrackDown,false,0,true);
|
||||
_scrollContent.parent.addEventListener("mouseWheel",onMouseWheelHandler,false,0,true);
|
||||
if(_loc1_ < 30)
|
||||
{
|
||||
_loc1_ = 30;
|
||||
}
|
||||
_scrollHandle.mid.height = _loc1_ - _scrollHandle.top.height - _scrollHandle.bot.height;
|
||||
_scrollHandle.top.y = 0;
|
||||
_scrollHandle.mid.y = _scrollHandle.top.y + _scrollHandle.top.height - 0.1;
|
||||
_scrollHandle.bot.y = _scrollHandle.mid.y + _scrollHandle.mid.height - 0.1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,714 @@
|
||||
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 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;
|
||||
|
||||
public static const TREE_PLAYERWALL:int = 5;
|
||||
|
||||
public static var sctNodes:Array;
|
||||
|
||||
public static var ctNodes:Array;
|
||||
|
||||
public static var photoBoothNodes:Array;
|
||||
|
||||
public static var adventureNodes:Array;
|
||||
|
||||
public static var playerWallNodes:Array;
|
||||
|
||||
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;
|
||||
|
||||
private static const PLAYERWALL_LOCALIZATION_ID:int = 333;
|
||||
|
||||
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 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 = playerWallNodes = 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_:* = 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 == 1)
|
||||
{
|
||||
_treeArray = ctNodes;
|
||||
}
|
||||
else if(param3 == 3)
|
||||
{
|
||||
_treeArray = photoBoothNodes;
|
||||
}
|
||||
else if(param3 == 4)
|
||||
{
|
||||
_treeArray = adventureNodes;
|
||||
}
|
||||
else if(param3 == 5)
|
||||
{
|
||||
_treeArray = playerWallNodes;
|
||||
}
|
||||
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("mouseDown",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(47,onListLoaded);
|
||||
GenericListXtCommManager.requestGenericList(66,onListLoaded);
|
||||
GenericListXtCommManager.requestGenericList(158,onListLoaded);
|
||||
GenericListXtCommManager.requestGenericList(170,onListLoaded);
|
||||
GenericListXtCommManager.requestGenericList(333,onListLoaded);
|
||||
}
|
||||
|
||||
public static function containsInTreeArray(param1:String, param2:int = 0) : Boolean
|
||||
{
|
||||
var _loc5_:Object = null;
|
||||
var _loc3_:Boolean = false;
|
||||
var _loc7_:Array = null;
|
||||
var _loc4_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
if(param2 == 1)
|
||||
{
|
||||
_loc7_ = ctNodes;
|
||||
}
|
||||
else if(param2 == 3)
|
||||
{
|
||||
_loc7_ = photoBoothNodes;
|
||||
}
|
||||
else if(param2 == 4)
|
||||
{
|
||||
_loc7_ = adventureNodes;
|
||||
}
|
||||
else if(param2 == 5)
|
||||
{
|
||||
_loc7_ = playerWallNodes;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc7_ = sctNodes;
|
||||
}
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc7_.length)
|
||||
{
|
||||
_loc5_ = _loc7_[_loc4_];
|
||||
if(_loc5_ is Array)
|
||||
{
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc5_.length)
|
||||
{
|
||||
if(_loc5_[_loc6_] == param1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
else if(_loc5_ == param1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static function onListLoaded(param1:int, param2:Array) : void
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
var _loc4_:int = 0;
|
||||
var _loc6_:RegExp = /\r\n|\n|\r/g;
|
||||
var _loc5_:Array = [];
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < param2.length)
|
||||
{
|
||||
_loc3_ = LocalizationManager.translateIdOnly(param2[_loc4_]).split(_loc6_);
|
||||
if(_loc3_.length == 1)
|
||||
{
|
||||
_loc5_.push(_loc3_[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_.push(_loc3_);
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
if(param1 == 47)
|
||||
{
|
||||
sctNodes = _loc5_;
|
||||
}
|
||||
else if(param1 == 66)
|
||||
{
|
||||
ctNodes = _loc5_;
|
||||
}
|
||||
else if(param1 == 158)
|
||||
{
|
||||
photoBoothNodes = _loc5_;
|
||||
}
|
||||
else if(param1 == 170)
|
||||
{
|
||||
adventureNodes = _loc5_;
|
||||
}
|
||||
else if(param1 == 333)
|
||||
{
|
||||
playerWallNodes = _loc5_;
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugUtility.debugTrace("Loaded safe chat list that doesn\'t match!");
|
||||
}
|
||||
if(ctNodes && sctNodes && photoBoothNodes && adventureNodes && playerWallNodes)
|
||||
{
|
||||
buildSafeChatTree(_safeChatTree);
|
||||
}
|
||||
}
|
||||
|
||||
private static function buildChatTreeSubMenu(param1:Array, param2:DisplayObjectContainer, param3:uint) : void
|
||||
{
|
||||
var _loc4_:* = 0;
|
||||
var _loc8_:MovieClip = null;
|
||||
var _loc5_:* = 0;
|
||||
var _loc7_:DisplayObjectContainer = null;
|
||||
param3++;
|
||||
var _loc6_:Number = _nodeYLocation + (param1.length - 2) * (_safeTreeNodeHeight - 1);
|
||||
if(_loc6_ > _lowestNodeYLocation)
|
||||
{
|
||||
_nodeYLocation -= _loc6_ - _lowestNodeYLocation;
|
||||
}
|
||||
_loc4_ = 1;
|
||||
while(_loc4_ < param1.length)
|
||||
{
|
||||
_loc8_ = new SafeChatTreeNode();
|
||||
_loc8_.x = param3 * _loc8_.width - param2.x;
|
||||
_loc8_.y = _nodeYLocation + (_loc4_ - 1) * (_loc8_.height - 1);
|
||||
_loc5_ = param3;
|
||||
_loc7_ = param2;
|
||||
while(_loc5_ > 0)
|
||||
{
|
||||
_loc8_.y -= _loc7_.y;
|
||||
_loc7_ = _loc7_.parent;
|
||||
_loc5_--;
|
||||
}
|
||||
param2.addChild(_loc8_);
|
||||
_loc8_.visible = false;
|
||||
if(_loc8_.parent["menuNums"])
|
||||
{
|
||||
_loc8_["menuNums"] = _loc8_.parent["menuNums"].slice();
|
||||
_loc8_["menuNums"].push(_loc4_);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc8_["menuNums"] = [_loc4_];
|
||||
}
|
||||
_loc8_.addEventListener("mouseDown",sctNodeMouseHandler,false,0,true);
|
||||
if(param1[_loc4_] is String)
|
||||
{
|
||||
LocalizationManager.updateToFit(_loc8_.sctNodeTxt,param1[_loc4_]);
|
||||
_loc8_.sctNodeBG.gotoAndStop(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!(param1[_loc4_] is Array))
|
||||
{
|
||||
throw new Error("invalid type in scSubTree...");
|
||||
}
|
||||
LocalizationManager.updateToFit(_loc8_.sctNodeTxt,param1[_loc4_][0]);
|
||||
_loc8_.sctNodeBG.gotoAndStop(3);
|
||||
buildChatTreeSubMenu(param1[_loc4_],DisplayObjectContainer(_loc8_),param3);
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
|
||||
public static function destroy(param1:MovieClip = null) : void
|
||||
{
|
||||
if(param1 != null)
|
||||
{
|
||||
while(param1.numChildren > 1)
|
||||
{
|
||||
param1.getChildAt(param1.numChildren - 1).removeEventListener("mouseDown",sctNodeMouseHandler);
|
||||
param1.removeChildAt(param1.numChildren - 1);
|
||||
}
|
||||
_safeChatCallbackFromOtherSystem = null;
|
||||
param1.visible = false;
|
||||
param1 = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
while(_safeChatTree.numChildren > 0)
|
||||
{
|
||||
_safeChatTree.getChildAt(0).removeEventListener("mouseDown",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 _loc4_:DisplayObject = null;
|
||||
var _loc3_:* = 0;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < param1.numChildren)
|
||||
{
|
||||
_loc4_ = param1.getChildAt(_loc3_);
|
||||
if(_loc4_ == null)
|
||||
{
|
||||
DebugUtility.debugTrace(param2 + "NULL?!");
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugUtility.debugTrace(param2 + " " + _loc4_ + " " + _loc4_.name);
|
||||
}
|
||||
if(_loc4_ is DisplayObjectContainer)
|
||||
{
|
||||
traceDisplayList(DisplayObjectContainer(_loc4_),param2 + " ");
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
public static function resetSafeChatTree(param1:Boolean, param2:MovieClip = null) : void
|
||||
{
|
||||
var _loc5_:* = 0;
|
||||
var _loc7_:DisplayObject = null;
|
||||
var _loc6_:DisplayObjectContainer = null;
|
||||
var _loc3_:* = 0;
|
||||
var _loc8_:DisplayObject = null;
|
||||
if(param1)
|
||||
{
|
||||
SafeChatTreeNode = getDefinitionByName("SafeChatTreeNode") as Class;
|
||||
}
|
||||
var _loc4_:MovieClip = MovieClip(_safeChatTree.getChildAt(1));
|
||||
if(param2)
|
||||
{
|
||||
_loc4_ = param2;
|
||||
}
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc4_.numChildren)
|
||||
{
|
||||
_loc7_ = _loc4_.getChildAt(_loc5_);
|
||||
if(_loc7_ && _loc7_ is DisplayObjectContainer)
|
||||
{
|
||||
if(_loc7_ is SafeChatTreeNode)
|
||||
{
|
||||
if(SafeChatTreeNode(_loc7_).sctNodeBG.currentFrame == 4)
|
||||
{
|
||||
SafeChatTreeNode(_loc7_).sctNodeBG.gotoAndStop(3);
|
||||
}
|
||||
if(SafeChatTreeNode(_loc7_).sctNodeBG.currentFrame == 2)
|
||||
{
|
||||
SafeChatTreeNode(_loc7_).sctNodeBG.gotoAndStop(1);
|
||||
}
|
||||
}
|
||||
_loc6_ = DisplayObjectContainer(_loc7_);
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc6_.numChildren)
|
||||
{
|
||||
_loc8_ = _loc6_.getChildAt(_loc3_);
|
||||
if(_loc8_ && _loc8_ is SafeChatTreeNode)
|
||||
{
|
||||
_loc8_.visible = false;
|
||||
SafeChatTreeNode(_loc8_).sctNodeBG.gotoAndStop(1);
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
|
||||
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 _loc5_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
if(param2 != -1 || _treeArray == null)
|
||||
{
|
||||
if(param2 == 1)
|
||||
{
|
||||
_loc3_ = ctNodes;
|
||||
}
|
||||
else if(param2 == 3)
|
||||
{
|
||||
_loc3_ = photoBoothNodes;
|
||||
}
|
||||
else if(param2 == 4)
|
||||
{
|
||||
_loc3_ = adventureNodes;
|
||||
}
|
||||
else if(param2 == 5)
|
||||
{
|
||||
_loc3_ = playerWallNodes;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = sctNodes;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = _treeArray;
|
||||
}
|
||||
_loc5_ = 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 _loc4_:String = null;
|
||||
var _loc6_:* = 0;
|
||||
var _loc5_:Array = param1.split(",");
|
||||
if(param2 != -1 || _treeArray == null)
|
||||
{
|
||||
if(param2 == 1)
|
||||
{
|
||||
_treeArray = ctNodes;
|
||||
}
|
||||
else if(param2 == 3)
|
||||
{
|
||||
_treeArray = photoBoothNodes;
|
||||
}
|
||||
else if(param2 == 4)
|
||||
{
|
||||
_treeArray = adventureNodes;
|
||||
}
|
||||
else if(param2 == 5)
|
||||
{
|
||||
_treeArray = playerWallNodes;
|
||||
}
|
||||
else
|
||||
{
|
||||
_treeArray = sctNodes;
|
||||
}
|
||||
}
|
||||
else if(gMainFrame.clientInfo.roomType == 7)
|
||||
{
|
||||
_treeArray = adventureNodes;
|
||||
}
|
||||
else
|
||||
{
|
||||
_treeArray = sctNodes;
|
||||
}
|
||||
var _loc3_:Array = _treeArray;
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc5_.length)
|
||||
{
|
||||
if(_loc6_ >= _loc5_.length - 1)
|
||||
{
|
||||
if(_loc3_[_loc5_[_loc6_]] is String)
|
||||
{
|
||||
if(_loc4_ && _loc4_.indexOf("...") > 0 && _loc4_.indexOf("...") == _loc4_.length - 3)
|
||||
{
|
||||
return _loc4_.substr(0,_loc4_.length - 3) + " " + _loc3_[_loc5_[_loc6_]];
|
||||
}
|
||||
return _loc3_[_loc5_[_loc6_]];
|
||||
}
|
||||
if(_loc3_[_loc5_[_loc6_]] is Array)
|
||||
{
|
||||
return _loc3_[_loc5_[_loc6_]][0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if(_loc3_[_loc5_[_loc6_]] is String)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if(!(_loc3_[_loc5_[_loc6_]] is Array))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
_loc4_ = _loc3_[_loc5_[_loc6_]][0];
|
||||
_loc3_ = _loc3_[_loc5_[_loc6_]];
|
||||
_loc6_++;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function openSafeChat(param1:Boolean, param2:MovieClip = null) : void
|
||||
{
|
||||
if(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 != 0.5)
|
||||
{
|
||||
_safeChatTree.alpha = 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
public static function brightenSafeChat() : void
|
||||
{
|
||||
if(_safeChatTree.alpha != 1)
|
||||
{
|
||||
_safeChatTree.alpha = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static function closeSafeChat(param1:MovieClip = null) : void
|
||||
{
|
||||
if(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,305 @@
|
||||
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 gui.itemWindows.ItemWindowServer;
|
||||
import localization.LocalizationManager;
|
||||
import room.RoomXtCommManager;
|
||||
|
||||
public class ServerSelector
|
||||
{
|
||||
|
||||
private static const NUM_Y_WIN:int = 10;
|
||||
|
||||
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;
|
||||
|
||||
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 _loc7_:Boolean = false;
|
||||
var _loc3_:int = 0;
|
||||
var _loc10_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc11_:int = -1;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = LocalizationManager.accountLanguage;
|
||||
_availShards = [];
|
||||
_languageIds = [];
|
||||
_popuplation = [];
|
||||
_numBuddies = [];
|
||||
while(param1[_loc6_] != null)
|
||||
{
|
||||
_loc7_ = param1[_loc6_ + 2] == 0;
|
||||
if(_loc7_)
|
||||
{
|
||||
_loc4_++;
|
||||
}
|
||||
if(_loc7_ && _loc4_ > 5)
|
||||
{
|
||||
if(_loc11_ == -1)
|
||||
{
|
||||
_loc11_ = int(param1[_loc6_]);
|
||||
}
|
||||
_loc6_ += 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
_availShards[_loc8_] = param1[_loc6_++];
|
||||
_languageIds[_loc8_] = param1[_loc6_++];
|
||||
_loc3_ += int(param1[_loc6_]);
|
||||
_popuplation[_loc8_] = param1[_loc6_++];
|
||||
_numBuddies[_loc8_] = param1[_loc6_++];
|
||||
_loc8_++;
|
||||
}
|
||||
}
|
||||
if(_loc3_ >= _availShards.length * 4 && _loc8_ < _serverNames.length)
|
||||
{
|
||||
if(_loc11_ == -1)
|
||||
{
|
||||
_loc10_ = param2 + 1;
|
||||
_loc9_ = _loc5_;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc10_ = _loc11_;
|
||||
_loc9_ = int(_languageIds[_loc11_]);
|
||||
}
|
||||
_availShards.splice(0,0,String(_loc10_));
|
||||
_languageIds.splice(0,0,String(_loc9_));
|
||||
_popuplation.splice(0,0,"0");
|
||||
_numBuddies.splice(0,0,"0");
|
||||
}
|
||||
createServerButtons();
|
||||
}
|
||||
|
||||
public static function getShardName(param1:int) : String
|
||||
{
|
||||
var _loc2_:int = param1 - 1;
|
||||
if(_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 = _nameIdx + 1;
|
||||
return;
|
||||
}
|
||||
_nameIdx = 0;
|
||||
setupMoreServers(param1);
|
||||
}
|
||||
|
||||
private static function createServerButtons() : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc1_:MovieClip = null;
|
||||
if(_scrollButtons)
|
||||
{
|
||||
_scrollButtons.destroy();
|
||||
_scrollButtons = null;
|
||||
}
|
||||
if(_itemWindows && _itemWindows.numChildren > 0)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
var _loc4_:int = int(_availShards.length);
|
||||
var _loc5_:int = Math.min(_loc4_,2);
|
||||
var _loc2_:int = Math.min(_loc4_,10);
|
||||
_itemWindows = new WindowGenerator();
|
||||
_itemWindows.init(_loc5_,_loc2_,_loc4_,20,8,10,ItemWindowServer,null,"",{"mouseDown":winMouseDown},null,null,false,false);
|
||||
_serverAllContent.itemBlock.addChild(_itemWindows);
|
||||
_itemWindows.x = 0;
|
||||
_itemWindows.y = 0;
|
||||
_nameIdx = 0;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc4_)
|
||||
{
|
||||
_loc1_ = MovieClip(_itemWindows.bg.getChildAt(_loc3_));
|
||||
setupMoreServers(_loc1_);
|
||||
_loc3_++;
|
||||
}
|
||||
_scrollButtons = new SBScrollbar();
|
||||
_scrollButtons.init(_itemWindows,_serverAllContent.itemBlock.width - 31,_itemWindows.boxHeight * 10 + 8 * 10,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(5);
|
||||
}
|
||||
|
||||
private static function addListeners() : void
|
||||
{
|
||||
_serverAllPopup.skin.s["bx"].addEventListener("mouseDown",onCloseBtn,false,0,true);
|
||||
}
|
||||
|
||||
private static function removeListeners() : void
|
||||
{
|
||||
_serverAllPopup.skin.s["bx"].removeEventListener("mouseDown",onCloseBtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
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 static const AV_LYNX:int = 32;
|
||||
|
||||
public static const AV_ARCTIC_FOX:int = 33;
|
||||
|
||||
public static const AV_GOAT:int = 34;
|
||||
|
||||
public static const AV_FALCON:int = 35;
|
||||
|
||||
public static const AV_PIG:int = 36;
|
||||
|
||||
public function SharedAvatarAnimalConstants()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,365 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.Avatar;
|
||||
import avatar.AvatarEditorView;
|
||||
import avatar.AvatarUtility;
|
||||
import avatar.AvatarView;
|
||||
import collection.AccItemCollection;
|
||||
import com.sbi.analytics.SBTracker;
|
||||
import com.sbi.graphics.LayerAnim;
|
||||
import currency.UserCurrency;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Point;
|
||||
import inventory.Iitem;
|
||||
import item.Item;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class ShopWithPreview extends Shop
|
||||
{
|
||||
|
||||
private static const SHOP_WITH_PREVIEW_MEDIA_ID:int = 4753;
|
||||
|
||||
private static const NUM_COLOR_ICONS:int = 8;
|
||||
|
||||
private var _avtEditorView:AvatarEditorView;
|
||||
|
||||
private var _loadingSpiralAvatar:LoadingSpiral;
|
||||
|
||||
private var _accShownItems:AccItemCollection;
|
||||
|
||||
private var _isShowingAnItem:Boolean;
|
||||
|
||||
private var _lastItemAdded:Item;
|
||||
|
||||
private var _currColorIdx:int;
|
||||
|
||||
private var _lastWindowIx:int;
|
||||
|
||||
private var _lastItemOffset:int;
|
||||
|
||||
public function ShopWithPreview()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
override public function init(param1:int, param2:int, param3:Avatar, param4:DisplayLayer, param5:Function = null, param6:int = 0, param7:Function = null, param8:Boolean = false, param9:int = -1) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
SBTracker.push();
|
||||
_shopId = param1;
|
||||
_glDefType = param2;
|
||||
_playerAvatar = param3;
|
||||
_popupLayer = param4;
|
||||
_appendString = "";
|
||||
_isMember = gMainFrame.userInfo.isMember;
|
||||
_denRoomShopCallback = param7;
|
||||
_isShopOnlyDen = param8;
|
||||
_isInFFM = GuiManager.isInFFM;
|
||||
_useStartupShopIndex = param9;
|
||||
_denItemIdx = param6;
|
||||
_closeCallback = param5;
|
||||
_shopWithPreview = this;
|
||||
_lastItemAdded = null;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(4753,onShopLoaded);
|
||||
}
|
||||
|
||||
public function handleItemEquip(param1:Iitem, param2:int) : void
|
||||
{
|
||||
if(_lastWindowIx != param2 || _lastItemOffset != _itemOffset)
|
||||
{
|
||||
_shop["iw" + _lastWindowIx].yellowBG.visible = false;
|
||||
(_shop["iconItemWindow_" + (_currColorIdx + 1)] as GuiSoundToggleButton).downToUpState();
|
||||
_currColorIdx = _itemColorIdx = 0;
|
||||
}
|
||||
_lastWindowIx = param2;
|
||||
_lastItemOffset = _itemOffset;
|
||||
_shop["iw" + param2].yellowBG.visible = !_shop["iw" + param2].yellowBG.visible;
|
||||
if(param1 is Item)
|
||||
{
|
||||
if((param1 as Item).getInUse(_playerAvatar.perUserAvId))
|
||||
{
|
||||
hideItem(Item(param1));
|
||||
}
|
||||
else if(!(param1 as Item).getInUse(_playerAvatar.perUserAvId))
|
||||
{
|
||||
showItem(Item(param1));
|
||||
}
|
||||
if(_shop.buyPopup.visible)
|
||||
{
|
||||
setupBuyPopup();
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new Error("Trying to equip item that is not an Item");
|
||||
}
|
||||
|
||||
public function purchaseComplete() : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
_lastItemAdded.setInUse(_playerAvatar.perUserAvId,false);
|
||||
_lastItemAdded.setIconColor(_lastItemAdded.layerId,_itemColorsArray[_itemToBuy.defId][0]);
|
||||
_lastItemAdded = null;
|
||||
setBtnsAndName(false,null);
|
||||
if(_avtEditorView)
|
||||
{
|
||||
_shop.charBox.removeChild(_avtEditorView);
|
||||
}
|
||||
_loc2_ = 1;
|
||||
while(_loc2_ <= 8)
|
||||
{
|
||||
(_shop["iconItemWindow_" + _loc2_] as GuiSoundToggleButton).downToUpState();
|
||||
_loc2_++;
|
||||
}
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < 6)
|
||||
{
|
||||
_shop["iw" + _loc2_].yellowBG.visible = false;
|
||||
_loc2_++;
|
||||
}
|
||||
_avtEditorView = new AvatarEditorView();
|
||||
_avtEditorView.init(_playerAvatar,null,onAvatarChanged);
|
||||
var _loc1_:Point = AvatarUtility.getAvatarViewPosition(_avtEditorView.avTypeId);
|
||||
_avtEditorView.x = _loc1_.x;
|
||||
_avtEditorView.y = _loc1_.y;
|
||||
if(Utility.isOcean(_playerAvatar.enviroTypeFlag))
|
||||
{
|
||||
if(Utility.isLand(_playerAvatar.enviroTypeFlag))
|
||||
{
|
||||
_shop.charBox.gotoAndStop(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
_shop.charBox.gotoAndStop(2);
|
||||
}
|
||||
}
|
||||
_shop.charBox.addChild(_avtEditorView);
|
||||
_avtEditorView.playAnim(13,false,1,onAvatarLoaded);
|
||||
_accShownItems = new AccItemCollection(_avtEditorView.accShownItems.concatCollection(null));
|
||||
}
|
||||
|
||||
public function adjustColor() : void
|
||||
{
|
||||
setColorsOnIcons(_itemColorIdx);
|
||||
}
|
||||
|
||||
public function checkIfThisItemEquipped(param1:int) : void
|
||||
{
|
||||
if(_lastItemAdded && param1 == _lastWindowIx && _lastItemOffset == _itemOffset)
|
||||
{
|
||||
_shop["iw" + param1].yellowBG.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_shop["iw" + param1].yellowBG.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
override protected function toggleInitialVisibility() : void
|
||||
{
|
||||
super.toggleInitialVisibility();
|
||||
setBtnsAndName(false,null);
|
||||
_loadingSpiralAvatar = new LoadingSpiral(_shop.charBox);
|
||||
_avtEditorView = new AvatarEditorView();
|
||||
_avtEditorView.init(_playerAvatar,null,onAvatarChanged);
|
||||
var _loc1_:Point = AvatarUtility.getAvatarViewPosition(_avtEditorView.avTypeId);
|
||||
_avtEditorView.x = _loc1_.x;
|
||||
_avtEditorView.y = _loc1_.y;
|
||||
if(Utility.isOcean(_playerAvatar.enviroTypeFlag))
|
||||
{
|
||||
if(Utility.isLand(_playerAvatar.enviroTypeFlag))
|
||||
{
|
||||
_shop.charBox.gotoAndStop(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
_shop.charBox.gotoAndStop(2);
|
||||
}
|
||||
}
|
||||
_shop.charBox.addChild(_avtEditorView);
|
||||
_avtEditorView.playAnim(13,false,1,onAvatarLoaded);
|
||||
_accShownItems = new AccItemCollection(_avtEditorView.accShownItems.concatCollection(null));
|
||||
}
|
||||
|
||||
override protected function addListeners() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
super.addListeners();
|
||||
_shop.buyBtnGreenPreview.addEventListener("mouseDown",onBuyBtn,false,0,true);
|
||||
_shop.buyBtnRedPreview.addEventListener("mouseDown",onBuyBtn,false,0,true);
|
||||
_shop.zoomBtn.addEventListener("mouseDown",onZoomBtn,false,0,true);
|
||||
_loc1_ = 1;
|
||||
while(_loc1_ <= 8)
|
||||
{
|
||||
_shop["iconItemWindow_" + _loc1_].addEventListener("mouseDown",onIconItemDown,false,0,true);
|
||||
_loc1_++;
|
||||
}
|
||||
}
|
||||
|
||||
override protected function removeListeners() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
super.removeListeners();
|
||||
_shop.buyBtnGreenPreview.removeEventListener("mouseDown",onBuyBtn);
|
||||
_shop.buyBtnRedPreview.removeEventListener("mouseDown",onBuyBtn);
|
||||
_shop.zoomBtn.removeEventListener("mouseDown",onZoomBtn);
|
||||
_loc1_ = 1;
|
||||
while(_loc1_ <= 8)
|
||||
{
|
||||
_shop["iconItemWindow_" + _loc1_].removeEventListener("mouseDown",onIconItemDown);
|
||||
_loc1_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function onAvatarLoaded(param1:LayerAnim, param2:int) : void
|
||||
{
|
||||
if(_loadingSpiralAvatar)
|
||||
{
|
||||
_loadingSpiralAvatar.destroy();
|
||||
_loadingSpiralAvatar = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onAvatarChanged(param1:AvatarView) : void
|
||||
{
|
||||
_avtEditorView.playAnim(13,false,1,onAvatarLoaded);
|
||||
}
|
||||
|
||||
private function showItem(param1:Item, param2:Function = null) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(_lastItemAdded != null)
|
||||
{
|
||||
hideItem(_lastItemAdded);
|
||||
}
|
||||
_lastItemAdded = param1;
|
||||
_avtEditorView.showAccessory(param1,param2);
|
||||
_itemToBuy = _currShopItemArray.getIitem(_itemIdx);
|
||||
setupColorIcons();
|
||||
setBtnsAndName(true,param1);
|
||||
}
|
||||
}
|
||||
|
||||
private function hideItem(param1:Item) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
_avtEditorView.hideAccessory(param1);
|
||||
_lastItemAdded = null;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _accShownItems.length)
|
||||
{
|
||||
_itemToBuy = null;
|
||||
_avtEditorView.showAccessory(_accShownItems.getAccItem(_loc2_));
|
||||
_loc2_++;
|
||||
}
|
||||
setBtnsAndName(false,null);
|
||||
}
|
||||
}
|
||||
|
||||
private function setBtnsAndName(param1:Boolean, param2:Item) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
if(UserCurrency.hasEnoughCurrency(param2.currencyType,param2.value))
|
||||
{
|
||||
_shop.buyBtnGreenPreview.visible = true;
|
||||
_shop.buyBtnRedPreview.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_shop.buyBtnGreenPreview.visible = false;
|
||||
_shop.buyBtnRedPreview.visible = true;
|
||||
}
|
||||
LocalizationManager.updateToFit(_shop.itemNameTxt,param2.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
_shop.buyBtnGreenPreview.visible = false;
|
||||
_shop.buyBtnRedPreview.visible = false;
|
||||
}
|
||||
_shop.itemNameBa.visible = param1;
|
||||
_shop.itemNameTxt.visible = param1;
|
||||
_shop.previewBtnBa.visible = param1;
|
||||
_shop.zoomBtn.activateGrayState(!param1);
|
||||
_loc3_ = 1;
|
||||
while(_loc3_ <= 8)
|
||||
{
|
||||
_shop["iconItemWindow_" + _loc3_].visible = param1;
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function setupColorIcons() : void
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
var _loc2_:Item = null;
|
||||
var _loc1_:int = 0;
|
||||
if(_itemToBuy is Item && _itemColorsArray)
|
||||
{
|
||||
_loc3_ = _itemColorsArray[_itemToBuy.defId];
|
||||
_loc2_ = _itemToBuy.clone() as Item;
|
||||
_loc2_.specialScale = 0.5;
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < 8)
|
||||
{
|
||||
if(_loc3_[_loc1_] != null)
|
||||
{
|
||||
_loc2_.color = _loc3_[_loc1_];
|
||||
(_shop["iconItemWindow_" + (_loc1_ + 1)] as GuiSoundToggleButton).insertIitem(_loc2_,"itemLayer");
|
||||
_shop["iconItemWindow_" + (_loc1_ + 1)].mouseEnabled = true;
|
||||
_shop["iconItemWindow_" + (_loc1_ + 1)].mouseChildren = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_shop["iconItemWindow_" + (_loc1_ + 1)].mouseEnabled = false;
|
||||
_shop["iconItemWindow_" + (_loc1_ + 1)].mouseChildren = false;
|
||||
(_shop["iconItemWindow_" + (_loc1_ + 1)] as GuiSoundToggleButton).insertIitem(null,"itemLayer");
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
(_itemToBuy as Item).color = _loc3_[_itemColorIdx];
|
||||
(_shop["iconItemWindow_" + (_itemColorIdx + 1)] as GuiSoundToggleButton).upToDownState();
|
||||
}
|
||||
}
|
||||
|
||||
private function onZoomBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
setupBuyPopup();
|
||||
}
|
||||
}
|
||||
|
||||
private function onBuyBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
buyBtnDownHandler(null);
|
||||
}
|
||||
|
||||
private function onIconItemDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
setColorsOnIcons(param1.currentTarget.name.split("_")[1] - 1);
|
||||
}
|
||||
|
||||
private function setColorsOnIcons(param1:int) : void
|
||||
{
|
||||
(_shop["iconItemWindow_" + (_currColorIdx + 1)] as GuiSoundToggleButton).downToUpState();
|
||||
_currColorIdx = _itemColorIdx = param1;
|
||||
(_shop["iconItemWindow_" + (_currColorIdx + 1)] as GuiSoundToggleButton).upToDownState();
|
||||
(_itemToBuy as Item).color = _itemColorsArray[_itemToBuy.defId][_itemColorIdx];
|
||||
_avtEditorView.replaceAccItem(_itemToBuy as Item,_itemToBuy as Item);
|
||||
if(_shop.buyPopup.visible)
|
||||
{
|
||||
_itemToBuy.largeIcon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,121 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.text.TextField;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class SubmissionRulesPopup
|
||||
{
|
||||
|
||||
private const POPUP_MEDIA_ID:uint = 4812;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
private var _submissionRulesPopup:MovieClip;
|
||||
|
||||
private var _guiLayer:DisplayObjectContainer;
|
||||
|
||||
private var _cancelBtn:MovieClip;
|
||||
|
||||
private var _buyBtn:MovieClip;
|
||||
|
||||
private var _closeBtn:MovieClip;
|
||||
|
||||
private var _diamondCostText:TextField;
|
||||
|
||||
private var _itemCost:int;
|
||||
|
||||
public function SubmissionRulesPopup(param1:int, param2:DisplayObjectContainer, param3:Function)
|
||||
{
|
||||
super();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_itemCost = param1;
|
||||
_closeCallback = param3;
|
||||
_guiLayer = param2;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(4812,onPopupLoaded);
|
||||
}
|
||||
|
||||
public function destroy(param1:Boolean = false) : void
|
||||
{
|
||||
var _loc2_:Function = null;
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_loc2_ = _closeCallback;
|
||||
_closeCallback = null;
|
||||
_loc2_(param1);
|
||||
return;
|
||||
}
|
||||
DarkenManager.unDarken(_submissionRulesPopup);
|
||||
_guiLayer.removeChild(_submissionRulesPopup);
|
||||
removeEventListeners();
|
||||
if(_mediaHelper)
|
||||
{
|
||||
_mediaHelper.destroy();
|
||||
_mediaHelper = null;
|
||||
}
|
||||
_submissionRulesPopup = _closeBtn = _cancelBtn = _buyBtn = null;
|
||||
}
|
||||
|
||||
private function onPopupLoaded(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_submissionRulesPopup = param1.getChildAt(0) as MovieClip;
|
||||
_diamondCostText = _submissionRulesPopup.diamondTxt;
|
||||
_closeBtn = _submissionRulesPopup.bx;
|
||||
_cancelBtn = _submissionRulesPopup.cancelBtn;
|
||||
_buyBtn = _submissionRulesPopup.buyBtn;
|
||||
_diamondCostText.text = "x " + _itemCost;
|
||||
_submissionRulesPopup.x = 900 * 0.5;
|
||||
_submissionRulesPopup.y = 550 * 0.5;
|
||||
_guiLayer.addChild(_submissionRulesPopup);
|
||||
DarkenManager.darken(_submissionRulesPopup);
|
||||
addEventListeners();
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
_submissionRulesPopup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_closeBtn.addEventListener("mouseDown",onClose,false,0,true);
|
||||
_cancelBtn.addEventListener("mouseDown",onBuyCancel,false,0,true);
|
||||
_buyBtn.addEventListener("mouseDown",onBuyCancel,false,0,true);
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_submissionRulesPopup.removeEventListener("mouseDown",onPopup);
|
||||
_closeBtn.removeEventListener("mouseDown",onClose);
|
||||
_cancelBtn.removeEventListener("mouseDown",onBuyCancel);
|
||||
_buyBtn.removeEventListener("mouseDown",onBuyCancel);
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
destroy(false);
|
||||
}
|
||||
|
||||
private function onBuyCancel(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget == _cancelBtn)
|
||||
{
|
||||
destroy(false);
|
||||
}
|
||||
else if(param1.currentTarget == _buyBtn)
|
||||
{
|
||||
destroy(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package gui
|
||||
{
|
||||
public class SwitchManager
|
||||
{
|
||||
|
||||
public static const NUM_DEN_ROOM_SLOTS:int = 28;
|
||||
|
||||
public static const NUM_AVATAR_SLOTS:int = 36;
|
||||
|
||||
public static const ALL_SLOTS_AVAILABLE:uint = 4294967295;
|
||||
|
||||
public static const ALL_SLOTS_DISABLED_FOR_DEMOTION:int = 0;
|
||||
|
||||
public function SwitchManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init() : void
|
||||
{
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.geom.Point;
|
||||
import flash.text.TextField;
|
||||
import flash.utils.Timer;
|
||||
|
||||
public class ToolTipPopup extends MovieClip
|
||||
{
|
||||
|
||||
private const NUM_EXTRA_TEXT_LINES:int = 2;
|
||||
|
||||
public var msgTxt:TextField;
|
||||
|
||||
public var right:MovieClip;
|
||||
|
||||
public var middle:MovieClip;
|
||||
|
||||
public var left:MovieClip;
|
||||
|
||||
public var extraInfo:MovieClip;
|
||||
|
||||
public var toolTipTimer:Timer;
|
||||
|
||||
private var _useTimer:Boolean;
|
||||
|
||||
private var _currEvent:MouseEvent;
|
||||
|
||||
public function ToolTipPopup()
|
||||
{
|
||||
super();
|
||||
msgTxt = this["txt"];
|
||||
right = this["r"];
|
||||
middle = this["m"];
|
||||
left = this["l"];
|
||||
extraInfo = this["tooltipCont"];
|
||||
enabled = false;
|
||||
visible = false;
|
||||
toolTipTimer = new Timer(225);
|
||||
mouseChildren = false;
|
||||
mouseEnabled = false;
|
||||
}
|
||||
|
||||
public function init(param1:DisplayObjectContainer, param2:String, param3:int, param4:int, param5:Boolean = true) : void
|
||||
{
|
||||
setChild(param1);
|
||||
msgTxt.autoSize = "left";
|
||||
setToolTipText(param2);
|
||||
setPos(param3,param4);
|
||||
_useTimer = param5;
|
||||
}
|
||||
|
||||
public function setToolTipText(param1:String) : void
|
||||
{
|
||||
var _loc10_:Array = null;
|
||||
var _loc6_:Number = NaN;
|
||||
var _loc3_:Number = NaN;
|
||||
var _loc4_:int = 0;
|
||||
var _loc11_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc2_:TextField = null;
|
||||
var _loc9_:TextField = null;
|
||||
var _loc7_:int = 0;
|
||||
if(param1 && param1 != "" && param1 != msgTxt.text)
|
||||
{
|
||||
_loc10_ = param1.split("|");
|
||||
msgTxt.text = _loc10_[0];
|
||||
_loc6_ = msgTxt.textWidth + 5;
|
||||
middle.width = Math.ceil(_loc6_);
|
||||
_loc3_ = -_loc6_ * 0.5;
|
||||
middle.x = Math.round(_loc3_);
|
||||
msgTxt.x = middle.x;
|
||||
left.x = middle.x - left.width;
|
||||
right.x = _loc3_ + _loc6_;
|
||||
enabled = true;
|
||||
if(_loc10_.length > 1 && extraInfo)
|
||||
{
|
||||
extraInfo.visible = true;
|
||||
_loc10_.shift();
|
||||
_loc4_ = _loc10_.length * 0.5;
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < 2)
|
||||
{
|
||||
_loc2_ = extraInfo["att" + (_loc7_ + 1)];
|
||||
_loc9_ = extraInfo["value" + (_loc7_ + 1)];
|
||||
if(_loc7_ < _loc4_)
|
||||
{
|
||||
_loc2_.visible = true;
|
||||
_loc9_.visible = true;
|
||||
_loc2_.autoSize = "left";
|
||||
_loc9_.autoSize = "left";
|
||||
_loc2_.text = _loc10_[_loc8_++];
|
||||
_loc9_.text = _loc10_[_loc8_++];
|
||||
_loc11_ += _loc2_.textHeight;
|
||||
_loc5_ = Math.max(_loc5_,_loc2_.width + _loc9_.width + 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_.visible = false;
|
||||
_loc9_.visible = false;
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
extraInfo.m.height = _loc11_;
|
||||
extraInfo.b.y = extraInfo.m.y + extraInfo.m.height;
|
||||
extraInfo.t.width = extraInfo.b.width = extraInfo.m.width = _loc5_;
|
||||
extraInfo.t.x = extraInfo.b.x = extraInfo.m.x = middle.x + middle.width * 0.5 - extraInfo.m.width * 0.5;
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc4_)
|
||||
{
|
||||
_loc2_ = extraInfo["att" + (_loc7_ + 1)];
|
||||
_loc9_ = extraInfo["value" + (_loc7_ + 1)];
|
||||
_loc2_.x = extraInfo.b.x + 2;
|
||||
_loc9_.x = extraInfo.b.x + extraInfo.b.width - _loc9_.width - 2;
|
||||
_loc2_.y = _loc9_.y = extraInfo.m.y + 2 + _loc7_ * _loc2_.textHeight;
|
||||
_loc7_++;
|
||||
}
|
||||
}
|
||||
else if(extraInfo)
|
||||
{
|
||||
extraInfo.visible = false;
|
||||
}
|
||||
}
|
||||
else if(extraInfo)
|
||||
{
|
||||
extraInfo.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function setPos(param1:int, param2:int) : void
|
||||
{
|
||||
var _loc5_:Point = this.parent.localToGlobal(new Point(param1,param2));
|
||||
var _loc4_:int = Math.round(this.width * 0.5);
|
||||
var _loc3_:int = Math.round(this.height * 0.5);
|
||||
if(_loc5_.x - _loc4_ < 0)
|
||||
{
|
||||
_loc5_.x += _loc4_ - _loc5_.x;
|
||||
}
|
||||
else if(_loc5_.x + _loc4_ > 900)
|
||||
{
|
||||
_loc5_.x -= _loc5_.x + _loc4_ - 900;
|
||||
}
|
||||
if(_loc5_.y - _loc3_ < 0)
|
||||
{
|
||||
_loc5_.y += _loc3_ - _loc5_.y;
|
||||
}
|
||||
else if(_loc5_.y + _loc3_ > 550)
|
||||
{
|
||||
_loc5_.y -= _loc5_.y + _loc3_ - 550;
|
||||
}
|
||||
_loc5_ = this.parent.globalToLocal(_loc5_);
|
||||
this.x = _loc5_.x;
|
||||
this.y = _loc5_.y;
|
||||
}
|
||||
|
||||
public function bringToolToFront() : void
|
||||
{
|
||||
parent.setChildIndex(this,parent.numChildren - 1);
|
||||
}
|
||||
|
||||
public function startTimer(param1:MouseEvent = null) : void
|
||||
{
|
||||
if(_useTimer)
|
||||
{
|
||||
bringToolToFront();
|
||||
toolTipTimer.start();
|
||||
toolTipTimer.addEventListener("timer",toolTipTimerHandler,false,0,true);
|
||||
_currEvent = param1;
|
||||
}
|
||||
else
|
||||
{
|
||||
visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function isTimerRunning() : Boolean
|
||||
{
|
||||
return toolTipTimer.running;
|
||||
}
|
||||
|
||||
public function resetTimerAndSetVisibility() : void
|
||||
{
|
||||
toolTipTimer.reset();
|
||||
toolTipTimer.removeEventListener("timer",toolTipTimerHandler);
|
||||
visible = false;
|
||||
_currEvent = null;
|
||||
}
|
||||
|
||||
public function toolTipTimerHandler(param1:TimerEvent) : void
|
||||
{
|
||||
toolTipTimer.stop();
|
||||
if(_currEvent && _currEvent.currentTarget.hitTestPoint(_currEvent.stageX,_currEvent.stageY))
|
||||
{
|
||||
visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
resetTimerAndSetVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
public function setChild(param1:DisplayObjectContainer) : void
|
||||
{
|
||||
param1.addChild(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,16 @@
|
||||
package gui
|
||||
{
|
||||
import gskinner.motion.easing.Quadratic;
|
||||
|
||||
public class TweenManager
|
||||
{
|
||||
|
||||
public static var quadratic:Function = Quadratic.easeIn;
|
||||
|
||||
public function TweenManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
package gui
|
||||
{
|
||||
import com.sbi.analytics.SBTracker;
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.net.URLRequest;
|
||||
import flash.net.navigateToURL;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class UpsellManager
|
||||
{
|
||||
|
||||
public static const EXTRA_DIAMONDS_AS_MEMBER:String = "";
|
||||
|
||||
public static const JAG:String = "jamagram";
|
||||
|
||||
public static const EMOTES:String = "emotes";
|
||||
|
||||
public static const ANIMALS:String = "animals";
|
||||
|
||||
public static const ANIMAL_SLOTS:String = "animalSlots";
|
||||
|
||||
public static const NAMEBARS:String = "namebars";
|
||||
|
||||
public static const DENS:String = "dens";
|
||||
|
||||
public static const DEN_ITEMS:String = "denItems";
|
||||
|
||||
public static const ACCESSORIES:String = "accessories";
|
||||
|
||||
public static const PETS:String = "pets";
|
||||
|
||||
public static const DEN_AUDIO:String = "denAudio";
|
||||
|
||||
public static const OCEAN:String = "oceanAnimals";
|
||||
|
||||
public static const EXTRA_DEN_ITEMS:String = "200Items";
|
||||
|
||||
public static const DIAMONDS:String = "diamondShop";
|
||||
|
||||
public static const ADVENTURES:String = "adventures";
|
||||
|
||||
public static const PLAYER_WALL:String = "jammerWall";
|
||||
|
||||
public static const DEN_ART:String = "denArt";
|
||||
|
||||
private static const UPSELL_MEDIA_ID:int = 1114;
|
||||
|
||||
private static const EXTRA_DIAMONDS_MEDIA_ID:int = 2216;
|
||||
|
||||
private static var _guiLayer:DisplayLayer;
|
||||
|
||||
private static var _closeCallBack:Function;
|
||||
|
||||
private static var _upsellMC:MovieClip;
|
||||
|
||||
private static var _loadingMediaHelper:MediaHelper;
|
||||
|
||||
private static var _mediaHelpers:Array;
|
||||
|
||||
private static var _maxPetsFunc:Function;
|
||||
|
||||
public function UpsellManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init(param1:DisplayLayer, param2:Function = null) : void
|
||||
{
|
||||
_guiLayer = param1;
|
||||
_maxPetsFunc = param2;
|
||||
_mediaHelpers = [];
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
if(_closeCallBack != null)
|
||||
{
|
||||
_closeCallBack = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function displayPopup(param1:String, param2:String, param3:Function = null, param4:String = null, param5:Boolean = false) : void
|
||||
{
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("/game/play/upsell/#" + param2);
|
||||
_closeCallBack = param3;
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
loadPopup(param1,param5);
|
||||
}
|
||||
|
||||
private static function loadPopup(param1:String, param2:Boolean = false) : void
|
||||
{
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(param1 == "" ? 2216 : 1114,onUpsellLoaded,{
|
||||
"m":param1,
|
||||
"s":param2
|
||||
});
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
}
|
||||
|
||||
private static function onUpsellLoaded(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
if(_upsellMC)
|
||||
{
|
||||
onLoadUpsellClose(null);
|
||||
}
|
||||
if(param1)
|
||||
{
|
||||
_upsellMC = MovieClip(param1.getChildAt(0));
|
||||
_upsellMC.x = 900 * 0.5;
|
||||
_upsellMC.y = 550 * 0.5;
|
||||
_upsellMC.frameName = param1.passback["m"];
|
||||
if(!param1.passback["s"])
|
||||
{
|
||||
_guiLayer.addChild(_upsellMC);
|
||||
}
|
||||
else
|
||||
{
|
||||
gMainFrame.stage.addChild(_upsellMC);
|
||||
}
|
||||
DarkenManager.darken(_upsellMC);
|
||||
if(param1.passback.m != "")
|
||||
{
|
||||
_upsellMC.gotoAndStop(_upsellMC.frameName);
|
||||
_upsellMC.lBtn.addEventListener("mouseDown",onLeftRightBtns,false,0,true);
|
||||
_upsellMC.rBtn.addEventListener("mouseDown",onLeftRightBtns,false,0,true);
|
||||
_upsellMC.joinClubBtn.addEventListener("mouseDown",onJoin,false,0,true);
|
||||
}
|
||||
_upsellMC.bx.addEventListener("mouseDown",onLoadUpsellClose,false,0,true);
|
||||
_upsellMC.addEventListener("mouseDown",onLoadPopup,false,0,true);
|
||||
_loadingMediaHelper.destroy();
|
||||
_loadingMediaHelper = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static function onLoadUpsellClose(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
SBTracker.pop();
|
||||
if(_upsellMC.parent)
|
||||
{
|
||||
_upsellMC.parent.removeChild(_upsellMC);
|
||||
}
|
||||
DarkenManager.unDarken(_upsellMC);
|
||||
if(_upsellMC.frameName != "")
|
||||
{
|
||||
_upsellMC.lBtn.removeEventListener("mouseDown",onLeftRightBtns);
|
||||
_upsellMC.rBtn.removeEventListener("mouseDown",onLeftRightBtns);
|
||||
_upsellMC.joinClubBtn.removeEventListener("mouseDown",onJoin);
|
||||
}
|
||||
_upsellMC.bx.removeEventListener("mouseDown",onLoadUpsellClose);
|
||||
_upsellMC.removeEventListener("mouseDown",onLoadPopup);
|
||||
_upsellMC = null;
|
||||
}
|
||||
|
||||
private static function onLeftRightBtns(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
var _loc2_:int = param1.currentTarget == _upsellMC.lBtn ? -1 : 1;
|
||||
if(_upsellMC.currentFrame + _loc2_ <= 0)
|
||||
{
|
||||
_upsellMC.gotoAndStop(_upsellMC.currentLabels.length);
|
||||
}
|
||||
else if(_upsellMC.currentFrame + _loc2_ > _upsellMC.currentLabels.length)
|
||||
{
|
||||
_upsellMC.gotoAndStop(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_upsellMC.gotoAndStop(_upsellMC.currentFrame + _loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function onLoadPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private static function onJoin(param1:MouseEvent) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
var _loc3_:String = gMainFrame.clientInfo.websiteURL + "membership";
|
||||
var _loc2_:URLRequest = new URLRequest(_loc3_);
|
||||
try
|
||||
{
|
||||
navigateToURL(_loc2_,"_blank");
|
||||
if(_upsellMC)
|
||||
{
|
||||
onLoadUpsellClose(param1);
|
||||
}
|
||||
}
|
||||
catch(e:Error)
|
||||
{
|
||||
DebugUtility.debugTrace("error with loading URL");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
package gui
|
||||
{
|
||||
import com.sbi.debug.DebugUtility;
|
||||
import com.sbi.graphics.JPEGAsyncCompleteEvent;
|
||||
import com.sbi.graphics.JpegAsynchEncoder;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import flash.display.Bitmap;
|
||||
import flash.display.Loader;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.ProgressEvent;
|
||||
import flash.net.FileFilter;
|
||||
import flash.net.FileReference;
|
||||
import flash.utils.ByteArray;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class UserImageUpload
|
||||
{
|
||||
|
||||
private static const MAX_FILE_SIZE:Number = 2048000;
|
||||
|
||||
private var _myFileReference:FileReference;
|
||||
|
||||
private var _byteArrayLoader:Loader;
|
||||
|
||||
private var _uploadBtn:MovieClip;
|
||||
|
||||
private var _jpgEncoder:JpegAsynchEncoder;
|
||||
|
||||
private var _fileName:String;
|
||||
|
||||
public function UserImageUpload()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init() : void
|
||||
{
|
||||
addEventListeners();
|
||||
}
|
||||
|
||||
public function setUploadBtn(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_uploadBtn = param1;
|
||||
_uploadBtn.addEventListener("mouseDown",onUploadDown,false,0,true);
|
||||
return;
|
||||
}
|
||||
throw new Error("Upload button was not provided");
|
||||
}
|
||||
|
||||
public function get uploadedImage() : ByteArray
|
||||
{
|
||||
if(_jpgEncoder)
|
||||
{
|
||||
return _jpgEncoder.ImageData;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function get fileName() : String
|
||||
{
|
||||
if(_fileName)
|
||||
{
|
||||
return _fileName;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public function resetUploader() : void
|
||||
{
|
||||
_jpgEncoder = null;
|
||||
_fileName = null;
|
||||
}
|
||||
|
||||
private function onUploadDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_myFileReference = new FileReference();
|
||||
_myFileReference.addEventListener("select",onFileSelected,false,0,true);
|
||||
_myFileReference.browse([new FileFilter("Images","*.jpeg;*.jpg;*.png")]);
|
||||
}
|
||||
|
||||
private function onFileSelected(param1:Event) : void
|
||||
{
|
||||
if(_myFileReference.size > 2048000)
|
||||
{
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14806));
|
||||
return;
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(true,true);
|
||||
_myFileReference.addEventListener("complete",onFileLoaded,false,0,true);
|
||||
_myFileReference.addEventListener("ioError",onFileLoadError,false,0,true);
|
||||
_myFileReference.addEventListener("progress",onProgress,false,0,true);
|
||||
_myFileReference.load();
|
||||
}
|
||||
|
||||
private function onProgress(param1:ProgressEvent) : void
|
||||
{
|
||||
DebugUtility.debugTrace("UPLOADED: " + (param1.bytesLoaded / param1.bytesTotal * 100).toFixed() + " %");
|
||||
}
|
||||
|
||||
private function onFileLoaded(param1:Event) : void
|
||||
{
|
||||
var _loc2_:FileReference = param1.target as FileReference;
|
||||
if(_loc2_["data"].bytesAvailable > 0)
|
||||
{
|
||||
_byteArrayLoader = new Loader();
|
||||
_byteArrayLoader.loadBytes(_loc2_["data"]);
|
||||
_fileName = _myFileReference.name;
|
||||
_byteArrayLoader.contentLoaderInfo.addEventListener("complete",onByteArrayLoaded,false,0,true);
|
||||
_myFileReference.removeEventListener("complete",onFileLoaded);
|
||||
_myFileReference.removeEventListener("ioError",onFileLoadError);
|
||||
_myFileReference.removeEventListener("progress",onProgress);
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
onFileLoadError(null);
|
||||
}
|
||||
}
|
||||
|
||||
private function onFileLoadError(param1:Event) : void
|
||||
{
|
||||
_myFileReference.removeEventListener("complete",onFileLoaded);
|
||||
_myFileReference.removeEventListener("ioError",onFileLoadError);
|
||||
_myFileReference.removeEventListener("progress",onProgress);
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14807));
|
||||
}
|
||||
|
||||
private function onByteArrayLoaded(param1:Event) : void
|
||||
{
|
||||
var _loc2_:Bitmap = param1.target.content;
|
||||
_jpgEncoder = new JpegAsynchEncoder();
|
||||
_jpgEncoder.addEventListener("JPEGAsyncComplete",asyncEncodingComplete,false,0,true);
|
||||
_jpgEncoder.addEventListener("progress",onEncodingProgress,false,0,true);
|
||||
_jpgEncoder.PixelsPerIteration = 128;
|
||||
_jpgEncoder.JPEGAsyncEncoder(95);
|
||||
_jpgEncoder.encode(_loc2_.bitmapData);
|
||||
}
|
||||
|
||||
private function asyncEncodingComplete(param1:JPEGAsyncCompleteEvent) : void
|
||||
{
|
||||
_jpgEncoder.removeEventListener("JPEGAsyncComplete",asyncEncodingComplete);
|
||||
_jpgEncoder.removeEventListener("progress",onEncodingProgress);
|
||||
_uploadBtn.visible = false;
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
}
|
||||
|
||||
private function onEncodingProgress(param1:ProgressEvent) : void
|
||||
{
|
||||
DarkenManager.updateLoadingSpiralPercentage(Math.round(param1.bytesLoaded / param1.bytesTotal * 100) + "%");
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
_uploadBtn.removeEventListener("mouseDown",onUploadDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,78 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import gui.itemWindows.ItemWindowChapterSelect;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class WelcomeToCarnival
|
||||
{
|
||||
|
||||
public static const WELCOME_CARNIVAL_MEDIA_ID:int = 1594;
|
||||
|
||||
private var _popup:MovieClip;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
public function WelcomeToCarnival()
|
||||
{
|
||||
super();
|
||||
ItemWindowChapterSelect;
|
||||
}
|
||||
|
||||
public function init() : void
|
||||
{
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(1594,mediaCallback,true);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
removeListeners();
|
||||
_mediaHelper.destroy();
|
||||
GuiManager.guiLayer.removeChild(_popup);
|
||||
DarkenManager.unDarken(_popup);
|
||||
_popup = null;
|
||||
}
|
||||
|
||||
private function mediaCallback(param1:MovieClip) : void
|
||||
{
|
||||
_popup = MovieClip(param1.getChildAt(0));
|
||||
_popup.x = 900 * 0.5;
|
||||
_popup.y = 550 * 0.5;
|
||||
GuiManager.guiLayer.addChild(_popup);
|
||||
addListeners();
|
||||
setInitialConditions();
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
DarkenManager.darken(_popup);
|
||||
}
|
||||
|
||||
private function setInitialConditions() : void
|
||||
{
|
||||
}
|
||||
|
||||
private function popupCloseHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
destroy();
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function addListeners() : void
|
||||
{
|
||||
_popup["bx"].addEventListener("mouseDown",popupCloseHandler,false,0,true);
|
||||
_popup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
}
|
||||
|
||||
private function removeListeners() : void
|
||||
{
|
||||
_popup["bx"].removeEventListener("mouseDown",popupCloseHandler);
|
||||
_popup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,519 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import gui.itemWindows.ItemWindowBase;
|
||||
|
||||
public class WindowAndScrollbarGenerator extends MovieClip
|
||||
{
|
||||
|
||||
public var bg:MovieClip;
|
||||
|
||||
public var numWindowsCreated:int;
|
||||
|
||||
public var toolTip:ToolTipPopup;
|
||||
|
||||
private var _xWinVis:int;
|
||||
|
||||
private var _yWinVis:int;
|
||||
|
||||
private var _numRows:int;
|
||||
|
||||
private var _numCols:int;
|
||||
|
||||
private var _totalNumWin:int;
|
||||
|
||||
private var _winWidth:int;
|
||||
|
||||
private var _winHeight:int;
|
||||
|
||||
private var _boxWidth:int;
|
||||
|
||||
private var _boxHeight:int;
|
||||
|
||||
private var _xOffset:Number;
|
||||
|
||||
private var _yOffset:Number;
|
||||
|
||||
private var _xStart:Number;
|
||||
|
||||
private var _numToCreated:int;
|
||||
|
||||
private var _fillCompletely:Boolean;
|
||||
|
||||
private var _mediaWindows:Array;
|
||||
|
||||
private var _singleLoadWindow:MovieClip;
|
||||
|
||||
private var _numLoaded:int;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
private var _mouseDown:Function;
|
||||
|
||||
private var _mouseOver:Function;
|
||||
|
||||
private var _mouseOut:Function;
|
||||
|
||||
private var _mouseMemberOnlyDown:Function;
|
||||
|
||||
private var _dynamicScrollbar:SBDynamicScrollbar;
|
||||
|
||||
private var _isSideways:Boolean;
|
||||
|
||||
private var _windowClass:Class;
|
||||
|
||||
private var _itemList:Array;
|
||||
|
||||
private var _iconLayerName:String;
|
||||
|
||||
private var _customParams:Object;
|
||||
|
||||
private var _loading:Boolean;
|
||||
|
||||
private var _loadingQueue:Array;
|
||||
|
||||
private var _manyLoadedWindows:Array;
|
||||
|
||||
private var _updateScrollPosition:Boolean;
|
||||
|
||||
private var _manyLoadingWindowIndexOffset:int;
|
||||
|
||||
private var _maxNumWindows:int;
|
||||
|
||||
private var _onInsertManyCallback:Function;
|
||||
|
||||
private var _insertAtTop:Boolean;
|
||||
|
||||
private var _numWindowsToLoad:int;
|
||||
|
||||
public function WindowAndScrollbarGenerator()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Number, param7:int, param8:Number, param9:Number, param10:Number, param11:Number, param12:Class, param13:Array, param14:String, param15:int = 0, param16:Object = null, param17:Object = null, param18:Function = null, param19:Boolean = true, param20:Boolean = false, param21:Boolean = true, param22:Boolean = false, param23:Boolean = false) : void
|
||||
{
|
||||
_xWinVis = param5;
|
||||
_yWinVis = param6;
|
||||
_totalNumWin = param13 ? param13.length : 0;
|
||||
_maxNumWindows = param15;
|
||||
_xOffset = param8;
|
||||
_yOffset = param9;
|
||||
_xStart = param10;
|
||||
_fillCompletely = param21;
|
||||
_callback = param18;
|
||||
_isSideways = param20;
|
||||
_windowClass = param12;
|
||||
_itemList = param13;
|
||||
_iconLayerName = param14;
|
||||
_customParams = param17;
|
||||
if(_fillCompletely)
|
||||
{
|
||||
param7 = _xWinVis * _yWinVis;
|
||||
}
|
||||
if(_totalNumWin < param7)
|
||||
{
|
||||
_totalNumWin = param7;
|
||||
}
|
||||
if(param20)
|
||||
{
|
||||
_numRows = param6;
|
||||
_numCols = Math.ceil(_totalNumWin / _yWinVis);
|
||||
}
|
||||
else
|
||||
{
|
||||
_numRows = Math.ceil(_totalNumWin / _xWinVis);
|
||||
_numCols = param5;
|
||||
}
|
||||
if(param16 != null)
|
||||
{
|
||||
_mouseDown = param16.mouseDown;
|
||||
_mouseOut = param16.mouseOut;
|
||||
_mouseOver = param16.mouseOver;
|
||||
_mouseMemberOnlyDown = param16.memberOnlyDown;
|
||||
}
|
||||
bg = new MovieClip();
|
||||
bg.graphics.beginFill(0);
|
||||
bg.graphics.drawRect(0,0,0,0);
|
||||
addChild(bg);
|
||||
_dynamicScrollbar = new SBDynamicScrollbar(bg,param1,param2,param7,param5,param6,param8,param9,param10,param11,param3,_maxNumWindows,param19,param4,-1,param22,param23,param20);
|
||||
_mediaWindows = [];
|
||||
_loadingQueue = [];
|
||||
_manyLoadedWindows = [];
|
||||
_numLoaded = 0;
|
||||
toolTip = ToolTipPopup(GETDEFINITIONBYNAME("Tooltip"));
|
||||
loadWindows(_totalNumWin,onInitialWindowsLoaded,true,true);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(_dynamicScrollbar)
|
||||
{
|
||||
_dynamicScrollbar.destroy();
|
||||
_dynamicScrollbar = null;
|
||||
}
|
||||
if(bg)
|
||||
{
|
||||
while(bg.numChildren > 0)
|
||||
{
|
||||
bg.removeChildAt(0);
|
||||
}
|
||||
if(bg.parent == this)
|
||||
{
|
||||
removeChild(bg);
|
||||
}
|
||||
}
|
||||
if(_mediaWindows)
|
||||
{
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _mediaWindows.length)
|
||||
{
|
||||
if(_mediaWindows[_loc1_] != null && _mediaWindows[_loc1_].hasOwnProperty("destroy"))
|
||||
{
|
||||
_mediaWindows[_loc1_].destroy();
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
_mediaWindows = null;
|
||||
}
|
||||
if(toolTip)
|
||||
{
|
||||
toolTip.resetTimerAndSetVisibility();
|
||||
toolTip = null;
|
||||
}
|
||||
bg = null;
|
||||
}
|
||||
|
||||
public function get boxHeight() : int
|
||||
{
|
||||
return _boxHeight;
|
||||
}
|
||||
|
||||
public function get boxWidth() : int
|
||||
{
|
||||
return _boxWidth;
|
||||
}
|
||||
|
||||
public function get mediaWindows() : Array
|
||||
{
|
||||
return _mediaWindows;
|
||||
}
|
||||
|
||||
public function get scrollYValue() : Number
|
||||
{
|
||||
return _dynamicScrollbar.scrollYValue;
|
||||
}
|
||||
|
||||
public function get totalNumWindows() : int
|
||||
{
|
||||
return _totalNumWin;
|
||||
}
|
||||
|
||||
public function deleteItem(param1:int, param2:*) : void
|
||||
{
|
||||
if(_dynamicScrollbar.deleteTweenItem(param1))
|
||||
{
|
||||
_numLoaded = _numLoaded - 1;
|
||||
_totalNumWin = _totalNumWin - 1;
|
||||
_mediaWindows.splice(param1,1);
|
||||
}
|
||||
if(param2 && param2 != _itemList)
|
||||
{
|
||||
param2.splice(param1,1);
|
||||
}
|
||||
_itemList.splice(param1,1);
|
||||
}
|
||||
|
||||
public function isIndexInView(param1:int) : Boolean
|
||||
{
|
||||
return _dynamicScrollbar.getIsIndexInView(param1);
|
||||
}
|
||||
|
||||
public function get scrollContentHeight() : Number
|
||||
{
|
||||
if(_dynamicScrollbar)
|
||||
{
|
||||
return _dynamicScrollbar.scrollContentHeight;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function insertItem(param1:*, param2:Boolean, param3:Boolean = false) : void
|
||||
{
|
||||
_insertAtTop = param3;
|
||||
if(param1 != null)
|
||||
{
|
||||
if(_itemList)
|
||||
{
|
||||
if(param3)
|
||||
{
|
||||
_itemList.unshift(param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_itemList.push(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
loadWindows(1,onSingleWindowLoaded,param2);
|
||||
}
|
||||
|
||||
public function insertMany(param1:Array, param2:Boolean, param3:Boolean = false, param4:Function = null) : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
_insertAtTop = param3;
|
||||
if(_itemList)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < param1.length)
|
||||
{
|
||||
if(param1[_loc5_] != null)
|
||||
{
|
||||
_itemList.push(param1[_loc5_]);
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
_onInsertManyCallback = param4;
|
||||
_manyLoadingWindowIndexOffset = _insertAtTop ? 0 : _dynamicScrollbar.getNumOfAssets();
|
||||
loadWindows(param1.length,onManyWindowsLoaded,param2);
|
||||
}
|
||||
|
||||
public function updateItem(param1:int, param2:*) : void
|
||||
{
|
||||
_dynamicScrollbar.updateItem(param1,param2);
|
||||
}
|
||||
|
||||
public function findItemAndUpdate(param1:*) : void
|
||||
{
|
||||
_dynamicScrollbar.findItemAndUpdate(param1);
|
||||
}
|
||||
|
||||
public function findOpenWindowAndUpdate(param1:*) : void
|
||||
{
|
||||
_dynamicScrollbar.findOpenAndUpdate(param1);
|
||||
}
|
||||
|
||||
public function callUpdateInWindow() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _mediaWindows.length)
|
||||
{
|
||||
if(_mediaWindows[_loc1_].hasOwnProperty("update"))
|
||||
{
|
||||
_mediaWindows[_loc1_].update();
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
}
|
||||
|
||||
public function callUpdateInWindowWithInput(param1:Object) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _mediaWindows.length)
|
||||
{
|
||||
if(_mediaWindows[_loc2_].hasOwnProperty("update"))
|
||||
{
|
||||
_mediaWindows[_loc2_].update(param1);
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
|
||||
public function callUpdateOnWindowWithInput(param1:int, param2:Object) : void
|
||||
{
|
||||
if(_mediaWindows[param1] && _mediaWindows[param1].hasOwnProperty("update"))
|
||||
{
|
||||
_mediaWindows[param1].update(param2);
|
||||
}
|
||||
}
|
||||
|
||||
public function callUpdateOnWindow(param1:int) : void
|
||||
{
|
||||
if(_mediaWindows[param1] && _mediaWindows[param1].hasOwnProperty("update"))
|
||||
{
|
||||
_mediaWindows[param1].update();
|
||||
}
|
||||
}
|
||||
|
||||
public function handleSearchInput(param1:String) : void
|
||||
{
|
||||
_dynamicScrollbar.handleSearchInput(param1);
|
||||
}
|
||||
|
||||
public function handleScrollBtnClick(param1:Boolean) : void
|
||||
{
|
||||
_dynamicScrollbar.handleExternalScrollClick(param1);
|
||||
}
|
||||
|
||||
public function scrollToIndex(param1:int, param2:Boolean) : void
|
||||
{
|
||||
_dynamicScrollbar.scrollToElement(param1,param2);
|
||||
}
|
||||
|
||||
private function loadWindows(param1:int, param2:Function, param3:Boolean, param4:Boolean = false) : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
if(!_loading)
|
||||
{
|
||||
if(param1 > 0)
|
||||
{
|
||||
_loading = true;
|
||||
if(!param4)
|
||||
{
|
||||
_totalNumWin += param1;
|
||||
}
|
||||
_updateScrollPosition = param3;
|
||||
_numWindowsToLoad = _insertAtTop ? param1 : _totalNumWin;
|
||||
if(_insertAtTop)
|
||||
{
|
||||
_numLoaded = 0;
|
||||
}
|
||||
_loc5_ = int(_insertAtTop ? 0 : _numLoaded);
|
||||
while(_loc5_ < _numWindowsToLoad)
|
||||
{
|
||||
if(_windowClass == ItemWindowBase)
|
||||
{
|
||||
new _windowClass(_customParams.itemClassName,param2,_itemList != null && _itemList.length > _loc5_ ? _itemList[_loc5_] : null,_iconLayerName,_loc5_,_mouseDown,_mouseOver,_mouseOut,_mouseMemberOnlyDown);
|
||||
}
|
||||
else
|
||||
{
|
||||
new _windowClass(param2,_itemList != null && _itemList.length > _loc5_ ? _itemList[_loc5_] : null,_iconLayerName,_loc5_,_mouseDown,_mouseOver,_mouseOut,_mouseMemberOnlyDown,_customParams);
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
else if(_callback != null)
|
||||
{
|
||||
_callback();
|
||||
_callback = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loadingQueue.push({
|
||||
"numWindows":param1,
|
||||
"callback":param2,
|
||||
"updateScrollPosition":param3
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private function onInitialWindowsLoaded(param1:MovieClip, param2:int = -1) : void
|
||||
{
|
||||
if(_mediaWindows && _dynamicScrollbar)
|
||||
{
|
||||
_mediaWindows[param2 == -1 ? param1.index : param2] = param1;
|
||||
_numLoaded = _numLoaded + 1;
|
||||
if(_numLoaded == _totalNumWin)
|
||||
{
|
||||
_boxWidth = param1.width;
|
||||
_boxHeight = param1.height;
|
||||
numWindowsCreated = _totalNumWin;
|
||||
_dynamicScrollbar.insertMany(_mediaWindows,_updateScrollPosition,false,true);
|
||||
if(_callback != null)
|
||||
{
|
||||
_callback();
|
||||
_callback = null;
|
||||
}
|
||||
checkForMoreToLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onSingleWindowLoaded(param1:MovieClip, param2:int = -1) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
if(_mediaWindows && _dynamicScrollbar)
|
||||
{
|
||||
_loc3_ = int(param2 == -1 ? param1.index : param2);
|
||||
if(_mediaWindows[_loc3_])
|
||||
{
|
||||
_mediaWindows.splice(_loc3_,0,param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_mediaWindows[_loc3_] = param1;
|
||||
}
|
||||
if(_insertAtTop)
|
||||
{
|
||||
_loc4_ = 1;
|
||||
while(_loc4_ < _mediaWindows.length)
|
||||
{
|
||||
_mediaWindows[_loc4_].index++;
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
_numLoaded = _numLoaded + 1;
|
||||
_dynamicScrollbar.insert(param1,_updateScrollPosition,_insertAtTop);
|
||||
numWindowsCreated = _totalNumWin;
|
||||
checkForMoreToLoad();
|
||||
}
|
||||
}
|
||||
|
||||
private function onManyWindowsLoaded(param1:MovieClip, param2:int = -1) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
if(_mediaWindows && _dynamicScrollbar)
|
||||
{
|
||||
_loc4_ = int(param2 == -1 ? param1.index : param2);
|
||||
if(_mediaWindows[_loc4_])
|
||||
{
|
||||
_mediaWindows.splice(_loc4_,0,param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_mediaWindows[_loc4_] = param1;
|
||||
}
|
||||
_manyLoadedWindows[_loc4_ - _manyLoadingWindowIndexOffset] = param1;
|
||||
_numLoaded = _numLoaded + 1;
|
||||
if(_numLoaded == _numWindowsToLoad)
|
||||
{
|
||||
numWindowsCreated = _totalNumWin;
|
||||
if(_insertAtTop)
|
||||
{
|
||||
_loc3_ = _mediaWindows[_mediaWindows.length - 1].index + 1;
|
||||
_loc5_ = _numLoaded;
|
||||
while(_loc5_ < _mediaWindows.length)
|
||||
{
|
||||
_mediaWindows[_loc5_].index = _loc3_++;
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
_dynamicScrollbar.insertMany(_manyLoadedWindows,_updateScrollPosition,false,_insertAtTop);
|
||||
_manyLoadedWindows = [];
|
||||
if(!checkForMoreToLoad())
|
||||
{
|
||||
if(_onInsertManyCallback != null)
|
||||
{
|
||||
_onInsertManyCallback();
|
||||
_onInsertManyCallback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function checkForMoreToLoad() : Boolean
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
_loading = false;
|
||||
_updateScrollPosition = false;
|
||||
if(_loadingQueue.length > 0)
|
||||
{
|
||||
_loc1_ = _loadingQueue.shift();
|
||||
_manyLoadingWindowIndexOffset = _dynamicScrollbar.getNumOfAssets();
|
||||
loadWindows(_loc1_.numWindows,_loc1_.callback,_loc1_.updateScrollPosition);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import gui.itemWindows.ItemWindowBase;
|
||||
|
||||
public class WindowGenerator extends MovieClip
|
||||
{
|
||||
|
||||
public var bg:MovieClip;
|
||||
|
||||
public var numWindowsCreated:int;
|
||||
|
||||
public var toolTip:ToolTipPopup;
|
||||
|
||||
private var _xWinVis:int;
|
||||
|
||||
private var _yWinVis:int;
|
||||
|
||||
private var _numRows:int;
|
||||
|
||||
private var _numCols:int;
|
||||
|
||||
private var _totalNumWin:int;
|
||||
|
||||
private var _winWidth:int;
|
||||
|
||||
private var _winHeight:int;
|
||||
|
||||
private var _boxWidth:int;
|
||||
|
||||
private var _boxHeight:int;
|
||||
|
||||
private var _xOffset:int;
|
||||
|
||||
private var _yOffset:int;
|
||||
|
||||
private var _xStart:int;
|
||||
|
||||
private var _yStart:int;
|
||||
|
||||
private var _numToCreated:int;
|
||||
|
||||
private var _fillCompletely:Boolean;
|
||||
|
||||
private var _mediaWindows:Array;
|
||||
|
||||
private var _numLoaded:int;
|
||||
|
||||
private var _callback:Function;
|
||||
|
||||
private var _mouseDown:Function;
|
||||
|
||||
private var _mouseOver:Function;
|
||||
|
||||
private var _mouseOut:Function;
|
||||
|
||||
private var _mouseMemberOnlyDown:Function;
|
||||
|
||||
public function WindowGenerator()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:int, param2:int, param3:int, param4:Number, param5:Number, param6:int, param7:Class, param8:Array, param9:String, param10:Object = null, param11:Object = null, param12:Function = null, param13:Boolean = false, param14:Boolean = true) : void
|
||||
{
|
||||
var _loc15_:int = 0;
|
||||
_xWinVis = param1;
|
||||
_yWinVis = param2;
|
||||
_totalNumWin = param3;
|
||||
_xOffset = param4;
|
||||
_yOffset = param5;
|
||||
_xStart = param6;
|
||||
_yStart = _yOffset * 0.5;
|
||||
_fillCompletely = param14;
|
||||
_callback = param12;
|
||||
var _loc16_:int = _totalNumWin;
|
||||
if(_fillCompletely)
|
||||
{
|
||||
_loc16_ = _xWinVis * _yWinVis;
|
||||
}
|
||||
if(_totalNumWin < _loc16_)
|
||||
{
|
||||
_totalNumWin = _loc16_;
|
||||
}
|
||||
if(param13)
|
||||
{
|
||||
_numRows = param2;
|
||||
_numCols = Math.ceil(_totalNumWin / _yWinVis);
|
||||
}
|
||||
else
|
||||
{
|
||||
_numRows = Math.ceil(_totalNumWin / _xWinVis);
|
||||
_numCols = param1;
|
||||
}
|
||||
bg = new MovieClip();
|
||||
if(param10 != null)
|
||||
{
|
||||
_mouseDown = param10.mouseDown;
|
||||
_mouseOut = param10.mouseOut;
|
||||
_mouseOver = param10.mouseOver;
|
||||
_mouseMemberOnlyDown = param10.memberOnlyDown;
|
||||
}
|
||||
_mediaWindows = [_totalNumWin];
|
||||
_numLoaded = 0;
|
||||
_loc15_ = 0;
|
||||
while(_loc15_ < _totalNumWin)
|
||||
{
|
||||
if(param7 == ItemWindowBase)
|
||||
{
|
||||
new param7(param11.itemClassName,windowLoaded,param8 != null && param8.length > _loc15_ ? param8[_loc15_] : null,param9,_loc15_,_mouseDown,_mouseOver,_mouseOut,_mouseMemberOnlyDown);
|
||||
}
|
||||
else
|
||||
{
|
||||
new param7(windowLoaded,param8 != null && param8.length > _loc15_ ? param8[_loc15_] : null,param9,_loc15_,_mouseDown,_mouseOver,_mouseOut,_mouseMemberOnlyDown,param11);
|
||||
}
|
||||
_loc15_++;
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(bg)
|
||||
{
|
||||
while(bg.numChildren > 0)
|
||||
{
|
||||
bg.removeChildAt(0);
|
||||
}
|
||||
if(bg.parent == this)
|
||||
{
|
||||
removeChild(bg);
|
||||
}
|
||||
}
|
||||
if(_mediaWindows)
|
||||
{
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _mediaWindows.length)
|
||||
{
|
||||
if(_mediaWindows[_loc1_] != null && _mediaWindows[_loc1_].hasOwnProperty("destroy"))
|
||||
{
|
||||
_mediaWindows[_loc1_].destroy();
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
_mediaWindows = null;
|
||||
}
|
||||
if(toolTip)
|
||||
{
|
||||
toolTip.resetTimerAndSetVisibility();
|
||||
toolTip = null;
|
||||
}
|
||||
bg = null;
|
||||
}
|
||||
|
||||
public function get boxHeight() : int
|
||||
{
|
||||
return _boxHeight;
|
||||
}
|
||||
|
||||
public function get boxWidth() : int
|
||||
{
|
||||
return _boxWidth;
|
||||
}
|
||||
|
||||
public function get mediaWindows() : Array
|
||||
{
|
||||
return _mediaWindows;
|
||||
}
|
||||
|
||||
public function isIndexInView(param1:int) : Boolean
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private function windowLoaded(param1:MovieClip, param2:int = -1) : void
|
||||
{
|
||||
var hasSizeCont:Boolean;
|
||||
var window:MovieClip = param1;
|
||||
var index:int = param2;
|
||||
if(_mediaWindows)
|
||||
{
|
||||
_mediaWindows[index == -1 ? window.index : index] = window;
|
||||
_numLoaded = _numLoaded + 1;
|
||||
if(_numLoaded == _totalNumWin)
|
||||
{
|
||||
toolTip = ToolTipPopup(GETDEFINITIONBYNAME("Tooltip"));
|
||||
hasSizeCont = "sizeCont" in window;
|
||||
_boxWidth = hasSizeCont ? window.sizeCont.width : window.width;
|
||||
_boxHeight = hasSizeCont ? window.sizeCont.height : window.height;
|
||||
generateWindows();
|
||||
with(bg.graphics)
|
||||
{
|
||||
|
||||
drawRect(0,0,_xWinVis * _boxWidth + (_xWinVis - 1) * _xOffset + 2 * _xStart,_numRows * _boxHeight + (_numRows - 1) * _yOffset + 2 * _yStart);
|
||||
}
|
||||
addChild(bg);
|
||||
if(_callback != null)
|
||||
{
|
||||
_callback();
|
||||
_callback = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function generateWindows() : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:MovieClip = null;
|
||||
var _loc1_:int = 0;
|
||||
_loc4_ = 0;
|
||||
loop0:
|
||||
while(_loc4_ < _numRows)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(true)
|
||||
{
|
||||
if(_loc3_ >= _numCols)
|
||||
{
|
||||
_loc4_++;
|
||||
continue loop0;
|
||||
}
|
||||
if(_loc1_ >= _totalNumWin && !_fillCompletely)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if(_mediaWindows[_loc1_] is ItemWindowBase)
|
||||
{
|
||||
_loc2_ = _mediaWindows[_loc1_];
|
||||
_loc2_.x = _xStart + _xOffset * _loc3_ + _boxWidth * _loc3_;
|
||||
_loc2_.y = _yStart + _yOffset * _loc4_ + _boxHeight * _loc4_;
|
||||
bg.addChild(_loc2_);
|
||||
_loc1_++;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
numWindowsCreated = _loc1_;
|
||||
return;
|
||||
}
|
||||
numWindowsCreated = _loc1_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
package gui.itemWindows
|
||||
{
|
||||
import avatar.AvatarInfo;
|
||||
import avatar.AvatarManager;
|
||||
import avatar.UserCommXtCommManager;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import flash.display.MovieClip;
|
||||
import gui.AdventureExpertPopup;
|
||||
import gui.GuiManager;
|
||||
import gui.UpsellManager;
|
||||
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)
|
||||
{
|
||||
_scriptDef = QuestXtCommManager.getScriptDef(param9.scriptIds[param4]);
|
||||
super(_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,_scriptDef.titleStrId);
|
||||
if(_window["memLock"])
|
||||
{
|
||||
_window["memLock"].visible = _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 < _scriptDef.levelMin)
|
||||
{
|
||||
_window.tag.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_scriptDef.defId == 21)
|
||||
{
|
||||
_window.tag.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
override protected function addEventListeners() : void
|
||||
{
|
||||
if(_window)
|
||||
{
|
||||
if(_mouseDown != null && !(_memberOnlyDown != null && !gMainFrame.userInfo.isMember))
|
||||
{
|
||||
addEventListener("mouseDown",_mouseDown,false,0,true);
|
||||
}
|
||||
if(_mouseOver != null)
|
||||
{
|
||||
addEventListener("rollOver",_mouseOver,false,0,true);
|
||||
}
|
||||
if(_mouseOut != null)
|
||||
{
|
||||
addEventListener("rollOut",_mouseOut,false,0,true);
|
||||
}
|
||||
if(_memberOnlyDown != null && !gMainFrame.userInfo.isMember)
|
||||
{
|
||||
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function performContinueChecks() : Object
|
||||
{
|
||||
var _loc1_:AvatarInfo = null;
|
||||
var _loc2_:Object = null;
|
||||
if(QuestManager.isInPrivateAdventureState)
|
||||
{
|
||||
QuestManager.showLeaveQuestLobbyPopup(performContinueChecks);
|
||||
return null;
|
||||
}
|
||||
if(AvatarManager.isMyUserInCustomPVPState())
|
||||
{
|
||||
UserCommXtCommManager.sendCustomPVPMessage(false,0);
|
||||
}
|
||||
if(!RoomXtCommManager.isSwitching)
|
||||
{
|
||||
if(_scriptDef.membersOnly && !gMainFrame.userInfo.isMember)
|
||||
{
|
||||
UpsellManager.displayPopup("adventures","adventure/" + _scriptDef.defId);
|
||||
return null;
|
||||
}
|
||||
_loc1_ = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
|
||||
if(_loc1_)
|
||||
{
|
||||
if(_scriptDef.playAsPet)
|
||||
{
|
||||
_loc2_ = PetManager.myActivePet;
|
||||
if(!_loc2_)
|
||||
{
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(19656));
|
||||
return null;
|
||||
}
|
||||
if(!PetManager.canPetGoInEnviroType(_loc2_.type,_scriptDef.avatarType))
|
||||
{
|
||||
switch(_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(AvatarManager.playerAvatar && !AvatarManager.isValidEnviro(_scriptDef.avatarType))
|
||||
{
|
||||
switch(_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 < _scriptDef.levelMin)
|
||||
{
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdAndInsertOnly(14697,_scriptDef.levelMin));
|
||||
return null;
|
||||
}
|
||||
if(_scriptDef.avatarLimit == 1 && _window.tag.visible)
|
||||
{
|
||||
return {
|
||||
"func":QuestXtCommManager.sendQuestCreateJoinPublic,
|
||||
"defId":_scriptDef.defId
|
||||
};
|
||||
}
|
||||
}
|
||||
if(_window.tag.visible)
|
||||
{
|
||||
return {
|
||||
"func":AdventureExpertPopup.init,
|
||||
"defId":_scriptDef.defId
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,450 @@
|
||||
package gui.itemWindows
|
||||
{
|
||||
import avatar.Avatar;
|
||||
import avatar.AvatarInfo;
|
||||
import avatar.AvatarSwitch;
|
||||
import flash.display.MovieClip;
|
||||
import gui.DenSwitch;
|
||||
|
||||
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)
|
||||
{
|
||||
_isChoosing = param9.isChoosing;
|
||||
_isAnimal = param9.isAnimal;
|
||||
_recyclingOnly = param9.recylingOnly;
|
||||
_isChoosingOcean = param9.isChoosingOcean;
|
||||
_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 _ai ? _ai.questLevel : 0;
|
||||
}
|
||||
|
||||
public function resetWindow(param1:int) : void
|
||||
{
|
||||
if(_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;
|
||||
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 _loc5_:int = 0;
|
||||
var _loc4_:Avatar = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(_isAnimal)
|
||||
{
|
||||
if(!_isCurrItemLoaded)
|
||||
{
|
||||
_loc5_ = 36;
|
||||
_window.gray.grayDen.visible = false;
|
||||
_window.aml.bg.visible = true;
|
||||
_window.aml.gray.visible = false;
|
||||
_window.aml.nameTxt.visible = true;
|
||||
_window.priceTag.txt.text = 1000;
|
||||
_window.aml.visible = true;
|
||||
_loc4_ = AvatarSwitch.avatars[_index];
|
||||
_loc6_ = AvatarSwitch.numNonMemberAvatars;
|
||||
_loc3_ = AvatarSwitch.numNonMemberOceanAvatars;
|
||||
if(_loc4_ != null)
|
||||
{
|
||||
if(AvatarSwitch.isSlotAvailable(_index) || _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(_isChoosing)
|
||||
{
|
||||
_window.checkbox.visible = true;
|
||||
_window.checkbox.check.visible = false;
|
||||
_window.aml.bg.visible = false;
|
||||
_window.aml.gray.visible = true;
|
||||
if(_loc6_ > 0 && _loc6_ < 3)
|
||||
{
|
||||
if(!AvatarSwitch.isMemberOnlyAvatar(_index))
|
||||
{
|
||||
_window.checkbox.check.visible = false;
|
||||
}
|
||||
}
|
||||
if(_loc6_ - _loc3_ < 1 || _loc6_ <= _loc5_ && 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;
|
||||
_addGrayChild = true;
|
||||
}
|
||||
}
|
||||
else if(!_isChoosingOcean)
|
||||
{
|
||||
_window.recycle.visible = false;
|
||||
}
|
||||
if(_index == AvatarSwitch.activeAvatarIdx)
|
||||
{
|
||||
_window.aml.sel.visible = true;
|
||||
}
|
||||
while(_window.xpShape.numChildren > 0)
|
||||
{
|
||||
_window.xpShape.removeChildAt(0);
|
||||
}
|
||||
_ai = gMainFrame.userInfo.getAvatarInfoByUserNameThenPerUserAvId(_loc4_.userName,_loc4_.perUserAvId);
|
||||
if(_ai && _ai.questLevel > 0)
|
||||
{
|
||||
loadQuestShape();
|
||||
}
|
||||
if(_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;
|
||||
_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 < 2 || _isChoosing && _loc6_ - _loc3_ < 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(_isChoosing && AvatarSwitch.numNonMemberAvatars > 1 && _loc6_ - _loc3_ > 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)
|
||||
{
|
||||
_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(_recyclingOnly)
|
||||
{
|
||||
_window.recycle.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.recycle.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.den.visible = false;
|
||||
_window.buyDen.visible = true;
|
||||
}
|
||||
if(_currItem && !_isCurrItemLoaded && _isAnimal)
|
||||
{
|
||||
_isCurrItemLoaded = true;
|
||||
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
|
||||
{
|
||||
if(_addGrayChild)
|
||||
{
|
||||
_window.gray.amlMask.amlBox.addChild(_currItem[_iconLayerName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.aml.amlMask.amlBox.addChild(_currItem[_iconLayerName]);
|
||||
}
|
||||
}
|
||||
else if(_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(_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(_ai.questLevel,true,_window.xpShape[_loc1_].mouse.up.icon,null,_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(_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("mouseDown",_mouseDown,false,0,true);
|
||||
}
|
||||
if(_mouseOver != null)
|
||||
{
|
||||
addEventListener("rollOver",_mouseOver,false,0,true);
|
||||
}
|
||||
if(_mouseOut != null)
|
||||
{
|
||||
addEventListener("rollOut",_mouseOut,false,0,true);
|
||||
}
|
||||
if(_memberOnlyDown != null)
|
||||
{
|
||||
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
package gui.itemWindows
|
||||
{
|
||||
import avatar.Avatar;
|
||||
import avatar.AvatarDef;
|
||||
import avatar.AvatarItem;
|
||||
import avatar.AvatarUtility;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.filters.ColorMatrixFilter;
|
||||
import gui.LoadingSpiral;
|
||||
import inventory.Iitem;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
import pet.GuiPet;
|
||||
import pet.PetItem;
|
||||
import pet.PetManager;
|
||||
|
||||
public class ItemWindowAvatarOrPetSelect extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _forCreation:Boolean;
|
||||
|
||||
private var _avType:int;
|
||||
|
||||
private var _shouldShowDiamond:Boolean;
|
||||
|
||||
private var _customAvId:int;
|
||||
|
||||
private var _creationAvatar:Avatar;
|
||||
|
||||
private var _isPet:Boolean;
|
||||
|
||||
private var _currGuiPet:GuiPet;
|
||||
|
||||
private var _selectedIndex:int;
|
||||
|
||||
private var _loadingSpiral:LoadingSpiral;
|
||||
|
||||
private var _currIitem:Iitem;
|
||||
|
||||
private var _avatarDef:AvatarDef;
|
||||
|
||||
private var _currIcon:MovieClip;
|
||||
|
||||
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)
|
||||
{
|
||||
if(param2)
|
||||
{
|
||||
_isPet = param9.isPet == null ? false : true;
|
||||
_selectedIndex = param9.selectedIndex == null ? 0 : param9.selectedIndex;
|
||||
if(!_isPet)
|
||||
{
|
||||
_currIitem = param2 as AvatarItem;
|
||||
_creationAvatar = param9.creationAvatars[param4];
|
||||
_avatarDef = gMainFrame.userInfo.getAvatarDefByAvatar(_creationAvatar);
|
||||
_forCreation = param9.forCreation == null ? false : param9.forCreation;
|
||||
_avType = param9.avTypes[param4];
|
||||
_customAvId = _creationAvatar.customAvId;
|
||||
_shouldShowDiamond = _currIitem.isDiamond && !AvatarUtility.getAvatarDefIsViewableWithAvId(_avType,_customAvId != -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_currIitem = param2 as PetItem;
|
||||
_shouldShowDiamond = _currIitem.isDiamond && !PetManager.isPetAvailable((_currIitem as PetItem).defId);
|
||||
}
|
||||
}
|
||||
super("avatarOrPetWindowCont",param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
public function get currWindow() : MovieClip
|
||||
{
|
||||
return _window;
|
||||
}
|
||||
|
||||
public function get customAvId() : int
|
||||
{
|
||||
return _customAvId;
|
||||
}
|
||||
|
||||
public function selectItem() : void
|
||||
{
|
||||
if(_window.currentFrameLabel != (!_isPet && isDiamond) ? "diamond_down" : "down")
|
||||
{
|
||||
_window.gotoAndStop(!_isPet && isDiamond ? "diamond_down" : "down");
|
||||
}
|
||||
}
|
||||
|
||||
public function deselect() : void
|
||||
{
|
||||
if(_window.currentFrameLabel != (!_isPet && isDiamond) ? "diamond_up" : "up")
|
||||
{
|
||||
_window.gotoAndStop(!_isPet && isDiamond ? "diamond_up" : "up");
|
||||
}
|
||||
}
|
||||
|
||||
public function setupLayers() : void
|
||||
{
|
||||
_window.diamond.visible = _shouldShowDiamond;
|
||||
}
|
||||
|
||||
public function get isDiamond() : Boolean
|
||||
{
|
||||
if(_currItem && _currIitem)
|
||||
{
|
||||
return _currIitem.isDiamond;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
super.destroy();
|
||||
if(_currGuiPet)
|
||||
{
|
||||
_currGuiPet.destroy();
|
||||
_currGuiPet = null;
|
||||
}
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
if(_window && _currItem)
|
||||
{
|
||||
if(_isPet)
|
||||
{
|
||||
if(!_isCurrItemLoaded)
|
||||
{
|
||||
_currIitem.imageLoadedCallback = onPetLoaded;
|
||||
_currGuiPet = _currIitem.icon as GuiPet;
|
||||
setupCommonItems();
|
||||
_window.itemWindow.addChild(_currGuiPet);
|
||||
_isCurrItemLoaded = true;
|
||||
}
|
||||
else if(_loadingSpiral)
|
||||
{
|
||||
_loadingSpiral.destroy();
|
||||
_loadingSpiral = null;
|
||||
}
|
||||
}
|
||||
else if(_currItem && !_isCurrItemLoaded)
|
||||
{
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(_avatarDef.iconMediaId,onCurrItemLoaded);
|
||||
}
|
||||
else if(_currItem && _currIcon)
|
||||
{
|
||||
if(_loadingSpiral)
|
||||
{
|
||||
_loadingSpiral.destroy();
|
||||
_loadingSpiral = null;
|
||||
}
|
||||
_isCurrItemLoaded = true;
|
||||
setupCommonItems();
|
||||
if(_iconLayerName != "" && _currIcon.hasOwnProperty(_iconLayerName))
|
||||
{
|
||||
_window.itemWindow.addChild(_currIcon[_iconLayerName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.itemWindow.addChild(DisplayObject(_currIcon));
|
||||
}
|
||||
}
|
||||
else if(_loadingSpiral)
|
||||
{
|
||||
_loadingSpiral.destroy();
|
||||
_loadingSpiral = null;
|
||||
}
|
||||
if(index == _selectedIndex)
|
||||
{
|
||||
selectItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
_window.memberLock.visible = false;
|
||||
_window.endangered.visible = false;
|
||||
_window.ocean.visible = false;
|
||||
_window.diamond.visible = false;
|
||||
_window.daysLeftTag.visible = false;
|
||||
_window.clearanceTag.visible = false;
|
||||
_loadingSpiral = new LoadingSpiral(_window.itemWindow,_window.itemWindow.width * 0.5,_window.itemWindow.height * 0.5);
|
||||
if(_forCreation)
|
||||
{
|
||||
loadCurrItem();
|
||||
}
|
||||
}
|
||||
|
||||
private function onCurrItemLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_currIcon = param1.getChildAt(0) as MovieClip;
|
||||
_isCurrItemLoaded = true;
|
||||
loadCurrItem();
|
||||
}
|
||||
}
|
||||
|
||||
private function onPetLoaded(param1:MovieClip, param2:GuiPet) : void
|
||||
{
|
||||
if(_loadingSpiral)
|
||||
{
|
||||
_loadingSpiral.destroy();
|
||||
_loadingSpiral = null;
|
||||
}
|
||||
param1.scaleX = param1.scaleY = 2;
|
||||
param1.x = 53;
|
||||
param1.y = 85;
|
||||
}
|
||||
|
||||
private function setupCommonItems() : void
|
||||
{
|
||||
var _loc1_:Array = null;
|
||||
if(!gMainFrame.userInfo.isMember && _currIitem.isMemberOnly)
|
||||
{
|
||||
_window.memberLock.visible = true;
|
||||
}
|
||||
_window.clearanceTag.visible = _currIitem.isOnClearance;
|
||||
_window.diamond.visible = _shouldShowDiamond;
|
||||
setupNumDaysLeft();
|
||||
if(_isPet)
|
||||
{
|
||||
if(_currGuiPet.canGoInOcean())
|
||||
{
|
||||
_window.ocean.visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!_forCreation && Utility.isOcean(_avatarDef.enviroTypeFlag))
|
||||
{
|
||||
_window.ocean.visible = true;
|
||||
}
|
||||
if(AvatarUtility.isEndangered(_avatarDef.availability))
|
||||
{
|
||||
if(_avType == 13 || _avType == 16 || _avType == 26)
|
||||
{
|
||||
LocalizationManager.translateId(_window.endangered.txt,11177);
|
||||
}
|
||||
else if(_avType == 6)
|
||||
{
|
||||
LocalizationManager.translateId(_window.endangered.txt,14226);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalizationManager.translateId(_window.endangered.txt,11178);
|
||||
}
|
||||
_window.endangered.visible = true;
|
||||
}
|
||||
if(AvatarUtility.isExtinct(_avatarDef.availability))
|
||||
{
|
||||
_loc1_ = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0];
|
||||
_currIcon.filters = [new ColorMatrixFilter(_loc1_)];
|
||||
}
|
||||
if(_currIitem.isDiamond && _window.currentFrameLabel != "diamond_down")
|
||||
{
|
||||
_window.gotoAndStop("diamond_up");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function setupNumDaysLeft() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(!_currIitem.isRare && !_currIitem.isNew && !_currIitem.isOnSale)
|
||||
{
|
||||
_loc1_ = Math.ceil((_currIitem.endTime - Utility.getCurrEpochTime()) / 60 / 60 / 24);
|
||||
if(_loc1_ > 0 && _loc1_ <= 10)
|
||||
{
|
||||
if(_loc1_ == 1)
|
||||
{
|
||||
LocalizationManager.translateId(_window.daysLeftTag.txt,18061);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalizationManager.translateIdAndInsert(_window.daysLeftTag.txt,6260,_loc1_);
|
||||
}
|
||||
_window.daysLeftTag.visible = true;
|
||||
MovieClip(_window.daysLeftTag.parent).clearanceTag.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.daysLeftTag.visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.daysLeftTag.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
package gui.itemWindows
|
||||
{
|
||||
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)
|
||||
{
|
||||
_isPet = param9 != null ? param9.isPet : false;
|
||||
_isMember = param9 != null ? param9.isMember : false;
|
||||
_nameBarData = param9 != null ? param9.nameBarData : 0;
|
||||
if(!_isPet)
|
||||
{
|
||||
_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 _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(_currFrameName)
|
||||
{
|
||||
if(param1 == "over")
|
||||
{
|
||||
xpShape[_currFrameName].mouse.gotoAndPlay(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
xpShape[_currFrameName].mouse.gotoAndStop(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(_currItem && !_isCurrItemLoaded)
|
||||
{
|
||||
_isCurrItemLoaded = true;
|
||||
_window.charLayer.addChild(DisplayObject(_currItem));
|
||||
if(_ai && _ai.questLevel > 0)
|
||||
{
|
||||
_currFrameName = xpShape.currentLabels[Utility.getColorId(_nameBarData) - 1].name;
|
||||
if(xpShape.currentFrameLabel != _currFrameName)
|
||||
{
|
||||
xpShape.gotoAndStop(_currFrameName);
|
||||
}
|
||||
Utility.createXpShape(_ai.questLevel,_isMember,xpShape[_currFrameName].mouse.up.icon,xpShape[_currFrameName].mouse.mouse.icon,2147483647);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
_window.sel.visible = false;
|
||||
if(_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,293 @@
|
||||
package gui.itemWindows
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import gui.LoadingSpiral;
|
||||
import gui.WindowAndScrollbarGenerator;
|
||||
import gui.WindowGenerator;
|
||||
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 _visibilityIndex: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:Object;
|
||||
|
||||
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();
|
||||
_currItem = param3;
|
||||
_iconLayerName = param4;
|
||||
_mouseDown = param6;
|
||||
_mouseOver = param7;
|
||||
_mouseOut = param8;
|
||||
_memberOnlyDown = param9;
|
||||
_index = param5;
|
||||
_visibilityIndex = param5;
|
||||
_windowLoadedCallback = param2;
|
||||
_useToolTip = param10;
|
||||
if(param1 is String)
|
||||
{
|
||||
_loc11_ = String(param1).split("|");
|
||||
_window = GETDEFINITIONBYNAME(_loc11_[0],_loc11_.length > 1 ? false : true);
|
||||
addChild(_window);
|
||||
addEventListeners();
|
||||
setChildrenAndInitialConditions();
|
||||
onWindowLoadCallback();
|
||||
}
|
||||
else if(param1 is int)
|
||||
{
|
||||
_windowMediaHelper = new MediaHelper();
|
||||
_windowMediaHelper.init(param1,onWindowLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!(param1 is MovieClip))
|
||||
{
|
||||
throw new Error("windowClassOrId is not of type string or int. windowClassOrIdOrMovieClip = " + param1);
|
||||
}
|
||||
_window = param1;
|
||||
addChild(_window);
|
||||
addEventListeners();
|
||||
setChildrenAndInitialConditions();
|
||||
onWindowLoadCallback();
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
removeEventListeners();
|
||||
if(_spiral)
|
||||
{
|
||||
_spiral.destroy();
|
||||
}
|
||||
if(_windowMediaHelper)
|
||||
{
|
||||
_windowMediaHelper.destroy();
|
||||
}
|
||||
if(_window && _window.parent == this)
|
||||
{
|
||||
removeChild(_window);
|
||||
}
|
||||
if(_currItem && _currItem.hasOwnProperty("destroy"))
|
||||
{
|
||||
_currItem.destroy();
|
||||
}
|
||||
_windowGenerator = null;
|
||||
_window = null;
|
||||
_windowLoadedCallback = null;
|
||||
_currItem = null;
|
||||
_mouseDown = null;
|
||||
_mouseOver = null;
|
||||
_mouseOut = null;
|
||||
}
|
||||
|
||||
public function get index() : int
|
||||
{
|
||||
return _index;
|
||||
}
|
||||
|
||||
public function set index(param1:int) : void
|
||||
{
|
||||
_index = param1;
|
||||
}
|
||||
|
||||
public function get visibilityIndex() : int
|
||||
{
|
||||
return _visibilityIndex;
|
||||
}
|
||||
|
||||
public function set visibilityIndex(param1:int) : void
|
||||
{
|
||||
_visibilityIndex = param1;
|
||||
}
|
||||
|
||||
override public function get width() : Number
|
||||
{
|
||||
if("sizeCont" in _window && _window.sizeCont)
|
||||
{
|
||||
return _window.sizeCont.width;
|
||||
}
|
||||
return super.width;
|
||||
}
|
||||
|
||||
override public function get height() : Number
|
||||
{
|
||||
if("sizeCont" in _window && _window.sizeCont)
|
||||
{
|
||||
return _window.sizeCont.height;
|
||||
}
|
||||
return super.height;
|
||||
}
|
||||
|
||||
public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(_currItem && !(_currItem is int) && !_isCurrItemLoaded)
|
||||
{
|
||||
_isCurrItemLoaded = true;
|
||||
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
|
||||
{
|
||||
_window.addChild(_currItem[_iconLayerName]);
|
||||
}
|
||||
else if(_window != _currItem)
|
||||
{
|
||||
_window.addChild(DisplayObject(_currItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function onWindowLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_window = MovieClip(param1.getChildAt(0));
|
||||
addChild(_window);
|
||||
setChildrenAndInitialConditions();
|
||||
onWindowLoadCallback();
|
||||
addEventListeners();
|
||||
_windowMediaHelper.destroy();
|
||||
_windowMediaHelper = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected function onWindowLoadCallback() : void
|
||||
{
|
||||
if(_windowLoadedCallback != null)
|
||||
{
|
||||
_windowLoadedCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
}
|
||||
|
||||
protected function onWindowRollOver(param1:MouseEvent) : void
|
||||
{
|
||||
if(_useToolTip && this.parent != null)
|
||||
{
|
||||
if(_windowGenerator == null)
|
||||
{
|
||||
if(this.parent.parent is WindowGenerator)
|
||||
{
|
||||
_windowGenerator = WindowGenerator(this.parent.parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
_windowGenerator = WindowAndScrollbarGenerator(this.parent.parent);
|
||||
}
|
||||
}
|
||||
if(_currItem && _windowGenerator.isIndexInView(_visibilityIndex))
|
||||
{
|
||||
_windowGenerator.toolTip.init(_windowGenerator.parent.parent,_currItem.name,this.x + _windowGenerator.boxWidth * 0.5 - _itemXLocation + _windowGenerator.parent.x,this.y + _windowGenerator.boxHeight - _itemYLocation + _windowGenerator.parent.y - 5);
|
||||
_windowGenerator.toolTip.startTimer(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function onWindowRollOut(param1:MouseEvent) : void
|
||||
{
|
||||
if(_windowGenerator && _useToolTip && this.parent != null)
|
||||
{
|
||||
_windowGenerator.toolTip.resetTimerAndSetVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
protected function addEventListeners() : void
|
||||
{
|
||||
if(_window && _currItem)
|
||||
{
|
||||
if(_mouseDown != null && !(_memberOnlyDown != null && !gMainFrame.userInfo.isMember))
|
||||
{
|
||||
addEventListener("mouseDown",_mouseDown,false,0,true);
|
||||
}
|
||||
if(_mouseOver != null)
|
||||
{
|
||||
if(_useToolTip)
|
||||
{
|
||||
addEventListener("rollOver",onWindowRollOver,false,0,true);
|
||||
}
|
||||
addEventListener("rollOver",_mouseOver,false,0,true);
|
||||
}
|
||||
if(_mouseOut != null)
|
||||
{
|
||||
if(_useToolTip)
|
||||
{
|
||||
addEventListener("rollOut",onWindowRollOut,false,0,true);
|
||||
}
|
||||
addEventListener("rollOut",_mouseOut,false,0,true);
|
||||
}
|
||||
if(_memberOnlyDown != null && !gMainFrame.userInfo.isMember)
|
||||
{
|
||||
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function removeEventListeners() : void
|
||||
{
|
||||
if(_mouseDown != null)
|
||||
{
|
||||
removeEventListener("mouseDown",_mouseDown);
|
||||
}
|
||||
if(_mouseOver != null)
|
||||
{
|
||||
if(_useToolTip)
|
||||
{
|
||||
removeEventListener("rollOver",onWindowRollOver);
|
||||
}
|
||||
removeEventListener("rollOver",_mouseOver);
|
||||
}
|
||||
if(_mouseOut != null)
|
||||
{
|
||||
if(_useToolTip)
|
||||
{
|
||||
removeEventListener("rollOut",onWindowRollOut);
|
||||
}
|
||||
removeEventListener("rollOut",_mouseOut);
|
||||
}
|
||||
if(_memberOnlyDown != null)
|
||||
{
|
||||
removeEventListener("mouseDown",_memberOnlyDown);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loaded 100 of 7925 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user