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,401 @@
|
||||
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 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 _loc8_:int = 0;
|
||||
var _loc10_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc11_:MovieClip = null;
|
||||
var _loc7_:TextField = null;
|
||||
var _loc9_:Object = null;
|
||||
var _loc2_:int = 0;
|
||||
var _loc6_:WindowAndScrollbarGenerator = null;
|
||||
if(_itemWindows)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
_numAchievementsLastDrawn = _myAchievements.length;
|
||||
var _loc13_:Array = SbiConstants.ACHIEVEMENT_TYPE_NAMES;
|
||||
var _loc3_:Array = AchievementManager.typeNamesTranslatedAndSorted;
|
||||
_allAchievementsIndexed = AchievementManager.getAllAchievementsIndexed();
|
||||
_sectionItemWindows = [];
|
||||
var _loc14_:TextFormat = (_achievementPopupContent.titleTxt as TextField).getTextFormat();
|
||||
_loc14_.size = 22;
|
||||
var _loc12_:int = int(_achievementPopupContent.itemBlockAll.width);
|
||||
var _loc4_:int = int(_achievementPopupContent.itemBlockAll.height);
|
||||
_loc8_ = 0;
|
||||
while(_loc8_ < _loc3_.length)
|
||||
{
|
||||
_loc9_ = _loc3_[_loc8_];
|
||||
_loc2_ = int(_allAchievementsIndexed[_loc9_.typeIndex].length);
|
||||
_loc10_ = Math.min(_loc2_,6);
|
||||
_loc5_ = Math.ceil(_loc10_ / 5);
|
||||
_loc11_ = new MovieClip();
|
||||
_loc7_ = new TextField();
|
||||
_loc7_.autoSize = "left";
|
||||
_loc7_.defaultTextFormat = _loc14_;
|
||||
_loc7_.embedFonts = true;
|
||||
_loc7_.antiAliasType = "advanced";
|
||||
_loc7_.setTextFormat(_loc14_);
|
||||
_loc7_.text = _loc9_.name;
|
||||
_loc11_.addChild(_loc7_);
|
||||
_loc6_ = new WindowAndScrollbarGenerator();
|
||||
_loc6_.init(_loc12_,_loc4_,0,0,1,1,0,0,0,5,ItemWindowWithSeparators,[_loc11_],"",0,null,null,null,true,false,false,true);
|
||||
_sectionItemWindows.push(_loc6_);
|
||||
_loc6_ = new WindowAndScrollbarGenerator();
|
||||
_loc6_.init(_loc12_,_loc4_,0,0,_loc10_,_loc5_,0,0,0,0,ItemWindowWithSeparators,_allAchievementsIndexed[_loc9_.typeIndex],"image",0,{
|
||||
"mouseOver":winMouseOver,
|
||||
"mouseOut":winMouseOut,
|
||||
"mouseDown":winMouseDown
|
||||
},{
|
||||
"itemClassName":"awardCont",
|
||||
"secondaryIndex":_loc8_ * 2 + 1,
|
||||
"myAchievementsByType":_myAchievementsIndexed[_loc9_.typeIndex]
|
||||
},null,true,false,false,true);
|
||||
_sectionItemWindows.push(_loc6_);
|
||||
_loc8_++;
|
||||
}
|
||||
_itemWindows = new WindowAndScrollbarGenerator();
|
||||
_itemWindows.init(_loc12_,_loc4_ - 8,0,0,1,_sectionItemWindows.length,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 _loc7_:Achievement = null;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:Object = null;
|
||||
var _loc3_:Array = null;
|
||||
var _loc6_:int = 0;
|
||||
if(_allAchievementsIndexed[param1] && _allAchievementsIndexed[param1][param2])
|
||||
{
|
||||
while(_achievementPopupContent.itemBlockSingle.numChildren > 1)
|
||||
{
|
||||
_achievementPopupContent.itemBlockSingle.removeChildAt(_achievementPopupContent.itemBlockSingle.numChildren - 1);
|
||||
}
|
||||
_loc7_ = _allAchievementsIndexed[param1][param2].clone();
|
||||
LocalizationManager.updateToFit(_achievementPopupContent.achNameTxt,_loc7_.name);
|
||||
_loc4_ = Math.max(0,gMainFrame.userInfo.userVarCache.getUserVarValueById(_loc7_.userVarId));
|
||||
_loc5_ = AchievementManager.getAchievementDef(_loc7_.defId);
|
||||
if(_loc4_ == 0)
|
||||
{
|
||||
_loc3_ = _myAchievementsIndexed[param1];
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc3_.length)
|
||||
{
|
||||
if(_loc3_[_loc6_].defId == _loc7_.defId)
|
||||
{
|
||||
_loc4_ = 1;
|
||||
break;
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_loc4_ > _loc5_.triggeredAmount)
|
||||
{
|
||||
_loc4_ = int(_loc5_.triggeredAmount);
|
||||
}
|
||||
_achievementPopupContent.progressMeter.normalBar.width = (1 - _loc4_ / _loc5_.triggeredAmount) * _achievementPopupContent.progressMeter.greenBar.width;
|
||||
_achievementPopupContent.progressTxt.text = _loc4_ + "/" + _loc5_.triggeredAmount;
|
||||
_loc7_.setScale(2);
|
||||
_achievementPopupContent.itemBlockSingle.addChild(_loc7_.image);
|
||||
LocalizationManager.updateToFit(_achievementPopupContent.descText,_loc7_.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 _loc5_:Achievement = _allAchievementsIndexed[param1.currentTarget.currItemType][param1.currentTarget.index];
|
||||
GuiManager.toolTip.init(_achievementPopupContent.itemBlockAll,_loc5_.name,0,0);
|
||||
GuiManager.toolTip.startTimer(param1);
|
||||
var _loc2_:int = param1.currentTarget.y + (_itemWindows.mediaWindows[param1.currentTarget.secondaryIndex].y - _itemWindows.scrollYValue);
|
||||
if(_loc5_.baseImageMediaId == Achievement.BASE_RIBBON_ID)
|
||||
{
|
||||
_loc2_ += 42;
|
||||
}
|
||||
else if(_loc5_.baseImageMediaId == Achievement.BASE_MEDAL_ID)
|
||||
{
|
||||
_loc2_ += 56;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ += 57;
|
||||
}
|
||||
var _loc3_:int = param1.currentTarget.x + param1.currentTarget.width * 0.5;
|
||||
var _loc4_:Number = GuiManager.toolTip.width * 0.5 - _loc3_;
|
||||
if(_loc4_ > 15)
|
||||
{
|
||||
_loc3_ += _loc4_ - 15;
|
||||
}
|
||||
GuiManager.toolTip.setPos(_loc3_,_loc2_);
|
||||
}
|
||||
|
||||
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,640 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
import avatar.UserCommXtCommManager;
|
||||
import flash.display.MovieClip;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Point;
|
||||
import game.MinigameManager;
|
||||
import gskinner.motion.GTween;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
import pet.WorldPet;
|
||||
|
||||
public class ActionManager
|
||||
{
|
||||
|
||||
private const ACTIONWINDOW_DIM_ALPHA:Number = 0.5;
|
||||
|
||||
private const ACTIONWINDOW_BRIGHT_ALPHA:Number = 1;
|
||||
|
||||
public var actionBtn:MovieClip;
|
||||
|
||||
public var actionWindow:MovieClip;
|
||||
|
||||
public var emoteBtn:MovieClip;
|
||||
|
||||
public var emoteWindow:Sprite;
|
||||
|
||||
public var safeChatBtn:MovieClip;
|
||||
|
||||
public var safeChatTree:MovieClip;
|
||||
|
||||
public var setActionCallback:Function;
|
||||
|
||||
public var actionSprites:Array = ["sit1BtnCont","sit2BtnCont","sit3BtnCont","sit4BtnCont","danceAnim_btnCont","sleepAnim_btnCont","hopAnim_btnCont","playAnim_btnCont","pose1BtnCont","pose2BtnCont","diveAnim_btnCont","swirlAnim_btnCont"];
|
||||
|
||||
public var actionStrings:Object;
|
||||
|
||||
private var _actions:MovieClip;
|
||||
|
||||
private var _petActions:MovieClip;
|
||||
|
||||
private var _gameTab:MovieClip;
|
||||
|
||||
private var _isGameTabOpen:Boolean;
|
||||
|
||||
private var _sideMenuTweenFinished:Boolean;
|
||||
|
||||
private var _pvpScrollBar:SBScrollbar;
|
||||
|
||||
private var _pvpItemWindows:WindowGenerator;
|
||||
|
||||
private var _pvpGameList:Array;
|
||||
|
||||
private var _views:Array;
|
||||
|
||||
public function ActionManager(param1:Function, param2:MovieClip, param3:MovieClip, param4:MovieClip, param5:Sprite, param6:MovieClip, param7:MovieClip)
|
||||
{
|
||||
super();
|
||||
if(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 _loc13_:* = 0;
|
||||
_loc13_ = 10;
|
||||
var _loc7_:* = 0;
|
||||
_loc7_ = 25;
|
||||
var _loc16_:* = 0;
|
||||
_loc16_ = 40;
|
||||
var _loc8_:* = 0;
|
||||
_loc8_ = 91;
|
||||
var _loc3_:* = 0;
|
||||
_loc3_ = 2;
|
||||
var _loc11_:Number = NaN;
|
||||
_loc11_ = -72;
|
||||
var _loc12_:Number = NaN;
|
||||
_loc12_ = -50;
|
||||
var _loc5_:Number = NaN;
|
||||
_loc5_ = -88;
|
||||
var _loc1_:int = 0;
|
||||
_loc1_ = 4;
|
||||
var _loc15_:int = 0;
|
||||
_loc15_ = 2;
|
||||
var _loc14_:int = 0;
|
||||
_loc14_ = 8;
|
||||
var _loc9_:* = 0;
|
||||
var _loc2_:Sprite = null;
|
||||
var _loc10_:Sprite = null;
|
||||
var _loc4_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
_actions = new MovieClip();
|
||||
_petActions = new MovieClip();
|
||||
_loc9_ = 0;
|
||||
while(_loc9_ < actionSprites.length)
|
||||
{
|
||||
if(_loc9_ < 8)
|
||||
{
|
||||
_loc2_ = GETDEFINITIONBYNAME(_loc9_ < 4 ? "sitBtns" : actionSprites[_loc9_]);
|
||||
if(_loc9_ == 0)
|
||||
{
|
||||
_loc2_.x = actionWindow.ba.width * 0.5 + -72 - 25 - 5;
|
||||
_loc2_.y = 10 + Math.floor(_loc9_ / 2) * 40 + -50;
|
||||
_actions.addChild(_loc2_);
|
||||
_actions.sitBtns = _loc2_;
|
||||
_loc4_ = 1;
|
||||
while(_loc4_ <= 4)
|
||||
{
|
||||
_loc10_ = _loc2_["sit" + _loc4_ + "Btn"];
|
||||
_loc10_.buttonMode = true;
|
||||
_loc10_.useHandCursor = true;
|
||||
_loc10_.tabEnabled = true;
|
||||
_loc10_.tabChildren = false;
|
||||
_loc10_.addEventListener("mouseDown",actionClickHandler,false,0,true);
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
else if(_loc9_ >= 4)
|
||||
{
|
||||
_loc2_.x = 25 + (_loc9_ % 2 * 91 + -72);
|
||||
_loc2_.y = 10 + Math.floor(_loc9_ / 2) * 40 + -88;
|
||||
_actions.addChild(_loc2_);
|
||||
_loc2_.buttonMode = true;
|
||||
_loc2_.useHandCursor = true;
|
||||
_loc2_.tabEnabled = true;
|
||||
_loc2_.tabChildren = false;
|
||||
_loc2_.addEventListener("mouseDown",actionClickHandler,false,0,true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = GETDEFINITIONBYNAME(_loc9_ == 8 ? "poseBtns" : actionSprites[_loc9_]);
|
||||
if(_loc9_ == 8)
|
||||
{
|
||||
_loc2_.visible = false;
|
||||
_actions.poseBtns = _loc2_;
|
||||
_loc2_.x = actionWindow.ba.width * 0.5 + -72 - 25 - 5;
|
||||
_loc2_.y = 10 + Math.floor((_loc9_ - 8) / 2) * 40 + -50;
|
||||
_actions.addChild(_loc2_);
|
||||
_loc6_ = 1;
|
||||
while(_loc6_ <= 2)
|
||||
{
|
||||
_loc10_ = _loc2_["pose" + _loc6_ + "Btn"];
|
||||
_loc10_.buttonMode = true;
|
||||
_loc10_.useHandCursor = true;
|
||||
_loc10_.tabEnabled = true;
|
||||
_loc10_.tabChildren = false;
|
||||
_loc10_.addEventListener("mouseDown",actionClickHandler,false,0,true);
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
else if(_loc9_ >= 8 + 2)
|
||||
{
|
||||
_loc2_.visible = false;
|
||||
if(_loc9_ == actionSprites.length - 1)
|
||||
{
|
||||
_actions.diveBtn = _loc2_;
|
||||
}
|
||||
else
|
||||
{
|
||||
_actions.swirlBtn = _loc2_;
|
||||
}
|
||||
_loc2_.x = 25 + ((_loc9_ - 5) % 2 * 91 + -72);
|
||||
_loc2_.y = 10 + Math.floor((_loc9_ - 5) / 2) * 40 + -88;
|
||||
_actions.addChild(_loc2_);
|
||||
_loc2_.buttonMode = true;
|
||||
_loc2_.useHandCursor = true;
|
||||
_loc2_.tabEnabled = true;
|
||||
_loc2_.tabChildren = false;
|
||||
_loc2_.addEventListener("mouseDown",actionClickHandler,false,0,true);
|
||||
}
|
||||
}
|
||||
_loc9_++;
|
||||
}
|
||||
_loc2_ = GETDEFINITIONBYNAME("playPetAnim_btnCont");
|
||||
_loc2_.y = -31;
|
||||
_loc2_.buttonMode = true;
|
||||
_loc2_.useHandCursor = true;
|
||||
_loc2_.tabEnabled = true;
|
||||
_loc2_.tabChildren = false;
|
||||
_loc2_.addEventListener("mouseDown",onPetPlayBtn,false,0,true);
|
||||
_petActions.addChild(_loc2_);
|
||||
_loc2_ = GETDEFINITIONBYNAME("dancePetAnim_btnCont");
|
||||
_petActions.danceBtn = _loc2_;
|
||||
_loc2_.y = 31;
|
||||
_loc2_.buttonMode = true;
|
||||
_loc2_.useHandCursor = true;
|
||||
_loc2_.tabEnabled = true;
|
||||
_loc2_.tabChildren = false;
|
||||
_loc2_.addEventListener("mouseDown",actionClickHandler,false,0,true);
|
||||
_petActions.addChild(_loc2_);
|
||||
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 _loc3_:String = param1["constructor"].toString();
|
||||
var _loc2_:String = _loc3_.slice(7,_loc3_.length - 1);
|
||||
if(actionStrings[_loc2_])
|
||||
{
|
||||
if(actionStrings[_loc2_].length > 1)
|
||||
{
|
||||
return actionStrings[_loc3_.slice(7,_loc3_.length - 1)][AvatarManager.roomEnviroType == 0 ? 0 : 1];
|
||||
}
|
||||
return actionStrings[_loc3_.slice(7,_loc3_.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 _loc2_:int = 0;
|
||||
var _loc1_:MediaHelper = null;
|
||||
_views = [];
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _pvpGameList.length)
|
||||
{
|
||||
_loc1_ = new MediaHelper();
|
||||
_loc1_.init(_pvpGameList[_loc2_].gameCardMediaId,mediaHelperCallback,true);
|
||||
_views[_loc2_] = _loc1_;
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
|
||||
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 _loc2_:AvatarInfo = null;
|
||||
param1.stopPropagation();
|
||||
var _loc3_:int = 0;
|
||||
if(Utility.canQuest())
|
||||
{
|
||||
if(param1.currentTarget.name == _difficultyPopup.dModeCont.hardBtn.name)
|
||||
{
|
||||
_loc2_ = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
|
||||
if(_loc2_ && _loc2_.questLevel < _scriptDef.levelMin + 1)
|
||||
{
|
||||
new SBOkPopup(_guiLayer,LocalizationManager.translateIdAndInsertOnly(14696,_scriptDef.levelMin + 1));
|
||||
return;
|
||||
}
|
||||
_loc3_ = 1;
|
||||
}
|
||||
if(_difficultyPopup.joinName == _difficultyPopup.joinBtn.name)
|
||||
{
|
||||
QuestXtCommManager.sendQuestCreateJoinPublic(_scriptDef.defId,_loc3_,_autoStart);
|
||||
destroy();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
return;
|
||||
}
|
||||
if(!gMainFrame.userInfo.isMember)
|
||||
{
|
||||
UpsellManager.displayPopup(15,"customAdventure/");
|
||||
destroy();
|
||||
return;
|
||||
}
|
||||
QuestXtCommManager.sendQuestCreatePrivate(_scriptDef.defId,_loc3_,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(15,"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 _loc8_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc7_:Avatar = null;
|
||||
var _loc6_:AvatarInfo = null;
|
||||
if(_popup && (_type == "normal" || _type == "custParty"))
|
||||
{
|
||||
_loc8_ = int(_scriptDef.avatarLimit);
|
||||
_loc3_ = 1;
|
||||
_loc5_ = 1;
|
||||
while(_loc5_ < _loc8_ + 1)
|
||||
{
|
||||
while(_numPlayersMC["p" + _loc5_].char.charLayer.numChildren > 0)
|
||||
{
|
||||
_numPlayersMC["p" + _loc5_].char.charLayer.removeChildAt(0);
|
||||
}
|
||||
_numPlayersMC["p" + _loc5_].char.gotoAndPlay("waiting");
|
||||
_numPlayersMC["p" + _loc5_].char.nameBar.lastName_txt.text = "";
|
||||
_loc5_++;
|
||||
}
|
||||
_loc2_ = 2;
|
||||
for(; _loc2_ < _loc8_ + 2; _loc2_++)
|
||||
{
|
||||
if(_loc2_ < param1.length)
|
||||
{
|
||||
_loc4_ = int(param1[_loc2_]);
|
||||
_numPlayersMC["p" + (_loc2_ - 1)].char.gotoAndPlay("up");
|
||||
_loc7_ = AvatarManager.getAvatarBySfsUserId(_loc4_);
|
||||
if(_loc7_)
|
||||
{
|
||||
_loc6_ = gMainFrame.userInfo.getAvatarInfoByUserName(_loc7_.userName);
|
||||
}
|
||||
if(_loc7_ == null || _loc6_ == null)
|
||||
{
|
||||
_savedParams[_loc4_] = _numPlayersMC["p" + (_loc2_ - 1)];
|
||||
AvatarXtCommManager.requestAvatarGetBySfsId(_loc4_,onAvatarGetReceived);
|
||||
continue;
|
||||
}
|
||||
setupAvatar(_numPlayersMC["p" + (_loc2_ - 1)],_loc7_,_loc6_.currPet);
|
||||
}
|
||||
else
|
||||
{
|
||||
_numPlayersMC["p" + (_loc2_ - 1)].char.gotoAndPlay("waiting");
|
||||
LocalizationManager.translateId(_numPlayersMC["p" + (_loc2_ - 1)].char.nameBar.firstName_txt,11101);
|
||||
_numPlayersMC["p" + (_loc2_ - 1)].char.nameBar.lastName_txt.text = "";
|
||||
}
|
||||
_numPlayersMC["p" + (_loc2_ - 1)].char.nameBar.visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_inParamsWaiting = param1;
|
||||
}
|
||||
}
|
||||
|
||||
private function setupAvatar(param1:MovieClip, param2:Avatar, param3:Object) : void
|
||||
{
|
||||
var _loc5_:GuiPet = null;
|
||||
var _loc10_:AvatarView = null;
|
||||
var _loc9_:Point = null;
|
||||
var _loc8_:String = null;
|
||||
var _loc7_:int = 0;
|
||||
var _loc6_:String = null;
|
||||
var _loc4_:String = null;
|
||||
if(_scriptDef.playAsPet)
|
||||
{
|
||||
_loc5_ = new GuiPet(0,param3.lBits,param3.uBits,param3.eBits,param3.type,param3.name,onBigPetLoaded);
|
||||
param1.char.charLayer.addChild(_loc5_);
|
||||
param1.char.nameBar.firstName_txt.text = _loc5_.petName;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc10_ = new AvatarView();
|
||||
_loc10_.init(param2);
|
||||
_loc10_.playAnim(15);
|
||||
_loc10_.scaleX = 0.7;
|
||||
_loc10_.scaleY = 0.7;
|
||||
_loc9_ = AvatarUtility.getAvatarMinigameLobbyOffset(_loc10_.avTypeId);
|
||||
_loc10_.x = _loc9_.x;
|
||||
_loc10_.y = _loc9_.y + 5;
|
||||
param1.char.charLayer.addChild(_loc10_);
|
||||
_loc8_ = param2.avName;
|
||||
_loc7_ = _loc8_.indexOf(" ");
|
||||
if(_loc7_ != -1)
|
||||
{
|
||||
_loc6_ = _loc8_.substr(0,_loc7_);
|
||||
_loc4_ = _loc8_.substr(_loc7_ + 1,_loc8_.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc6_ = _loc8_;
|
||||
}
|
||||
param1.char.nameBar.firstName_txt.text = _loc6_;
|
||||
if(_loc4_)
|
||||
{
|
||||
param1.char.nameBar.lastName_txt.text = _loc4_;
|
||||
}
|
||||
}
|
||||
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 _loc7_:AvatarInfo = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:Avatar = null;
|
||||
if(_popup && param2)
|
||||
{
|
||||
_loc7_ = gMainFrame.userInfo.getAvatarInfoByUserName(param1);
|
||||
if(!_loc7_)
|
||||
{
|
||||
throw new Error("onAvatarSFSGetReceived and avInfo is null");
|
||||
}
|
||||
_loc5_ = _loc7_.perUserAvId;
|
||||
_loc6_ = AvatarManager.getAvatarByUserName(param1);
|
||||
if(_loc6_ == null)
|
||||
{
|
||||
_loc6_ = AvatarUtility.generateNew(_loc5_,null,param1,-1,0);
|
||||
}
|
||||
setupAvatar(_savedParams[param4],_loc6_,_loc7_.currPet);
|
||||
delete _savedParams[param4];
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var _loc7_:AvatarView = null;
|
||||
var _loc6_:String = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:String = null;
|
||||
var _loc3_:String = null;
|
||||
var _loc2_: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")
|
||||
{
|
||||
_loc7_ = new AvatarView();
|
||||
_loc7_.init(AvatarManager.playerAvatar);
|
||||
_loc7_.playAnim(15);
|
||||
_numPlayersMC.p1.char.charLayer.addChild(_loc7_);
|
||||
if(_type == "custParty")
|
||||
{
|
||||
_popup.playBtn.visible = false;
|
||||
_popup.playBg.visible = false;
|
||||
}
|
||||
_loc6_ = AvatarManager.playerAvatar.avName;
|
||||
_loc5_ = _loc6_.indexOf(" ");
|
||||
if(_loc5_ != -1)
|
||||
{
|
||||
_loc4_ = _loc6_.substr(0,_loc5_);
|
||||
_loc3_ = _loc6_.substr(_loc5_ + 1,_loc6_.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ = _loc6_;
|
||||
}
|
||||
_numPlayersMC.p1.char.nameBar.firstName_txt.text = _loc4_;
|
||||
if(_loc3_)
|
||||
{
|
||||
_numPlayersMC.p1.char.nameBar.lastName_txt.text = _loc3_;
|
||||
}
|
||||
_numPlayersMC.p1.char.nameBar.visible = false;
|
||||
_loc2_ = 2;
|
||||
while(_loc2_ < _scriptDef.avatarLimit + 1)
|
||||
{
|
||||
_numPlayersMC["p" + _loc2_].char.gotoAndPlay("waiting");
|
||||
LocalizationManager.translateId(_numPlayersMC["p" + _loc2_].char.nameBar.firstName_txt,11101);
|
||||
_numPlayersMC["p" + _loc2_].char.nameBar.lastName_txt.text = "";
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
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,521 @@
|
||||
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 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) + "/" + "100";
|
||||
_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();
|
||||
}
|
||||
}
|
||||
|
||||
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) + "/" + "100";
|
||||
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,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 _loc1_:Dictionary = BuddyManager.buddyList;
|
||||
var _loc2_:int = BuddyManager.buddyCount;
|
||||
_buddyListContent.counterTxt.text = String(BuddyManager.buddyCount) + "/" + "100";
|
||||
if(_loc1_ && _loc2_ > 0)
|
||||
{
|
||||
for each(var _loc3_:Buddy in _loc1_)
|
||||
{
|
||||
_loc4_.push({
|
||||
"userName":_loc3_.userName,
|
||||
"moderatedUserName":_loc3_.userNameModerated,
|
||||
"moderatedUserNameFlag":_loc3_.userNameModeratedFlag,
|
||||
"onlineStatus":_loc3_.onlineStatus,
|
||||
"numDaysSinceLastLogin":_loc3_.numDaysSinceLastLogin,
|
||||
"accountType":_loc3_.accountType,
|
||||
"uuid":_loc3_.uuid,
|
||||
"timeLeftHostingCustomParty":_loc3_.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 _loc5_:Dictionary = null;
|
||||
var _loc6_: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_ = [];
|
||||
_loc5_ = BuddyManager.buddyList;
|
||||
_loc6_ = BuddyManager.buddyCount;
|
||||
if(_loc5_ && _loc6_ > 0)
|
||||
{
|
||||
for each(var _loc7_:Buddy in _loc5_)
|
||||
{
|
||||
_loc8_.push({
|
||||
"userName":_loc7_.userName,
|
||||
"moderatedUserName":_loc7_.userNameModerated,
|
||||
"moderatedUserNameFlag":_loc7_.userNameModeratedFlag,
|
||||
"uuid":_loc7_.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,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 _loc2_:MovieClip = MovieClip(param1.currentTarget);
|
||||
var _loc3_:Buddy = param1.currentTarget.getBuddy();
|
||||
if(_loc3_.userName.indexOf("Liza") < 0)
|
||||
{
|
||||
BuddyCard.showBuddyCard({
|
||||
"userName":_loc3_.userName,
|
||||
"onlineStatus":_loc3_.onlineStatus
|
||||
});
|
||||
}
|
||||
GuiManager.toolTip.resetTimerAndSetVisibility();
|
||||
AJAudio.playSubMenuBtnClick();
|
||||
}
|
||||
|
||||
private static function buddyListOverBuddyHandler(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:String = null;
|
||||
var _loc4_:int = _buddyListPopup.x - _itemWindowBuddyList.width * 0.5 + 5;
|
||||
var _loc3_:int = _buddyListPopup.y - 88.2 - _itemWindowBuddyList.scrollYValue;
|
||||
var _loc5_:MovieClip = MovieClip(param1.currentTarget.getChildAt(0));
|
||||
var _loc6_:int = int(param1.currentTarget.daysSinceLastLogin);
|
||||
if(param1.currentTarget.currentFrameLabel == "online")
|
||||
{
|
||||
_loc2_ = LocalizationManager.translateIdOnly(11251);
|
||||
}
|
||||
else if(_loc6_ == 0)
|
||||
{
|
||||
_loc2_ = LocalizationManager.translateIdOnly(11252);
|
||||
}
|
||||
else if(_loc6_ == 1)
|
||||
{
|
||||
_loc2_ = LocalizationManager.translateIdOnly(11253);
|
||||
}
|
||||
else if(_loc6_ > 1 && _loc6_ < 31)
|
||||
{
|
||||
_loc2_ = LocalizationManager.translateIdAndInsertOnly(11254,_loc6_);
|
||||
}
|
||||
else if(_loc6_ > 30 || _loc6_ == -1)
|
||||
{
|
||||
_loc2_ = LocalizationManager.translateIdOnly(11255);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = LocalizationManager.translateIdOnly(11256);
|
||||
}
|
||||
GuiManager.toolTip.init(GuiManager.guiLayer,_loc2_,0,0);
|
||||
GuiManager.toolTip.setPos(_loc4_ + _loc5_.x + GuiManager.toolTip.width * 0.5,_loc3_ + param1.currentTarget.y);
|
||||
GuiManager.toolTip.startTimer(param1);
|
||||
}
|
||||
|
||||
private static function buddyListOutBuddyHandler(param1:MouseEvent) : void
|
||||
{
|
||||
GuiManager.toolTip.resetTimerAndSetVisibility();
|
||||
}
|
||||
|
||||
private static function buddyListBtnHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
if(!listRequested)
|
||||
{
|
||||
BuddyXtCommManager.sendBuddyListRequest();
|
||||
listRequested = true;
|
||||
}
|
||||
GuiManager.onExitRoom(true);
|
||||
if(_buddyListPopup.visible)
|
||||
{
|
||||
_buddyListPopup.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
glowTimerHandler(null);
|
||||
_buddyListPopup.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function buddyListClosedCallback() : void
|
||||
{
|
||||
_buddyListBtn.downToUpState();
|
||||
}
|
||||
|
||||
public static function startBuddyListBtnGlow() : void
|
||||
{
|
||||
if(_buddyListBtn)
|
||||
{
|
||||
_buddyListBtn.glow.visible = true;
|
||||
}
|
||||
AJAudio.playBuddyOnlineOfflineSound();
|
||||
if(_glowTimer.running)
|
||||
{
|
||||
_glowTimer.stop();
|
||||
}
|
||||
_glowTimer.start();
|
||||
}
|
||||
|
||||
private static function glowTimerHandler(param1:TimerEvent) : void
|
||||
{
|
||||
_glowTimer.stop();
|
||||
if(_buddyListBtn)
|
||||
{
|
||||
_buddyListBtn.glow.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static function onSearchBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_playerSearch = new PlayerSearch();
|
||||
_playerSearch.init();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
GuiManager.toolTip.resetTimerAndSetVisibility();
|
||||
}
|
||||
|
||||
private static function onSearchBtnOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
GuiManager.toolTip.init(GuiManager.guiLayer,LocalizationManager.translateIdOnly(14638),180,305);
|
||||
GuiManager.toolTip.startTimer(param1);
|
||||
}
|
||||
|
||||
private static function onSearchBtnOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
GuiManager.toolTip.resetTimerAndSetVisibility();
|
||||
}
|
||||
|
||||
private static function addListeners() : void
|
||||
{
|
||||
_glowTimer.addEventListener("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,578 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarInfo;
|
||||
import avatar.UserInfo;
|
||||
import buddy.Buddy;
|
||||
import buddy.BuddyEvent;
|
||||
import buddy.BuddyTimer;
|
||||
import buddy.BuddyXtCommManager;
|
||||
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 = 100;
|
||||
|
||||
public static const WARNING_BUDDY_COUNT:int = 95;
|
||||
|
||||
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;
|
||||
|
||||
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();
|
||||
BuddyCard.init(_popupLayer);
|
||||
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 _loc4_:Buddy in _buddyList)
|
||||
{
|
||||
_loc4_ = null;
|
||||
}
|
||||
for each(var _loc2_:Object in _blockedList)
|
||||
{
|
||||
_loc2_ = null;
|
||||
}
|
||||
for each(var _loc5_:Object in _buddyRequestList)
|
||||
{
|
||||
_loc5_ = null;
|
||||
}
|
||||
for each(var _loc3_:Object in _buddyRequestPopups)
|
||||
{
|
||||
_loc3_ = null;
|
||||
}
|
||||
for each(var _loc1_:Object in _confirmBuddyRequestPopups)
|
||||
{
|
||||
_loc1_ = null;
|
||||
}
|
||||
_eventDispatcher = null;
|
||||
_buddyList = null;
|
||||
_blockedList = null;
|
||||
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 _loc2_:int = 0;
|
||||
for(var _loc1_:Object in _buddyList)
|
||||
{
|
||||
_loc2_++;
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
public static function addRemoveBuddy(param1:String, param2:String, param3:Boolean) : void
|
||||
{
|
||||
var _loc4_:String = null;
|
||||
var _loc6_:* = null;
|
||||
var _loc5_:Object = null;
|
||||
if(param3)
|
||||
{
|
||||
_loc4_ = param1.toLowerCase();
|
||||
if(buddyCount < 100)
|
||||
{
|
||||
_loc5_ = _buddyRequestList[_loc4_];
|
||||
if(_loc5_ == null || _loc5_.expires < new Date().getTime())
|
||||
{
|
||||
BuddyXtCommManager.sendBuddyAddRequest(param1);
|
||||
_buddyRequestList[_loc4_] = {
|
||||
"userName":param1,
|
||||
"expires":new Date().getTime() + 30000,
|
||||
"isAccepting":true
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_buddyRequestList[_loc4_] != null)
|
||||
{
|
||||
if(!_buddyRequestList[_loc4_].isAccepting)
|
||||
{
|
||||
_buddyRequestPopups[_loc4_] = new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14706,param2));
|
||||
return;
|
||||
}
|
||||
}
|
||||
_buddyRequestPopups[_loc4_] = new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14707,param2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(_popupLayer,LocalizationManager.translateIdOnly(14708));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BuddyXtCommManager.sendBuddyDeleteRequest(param1);
|
||||
delete PlayerWallManager.tokenMap[param1.toLowerCase()];
|
||||
}
|
||||
}
|
||||
|
||||
private static function buddyAddRequestCallback(param1:Object) : void
|
||||
{
|
||||
var _loc3_:Timer = _confirmBuddyRequestPopups[param1.passback.toLowerCase()].timer;
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc3_.reset();
|
||||
_loc3_ = null;
|
||||
}
|
||||
var _loc2_:BuddyRequest = _confirmBuddyRequestPopups[param1.passback.toLowerCase()].popup;
|
||||
if(_loc2_)
|
||||
{
|
||||
_loc2_.destroy();
|
||||
_loc2_ = null;
|
||||
}
|
||||
delete _confirmBuddyRequestPopups[param1.passback.toLowerCase()];
|
||||
if(buddyCount < 100)
|
||||
{
|
||||
BuddyXtCommManager.sendBuddyConfirmRequest(param1.passback,param1.status);
|
||||
}
|
||||
else
|
||||
{
|
||||
new SBOkPopup(_popupLayer,LocalizationManager.translateIdOnly(14708));
|
||||
}
|
||||
}
|
||||
|
||||
public static function buddyListResponseHandler(param1:Object) : void
|
||||
{
|
||||
var _loc12_:int = 0;
|
||||
var _loc19_:Buddy = null;
|
||||
var _loc16_:String = null;
|
||||
var _loc18_:String = null;
|
||||
var _loc3_:int = 0;
|
||||
var _loc20_:String = null;
|
||||
var _loc15_:int = 0;
|
||||
var _loc21_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc14_:UserInfo = null;
|
||||
var _loc10_:AvatarInfo = null;
|
||||
var _loc8_:Buddy = null;
|
||||
var _loc23_:String = null;
|
||||
var _loc17_:String = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc22_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
_buddyList = new Dictionary(true);
|
||||
var _loc13_:int = 3;
|
||||
var _loc6_:int = int(param1[_loc13_++]);
|
||||
_loc12_ = 0;
|
||||
while(_loc12_ < _loc6_)
|
||||
{
|
||||
_loc19_ = new Buddy();
|
||||
_loc16_ = param1[_loc13_++];
|
||||
_loc18_ = param1[_loc13_++];
|
||||
_loc3_ = int(param1[_loc13_++]);
|
||||
_loc20_ = param1[_loc13_++];
|
||||
_loc15_ = int(param1[_loc13_++]);
|
||||
_loc21_ = int(param1[_loc13_++]);
|
||||
_loc7_ = int(param1[_loc13_++]);
|
||||
_loc19_.init(_loc16_,_loc18_,_loc3_,1,_loc21_,0,_loc7_);
|
||||
_buddyList[_loc16_.toLowerCase()] = _loc19_;
|
||||
_loc14_ = gMainFrame.userInfo.getUserInfoByUserName(_loc16_);
|
||||
if(!_loc14_)
|
||||
{
|
||||
if(_loc15_ > -1)
|
||||
{
|
||||
_loc10_ = new AvatarInfo();
|
||||
_loc10_.init(_loc15_,_loc20_,_loc16_,_loc18_);
|
||||
_loc14_ = new UserInfo();
|
||||
_loc14_.init(_loc16_,_loc18_,null,_loc15_,_loc21_,_loc3_,_loc7_);
|
||||
_loc14_.addAvatarToList(_loc10_);
|
||||
gMainFrame.userInfo.setUserInfoByUserName(_loc16_,_loc14_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_loc15_ > -1 && !_loc14_.getAvatarInfoByPerUserAvId(_loc15_))
|
||||
{
|
||||
_loc10_ = new AvatarInfo();
|
||||
_loc10_.init(_loc15_,_loc20_,_loc16_,_loc18_);
|
||||
_loc14_.addAvatarToList(_loc10_);
|
||||
}
|
||||
_loc14_.uuid = _loc18_;
|
||||
_loc14_.userNameModeratedFlag = _loc3_;
|
||||
_loc14_.accountType = _loc21_;
|
||||
_loc14_.timeLeftHostingCustomParty = _loc7_;
|
||||
if(_loc15_ > -1)
|
||||
{
|
||||
_loc14_.currPerUserAvId = _loc15_;
|
||||
}
|
||||
}
|
||||
_loc12_++;
|
||||
}
|
||||
var _loc11_:int = int(param1[_loc13_++]);
|
||||
_loc12_ = 0;
|
||||
while(_loc12_ < _loc11_)
|
||||
{
|
||||
_loc8_ = new Buddy();
|
||||
_loc23_ = param1[_loc13_++];
|
||||
_loc17_ = param1[_loc13_++];
|
||||
_loc5_ = int(param1[_loc13_++]);
|
||||
_loc2_ = int(param1[_loc13_++]);
|
||||
_loc22_ = int(param1[_loc13_++]);
|
||||
_loc9_ = _loc2_ > -1 ? 0 : -1;
|
||||
if(_loc9_ == -1)
|
||||
{
|
||||
_loc5_ = 1;
|
||||
}
|
||||
_loc8_.init(_loc23_,_loc17_,_loc5_,_loc9_,_loc22_,_loc2_,-1);
|
||||
_buddyList[_loc23_.toLowerCase()] = _loc8_;
|
||||
_loc12_++;
|
||||
}
|
||||
BuddyList.listRequested = true;
|
||||
var _loc4_:BuddyEvent = new BuddyEvent("OnBuddyList");
|
||||
_eventDispatcher.dispatchEvent(_loc4_);
|
||||
}
|
||||
|
||||
public static function blockedListResponseHandler(param1:Object) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:int = 3;
|
||||
var _loc2_:int = int(param1[_loc4_++]);
|
||||
_blockedList = new Dictionary(true);
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc2_)
|
||||
{
|
||||
_blockedList[param1[_loc4_++].toLowerCase()] = "1";
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
public static function buddyAddRequestResponseHandler(param1:int, param2:String, param3:int) : void
|
||||
{
|
||||
var _loc5_:AvatarInfo = null;
|
||||
var _loc6_:BuddyTimer = null;
|
||||
var _loc4_:String = param3 > 0 ? param2 : LocalizationManager.translateIdOnly(11098);
|
||||
if(param1 == 0)
|
||||
{
|
||||
if(!_buddyList[param2.toLowerCase()])
|
||||
{
|
||||
_loc5_ = gMainFrame.userInfo.getAvatarInfoByUserName(param2);
|
||||
_loc6_ = new BuddyTimer(30000);
|
||||
_loc6_.userName = param2.toLowerCase();
|
||||
_loc6_.addEventListener("timer",confirmPopupTimerHandler,false,0,true);
|
||||
_confirmBuddyRequestPopups[param2.toLowerCase()] = {
|
||||
"popup":new BuddyRequest(param2,buddyAddRequestCallback,1),
|
||||
"timer":_loc6_
|
||||
};
|
||||
_loc6_.start();
|
||||
}
|
||||
}
|
||||
else if(param1 == 1)
|
||||
{
|
||||
_buddyRequestPopups[param2.toLowerCase()] = new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14707,_loc4_));
|
||||
}
|
||||
else if(param1 == 2)
|
||||
{
|
||||
new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14710,_loc4_));
|
||||
}
|
||||
else if(param1 == 3)
|
||||
{
|
||||
if(_buddyRequestList[param2.toLowerCase()] != null)
|
||||
{
|
||||
_buddyRequestList[param2.toLowerCase()].isAccepting = false;
|
||||
}
|
||||
new SBOkPopup(_popupLayer,LocalizationManager.translateIdAndInsertOnly(14706,_loc4_));
|
||||
}
|
||||
else if(param1 == 4)
|
||||
{
|
||||
new SBOkPopup(_popupLayer,LocalizationManager.translateIdOnly(14708));
|
||||
}
|
||||
}
|
||||
|
||||
public static function buddyStatusResponseHandler(param1:String, param2:String, param3:int, param4:Boolean, param5:int, param6:int, param7:String = null, param8:String = null, param9:int = -1, param10:int = -1) : void
|
||||
{
|
||||
var _loc12_:AvatarInfo = null;
|
||||
var _loc13_:String = null;
|
||||
var _loc14_:String = param1.toLowerCase();
|
||||
var _loc16_:Buddy = _buddyList[_loc14_];
|
||||
var _loc15_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(param1);
|
||||
if(!_loc15_)
|
||||
{
|
||||
_loc15_ = new UserInfo();
|
||||
_loc15_.init(param1,param2);
|
||||
_loc15_.userNameModeratedFlag = param3;
|
||||
_loc15_.timeLeftHostingCustomParty = param10;
|
||||
gMainFrame.userInfo.setUserInfoByUserName(param1,_loc15_);
|
||||
}
|
||||
_loc15_.accountType = param5;
|
||||
if(param8)
|
||||
{
|
||||
_loc12_ = _loc15_.getAvatarInfoByPerUserAvId(param9);
|
||||
if(param9 > 0)
|
||||
{
|
||||
if(!_loc12_)
|
||||
{
|
||||
_loc12_ = new AvatarInfo();
|
||||
_loc12_.init(param9,param8,param1,param2);
|
||||
_loc15_.addAvatarToList(_loc12_);
|
||||
}
|
||||
_loc15_.currPerUserAvId = param9;
|
||||
}
|
||||
}
|
||||
if(param6 != 3 && param6 != 4)
|
||||
{
|
||||
if(_loc16_)
|
||||
{
|
||||
_loc16_.userName = param1;
|
||||
_loc16_.userNameModeratedFlag = param3;
|
||||
_loc16_.timeLeftHostingCustomParty = param10;
|
||||
if(_loc16_.isOnline && !param4)
|
||||
{
|
||||
_numOnlineBuddies = _numOnlineBuddies - 1;
|
||||
_loc16_.numDaysSinceLastLogin = 0;
|
||||
}
|
||||
else if(!_loc16_.isOnline && param4)
|
||||
{
|
||||
if(Utility.canBuddy())
|
||||
{
|
||||
BuddyList.startBuddyListBtnGlow();
|
||||
}
|
||||
_numOnlineBuddies = _numOnlineBuddies + 1;
|
||||
}
|
||||
_loc16_.onlineStatus = param4 ? 1 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc16_ = new Buddy();
|
||||
_loc16_.init(param1,param2,param3,param4 ? 1 : 0,param5,0,param10);
|
||||
_buddyList[_loc14_] = _loc16_;
|
||||
if(param6 == 1)
|
||||
{
|
||||
if(_buddyRequestPopups[_loc14_] != null)
|
||||
{
|
||||
_buddyRequestPopups[_loc14_].destroy();
|
||||
delete _buddyRequestPopups[_loc14_];
|
||||
}
|
||||
SBPopupManager.nonSBPopups.push(new BuddyRequest(param1,null,2));
|
||||
}
|
||||
else if(param6 == 2)
|
||||
{
|
||||
SBPopupManager.nonSBPopups.push(new BuddyRequest(param1,null,2));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_loc16_)
|
||||
{
|
||||
_loc16_.userName = param7;
|
||||
_loc16_.userNameModeratedFlag = param3;
|
||||
_loc16_.timeLeftHostingCustomParty = param10;
|
||||
if(_loc16_.isOnline && !param4)
|
||||
{
|
||||
_numOnlineBuddies = _numOnlineBuddies - 1;
|
||||
}
|
||||
else if(!_loc16_.isOnline && param4)
|
||||
{
|
||||
BuddyList.startBuddyListBtnGlow();
|
||||
_numOnlineBuddies = _numOnlineBuddies + 1;
|
||||
}
|
||||
_loc16_.onlineStatus = param4 ? 1 : 0;
|
||||
delete _buddyList[_loc14_];
|
||||
_buddyList[param7.toLowerCase()] = _loc16_;
|
||||
BuddyCard.userNameChange(param1,param7,_loc16_.userNameModerated);
|
||||
gMainFrame.userInfo.changeUserName(param1,param7,param3);
|
||||
param1 = param7;
|
||||
}
|
||||
if(isBlocked(_loc14_))
|
||||
{
|
||||
_loc13_ = param3 > 0 ? param7 : LocalizationManager.translateIdOnly(11098);
|
||||
BuddyCard.userNameChange(param1,param7,_loc13_);
|
||||
gMainFrame.userInfo.changeUserName(param1,param7,param3);
|
||||
param1 = param7;
|
||||
delete _blockedList[_loc14_];
|
||||
_blockedList[param7.toLowerCase()] = "1";
|
||||
}
|
||||
}
|
||||
var _loc11_:BuddyEvent = new BuddyEvent("OnBuddyChanged");
|
||||
_loc11_.userName = param1;
|
||||
_eventDispatcher.dispatchEvent(_loc11_);
|
||||
}
|
||||
|
||||
public static function buddyDeleteResponseHandler(param1:String) : void
|
||||
{
|
||||
var _loc2_:BuddyEvent = null;
|
||||
var _loc3_:String = param1.toLowerCase();
|
||||
if(_buddyList[_loc3_])
|
||||
{
|
||||
delete _buddyList[_loc3_];
|
||||
delete _buddyRequestList[_loc3_];
|
||||
_loc2_ = new BuddyEvent("OnBuddyChanged");
|
||||
_loc2_.userName = param1;
|
||||
_eventDispatcher.dispatchEvent(_loc2_);
|
||||
}
|
||||
}
|
||||
|
||||
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 _loc2_:String = null;
|
||||
for each(var _loc3_:Object in _buddyRequestList)
|
||||
{
|
||||
_loc2_ = _loc3_.userName.toLowerCase();
|
||||
if(_loc3_ == null || _loc3_.expires < new Date().getTime())
|
||||
{
|
||||
delete _buddyRequestList[_loc2_];
|
||||
if(_buddyRequestPopups[_loc2_] != null)
|
||||
{
|
||||
delete _buddyRequestPopups[_loc2_];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function confirmPopupTimerHandler(param1:TimerEvent) : void
|
||||
{
|
||||
var _loc3_:String = null;
|
||||
var _loc2_:Object = null;
|
||||
var _loc4_:BuddyTimer = BuddyTimer(param1.currentTarget);
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc3_ = _loc4_.userName;
|
||||
_loc4_.stop();
|
||||
_loc4_ = null;
|
||||
_loc2_ = _confirmBuddyRequestPopups[_loc3_];
|
||||
if(_loc2_ != null)
|
||||
{
|
||||
if(_loc2_.popup)
|
||||
{
|
||||
_loc2_.popup.destroy();
|
||||
_loc2_.popup = null;
|
||||
}
|
||||
delete _confirmBuddyRequestPopups[_loc3_];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.Avatar;
|
||||
import avatar.AvatarInfo;
|
||||
import avatar.AvatarManager;
|
||||
import avatar.AvatarUtility;
|
||||
import avatar.AvatarView;
|
||||
import avatar.AvatarXtCommManager;
|
||||
import avatar.UserInfo;
|
||||
import com.sbi.graphics.LayerAnim;
|
||||
import com.sbi.popup.SBPopupManager;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Point;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class BuddyRequest
|
||||
{
|
||||
|
||||
public static const ACCEPT_REJECT:int = 1;
|
||||
|
||||
public static const CONFIRMATION:int = 2;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _requestPopup:MovieClip;
|
||||
|
||||
private var _playerUserName:String;
|
||||
|
||||
private var _mainAvatarView:AvatarView;
|
||||
|
||||
private var _loadingSpiralAvatar:LoadingSpiral;
|
||||
|
||||
private var _mainAvatar:Avatar;
|
||||
|
||||
private var _requestCallback:Function;
|
||||
|
||||
private var _popupType:int;
|
||||
|
||||
public function BuddyRequest(param1:String, param2:Function, param3:int)
|
||||
{
|
||||
super();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_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);
|
||||
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_ >= 95)
|
||||
{
|
||||
LocalizationManager.translateIdAndInsert(_requestPopup.txt,18509,100 - _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 = BuddyCard.getAvOffsetByDefId(_mainAvatarView.avTypeId);
|
||||
_mainAvatarView.x = _loc3_.x;
|
||||
_mainAvatarView.y = _loc3_.y;
|
||||
if(_requestPopup)
|
||||
{
|
||||
_requestPopup.charBox.addChild(_mainAvatarView);
|
||||
}
|
||||
_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,914 @@
|
||||
package gui
|
||||
{
|
||||
import com.sbi.analytics.SBTracker;
|
||||
import com.sbi.client.KeepAlive;
|
||||
import com.sbi.corelib.audio.SBAudio;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import flash.display.MovieClip;
|
||||
import flash.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 = 201.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 _loc4_:int = 0;
|
||||
var _loc3_:MovieClip = null;
|
||||
var _loc2_:Number = NaN;
|
||||
if(param1)
|
||||
{
|
||||
_loc4_ = 0;
|
||||
while(true)
|
||||
{
|
||||
if(_loc4_ < _mediaHelpers.length)
|
||||
{
|
||||
if(_mediaHelpers[_loc4_] == param1.mediaHelper)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc4_++;
|
||||
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)
|
||||
{
|
||||
_loc3_ = _bulletinBoardPopup;
|
||||
_tutorialSpiral.destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = _whatsNewPopup;
|
||||
_whatsNewVideoLoadingSpiral.visible = false;
|
||||
}
|
||||
if(_loc3_)
|
||||
{
|
||||
_loc2_ = _loc3_.videoItemWindow.width / param1.width;
|
||||
param1.scaleX = _loc2_;
|
||||
param1.scaleY = _loc2_;
|
||||
_loc3_.videoItemWindow.addChild(param1);
|
||||
_loc3_.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(_loc4_,1);
|
||||
}
|
||||
}
|
||||
|
||||
private function displayText(param1:int) : void
|
||||
{
|
||||
if(_artGalleryPopup)
|
||||
{
|
||||
_artGalleryPopup.descTxt.text = _artObjects[param1].desc;
|
||||
_artGalleryPopup.descTxt.y = 201.35;
|
||||
if(_artGalleryPopup.descTxt.numLines == 1)
|
||||
{
|
||||
_artGalleryPopup.descTxt.y += 11;
|
||||
}
|
||||
_artGalleryPopup.titleTxt.text = _artObjects[param1].title;
|
||||
}
|
||||
}
|
||||
|
||||
private function onArtDataLoaded(param1:Object) : void
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc3_:String = null;
|
||||
var _loc2_:String = null;
|
||||
var _loc4_:String = null;
|
||||
if(param1 && _bulletinBoardPopup)
|
||||
{
|
||||
_loc3_ = param1.data.text;
|
||||
_loc5_ = _loc3_.indexOf("|");
|
||||
_loc2_ = _loc3_.substr(0,_loc5_);
|
||||
_loc4_ = _loc3_.substr(_loc5_ + 1,_loc3_.length);
|
||||
_loc4_ = LocalizationManager.translateAvatarName(_loc4_);
|
||||
_artObjects[param1.data.imageId] = {
|
||||
"img":null,
|
||||
"title":LocalizationManager.translateIdOnly(int(_loc2_)),
|
||||
"desc":_loc4_.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:Array, param3:Array, param4:Array, param5:Array, param6:Array, param7:Array) : void
|
||||
{
|
||||
_tutorialStreamId = param2[0];
|
||||
_introCloseId = 178;
|
||||
LocalizationManager.translateId(_bulletinBoardPopup.videoTitleTxt,param4[0]);
|
||||
_tutorialText = param4[0];
|
||||
_tutorialMediaId = param3[0];
|
||||
_tutorialSubtitleId = param7[0];
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(_tutorialMediaId,onMediaItemLoaded,true);
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
}
|
||||
|
||||
private function onArtGLReceived(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Array = null;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:Array = null;
|
||||
var _loc5_:int = 0;
|
||||
if(_bulletinBoardPopup)
|
||||
{
|
||||
_artMediaIds = param1.data.jammerCentralGallery;
|
||||
_loc2_ = param1.data.jammerCentralHowls.split(/\"\|/g);
|
||||
_loc3_ = 0;
|
||||
shuffle(_loc2_);
|
||||
_howlsTextArray = [];
|
||||
_loc5_ = 0;
|
||||
for(; _loc5_ < _loc2_.length; _loc5_++)
|
||||
{
|
||||
if(_howlsTextArray[_loc3_] == null)
|
||||
{
|
||||
_howlsTextArray[_loc3_] = new String();
|
||||
}
|
||||
else if(_howlsTextArray[_loc3_].length > 1700)
|
||||
{
|
||||
_loc5_--;
|
||||
_loc3_++;
|
||||
continue;
|
||||
}
|
||||
_loc4_ = _loc2_[_loc5_].split(":");
|
||||
_loc4_[0] = LocalizationManager.translateAvatarName(_loc4_[0]).toUpperCase();
|
||||
_loc2_[_loc5_] = _loc4_.join(":");
|
||||
_loc2_[_loc5_] = _loc2_[_loc5_].replace(/\n/g,"");
|
||||
_howlsTextArray[_loc3_] += _loc2_[_loc5_] + "\" - ";
|
||||
}
|
||||
_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:Array, param3:Array, param4:Array, param5:Array, param6:Array, param7:Array) : void
|
||||
{
|
||||
_whatsNewStreamId = param2[0];
|
||||
_whatsNewStreamText = param4[0];
|
||||
_whatsNewStreamThumbId = param3[0];
|
||||
_whatsNewStreamSubtitleId = param7[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 _loc4_:int = 0;
|
||||
var _loc2_:String = null;
|
||||
var _loc3_:int = 0;
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < param1.length)
|
||||
{
|
||||
_loc2_ = param1[_loc4_];
|
||||
_loc3_ = Math.floor(Math.random() * param1.length);
|
||||
param1[_loc4_] = param1[_loc3_];
|
||||
param1[_loc3_] = _loc2_;
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
param1.stopPropagation();
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
if(_bulletinBoardPopup && param1.currentTarget == _bulletinBoardPopup.playMovBtn)
|
||||
{
|
||||
GuiManager.initMoviePlayer(39,[_tutorialStreamId],[_tutorialText],[_tutorialSubtitleId],false,768,432);
|
||||
GuiManager.setVideoPlayerSkin(5);
|
||||
}
|
||||
else if(_whatsNewPopup && param1.currentTarget == _whatsNewPopup.playMovBtn)
|
||||
{
|
||||
GuiManager.initMoviePlayer(39,[_whatsNewStreamId],[_whatsNewStreamText],[_whatsNewStreamSubtitleId],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 _loc2_:int = 0;
|
||||
var _loc3_: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);
|
||||
}
|
||||
_loc2_ = int(_artMediaIds[_artPageNum]);
|
||||
_loc3_ = _artObjects[_loc2_];
|
||||
if(_loc3_ && _loc3_.img != null)
|
||||
{
|
||||
while(_artGalleryPopup.itemWindow.numChildren > 1)
|
||||
{
|
||||
_artGalleryPopup.itemWindow.removeChildAt(1);
|
||||
}
|
||||
_artGalleryPopup.itemWindow.addChild(_loc3_.img);
|
||||
displayText(_loc2_);
|
||||
}
|
||||
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,451 @@
|
||||
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;
|
||||
|
||||
public var msgTxt:Object;
|
||||
|
||||
public var balloonBG:MovieClip;
|
||||
|
||||
private var btnBallonBG:MovieClip;
|
||||
|
||||
private var btnBalloonMouseBG:MovieClip;
|
||||
|
||||
private var btnBalloonUpBG:MovieClip;
|
||||
|
||||
private var btnBalloonDownBg:MovieClip;
|
||||
|
||||
private var btnBalloonGrayBG:MovieClip;
|
||||
|
||||
private var _onCustomAdventureBtn:Function;
|
||||
|
||||
private var _onCustomPVPBtn:Function;
|
||||
|
||||
private var _emoteBGOffsetFunc:Function;
|
||||
|
||||
public function ChatBalloon()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:int, param2:Function, param3:Boolean = false, param4:int = 1, param5:Class = null, param6:Function = null, param7:Function = null) : void
|
||||
{
|
||||
_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;
|
||||
if(!_hasSbTextfield)
|
||||
{
|
||||
if(param3)
|
||||
{
|
||||
balloonBG.m.height = 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 - msgTxt.height - (msgTxt.height - balloonBG.m.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
balloonBG.m.height = msgTxt.height;
|
||||
balloonBG.b.y = Math.round(balloonBG.m.y + balloonBG.m.height);
|
||||
msgTxt.y = balloonBG.t.height + (balloonBG.m.height * 0.5 - msgTxt.height * 0.5) + 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 _loc8_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc6_:Array = param2.split("|");
|
||||
if(param5)
|
||||
{
|
||||
param2 = _loc6_[0];
|
||||
_loc8_ = int(_loc6_[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
param2 = _loc6_[0];
|
||||
_loc7_ = int(_loc6_[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 = _loc8_;
|
||||
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 = Math.floor(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 - msgTxt.height - (msgTxt.height - balloonBG.m.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 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 = Math.floor(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 - msgTxt.height - (msgTxt.height - balloonBG.m.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 = Math.floor(msgTxt.height);
|
||||
balloonBG.m.y = Math.floor(balloonBG.b.y - balloonBG.m.height);
|
||||
balloonBG.t.y = Math.floor(balloonBG.m.y - balloonBG.t.height);
|
||||
var _loc1_:Number = Number(msgTxt.y);
|
||||
msgTxt.y = -balloonBG.b.height - msgTxt.height - (msgTxt.height - balloonBG.m.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 _loc4_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc1_:Rectangle = null;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _colorIndexes.length)
|
||||
{
|
||||
_loc4_ = _loc3_ % _numCols * (_width / _numCols);
|
||||
_loc2_ = Math.floor(_loc3_ / _numCols) * (_height / _numRows);
|
||||
_loc1_ = new Rectangle(_loc4_,_loc2_,_width / _numCols,_height / _numRows);
|
||||
_bmd.fillRect(_loc1_,_colorValues[_colorIndexes[_loc3_]]);
|
||||
_loc3_++;
|
||||
}
|
||||
_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 _loc2_:int = 0;
|
||||
var _loc3_:Point = new Point(param1.localX,param1.localY);
|
||||
var _loc4_:int = -1;
|
||||
if(_loc3_.x == _width)
|
||||
{
|
||||
if(_secretColorIdx == -1)
|
||||
{
|
||||
_loc3_.x = _width - 1;
|
||||
}
|
||||
else if(_loc3_.y < _cellHeight * (_numRows - 1))
|
||||
{
|
||||
_loc3_.x = _width - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ = _secretColorIdx;
|
||||
}
|
||||
}
|
||||
if(_loc4_ < 0)
|
||||
{
|
||||
_loc2_ = Math.floor(_loc3_.x / _cellWidth) + Math.floor(_loc3_.y / _cellHeight) * _numCols;
|
||||
_loc4_ = int(_colorIndexes[_loc2_]);
|
||||
}
|
||||
if(_currColor != _loc4_)
|
||||
{
|
||||
_currColor = _loc4_;
|
||||
setCurrentColorSwatch(_loc4_);
|
||||
if(_colorChangeCallback != null)
|
||||
{
|
||||
_colorChangeCallback(_id,_loc4_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 _loc2_:Rectangle = new Rectangle(0,0,19,24);
|
||||
var _loc3_:BitmapData = new BitmapData(19,24,true,0);
|
||||
_loc3_.draw(param1);
|
||||
return _loc3_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,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 _loc1_:MovieClip = null;
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:Number = Number(gMainFrame.userInfo.userVarCache.getUserVarValueById(373));
|
||||
_loc3_ = 1;
|
||||
while(_loc3_ <= 31)
|
||||
{
|
||||
_loc1_ = _giftingPopupContent["gift" + _loc3_];
|
||||
if(_loc3_ < _giftIndex + 1)
|
||||
{
|
||||
if(_loc2_ != -1 && (_loc2_ & 1 << _loc3_ - 1) > 0)
|
||||
{
|
||||
_loc1_.gotoAndStop("opened");
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc1_.gotoAndStop("missed");
|
||||
_loc1_.missedGift.diamond.visible = _additionalDiamond[_loc3_ - 1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_loc3_ > _giftIndex + 1)
|
||||
{
|
||||
_loc1_.gotoAndStop("unopened");
|
||||
_loc1_.unopenedGift.highlight.visible = false;
|
||||
_loc1_.unopenedGift.openTag.visible = false;
|
||||
_loc1_.unopenedGift.currIndex = _loc3_;
|
||||
_loc1_.unopenedGift.shine.visible = false;
|
||||
_loc1_.unopenedGift.gift.addEventListener("mouseDown",onFutureGiftDown,false,0,true);
|
||||
_loc1_.unopenedGift.diamond.addEventListener("mouseDown",onFutureGiftDown,false,0,true);
|
||||
}
|
||||
else if(_loc3_ == _giftIndex + 1)
|
||||
{
|
||||
_loc1_.gotoAndStop("unopened");
|
||||
_loc1_.unopenedGift.openTag.visible = true;
|
||||
_loc1_.unopenedGift.highlight.visible = false;
|
||||
_loc1_.unopenedGift.highlight.mouseChildren = false;
|
||||
_loc1_.unopenedGift.highlight.mouseEnabled = false;
|
||||
_loc1_.unopenedGift.shine.mouseChildren = false;
|
||||
_loc1_.unopenedGift.shine.mouseEnabled = false;
|
||||
_loc1_.unopenedGift.gift.addEventListener("mouseDown",onGiftDown,false,0,true);
|
||||
_loc1_.unopenedGift.gift.addEventListener("rollOver",onGiftOver,false,0,true);
|
||||
_loc1_.unopenedGift.gift.addEventListener("rollOut",onGiftOut,false,0,true);
|
||||
_loc1_.unopenedGift.diamond.addEventListener("mouseDown",onGiftDown,false,0,true);
|
||||
}
|
||||
if(!gMainFrame.userInfo.isMember)
|
||||
{
|
||||
_loc1_.unopenedGift.diamond.gotoAndStop("nonMember");
|
||||
}
|
||||
_loc1_.unopenedGift.diamond.visible = _additionalDiamond[_loc3_ - 1];
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
|
||||
public function setupGiftPopup() : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
var _loc5_:Object = null;
|
||||
var _loc4_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
var _loc7_:int = 1;
|
||||
var _loc1_:int = 2;
|
||||
var _loc8_:int = 3;
|
||||
var _loc11_:Array = new Array(_loc7_,_loc7_,_loc9_,_loc7_,_loc9_,_loc9_,_loc7_,_loc7_,_loc9_,_loc7_,_loc7_,_loc9_,_loc7_,_loc9_,_loc7_,_loc7_,_loc9_,_loc7_,_loc7_,_loc7_,_loc9_,_loc9_,_loc9_,_loc9_,_loc9_,_loc7_,_loc7_,_loc7_,_loc9_,_loc7_,_loc7_);
|
||||
var _loc6_: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 _loc10_:int = 0;
|
||||
var _loc2_:int = int(gMainFrame.clientInfo.dailyGiftIndex);
|
||||
if(_loc2_ <= _loc11_.length)
|
||||
{
|
||||
if(_loc11_[_giftIndex] == _loc9_)
|
||||
{
|
||||
_loc5_ = ItemXtCommManager.getItemDef(_loc6_[_loc2_]);
|
||||
_randColorIndex = (_loc5_.colors.length - 1) * Math.random();
|
||||
_loc3_ = new Item();
|
||||
_loc3_.init(_loc5_.defId,0,_loc5_.colors[_randColorIndex],0,0,true);
|
||||
_loc4_ = 1;
|
||||
}
|
||||
else if(_loc11_[_giftIndex] == _loc7_)
|
||||
{
|
||||
_loc5_ = DenXtCommManager.getDenItemDef(_loc6_[_loc2_]);
|
||||
_loc3_ = new DenItem();
|
||||
_loc3_.initShopItem(_loc5_.id,0);
|
||||
_loc4_ = 2;
|
||||
}
|
||||
else if(_loc11_[_giftIndex] == _loc1_)
|
||||
{
|
||||
_loc4_ = 0;
|
||||
}
|
||||
else if(_loc11_[_giftIndex] == _loc8_)
|
||||
{
|
||||
_loc4_ = 8;
|
||||
}
|
||||
if(_additionalDiamond[_giftIndex])
|
||||
{
|
||||
_diamondAmount = 1;
|
||||
_giftingPopupMediaHelper = new MediaHelper();
|
||||
_giftingPopupMediaHelper.init(2221,onDiamondIconLoaded);
|
||||
_giftDataToStillBeDisplayed = {
|
||||
"currItem":_loc3_,
|
||||
"defIdOrAmount":_loc6_[_loc2_],
|
||||
"giftType":_loc4_
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
checkAndInitializeGiftPopup(_loc4_,_loc3_,_loc6_[_loc2_]);
|
||||
}
|
||||
}
|
||||
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 _loc1_:MovieClip = null;
|
||||
var _loc2_:int = 0;
|
||||
_giftingPopupContent.bx.removeEventListener("mouseDown",onClose);
|
||||
_giftingPopupContent.removeEventListener("mouseDown",onPopupDown);
|
||||
_loc2_ = _giftIndex + 1;
|
||||
while(_loc2_ <= 25)
|
||||
{
|
||||
_loc1_ = _giftingPopupContent["gift" + _loc2_];
|
||||
_loc1_.unopenedGift.gift.removeEventListener("mouseDown",onGiftDown);
|
||||
_loc1_.unopenedGift.gift.removeEventListener("rollOver",onGiftOver);
|
||||
_loc1_.unopenedGift.gift.removeEventListener("rollOut",onGiftOut);
|
||||
_loc1_.unopenedGift.gift.removeEventListener("mouseDown",onFutureGiftDown);
|
||||
_loc1_.unopenedGift.diamond.removeEventListener("mouseDown",onFutureGiftDown);
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,259 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.Sprite;
|
||||
import flash.events.Event;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public class DarkenManager
|
||||
{
|
||||
|
||||
private static var _darken:Vector.<DisplayObjectContainer>;
|
||||
|
||||
private static var _stageDarkBG:Sprite;
|
||||
|
||||
private static var _darkBG:Sprite;
|
||||
|
||||
private static var _stageBlockBG:Sprite;
|
||||
|
||||
private static var _layer:DisplayLayer;
|
||||
|
||||
private static var _spiral:LoadingSpiral;
|
||||
|
||||
public static var setFocus:Function;
|
||||
|
||||
public function DarkenManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init(param1:DisplayLayer) : void
|
||||
{
|
||||
_darken = new Vector.<DisplayObjectContainer>();
|
||||
_darkBG = new Sprite();
|
||||
_stageBlockBG = new Sprite();
|
||||
_stageDarkBG = new Sprite();
|
||||
addListeners();
|
||||
makeDarkShape();
|
||||
makeStageDarkBG();
|
||||
makeLightStageBlock();
|
||||
gMainFrame.stage.addEventListener("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();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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) : void
|
||||
{
|
||||
param1.addChildAt(_darkBG,0);
|
||||
var _loc2_:DisplayObjectContainer = param1;
|
||||
while(_loc2_ != null && _loc2_.parent != _layer)
|
||||
{
|
||||
if(_loc2_.parent == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc2_ = _loc2_.parent;
|
||||
}
|
||||
_darkBG.x = -_loc2_.x;
|
||||
_darkBG.y = -_loc2_.y;
|
||||
if(setFocus != null)
|
||||
{
|
||||
setFocus(false);
|
||||
}
|
||||
if(_darken.indexOf(param1) < 0)
|
||||
{
|
||||
_darken.push(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function unDarken(param1:DisplayObjectContainer) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:DisplayObjectContainer = null;
|
||||
var _loc4_:DisplayObjectContainer = null;
|
||||
if(param1)
|
||||
{
|
||||
_loc2_ = _darken.indexOf(param1);
|
||||
if(_loc2_ >= 0)
|
||||
{
|
||||
if(param1.parent == _darkBG)
|
||||
{
|
||||
param1.removeChild(_darkBG);
|
||||
}
|
||||
_darken.splice(_loc2_,1);
|
||||
if(_darken.length > 0)
|
||||
{
|
||||
_loc3_ = _darken[_darken.length - 1];
|
||||
_loc4_ = _loc3_;
|
||||
_loc3_.addChildAt(_darkBG,0);
|
||||
while(_loc4_ != null && _loc4_.parent != _layer)
|
||||
{
|
||||
if(_loc4_.parent == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
_loc4_ = _loc4_.parent;
|
||||
}
|
||||
_darkBG.x = -_loc4_.x;
|
||||
_darkBG.y = -_loc4_.y;
|
||||
}
|
||||
gMainFrame.stage.invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function get isDarkened() : Boolean
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc1_:Boolean = false;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _darken.length)
|
||||
{
|
||||
if(_darken[_loc2_].visible)
|
||||
{
|
||||
_loc1_ = true;
|
||||
break;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 _loc4_:Array = null;
|
||||
var _loc5_:Array = null;
|
||||
var _loc6_:* = 0;
|
||||
var _loc7_:* = 0;
|
||||
var _loc9_:Boolean = false;
|
||||
var _loc2_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("/game/play/popup/demotion/#page" + _gaIdx);
|
||||
var _loc3_:Boolean = AvatarSwitch.shouldChoose();
|
||||
_gaIdx = _gaIdx + 1;
|
||||
_idx = _idx + 1;
|
||||
if(!_hasChosen && !_loc3_ && _idx > 2)
|
||||
{
|
||||
_idx = _idx + 1;
|
||||
_loc4_ = AvatarSwitch.avatars;
|
||||
_loc5_ = [];
|
||||
_loc2_ = AvatarSwitch.numNonMemberAvatars;
|
||||
_loc8_ = 0;
|
||||
while(_loc8_ < _loc4_.length)
|
||||
{
|
||||
if(_loc4_[_loc8_])
|
||||
{
|
||||
if(!AvatarSwitch.isMemberOnlyAvatar(_loc8_))
|
||||
{
|
||||
_loc9_ = true;
|
||||
}
|
||||
}
|
||||
else if(_loc8_ >= _loc2_ - 1)
|
||||
{
|
||||
_loc9_ = true;
|
||||
}
|
||||
if(_loc9_)
|
||||
{
|
||||
_loc9_ = false;
|
||||
if(_loc5_[0] == null && _loc4_[_loc8_])
|
||||
{
|
||||
_loc5_[0] = _loc6_ = _loc8_;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_[1] = _loc7_ = _loc8_;
|
||||
}
|
||||
if(_loc5_[0] != null && _loc5_[1] != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
_loc8_++;
|
||||
}
|
||||
if(_loc5_[1] != null && _loc4_[_loc7_])
|
||||
{
|
||||
AvatarSwitch.adjustAvailSlotFlags(AvatarXtCommManager.avSlotInfo[_loc4_[_loc6_].perUserAvId].avInvId,true);
|
||||
AvatarSwitch.adjustAvailSlotFlags(AvatarXtCommManager.avSlotInfo[_loc4_[_loc7_].perUserAvId].avInvId,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
AvatarSwitch.adjustAvailSlotFlags(AvatarXtCommManager.avSlotInfo[_loc4_[_loc6_].perUserAvId].avInvId,true);
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_content.nextBtn.visible = false;
|
||||
AvatarSwitch.chooseTwo(_loc5_,onAvatarChooseCallback);
|
||||
return;
|
||||
}
|
||||
if(_idx == 3)
|
||||
{
|
||||
_content.renewBtn.visible = false;
|
||||
_content.nextBtn.visible = false;
|
||||
_content.chooseBtn.visible = true;
|
||||
}
|
||||
if(_idx == 4 && _loc3_)
|
||||
{
|
||||
_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,165 @@
|
||||
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;
|
||||
|
||||
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(_currentShop)
|
||||
{
|
||||
_currentShop.showShop(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_currentShop)
|
||||
{
|
||||
_currentShop.showShop(false);
|
||||
}
|
||||
GuiManager.showDenSwitcher(false);
|
||||
}
|
||||
}
|
||||
|
||||
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,188 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.UserInfo;
|
||||
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:Array;
|
||||
|
||||
private static var _addDenCallback:Function;
|
||||
|
||||
private static var _removeCallback:Function;
|
||||
|
||||
private static var _switchIdx:int;
|
||||
|
||||
private static var _switchDensCallback:Function;
|
||||
|
||||
private static var _removeIdx:int;
|
||||
|
||||
private static var _maxSlots:int;
|
||||
|
||||
private static var _numSlots:int;
|
||||
|
||||
public 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[_loc2_])
|
||||
{
|
||||
_loc1_++;
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
return _loc1_;
|
||||
}
|
||||
|
||||
public static function addNewDen(param1:int, param2:String, param3:Function) : void
|
||||
{
|
||||
_addDenCallback = param3;
|
||||
}
|
||||
|
||||
public static function addDenResponse(param1:Boolean, param2:int) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
}
|
||||
if(_addDenCallback != null)
|
||||
{
|
||||
_addDenCallback(param1);
|
||||
}
|
||||
}
|
||||
|
||||
public static function switchDens(param1:int, param2:Function = null) : void
|
||||
{
|
||||
if(param1 < 0 || param1 >= _denList.length)
|
||||
{
|
||||
throw new Error("Invalid switchIdx:" + param1);
|
||||
}
|
||||
_switchIdx = param1;
|
||||
_switchDensCallback = param2;
|
||||
activeDenIdx = _denList[_switchIdx].invId;
|
||||
DenXtCommManager.requestDenChange(param1,param2);
|
||||
}
|
||||
|
||||
public static function reTrySwitchDensAfterAddingAvatar() : void
|
||||
{
|
||||
DenXtCommManager.requestDenChange(_switchIdx,_switchDensCallback);
|
||||
}
|
||||
|
||||
public static function denListResponse(param1:Array) : void
|
||||
{
|
||||
_denList = param1;
|
||||
}
|
||||
|
||||
public static function removeDen(param1:int, param2:Function) : void
|
||||
{
|
||||
if(param1 < 0 || param1 >= _denList.length)
|
||||
{
|
||||
throw new Error("Invalid removeIdx:" + param1);
|
||||
}
|
||||
_removeCallback = param2;
|
||||
_removeIdx = param1;
|
||||
if(_denList[param1].invId != activeDenIdx && _denList[param1].invId > 0)
|
||||
{
|
||||
DenXtCommManager.requestRecycle(false,_denList[param1].invId,denRecycleResponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
denRecycleResponse(false);
|
||||
}
|
||||
}
|
||||
|
||||
public static function denRecycleResponse(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_denList[_removeIdx] = null;
|
||||
}
|
||||
if(_removeCallback != null)
|
||||
{
|
||||
_removeCallback(param1,_removeIdx);
|
||||
}
|
||||
_removeIdx = -1;
|
||||
}
|
||||
|
||||
public static function get denList() : Array
|
||||
{
|
||||
return _denList;
|
||||
}
|
||||
|
||||
public static function get nextFreeSlotIdx() : int
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < 28)
|
||||
{
|
||||
if(!_denList[_loc1_])
|
||||
{
|
||||
return _loc1_;
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static function haveOceanDen() : Boolean
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _denList.length)
|
||||
{
|
||||
if(_denList[_loc1_] && _denList[_loc1_].enviroType == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,661 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.Avatar;
|
||||
import com.sbi.client.KeepAlive;
|
||||
import com.sbi.popup.SBYesNoPopup;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import loader.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) : void
|
||||
{
|
||||
if(_switchContent && _switchContent.root.visible != param1)
|
||||
{
|
||||
_switchContent.root.visible = param1;
|
||||
if(param1)
|
||||
{
|
||||
DarkenManager.darken(MovieClip(_switchContent.root));
|
||||
}
|
||||
else
|
||||
{
|
||||
DarkenManager.unDarken(MovieClip(_switchContent.root));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 _loc7_:int = 0;
|
||||
var _loc2_:MovieClip = null;
|
||||
var _loc6_:MediaHelper = null;
|
||||
if(_scrollButtons)
|
||||
{
|
||||
_scrollButtons.destroy();
|
||||
_scrollButtons = null;
|
||||
}
|
||||
if(_itemWindows)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
var _loc1_:int = _numTotalSlots;
|
||||
var _loc3_:int = Math.min(_loc1_,4);
|
||||
var _loc4_:int = Math.ceil(_loc3_ / 2);
|
||||
_itemWindows = new WindowGenerator();
|
||||
_itemWindows.init(_loc3_,_loc4_,_loc1_,1,2,0,ItemWindowAnimal,DenSwitch.denList,"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;
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _numTotalSlots)
|
||||
{
|
||||
_loc2_ = MovieClip(_itemWindows.bg.getChildAt(_loc7_));
|
||||
_contentItems[_loc7_] = _loc2_;
|
||||
if(DenSwitch.denList[_loc7_] != null)
|
||||
{
|
||||
_loc6_ = new MediaHelper();
|
||||
_loc6_.init(DenSwitch.denList[_loc7_].mediaId,mediaHelperCallback,DenSwitch.denList[_loc7_].isMemberOnly);
|
||||
_views[_loc7_] = _loc6_;
|
||||
}
|
||||
else if(_firstOpenIdx == -1)
|
||||
{
|
||||
_firstOpenIdx = _loc7_;
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
if(_firstOpenIdx == -1)
|
||||
{
|
||||
_firstOpenIdx = 0;
|
||||
}
|
||||
var _loc5_:int = DenSwitch.numDens;
|
||||
if(_loc5_ > 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(_loc5_ >= _numTotalSlots && !_recyclingOnly)
|
||||
{
|
||||
_switchContent.denShopTag.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_switchContent.denShopTag.visible = false;
|
||||
}
|
||||
_scrollButtons = new SBScrollbar();
|
||||
_scrollButtons.init(_itemWindows,840,440,-6,"scrollbar2",224.6);
|
||||
}
|
||||
|
||||
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 _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;
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _numTotalSlots)
|
||||
{
|
||||
_contentItems[_loc4_].recycle.visible = false;
|
||||
_loc4_++;
|
||||
}
|
||||
_loc3_.resetWindow(param2);
|
||||
if(DenSwitch.numDens <= 1)
|
||||
{
|
||||
_switchContent.recycleBtn.gray.visible = true;
|
||||
_switchContent.recycleBtn.mouse.visible = false;
|
||||
_switchContent.recycleBtn.down.visible = false;
|
||||
}
|
||||
if(DenSwitch.numDens >= _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);
|
||||
}
|
||||
MovieClip(_itemWindows).bg.getChildAt(_idx).currItem = DenSwitch.denList[_idx];
|
||||
var _loc1_:MovieClip = _contentItems[_idx];
|
||||
_loc1_.buyDen.visible = false;
|
||||
_loc1_.den.visible = true;
|
||||
_loc1_.den.txt.text = DenSwitch.denList[_idx].name;
|
||||
_loc1_.den.sel.visible = false;
|
||||
var _loc2_:MediaHelper = new MediaHelper();
|
||||
_loc2_.init(DenSwitch.denList[_idx].mediaId,mediaHelperCallback,DenSwitch.denList[_idx].isMemberOnly);
|
||||
_views[_idx] = _loc2_;
|
||||
if(DenSwitch.numDens >= _numTotalSlots)
|
||||
{
|
||||
_switchContent.denShopTag.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_switchContent.denShopTag.visible = false;
|
||||
}
|
||||
if(DenSwitch.numDens > 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.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,1040,_playerAvatar,_guiLayer,closeDenShop,_idx,purchasedDenRoomCallback,_openStoreOnly,_storeItemIndex);
|
||||
}
|
||||
}
|
||||
else if(_contentItems[_idx].gray.visible == true && !_recycling)
|
||||
{
|
||||
if(!gMainFrame.userInfo.isMember)
|
||||
{
|
||||
UpsellManager.displayPopup(6,"useLockedDen/" + DenSwitch.denList[_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[_idx].recycleValue)),true,confirmRecycleHandler);
|
||||
}
|
||||
}
|
||||
else if(_contentItems[_idx].den.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.currentFrameLabel != "mouse")
|
||||
{
|
||||
_contentItems[_idx].den.gotoAndPlay("mouse");
|
||||
}
|
||||
AJAudio.playSubMenuBtnRollover();
|
||||
}
|
||||
|
||||
private function onItemWindowOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_idx = param1.currentTarget.index;
|
||||
if(_contentItems[_idx].den.currentFrameLabel != "out")
|
||||
{
|
||||
_contentItems[_idx].den.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 _loc3_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
param1.stopPropagation();
|
||||
if(!_recyclingOnly)
|
||||
{
|
||||
if(_recycling)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _numTotalSlots)
|
||||
{
|
||||
_contentItems[_loc3_].recycle.visible = false;
|
||||
_loc3_++;
|
||||
}
|
||||
_recycling = false;
|
||||
}
|
||||
else if(!_switchContent.recycleBtn.gray.visible)
|
||||
{
|
||||
_recycling = true;
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _numTotalSlots)
|
||||
{
|
||||
if(_views[_loc2_])
|
||||
{
|
||||
if(!_contentItems[_loc2_].buyDen.visible)
|
||||
{
|
||||
_contentItems[_loc2_].recycle.visible = true;
|
||||
}
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
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,196 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.system.ApplicationDomain;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class EBookChooser
|
||||
{
|
||||
|
||||
public static const LAND_TYPE:String = "land";
|
||||
|
||||
public static const OCEAN_TYPE:String = "ocean";
|
||||
|
||||
public static const AIR_TYPE:String = "air";
|
||||
|
||||
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 _itemWindowsTop:WindowGenerator;
|
||||
|
||||
private var _itemWindowsBottom:WindowGenerator;
|
||||
|
||||
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(_itemWindowsBottom)
|
||||
{
|
||||
_itemWindowsBottom.destroy();
|
||||
}
|
||||
if(_itemWindowsTop)
|
||||
{
|
||||
_itemWindowsTop.destroy();
|
||||
}
|
||||
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 _loc10_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
_currEBooks = [];
|
||||
_loc10_ = 0;
|
||||
while(_loc10_ < param2.length)
|
||||
{
|
||||
_currEBooks.push({
|
||||
"ebookId":param2[_loc10_],
|
||||
"mediaId":param3[_loc10_],
|
||||
"listId":param4[_loc10_]
|
||||
});
|
||||
_loc10_++;
|
||||
}
|
||||
if(_currEBooks.length > 0)
|
||||
{
|
||||
_loc7_ = 5;
|
||||
_loc9_ = 1;
|
||||
_loc8_ = Math.min(_loc7_,param2.length);
|
||||
_loc6_ = Math.min(_loc7_,param2.length - _loc8_);
|
||||
_itemWindowsTop = new WindowGenerator();
|
||||
_itemWindowsBottom = new WindowGenerator();
|
||||
_itemWindowsTop.init(_loc7_,_loc9_,_loc8_,12,2,0,ItemWindowBook,_currEBooks.slice(0,_loc7_),"",null,{"currLoaderAppDomain":_currLoaderAppDomain},null,false,false);
|
||||
_itemWindowsBottom.init(_loc7_,_loc9_,_loc6_,12,2,0,ItemWindowBook,_currEBooks.slice(_loc7_,_loc7_ * 2),"",null,{"currLoaderAppDomain":_currLoaderAppDomain},null,false,false);
|
||||
_popup.itemWindowTop.addChild(_itemWindowsTop);
|
||||
_popup.itemWindowBtm.addChild(_itemWindowsBottom);
|
||||
}
|
||||
}
|
||||
|
||||
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,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 _loc12_:* = 0;
|
||||
var _loc9_:Sprite = null;
|
||||
var _loc10_:int = param3 ? 0 : 7 * 2;
|
||||
var _loc8_:Number = param1 == 0 ? -55 : 15;
|
||||
var _loc7_:MovieClip = new MovieClip();
|
||||
var _loc11_:int = 0;
|
||||
_loc12_ = 0;
|
||||
for(; _loc12_ < displaySprites.length; _loc12_++)
|
||||
{
|
||||
if(param1 == 0 || displaySpritesNotAllowedInPlayerWall.indexOf(displaySprites[_loc12_]) == -1)
|
||||
{
|
||||
_loc9_ = GETDEFINITIONBYNAME(displaySprites[_loc12_]);
|
||||
if(param1 == 0 && _loc11_ < 7 * 2)
|
||||
{
|
||||
if(!param3)
|
||||
{
|
||||
_loc11_++;
|
||||
continue;
|
||||
}
|
||||
_loc9_.x = 11 + _loc11_ % 7 * 33 + -109;
|
||||
_loc9_.y = 14 + Math.floor(_loc11_ / 7) * 23 + -70;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc9_.x = 11 + _loc11_ % 7 * 33 + -109;
|
||||
_loc9_.y = 14 + Math.floor((_loc11_ - _loc10_) / 7) * 23 + _loc8_;
|
||||
if(!param3)
|
||||
{
|
||||
_loc9_.y += 35;
|
||||
}
|
||||
}
|
||||
_loc7_.addChild(_loc9_);
|
||||
_loc9_.addChild(GETDEFINITIONBYNAME("emo_place_holder"));
|
||||
_loc9_.buttonMode = true;
|
||||
_loc9_.useHandCursor = true;
|
||||
_loc9_.mouseChildren = false;
|
||||
_loc9_.tabEnabled = true;
|
||||
_loc9_.tabChildren = false;
|
||||
_loc9_.addEventListener("click",param4,false,0,true);
|
||||
_loc9_.addEventListener("rollOver",param5,false,0,true);
|
||||
_loc9_.addEventListener("rollOut",param5,false,0,true);
|
||||
_loc11_++;
|
||||
}
|
||||
}
|
||||
return _loc7_;
|
||||
}
|
||||
|
||||
public static function getEmoteString(param1:Sprite) : String
|
||||
{
|
||||
if(_emoteStrings[getQualifiedClassName(param1)])
|
||||
{
|
||||
return _emoteStrings[getQualifiedClassName(param1)][0];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function matchEmoteString(param1:String, param2:Boolean = false) : Object
|
||||
{
|
||||
var _loc3_:* = 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(2,"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(2,"useLockedEmote");
|
||||
}
|
||||
else
|
||||
{
|
||||
param2(GETDEFINITIONBYNAME(emoteSprites[_loc3_]));
|
||||
}
|
||||
}
|
||||
|
||||
public static function formatStringForSmiley(param1:String, param2:int, param3:Array, param4:Boolean) : Object
|
||||
{
|
||||
var _loc7_:* = null;
|
||||
var _loc20_:String = null;
|
||||
var _loc25_:Boolean = false;
|
||||
var _loc9_:Boolean = false;
|
||||
var _loc24_:String = null;
|
||||
var _loc17_:int = 0;
|
||||
var _loc21_:RegExp = null;
|
||||
var _loc22_:* = null;
|
||||
var _loc5_:String = null;
|
||||
var _loc23_:MovieClip = null;
|
||||
var _loc12_:String = null;
|
||||
var _loc15_:* = null;
|
||||
var _loc6_:String = null;
|
||||
var _loc8_:String = null;
|
||||
var _loc10_:int = 0;
|
||||
var _loc16_:Boolean = false;
|
||||
var _loc14_:Array = null;
|
||||
var _loc11_:Array = [];
|
||||
for each(_loc7_ in _emoteChatStrings)
|
||||
{
|
||||
for each(_loc20_ in _loc7_)
|
||||
{
|
||||
_loc21_ = new RegExp(escapeRegExp(_loc20_),"gm");
|
||||
_loc11_ = param1.split(_loc21_);
|
||||
if(param4)
|
||||
{
|
||||
param1 = _loc11_.join("|*|" + _loc20_);
|
||||
}
|
||||
else if(_loc11_.length > 1)
|
||||
{
|
||||
param1 = "";
|
||||
_loc17_ = 0;
|
||||
while(_loc17_ < _loc11_.length)
|
||||
{
|
||||
_loc24_ = _loc11_[_loc17_];
|
||||
if(_loc17_ == 0 && _loc24_ != " ")
|
||||
{
|
||||
param1 += _loc24_;
|
||||
}
|
||||
else if(!_loc25_)
|
||||
{
|
||||
if(_loc24_ != "" && _loc24_ != " ")
|
||||
{
|
||||
param1 += "|*|" + _loc20_ + _loc24_;
|
||||
}
|
||||
else
|
||||
{
|
||||
param1 += "|*|" + _loc20_;
|
||||
}
|
||||
_loc25_ = true;
|
||||
}
|
||||
else if(_loc24_ != "" && _loc24_ != " ")
|
||||
{
|
||||
param1 += _loc24_;
|
||||
}
|
||||
_loc17_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var _loc19_:Array = param1.split("|*|");
|
||||
if(_loc19_[0] == "")
|
||||
{
|
||||
_loc19_.shift();
|
||||
}
|
||||
var _loc13_:Boolean = _loc19_.length == 1;
|
||||
var _loc18_:String = "false";
|
||||
for(_loc20_ in _loc19_)
|
||||
{
|
||||
if(_loc20_ == "0" && _loc19_[_loc20_] == "")
|
||||
{
|
||||
_loc18_ = "true";
|
||||
}
|
||||
loop4:
|
||||
for(_loc5_ in _emoteChatStrings)
|
||||
{
|
||||
var _loc31_:int = 0;
|
||||
var _loc30_:* = _emoteChatStrings[_loc5_];
|
||||
loop5:
|
||||
do
|
||||
{
|
||||
for each(_loc22_ in _loc30_)
|
||||
{
|
||||
_loc6_ = _loc19_[_loc20_];
|
||||
if(!(_loc6_ == "" || _loc6_.charAt() == " "))
|
||||
{
|
||||
continue loop5;
|
||||
}
|
||||
continue loop4;
|
||||
}
|
||||
}
|
||||
while(_loc15_ = _loc22_, _loc10_ = int(_loc6_.indexOf(_loc15_)), if(_loc10_ != -1)
|
||||
{
|
||||
_loc8_ = "";
|
||||
_loc17_ = 0;
|
||||
while(_loc17_ < _loc22_.length)
|
||||
{
|
||||
_loc8_ += _loc6_.charAt(_loc10_ + _loc17_);
|
||||
_loc17_++;
|
||||
}
|
||||
}, _loc8_ != _loc15_);
|
||||
if(!(_loc5_.slice(3,5) == "MO" && !gMainFrame.userInfo.isMember))
|
||||
{
|
||||
_loc8_ = "";
|
||||
_loc23_ = GETDEFINITIONBYNAME(_loc5_ + "_sml");
|
||||
_loc23_.y = _loc23_.y - 3;
|
||||
if(_loc18_ == "false" && _loc19_[_loc20_].charAt(_loc19_[_loc20_].length - 1) != "")
|
||||
{
|
||||
_loc16_ = true;
|
||||
}
|
||||
if(_loc23_.width <= 20)
|
||||
{
|
||||
_loc12_ = " . ";
|
||||
}
|
||||
else if(_loc23_.width <= 22)
|
||||
{
|
||||
_loc12_ = " . ";
|
||||
}
|
||||
else if(_loc23_.width <= 25)
|
||||
{
|
||||
_loc12_ = " . ";
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc12_ = " . ";
|
||||
}
|
||||
_loc19_[_loc20_] = _loc12_ + (_loc16_ == true ? " " : "");
|
||||
param3.push({
|
||||
"strindex":param2,
|
||||
"emoticon":_loc23_,
|
||||
"added":false,
|
||||
"smileystart":_loc18_
|
||||
});
|
||||
}
|
||||
}
|
||||
_loc14_ = _loc19_[_loc20_].split("");
|
||||
param2 += _loc14_.length;
|
||||
}
|
||||
return {
|
||||
"str":_loc19_.join(""),
|
||||
"smileyArray":param3,
|
||||
"stringIndex":param2,
|
||||
"hasOnlyOne":_loc13_
|
||||
};
|
||||
}
|
||||
|
||||
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,557 @@
|
||||
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;
|
||||
|
||||
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 _loc5_:int = 0;
|
||||
var _loc4_:Object = null;
|
||||
var _loc3_:FeedbackDefHelper = null;
|
||||
_feedbackLocs = param2;
|
||||
_feedbackDefHelpers = [];
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < param1.length)
|
||||
{
|
||||
if(param1[_loc5_] == 0)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
throw new Error("Id == 0");
|
||||
}
|
||||
_loc4_ = _feedbackDefCache[param1[_loc5_]];
|
||||
if(!_loc4_)
|
||||
{
|
||||
_loc3_ = new FeedbackDefHelper();
|
||||
_loc3_.init(param1[_loc5_],onDefReceived);
|
||||
_feedbackDefHelpers[param1[_loc5_]] = _loc3_;
|
||||
}
|
||||
else
|
||||
{
|
||||
setUpOrb(_loc4_);
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
|
||||
public static function openFeedbackPopup(param1:int) : void
|
||||
{
|
||||
var _loc2_:FeedbackDefHelper = null;
|
||||
if(param1 == 0)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
throw new Error("Id == 0");
|
||||
}
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
if(!_feedbackDefHelpers)
|
||||
{
|
||||
_feedbackDefHelpers = [];
|
||||
}
|
||||
var _loc3_:Object = _feedbackDefCache[param1];
|
||||
if(!_loc3_)
|
||||
{
|
||||
_loc2_ = new FeedbackDefHelper();
|
||||
_loc2_.init(param1,onDefReceived);
|
||||
_feedbackDefHelpers[param1] = _loc2_;
|
||||
}
|
||||
else
|
||||
{
|
||||
displayFeedbackPopup(_loc3_);
|
||||
}
|
||||
}
|
||||
|
||||
private static function onDefReceived(param1:FeedbackDefHelper) : void
|
||||
{
|
||||
var _loc4_:Object = param1.def;
|
||||
var _loc3_:String = LocalizationManager.translateIdOnly(int(_loc4_.defaultStrRef));
|
||||
var _loc5_:RegExp = /\r\n/g;
|
||||
_loc3_ = _loc3_.replace(_loc5_,"\n");
|
||||
_loc5_ = /\r/g;
|
||||
_loc3_ = _loc3_.replace(_loc5_,"\n");
|
||||
var _loc2_:Object = {
|
||||
"id":int(_loc4_.id),
|
||||
"titleTxt":LocalizationManager.translateIdOnly(int(_loc4_.titleStrRef)),
|
||||
"defaultTxt":_loc3_,
|
||||
"thanksTxt":LocalizationManager.translateIdOnly(int(_loc4_.thankStrRef)),
|
||||
"allowImg":Boolean(int(_loc4_.bAcceptImage)),
|
||||
"userVarId":int(_loc4_.userVarRef),
|
||||
"bitIdx":int(_loc4_.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)
|
||||
{
|
||||
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 _loc3_:MovieClip = MovieClip(param1.currentTarget);
|
||||
var _loc2_:Object = _loc3_.def;
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("/game/play/popup/feedback/" + _loc2_.id);
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
if(!_loc2_.seen)
|
||||
{
|
||||
_loc3_.gotoAndPlay("answerDim");
|
||||
}
|
||||
displayFeedbackPopup(_loc2_);
|
||||
}
|
||||
|
||||
public static function displayFeedbackPopup(param1:Object) : void
|
||||
{
|
||||
var _loc2_:Array = null;
|
||||
var _loc3_: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(_loc3_));
|
||||
_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"])
|
||||
{
|
||||
_loc2_ = param1.defaultTxt.split("|");
|
||||
LocalizationManager.updateToFit(_popup.descTxt,_loc2_[0]);
|
||||
LocalizationManager.updateToFit(_popup.txt,_loc2_[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(_loc3_);
|
||||
if(_loc3_ == 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 - 1)
|
||||
{
|
||||
case 0:
|
||||
return 1;
|
||||
case 1:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 12:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
return 3;
|
||||
case 2:
|
||||
return 2;
|
||||
case 10:
|
||||
return 4;
|
||||
case 17:
|
||||
return 6;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
private static function maxCharsForType(param1:int) : int
|
||||
{
|
||||
switch(param1 - 1)
|
||||
{
|
||||
case 0:
|
||||
case 10:
|
||||
return 150;
|
||||
case 1:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
return 100;
|
||||
case 2:
|
||||
return 50;
|
||||
case 3:
|
||||
return 3000;
|
||||
case 16:
|
||||
return 200;
|
||||
case 17:
|
||||
return 25;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
private static function onRemoveFileBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
_imageUploader.resetUploader();
|
||||
_popup.addFileBtn.visible = true;
|
||||
}
|
||||
|
||||
private static function onMouseDown(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:String = null;
|
||||
var _loc3_:RegExp = null;
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget == _popup)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(param1.currentTarget == _popup.txt)
|
||||
{
|
||||
if(!_popup.clickedTextBox)
|
||||
{
|
||||
_popup.txt.text = "";
|
||||
_popup.clickedTextBox = true;
|
||||
gMainFrame.stage.focus = _popup.txt;
|
||||
_popup.txt.setSelection(0,0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(param1.currentTarget.name == "submitBtn")
|
||||
{
|
||||
_loc2_ = _popup.txt.text;
|
||||
_loc3_ = /\r\n/g;
|
||||
_loc2_ = _loc2_.replace(_loc3_,"\n");
|
||||
_loc3_ = /\r/g;
|
||||
_loc2_ = _loc2_.replace(_loc3_,"\n");
|
||||
if(_loc2_.length > 0 && _loc2_ != _popup.defaultTxt || _imageUploader.fileName != "")
|
||||
{
|
||||
if(_loc2_ == _popup.def.defaultTxt)
|
||||
{
|
||||
_loc2_ = _popup.txt.text = "";
|
||||
}
|
||||
setupRequest(_imageUploader,_loc2_,_popup.def.id,_secondaryType,onSendComplete,onSendError);
|
||||
}
|
||||
}
|
||||
_popup.removeEventListener("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 _loc10_:String = "---------------------------" + Math.floor(Math.random() * 100000000000000);
|
||||
var _loc8_:Object = {
|
||||
"userName":gMainFrame.userInfo.myUserName,
|
||||
"type":param3,
|
||||
"message":param2,
|
||||
"secondaryType":param4,
|
||||
"languageId":LocalizationManager.currentLanguage
|
||||
};
|
||||
var _loc9_:URLRequest = new URLRequest(gMainFrame.clientInfo.mdUrl + "fb");
|
||||
_loc9_.contentType = "multipart/form-data; boundary=" + _loc10_;
|
||||
_loc9_.requestHeaders.push(new URLRequestHeader("Cache-Control","no-cache"));
|
||||
_loc9_.method = "POST";
|
||||
_loc9_.data = createPostData(param1.fileName,param1.uploadedImage,_loc10_,_loc8_);
|
||||
var _loc7_:URLLoader = new URLLoader();
|
||||
_loc7_.dataFormat = "binary";
|
||||
_loc7_.addEventListener("complete",param5);
|
||||
_loc7_.addEventListener("ioError",param6);
|
||||
_loc7_.load(_loc9_);
|
||||
}
|
||||
|
||||
public static function createPostData(param1:String, param2:ByteArray, param3:String, param4:Object = null) : ByteArray
|
||||
{
|
||||
var _loc7_:String = null;
|
||||
var _loc8_:int = 0;
|
||||
var _loc5_:ByteArray = new ByteArray();
|
||||
_loc5_.endian = "bigEndian";
|
||||
if(param4 == null)
|
||||
{
|
||||
param4 = {};
|
||||
}
|
||||
for(var _loc6_:String in param4)
|
||||
{
|
||||
writeBoundary(_loc5_,param3);
|
||||
writeLineBreak(_loc5_);
|
||||
_loc7_ = "Content-Disposition: form-data; name=\"" + _loc6_ + "\"";
|
||||
_loc8_ = 0;
|
||||
while(_loc8_ < _loc7_.length)
|
||||
{
|
||||
_loc5_.writeByte(_loc7_.charCodeAt(_loc8_));
|
||||
_loc8_++;
|
||||
}
|
||||
writeLineBreak(_loc5_);
|
||||
writeLineBreak(_loc5_);
|
||||
_loc5_.writeUTFBytes(param4[_loc6_]);
|
||||
writeLineBreak(_loc5_);
|
||||
}
|
||||
if(param2)
|
||||
{
|
||||
writeBoundary(_loc5_,param3);
|
||||
writeLineBreak(_loc5_);
|
||||
_loc7_ = "Content-Disposition: form-data; name=\"image\"; filename=\"" + param1 + "\"";
|
||||
_loc8_ = 0;
|
||||
while(_loc8_ < _loc7_.length)
|
||||
{
|
||||
_loc5_.writeByte(_loc7_.charCodeAt(_loc8_));
|
||||
_loc8_++;
|
||||
}
|
||||
writeLineBreak(_loc5_);
|
||||
_loc7_ = "Content-Type: image/jpeg";
|
||||
_loc8_ = 0;
|
||||
while(_loc8_ < _loc7_.length)
|
||||
{
|
||||
_loc5_.writeByte(_loc7_.charCodeAt(_loc8_));
|
||||
_loc8_++;
|
||||
}
|
||||
writeLineBreak(_loc5_);
|
||||
writeLineBreak(_loc5_);
|
||||
_loc5_.writeBytes(param2,0,param2.length);
|
||||
writeLineBreak(_loc5_);
|
||||
}
|
||||
writeBoundary(_loc5_,param3);
|
||||
writeDoubleDash(_loc5_);
|
||||
writeLineBreak(_loc5_);
|
||||
return _loc5_;
|
||||
}
|
||||
|
||||
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,623 @@
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
_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,214 @@
|
||||
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 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,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(_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(_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 _loc2_:ApplicationDomain = null;
|
||||
var _loc3_: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)
|
||||
{
|
||||
_loc2_ = param1.loaderInfo.applicationDomain;
|
||||
AJAudio.loadSfx("DailySpinSpin",_loc2_.getDefinition("DailySpinSpin") as Class,0.5);
|
||||
AJAudio.loadSfx("DailySpinBub1",_loc2_.getDefinition("DailySpinBub1") as Class,0.5);
|
||||
AJAudio.loadSfx("DailySpinBub2",_loc2_.getDefinition("DailySpinBub2") as Class,0.5);
|
||||
AJAudio.loadSfx("DailySpinBub3",_loc2_.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)
|
||||
{
|
||||
_loc3_ = Math.min((param1.passback >> 16 & 0xFF) + 1,3);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = 1;
|
||||
}
|
||||
_loc4_ = 1;
|
||||
while(_loc4_ < 4)
|
||||
{
|
||||
if(_loc3_ < _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,218 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
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:Array, param3:Array, param4:Array, param5:Array, param6:Array, param7:Array, param8:Object = null) : void
|
||||
{
|
||||
var _loc9_:Array = null;
|
||||
var _loc10_:Boolean = false;
|
||||
if(param2.length > 1)
|
||||
{
|
||||
GenericListXtCommManager.filterList(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")
|
||||
{
|
||||
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)
|
||||
{
|
||||
_loc9_ = param8.msg.split("%");
|
||||
if(_loc9_.length > 1)
|
||||
{
|
||||
param8.shouldRepeat = _loc9_[1] == "true";
|
||||
param8.width = int(_loc9_[2]);
|
||||
param8.height = int(_loc9_[3]);
|
||||
}
|
||||
}
|
||||
_loc10_ = true;
|
||||
if(param8.shouldRepeat != null)
|
||||
{
|
||||
_loc10_ = Boolean(param8.shouldRepeat);
|
||||
}
|
||||
if(param8.width && param8.height)
|
||||
{
|
||||
GuiManager.initMoviePlayer(39,param2,param4,param7,_loc10_,param8.width,param8.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiManager.initMoviePlayer(39,param2,param4,param7,_loc10_);
|
||||
}
|
||||
if(_loc9_)
|
||||
{
|
||||
GuiManager.setVideoPlayerSkin(frameIdForMsg(_loc9_[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;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static function onMovieSelectorClose() : void
|
||||
{
|
||||
if(movieSelector)
|
||||
{
|
||||
movieSelector.toggleVisibility();
|
||||
}
|
||||
}
|
||||
|
||||
private static function launchStore(param1:int, param2:int) : void
|
||||
{
|
||||
if(_shop)
|
||||
{
|
||||
_shop.destroy();
|
||||
}
|
||||
_shop = new Shop();
|
||||
_shop.init(param1,param2,AvatarManager.playerAvatar,GuiManager.guiLayer,onShopClose);
|
||||
}
|
||||
|
||||
private static function onShopClose(param1:Boolean) : void
|
||||
{
|
||||
if(_shop)
|
||||
{
|
||||
_shop.destroy();
|
||||
_shop = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function init() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,877 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
import avatar.UserInfo;
|
||||
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 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("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 == 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:
|
||||
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 8:
|
||||
case 46:
|
||||
case 27:
|
||||
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 onPresentDownHandler(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
var _loc2_:String = _enviroType == 1 ? "_Ocean" : "";
|
||||
_popupContent.buttons.visible = true;
|
||||
_popupContent.present.removeEventListener("mouseDown",onPresentDownHandler);
|
||||
_popupContent.gotoAndPlay(_popupType == 6 ? "onMessage" : (isPopUpTypeTreasure() ? "onTreasureMessage" + _loc2_ + popUpColor() : "on"));
|
||||
if(isPopUpTypeTreasure())
|
||||
{
|
||||
if(_popupType == 13)
|
||||
{
|
||||
AJAudio.playTreasureBagUnwrap();
|
||||
}
|
||||
else
|
||||
{
|
||||
AJAudio.playTreasureUnwrap();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AJAudio.playGiftUnwrap();
|
||||
}
|
||||
}
|
||||
|
||||
private function keepBtnDownHandler(param1:Event) : void
|
||||
{
|
||||
var _loc7_:Array = null;
|
||||
var _loc4_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc3_:Array = null;
|
||||
var _loc2_:UserInfo = null;
|
||||
var _loc8_:int = 0;
|
||||
if(param1)
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
if(_denyForNonMem && !gMainFrame.userInfo.isMember)
|
||||
{
|
||||
UpsellManager.displayPopup(1,"Receiving_Gift");
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc7_ = [];
|
||||
if(_giftType == 1)
|
||||
{
|
||||
if(gMainFrame.userInfo.playerAvatarInfo)
|
||||
{
|
||||
_loc3_ = gMainFrame.userInfo.playerAvatarInfo.getFullItems();
|
||||
}
|
||||
if(_enviroType == 0)
|
||||
{
|
||||
if(_loc3_.length > 0)
|
||||
{
|
||||
_loc7_ = Utility.clothingItemListByEnviroType(_loc3_,0);
|
||||
}
|
||||
_loc6_ = 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_loc3_.length > 0)
|
||||
{
|
||||
_loc7_ = Utility.clothingItemListByEnviroType(_loc3_,1);
|
||||
}
|
||||
_loc6_ = 5;
|
||||
}
|
||||
if(_loc7_)
|
||||
{
|
||||
_loc4_ = int(_loc7_.length);
|
||||
}
|
||||
_loc5_ = Shop.maxItems;
|
||||
}
|
||||
else if(_giftType == 2)
|
||||
{
|
||||
if(_enviroType == 0)
|
||||
{
|
||||
if(gMainFrame.userInfo.playerUserInfo)
|
||||
{
|
||||
_loc2_ = gMainFrame.userInfo.playerUserInfo;
|
||||
if(_loc2_.denItemsFull.length > 0)
|
||||
{
|
||||
_loc7_ = Utility.denItemListByEnviroType(_loc2_.denItemsFull,0);
|
||||
}
|
||||
}
|
||||
_loc6_ = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(gMainFrame.userInfo.playerUserInfo && gMainFrame.userInfo.playerUserInfo.denItemsFull.length > 0)
|
||||
{
|
||||
_loc7_ = Utility.denItemListByEnviroType(gMainFrame.userInfo.playerUserInfo.denItemsFull,1);
|
||||
}
|
||||
_loc6_ = 3;
|
||||
}
|
||||
if(_loc7_)
|
||||
{
|
||||
_loc4_ = int(_loc7_.length);
|
||||
}
|
||||
_loc5_ = Shop.maxDenItems;
|
||||
}
|
||||
else if(_giftType == 5)
|
||||
{
|
||||
if(gMainFrame.userInfo.playerUserInfo && gMainFrame.userInfo.playerUserInfo.denItemsFull.length > 0)
|
||||
{
|
||||
_loc7_ = Utility.denItemListByEnviroType(gMainFrame.userInfo.playerUserInfo.denItemsFull,-1,true);
|
||||
}
|
||||
_loc6_ = 2;
|
||||
if(_loc7_)
|
||||
{
|
||||
_loc4_ = int(_loc7_.length);
|
||||
}
|
||||
_loc5_ = Shop.maxAudioItems;
|
||||
}
|
||||
else if(_giftType == 3)
|
||||
{
|
||||
_loc7_ = DenSwitch.denList;
|
||||
_loc6_ = 99;
|
||||
if(_loc7_)
|
||||
{
|
||||
_loc8_ = 0;
|
||||
while(_loc8_ < _loc7_.length)
|
||||
{
|
||||
if(_loc7_[_loc8_])
|
||||
{
|
||||
_loc4_++;
|
||||
}
|
||||
_loc8_++;
|
||||
}
|
||||
}
|
||||
_loc5_ = 28;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_popupType == 8 || _popupType == 14 || _popupType == 15 || _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(_loc4_ >= _loc5_)
|
||||
{
|
||||
_popupActive = true;
|
||||
new SBYesNoPopup(_guiLayer,LocalizationManager.translateIdOnly(14746),true,confirmRecycleHandler,_loc6_);
|
||||
}
|
||||
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 _loc4_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:String = null;
|
||||
if(scrollItems && scrollItems.length > 0 && _numDaysShow != param1)
|
||||
{
|
||||
_loc4_ = scrollContent["_item2"].y - scrollContent["_item1"].y;
|
||||
_loc3_ = 0;
|
||||
_loc2_ = null;
|
||||
_numDaysShow = param1;
|
||||
if(param1 == 30)
|
||||
{
|
||||
_loc3_ = _loc4_;
|
||||
if(selectedIdx > 29)
|
||||
{
|
||||
selectedIdx = 29;
|
||||
}
|
||||
}
|
||||
else if(param1 == 29)
|
||||
{
|
||||
_loc3_ = _loc4_ * 2;
|
||||
if(selectedIdx > 28)
|
||||
{
|
||||
selectedIdx = 28;
|
||||
}
|
||||
}
|
||||
else if(param1 == 28)
|
||||
{
|
||||
_loc3_ = _loc4_ * 3;
|
||||
if(selectedIdx > 27)
|
||||
{
|
||||
selectedIdx = 27;
|
||||
}
|
||||
}
|
||||
if(selectedIdx == -1)
|
||||
{
|
||||
selectedIdx = 0;
|
||||
_loc2_ = "-";
|
||||
}
|
||||
rebuild(0.55,selectedIdx,_loc2_,_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 _loc3_:DisplayObject = null;
|
||||
super();
|
||||
currRadioButton = param1;
|
||||
if(currRadioButton.numChildren <= 1)
|
||||
{
|
||||
throw new Error("GuiRadioButtonGroup requires two or more radio buttons!");
|
||||
}
|
||||
radioButtons = [];
|
||||
var _loc2_:int = 0;
|
||||
while(_loc2_ < currRadioButton.numChildren)
|
||||
{
|
||||
_loc4_ = currRadioButton.getChildAt(_loc2_);
|
||||
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;
|
||||
}
|
||||
_loc3_ = _loc4_["_circle"];
|
||||
_loc3_.visible = false;
|
||||
if(_loc3_ is MovieClip)
|
||||
{
|
||||
MovieClip(_loc3_).stop();
|
||||
}
|
||||
_loc2_++;
|
||||
}
|
||||
}
|
||||
|
||||
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,331 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public class GuiSoundButton extends MovieClip
|
||||
{
|
||||
|
||||
public var mouse:MovieClip;
|
||||
|
||||
public var down:MovieClip;
|
||||
|
||||
public var gray:MovieClip;
|
||||
|
||||
public var glowArrow:MovieClip;
|
||||
|
||||
public var glow:MovieClip;
|
||||
|
||||
public var 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) : 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 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;
|
||||
}
|
||||
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,477 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public class GuiSoundToggleButton extends MovieClip
|
||||
{
|
||||
|
||||
public var mouse:MovieClip;
|
||||
|
||||
public var down:MovieClip;
|
||||
|
||||
public var gray:MovieClip;
|
||||
|
||||
public var glowArrow:MovieClip;
|
||||
|
||||
public var glow:MovieClip;
|
||||
|
||||
public var 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;
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,228 @@
|
||||
package gui
|
||||
{
|
||||
import achievement.AchievementXtCommManager;
|
||||
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:Array, param3:Array, param4:Array, param5:Array, param6:Array, param7:Array) : void
|
||||
{
|
||||
_tutorialStreamId = param2[0];
|
||||
_tutorialText = param4[0];
|
||||
_tutorialSubtitleId = param7[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);
|
||||
GuiManager.initMoviePlayer(39,[_tutorialStreamId],[_tutorialText],[_tutorialSubtitleId],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 _loc4_:int = 0;
|
||||
var _loc2_: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 = [];
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _numImageWindow)
|
||||
{
|
||||
_loc3_ = _imgPopup["pollItem" + _loc4_];
|
||||
_loc3_.index = _loc4_;
|
||||
_loc3_.ItemHL.itemSelectedHL.visible = false;
|
||||
_loc3_.ItemHL.mouseOverHL.gotoAndStop("out");
|
||||
_loc3_.checkbox.checkmark.visible = false;
|
||||
_loc3_.checkbox.mouse.visible = false;
|
||||
if(_mediaIds)
|
||||
{
|
||||
_spirals[_loc4_] = new LoadingSpiral(_loc3_.itemBlock);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(_mediaIds[_loc4_],onMediaReceived,_loc4_);
|
||||
_mediaHolder.push(_mediaHelper);
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(_mediaIds[_loc4_],onMediaReceived,_loc4_ + 10);
|
||||
_mediaHolder.push(_mediaHelper);
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
_guiLayer.addChild(_imgPopup);
|
||||
DarkenManager.darken(_imgPopup);
|
||||
addListeners();
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = param1.getChildAt(0);
|
||||
_itemImages[param1.passback] = _loc2_;
|
||||
if(param1.passback < _numImageWindow)
|
||||
{
|
||||
_spirals[param1.passback].destroy();
|
||||
_imgPopup["pollItem" + param1.passback].itemBlock.addChild(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private static function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
param1.stopPropagation();
|
||||
if(!param1.currentTarget.isGray)
|
||||
{
|
||||
if(param1.currentTarget.name == "doneBtn")
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _checkedItems.length)
|
||||
{
|
||||
if(_checkedItems[_loc3_] != null)
|
||||
{
|
||||
if(_randOptionLookup)
|
||||
{
|
||||
_loc2_ |= 1 << _randOptionLookup[_checkedItems[_loc3_]];
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ |= 1 << _checkedItems[_loc3_];
|
||||
}
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
SBTracker.trackPageview("/game/play/imageVote/#" + _loc2_);
|
||||
AchievementXtCommManager.requestSetUserVar(_pollUserVardId,_pollUserVarIndex);
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
_closeCallback(_pollTab);
|
||||
_closeCallback = null;
|
||||
}
|
||||
}
|
||||
else if(_closeCallback != null)
|
||||
{
|
||||
SBTracker.pop();
|
||||
}
|
||||
destroy(param1.currentTarget.name == "doneBtn");
|
||||
}
|
||||
}
|
||||
|
||||
private static function onItemOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.ItemHL.mouseOverHL.currentFrameLabel != "out")
|
||||
{
|
||||
param1.currentTarget.ItemHL.mouseOverHL.gotoAndStop("out");
|
||||
}
|
||||
}
|
||||
|
||||
private static function onItemOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.ItemHL.mouseOverHL.currentFrameLabel != "over")
|
||||
{
|
||||
param1.currentTarget.ItemHL.mouseOverHL.gotoAndStop("over");
|
||||
}
|
||||
}
|
||||
|
||||
private static function onCheckOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
param1.currentTarget.mouse.visible = !param1.currentTarget.mouse.visible;
|
||||
}
|
||||
|
||||
private static function onCheckOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
param1.currentTarget.mouse.visible = !param1.currentTarget.mouse.visible;
|
||||
}
|
||||
|
||||
private static function onCheckOrVote(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc2_:Boolean = false;
|
||||
var _loc3_:int = 0;
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.name == "checkbox")
|
||||
{
|
||||
param1.currentTarget.checkmark.visible = _loc2_ = !param1.currentTarget.checkmark.visible;
|
||||
_loc4_ = int(param1.currentTarget.parent.index);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ = int(param1.currentTarget.parent.currPollIndex);
|
||||
_imgPopup["pollItem" + _loc4_].checkbox.checkmark.visible = _loc2_ = !_imgPopup["pollItem" + _loc4_].checkbox.checkmark.visible;
|
||||
}
|
||||
if(_loc2_)
|
||||
{
|
||||
_checkedItems.push(_loc4_);
|
||||
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(_loc4_),1);
|
||||
if(_imgPopup.doneBtn.hasGrayState && !_imgPopup.doneBtn.isGray && _checkedItems.length == 0)
|
||||
{
|
||||
_imgPopup.doneBtn.activateGrayState(true);
|
||||
}
|
||||
}
|
||||
_imgPopup["pollItem" + _loc4_].ItemHL.itemSelectedHL.visible = _loc2_;
|
||||
if(param1.currentTarget.name != "checkbox")
|
||||
{
|
||||
_imgPopup.imageViewerPopup.visible = false;
|
||||
_imgPopup.scrim.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static function onItemZoom(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_: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 _loc3_:int = int(param1.currentTarget.name == "zoomBtn" ? param1.currentTarget.parent.index : param1.currentTarget.index);
|
||||
if(_itemImages)
|
||||
{
|
||||
_loc2_ = _itemImages[_loc3_ + 10];
|
||||
if(_loc2_ != null)
|
||||
{
|
||||
_loc2_.gotoAndStop("large");
|
||||
_imgPopup.imageViewerPopup.itemBlock.addChild(_loc2_);
|
||||
}
|
||||
}
|
||||
if(_locStrings)
|
||||
{
|
||||
_imgPopup.imageViewerPopup.titleTxt.text = _locStrings[_randOptionLookup[_loc3_]];
|
||||
}
|
||||
if(_imgPopup.imageViewerPopup.currentLabels.length > 1)
|
||||
{
|
||||
_imgPopup.imageViewerPopup.gotoAndStop("pollItem" + _loc3_);
|
||||
_imgPopup.imageViewerPopup.titleTxt.text = _imgPopup["pollItem" + _loc3_].titleTxt.text;
|
||||
}
|
||||
_imgPopup.imageViewerPopup.currPollIndex = _loc3_;
|
||||
}
|
||||
|
||||
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 _loc2_:String = null;
|
||||
var _loc6_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc5_:int = int(param1.length);
|
||||
var _loc4_:Array = param1.slice();
|
||||
while(_loc7_ < _loc5_)
|
||||
{
|
||||
_loc2_ = _loc4_[_loc7_];
|
||||
_loc6_ = Math.floor(Math.random() * _loc5_);
|
||||
if(_loc7_ != _loc6_)
|
||||
{
|
||||
_loc4_[_loc7_] = _loc4_[_loc6_];
|
||||
_loc4_[_loc6_] = _loc2_;
|
||||
_loc3_ = int(_randOptionLookup[_loc7_]);
|
||||
_randOptionLookup[_loc7_] = _randOptionLookup[_loc6_];
|
||||
_randOptionLookup[_loc6_] = _loc3_;
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
return _loc4_;
|
||||
}
|
||||
|
||||
private static function addListeners() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
var _loc2_: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);
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _numImageWindow)
|
||||
{
|
||||
_loc1_ = _imgPopup["pollItem" + _loc2_];
|
||||
_loc1_.addEventListener("mouseOut",onItemOut,false,0,true);
|
||||
_loc1_.addEventListener("mouseOver",onItemOver,false,0,true);
|
||||
_loc1_.addEventListener("mouseDown",onItemZoom,false,0,true);
|
||||
_loc1_.zoomBtn.addEventListener("mouseDown",onItemZoom,false,0,true);
|
||||
_loc1_.checkbox.addEventListener("rollOver",onCheckOver,false,0,true);
|
||||
_loc1_.checkbox.addEventListener("rollOut",onCheckOut,false,0,true);
|
||||
_loc1_.checkbox.addEventListener("mouseDown",onCheckOrVote,false,0,true);
|
||||
_loc2_++;
|
||||
}
|
||||
_imgPopup.imageViewerPopup.bx.addEventListener("mouseDown",onCloseViewer,false,0,true);
|
||||
_imgPopup.imageViewerPopup.voteBtn.addEventListener("mouseDown",onCheckOrVote,false,0,true);
|
||||
}
|
||||
|
||||
private static function removeListeners() : void
|
||||
{
|
||||
var _loc1_:Object = null;
|
||||
var _loc2_:int = 0;
|
||||
_imgPopup.removeEventListener("mouseDown",onPopup);
|
||||
_imgPopup.bx.removeEventListener("mouseDown",onClose);
|
||||
_imgPopup.doneBtn.removeEventListener("mouseDown",onClose);
|
||||
_loc2_ = 0;
|
||||
while(_loc2_ < _numImageWindow)
|
||||
{
|
||||
_loc1_ = _imgPopup["pollItem" + _loc2_];
|
||||
_loc1_.removeEventListener("mouseOut",onItemOut);
|
||||
_loc1_.removeEventListener("mouseOver",onItemOver);
|
||||
_loc1_.removeEventListener("mouseDown",onItemZoom);
|
||||
_loc1_.zoomBtn.removeEventListener("mouseDown",onItemZoom);
|
||||
_loc1_.checkbox.removeEventListener("rollOver",onCheckOver);
|
||||
_loc1_.checkbox.removeEventListener("rollOut",onCheckOut);
|
||||
_loc1_.checkbox.removeEventListener("mouseDown",onCheckOrVote);
|
||||
_loc2_++;
|
||||
}
|
||||
_imgPopup.imageViewerPopup.bx.removeEventListener("mouseDown",onCloseViewer);
|
||||
_imgPopup.imageViewerPopup.voteBtn.removeEventListener("mouseDown",onCheckOrVote);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarInfo;
|
||||
import avatar.AvatarManager;
|
||||
import avatar.UserCommXtCommManager;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import flash.display.MovieClip;
|
||||
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 _loc2_:AvatarInfo = null;
|
||||
var _loc1_: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(16,"adventure/" + _scriptDef.defId);
|
||||
return null;
|
||||
}
|
||||
_loc2_ = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
|
||||
if(_loc2_)
|
||||
{
|
||||
if(_scriptDef.playAsPet)
|
||||
{
|
||||
_loc1_ = PetManager.myActivePet;
|
||||
if(!_loc1_)
|
||||
{
|
||||
new SBOkPopup(GuiManager.guiLayer,LocalizationManager.translateIdOnly(19656));
|
||||
return null;
|
||||
}
|
||||
if(!PetManager.canPetGoInEnviroType(_loc1_.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(_loc2_.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,449 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.Avatar;
|
||||
import avatar.AvatarInfo;
|
||||
import avatar.AvatarSwitch;
|
||||
import flash.display.MovieClip;
|
||||
|
||||
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 _loc6_:Avatar = null;
|
||||
var _loc4_: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;
|
||||
_loc6_ = AvatarSwitch.avatars[_index];
|
||||
_loc4_ = AvatarSwitch.numNonMemberAvatars;
|
||||
_loc3_ = AvatarSwitch.numNonMemberOceanAvatars;
|
||||
if(_loc6_ != 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 = _loc6_.avName;
|
||||
if(_isChoosing)
|
||||
{
|
||||
_window.checkbox.visible = true;
|
||||
_window.checkbox.check.visible = false;
|
||||
_window.aml.bg.visible = false;
|
||||
_window.aml.gray.visible = true;
|
||||
if(_loc4_ > 0 && _loc4_ < 3)
|
||||
{
|
||||
if(!AvatarSwitch.isMemberOnlyAvatar(_index))
|
||||
{
|
||||
_window.checkbox.check.visible = false;
|
||||
}
|
||||
}
|
||||
if(_loc4_ - _loc3_ < 1 || _loc4_ <= _loc5_ && AvatarSwitch.isMemberOnlyAvatar(_index))
|
||||
{
|
||||
_window.aml.visible = false;
|
||||
_window.gray.visible = true;
|
||||
_window.lock.visible = true;
|
||||
_window.checkbox.visible = false;
|
||||
_window.gray.nameTxt.text = _loc6_.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(_loc6_.userName,_loc6_.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 = _loc6_.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 && _loc4_ - _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 && _loc4_ - _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,227 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.Avatar;
|
||||
import avatar.AvatarUtility;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.filters.ColorMatrixFilter;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
import pet.GuiPet;
|
||||
import pet.PetManager;
|
||||
|
||||
public class ItemWindowAvatarOrPetSelect extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _currIconId:int;
|
||||
|
||||
private var _forCreation:Boolean;
|
||||
|
||||
private var _avType:int;
|
||||
|
||||
private var _currDef:Object;
|
||||
|
||||
private var _shouldShowDiamond:Boolean;
|
||||
|
||||
private var _customAvId:int;
|
||||
|
||||
private var _creationAvatar:Avatar;
|
||||
|
||||
private var _isPet:Boolean;
|
||||
|
||||
private var _currGuiPet:GuiPet;
|
||||
|
||||
private var _selectedIndex:int;
|
||||
|
||||
public function ItemWindowAvatarOrPetSelect(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_currIconId = int(param2);
|
||||
_isPet = param9.isPet == null ? false : true;
|
||||
_selectedIndex = param9.selectedIndex == null ? 0 : param9.selectedIndex;
|
||||
if(!_isPet)
|
||||
{
|
||||
_forCreation = param9.forCreation == null ? false : param9.forCreation;
|
||||
_avType = param9.avTypes[param4];
|
||||
_creationAvatar = param9.creationAvatars[param4];
|
||||
_customAvId = _creationAvatar.customAvId;
|
||||
_currDef = AvatarUtility.findAvDefByType(_avType,_customAvId);
|
||||
_shouldShowDiamond = _currDef.isDiamond && !AvatarUtility.getAvatarDefIsViewableWithAvId(_avType,_customAvId != -1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_currDef = PetManager.getPetDef(_currIconId);
|
||||
_shouldShowDiamond = _currDef.isDiamond;
|
||||
}
|
||||
super(1810,param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
public function get currIconId() : int
|
||||
{
|
||||
return _currIconId;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
return _currDef.isDiamond;
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
super.destroy();
|
||||
if(_currGuiPet)
|
||||
{
|
||||
_currGuiPet.destroy();
|
||||
_currGuiPet = null;
|
||||
}
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
var _loc3_:Array = null;
|
||||
var _loc4_:Array = null;
|
||||
if(_window)
|
||||
{
|
||||
if(_isPet)
|
||||
{
|
||||
if(!_isCurrItemLoaded)
|
||||
{
|
||||
_loc3_ = PetManager.packPetBits(PetManager.createRandomPet(_currIconId));
|
||||
_currGuiPet = PetManager.getGuiPet(0,_loc3_[0],_loc3_[1],_loc3_[2],_currDef.type,_currDef.title,null);
|
||||
_window.diamond.visible = _shouldShowDiamond;
|
||||
if(!gMainFrame.userInfo.isMember)
|
||||
{
|
||||
if(_currDef.isMember)
|
||||
{
|
||||
_window.memberLock.visible = true;
|
||||
}
|
||||
}
|
||||
if(_currGuiPet.canGoInOcean())
|
||||
{
|
||||
_window.ocean.visible = true;
|
||||
}
|
||||
_currGuiPet.scaleX = _currGuiPet.scaleY = 2;
|
||||
_currGuiPet.x = 53;
|
||||
_currGuiPet.y = 85;
|
||||
_window.itemWindow.addChild(_currGuiPet);
|
||||
_isCurrItemLoaded = true;
|
||||
}
|
||||
}
|
||||
else if(_currItem is int && _currItem != 0)
|
||||
{
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(int(_currItem),onCurrItemLoaded);
|
||||
}
|
||||
else if(_currItem && !_isCurrItemLoaded)
|
||||
{
|
||||
_isCurrItemLoaded = true;
|
||||
if(!gMainFrame.userInfo.isMember)
|
||||
{
|
||||
if(_currDef.isMemberOnly)
|
||||
{
|
||||
_window.memberLock.visible = true;
|
||||
}
|
||||
}
|
||||
if(!_forCreation && Utility.isOcean(_currDef.enviroFlag))
|
||||
{
|
||||
_window.ocean.visible = true;
|
||||
}
|
||||
if(AvatarUtility.isEndangered(_currDef.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(_currDef.availability))
|
||||
{
|
||||
_loc4_ = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0];
|
||||
_currItem.filters = [new ColorMatrixFilter(_loc4_)];
|
||||
}
|
||||
_window.diamond.visible = _shouldShowDiamond;
|
||||
if(_currDef.isDiamond && _window.currentFrameLabel != "diamond_down")
|
||||
{
|
||||
_window.gotoAndStop("diamond_up");
|
||||
}
|
||||
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
|
||||
{
|
||||
_window.itemWindow.addChild(_currItem[_iconLayerName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.itemWindow.addChild(DisplayObject(_currItem));
|
||||
}
|
||||
}
|
||||
if(index == _selectedIndex)
|
||||
{
|
||||
selectItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
_window.memberLock.visible = false;
|
||||
_window.endangered.visible = false;
|
||||
_window.ocean.visible = false;
|
||||
_window.diamond.visible = false;
|
||||
if(_forCreation)
|
||||
{
|
||||
loadCurrItem();
|
||||
}
|
||||
}
|
||||
|
||||
private function onCurrItemLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_currItem = param1.getChildAt(0);
|
||||
loadCurrItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarInfo;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
|
||||
public class ItemWindowAvtPetSml extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _isPet:Boolean;
|
||||
|
||||
private var _ai:AvatarInfo;
|
||||
|
||||
private var _isMember:Boolean;
|
||||
|
||||
private var _nameBarData:int;
|
||||
|
||||
private var _currFrameName:String;
|
||||
|
||||
public function ItemWindowAvtPetSml(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_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,290 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class ItemWindowBase extends MovieClip
|
||||
{
|
||||
|
||||
protected var _window:MovieClip;
|
||||
|
||||
protected var _currItem:Object;
|
||||
|
||||
protected var _mouseDown:Function;
|
||||
|
||||
protected var _mouseOver:Function;
|
||||
|
||||
protected var _mouseOut:Function;
|
||||
|
||||
protected var _memberOnlyDown:Function;
|
||||
|
||||
protected var _index:int;
|
||||
|
||||
protected var _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)
|
||||
{
|
||||
return _window.sizeCont.width;
|
||||
}
|
||||
return super.width;
|
||||
}
|
||||
|
||||
override public function get height() : Number
|
||||
{
|
||||
if("sizeCont" in _window)
|
||||
{
|
||||
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(_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(_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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class ItemWindowBook extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
public function ItemWindowBook(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
super(new (param9.currLoaderAppDomain.getDefinition("eBookLibraryCont") as Class)(),param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(_currItem.mediaId,onBookCoverLoaded);
|
||||
}
|
||||
|
||||
override protected function addEventListeners() : void
|
||||
{
|
||||
super.addEventListeners();
|
||||
_window.itemWindow.addEventListener("mouseDown",onBookCoverDown,false,0,true);
|
||||
}
|
||||
|
||||
private function onBookCoverLoaded(param1:MovieClip) : void
|
||||
{
|
||||
_window.itemWindow.addChild(param1.getChildAt(0));
|
||||
}
|
||||
|
||||
private function onBookCoverDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
GuiManager.openEBook(_currItem.listId,true,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarInfo;
|
||||
import buddy.Buddy;
|
||||
import flash.display.MovieClip;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class ItemWindowBuddyList extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _bud:Buddy = new Buddy();
|
||||
|
||||
private var _isForMainHud:Boolean;
|
||||
|
||||
private var _currWindow:MovieClip;
|
||||
|
||||
private var _isSelection:Boolean;
|
||||
|
||||
private var _currSelectedUsername:String;
|
||||
|
||||
public function ItemWindowBuddyList(param1:Function, param2:*, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_bud.init(param2.userName,param2.uuuid,param2.moderatedUserNameFlag,param2.onlineStatus,param2.accountType,param2.numDaysSinceLastLogin,param2.timeLeftHostingCustomParty);
|
||||
_isForMainHud = param9 ? param9.isForMainHud : false;
|
||||
_isSelection = param9 ? param9.isSelection : false;
|
||||
if(param9 && _bud.userName.toLowerCase() == param9.currSelectedUsername.toLowerCase())
|
||||
{
|
||||
_currSelectedUsername = param9.currSelectedUsername;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currSelectedUsername = "";
|
||||
}
|
||||
super("buddyListWindowCont",param1,param2,param3,param4,param5,param6,param7,param8,false);
|
||||
}
|
||||
|
||||
public function getBuddy() : Buddy
|
||||
{
|
||||
return _bud;
|
||||
}
|
||||
|
||||
public function buddyPortalUsername() : String
|
||||
{
|
||||
return _currSelectedUsername.toLowerCase();
|
||||
}
|
||||
|
||||
public function turnOffBuddySelection() : void
|
||||
{
|
||||
_currSelectedUsername = "";
|
||||
_currWindow.selectPortalBuddyBox.selected = false;
|
||||
}
|
||||
|
||||
public function setBuddySelection() : void
|
||||
{
|
||||
_currSelectedUsername = _bud.userName;
|
||||
}
|
||||
|
||||
public function get daysSinceLastLogin() : int
|
||||
{
|
||||
return _bud.numDaysSinceLastLogin;
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
if(_bud.onlineStatus == 1)
|
||||
{
|
||||
_bud = BuddyManager.getBuddyByUserName(_bud.userName);
|
||||
_currWindow = _window.OnlineBuddyListWindow;
|
||||
if(_currWindow.onOffBlocked.currentFrameLabel != "blocked")
|
||||
{
|
||||
if(_bud.timeLeftHostingCustomParty > 0)
|
||||
{
|
||||
_currWindow.onOffBlocked.gotoAndStop("jammerParty");
|
||||
}
|
||||
else
|
||||
{
|
||||
_currWindow.onOffBlocked.gotoAndStop("online");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
var _loc2_:String = null;
|
||||
var _loc1_:AvatarInfo = null;
|
||||
if(_isSelection)
|
||||
{
|
||||
_window.gotoAndStop("portal");
|
||||
_currWindow = _window.portal;
|
||||
_currWindow.selectPortalBuddyBox = new GuiRadioButtonSingle(_currWindow.radioBtn,_currWindow.userNameTxt);
|
||||
if(_bud.onlineStatus == -1)
|
||||
{
|
||||
_currWindow.selectPortalBuddyBox.gray = true;
|
||||
}
|
||||
else if(_bud.userName.toLowerCase() == _currSelectedUsername.toLowerCase())
|
||||
{
|
||||
_currWindow.selectPortalBuddyBox.selected = true;
|
||||
BuddyList.updateSelectedInWorldBuddyIndex(_index);
|
||||
}
|
||||
else
|
||||
{
|
||||
_currWindow.selectPortalBuddyBox.selected = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_bud.onlineStatus == 1)
|
||||
{
|
||||
_window.gotoAndStop("online");
|
||||
_currWindow = _window.OnlineBuddyListWindow;
|
||||
_loc2_ = "";
|
||||
_loc1_ = gMainFrame.userInfo.getAvatarInfoByUserName(_bud.userName);
|
||||
if(_loc1_)
|
||||
{
|
||||
_loc2_ = _loc1_.avName;
|
||||
}
|
||||
LocalizationManager.updateToFit(_currWindow.avNameTxt,_loc2_);
|
||||
if(BuddyManager.isBlocked(_bud.userName))
|
||||
{
|
||||
_currWindow.onOffBlocked.gotoAndStop("blocked");
|
||||
}
|
||||
else if(_bud.timeLeftHostingCustomParty > 0)
|
||||
{
|
||||
_currWindow.onOffBlocked.gotoAndStop("jammerParty");
|
||||
}
|
||||
else
|
||||
{
|
||||
_currWindow.onOffBlocked.gotoAndStop("online");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.gotoAndStop("offline");
|
||||
_currWindow = _window.OfflineBuddyListWindow;
|
||||
_currWindow.onOffBlocked.gotoAndStop("offline");
|
||||
}
|
||||
_currWindow.onlineStatus = _bud.onlineStatus;
|
||||
_currWindow.daysSinceLastLogin = _bud.numDaysSinceLastLogin;
|
||||
_currWindow.accountType = _bud.accountType;
|
||||
}
|
||||
_currWindow.userName = _bud.userName;
|
||||
_currWindow.moderatedUserName = _bud.userNameModerated;
|
||||
LocalizationManager.updateToFit(_currWindow.userNameTxt,_bud.userNameModerated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package gui
|
||||
{
|
||||
import localization.LocalizationManager;
|
||||
import movie.MovieNode;
|
||||
|
||||
public class ItemWindowChapterSelect extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _currMovieNodeDef:MovieNode;
|
||||
|
||||
private var _isGray:Boolean;
|
||||
|
||||
private var _baseDefId:int;
|
||||
|
||||
public function ItemWindowChapterSelect(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
super(2162,param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
_currMovieNodeDef = MovieNode(param2);
|
||||
_baseDefId = param9.baseDefId;
|
||||
}
|
||||
|
||||
public function getMovieNodeDef() : MovieNode
|
||||
{
|
||||
return _currMovieNodeDef;
|
||||
}
|
||||
|
||||
public function activateGrayState(param1:Boolean) : void
|
||||
{
|
||||
_isGray = param1;
|
||||
_window.activateGrayState(param1);
|
||||
}
|
||||
|
||||
public function get isGray() : Boolean
|
||||
{
|
||||
return _isGray;
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
var _loc2_:Boolean = false;
|
||||
if(_currMovieNodeDef.defId != _baseDefId && !gMainFrame.userInfo.userVarCache.isBitSet(_currMovieNodeDef.userVarId,_currMovieNodeDef.bitIndex))
|
||||
{
|
||||
if(_currMovieNodeDef.bitIndex > 0 && Boolean(gMainFrame.userInfo.userVarCache.isBitSet(_currMovieNodeDef.userVarId,_currMovieNodeDef.bitIndex - 1)))
|
||||
{
|
||||
activateGrayState(false);
|
||||
_loc2_ = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
activateGrayState(true);
|
||||
}
|
||||
}
|
||||
if(_currMovieNodeDef.thisChapterHasGift && (_loc2_ || _isGray))
|
||||
{
|
||||
_window.btnCont.showGift(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.btnCont.showGift(false);
|
||||
}
|
||||
var _loc1_:String = LocalizationManager.translateIdOnly(_currMovieNodeDef.streamTitleId);
|
||||
if(_isGray)
|
||||
{
|
||||
_loc1_ = _loc1_.slice(0,_loc1_.indexOf(":"));
|
||||
}
|
||||
LocalizationManager.updateToFit(_window.btnCont.mouse.up.txt,_loc1_);
|
||||
LocalizationManager.updateToFit(_window.btnCont.gray.txt,_loc1_);
|
||||
}
|
||||
|
||||
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,191 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.Avatar;
|
||||
import avatar.AvatarInfo;
|
||||
import avatar.AvatarManager;
|
||||
import avatar.AvatarUtility;
|
||||
import avatar.AvatarView;
|
||||
import avatar.AvatarXtCommManager;
|
||||
import avatar.UserInfo;
|
||||
import flash.display.MovieClip;
|
||||
import flash.geom.Point;
|
||||
import localization.LocalizationManager;
|
||||
import pet.GuiPet;
|
||||
import quest.QuestXtCommManager;
|
||||
|
||||
public class ItemWindowCustPlayers extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _onBxBtn:Function;
|
||||
|
||||
private var _currUserName:String;
|
||||
|
||||
private var _ai:AvatarInfo;
|
||||
|
||||
private var _scriptDefId:int;
|
||||
|
||||
public function ItemWindowCustPlayers(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_onBxBtn = param9.onBxBtn;
|
||||
_scriptDefId = param9.scriptDefId;
|
||||
super(2301,param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
_window.bx.visible = false;
|
||||
super.setChildrenAndInitialConditions();
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
var _loc3_:AvatarInfo = null;
|
||||
while(_window.char.charLayer.numChildren > 0)
|
||||
{
|
||||
_window.char.charLayer.removeChildAt(0);
|
||||
}
|
||||
_window.char.gotoAndPlay("waiting");
|
||||
LocalizationManager.translateId(_window.nameBar.firstName_txt,11101);
|
||||
_window.nameBar.lastName_txt.text = "";
|
||||
_window.char.gotoAndPlay("up");
|
||||
var _loc4_:Avatar = AvatarManager.getAvatarBySfsUserId(int(_currItem));
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc3_ = gMainFrame.userInfo.getAvatarInfoByUserName(_loc4_.userName);
|
||||
}
|
||||
if(_loc4_ == null || _loc3_ == null)
|
||||
{
|
||||
AvatarXtCommManager.requestAvatarGetBySfsId(int(_currItem),onAvatarGetReceived);
|
||||
}
|
||||
else
|
||||
{
|
||||
setupAvatar(_loc4_,_loc3_.currPet);
|
||||
}
|
||||
}
|
||||
|
||||
override protected function addEventListeners() : void
|
||||
{
|
||||
_window.bx.addEventListener("mouseDown",_onBxBtn,false,0,true);
|
||||
super.addEventListeners();
|
||||
}
|
||||
|
||||
override protected function removeEventListeners() : void
|
||||
{
|
||||
_window.bx.removeEventListener("mouseDown",_onBxBtn);
|
||||
super.removeEventListeners();
|
||||
}
|
||||
|
||||
public function showXBtn(param1:Boolean) : void
|
||||
{
|
||||
_window.bx.visible = param1;
|
||||
}
|
||||
|
||||
public function get userName() : String
|
||||
{
|
||||
return _currUserName;
|
||||
}
|
||||
|
||||
public function get char() : MovieClip
|
||||
{
|
||||
return _window.char;
|
||||
}
|
||||
|
||||
private function setupAvatar(param1:Avatar, param2:Object) : void
|
||||
{
|
||||
var _loc5_:GuiPet = null;
|
||||
var _loc10_:AvatarView = null;
|
||||
var _loc9_:Point = null;
|
||||
var _loc8_:String = null;
|
||||
var _loc7_:int = 0;
|
||||
var _loc6_:String = null;
|
||||
var _loc4_:String = null;
|
||||
var _loc11_:Object = QuestXtCommManager.getScriptDef(_scriptDefId);
|
||||
if(_loc11_.playAsPet)
|
||||
{
|
||||
_loc5_ = new GuiPet(0,param2.lBits,param2.uBits,param2.eBits,param2.type,param2.name,onBigPetLoaded);
|
||||
_window.char.charLayer.addChild(_loc5_);
|
||||
_window.nameBar.firstName_txt.text = _loc5_.petName;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc10_ = new AvatarView();
|
||||
_loc10_.init(param1);
|
||||
_loc10_.playAnim(15);
|
||||
_loc10_.scaleX = 0.7;
|
||||
_loc10_.scaleY = 0.7;
|
||||
_loc9_ = AvatarUtility.getAvatarMinigameLobbyOffset(_loc10_.avTypeId);
|
||||
_loc10_.x = _loc9_.x;
|
||||
_loc10_.y = _loc9_.y + 5;
|
||||
_window.char.charLayer.addChild(_loc10_);
|
||||
_loc8_ = param1.avName;
|
||||
_loc7_ = _loc8_.indexOf(" ");
|
||||
if(_loc7_ != -1)
|
||||
{
|
||||
_loc6_ = _loc8_.substr(0,_loc7_);
|
||||
_loc4_ = _loc8_.substr(_loc7_ + 1,_loc8_.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc6_ = _loc8_;
|
||||
}
|
||||
_window.nameBar.firstName_txt.text = _loc6_;
|
||||
if(_loc4_)
|
||||
{
|
||||
_window.nameBar.lastName_txt.text = _loc4_;
|
||||
}
|
||||
}
|
||||
_currUserName = param1.userName;
|
||||
_ai = gMainFrame.userInfo.getAvatarInfoByUserNameThenPerUserAvId(param1.userName,param1.perUserAvId);
|
||||
var _loc3_:UserInfo = gMainFrame.userInfo.getUserInfoByUserName(param1.userName);
|
||||
if(_ai && _loc3_ && _ai.questLevel > 0)
|
||||
{
|
||||
loadQuestShape(_loc3_.nameBarData);
|
||||
}
|
||||
}
|
||||
|
||||
private function onAvatarGetReceived(param1:String, param2:Boolean, param3:int, param4:int) : void
|
||||
{
|
||||
var _loc7_:AvatarInfo = null;
|
||||
var _loc5_:int = 0;
|
||||
var _loc6_:Avatar = null;
|
||||
if(param2)
|
||||
{
|
||||
_loc7_ = gMainFrame.userInfo.getAvatarInfoByUserName(param1);
|
||||
if(!_loc7_)
|
||||
{
|
||||
throw new Error("onAvatarSFSGetReceived and avInfo is null");
|
||||
}
|
||||
_loc5_ = _loc7_.perUserAvId;
|
||||
_loc6_ = AvatarManager.getAvatarByUserName(param1);
|
||||
if(_loc6_ == null)
|
||||
{
|
||||
_loc6_ = AvatarUtility.generateNew(_loc5_,null,param1,-1,0);
|
||||
}
|
||||
setupAvatar(_loc6_,_loc7_.currPet);
|
||||
}
|
||||
}
|
||||
|
||||
private function onBigPetLoaded(param1:MovieClip, param2:GuiPet) : void
|
||||
{
|
||||
param2.scaleX = param2.scaleY = 1.5;
|
||||
param2.y += 30;
|
||||
}
|
||||
|
||||
private function loadQuestShape(param1:int) : void
|
||||
{
|
||||
var _loc2_:String = _window.xpShape.currentLabels[Utility.getColorId(param1) - 1].name;
|
||||
_window.xpShape.visible = true;
|
||||
if(_loc2_ == "black")
|
||||
{
|
||||
_window.xpShape.gotoAndStop(2);
|
||||
_window.xpShape.gotoAndStop(_loc2_);
|
||||
}
|
||||
if(_window.xpShape.currentFrameLabel != _loc2_)
|
||||
{
|
||||
_window.xpShape.gotoAndStop(_loc2_);
|
||||
}
|
||||
Utility.createXpShape(_ai.questLevel,true,_window.xpShape[_loc2_].mouse.up.icon,null,param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package gui
|
||||
{
|
||||
import ecard.ECard;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class ItemWindowECard extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _currSelectedIndex:Function;
|
||||
|
||||
private var _readFunction:Function;
|
||||
|
||||
public function ItemWindowECard(param1:Function, param2:ECard, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_currSelectedIndex = param9.currSelectedIndex;
|
||||
_readFunction = param9.readFunction;
|
||||
super("inboxMessage",param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
public function select(param1:Boolean) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(!_currItem.isRead)
|
||||
{
|
||||
_currItem.isReadInProcess = true;
|
||||
_window.gotoAndStop("new");
|
||||
_window.selectedOutline.visible = true;
|
||||
LocalizationManager.findAllTextfields(_window);
|
||||
_readFunction();
|
||||
}
|
||||
else if(_window.currentFrameLabel != "new")
|
||||
{
|
||||
_window.gotoAndStop("selected");
|
||||
}
|
||||
}
|
||||
else if(!_currItem.isRead)
|
||||
{
|
||||
_window.gotoAndStop("new");
|
||||
_window.selectedOutline.visible = false;
|
||||
LocalizationManager.findAllTextfields(_window);
|
||||
}
|
||||
else if(_window.currentFrameLabel == "selected" || _window.currentFrameLabel == "new")
|
||||
{
|
||||
_window.gotoAndStop("norm");
|
||||
}
|
||||
}
|
||||
|
||||
public function get currItem() : Object
|
||||
{
|
||||
return _currItem;
|
||||
}
|
||||
|
||||
public function updateWithInput(param1:ECard) : void
|
||||
{
|
||||
_currItem = param1;
|
||||
update();
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
if(_isCurrItemLoaded)
|
||||
{
|
||||
select(index == _currSelectedIndex());
|
||||
LocalizationManager.updateToFit(_window.messageTxt,_currItem.modifiedMsg);
|
||||
_window.gift.visible = _currItem.isGift;
|
||||
}
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
_window.messageTxt.mouseEnabled = false;
|
||||
_window.nameTxt.mouseEnabled = false;
|
||||
_window.gift.visible = false;
|
||||
_window.gift.mouseEnabled = false;
|
||||
_window.gift.mouseChildren = false;
|
||||
_window.AJIcon.visible = false;
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(!_isCurrItemLoaded)
|
||||
{
|
||||
_isCurrItemLoaded = true;
|
||||
LocalizationManager.updateToFit(_window.nameTxt,_currItem.senderModeratedUserName);
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package gui
|
||||
{
|
||||
import ecard.ECardImageBase;
|
||||
import flash.filters.ColorMatrixFilter;
|
||||
|
||||
public class ItemWindowECardPreview extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _currentECardImageBase:ECardImageBase;
|
||||
|
||||
private var _loadingSpiral:LoadingSpiral;
|
||||
|
||||
private var _currIndexFunction:Function;
|
||||
|
||||
private var _shouldGrayOutPreviewFunction:Function;
|
||||
|
||||
public function ItemWindowECardPreview(param1:Function, param2:int, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_currIndexFunction = param9.currIndexFunction;
|
||||
_shouldGrayOutPreviewFunction = param9.shouldGrayOutPreview;
|
||||
super(4474,param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
_loadingSpiral = new LoadingSpiral(_window.itemWindow,_window.itemWindow.width * 0.5,_window.itemWindow.height * 0.5);
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(_window && !_isCurrItemLoaded)
|
||||
{
|
||||
_isCurrItemLoaded = true;
|
||||
_currentECardImageBase = new ECardImageBase();
|
||||
_currentECardImageBase.init(int(_currItem),onECardImageLoaded);
|
||||
}
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
if(_currentECardImageBase && _currentECardImageBase.img)
|
||||
{
|
||||
if(_shouldGrayOutPreviewFunction())
|
||||
{
|
||||
if(_currIndexFunction() == index)
|
||||
{
|
||||
_window.gotoAndStop("selected");
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.gotoAndStop("norm");
|
||||
}
|
||||
_currentECardImageBase.img.filters = null;
|
||||
if(_window.normCont)
|
||||
{
|
||||
_window.normCont.activateGrayState(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.gotoAndStop("norm");
|
||||
if(_window.normCont)
|
||||
{
|
||||
_window.normCont.activateGrayState(true);
|
||||
}
|
||||
_currentECardImageBase.img.filters = [new ColorMatrixFilter([0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0,0,0,1,0])];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onECardImageLoaded() : void
|
||||
{
|
||||
_currentECardImageBase.img.scaleX = _currentECardImageBase.img.scaleY = 0.255;
|
||||
_window.itemWindow.addChild(_currentECardImageBase.img);
|
||||
update();
|
||||
_loadingSpiral.destroy();
|
||||
_loadingSpiral = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
|
||||
public class ItemWindowGame extends ItemWindowBase
|
||||
{
|
||||
|
||||
public function ItemWindowGame(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
super("gameBtnCont",param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
public function get itemLayer() : MovieClip
|
||||
{
|
||||
return _window.itemLayer;
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(_currItem && !_isCurrItemLoaded)
|
||||
{
|
||||
_isCurrItemLoaded = true;
|
||||
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
|
||||
{
|
||||
_window.itemLayer.addChild(_currItem[_iconLayerName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.itemLayer.addChild(DisplayObject(_currItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override protected function addEventListeners() : void
|
||||
{
|
||||
if(_window)
|
||||
{
|
||||
if(_mouseDown != null)
|
||||
{
|
||||
addEventListener("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,109 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import game.MinigameInfo;
|
||||
import game.MinigameManager;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class ItemWindowGameIcon extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _currGameDefId:int;
|
||||
|
||||
private var _mgf:MinigameInfo;
|
||||
|
||||
private var _toolTipName:String = "";
|
||||
|
||||
public function ItemWindowGameIcon(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_currGameDefId = int(param2);
|
||||
super(4314,param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
public function get itemYLocation() : Number
|
||||
{
|
||||
return _itemYLocation;
|
||||
}
|
||||
|
||||
public function get itemXLocation() : Number
|
||||
{
|
||||
return _itemXLocation;
|
||||
}
|
||||
|
||||
public function get toolTipName() : String
|
||||
{
|
||||
return _toolTipName;
|
||||
}
|
||||
|
||||
public function get currGamDefId() : int
|
||||
{
|
||||
return _currGameDefId;
|
||||
}
|
||||
|
||||
public function get currWindow() : MovieClip
|
||||
{
|
||||
return _window;
|
||||
}
|
||||
|
||||
public function get currItem() : MovieClip
|
||||
{
|
||||
if(!(_currItem is int))
|
||||
{
|
||||
return _currItem as MovieClip;
|
||||
}
|
||||
return _window;
|
||||
}
|
||||
|
||||
public function get doubleGems() : MovieClip
|
||||
{
|
||||
return _window.mouse.mouse.doubleGems;
|
||||
}
|
||||
|
||||
public function get gameLaunchObject() : Object
|
||||
{
|
||||
return {"typeDefId":_mgf.gameDefId};
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(_currItem is int)
|
||||
{
|
||||
_mgf = MinigameManager.minigameInfoCache.getMinigameInfo(_currGameDefId);
|
||||
if(_mgf.gemMultiplier > 1)
|
||||
{
|
||||
_window.mouse.mouse.doubleGems.visible = true;
|
||||
}
|
||||
_toolTipName = LocalizationManager.translateIdOnly(_mgf.titleStrId);
|
||||
if(_mgf)
|
||||
{
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(_mgf.gameLibraryIconMediaId,onCurrItemLoaded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
_window.mouse.mouse.doubleGems.visible = false;
|
||||
}
|
||||
|
||||
private function onCurrItemLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_currItem = param1.getChildAt(0);
|
||||
_isCurrItemLoaded = true;
|
||||
_currItem.x += _currItem.width * 0.5;
|
||||
_currItem.y += _currItem.height * 0.5;
|
||||
_window.mouse.mouse.itemWindow.addChild(DisplayObject(_currItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarInfo;
|
||||
|
||||
public class ItemWindowHeart extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _frameName:String = "fullHeart";
|
||||
|
||||
private var _hpPercentage:Number;
|
||||
|
||||
private var _isEmptyHeart:Boolean;
|
||||
|
||||
private var _numTotalHearts:Number = _loc10_.healthBase * 0.5;
|
||||
|
||||
public function ItemWindowHeart(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_hpPercentage = param9.hpPercentage;
|
||||
var _loc10_:AvatarInfo = gMainFrame.userInfo.getAvatarInfoByUsernamePerUserAvId(gMainFrame.userInfo.myUserName,gMainFrame.userInfo.myPerUserAvId);
|
||||
var _loc13_:Number = 100 / _numTotalHearts;
|
||||
var _loc12_:Number = Math.min(_numTotalHearts,_hpPercentage / _loc13_);
|
||||
var _loc11_:int = Math.ceil(_loc12_);
|
||||
if(param4 + 1 == _loc11_)
|
||||
{
|
||||
if(_loc11_ - _loc12_ >= 0.5 && _numTotalHearts == _loc12_)
|
||||
{
|
||||
_frameName = "halfHeart";
|
||||
}
|
||||
else
|
||||
{
|
||||
_frameName = _loc11_ - _loc12_ >= 0.5 ? "halfEmpty" : "fullHeart";
|
||||
}
|
||||
}
|
||||
else if(param4 + 1 > _loc11_ && _loc11_ < _numTotalHearts)
|
||||
{
|
||||
_isEmptyHeart = true;
|
||||
if(param4 + 1 == Math.ceil(_numTotalHearts) && _loc11_ - _loc12_ >= 0.5)
|
||||
{
|
||||
_frameName = "halfCont";
|
||||
}
|
||||
else
|
||||
{
|
||||
_frameName = "emptyHeart";
|
||||
}
|
||||
}
|
||||
super("questHudHeart",param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
public function updateFrame() : void
|
||||
{
|
||||
_window.gotoAndStop(_frameName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
import avatar.NameBar;
|
||||
import flash.display.MovieClip;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class ItemWindowNameBar extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _isMember:Boolean;
|
||||
|
||||
private var _nameBarData:Object;
|
||||
|
||||
private var _userName:String;
|
||||
|
||||
private var _avName:String;
|
||||
|
||||
private var _isBuddy:Boolean;
|
||||
|
||||
private var _isBlocked:Boolean;
|
||||
|
||||
public function ItemWindowNameBar(param1:Function, param2:MovieClip, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_isMember = param9[param4].isMember;
|
||||
_nameBarData = param9[param4].nameBarData;
|
||||
_userName = param9[param4].userName;
|
||||
_avName = param9[param4].avName;
|
||||
_isBuddy = param9[param4].isBuddy;
|
||||
_isBlocked = param9[param4].isBlocked;
|
||||
super(_isMember ? "memberNameBar" : "FreeNameBar",param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
public function get userName() : String
|
||||
{
|
||||
return _userName;
|
||||
}
|
||||
|
||||
public function updateToBeCentered(param1:int) : void
|
||||
{
|
||||
_window.x += (param1 - _window.width) * 0.5;
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
if(_isMember)
|
||||
{
|
||||
_window.nubData = AvatarManager.playerAvatarWorldView.nubData;
|
||||
_window.setNubType(_isBuddy ? NameBar.BUDDY : NameBar.NON_BUDDY);
|
||||
_window.setColorAndBadge(_nameBarData);
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.iconIds = AvatarManager.playerAvatarWorldView.nameBarIconIds;
|
||||
_window.nubData = AvatarManager.playerAvatarWorldView.nubData;
|
||||
}
|
||||
_window.isBlocked = _isBlocked;
|
||||
_window.setAvName(LocalizationManager.translateAvatarName(_avName),Utility.isSettingOn(MySettings.SETTINGS_USERNAME_BADGE));
|
||||
_window.x += _window.width * 0.5;
|
||||
_window.y += _window.height * 0.5;
|
||||
}
|
||||
|
||||
override protected function addEventListeners() : void
|
||||
{
|
||||
if(_window)
|
||||
{
|
||||
if(_mouseDown != null)
|
||||
{
|
||||
addEventListener("mouseDown",_mouseDown,false,0,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class ItemWindowNameBarIcon extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _currFrameLabel:String;
|
||||
|
||||
private var _loadIcons:Boolean;
|
||||
|
||||
private var _icon1:MovieClip;
|
||||
|
||||
private var _icon2:MovieClip;
|
||||
|
||||
private var _iconsMediaHelper:MediaHelper;
|
||||
|
||||
private var _callbackFunction:Function;
|
||||
|
||||
private var _triedToLoadCurrItem:Boolean;
|
||||
|
||||
public function ItemWindowNameBarIcon(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_currFrameLabel = param9.currFrameLabel;
|
||||
_loadIcons = param9.loadIcons;
|
||||
_callbackFunction = param9.callbackFunction;
|
||||
super("selNub",param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
public function get mouse() : MovieClip
|
||||
{
|
||||
return _window.mouse;
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(_currItem && !_isCurrItemLoaded && !_loadIcons && _window.hasOwnProperty("mouse"))
|
||||
{
|
||||
_isCurrItemLoaded = true;
|
||||
_window.mouse.gotoAndStop(1);
|
||||
_window.mouse.mouse.icon.addChild(_currItem.iconMouse);
|
||||
_window.mouse.up.icon.addChild(_currItem.iconUp);
|
||||
}
|
||||
else
|
||||
{
|
||||
_triedToLoadCurrItem = true;
|
||||
}
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
if(_currItem)
|
||||
{
|
||||
_window.scaleX = 1.5;
|
||||
_window.scaleY = 1.5;
|
||||
_window.gotoAndStop(_currFrameLabel);
|
||||
_window = _window[_currFrameLabel];
|
||||
_window.y += _window.height * 0.5;
|
||||
while(_window.mouse.mouse.icon.numChildren > 0)
|
||||
{
|
||||
_window.mouse.mouse.icon.removeChildAt(0);
|
||||
}
|
||||
while(_window.mouse.up.icon.numChildren > 0)
|
||||
{
|
||||
_window.mouse.up.icon.removeChildAt(0);
|
||||
}
|
||||
if(_loadIcons)
|
||||
{
|
||||
_window.mouse.gotoAndStop(1);
|
||||
loadIcon();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private function loadIcon() : void
|
||||
{
|
||||
_iconsMediaHelper = new MediaHelper();
|
||||
_iconsMediaHelper.init(int(_currItem),onIconsLoaded);
|
||||
}
|
||||
|
||||
private function onIconsLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1 && _window)
|
||||
{
|
||||
if(_icon1 == null)
|
||||
{
|
||||
_icon1 = param1;
|
||||
_iconsMediaHelper = new MediaHelper();
|
||||
_iconsMediaHelper.init(int(_currItem),onIconsLoaded);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loadIcons = false;
|
||||
_icon2 = param1;
|
||||
_currItem = {
|
||||
"iconMouse":_icon1,
|
||||
"iconUp":_icon2
|
||||
};
|
||||
_callbackFunction(_icon1,_icon2,_index);
|
||||
_icon1 = null;
|
||||
_icon2 = null;
|
||||
_callbackFunction = null;
|
||||
_iconsMediaHelper.destroy();
|
||||
_iconsMediaHelper = null;
|
||||
if(_triedToLoadCurrItem)
|
||||
{
|
||||
loadCurrItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,448 @@
|
||||
package gui
|
||||
{
|
||||
import den.DenItem;
|
||||
import flash.display.DisplayObject;
|
||||
import flash.display.MovieClip;
|
||||
import item.Item;
|
||||
import pet.PetManager;
|
||||
|
||||
public class ItemWindowOriginal extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _isAvatarEditor:Boolean;
|
||||
|
||||
private var _isTradeList:Boolean;
|
||||
|
||||
private var _isChoosingForTradeList:Boolean;
|
||||
|
||||
private var _generatorIndex:int;
|
||||
|
||||
private var _giftItemIdx:int;
|
||||
|
||||
private var _isDownGift:Boolean;
|
||||
|
||||
private var _isPetItem:Boolean;
|
||||
|
||||
private var _isActivePet:Boolean;
|
||||
|
||||
private var _isAudio:Boolean;
|
||||
|
||||
private var _isLastPlacedAudio:Boolean;
|
||||
|
||||
private var _isTradeManager:Boolean;
|
||||
|
||||
private var _isECard:Boolean;
|
||||
|
||||
private var _isViewingATradeList:Boolean;
|
||||
|
||||
private var _isRecycling:Boolean;
|
||||
|
||||
private var _loadImmediately:Boolean;
|
||||
|
||||
private var _showAddRemoveBtns:Boolean;
|
||||
|
||||
private var _hasBeenHidden:Boolean;
|
||||
|
||||
public function ItemWindowOriginal(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
var _loc10_:int = 0;
|
||||
var _loc11_:int = param4;
|
||||
_generatorIndex = param4;
|
||||
if(param9 != null)
|
||||
{
|
||||
_loadImmediately = param9.loadImmediately;
|
||||
_isRecycling = param9.isRecycling;
|
||||
_isViewingATradeList = param9.isViewingATradeList;
|
||||
_isECard = param9.isECard;
|
||||
_isAvatarEditor = param9.isAvatarEditor;
|
||||
_isTradeManager = param9.isTradeManager;
|
||||
_isAudio = param9.isAudio;
|
||||
_isPetItem = param9.isPetItem;
|
||||
_giftItemIdx = param9.giftItemIdx;
|
||||
_isTradeList = param9.isTradeList;
|
||||
_isChoosingForTradeList = param9.isChoosingForTradeList;
|
||||
_showAddRemoveBtns = param9.showAddRemoveBtns;
|
||||
if(param9.indexArray != null)
|
||||
{
|
||||
_loc10_ = int(param9.indexArray.length);
|
||||
_loc11_ = int(_loc10_ - 1 > param4 ? param9.indexArray[param4] : param9.indexArray[_loc10_ - 1] - param4 + param4);
|
||||
}
|
||||
}
|
||||
super("itemWindow",param1,param2,param3,_loc11_,param5,param6,param7,param8,true);
|
||||
}
|
||||
|
||||
public function get removeBtn() : MovieClip
|
||||
{
|
||||
return _window.removeBtn;
|
||||
}
|
||||
|
||||
public function get addBtn() : MovieClip
|
||||
{
|
||||
return _window.addBtn;
|
||||
}
|
||||
|
||||
public function get cir() : MovieClip
|
||||
{
|
||||
return _window.cir;
|
||||
}
|
||||
|
||||
public function get sizeCont() : MovieClip
|
||||
{
|
||||
return _window.sizeCont;
|
||||
}
|
||||
|
||||
public function get gift() : MovieClip
|
||||
{
|
||||
return _window.gift;
|
||||
}
|
||||
|
||||
public function get isDownGift() : Boolean
|
||||
{
|
||||
return _isDownGift;
|
||||
}
|
||||
|
||||
public function get isActivePet() : Boolean
|
||||
{
|
||||
return _isActivePet;
|
||||
}
|
||||
|
||||
public function get isLastPlacedAudio() : Boolean
|
||||
{
|
||||
return _isLastPlacedAudio;
|
||||
}
|
||||
|
||||
public function get isAudio() : Boolean
|
||||
{
|
||||
return _isAudio;
|
||||
}
|
||||
|
||||
public function get isUsable() : Boolean
|
||||
{
|
||||
return _currItem == null;
|
||||
}
|
||||
|
||||
public function get currItem() : Object
|
||||
{
|
||||
return _currItem;
|
||||
}
|
||||
|
||||
public function get itemName() : String
|
||||
{
|
||||
if(_currItem)
|
||||
{
|
||||
return _currItem.name;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
override public function get numChildren() : int
|
||||
{
|
||||
return _window.numChildren;
|
||||
}
|
||||
|
||||
override public function getChildAt(param1:int) : DisplayObject
|
||||
{
|
||||
return _window.getChildAt(param1);
|
||||
}
|
||||
|
||||
public function resetDownGift() : void
|
||||
{
|
||||
_window.gift.visible = false;
|
||||
_isDownGift = false;
|
||||
}
|
||||
|
||||
public function set currDownGift(param1:Object) : void
|
||||
{
|
||||
_isDownGift = true;
|
||||
_window.gift.visible = true;
|
||||
}
|
||||
|
||||
public function resetAudioDown() : void
|
||||
{
|
||||
_isLastPlacedAudio = false;
|
||||
_window.cir.gotoAndStop("up");
|
||||
}
|
||||
|
||||
public function setAudioDown() : void
|
||||
{
|
||||
_isLastPlacedAudio = true;
|
||||
_window.cir.gotoAndStop("down");
|
||||
}
|
||||
|
||||
public function get defId() : int
|
||||
{
|
||||
if(_currItem)
|
||||
{
|
||||
if(_currItem is Item)
|
||||
{
|
||||
return _currItem.defId;
|
||||
}
|
||||
return _currItem.itemDefId;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public function get avtSpecific() : MovieClip
|
||||
{
|
||||
return _window.avtSpecific;
|
||||
}
|
||||
|
||||
public function get hasBeenHidden() : Boolean
|
||||
{
|
||||
return _hasBeenHidden;
|
||||
}
|
||||
|
||||
public function removeLoadedItem() : void
|
||||
{
|
||||
_hasBeenHidden = true;
|
||||
if(_currItem)
|
||||
{
|
||||
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
|
||||
{
|
||||
if(_currItem[_iconLayerName].parent == _window.iconLayer)
|
||||
{
|
||||
_window.iconLayer.removeChild(_currItem[_iconLayerName]);
|
||||
}
|
||||
}
|
||||
else if(_currItem.parent == _window.iconLayer)
|
||||
{
|
||||
_window.iconLayer.removeChild(_currItem);
|
||||
}
|
||||
}
|
||||
resetDownGift();
|
||||
resetAudioDown();
|
||||
resetVisibility();
|
||||
super.removeEventListeners();
|
||||
}
|
||||
|
||||
public function updateWithInput(param1:*) : void
|
||||
{
|
||||
_hasBeenHidden = false;
|
||||
_currItem = param1;
|
||||
_isCurrItemLoaded = false;
|
||||
setChildrenAndInitialConditions();
|
||||
loadCurrItem();
|
||||
addEventListeners();
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(_currItem && !_isCurrItemLoaded && !_hasBeenHidden)
|
||||
{
|
||||
_isCurrItemLoaded = true;
|
||||
if(_iconLayerName != "" && _currItem.hasOwnProperty(_iconLayerName))
|
||||
{
|
||||
_window.iconLayer.addChild(_currItem[_iconLayerName]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.iconLayer.addChild(DisplayObject(_currItem));
|
||||
}
|
||||
if(_isTradeManager)
|
||||
{
|
||||
if(_currItem is Item)
|
||||
{
|
||||
_loc3_ = _currItem;
|
||||
_currItem = _loc3_.clone();
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = _currItem;
|
||||
_currItem = _loc3_.clone();
|
||||
}
|
||||
}
|
||||
if(_currItem.isMemberOnly)
|
||||
{
|
||||
if(!gMainFrame.userInfo.isMember)
|
||||
{
|
||||
_window.lock.visible = true;
|
||||
if(!isSpecialList())
|
||||
{
|
||||
_window.gray.visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.lockOpen.visible = true;
|
||||
}
|
||||
}
|
||||
if(_currItem.isOcean)
|
||||
{
|
||||
_window.ocean.visible = true;
|
||||
}
|
||||
if(_currItem.isRareDiamond)
|
||||
{
|
||||
_window.rareDiamondTag.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_currItem.isRare)
|
||||
{
|
||||
_window.rare.visible = true;
|
||||
}
|
||||
_window.diamond.visible = _currItem.isDiamond;
|
||||
}
|
||||
if(_showAddRemoveBtns && (_isTradeList || _isTradeManager))
|
||||
{
|
||||
_window.removeBtn.visible = true;
|
||||
_window.addBtn.visible = false;
|
||||
}
|
||||
if(_isPetItem && _currItem.invIdx == PetManager.myActivePetInvId)
|
||||
{
|
||||
_window.cir.gotoAndStop("green");
|
||||
_isActivePet = true;
|
||||
}
|
||||
if(_currItem is Item)
|
||||
{
|
||||
if(_currItem.getInUse(gMainFrame.userInfo.myPerUserAvId))
|
||||
{
|
||||
_window.cir.gotoAndStop("down");
|
||||
}
|
||||
}
|
||||
else if(_currItem is DenItem)
|
||||
{
|
||||
if(_currItem.categoryId != 0 && !_isActivePet)
|
||||
{
|
||||
_isLastPlacedAudio = true;
|
||||
_window.cir.gotoAndStop("down");
|
||||
}
|
||||
}
|
||||
if(_isECard)
|
||||
{
|
||||
if(_giftItemIdx == _currItem.invIdx)
|
||||
{
|
||||
this.gift.visible = true;
|
||||
_isDownGift = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(_currItem == null)
|
||||
{
|
||||
_isCurrItemLoaded = false;
|
||||
resetVisibility();
|
||||
resetDownGift();
|
||||
resetAudioDown();
|
||||
if(_showAddRemoveBtns && (_isTradeList || _isTradeManager))
|
||||
{
|
||||
_window.addBtn.visible = true;
|
||||
}
|
||||
while(_window.iconLayer.numChildren > 1)
|
||||
{
|
||||
_window.iconLayer.removeChildAt(_window.iconLayer.numChildren - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
resetVisibility();
|
||||
if(_currItem)
|
||||
{
|
||||
if(!_spiral)
|
||||
{
|
||||
_spiral = new LoadingSpiral(_window.iconLayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
_spiral.setNewParent(_window.iconLayer);
|
||||
}
|
||||
if(!_currItem.isIconLoaded)
|
||||
{
|
||||
_currItem.imageLoadedCallback = _spiral.destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
_spiral.destroy();
|
||||
}
|
||||
if(_loadImmediately)
|
||||
{
|
||||
loadCurrItem();
|
||||
}
|
||||
}
|
||||
else if(_showAddRemoveBtns && (_isTradeList || _isTradeManager))
|
||||
{
|
||||
_window.addBtn.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
override protected function onWindowLoadCallback() : void
|
||||
{
|
||||
if(_windowLoadedCallback != null)
|
||||
{
|
||||
_windowLoadedCallback(this,_generatorIndex);
|
||||
}
|
||||
}
|
||||
|
||||
override protected function addEventListeners() : void
|
||||
{
|
||||
if(_window && _currItem)
|
||||
{
|
||||
if(_mouseDown != null && !(_currItem.isMemberOnly && _memberOnlyDown != null && !gMainFrame.userInfo.isMember && !isSpecialList()))
|
||||
{
|
||||
addEventListener("mouseDown",_mouseDown,false,0,true);
|
||||
}
|
||||
if(_mouseOver != null)
|
||||
{
|
||||
addEventListener("rollOver",_mouseOver,false,0,true);
|
||||
if(_useToolTip)
|
||||
{
|
||||
addEventListener("rollOver",onWindowRollOver,false,0,true);
|
||||
}
|
||||
}
|
||||
if(_mouseOut != null)
|
||||
{
|
||||
addEventListener("rollOut",_mouseOut,false,0,true);
|
||||
if(_useToolTip)
|
||||
{
|
||||
addEventListener("rollOut",onWindowRollOut,false,0,true);
|
||||
}
|
||||
}
|
||||
if(_memberOnlyDown != null && _currItem.isMemberOnly && !gMainFrame.userInfo.isMember && !isSpecialList())
|
||||
{
|
||||
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
|
||||
}
|
||||
}
|
||||
else if(_showAddRemoveBtns && (_isTradeList || _isTradeManager))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function isSpecialList() : Boolean
|
||||
{
|
||||
return _isTradeList || _isTradeManager || _isChoosingForTradeList || _isViewingATradeList || _isECard || _isRecycling;
|
||||
}
|
||||
|
||||
private function resetVisibility() : void
|
||||
{
|
||||
_window.lock.visible = false;
|
||||
_window.lockOpen.visible = false;
|
||||
_window.gray.visible = false;
|
||||
_window.gift.visible = false;
|
||||
_window.addBtn.visible = false;
|
||||
_window.removeBtn.visible = false;
|
||||
_window.ocean.visible = false;
|
||||
_window.rare.visible = false;
|
||||
_window.avtSpecific.visible = false;
|
||||
_window.avtSpecificIcon.visible = false;
|
||||
_window.avtSpecificHighlight.visible = false;
|
||||
_window.rareDiamondTag.visible = false;
|
||||
_window.diamond.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
package gui
|
||||
{
|
||||
import Party.PartyManager;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class ItemWindowParty extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _defId:int;
|
||||
|
||||
private var _isGame:Boolean;
|
||||
|
||||
private var _additionalIndex:int;
|
||||
|
||||
private var _partyDef:Object;
|
||||
|
||||
private var _printTimeFunc:Function;
|
||||
|
||||
private var _creatorName:String;
|
||||
|
||||
private var _customPartyName:String = "";
|
||||
|
||||
private var _customPartyTimeLeft:Number = 0;
|
||||
|
||||
private var _isCustom:Boolean;
|
||||
|
||||
public function ItemWindowParty(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
var _loc10_:int = 0;
|
||||
_additionalIndex = param9.additionalIndex;
|
||||
_printTimeFunc = param9.printTimeFunc;
|
||||
if(param2 != null && !(param2 is int))
|
||||
{
|
||||
_creatorName = param2.creator;
|
||||
_customPartyName = param2.name;
|
||||
_customPartyTimeLeft = param2.timeLeft;
|
||||
_partyDef = PartyManager.getPartyDef(param2.defId);
|
||||
_loc10_ = int(_partyDef.mediaRefId);
|
||||
param2 = param2.defId;
|
||||
_useToolTip = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc10_ = int(param9.mediaRefId[param4]);
|
||||
}
|
||||
super(_loc10_,param1,param2,param3,param4,param5,param6,param7,param8,_useToolTip);
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
_window.anims.mouseEnabled = false;
|
||||
_window.anims.mouseChildren = false;
|
||||
_window.txt.mouseEnabled = false;
|
||||
_window.txt.mouseChildren = false;
|
||||
if(_currItem || _partyDef != null)
|
||||
{
|
||||
if(_partyDef == null)
|
||||
{
|
||||
_partyDef = PartyManager.getPartyDef(_currItem as int);
|
||||
}
|
||||
_defId = int(_partyDef.id);
|
||||
_isGame = _partyDef.isGame == "1";
|
||||
_isCustom = _partyDef.isCustom == "1";
|
||||
setupTextAndAnims(_printTimeFunc != null ? _printTimeFunc(_isCustom ? _customPartyTimeLeft : index) : "");
|
||||
if(_customPartyName != "")
|
||||
{
|
||||
titleTextWithString = _customPartyName;
|
||||
}
|
||||
else
|
||||
{
|
||||
titleText = _partyDef.titleStrId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override protected function addEventListeners() : void
|
||||
{
|
||||
if(_window)
|
||||
{
|
||||
if(_mouseDown != null && !(_memberOnlyDown != null && !gMainFrame.userInfo.isMember))
|
||||
{
|
||||
addEventListener("mouseDown",_mouseDown,false,0,true);
|
||||
}
|
||||
if(_useToolTip)
|
||||
{
|
||||
addEventListener("rollOver",onWindowRollOver,false,0,true);
|
||||
addEventListener("rollOut",onWindowRollOut,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override protected function onWindowRollOver(param1:MouseEvent) : void
|
||||
{
|
||||
if(_windowGenerator == null)
|
||||
{
|
||||
if(this.parent.parent is WindowGenerator)
|
||||
{
|
||||
_windowGenerator = WindowGenerator(this.parent.parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
_windowGenerator = WindowAndScrollbarGenerator(this.parent.parent);
|
||||
}
|
||||
}
|
||||
if(_windowGenerator.isIndexInView(_visibilityIndex))
|
||||
{
|
||||
_windowGenerator.toolTip.init(_windowGenerator.parent.parent,_printTimeFunc != null ? _printTimeFunc(_isCustom ? _customPartyTimeLeft : index) : "",this.x + _windowGenerator.boxWidth * 0.5 - _itemXLocation + _windowGenerator.parent.x,this.y + _windowGenerator.boxHeight - _itemYLocation + _windowGenerator.parent.y);
|
||||
_windowGenerator.toolTip.startTimer(param1);
|
||||
}
|
||||
}
|
||||
|
||||
override protected function onWindowRollOut(param1:MouseEvent) : void
|
||||
{
|
||||
_windowGenerator.toolTip.resetTimerAndSetVisibility();
|
||||
}
|
||||
|
||||
public function setupTextAndAnims(param1:String) : void
|
||||
{
|
||||
if(_window)
|
||||
{
|
||||
if(_customPartyName != "")
|
||||
{
|
||||
_window.goBtn.visible = true;
|
||||
}
|
||||
else if(param1 != "")
|
||||
{
|
||||
_window.goBtn.visible = false;
|
||||
if(_window.txt.timeTxt)
|
||||
{
|
||||
LocalizationManager.updateToFit(_window.txt.timeTxt,param1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.goBtn.visible = true;
|
||||
if(_window.txt.timeTxt)
|
||||
{
|
||||
_window.txt.timeTxt.visible = false;
|
||||
}
|
||||
_window.anims.animate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get additionalIndex() : int
|
||||
{
|
||||
return _additionalIndex;
|
||||
}
|
||||
|
||||
public function get txt() : MovieClip
|
||||
{
|
||||
return _window.txt;
|
||||
}
|
||||
|
||||
public function set titleText(param1:int) : void
|
||||
{
|
||||
if(_window.txt.titleTxtCont.hasOwnProperty("titleTxt"))
|
||||
{
|
||||
LocalizationManager.translateId(_window.txt.titleTxtCont.titleTxt,param1);
|
||||
}
|
||||
}
|
||||
|
||||
public function set titleTextWithString(param1:String) : void
|
||||
{
|
||||
if(_window.txt.titleTxtCont.hasOwnProperty("titleTxt"))
|
||||
{
|
||||
LocalizationManager.updateToFit(_window.txt.titleTxtCont.titleTxt,param1);
|
||||
}
|
||||
}
|
||||
|
||||
public function set defId(param1:int) : void
|
||||
{
|
||||
_defId = param1;
|
||||
}
|
||||
|
||||
public function get defId() : int
|
||||
{
|
||||
return _defId;
|
||||
}
|
||||
|
||||
public function set isGame(param1:Boolean) : void
|
||||
{
|
||||
_isGame = param1;
|
||||
}
|
||||
|
||||
public function get isGame() : Boolean
|
||||
{
|
||||
return _isGame;
|
||||
}
|
||||
|
||||
public function get timeLeft() : int
|
||||
{
|
||||
return _customPartyTimeLeft;
|
||||
}
|
||||
|
||||
public function get sizeCont() : MovieClip
|
||||
{
|
||||
return _window.sizeCont;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package gui
|
||||
{
|
||||
public class ItemWindowPattern extends ItemWindowBase
|
||||
{
|
||||
|
||||
public static const TYPE_SWATCH:String = "swatch";
|
||||
|
||||
public static const TYPE_MESSAGE:String = "message";
|
||||
|
||||
public static const TYPE_POST:String = "post";
|
||||
|
||||
private var _type:String;
|
||||
|
||||
private var _patternIndexOrName:Object;
|
||||
|
||||
private var _colorIndexOrName:Object;
|
||||
|
||||
public function ItemWindowPattern(param1:Function, param2:Object, param3:String, param4:int, param5:Function, param6:Function, param7:Function, param8:Function, param9:Object)
|
||||
{
|
||||
_type = param9.type;
|
||||
_patternIndexOrName = param9.patternIndex != null ? param9.patternIndex : param4 + 1;
|
||||
_colorIndexOrName = param9.colorIndex != null ? param9.colorIndex : 1;
|
||||
super(param2,param1,param2,param3,param4,param5,param6,param7,param8,false);
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
if(_window)
|
||||
{
|
||||
_window.gotoAndStop(_type);
|
||||
_window[_type + "Btn"].gotoAndStop(_colorIndexOrName);
|
||||
if(_window[_type + "Btn"].messageBodyCont != null)
|
||||
{
|
||||
_window[_type + "Btn"].messageBodyCont.gotoAndStop(_colorIndexOrName);
|
||||
}
|
||||
_window[_type + "Btn"].pattern.gotoAndStop(_patternIndexOrName);
|
||||
}
|
||||
}
|
||||
|
||||
public function getCurrentPatternIndex() : int
|
||||
{
|
||||
return _window[_type + "Btn"].pattern.currentFrame;
|
||||
}
|
||||
|
||||
public function setPatternAndColor(param1:Object, param2:Object) : void
|
||||
{
|
||||
_colorIndexOrName = param2;
|
||||
_patternIndexOrName = param1;
|
||||
setChildrenAndInitialConditions();
|
||||
}
|
||||
|
||||
public function setColor(param1:Object) : void
|
||||
{
|
||||
_colorIndexOrName = param1;
|
||||
setChildrenAndInitialConditions();
|
||||
}
|
||||
|
||||
public function setPattern(param1:Object) : void
|
||||
{
|
||||
_patternIndexOrName = param1;
|
||||
setChildrenAndInitialConditions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.AvatarManager;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import pet.GuiPet;
|
||||
import pet.PetManager;
|
||||
|
||||
public class ItemWindowPets extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _isRecycling:Boolean;
|
||||
|
||||
private var _currGuiPet:GuiPet;
|
||||
|
||||
public function ItemWindowPets(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_isRecycling = param9.isRecycling;
|
||||
super("itemWindowPets",param1,param2,param3,param4,param5,param6,param7,param8,true);
|
||||
}
|
||||
|
||||
public function get cir() : MovieClip
|
||||
{
|
||||
return _window.cir;
|
||||
}
|
||||
|
||||
public function get gray() : MovieClip
|
||||
{
|
||||
return _window.gray;
|
||||
}
|
||||
|
||||
public function get cageIcon() : MovieClip
|
||||
{
|
||||
return _window.cageIcon;
|
||||
}
|
||||
|
||||
public function get newPetIcon() : MovieClip
|
||||
{
|
||||
return _window.newPet;
|
||||
}
|
||||
|
||||
public function get hasPet() : Boolean
|
||||
{
|
||||
return _currItem;
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
if(_currGuiPet)
|
||||
{
|
||||
_currGuiPet.destroy();
|
||||
_currGuiPet = null;
|
||||
}
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
var _loc3_:Object = null;
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(_currItem && !_isCurrItemLoaded)
|
||||
{
|
||||
_loc3_ = PetManager.getPetDef(_currItem.defId);
|
||||
_currGuiPet = new GuiPet(_currItem.idx,_currItem.lBits,_currItem.uBits,_currItem.eBits,_currItem.type,_currItem.name,null);
|
||||
_window.cageIcon.visible = _isRecycling;
|
||||
_window.ocean.visible = _currGuiPet.canGoInOcean();
|
||||
if(!gMainFrame.userInfo.isMember)
|
||||
{
|
||||
_window.lockOpen.visible = false;
|
||||
if(_loc3_.isMember)
|
||||
{
|
||||
_window.gray.visible = true;
|
||||
_window.lock.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.lock.visible = false;
|
||||
_window.gray.visible = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.lock.visible = false;
|
||||
_window.gray.visible = false;
|
||||
if(_loc3_.isMember)
|
||||
{
|
||||
_window.lockOpen.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.lockOpen.visible = false;
|
||||
}
|
||||
}
|
||||
_window.newPet.visible = false;
|
||||
if(!PetManager.canCurrAvatarUsePet(AvatarManager.playerAvatar.enviroTypeFlag,_loc3_.type))
|
||||
{
|
||||
_window.gray.visible = true;
|
||||
}
|
||||
else if(PetManager.myActivePetInvId == _currGuiPet.idx)
|
||||
{
|
||||
_window.cir.gotoAndStop("down");
|
||||
}
|
||||
_currGuiPet.scaleX = _currGuiPet.scaleY = 2;
|
||||
_isCurrItemLoaded = true;
|
||||
_window.iconLayer.addChild(_currGuiPet);
|
||||
}
|
||||
if(_spiral)
|
||||
{
|
||||
_spiral.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
_spiral = new LoadingSpiral(_window.iconLayer);
|
||||
_window.lockOpen.visible = false;
|
||||
_window.lock.visible = false;
|
||||
_window.gray.visible = false;
|
||||
_window.ocean.visible = false;
|
||||
_window.cageIcon.visible = false;
|
||||
_window.newPet.gray.visible = false;
|
||||
}
|
||||
|
||||
override protected function addEventListeners() : void
|
||||
{
|
||||
if(_window)
|
||||
{
|
||||
if(_mouseDown != null && !(_memberOnlyDown != null && !gMainFrame.userInfo.isMember))
|
||||
{
|
||||
addEventListener("mouseDown",_mouseDown,false,0,true);
|
||||
}
|
||||
if(_mouseOver != null && _currItem)
|
||||
{
|
||||
addEventListener("rollOver",_mouseOver,false,0,true);
|
||||
if(_useToolTip)
|
||||
{
|
||||
addEventListener("rollOver",onWindowRollOver,false,0,true);
|
||||
}
|
||||
}
|
||||
if(_mouseOut != null && _currItem)
|
||||
{
|
||||
addEventListener("rollOut",_mouseOut,false,0,true);
|
||||
if(_useToolTip)
|
||||
{
|
||||
addEventListener("rollOut",onWindowRollOut,false,0,true);
|
||||
}
|
||||
}
|
||||
if(_memberOnlyDown != null && !gMainFrame.userInfo.isMember)
|
||||
{
|
||||
addEventListener("mouseDown",_memberOnlyDown,false,0,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override protected function onWindowRollOver(param1:MouseEvent) : void
|
||||
{
|
||||
if(_useToolTip && this.parent != null)
|
||||
{
|
||||
if(_windowGenerator == null)
|
||||
{
|
||||
_windowGenerator = WindowGenerator(this.parent.parent);
|
||||
}
|
||||
_windowGenerator.toolTip.init(_windowGenerator.parent.parent,_currGuiPet.petName,this.x + _windowGenerator.boxWidth * 0.5 + _windowGenerator.parent.x + _itemXLocation,this.y + _windowGenerator.boxHeight - _itemYLocation + _windowGenerator.parent.y - 5);
|
||||
_windowGenerator.toolTip.startTimer(param1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package gui
|
||||
{
|
||||
public class ItemWindowPlayerWallDecor extends ItemWindowBase
|
||||
{
|
||||
|
||||
public function ItemWindowPlayerWallDecor(param1:Function, param2:Object, param3:String, param4:int, param5:Function, param6:Function, param7:Function, param8:Function, param9:Boolean = false)
|
||||
{
|
||||
super(param2,param1,null,param3,param4,param5,param6,param7,param8,param9);
|
||||
}
|
||||
|
||||
override protected function addEventListeners() : void
|
||||
{
|
||||
if(_mouseDown != null)
|
||||
{
|
||||
addEventListener("mouseDown",_mouseDown,false,0,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,317 @@
|
||||
package gui
|
||||
{
|
||||
import avatar.Avatar;
|
||||
import avatar.AvatarUtility;
|
||||
import avatar.AvatarView;
|
||||
import avatar.AvatarXtCommManager;
|
||||
import buddy.Buddy;
|
||||
import com.sbi.corelib.input.SBTextField;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.geom.Point;
|
||||
import item.Item;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
import playerWall.PostMessage;
|
||||
|
||||
public class ItemWindowPost extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _iconMediaHelper:MediaHelper;
|
||||
|
||||
private var _onReportDown:Function;
|
||||
|
||||
private var _onDeleteDown:Function;
|
||||
|
||||
private var _smileyText:SBTextField;
|
||||
|
||||
private var _isMyPost:Boolean;
|
||||
|
||||
private var _patternWindow:ItemWindowPattern;
|
||||
|
||||
public function ItemWindowPost(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_onReportDown = param9.reportMsgBtnMouseDown;
|
||||
_onDeleteDown = param9.deleteMsgBtnMouseDown;
|
||||
_isMyPost = param9.isMyPost;
|
||||
tabEnabled = false;
|
||||
super(1501,param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
public function get msgId() : String
|
||||
{
|
||||
return _currItem.msgId;
|
||||
}
|
||||
|
||||
public function get senderUserName() : String
|
||||
{
|
||||
return _currItem.senderUserName;
|
||||
}
|
||||
|
||||
public function get senderModeratedUserName() : String
|
||||
{
|
||||
return _currItem.senderModeratedUserName;
|
||||
}
|
||||
|
||||
public function get sizeCont() : MovieClip
|
||||
{
|
||||
return MovieClip(_window.parent).sizeCont;
|
||||
}
|
||||
|
||||
public function darken(param1:Boolean) : void
|
||||
{
|
||||
if(_window)
|
||||
{
|
||||
_window.darkCont.visible = param1;
|
||||
}
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
var _loc2_:Number = new Date().valueOf();
|
||||
_loc2_ += Utility.getTimeOffset();
|
||||
var _loc1_:Object = Utility.calculateTime((_loc2_ - _currItem.postTime) / 1000);
|
||||
if(_loc1_.mins < 0)
|
||||
{
|
||||
_loc1_.mins = 0;
|
||||
}
|
||||
if(_loc1_.mins == 0 && _loc1_.hours < 1 && _loc1_.days < 1)
|
||||
{
|
||||
_window.timeTxt.text = Utility.calculatePrintTimeToNearest(_loc1_.mins,_loc1_.hours,true,_loc1_.days);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalizationManager.translateIdAndInsert(_window.timeTxt,11360,Utility.calculatePrintTimeToNearest(_loc1_.mins,_loc1_.hours,true,_loc1_.days));
|
||||
}
|
||||
}
|
||||
|
||||
public function updateWithInput(param1:PostMessage) : void
|
||||
{
|
||||
if(_smileyText && param1)
|
||||
{
|
||||
_smileyText.text = param1.message;
|
||||
}
|
||||
}
|
||||
|
||||
override public function destroy() : void
|
||||
{
|
||||
removeEventListeners();
|
||||
if(_iconMediaHelper)
|
||||
{
|
||||
_iconMediaHelper.destroy();
|
||||
_iconMediaHelper = null;
|
||||
}
|
||||
_onReportDown = null;
|
||||
_onDeleteDown = null;
|
||||
if(_smileyText)
|
||||
{
|
||||
_smileyText.destroy();
|
||||
_smileyText = null;
|
||||
}
|
||||
_window = null;
|
||||
_windowLoadedCallback = null;
|
||||
_currItem = null;
|
||||
_mouseDown = null;
|
||||
_mouseOver = null;
|
||||
_mouseOut = null;
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(_currItem && !_isCurrItemLoaded)
|
||||
{
|
||||
if(!_spiral)
|
||||
{
|
||||
_spiral = new LoadingSpiral(_window.iconLayer);
|
||||
}
|
||||
else
|
||||
{
|
||||
_spiral.setNewParent(_window.iconLayer);
|
||||
}
|
||||
_smileyText = new SBTextField(null,_window.messageTxt,_window.textItemHolder,true);
|
||||
_smileyText.text = _currItem.message;
|
||||
_smileyText.mouseChildren = false;
|
||||
_smileyText.mouseEnabled = false;
|
||||
_smileyText.selectable = false;
|
||||
if(!_isMyPost)
|
||||
{
|
||||
_window.reportMessageBtn.x += _window.reportMessageBtn.width;
|
||||
}
|
||||
_isCurrItemLoaded = true;
|
||||
setupCurrAvtImage();
|
||||
}
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
if(_currItem)
|
||||
{
|
||||
if(_currItem.senderUserName.toLowerCase() == gMainFrame.userInfo.myUserName.toLowerCase())
|
||||
{
|
||||
_window.gotoAndStop("player");
|
||||
_window = _window.player;
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.gotoAndStop("buddies");
|
||||
_window = _window.buddies;
|
||||
}
|
||||
darken(false);
|
||||
loadPostPattern();
|
||||
_window.reportMessageBtn.visible = false;
|
||||
_window.deleteMessageBtn.visible = false;
|
||||
_window.gotoAndStop(_currItem.colorId);
|
||||
_window.messageTxt.text = "";
|
||||
_window.messageTxt.selectable = false;
|
||||
_window.nameTxt.text = _currItem.senderModeratedUserName;
|
||||
_window.timeTxt.autoSize = "right";
|
||||
if(_currItem.isBuddy && _currItem.senderUserName.toLowerCase() != gMainFrame.userInfo.myUserName.toLowerCase())
|
||||
{
|
||||
_window.buddyIcon.visible = true;
|
||||
_window.nameTxt.x += _window.buddyIcon.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.buddyIcon.visible = false;
|
||||
}
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
override protected function addEventListeners() : void
|
||||
{
|
||||
if(_isMyPost)
|
||||
{
|
||||
_window.deleteMessageBtn.addEventListener("mouseDown",_onDeleteDown,false,0,true);
|
||||
}
|
||||
_window.reportMessageBtn.addEventListener("mouseDown",_onReportDown,false,0,true);
|
||||
_window.darkCont.addEventListener("mouseDown",onDarkCont,false,0,true);
|
||||
addEventListener("rollOver",onPostRollOverOut,false,0,true);
|
||||
addEventListener("rollOut",onPostRollOverOut,false,0,true);
|
||||
addEventListener("mouseDown",onPostDown,false,0,true);
|
||||
}
|
||||
|
||||
override protected function removeEventListeners() : void
|
||||
{
|
||||
if(_isMyPost)
|
||||
{
|
||||
_window.deleteMessageBtn.removeEventListener("mouseDown",_onDeleteDown);
|
||||
}
|
||||
_window.reportMessageBtn.removeEventListener("mouseDown",_onReportDown);
|
||||
_window.darkCont.removeEventListener("mouseDown",onDarkCont);
|
||||
removeEventListener("rollOver",onPostRollOverOut);
|
||||
removeEventListener("rollOut",onPostRollOverOut);
|
||||
removeEventListener("mouseDown",onPostDown);
|
||||
}
|
||||
|
||||
private function onDarkCont(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onPostDown(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_window && _currItem.senderUserName.toLowerCase() != gMainFrame.userInfo.myUserName.toLowerCase())
|
||||
{
|
||||
BuddyList.requestBuddyListIfNeeded(onBuddyListRequested);
|
||||
}
|
||||
}
|
||||
|
||||
private function onBuddyListRequested() : void
|
||||
{
|
||||
var _loc1_:Buddy = BuddyManager.getBuddyByUserName(_currItem.senderUserName);
|
||||
if(_loc1_)
|
||||
{
|
||||
BuddyCard.showBuddyCard({
|
||||
"userName":_loc1_.userName,
|
||||
"onlineStatus":_loc1_.onlineStatus
|
||||
});
|
||||
return;
|
||||
}
|
||||
AvatarXtCommManager.requestAvatarGet(_currItem.senderUserName,onUserLookUpReceived,true);
|
||||
}
|
||||
|
||||
private function onUserLookUpReceived(param1:String, param2:Boolean, param3:int) : void
|
||||
{
|
||||
if(param2)
|
||||
{
|
||||
BuddyCard.showBuddyCard({
|
||||
"userName":param1,
|
||||
"onlineStatus":param3
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private function onPostRollOverOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_window)
|
||||
{
|
||||
if(_window.messageHighlight.currentFrameLabel != "on")
|
||||
{
|
||||
_window.messageHighlight.gotoAndStop("on");
|
||||
_window.reportMessageBtn.visible = _currItem.senderUserName != gMainFrame.userInfo.myUserName;
|
||||
if(_isMyPost)
|
||||
{
|
||||
_window.deleteMessageBtn.visible = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.messageHighlight.gotoAndStop("off");
|
||||
_window.reportMessageBtn.visible = false;
|
||||
if(_isMyPost)
|
||||
{
|
||||
_window.deleteMessageBtn.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function loadPostPattern() : void
|
||||
{
|
||||
_patternWindow = new ItemWindowPattern(null,3983,"",0,null,null,null,null,{
|
||||
"type":"message",
|
||||
"colorIndex":_currItem.colorId,
|
||||
"patternIndex":_currItem.patternId
|
||||
});
|
||||
_window.messageBodyHolder.addChild(_patternWindow);
|
||||
}
|
||||
|
||||
private function setupCurrAvtImage() : void
|
||||
{
|
||||
var _loc3_:Avatar = new Avatar();
|
||||
_loc3_.init(-1,"",_currItem.avtDefId,_currItem.avtColors,_currItem.avtCustomId,null,_currItem.senderUserName);
|
||||
var _loc1_:Array = [];
|
||||
var _loc5_:Item = new Item();
|
||||
_loc1_[0] = _loc5_;
|
||||
_loc5_.init(1,1,0,-1,-1);
|
||||
_loc5_ = new Item();
|
||||
_loc1_[1] = _loc5_;
|
||||
_loc5_.init(_currItem.avtEyeDefId > 0 ? _currItem.avtEyeDefId : 2,2,0,-1,-1);
|
||||
var _loc2_:Object = gMainFrame.userInfo.getAvatarDefByAvatar(_loc3_);
|
||||
if(_currItem.avtCustomId != -1 && _loc2_)
|
||||
{
|
||||
_currItem.avtPatternDefId = _loc2_.patternRefId;
|
||||
}
|
||||
if(_currItem.avtPatternDefId > 0)
|
||||
{
|
||||
_loc5_ = new Item();
|
||||
_loc1_[2] = _loc5_;
|
||||
_loc5_.init(_currItem.avtPatternDefId,3,0,-1,-1);
|
||||
}
|
||||
_loc3_.itemResponseIntegrate(_loc1_);
|
||||
var _loc4_:AvatarView = new AvatarView();
|
||||
_loc4_.init(_loc3_,null);
|
||||
_loc4_.playAnim(15,false,1,null);
|
||||
var _loc6_:Point = AvatarUtility.getAvatarHudPosition(_loc4_.avTypeId);
|
||||
_loc4_.x = _loc6_.x + _window.charCont.width * 0.5;
|
||||
_loc4_.y = _loc6_.y + _window.charCont.height * 0.5;
|
||||
_window.charCont.charLayer.addChild(_loc4_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package gui
|
||||
{
|
||||
import currency.UserCurrency;
|
||||
|
||||
public class ItemWindowSatchel extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _count:int;
|
||||
|
||||
private var _scale:Number = 1;
|
||||
|
||||
private var _frame:String = "shop";
|
||||
|
||||
public function ItemWindowSatchel(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
_count = UserCurrency.getCurrency(UserCurrency.usableCraftTypes[param4]);
|
||||
if(param9)
|
||||
{
|
||||
_scale = param9.scale;
|
||||
_frame = param9.frame;
|
||||
}
|
||||
super(param2,param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
if(_window.currentFrameLabel != _frame)
|
||||
{
|
||||
_window.gotoAndStop(_frame);
|
||||
}
|
||||
if(_window.scaleX != _scale)
|
||||
{
|
||||
_window.scaleX = _window.scaleY = _scale;
|
||||
}
|
||||
_window.txt.text = Utility.convertNumberToString(_count);
|
||||
}
|
||||
|
||||
public function update() : void
|
||||
{
|
||||
_count = UserCurrency.getCurrency(UserCurrency.usableCraftTypes[index]);
|
||||
setChildrenAndInitialConditions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.text.TextField;
|
||||
|
||||
public class ItemWindowServer extends ItemWindowBase
|
||||
{
|
||||
|
||||
public function ItemWindowServer(param1:Function, param2:MovieClip, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
super("serverBarSml",param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
_window.txt.mouseEnabled = false;
|
||||
_window.buddy.mouseEnabled = false;
|
||||
_window.g1.mouseEnabled = false;
|
||||
_window.g2.mouseEnabled = false;
|
||||
_window.g3.mouseEnabled = false;
|
||||
_window.o1.mouseEnabled = false;
|
||||
_window.o2.mouseEnabled = false;
|
||||
_window.o3.mouseEnabled = false;
|
||||
_window.full.mouseEnabled = false;
|
||||
_window.full.mouseChildren = false;
|
||||
}
|
||||
|
||||
public function get full() : Boolean
|
||||
{
|
||||
return _window.full.visible;
|
||||
}
|
||||
|
||||
public function set text(param1:String) : void
|
||||
{
|
||||
_window.txt.text = param1;
|
||||
}
|
||||
|
||||
public function get textField() : TextField
|
||||
{
|
||||
return _window.txt;
|
||||
}
|
||||
|
||||
public function set buddy(param1:Boolean) : void
|
||||
{
|
||||
_window.buddy.visible = param1;
|
||||
}
|
||||
|
||||
public function set flag(param1:int) : void
|
||||
{
|
||||
_window.flag.gotoAndStop(param1);
|
||||
}
|
||||
|
||||
public function set population(param1:String) : void
|
||||
{
|
||||
switch(param1)
|
||||
{
|
||||
case "0":
|
||||
_window.full.visible = false;
|
||||
_window.o1.visible = false;
|
||||
_window.o2.visible = false;
|
||||
_window.o3.visible = false;
|
||||
break;
|
||||
case "1":
|
||||
_window.o1.visible = true;
|
||||
_window.o2.visible = false;
|
||||
_window.o3.visible = false;
|
||||
_window.full.visible = false;
|
||||
break;
|
||||
case "2":
|
||||
_window.o1.visible = true;
|
||||
_window.o2.visible = true;
|
||||
_window.o3.visible = false;
|
||||
_window.full.visible = false;
|
||||
break;
|
||||
case "3":
|
||||
_window.o1.visible = true;
|
||||
_window.o2.visible = true;
|
||||
_window.o3.visible = true;
|
||||
_window.full.visible = false;
|
||||
break;
|
||||
case "4":
|
||||
_window.full.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
override protected function addEventListeners() : void
|
||||
{
|
||||
if(_window)
|
||||
{
|
||||
if(_mouseDown != null)
|
||||
{
|
||||
addEventListener("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,36 @@
|
||||
package gui
|
||||
{
|
||||
import flash.text.TextField;
|
||||
|
||||
public class ItemWindowSpecialText extends ItemWindowBase
|
||||
{
|
||||
|
||||
public function ItemWindowSpecialText(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
super("specialCharHighlightCont",param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
if(_currItem)
|
||||
{
|
||||
_window.txt.text = _currItem;
|
||||
}
|
||||
_window.txt.mouseEnabled = false;
|
||||
_window.up.mouseEnabled = false;
|
||||
_window.up.visible = false;
|
||||
}
|
||||
|
||||
public function get txt() : TextField
|
||||
{
|
||||
return _window.txt;
|
||||
}
|
||||
|
||||
public function setText(param1:String) : void
|
||||
{
|
||||
_currItem = param1;
|
||||
_window.txt.text = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package gui
|
||||
{
|
||||
import ecard.ECardImageBase;
|
||||
|
||||
public class ItemWindowStamp extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var stampImageBase:ECardImageBase;
|
||||
|
||||
public function ItemWindowStamp(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
super("StampBtn",param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(_currItem && !_isCurrItemLoaded)
|
||||
{
|
||||
_isCurrItemLoaded = true;
|
||||
stampImageBase = new ECardImageBase();
|
||||
stampImageBase.init(int(_currItem),onImageLoaded);
|
||||
}
|
||||
}
|
||||
|
||||
private function onImageLoaded() : void
|
||||
{
|
||||
if(_iconLayerName != "" && stampImageBase.hasOwnProperty(_iconLayerName))
|
||||
{
|
||||
_window.imgLayer.addChild(stampImageBase[_iconLayerName]);
|
||||
}
|
||||
stampImageBase[_iconLayerName].scaleX = 0.6;
|
||||
stampImageBase[_iconLayerName].scaleY = 0.6;
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package gui
|
||||
{
|
||||
import flash.text.TextField;
|
||||
|
||||
public class ItemWindowTextBar extends ItemWindowBase
|
||||
{
|
||||
|
||||
public function ItemWindowTextBar(param1:Function, param2:String, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
super("userDenBtnCont",param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
_itemYLocation = param1;
|
||||
_itemXLocation = param2;
|
||||
if(_currItem)
|
||||
{
|
||||
_window.txt.text = _currItem;
|
||||
}
|
||||
}
|
||||
|
||||
public function get txt() : TextField
|
||||
{
|
||||
return _window.txt;
|
||||
}
|
||||
|
||||
public function setText(param1:String) : void
|
||||
{
|
||||
_currItem = param1;
|
||||
_window.txt.text = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package gui
|
||||
{
|
||||
import flash.events.MouseEvent;
|
||||
|
||||
public class ItemWindowTextNode extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _originalText:String;
|
||||
|
||||
public function ItemWindowTextNode(param1:Function, param2:String, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
super("chatTextNode",param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
if(_currItem)
|
||||
{
|
||||
setupText();
|
||||
}
|
||||
addEventListener("rollOver",onRollOver,false,0,true);
|
||||
addEventListener("rollOut",onRollOut,false,0,true);
|
||||
}
|
||||
|
||||
override protected function removeEventListeners() : void
|
||||
{
|
||||
removeEventListener("rollOver",onRollOver);
|
||||
removeEventListener("rollOut",onRollOut);
|
||||
super.removeEventListeners();
|
||||
}
|
||||
|
||||
public function get text() : String
|
||||
{
|
||||
return _originalText;
|
||||
}
|
||||
|
||||
public function updateToBeCentered(param1:int) : void
|
||||
{
|
||||
_window.x += (param1 - _window.width) * 0.5;
|
||||
}
|
||||
|
||||
private function setupText() : void
|
||||
{
|
||||
var _loc2_:int = 0;
|
||||
var _loc1_:String = null;
|
||||
_window.txt.text = _currItem;
|
||||
_originalText = String(_currItem);
|
||||
if(_window.txt.textWidth > _window.txt.width)
|
||||
{
|
||||
_window.txt.text = "";
|
||||
_loc2_ = 0;
|
||||
_loc1_ = "";
|
||||
while(_window.txt.textWidth < _window.txt.width)
|
||||
{
|
||||
_loc1_ += String(_currItem).charAt(_loc2_);
|
||||
_window.txt.text = _loc1_ + "...";
|
||||
_loc2_++;
|
||||
}
|
||||
_window.txt.text = _loc1_.slice(0,_loc1_.length - 1) + "...";
|
||||
}
|
||||
}
|
||||
|
||||
private function onRollOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_window && _window.currentFrameLabel != "on")
|
||||
{
|
||||
_window.gotoAndStop("on");
|
||||
AJAudio.playSubMenuBtnRollover();
|
||||
}
|
||||
}
|
||||
|
||||
private function onRollOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_window && _window.currentFrameLabel != "off")
|
||||
{
|
||||
_window.gotoAndStop("off");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,404 @@
|
||||
package gui
|
||||
{
|
||||
import achievement.AchievementXtCommManager;
|
||||
import com.sbi.corelib.audio.SBAudio;
|
||||
import den.DenXtCommManager;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import gamePlayFlow.GamePlay;
|
||||
import localization.LocalizationManager;
|
||||
import room.RoomManagerWorld;
|
||||
|
||||
public class ItemWindowToggle extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _lock:MovieClip;
|
||||
|
||||
private var _currHeight:int;
|
||||
|
||||
public function ItemWindowToggle(param1:Function, param2:Object, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
super("mySettingsToggle|false",param1,param2,param3,param4,param5,param6,param7,param8);
|
||||
}
|
||||
|
||||
public function get currFrameLabel() : String
|
||||
{
|
||||
return _currItem.frame;
|
||||
}
|
||||
|
||||
public function resetConditions() : void
|
||||
{
|
||||
setChildrenAndInitialConditions();
|
||||
}
|
||||
|
||||
override public function loadCurrItem(param1:int = 0, param2:int = 0) : void
|
||||
{
|
||||
}
|
||||
|
||||
override public function get height() : Number
|
||||
{
|
||||
return _currHeight;
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
_currHeight = _window.height;
|
||||
_window.goNowBtn.visible = false;
|
||||
_window.woodenCursorBtn.visible = false;
|
||||
_window.defaultCursorBtn.visible = false;
|
||||
_window.toggleBtn.visible = false;
|
||||
_window.toggleTxt.visible = false;
|
||||
switch(_currItem.type)
|
||||
{
|
||||
case MySettings.TOGGLE_TYPE_TOGGLE_BTN:
|
||||
_window.toggleBtn.visible = true;
|
||||
_window.toggleBtn.toggleBtn.toggleKnob.gotoAndStop("up");
|
||||
_window.toggleBtn.toggleBtn.toggleBG.gotoAndStop("up");
|
||||
_window.icon.gotoAndStop(_currItem.frame);
|
||||
_window.toggleBtn.addEventListener("mouseDown",handleMouseDown,false,0,true);
|
||||
_window.toggleBtn.addEventListener("rollOver",handleMouseOver,false,0,true);
|
||||
_window.toggleBtn.addEventListener("rollOut",handleMouseOut,false,0,true);
|
||||
break;
|
||||
case MySettings.TOGGLE_TYPE_TEXT:
|
||||
_window.toggleTxt.visible = true;
|
||||
_window.icon.gotoAndStop(_currItem.frame);
|
||||
break;
|
||||
case MySettings.TOGGLE_TYPE_CURSOR:
|
||||
_window.woodenCursorBtn.visible = true;
|
||||
_window.defaultCursorBtn.visible = true;
|
||||
_window.icon.visible = false;
|
||||
if(GuiManager.sharedObj && (GuiManager.sharedObj.data.cursor == "custom" || GuiManager.sharedObj.data.cursor == null))
|
||||
{
|
||||
_window.woodenCursorBtn.upToDownState();
|
||||
_window.woodenCursorBtn.mouseEnabled = false;
|
||||
_window.woodenCursorBtn.mouseChildren = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.defaultCursorBtn.upToDownState();
|
||||
_window.defaultCursorBtn.mouseEnabled = false;
|
||||
_window.defaultCursorBtn.mouseChildren = false;
|
||||
}
|
||||
_window.woodenCursorBtn.addEventListener("mouseDown",handleMouseDown,false,0,true);
|
||||
_window.defaultCursorBtn.addEventListener("mouseDown",handleMouseDown,false,0,true);
|
||||
break;
|
||||
case MySettings.TOGGLE_TYPE_JOIN:
|
||||
_window.goNowBtn.visible = true;
|
||||
_window.goNowBtn.addEventListener("mouseDown",handleMouseDown,false,0,true);
|
||||
_window.icon.gotoAndStop(_currItem.frame);
|
||||
}
|
||||
switch(_currItem.frame)
|
||||
{
|
||||
case "lock":
|
||||
if(gMainFrame.userInfo.isMyDenPrivate)
|
||||
{
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
|
||||
}
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
|
||||
break;
|
||||
case "world":
|
||||
_window.goNowBtn.down.txt.text = ServerSelector.getShardName(RoomManagerWorld.instance.shardId);
|
||||
_window.goNowBtn.mouse.mouse.txt.text = ServerSelector.getShardName(RoomManagerWorld.instance.shardId);
|
||||
_window.goNowBtn.mouse.up.txt.text = ServerSelector.getShardName(RoomManagerWorld.instance.shardId);
|
||||
break;
|
||||
case "music":
|
||||
if(SBAudio.isMusicMuted || SBAudio.areSoundsMuted)
|
||||
{
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
|
||||
}
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
|
||||
break;
|
||||
case "buddyRequest":
|
||||
if(Utility.isSettingOn(MySettings.SETTINGS_BUDDY_REQUESTS))
|
||||
{
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
|
||||
}
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
|
||||
break;
|
||||
case "gameInvites":
|
||||
if(Utility.isSettingOn(MySettings.SETTINGS_GAME_INVITES))
|
||||
{
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
|
||||
}
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
|
||||
break;
|
||||
case "doorBell":
|
||||
if(Utility.isSettingOn(MySettings.SETTINGS_DOOR_BELL))
|
||||
{
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
|
||||
}
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
|
||||
break;
|
||||
case "autoServer":
|
||||
if(Utility.isSettingOn(MySettings.SETTINGS_AUTO_SERVER_TRAVEL))
|
||||
{
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOn");
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndStop("startingOff");
|
||||
}
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
|
||||
break;
|
||||
case "nameBadge":
|
||||
if(Utility.isSettingOn(MySettings.SETTINGS_USERNAME_BADGE))
|
||||
{
|
||||
_window.toggleBtn.gotoAndStop("double");
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOff");
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.toggleBtn.gotoAndStop("double");
|
||||
_window.toggleBtn.toggleBtn.gotoAndStop("startingOn");
|
||||
}
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
|
||||
case "intro":
|
||||
}
|
||||
LocalizationManager.translateId(_window.labelTxtCont.labelTxt,_currItem.labelTxt);
|
||||
}
|
||||
|
||||
private function handleMouseDown(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc2_:Number = NaN;
|
||||
var _loc3_:int = 0;
|
||||
param1.stopPropagation();
|
||||
if(_currItem.type == MySettings.TOGGLE_TYPE_TOGGLE_BTN)
|
||||
{
|
||||
switch(_currItem.frame)
|
||||
{
|
||||
case "lock":
|
||||
_lock = MovieClip(param1.currentTarget);
|
||||
GuiManager.onToggleDenLock(onDenLockUnlock);
|
||||
break;
|
||||
case "music":
|
||||
SBAudio.toggleMuteAll();
|
||||
GuiManager.toggleMuteVideo();
|
||||
if(SBAudio.isMusicMuted || SBAudio.areSoundsMuted)
|
||||
{
|
||||
param1.currentTarget.toggleBtn.gotoAndPlay("off");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("off");
|
||||
GuiManager.depressSoundButton(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
param1.currentTarget.toggleBtn.gotoAndPlay("on");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("on");
|
||||
GuiManager.depressSoundButton(false);
|
||||
}
|
||||
break;
|
||||
case "buddyRequest":
|
||||
case "gameInvites":
|
||||
case "doorBell":
|
||||
case "autoServer":
|
||||
case "nameBadge":
|
||||
_loc2_ = Number(gMainFrame.userInfo.userVarCache.getUserVarValueById(363));
|
||||
_loc3_ = -1;
|
||||
if(_currItem.frame == "buddyRequest")
|
||||
{
|
||||
_loc3_ = MySettings.SETTINGS_BUDDY_REQUESTS;
|
||||
}
|
||||
else if(_currItem.frame == "gameInvites")
|
||||
{
|
||||
_loc3_ = MySettings.SETTINGS_GAME_INVITES;
|
||||
}
|
||||
else if(_currItem.frame == "doorBell")
|
||||
{
|
||||
_loc3_ = MySettings.SETTINGS_DOOR_BELL;
|
||||
}
|
||||
else if(_currItem.frame == "autoServer")
|
||||
{
|
||||
_loc3_ = MySettings.SETTINGS_AUTO_SERVER_TRAVEL;
|
||||
}
|
||||
else if(_currItem.frame == "nameBadge")
|
||||
{
|
||||
_loc3_ = MySettings.SETTINGS_USERNAME_BADGE;
|
||||
}
|
||||
if(_loc3_ != -1)
|
||||
{
|
||||
if(_loc2_ == -1)
|
||||
{
|
||||
if(_loc3_ == MySettings.SETTINGS_DOOR_BELL || _loc3_ == MySettings.SETTINGS_USERNAME_BADGE)
|
||||
{
|
||||
param1.currentTarget.toggleBtn.gotoAndPlay("on");
|
||||
if(_window.icon["" + _window.icon.currentFrameLabel].currentLabel)
|
||||
{
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("on");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
param1.currentTarget.toggleBtn.gotoAndPlay("off");
|
||||
if(_window.icon["" + _window.icon.currentFrameLabel].currentLabel)
|
||||
{
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("off");
|
||||
}
|
||||
}
|
||||
AchievementXtCommManager.requestSetUserVar(363,_loc3_);
|
||||
}
|
||||
else if(param1.currentTarget.toggleBtn.currentFrameLabel == "on" || param1.currentTarget.toggleBtn.currentFrameLabel == "startingOn")
|
||||
{
|
||||
param1.currentTarget.toggleBtn.gotoAndPlay("off");
|
||||
if(_window.icon["" + _window.icon.currentFrameLabel].currentLabel)
|
||||
{
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("off");
|
||||
}
|
||||
if(_loc3_ == MySettings.SETTINGS_DOOR_BELL || _loc3_ == MySettings.SETTINGS_USERNAME_BADGE)
|
||||
{
|
||||
AchievementXtCommManager.requestSetUserVar(363,_loc3_,null,false);
|
||||
}
|
||||
else
|
||||
{
|
||||
AchievementXtCommManager.requestSetUserVar(363,_loc3_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
param1.currentTarget.toggleBtn.gotoAndPlay("on");
|
||||
if(_window.icon["" + _window.icon.currentFrameLabel].currentLabel)
|
||||
{
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("on");
|
||||
}
|
||||
if(_loc3_ == MySettings.SETTINGS_DOOR_BELL || _loc3_ == MySettings.SETTINGS_USERNAME_BADGE)
|
||||
{
|
||||
AchievementXtCommManager.requestSetUserVar(363,_loc3_);
|
||||
}
|
||||
else
|
||||
{
|
||||
AchievementXtCommManager.requestSetUserVar(363,_loc3_,null,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.onTxt,_currItem.onTxt);
|
||||
LocalizationManager.translateId(_window.toggleBtn.toggleBtn.valueTxt.offTxt,_currItem.offTxt);
|
||||
}
|
||||
else if(_currItem.type == MySettings.TOGGLE_TYPE_CURSOR)
|
||||
{
|
||||
if(param1.currentTarget.mouse.currentFrame == 3)
|
||||
{
|
||||
param1.currentTarget.mouseEnabled = false;
|
||||
param1.currentTarget.mouseChildren = false;
|
||||
}
|
||||
if(param1.currentTarget != _window.defaultCursorBtn)
|
||||
{
|
||||
GuiManager.setSharedObj("cursor","custom");
|
||||
CursorManager.switchToCursor("custom_cursor");
|
||||
_window.defaultCursorBtn.downToUpState();
|
||||
_window.defaultCursorBtn.mouseEnabled = true;
|
||||
_window.defaultCursorBtn.mouseChildren = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
GuiManager.setSharedObj("cursor","default");
|
||||
CursorManager.switchToCursor("Default_Cursor");
|
||||
_window.woodenCursorBtn.downToUpState();
|
||||
_window.woodenCursorBtn.mouseEnabled = true;
|
||||
_window.woodenCursorBtn.mouseChildren = true;
|
||||
}
|
||||
}
|
||||
else if(_currItem.type == MySettings.TOGGLE_TYPE_JOIN)
|
||||
{
|
||||
switch(_currItem.frame)
|
||||
{
|
||||
case "world":
|
||||
ServerSelector.init(GuiManager.guiLayer,null,GamePlay(gMainFrame.gamePlay).joinChosenShardIdNode);
|
||||
break;
|
||||
case "intro":
|
||||
GuiManager.startFFM();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function handleMouseOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_currItem.type == MySettings.TOGGLE_TYPE_TOGGLE_BTN)
|
||||
{
|
||||
if(param1.currentTarget.toggleBtn.toggleBG.currentFrameLabel != "up")
|
||||
{
|
||||
param1.currentTarget.toggleBtn.toggleBG.gotoAndStop("up");
|
||||
}
|
||||
if(param1.currentTarget.toggleBtn.toggleKnob.currentFrameLabel != "up")
|
||||
{
|
||||
param1.currentTarget.toggleBtn.toggleKnob.gotoAndStop("up");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function handleMouseOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_currItem.type == MySettings.TOGGLE_TYPE_TOGGLE_BTN)
|
||||
{
|
||||
if(param1.currentTarget.toggleBtn.toggleBG.currentFrameLabel != "over")
|
||||
{
|
||||
param1.currentTarget.toggleBtn.toggleBG.gotoAndStop("over");
|
||||
}
|
||||
if(param1.currentTarget.toggleBtn.toggleKnob.currentFrameLabel != "over")
|
||||
{
|
||||
param1.currentTarget.toggleBtn.toggleKnob.gotoAndStop("over");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onDenLockUnlock(param1:Boolean = true) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
gMainFrame.userInfo.isMyDenPrivate = !gMainFrame.userInfo.isMyDenPrivate;
|
||||
DenXtCommManager.requestSetDenPrivacy(gMainFrame.userInfo.isMyDenPrivate,true);
|
||||
GuiManager.refreshDenLockSettings();
|
||||
}
|
||||
if(gMainFrame.userInfo.isMyDenPrivate)
|
||||
{
|
||||
_lock.toggleBtn.gotoAndPlay("off");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("off");
|
||||
}
|
||||
else
|
||||
{
|
||||
_lock.toggleBtn.gotoAndPlay("on");
|
||||
_window.icon["" + _window.icon.currentFrameLabel].gotoAndPlay("on");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package gui
|
||||
{
|
||||
import achievement.Achievement;
|
||||
import flash.filters.ColorMatrixFilter;
|
||||
|
||||
public class ItemWindowWithSeparators extends ItemWindowBase
|
||||
{
|
||||
|
||||
private var _sizeCont:Object;
|
||||
|
||||
private var _secondaryIndex:int;
|
||||
|
||||
private var _myAchievementsByType:Array;
|
||||
|
||||
public function ItemWindowWithSeparators(param1:Function, param2:*, param3:String, param4:int, param5:Function = null, param6:Function = null, param7:Function = null, param8:Function = null, param9:Object = null)
|
||||
{
|
||||
if(param2.hasOwnProperty("width"))
|
||||
{
|
||||
_sizeCont = {
|
||||
"height":(param2.hasOwnProperty("scrollContentHeight") ? param2.scrollContentHeight : param2.height),
|
||||
"width":param2.width
|
||||
};
|
||||
}
|
||||
_secondaryIndex = param9 ? param9.secondaryIndex as int : 0;
|
||||
_myAchievementsByType = param9 ? param9.myAchievementsByType : [];
|
||||
super(param9 != null && param9.itemClassName != null ? param9.itemClassName : param2,param1,param2,param3,param4,param5,param6,param7,param8,false);
|
||||
}
|
||||
|
||||
override protected function setChildrenAndInitialConditions() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
if(_currItem is Achievement)
|
||||
{
|
||||
if(_myAchievementsByType != null)
|
||||
{
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _myAchievementsByType.length)
|
||||
{
|
||||
if(_myAchievementsByType[_loc1_].defId == _currItem.defId)
|
||||
{
|
||||
_currItem.image.filters = null;
|
||||
return;
|
||||
}
|
||||
_loc1_++;
|
||||
}
|
||||
}
|
||||
_currItem.image.filters = [new ColorMatrixFilter([0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0.3086,0.6094,0.082,0,0,0,0,0,1,0])];
|
||||
}
|
||||
}
|
||||
|
||||
public function get sizeCont() : Object
|
||||
{
|
||||
return _sizeCont;
|
||||
}
|
||||
|
||||
public function get secondaryIndex() : int
|
||||
{
|
||||
return _secondaryIndex;
|
||||
}
|
||||
|
||||
public function get currItemType() : int
|
||||
{
|
||||
if(_currItem && _currItem.hasOwnProperty("type"))
|
||||
{
|
||||
return _currItem.type;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 _loc2_:Object in param1)
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:Array = _unseenPagesIds;
|
||||
do
|
||||
{
|
||||
for each(var _loc3_:int in _loc4_)
|
||||
{
|
||||
}
|
||||
continue loop0;
|
||||
}
|
||||
while(_loc3_ != _loc2_.refId);
|
||||
GuiManager.showJBGlow(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_currRoomJBItems = param1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function onFactListReceived(param1:Array) : void
|
||||
{
|
||||
var _loc7_:int = 0;
|
||||
var _loc6_:Object = null;
|
||||
var _loc5_:int = 0;
|
||||
_hasLoadedDefs = true;
|
||||
var _loc4_:int = int(param1.length);
|
||||
var _loc3_:int = 0;
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc4_)
|
||||
{
|
||||
_loc6_ = param1[_loc7_];
|
||||
if(!_defPages[_loc6_.userVarId])
|
||||
{
|
||||
_defPages[_loc6_.userVarId] = [];
|
||||
if(!gMainFrame.userInfo.userVarCache.isBitSet(_loc6_.userVarId,29))
|
||||
{
|
||||
_numUnseenPages = _numUnseenPages + 1;
|
||||
_unseenPagesIds[_loc6_.userVarId] = _loc6_.id;
|
||||
}
|
||||
}
|
||||
_defPages[_loc6_.userVarId].push(_loc6_);
|
||||
NGFactManager.updateFactDefCache(_loc6_);
|
||||
_loc7_++;
|
||||
}
|
||||
for each(var _loc2_:Array in _defPages)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc2_.length)
|
||||
{
|
||||
if(gMainFrame.userInfo.userVarCache.isBitSet(_loc2_[_loc7_].userVarId,_loc2_[_loc7_].bitIdx))
|
||||
{
|
||||
_loc5_++;
|
||||
}
|
||||
_loc7_++;
|
||||
}
|
||||
if(_loc5_ == _loc2_.length)
|
||||
{
|
||||
if(!(gMainFrame.userInfo.userVarCache.isBitSet(_loc2_[_loc7_ - 1].userVarId,31) || Boolean(gMainFrame.userInfo.userVarCache.isBitSet(_loc2_[_loc7_ - 1].userVarId,30))))
|
||||
{
|
||||
_numUnclaimedGifts = _numUnclaimedGifts + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(_currRoomJBItems)
|
||||
{
|
||||
checkUnseenPage(_currRoomJBItems);
|
||||
}
|
||||
GuiManager.updateJBIcon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import loader.MediaHelper;
|
||||
|
||||
public class LoadingSpiral extends MovieClip
|
||||
{
|
||||
|
||||
public static 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 && _loadingSpiral && this.parent == _parent)
|
||||
{
|
||||
_parent.removeChild(this);
|
||||
_parent = null;
|
||||
_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;
|
||||
}
|
||||
}
|
||||
|
||||
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,262 @@
|
||||
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(_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,253 @@
|
||||
package gui
|
||||
{
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.*;
|
||||
import flash.net.URLRequest;
|
||||
import flash.net.navigateToURL;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class MySettings
|
||||
{
|
||||
|
||||
public static var SETTINGS_BUDDY_REQUESTS:int = 0;
|
||||
|
||||
public static var SETTINGS_GAME_INVITES:int = 1;
|
||||
|
||||
public static var SETTINGS_DOOR_BELL:int = 2;
|
||||
|
||||
public static var 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 _loc1_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
if(gMainFrame.userInfo.isMember)
|
||||
{
|
||||
_mySettings.statusNonmember.visible = false;
|
||||
_loc5_ = int(gMainFrame.clientInfo.numDaysLeftOnSubscription);
|
||||
if(_loc5_ > 0)
|
||||
{
|
||||
_mySettings.gotoAndStop("memberScrollSubscription");
|
||||
_loc1_ = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
_mySettings.gotoAndStop("memberScroll");
|
||||
_loc1_ = 6;
|
||||
}
|
||||
_loc4_ = int(_mySettings.itemWindow.height);
|
||||
_loc2_ = int(_mySettings.itemWindow.width);
|
||||
if(_loc5_ > 0)
|
||||
{
|
||||
if(_loc5_ > 1)
|
||||
{
|
||||
LocalizationManager.translateIdAndInsert(_mySettings.timeRemaining.timeTxt,11361,_loc5_);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalizationManager.translateIdAndInsert(_mySettings.timeRemaining.timeTxt,11362,_loc5_);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_mySettings.statusMember.visible = false;
|
||||
_mySettings.gotoAndStop("nonMemScroll");
|
||||
_mySettings.joinBtn.addEventListener("mouseDown",onJoinBtn,false,0,true);
|
||||
_loc1_ = 5;
|
||||
_loc4_ = int(_mySettings.itemWindow.height);
|
||||
_loc2_ = int(_mySettings.itemWindow.width);
|
||||
}
|
||||
var _loc3_:Array = [{
|
||||
"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,_loc1_,_loc3_.length,0,4,0,ItemWindowToggle,_loc3_,null);
|
||||
_mySettings.itemWindow.addChild(_toggleWindows);
|
||||
_toggleScrollBar = new SBScrollbar();
|
||||
_toggleScrollBar.init(_toggleWindows,_loc2_,_loc4_,2,"scrollbar2",_toggleWindows.boxHeight + 4);
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onClose(param1:MouseEvent) : void
|
||||
{
|
||||
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,96 @@
|
||||
package gui
|
||||
{
|
||||
import diamond.DiamondItem;
|
||||
import diamond.DiamondXtCommManager;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import loader.MediaHelper;
|
||||
import pet.PetManager;
|
||||
|
||||
public class PetAdoptionBanner
|
||||
{
|
||||
|
||||
private static var _popupMediaHelper:MediaHelper;
|
||||
|
||||
private static var _popup:MovieClip;
|
||||
|
||||
private static var _diamondPetDef:int;
|
||||
|
||||
public function PetAdoptionBanner()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init(param1:int) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_diamondPetDef = param1;
|
||||
_popupMediaHelper = new MediaHelper();
|
||||
_popupMediaHelper.init(3759,onMediaLoaded);
|
||||
}
|
||||
|
||||
public static function destroy() : void
|
||||
{
|
||||
if(_popupMediaHelper)
|
||||
{
|
||||
_popupMediaHelper.destroy();
|
||||
_popupMediaHelper = null;
|
||||
}
|
||||
if(_popup)
|
||||
{
|
||||
_popup.removeEventListener("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_:DiamondItem = DiamondXtCommManager.getDiamondItem(_diamondPetDef);
|
||||
if(_loc2_)
|
||||
{
|
||||
PetManager.openPetFinder(PetManager.petNameForDefId(_loc2_.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,699 @@
|
||||
package gui
|
||||
{
|
||||
import Party.PartyManager;
|
||||
import avatar.AvatarManager;
|
||||
import com.sbi.analytics.SBTracker;
|
||||
import com.sbi.popup.SBOkPopup;
|
||||
import com.sbi.popup.SBYesNoPopup;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import game.MinigameManager;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
import pet.GuiPet;
|
||||
import pet.PetManager;
|
||||
import pet.PetXtCommManager;
|
||||
|
||||
public class PetInventory
|
||||
{
|
||||
|
||||
private static const LOADING_SPIRAL_SMALL:int = 397;
|
||||
|
||||
private static const EVT_ICON_ID:int = 44;
|
||||
|
||||
private const PET_INVENTORY_MEDIA_ID:int = 993;
|
||||
|
||||
private var _guiLayer:DisplayLayer;
|
||||
|
||||
private var _mediaHelpers:Array;
|
||||
|
||||
private var _loadingMediaHelper:MediaHelper;
|
||||
|
||||
private var _closeCallback:Function;
|
||||
|
||||
private var _petList:Array;
|
||||
|
||||
private var _petViews:Array;
|
||||
|
||||
private var _loadingSpiralBig:LoadingSpiral;
|
||||
|
||||
private var _inventoryMC:MovieClip;
|
||||
|
||||
private var _bigPet:GuiPet;
|
||||
|
||||
private var _scrollButtons:SBScrollbar;
|
||||
|
||||
private var _itemWindows:WindowGenerator;
|
||||
|
||||
private var _isRecycling:Boolean;
|
||||
|
||||
private var _activePetModified:Boolean;
|
||||
|
||||
private var _noCurrentActivePet:Boolean;
|
||||
|
||||
private var _idx:int;
|
||||
|
||||
private var _currSelectedIdx:int;
|
||||
|
||||
private var _initialPetInvId:int;
|
||||
|
||||
private var _recycleOneOnly:Boolean;
|
||||
|
||||
private var _hasRecycled:Boolean;
|
||||
|
||||
private var _shop:Shop;
|
||||
|
||||
private var _previousPetInvId:int;
|
||||
|
||||
public function PetInventory()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init(param1:Function, param2:Boolean = false) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_guiLayer = GuiManager.guiLayer;
|
||||
_closeCallback = param1;
|
||||
_mediaHelpers = [];
|
||||
_petViews = [];
|
||||
_petList = PetManager.myPetList;
|
||||
_idx = -1;
|
||||
_currSelectedIdx = -1;
|
||||
_recycleOneOnly = param2;
|
||||
_loadingSpiralBig = new LoadingSpiral();
|
||||
SBTracker.push();
|
||||
SBTracker.trackPageview("/game/play/popup/pet/inventory");
|
||||
_loadingMediaHelper = new MediaHelper();
|
||||
_loadingMediaHelper.init(993,onMediaItemLoaded);
|
||||
_mediaHelpers.push(_loadingMediaHelper);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
removeEventListeners();
|
||||
DarkenManager.unDarken(_inventoryMC);
|
||||
_guiLayer.removeChild(_inventoryMC);
|
||||
SBTracker.pop();
|
||||
_activePetModified = false;
|
||||
_noCurrentActivePet = false;
|
||||
_idx = -1;
|
||||
_initialPetInvId = -1;
|
||||
_currSelectedIdx = -1;
|
||||
_isRecycling = false;
|
||||
_inventoryMC = null;
|
||||
_petList = null;
|
||||
if(_petViews)
|
||||
{
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _petViews.length)
|
||||
{
|
||||
_petViews[_loc1_].destroy();
|
||||
_loc1_++;
|
||||
}
|
||||
}
|
||||
_petViews = null;
|
||||
if(_bigPet)
|
||||
{
|
||||
_bigPet.destroy();
|
||||
_bigPet = null;
|
||||
}
|
||||
if(_scrollButtons)
|
||||
{
|
||||
_scrollButtons.destroy();
|
||||
_scrollButtons = null;
|
||||
}
|
||||
if(_itemWindows)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _mediaHelpers.length)
|
||||
{
|
||||
_mediaHelpers[_loc1_].destroy();
|
||||
_loc1_++;
|
||||
}
|
||||
_mediaHelpers.splice();
|
||||
if(_closeCallback != null)
|
||||
{
|
||||
if(_recycleOneOnly)
|
||||
{
|
||||
_closeCallback(_hasRecycled);
|
||||
}
|
||||
else
|
||||
{
|
||||
_closeCallback();
|
||||
}
|
||||
_closeCallback = null;
|
||||
}
|
||||
}
|
||||
|
||||
private function onMediaItemLoaded(param1:MovieClip) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_: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;
|
||||
_inventoryMC.helpBubble.visible = false;
|
||||
if(AvatarManager.roomEnviroType == 1)
|
||||
{
|
||||
_inventoryMC.shopBtn.visible = false;
|
||||
}
|
||||
if(_petList && _petList.length > 0)
|
||||
{
|
||||
if(PetManager.myActivePetInvId != 0)
|
||||
{
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _petList.length)
|
||||
{
|
||||
if(_petList[_loc3_].idx == PetManager.myActivePetInvId)
|
||||
{
|
||||
_currSelectedIdx = _loc3_;
|
||||
_initialPetInvId = _petList[_loc3_].idx;
|
||||
if(PetManager.canCurrAvatarUsePet(AvatarManager.playerAvatar.enviroTypeFlag,_petList[_loc3_].type))
|
||||
{
|
||||
_loc2_ = _petList[_loc3_];
|
||||
_bigPet = new GuiPet(_loc2_.idx,_loc2_.lBits,_loc2_.uBits,_loc2_.eBits,_loc2_.type,_loc2_.name,onBigPetLoaded);
|
||||
_inventoryMC.itemWindowPet.addChild(_bigPet);
|
||||
_inventoryMC.petNameTxt.text = _bigPet.petName;
|
||||
_inventoryMC.butterfly.visible = false;
|
||||
if(_loc2_.masteryCounter >= 100)
|
||||
{
|
||||
_inventoryMC.bMastery.visible = true;
|
||||
_inventoryMC.bMastery.icon.gotoAndStop(PetManager.petNameForDefId(_loc2_.defId) + "1");
|
||||
if((_loc2_.uBits >> 8 & 0x0F) > 0)
|
||||
{
|
||||
_inventoryMC.bMastery.mouse.visible = false;
|
||||
_inventoryMC.bMastery.down.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
_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();
|
||||
}
|
||||
}
|
||||
|
||||
private function onBigPetLoaded(param1:MovieClip, param2:GuiPet) : void
|
||||
{
|
||||
_bigPet.scaleX = _bigPet.scaleY = 5;
|
||||
_bigPet.y += 83;
|
||||
}
|
||||
|
||||
private function createGuiPets() : void
|
||||
{
|
||||
var _loc1_:int = 0;
|
||||
_petViews = [];
|
||||
_loc1_ = 0;
|
||||
while(_loc1_ < _petList.length)
|
||||
{
|
||||
_petViews.push(new GuiPet(_petList[_loc1_].idx,_petList[_loc1_].lBits,_petList[_loc1_].uBits,_petList[_loc1_].eBits,_petList[_loc1_].type,_petList[_loc1_].name,null));
|
||||
_loc1_++;
|
||||
}
|
||||
}
|
||||
|
||||
private function createItemWindows() : void
|
||||
{
|
||||
if(_scrollButtons)
|
||||
{
|
||||
_scrollButtons.destroy();
|
||||
_scrollButtons = null;
|
||||
}
|
||||
if(_itemWindows)
|
||||
{
|
||||
_itemWindows.destroy();
|
||||
_itemWindows = null;
|
||||
}
|
||||
while(_inventoryMC.itemWindow.numChildren > 0)
|
||||
{
|
||||
_inventoryMC.itemWindow.removeChildAt(0);
|
||||
}
|
||||
createGuiPets();
|
||||
var _loc1_:int = int(_petList.length);
|
||||
var _loc2_:Number = Math.min(PetManager.getPetInventoryMax(),4);
|
||||
var _loc3_:int = Math.ceil(_loc2_ / 5);
|
||||
_itemWindows = new WindowGenerator();
|
||||
_itemWindows.init(_loc2_,_loc3_,PetManager.getPetInventoryMax(),2,2,1,ItemWindowPets,_petList,"",{
|
||||
"mouseDown":winMouseDown,
|
||||
"mouseOver":winMouseOver,
|
||||
"mouseOut":winMouseOut
|
||||
},{"isRecycling":_isRecycling || _recycleOneOnly},null,false,false);
|
||||
_inventoryMC.itemWindow.addChild(_itemWindows);
|
||||
_loadingSpiralBig.visible = false;
|
||||
_scrollButtons = new SBScrollbar();
|
||||
_scrollButtons.init(_itemWindows,344,258,2,"scrollbar2",86);
|
||||
}
|
||||
|
||||
private function onConfirmFreePet(param1:Object) : void
|
||||
{
|
||||
if(param1.status)
|
||||
{
|
||||
PetXtCommManager.sendPetDismissRequest(_petList[param1.passback].idx,freePetCallback);
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
}
|
||||
}
|
||||
|
||||
private function freePetCallback(param1:Boolean, param2:Boolean, param3:Boolean) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
GuiManager.resetPetWindowListAndUpdateBtns();
|
||||
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)
|
||||
{
|
||||
_petList = PetManager.myPetList;
|
||||
_inventoryMC.itemCounter.counterTxt.text = _petList.length + "/" + PetManager.getPetInventoryMax();
|
||||
_isRecycling = false;
|
||||
_noCurrentActivePet = true;
|
||||
createItemWindows();
|
||||
}
|
||||
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 _loc4_:int = 0;
|
||||
var _loc3_:MovieClip = null;
|
||||
var _loc2_: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(10,"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;
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _itemWindows.numWindowsCreated)
|
||||
{
|
||||
_loc3_ = MovieClip(_itemWindows.bg.getChildAt(_loc4_));
|
||||
_loc3_.cir.gotoAndStop("up");
|
||||
_loc4_++;
|
||||
}
|
||||
param1.currentTarget.cir.gotoAndStop("downMouse");
|
||||
_loc2_ = _petList[_idx];
|
||||
_bigPet = new GuiPet(_loc2_.idx,_loc2_.lBits,_loc2_.uBits,_loc2_.eBits,_loc2_.type,_loc2_.name,onBigPetLoaded);
|
||||
_inventoryMC.itemWindowPet.addChild(_bigPet);
|
||||
_inventoryMC.petNameTxt.text = _bigPet.petName;
|
||||
_inventoryMC.butterfly.visible = false;
|
||||
if(_loc2_.masteryCounter >= 100)
|
||||
{
|
||||
_inventoryMC.bMastery.visible = true;
|
||||
_inventoryMC.bMastery.icon.gotoAndStop(PetManager.petNameForDefId(_loc2_.defId) + "1");
|
||||
if((_loc2_.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 == _loc2_.idx)
|
||||
{
|
||||
_idx = -1;
|
||||
PetManager.myActivePetInvId = _initialPetInvId;
|
||||
}
|
||||
else
|
||||
{
|
||||
PetManager.myActivePetInvId = _loc2_.idx;
|
||||
}
|
||||
GuiManager.resetPetWindowListAndUpdateBtns();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function winMouseOver(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.numChildren >= 1)
|
||||
{
|
||||
if(param1.currentTarget.cir.currentFrameLabel == "down")
|
||||
{
|
||||
param1.currentTarget.cir.gotoAndStop("downMouse");
|
||||
}
|
||||
else if(param1.currentTarget.cir.currentFrameLabel != "downMouse")
|
||||
{
|
||||
param1.currentTarget.cir.gotoAndStop("over");
|
||||
}
|
||||
AJAudio.playSubMenuBtnRollover();
|
||||
}
|
||||
}
|
||||
|
||||
private function winMouseOut(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(param1.currentTarget.numChildren >= 1)
|
||||
{
|
||||
if(param1.currentTarget.cir.currentFrameLabel == "downMouse")
|
||||
{
|
||||
param1.currentTarget.cir.gotoAndStop("down");
|
||||
}
|
||||
else if(param1.currentTarget.cir.currentFrameLabel != "down")
|
||||
{
|
||||
param1.currentTarget.cir.gotoAndStop("up");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function onCageBtn(param1:MouseEvent) : void
|
||||
{
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:MovieClip = null;
|
||||
param1.stopPropagation();
|
||||
if(_isRecycling)
|
||||
{
|
||||
_isRecycling = false;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _itemWindows.numWindowsCreated)
|
||||
{
|
||||
_loc2_ = MovieClip(_itemWindows.bg.getChildAt(_loc3_));
|
||||
_loc2_.cageIcon.visible = false;
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_isRecycling = true;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _itemWindows.numWindowsCreated)
|
||||
{
|
||||
_loc2_ = MovieClip(_itemWindows.bg.getChildAt(_loc3_));
|
||||
if(_loc2_.hasPet)
|
||||
{
|
||||
_loc2_.cageIcon.visible = true;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 _loc5_:int = 0;
|
||||
var _loc9_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
param1.stopPropagation();
|
||||
var _loc2_:Object = _petList[_currSelectedIdx];
|
||||
if(_loc2_ != null)
|
||||
{
|
||||
_loc5_ = _loc2_.uBits >> 8 & 0x0F;
|
||||
if(_loc5_ > 0)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
param1.currentTarget.mouse.visible = true;
|
||||
param1.currentTarget.down.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc5_ = 1;
|
||||
param1.currentTarget.mouse.visible = false;
|
||||
param1.currentTarget.down.visible = true;
|
||||
}
|
||||
_loc9_ = int(_loc2_.uBits);
|
||||
_loc7_ = _loc9_ & 0x0F;
|
||||
_loc8_ = _loc9_ >> 4 & 0x0F;
|
||||
_loc6_ = _loc9_ >> 12 & 0x0F;
|
||||
_loc4_ = _loc9_ >> 16 & 0x0F;
|
||||
_loc3_ = _loc9_ >> 20 & 0x0F;
|
||||
_loc9_ = _loc3_ << 20 | _loc4_ << 16 | _loc6_ << 12 | _loc5_ << 8 | _loc8_ << 4 | _loc7_;
|
||||
_loc2_.uBits = _loc5_ << 8 | _loc9_;
|
||||
if(_petViews[_currSelectedIdx] != null)
|
||||
{
|
||||
_petViews[_currSelectedIdx].updateUBits(_loc2_.uBits);
|
||||
}
|
||||
_bigPet.updateAllBits(_loc2_.lBits,_loc2_.uBits,_loc2_.eBits);
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
PetXtCommManager.sendPetMasteryRequest(_loc5_,_loc2_.idx);
|
||||
}
|
||||
}
|
||||
|
||||
private function updateActivePet(param1:Boolean = false) : void
|
||||
{
|
||||
var _loc2_:Object = null;
|
||||
var _loc3_:Function = null;
|
||||
if(param1)
|
||||
{
|
||||
_loc3_ = onPetUpdate;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc3_ = onPetSwitch;
|
||||
}
|
||||
if(_idx > -1)
|
||||
{
|
||||
if(_petList && _petList.length > 0)
|
||||
{
|
||||
_loc2_ = _petList[_idx];
|
||||
if(_loc2_ != null)
|
||||
{
|
||||
if(_activePetModified)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
PetXtCommManager.sendPetSwitchRequest(_loc2_.idx,_loc3_);
|
||||
_activePetModified = false;
|
||||
return;
|
||||
}
|
||||
if(PetManager.myActivePetInvId == 0 && MovieClip(_itemWindows.bg.getChildAt(_idx)).cir.currentFrameLabel == "up" && !_noCurrentActivePet)
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
PetXtCommManager.sendPetSwitchRequest(0,_loc3_);
|
||||
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
|
||||
{
|
||||
_loc3_(true);
|
||||
}
|
||||
}
|
||||
|
||||
private function reloadPets() : void
|
||||
{
|
||||
_petList = PetManager.myPetList;
|
||||
while(_inventoryMC.itemWindowPet.numChildren > 0)
|
||||
{
|
||||
_inventoryMC.itemWindowPet.removeChildAt(0);
|
||||
}
|
||||
var _loc1_:Object = PetManager.myActivePet;
|
||||
_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(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 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 _loc4_:int = 0;
|
||||
var _loc8_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc7_:int = 0;
|
||||
var _loc5_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:int = 0;
|
||||
var _loc1_:Object = PetManager.myActivePet;
|
||||
if(_loc1_)
|
||||
{
|
||||
_loc4_ = 1;
|
||||
_loc8_ = int(_loc1_.uBits);
|
||||
_loc6_ = _loc8_ & 0x0F;
|
||||
_loc7_ = _loc8_ >> 4 & 0x0F;
|
||||
_loc5_ = _loc8_ >> 12 & 0x0F;
|
||||
_loc3_ = _loc8_ >> 16 & 0x0F;
|
||||
_loc2_ = _loc8_ >> 20 & 0x0F;
|
||||
_loc8_ = _loc2_ << 20 | _loc3_ << 16 | _loc5_ << 12 | _loc4_ << 8 | _loc7_ << 4 | _loc6_;
|
||||
_loc1_.uBits = _loc4_ << 8 | _loc8_;
|
||||
_currPet = new GuiPet(_loc1_.idx,_loc1_.lBits,_loc1_.uBits,_loc1_.eBits,_loc1_.type,_loc1_.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,784 @@
|
||||
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 _loc3_:int = 0;
|
||||
var _loc1_:Object = null;
|
||||
var _loc2_:Array = PetManager.myPetList;
|
||||
_myPet = null;
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc2_.length)
|
||||
{
|
||||
if(_loc2_[_loc3_].idx == PetManager.myActivePetInvId)
|
||||
{
|
||||
_loc1_ = _loc2_[_loc3_];
|
||||
if(PetManager.canCurrAvatarUsePet(AvatarManager.playerAvatar.enviroTypeFlag,_loc1_.type))
|
||||
{
|
||||
_booth.posBtn.activateGrayState(false);
|
||||
_myPet = new GuiPet(_loc1_.idx,_loc1_.lBits,_loc1_.uBits,_loc1_.eBits,_loc1_.type,_loc1_.name,onPetLoaded);
|
||||
}
|
||||
break;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
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 _loc1_:Avatar = AvatarManager.playerAvatar;
|
||||
if(_hudAvtView)
|
||||
{
|
||||
if(_hudAvtView.parent == _booth.char.charLayer)
|
||||
{
|
||||
_booth.char.charLayer.removeChild(_hudAvtView);
|
||||
}
|
||||
_hudAvtView.destroy();
|
||||
}
|
||||
_hudAvtView = new AvatarView();
|
||||
_hudAvtView.init(_loc1_);
|
||||
_hudAvtView.playAnim(15,false,1);
|
||||
var _loc2_:Point = AvatarUtility.getAvatarHudPosition(_hudAvtView.avTypeId);
|
||||
_hudAvtView.x = _loc2_.x;
|
||||
_hudAvtView.y = _loc2_.y;
|
||||
_booth.char.charLayer.addChild(_hudAvtView);
|
||||
}
|
||||
|
||||
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 _loc2_:Avatar = null;
|
||||
var _loc5_:int = 0;
|
||||
param1.stopPropagation();
|
||||
if(_loadingSpiralAvt.visible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_debugAvtIndex = _debugAvtIndex + 1;
|
||||
var _loc4_:Array = AvatarSwitch.avatars;
|
||||
if(_debugAvtIndex >= AvatarUtility.numAvatarTypes)
|
||||
{
|
||||
_debugAvtIndex = 0;
|
||||
}
|
||||
var _loc3_:int = AvatarUtility.getAvatarTypeByIndex(_debugAvtIndex);
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc4_.length)
|
||||
{
|
||||
if(_loc4_[_loc5_].avTypeId == _loc3_)
|
||||
{
|
||||
_loc2_ = _loc4_[_loc5_];
|
||||
break;
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
if(_loc2_ == null)
|
||||
{
|
||||
_loc2_ = AvatarUtility.getAvatarByIndex(_debugAvtIndex);
|
||||
}
|
||||
if(!Utility.isLand(_loc2_.enviroTypeFlag))
|
||||
{
|
||||
onAvtDebugLoadBtn(param1);
|
||||
return;
|
||||
}
|
||||
loadDebugAvatar(_loc2_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,201 @@
|
||||
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;
|
||||
|
||||
public function PlayerSearch()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public function init() : void
|
||||
{
|
||||
_searchMediaHelper = new MediaHelper();
|
||||
_searchMediaHelper.init(396,searchMediaCallback,true);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
removeListeners();
|
||||
_searchMediaHelper.destroy();
|
||||
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 _loc3_:Buddy = null;
|
||||
_searchPopup.notFoundTab.visible = true;
|
||||
LocalizationManager.translateId(_searchPopup.notFoundTab.getChildAt(1),11369);
|
||||
var _loc1_:String = _searchPopup.userNameTxt.text;
|
||||
if(gMainFrame.userInfo.myUserName.toLowerCase() == _loc1_.toLowerCase())
|
||||
{
|
||||
LocalizationManager.translateId(_searchPopup.notFoundTab.getChildAt(1),11370);
|
||||
gMainFrame.stage.focus = _searchPopup.userNameTxt;
|
||||
return;
|
||||
}
|
||||
var _loc2_:String = _loc1_.toLowerCase();
|
||||
if(_lastSearchedName != _loc2_)
|
||||
{
|
||||
_lastSearchedName = _loc2_;
|
||||
_loc3_ = BuddyManager.getBuddyByUserName(_loc2_);
|
||||
if(_loc3_)
|
||||
{
|
||||
_searchPopup.notFoundTab.visible = false;
|
||||
BuddyCard.showBuddyCard({
|
||||
"userName":_loc3_.userName,
|
||||
"onlineStatus":_loc3_.onlineStatus
|
||||
});
|
||||
destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
_searchPopup.notFoundTab.visible = false;
|
||||
_searchPopup.itemBlock.visible = true;
|
||||
AvatarXtCommManager.requestAvatarGet(_loc1_,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())
|
||||
{
|
||||
BuddyCard.showBuddyCard({
|
||||
"userName":param1,
|
||||
"onlineStatus":param3
|
||||
});
|
||||
destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
_searchPopup.notFoundTab.visible = true;
|
||||
gMainFrame.stage.focus = _searchPopup.userNameTxt;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BuddyCard.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 _loc5_:Object = null;
|
||||
var _loc4_: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)
|
||||
{
|
||||
_loc5_ = _pollDefCache[param1[_loc6_]];
|
||||
if(!_loc5_)
|
||||
{
|
||||
_loc4_ = new PollDefHelper();
|
||||
_loc4_.init(param1[_loc6_],onPollDefReceived);
|
||||
_pollDefHelpers[param1[_loc6_]] = _loc4_;
|
||||
}
|
||||
else
|
||||
{
|
||||
setUpPoll(_loc5_);
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function setupNonTabPoll(param1:int, param2:Function = null) : void
|
||||
{
|
||||
var _loc3_:PollDefHelper = null;
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_pollDefHelpers = [];
|
||||
var _loc4_:Object = _pollDefCache[param1];
|
||||
_nonTabPollCloseCallback = param2;
|
||||
if(!_loc4_)
|
||||
{
|
||||
_loc3_ = new PollDefHelper();
|
||||
_loc3_.init(param1,onNonTabPollDefReceived);
|
||||
_pollDefHelpers[param1] = _loc3_;
|
||||
}
|
||||
else if(_pollDefHelpers[param1] == null)
|
||||
{
|
||||
setupNonTabPollPopup(_loc4_);
|
||||
}
|
||||
}
|
||||
|
||||
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 _loc2_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
if(children != null)
|
||||
{
|
||||
_loc2_ = int(children.length);
|
||||
_loc3_ = 0;
|
||||
while(_loc3_ < _loc2_)
|
||||
{
|
||||
if(children[_loc3_].char == param1)
|
||||
{
|
||||
return _loc3_;
|
||||
}
|
||||
_loc3_++;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,739 @@
|
||||
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 _loc4_:int = 0;
|
||||
var _loc3_:Array = param1.split(",");
|
||||
_specialCharsMap = new Dictionary();
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc3_.length)
|
||||
{
|
||||
_loc2_ = _loc3_[_loc4_].split("|");
|
||||
_specialCharsMap[_loc2_[0]] = _loc2_[1];
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
|
||||
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 _loc4_:int = 0;
|
||||
var _loc6_:int = 0;
|
||||
var _loc3_:int = 0;
|
||||
var _loc2_:Boolean = false;
|
||||
var _loc5_:Boolean = false;
|
||||
if(param1.children)
|
||||
{
|
||||
_loc4_ = int(param1.children.length);
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc4_)
|
||||
{
|
||||
optimizeTree(param1.children[_loc6_]);
|
||||
if(param1.weight > 0 || param1 == _defaultRoot || _loc4_ > 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;
|
||||
_loc2_ = _lastKnowWordNode.isSpecialLangChar;
|
||||
_loc5_ = _lastKnowWordNode.isSpecialCharacter;
|
||||
_lastKnowWordNode = param1;
|
||||
_lastKnowWordNode.weight = _loc3_;
|
||||
_optimizationString += param1.char;
|
||||
if(_loc2_)
|
||||
{
|
||||
_lastKnowWordNode.isSpecialLangChar = _loc2_;
|
||||
}
|
||||
if(_loc5_)
|
||||
{
|
||||
_lastKnowWordNode.isSpecialCharacter = _loc5_;
|
||||
}
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
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 _loc1_:Object = null;
|
||||
var _loc2_:int = 0;
|
||||
if(_searchChildren.length > 0)
|
||||
{
|
||||
_loc1_ = _searchChildren[_searchChildren.length - 1];
|
||||
if(_loc1_.node)
|
||||
{
|
||||
if(_currSearchNode)
|
||||
{
|
||||
if(_currSearchNode.isSpecialCharacter)
|
||||
{
|
||||
_loc2_ = 3;
|
||||
}
|
||||
else if(_currSearchNode.char.length > 1)
|
||||
{
|
||||
if(_charSearchIndex == _loc1_.node.char.length)
|
||||
{
|
||||
_loc2_ = canThisTypeUseThisWord(_loc1_.node);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = 1;
|
||||
}
|
||||
}
|
||||
else if(_currSearchNode.char.charAt(_charSearchIndex) == _loc1_.node.char)
|
||||
{
|
||||
_loc2_ = canThisTypeUseThisWord(_loc1_.node);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc2_ = 2;
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
_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 _loc3_:* = undefined;
|
||||
var _loc2_:String = "";
|
||||
if(_currSearchNode)
|
||||
{
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _currSearchNode.char.length)
|
||||
{
|
||||
_loc1_ = _currSearchNode.char.charAt(_loc4_);
|
||||
if(_loc1_ == "-")
|
||||
{
|
||||
_loc2_ += "|\\-";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_specialCharsMap && _specialCharsMap[_loc1_])
|
||||
{
|
||||
_loc2_ += "|" + _specialCharsMap[_loc1_];
|
||||
}
|
||||
_loc2_ += "|" + _loc1_;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
_loc3_ = _currSearchNode.children;
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc3_.length)
|
||||
{
|
||||
_loc1_ = _loc3_[_loc4_].char.charAt(0);
|
||||
if(_loc1_ == "-")
|
||||
{
|
||||
_loc2_ += "|\\-";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_specialCharsMap && _specialCharsMap[_loc1_])
|
||||
{
|
||||
_loc2_ += "|" + _specialCharsMap[_loc1_];
|
||||
}
|
||||
_loc2_ += "|" + _loc1_;
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
return _loc2_;
|
||||
}
|
||||
|
||||
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 _loc3_:int = 0;
|
||||
var _loc4_:int = 0;
|
||||
var _loc2_:PredictiveTextNode = null;
|
||||
if(_currSearchNode)
|
||||
{
|
||||
_loc3_ = int(_currSearchNode.children.length);
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc3_)
|
||||
{
|
||||
_hasCompletedCheckingMyself = false;
|
||||
_loc2_ = _currSearchNode.children[_loc4_];
|
||||
if(_loc2_.isSpecialCharacter)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if(_loc2_.char == param1)
|
||||
{
|
||||
_searchChildren.push({
|
||||
"node":_loc2_,
|
||||
"wordIndex":0
|
||||
});
|
||||
_currSearchNode = _loc2_;
|
||||
return canThisTypeUseThisWord(_loc2_);
|
||||
}
|
||||
if(_loc2_.char.length > 1)
|
||||
{
|
||||
if(_loc2_.char.charAt(_charSearchIndex) == param1)
|
||||
{
|
||||
_charSearchIndex = _charSearchIndex + 1;
|
||||
if(_charSearchIndex == _loc2_.char.length)
|
||||
{
|
||||
_searchChildren.push({
|
||||
"node":_loc2_,
|
||||
"wordIndex":_charSearchIndex
|
||||
});
|
||||
_currSearchNode = _loc2_;
|
||||
_charSearchIndex = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_searchChildren.push({
|
||||
"node":_loc2_,
|
||||
"wordIndex":_charSearchIndex
|
||||
});
|
||||
_currSearchNode = _loc2_;
|
||||
}
|
||||
return canThisTypeUseThisWord(_loc2_,true);
|
||||
}
|
||||
}
|
||||
_loc4_++;
|
||||
}
|
||||
}
|
||||
_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 _loc6_:int = 0;
|
||||
var _loc4_:PredictiveTextNode = param1 != null ? param1 : _currSearchNode;
|
||||
if(_loc4_ == _root)
|
||||
{
|
||||
return _similarWords;
|
||||
}
|
||||
if(param3 == null)
|
||||
{
|
||||
param3 = _currSearchNode;
|
||||
}
|
||||
if(_loc4_)
|
||||
{
|
||||
_loc5_ = int(_searchChildren[_searchChildren.length - 1].wordIndex);
|
||||
if(_loc4_ == _currSearchNode && _currSearchNode.char.length > 1 && _currSearchNode.weight > 0 && _loc5_ < _currSearchNode.char.length)
|
||||
{
|
||||
if(canThisTypeUseThisWord(_loc4_,false,false) == 2)
|
||||
{
|
||||
_similarWords.push({
|
||||
"word":appendCompletionString(""),
|
||||
"weight":_currSearchNode.weight,
|
||||
"index":_loc5_
|
||||
});
|
||||
_similarWordsIndex = _similarWordsIndex + 1;
|
||||
}
|
||||
}
|
||||
_loc6_ = 0;
|
||||
while(_loc6_ < _loc4_.children.length)
|
||||
{
|
||||
if(_loc4_ != param3)
|
||||
{
|
||||
param2 += _loc4_.char;
|
||||
param3 = _loc4_;
|
||||
}
|
||||
if(_similarWords.length <= _similarWordsIndex)
|
||||
{
|
||||
if(canThisTypeUseThisWord(_loc4_.children[_loc6_],false,false) == 2)
|
||||
{
|
||||
_similarWords.push({
|
||||
"word":param2,
|
||||
"weight":_loc4_.children[_loc6_].weight
|
||||
});
|
||||
_similarWords[_similarWordsIndex].word += _loc4_.children[_loc6_].char;
|
||||
_similarWords[_similarWordsIndex].weight = _loc4_.children[_loc6_].weight;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_similarWords[_similarWordsIndex].word += _loc4_.children[_loc6_].char;
|
||||
_similarWords[_similarWordsIndex].weight = _loc4_.children[_loc6_].weight;
|
||||
}
|
||||
if(_loc4_.children[_loc6_].weight > 0 && _similarWords.length > _similarWordsIndex)
|
||||
{
|
||||
_similarWords[_similarWordsIndex].word = appendCompletionString(_similarWords[_similarWordsIndex].word);
|
||||
_similarWords[_similarWordsIndex].weight = _loc4_.children[_loc6_].weight;
|
||||
if(_loc4_ != _currSearchNode)
|
||||
{
|
||||
return _similarWords;
|
||||
}
|
||||
_similarWordsIndex = _similarWordsIndex + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
findAllSimilarWords(_loc4_.children[_loc6_],param2);
|
||||
_similarWordsIndex = _similarWordsIndex + 1;
|
||||
}
|
||||
_loc6_++;
|
||||
}
|
||||
if(param1 == null && _loc4_.children.length == 0)
|
||||
{
|
||||
if(canThisTypeUseThisWord(_loc4_,false,false) == 2)
|
||||
{
|
||||
_similarWords.push({
|
||||
"word":appendCompletionString(""),
|
||||
"weight":_loc4_.weight
|
||||
});
|
||||
}
|
||||
}
|
||||
_similarWordsIndex = _similarWordsIndex - 1;
|
||||
}
|
||||
return _similarWords;
|
||||
}
|
||||
|
||||
public function findAllLanguageSpecialChars(param1:String) : Array
|
||||
{
|
||||
var _loc5_:int = 0;
|
||||
var _loc4_:PredictiveTextNode = null;
|
||||
var _loc2_:String = null;
|
||||
var _loc3_:Array = [];
|
||||
if(_searchChildren.length > 0)
|
||||
{
|
||||
if(_searchChildren.length == 1 || _searchChildren[_searchChildren.length - 2].node == null)
|
||||
{
|
||||
_loc4_ = theRoot;
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ = _searchChildren[_searchChildren.length - 2].node;
|
||||
}
|
||||
if(_loc4_.char.length > 1 && _loc4_.isSpecialLangChar)
|
||||
{
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc4_.char.length)
|
||||
{
|
||||
_loc2_ = _loc4_.char.charAt(_loc5_);
|
||||
if(_specialCharsMap[_loc2_] == param1)
|
||||
{
|
||||
_loc3_.push(_loc4_.char.charAt(_loc5_));
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
_loc5_ = 0;
|
||||
while(_loc5_ < _loc4_.children.length)
|
||||
{
|
||||
if(_loc4_.children[_loc5_].isSpecialLangChar)
|
||||
{
|
||||
_loc2_ = _loc4_.children[_loc5_].char.charAt(0);
|
||||
if(_specialCharsMap[_loc2_] == param1)
|
||||
{
|
||||
_loc3_.push(_loc4_.children[_loc5_].char.charAt(0));
|
||||
}
|
||||
}
|
||||
_loc5_++;
|
||||
}
|
||||
}
|
||||
return _loc3_;
|
||||
}
|
||||
|
||||
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 _loc2_:PredictiveTextNode = null;
|
||||
var _loc3_:int = 0;
|
||||
var _loc4_:String = "";
|
||||
if(_searchChildren)
|
||||
{
|
||||
_loc3_ = _searchChildren.length - 1;
|
||||
for(; _loc3_ >= 0; _loc3_--)
|
||||
{
|
||||
if(!(_searchChildren[_loc3_].node && !_searchChildren[_loc3_].node.isSpecialCharacter))
|
||||
{
|
||||
break;
|
||||
}
|
||||
if(_loc2_)
|
||||
{
|
||||
if(_loc2_ == _searchChildren[_loc3_].node)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(_searchChildren[_loc3_].node.char.length > 1)
|
||||
{
|
||||
_loc4_ += reverseString(_searchChildren[_loc3_].node.char);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ += _searchChildren[_loc3_].node.char;
|
||||
}
|
||||
_loc2_ = _searchChildren[_loc3_].node;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(_searchChildren[_loc3_].node.char.length > 1)
|
||||
{
|
||||
_loc4_ += reverseString(_searchChildren[_loc3_].node.char);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loc4_ += _searchChildren[_loc3_].node.char;
|
||||
}
|
||||
_loc2_ = _searchChildren[_loc3_].node;
|
||||
}
|
||||
}
|
||||
}
|
||||
return reverseString(_loc4_) + 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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