mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-19 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,190 @@
|
||||
package trade
|
||||
{
|
||||
import com.sbi.popup.SBPopupManager;
|
||||
import flash.display.DisplayObjectContainer;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.MouseEvent;
|
||||
import gui.DarkenManager;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class TradeConfirmPopup
|
||||
{
|
||||
|
||||
public static const TYPE_NORMAL:int = 0;
|
||||
|
||||
public static const TYPE_RARE:int = 1;
|
||||
|
||||
public static const TYPE_RARES:int = 2;
|
||||
|
||||
public static const TYPE_DIAMOND:int = 3;
|
||||
|
||||
public static const TYPE_DIAMONDS:int = 4;
|
||||
|
||||
public static const TYPE_RARE_DIAMONDS:int = 5;
|
||||
|
||||
public static const TYPE_RARE_DIAMOND:int = 6;
|
||||
|
||||
private static const TRADE_POPUP_MEDIA_ID:int = 3891;
|
||||
|
||||
private var _mediaHelper:MediaHelper;
|
||||
|
||||
private var _parentLayer:DisplayObjectContainer;
|
||||
|
||||
private var _type:int;
|
||||
|
||||
private var _confirmCallback:Function;
|
||||
|
||||
private var _passback:Object;
|
||||
|
||||
private var _confirmPopup:MovieClip;
|
||||
|
||||
private var _frameName:String;
|
||||
|
||||
private var _isForGifting:Boolean;
|
||||
|
||||
public function TradeConfirmPopup(param1:DisplayObjectContainer, param2:int, param3:Boolean, param4:Function = null, param5:Object = null)
|
||||
{
|
||||
super();
|
||||
SBPopupManager.nonSBPopups.push(this);
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
_parentLayer = param1;
|
||||
_type = param2;
|
||||
_isForGifting = param3;
|
||||
switch(_type - 1)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
_frameName = "rare";
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
_frameName = "diamond";
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
_frameName = "rareDiamond";
|
||||
break;
|
||||
default:
|
||||
_frameName = "reg";
|
||||
}
|
||||
_confirmCallback = param4;
|
||||
_passback = param5;
|
||||
_mediaHelper = new MediaHelper();
|
||||
_mediaHelper.init(3891,onPopupLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
SBPopupManager.destroySpecificNonSBPopup(this);
|
||||
removeEventListeners();
|
||||
DarkenManager.unDarken(_confirmPopup);
|
||||
_parentLayer.removeChild(_confirmPopup);
|
||||
_confirmPopup = null;
|
||||
}
|
||||
|
||||
private function onPopupLoaded(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
_confirmPopup = MovieClip(param1.getChildAt(0));
|
||||
_confirmPopup.x = 900 * 0.5;
|
||||
_confirmPopup.y = 550 * 0.5;
|
||||
_parentLayer.addChild(_confirmPopup);
|
||||
DarkenManager.darken(_confirmPopup);
|
||||
_confirmPopup.gotoAndStop(_frameName);
|
||||
if(_isForGifting)
|
||||
{
|
||||
if(_type == 2 || _type == 1)
|
||||
{
|
||||
LocalizationManager.translateId(_confirmPopup.popupTxt,27607,true);
|
||||
}
|
||||
else if(_type == 4 || _type == 3)
|
||||
{
|
||||
LocalizationManager.translateId(_confirmPopup.popupTxt,27608,true);
|
||||
}
|
||||
else if(_type == 5 || _type == 6)
|
||||
{
|
||||
LocalizationManager.translateId(_confirmPopup.popupTxt,27680,true);
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalizationManager.translateId(_confirmPopup.popupTxt,27609);
|
||||
}
|
||||
LocalizationManager.translateId(_confirmPopup.yesBtn.yesTxt,4);
|
||||
}
|
||||
else if(_type == 2)
|
||||
{
|
||||
LocalizationManager.translateId(_confirmPopup.popupTxt,21881,true);
|
||||
}
|
||||
else if(_type == 1)
|
||||
{
|
||||
LocalizationManager.translateId(_confirmPopup.popupTxt,21646,true);
|
||||
}
|
||||
else if(_type == 4)
|
||||
{
|
||||
LocalizationManager.translateId(_confirmPopup.popupTxt,21882,true);
|
||||
}
|
||||
else if(_type == 3)
|
||||
{
|
||||
LocalizationManager.translateId(_confirmPopup.popupTxt,21648,true);
|
||||
}
|
||||
else if(_type == 6)
|
||||
{
|
||||
LocalizationManager.translateId(_confirmPopup.popupTxt,27681,true);
|
||||
}
|
||||
else if(_type == 5)
|
||||
{
|
||||
LocalizationManager.translateId(_confirmPopup.popupTxt,21880,true);
|
||||
}
|
||||
addEventListeners();
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
if(_confirmPopup)
|
||||
{
|
||||
_confirmPopup.addEventListener("mouseDown",onPopup,false,0,true);
|
||||
_confirmPopup.yesBtn.addEventListener("mouseDown",onConfirm,false,0,true);
|
||||
_confirmPopup.noBtn.addEventListener("mouseDown",onConfirm,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
if(_confirmPopup)
|
||||
{
|
||||
_confirmPopup.removeEventListener("mouseDown",onPopup);
|
||||
_confirmPopup.yesBtn.removeEventListener("mouseDown",onConfirm);
|
||||
_confirmPopup.noBtn.removeEventListener("mouseDown",onConfirm);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onConfirm(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_confirmCallback != null)
|
||||
{
|
||||
if(_passback != null)
|
||||
{
|
||||
_confirmCallback(param1.currentTarget == _confirmPopup.yesBtn,_passback);
|
||||
_passback = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_confirmCallback(param1.currentTarget == _confirmPopup.yesBtn);
|
||||
}
|
||||
_confirmCallback = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package trade
|
||||
{
|
||||
import collection.TradeItemCollection;
|
||||
import com.sbi.client.SFEvent;
|
||||
import gui.TradeManager;
|
||||
|
||||
public class TradeXtCommManager
|
||||
{
|
||||
|
||||
public function TradeXtCommManager()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function init() : void
|
||||
{
|
||||
}
|
||||
|
||||
public static function sendTradeListRequest(param1:String) : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("tl",[param1]);
|
||||
}
|
||||
|
||||
public static function sendTradeBusyRequest(param1:Boolean) : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("tb",[param1 ? "1" : "0"]);
|
||||
}
|
||||
|
||||
public static function sendTradeItemsRequest(param1:String, param2:int, param3:int, param4:Array, param5:Array, param6:int, param7:Array, param8:int) : void
|
||||
{
|
||||
var _loc9_:int = int(param4.length);
|
||||
var _loc10_:int = param5.length - param6;
|
||||
var _loc11_:Array = [0,param1,param3,param2,_loc9_,_loc10_,param6,param8];
|
||||
if(_loc9_ > 0)
|
||||
{
|
||||
_loc11_ = _loc11_.concat(param4);
|
||||
}
|
||||
if(_loc10_ + param6 > 0)
|
||||
{
|
||||
_loc11_ = _loc11_.concat(param5.concat());
|
||||
}
|
||||
if(param8 > 0)
|
||||
{
|
||||
_loc11_ = _loc11_.concat(param7.concat());
|
||||
}
|
||||
gMainFrame.server.setXtObject_Str("ti",_loc11_);
|
||||
}
|
||||
|
||||
public static function sendTradeSetRequest(param1:TradeItemCollection, param2:TradeItemCollection) : void
|
||||
{
|
||||
var _loc4_:int = 0;
|
||||
var _loc7_:int = int(param1 ? param1.length : 0);
|
||||
var _loc3_:int = int(param2 ? param2.length : 0);
|
||||
var _loc6_:Array = new Array(2 + (_loc7_ + _loc3_) * 2);
|
||||
var _loc5_:int = 0;
|
||||
_loc6_[_loc5_++] = _loc3_;
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc3_)
|
||||
{
|
||||
_loc6_[_loc5_++] = param2.getTradeItem(_loc4_).itemType;
|
||||
_loc6_[_loc5_++] = param2.getTradeItem(_loc4_).invIdx;
|
||||
_loc4_++;
|
||||
}
|
||||
_loc6_[_loc5_++] = _loc7_;
|
||||
_loc4_ = 0;
|
||||
while(_loc4_ < _loc7_)
|
||||
{
|
||||
_loc6_[_loc5_++] = param1.getTradeItem(_loc4_).itemType;
|
||||
_loc6_[_loc5_++] = param1.getTradeItem(_loc4_).invIdx;
|
||||
_loc4_++;
|
||||
}
|
||||
gMainFrame.server.setXtObject_Str("ts",_loc6_);
|
||||
}
|
||||
|
||||
public static function sendTradeItemAcceptOrReject(param1:int) : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("ti",[1,param1]);
|
||||
}
|
||||
|
||||
public static function sendTradeItemCancel() : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("ti",[2]);
|
||||
}
|
||||
|
||||
public static function sendConfirmTrade(param1:Boolean) : void
|
||||
{
|
||||
gMainFrame.server.setXtObject_Str("ti",[3,param1 ? 1 : 0]);
|
||||
}
|
||||
|
||||
public static function handleXtReply(param1:SFEvent) : void
|
||||
{
|
||||
var _loc2_:Object = param1.obj;
|
||||
switch(_loc2_[0])
|
||||
{
|
||||
case "tl":
|
||||
TradeManager.onTradeListReceived(_loc2_);
|
||||
break;
|
||||
case "ti":
|
||||
TradeManager.onTradeItemsResponse(_loc2_);
|
||||
break;
|
||||
default:
|
||||
throw new Error("ECardXtCommManager: Received illegal cmd: " + _loc2_[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,458 @@
|
||||
package trade
|
||||
{
|
||||
import com.sbi.corelib.audio.SBAudio;
|
||||
import com.sbi.loader.LoaderCache;
|
||||
import flash.display.MovieClip;
|
||||
import flash.events.Event;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.TimerEvent;
|
||||
import flash.media.Sound;
|
||||
import flash.media.SoundTransform;
|
||||
import flash.utils.Timer;
|
||||
import gui.GuiManager;
|
||||
import gui.LoadingSpiral;
|
||||
import loader.MediaHelper;
|
||||
import localization.LocalizationManager;
|
||||
|
||||
public class TutorialPopups
|
||||
{
|
||||
|
||||
private static var _tutorialMediaHelper:MediaHelper;
|
||||
|
||||
private static var _talkingTutorialPopup:MovieClip;
|
||||
|
||||
private static var _tutorialTextPopup:MovieClip;
|
||||
|
||||
private static var _talkingLoadingSpiral:LoadingSpiral;
|
||||
|
||||
private static var _talkingTutorialTimer:Timer;
|
||||
|
||||
private static var _soundIds:Array;
|
||||
|
||||
public function TutorialPopups()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public static function openTutorialTextPopup(param1:int, param2:int, param3:int) : void
|
||||
{
|
||||
if(_tutorialTextPopup)
|
||||
{
|
||||
_tutorialTextPopup.x = param2;
|
||||
_tutorialTextPopup.y = param3;
|
||||
_tutorialTextPopup.message_txt.text = LocalizationManager.translateIdOnly(param1);
|
||||
_tutorialTextPopup.balloon_bg.m.height = Math.floor(_tutorialTextPopup.message_txt.height + 10);
|
||||
_tutorialTextPopup.balloon_bg.b.y = Math.round(_tutorialTextPopup.balloon_bg.m.y + _tutorialTextPopup.balloon_bg.m.height);
|
||||
tutorialTextVoSetup(param1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_tutorialMediaHelper = new MediaHelper();
|
||||
_tutorialMediaHelper.init(2875,onTutorialLoaded,{
|
||||
"message":param1,
|
||||
"x":param2,
|
||||
"y":param3
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static function tutorialTextVoSetup(param1:int) : void
|
||||
{
|
||||
if(_soundIds == null)
|
||||
{
|
||||
setupSoundIds();
|
||||
}
|
||||
var _loc2_:Sound = new Sound();
|
||||
switch(param1 - 18659)
|
||||
{
|
||||
case 0:
|
||||
_loc2_.load(LoaderCache.fetchCDNURLRequest("streams/" + _soundIds[LocalizationManager.currentLanguage][5] + ".mp3"));
|
||||
break;
|
||||
case 1:
|
||||
_loc2_.load(LoaderCache.fetchCDNURLRequest("streams/" + _soundIds[LocalizationManager.currentLanguage][6] + ".mp3"));
|
||||
}
|
||||
_tutorialTextPopup.sound = _loc2_;
|
||||
if(_tutorialTextPopup.currSoundChannel)
|
||||
{
|
||||
_tutorialTextPopup.currSoundChannel.stop();
|
||||
_tutorialTextPopup.currSoundChannel = null;
|
||||
}
|
||||
_tutorialTextPopup.currSoundChannel = _loc2_.play(0,0,new SoundTransform(SBAudio.isMusicMuted ? 0 : volumeLevel()));
|
||||
}
|
||||
|
||||
private static function onTutorialLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_tutorialTextPopup = MovieClip(param1.getChildAt(0));
|
||||
_tutorialTextPopup.x = param1.passback.x;
|
||||
_tutorialTextPopup.y = param1.passback.y;
|
||||
_tutorialTextPopup.message_txt.autoSize = "center";
|
||||
_tutorialTextPopup.message_txt.text = LocalizationManager.translateIdOnly(param1.passback.message);
|
||||
_tutorialTextPopup.balloon_bg.m.height = Math.floor(_tutorialTextPopup.message_txt.height + 10);
|
||||
_tutorialTextPopup.balloon_bg.b.y = Math.round(_tutorialTextPopup.balloon_bg.m.y + _tutorialTextPopup.balloon_bg.m.height);
|
||||
0;
|
||||
tutorialTextVoSetup(param1.passback.message);
|
||||
GuiManager.guiLayer.addChild(_tutorialTextPopup);
|
||||
_tutorialMediaHelper.destroy();
|
||||
_tutorialMediaHelper = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function openTalkingTutorial(param1:int, param2:int, param3:int, param4:int, param5:MovieClip, param6:MovieClip = null) : void
|
||||
{
|
||||
if(_talkingTutorialPopup)
|
||||
{
|
||||
if(param3 != -1)
|
||||
{
|
||||
_talkingTutorialPopup.x = param3;
|
||||
}
|
||||
if(param4 != -1)
|
||||
{
|
||||
_talkingTutorialPopup.y = param4;
|
||||
}
|
||||
_talkingTutorialPopup.cont.popupCont.txt.text = LocalizationManager.translateIdOnly(param1);
|
||||
_talkingTutorialPopup.cont.popupCont.bg.m.height = Math.floor(_talkingTutorialPopup.cont.popupCont.txt.textHeight + 6);
|
||||
_talkingTutorialPopup.cont.popupCont.bg.b.y = Math.floor(_talkingTutorialPopup.cont.popupCont.bg.m.y + _talkingTutorialPopup.cont.popupCont.bg.m.height);
|
||||
_talkingTutorialPopup.buttonToTurnOn = param5;
|
||||
_talkingTutorialPopup.layerToTurnOn = param6;
|
||||
if(_talkingTutorialPopup.currSoundChannel != null)
|
||||
{
|
||||
_talkingTutorialPopup.currSoundChannel.stop();
|
||||
_talkingTutorialPopup.currSoundChannel = null;
|
||||
}
|
||||
if(param2 != 0)
|
||||
{
|
||||
LocalizationManager.translateId(_talkingTutorialPopup.cont.popupCont.talkingHeadTitleTxt,21401);
|
||||
}
|
||||
setupTalkingTutorialSound(param1);
|
||||
if(_talkingTutorialPopup.cont.currentFrameLabel != "closed")
|
||||
{
|
||||
_talkingTutorialPopup.cont.gotoAndStop("closed");
|
||||
}
|
||||
if(_talkingTutorialTimer == null)
|
||||
{
|
||||
_talkingTutorialTimer = new Timer(1000);
|
||||
_talkingTutorialTimer.addEventListener("timer",onTalkingTutorialTimerComplete,false,0,true);
|
||||
}
|
||||
if(_talkingTutorialPopup.talkingHead)
|
||||
{
|
||||
_talkingTutorialPopup.talkingHead.NPC.gotoAndStop(1);
|
||||
}
|
||||
_talkingTutorialTimer.reset();
|
||||
_talkingTutorialTimer.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
_tutorialMediaHelper = new MediaHelper();
|
||||
_tutorialMediaHelper.init(2872,onTalkingTutorialLoaded,{
|
||||
"message":param1,
|
||||
"titleTxt":param2,
|
||||
"x":param3,
|
||||
"y":param4,
|
||||
"buttonToTurnOn":param5,
|
||||
"layerToTurnOn":param6
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static function setupTalkingTutorialSound(param1:int) : void
|
||||
{
|
||||
if(_soundIds == null)
|
||||
{
|
||||
setupSoundIds();
|
||||
}
|
||||
var _loc2_:Sound = new Sound();
|
||||
switch(param1)
|
||||
{
|
||||
case 18654:
|
||||
_loc2_.load(LoaderCache.fetchCDNURLRequest("streams/" + _soundIds[LocalizationManager.currentLanguage][0] + ".mp3"));
|
||||
break;
|
||||
case 18655:
|
||||
_loc2_.load(LoaderCache.fetchCDNURLRequest("streams/" + _soundIds[LocalizationManager.currentLanguage][1] + ".mp3"));
|
||||
break;
|
||||
case 18656:
|
||||
_loc2_.load(LoaderCache.fetchCDNURLRequest("streams/" + _soundIds[LocalizationManager.currentLanguage][2] + ".mp3"));
|
||||
break;
|
||||
case 21388:
|
||||
_loc2_.load(LoaderCache.fetchCDNURLRequest("streams/" + _soundIds[LocalizationManager.currentLanguage][3] + ".mp3"));
|
||||
break;
|
||||
case 18658:
|
||||
_loc2_.load(LoaderCache.fetchCDNURLRequest("streams/" + _soundIds[LocalizationManager.currentLanguage][4] + ".mp3"));
|
||||
break;
|
||||
case 18661:
|
||||
_loc2_.load(LoaderCache.fetchCDNURLRequest("streams/" + _soundIds[LocalizationManager.currentLanguage][7] + ".mp3"));
|
||||
}
|
||||
_talkingTutorialPopup.sound = _loc2_;
|
||||
}
|
||||
|
||||
private static function onTalkingTutorialTimerComplete(param1:TimerEvent) : void
|
||||
{
|
||||
if(_talkingTutorialPopup)
|
||||
{
|
||||
if(_talkingTutorialPopup.cont.currentFrameLabel == "closed")
|
||||
{
|
||||
_talkingTutorialPopup.cont.gotoAndPlay("opening");
|
||||
if(_talkingTutorialPopup.talkingHead)
|
||||
{
|
||||
_talkingTutorialPopup.talkingHead.NPC.gotoAndPlay(1);
|
||||
}
|
||||
_talkingTutorialPopup.lizaHeadFrameHolder.glow.visible = false;
|
||||
}
|
||||
if(_talkingTutorialPopup.buttonToTurnOn)
|
||||
{
|
||||
_talkingTutorialPopup.buttonToTurnOn.gotoAndStop("new");
|
||||
_talkingTutorialPopup.buttonToTurnOn.setButtonState(2);
|
||||
}
|
||||
if(_talkingTutorialPopup.layerToTurnOn && _talkingTutorialPopup.layerToTurnOn.parent)
|
||||
{
|
||||
_talkingTutorialPopup.layerToTurnOn.parent.gotoAndStop("new");
|
||||
_talkingTutorialPopup.layerToTurnOn.visible = true;
|
||||
}
|
||||
_talkingTutorialTimer.reset();
|
||||
if(_talkingTutorialPopup.sound && _talkingTutorialPopup.sound.bytesLoaded != 0 && _talkingTutorialPopup.sound.bytesLoaded == _talkingTutorialPopup.sound.bytesTotal)
|
||||
{
|
||||
_talkingTutorialPopup.currSoundChannel = (_talkingTutorialPopup.sound as Sound).play(0,0,new SoundTransform(SBAudio.isMusicMuted ? 0 : volumeLevel()));
|
||||
if(_talkingTutorialPopup.currSoundChannel)
|
||||
{
|
||||
_talkingTutorialPopup.currSoundChannel.addEventListener("soundComplete",onPlaybackComplete);
|
||||
}
|
||||
else
|
||||
{
|
||||
onPlaybackComplete(null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_talkingTutorialTimer.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function onPlaybackComplete(param1:Event) : void
|
||||
{
|
||||
if(_talkingTutorialPopup)
|
||||
{
|
||||
if(_talkingTutorialPopup.talkingHead)
|
||||
{
|
||||
_talkingTutorialPopup.talkingHead.NPC.gotoAndStop(1);
|
||||
}
|
||||
if(_talkingTutorialPopup.currSoundChannel)
|
||||
{
|
||||
_talkingTutorialPopup.currSoundChannel = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function onTalkingTutorialLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
_talkingTutorialPopup = MovieClip(param1.getChildAt(0));
|
||||
_talkingTutorialPopup.scaleX = 0.7;
|
||||
_talkingTutorialPopup.scaleY = 0.7;
|
||||
_talkingTutorialPopup.x = param1.passback.x;
|
||||
_talkingTutorialPopup.y = param1.passback.y;
|
||||
_talkingTutorialPopup.addEventListener("mouseDown",onTutorialPopup,false,0,true);
|
||||
_talkingTutorialPopup.cont.popupCont.bx.addEventListener("mouseDown",onTutorialPopup,false,0,true);
|
||||
_talkingTutorialPopup.cont.popupCont.voBtn.addEventListener("mouseDown",onTutorialVoBtn,false,0,true);
|
||||
_talkingTutorialPopup.cont.popupCont.txt.autoSize = "center";
|
||||
_talkingTutorialPopup.cont.popupCont.txt.text = LocalizationManager.translateIdOnly(param1.passback.message);
|
||||
_talkingTutorialPopup.cont.popupCont.bg.m.height = Math.floor(_talkingTutorialPopup.cont.popupCont.txt.textHeight + 6);
|
||||
_talkingTutorialPopup.cont.popupCont.bg.b.y = Math.floor(_talkingTutorialPopup.cont.popupCont.bg.m.y + _talkingTutorialPopup.cont.popupCont.bg.m.height);
|
||||
LocalizationManager.translateId(_talkingTutorialPopup.cont.popupCont.talkingHeadTitleTxt,21401);
|
||||
_talkingTutorialPopup.lizaHeadFrameHolder.glow.visible = false;
|
||||
_talkingTutorialPopup.buttonToTurnOn = param1.passback.buttonToTurnOn;
|
||||
_talkingTutorialPopup.layerToTurnOn = param1.passback.layerToTurnOn;
|
||||
_talkingLoadingSpiral = new LoadingSpiral(_talkingTutorialPopup.itemRenderPlaceholder.itemWindow,_talkingTutorialPopup.itemRenderPlaceholder.itemWindow.width * 0.5,_talkingTutorialPopup.itemRenderPlaceholder.itemWindow.height * 0.5);
|
||||
_tutorialMediaHelper = new MediaHelper();
|
||||
_tutorialMediaHelper.init(2052,onTalkingHeadMediaLoaded);
|
||||
_talkingTutorialPopup.cont.gotoAndPlay("opening");
|
||||
GuiManager.guiLayer.addChild(_talkingTutorialPopup);
|
||||
setupTalkingTutorialSound(param1.passback.message);
|
||||
if(_talkingTutorialPopup.cont.currentFrameLabel != "closed")
|
||||
{
|
||||
_talkingTutorialPopup.cont.gotoAndStop("closed");
|
||||
}
|
||||
if(_talkingTutorialTimer == null)
|
||||
{
|
||||
_talkingTutorialTimer = new Timer(1000);
|
||||
_talkingTutorialTimer.addEventListener("timer",onTalkingTutorialTimerComplete,false,0,true);
|
||||
}
|
||||
_talkingTutorialTimer.reset();
|
||||
_talkingTutorialTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
private static function onTalkingHeadMediaLoaded(param1:MovieClip) : void
|
||||
{
|
||||
if(param1)
|
||||
{
|
||||
if(_talkingTutorialPopup != null)
|
||||
{
|
||||
_talkingTutorialPopup.talkingHead = param1.getChildAt(0);
|
||||
_talkingTutorialPopup.itemRenderPlaceholder.itemWindow.addChild(param1);
|
||||
_talkingLoadingSpiral.visible = false;
|
||||
if(_tutorialMediaHelper)
|
||||
{
|
||||
_tutorialMediaHelper.destroy();
|
||||
_tutorialMediaHelper = null;
|
||||
}
|
||||
_talkingTutorialPopup.talkingHead.NPC.gotoAndStop(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function onTutorialVoBtn(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_talkingTutorialPopup.currSoundChannel)
|
||||
{
|
||||
_talkingTutorialPopup.currSoundChannel.stop();
|
||||
_talkingTutorialPopup.currSoundChannel = null;
|
||||
if(_talkingTutorialPopup.talkingHead)
|
||||
{
|
||||
_talkingTutorialPopup.talkingHead.NPC.gotoAndStop(1);
|
||||
}
|
||||
}
|
||||
else if(_talkingTutorialPopup.sound)
|
||||
{
|
||||
_talkingTutorialPopup.currSoundChannel = _talkingTutorialPopup.sound.play(0,0,new SoundTransform(SBAudio.isMusicMuted ? 0 : volumeLevel()));
|
||||
_talkingTutorialPopup.currSoundChannel.addEventListener("soundComplete",onPlaybackComplete);
|
||||
if(_talkingTutorialPopup.talkingHead)
|
||||
{
|
||||
_talkingTutorialPopup.talkingHead.NPC.gotoAndPlay(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function onTutorialPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(_talkingTutorialPopup.cont.currentFrameLabel == "closed")
|
||||
{
|
||||
_talkingTutorialPopup.cont.gotoAndPlay("opening");
|
||||
if(_talkingTutorialPopup.talkingHead)
|
||||
{
|
||||
_talkingTutorialPopup.talkingHead.NPC.gotoAndPlay(1);
|
||||
}
|
||||
_talkingTutorialPopup.lizaHeadFrameHolder.glow.visible = false;
|
||||
if(_talkingTutorialPopup.buttonToTurnOn)
|
||||
{
|
||||
_talkingTutorialPopup.buttonToTurnOn.gotoAndStop("new");
|
||||
_talkingTutorialPopup.buttonToTurnOn.setButtonState(2);
|
||||
}
|
||||
if(_talkingTutorialPopup.layerToTurnOn)
|
||||
{
|
||||
_talkingTutorialPopup.layerToTurnOn.parent.gotoAndStop("new");
|
||||
_talkingTutorialPopup.layerToTurnOn.visible = true;
|
||||
}
|
||||
if(_talkingTutorialPopup.sound)
|
||||
{
|
||||
_talkingTutorialPopup.currSoundChannel = _talkingTutorialPopup.sound.play(0,0,new SoundTransform(SBAudio.isMusicMuted ? 0 : volumeLevel()));
|
||||
_talkingTutorialPopup.currSoundChannel.addEventListener("soundComplete",onPlaybackComplete);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_talkingTutorialPopup.cont.gotoAndPlay("closing");
|
||||
if(_talkingTutorialPopup.talkingHead)
|
||||
{
|
||||
_talkingTutorialPopup.talkingHead.NPC.gotoAndStop(1);
|
||||
}
|
||||
_talkingTutorialPopup.lizaHeadFrameHolder.glow.visible = true;
|
||||
if(_talkingTutorialPopup.buttonToTurnOn)
|
||||
{
|
||||
_talkingTutorialPopup.buttonToTurnOn.setButtonState(1);
|
||||
}
|
||||
if(_talkingTutorialPopup.layerToTurnOn)
|
||||
{
|
||||
_talkingTutorialPopup.layerToTurnOn.visible = false;
|
||||
}
|
||||
if(_talkingTutorialPopup.currSoundChannel)
|
||||
{
|
||||
_talkingTutorialPopup.currSoundChannel.stop();
|
||||
_talkingTutorialPopup.currSoundChannel = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static function setupSoundIds() : void
|
||||
{
|
||||
_soundIds = new Array(8);
|
||||
_soundIds[LocalizationManager.LANG_ENG] = [789,790,791,792,793,794,795,796];
|
||||
_soundIds[LocalizationManager.LANG_FRE] = [812,813,814,815,816,817,818,819];
|
||||
_soundIds[LocalizationManager.LANG_DE] = [820,821,822,823,824,825,826,827];
|
||||
_soundIds[LocalizationManager.LANG_POR] = [828,829,830,831,832,833,834,835];
|
||||
_soundIds[LocalizationManager.LANG_SPA] = [836,837,838,839,840,841,842,843];
|
||||
}
|
||||
|
||||
private static function volumeLevel() : Number
|
||||
{
|
||||
switch(LocalizationManager.currentLanguage)
|
||||
{
|
||||
case LocalizationManager.LANG_FRE:
|
||||
return 0.57;
|
||||
case LocalizationManager.LANG_POR:
|
||||
return 0.85;
|
||||
case LocalizationManager.LANG_SPA:
|
||||
return 0.7;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static function handleSoundBtnClick() : void
|
||||
{
|
||||
if(_tutorialTextPopup && _tutorialTextPopup.currSoundChannel)
|
||||
{
|
||||
_tutorialTextPopup.currSoundChannel.soundTransform = new SoundTransform(SBAudio.isMusicMuted ? 0 : volumeLevel());
|
||||
}
|
||||
if(_talkingTutorialPopup && _talkingTutorialPopup.currSoundChannel)
|
||||
{
|
||||
_talkingTutorialPopup.currSoundChannel.soundTransform = new SoundTransform(SBAudio.isMusicMuted ? 0 : volumeLevel());
|
||||
}
|
||||
}
|
||||
|
||||
public static function closeTutorialTextPopup() : void
|
||||
{
|
||||
if(_tutorialTextPopup)
|
||||
{
|
||||
GuiManager.guiLayer.removeChild(_tutorialTextPopup);
|
||||
if(_tutorialTextPopup.currSoundChannel)
|
||||
{
|
||||
_tutorialTextPopup.currSoundChannel.stop();
|
||||
_tutorialTextPopup.currSoundChannel = null;
|
||||
}
|
||||
_tutorialTextPopup = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static function closeTalkingTutorialPopup() : void
|
||||
{
|
||||
if(_talkingTutorialPopup)
|
||||
{
|
||||
if(_tutorialMediaHelper)
|
||||
{
|
||||
_tutorialMediaHelper.destroy();
|
||||
_tutorialMediaHelper = null;
|
||||
}
|
||||
if(_talkingTutorialPopup.currSoundChannel)
|
||||
{
|
||||
_talkingTutorialPopup.currSoundChannel.stop();
|
||||
_talkingTutorialPopup.currSoundChannel = null;
|
||||
}
|
||||
GuiManager.guiLayer.removeChild(_talkingTutorialPopup);
|
||||
_talkingTutorialPopup.removeEventListener("mouseDown",onTutorialPopup);
|
||||
_talkingTutorialPopup.cont.popupCont.bx.removeEventListener("mouseDown",onTutorialPopup);
|
||||
_talkingTutorialPopup = null;
|
||||
if(_talkingTutorialTimer)
|
||||
{
|
||||
_talkingTutorialTimer.reset();
|
||||
_talkingTutorialTimer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user