mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-21 01: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,148 @@
|
||||
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_DIAMOND:int = 5;
|
||||
|
||||
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;
|
||||
|
||||
public function TradeConfirmPopup(param1:DisplayObjectContainer, param2:int, param3:Function = null, param4:Object = null)
|
||||
{
|
||||
super();
|
||||
SBPopupManager.nonSBPopups.push(this);
|
||||
DarkenManager.showLoadingSpiral(true);
|
||||
this._parentLayer = param1;
|
||||
this._type = param2;
|
||||
switch(this._type)
|
||||
{
|
||||
case TYPE_RARE:
|
||||
case TYPE_RARES:
|
||||
this._frameName = "rare";
|
||||
break;
|
||||
case TYPE_DIAMOND:
|
||||
case TYPE_DIAMONDS:
|
||||
this._frameName = "diamond";
|
||||
break;
|
||||
case TYPE_RARE_DIAMOND:
|
||||
this._frameName = "rareDiamond";
|
||||
break;
|
||||
default:
|
||||
this._frameName = "reg";
|
||||
}
|
||||
this._confirmCallback = param3;
|
||||
this._passback = param4;
|
||||
this._mediaHelper = new MediaHelper();
|
||||
this._mediaHelper.init(TRADE_POPUP_MEDIA_ID,this.onPopupLoaded);
|
||||
}
|
||||
|
||||
public function destroy() : void
|
||||
{
|
||||
SBPopupManager.destroySpecificNonSBPopup(this);
|
||||
this.removeEventListeners();
|
||||
DarkenManager.unDarken(this._confirmPopup);
|
||||
this._parentLayer.removeChild(this._confirmPopup);
|
||||
this._confirmPopup = null;
|
||||
}
|
||||
|
||||
private function onPopupLoaded(param1:MovieClip) : void
|
||||
{
|
||||
DarkenManager.showLoadingSpiral(false);
|
||||
this._confirmPopup = MovieClip(param1.getChildAt(0));
|
||||
this._confirmPopup.x = MainFrame.VIEW_WIDTH * 0.5;
|
||||
this._confirmPopup.y = MainFrame.VIEW_HEIGHT * 0.5;
|
||||
this._parentLayer.addChild(this._confirmPopup);
|
||||
DarkenManager.darken(this._confirmPopup);
|
||||
this._confirmPopup.gotoAndStop(this._frameName);
|
||||
if(this._type == TYPE_RARES)
|
||||
{
|
||||
LocalizationManager.translateId(this._confirmPopup.popupTxt,21881,true);
|
||||
}
|
||||
else if(this._type == TYPE_DIAMONDS)
|
||||
{
|
||||
LocalizationManager.translateId(this._confirmPopup.popupTxt,21882,true);
|
||||
}
|
||||
this.addEventListeners();
|
||||
}
|
||||
|
||||
private function addEventListeners() : void
|
||||
{
|
||||
if(this._confirmPopup)
|
||||
{
|
||||
this._confirmPopup.addEventListener(MouseEvent.MOUSE_DOWN,this.onPopup,false,0,true);
|
||||
this._confirmPopup.yesBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onConfirm,false,0,true);
|
||||
this._confirmPopup.noBtn.addEventListener(MouseEvent.MOUSE_DOWN,this.onConfirm,false,0,true);
|
||||
}
|
||||
}
|
||||
|
||||
private function removeEventListeners() : void
|
||||
{
|
||||
if(this._confirmPopup)
|
||||
{
|
||||
this._confirmPopup.removeEventListener(MouseEvent.MOUSE_DOWN,this.onPopup);
|
||||
this._confirmPopup.yesBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onConfirm);
|
||||
this._confirmPopup.noBtn.removeEventListener(MouseEvent.MOUSE_DOWN,this.onConfirm);
|
||||
}
|
||||
}
|
||||
|
||||
private function onPopup(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
}
|
||||
|
||||
private function onConfirm(param1:MouseEvent) : void
|
||||
{
|
||||
param1.stopPropagation();
|
||||
if(this._confirmCallback != null)
|
||||
{
|
||||
if(this._passback != null)
|
||||
{
|
||||
this._confirmCallback(param1.currentTarget == this._confirmPopup.yesBtn,this._passback);
|
||||
this._passback = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._confirmCallback(param1.currentTarget == this._confirmPopup.yesBtn);
|
||||
}
|
||||
this._confirmCallback = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package trade
|
||||
{
|
||||
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:Boolean, param4:Array, param5:Array, param6:int) : void
|
||||
{
|
||||
var _loc7_:int = int(param4.length);
|
||||
var _loc8_:int = param5.length - param6;
|
||||
var _loc9_:Array = [0,param1,param3 ? "0" : "1",param2,_loc7_,_loc8_,param6];
|
||||
if(_loc7_ > 0)
|
||||
{
|
||||
_loc9_ = _loc9_.concat(param4);
|
||||
}
|
||||
if(_loc8_ + param6 > 0)
|
||||
{
|
||||
_loc9_ = _loc9_.concat(param5.concat());
|
||||
}
|
||||
gMainFrame.server.setXtObject_Str("ti",_loc9_);
|
||||
}
|
||||
|
||||
public static function sendTradeSetRequest(param1:Array, param2:Array) : void
|
||||
{
|
||||
var _loc7_:int = 0;
|
||||
var _loc3_:int = int(param1.length);
|
||||
var _loc4_:int = int(param2.length);
|
||||
var _loc5_:Array = new Array(2 + (_loc3_ + _loc4_) * 2);
|
||||
var _loc6_:* = 0;
|
||||
var _loc8_:Number;
|
||||
_loc5_[_loc8_ = _loc6_++] = _loc4_;
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc4_)
|
||||
{
|
||||
var _loc9_:Number;
|
||||
_loc5_[_loc9_ = _loc6_++] = param2[_loc7_].type;
|
||||
var _loc10_:Number;
|
||||
_loc5_[_loc10_ = _loc6_++] = param2[_loc7_].invIdx;
|
||||
_loc7_++;
|
||||
}
|
||||
_loc5_[_loc9_ = _loc6_++] = _loc3_;
|
||||
_loc7_ = 0;
|
||||
while(_loc7_ < _loc3_)
|
||||
{
|
||||
_loc5_[_loc10_ = _loc6_++] = param1[_loc7_].type;
|
||||
var _loc11_:Number;
|
||||
_loc5_[_loc11_ = _loc6_++] = param1[_loc7_].invIdx;
|
||||
_loc7_++;
|
||||
}
|
||||
gMainFrame.server.setXtObject_Str("ts",_loc5_);
|
||||
}
|
||||
|
||||
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 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,447 @@
|
||||
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.text.TextFieldAutoSize;
|
||||
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)
|
||||
{
|
||||
case 18659:
|
||||
_loc2_.load(LoaderCache.fetchCDNURLRequest("streams/" + _soundIds[LocalizationManager.currentLanguage][5] + ".mp3"));
|
||||
break;
|
||||
case 18660:
|
||||
_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 = TextFieldAutoSize.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);
|
||||
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(TimerEvent.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.sound)
|
||||
{
|
||||
_talkingTutorialPopup.currSoundChannel = _talkingTutorialPopup.sound.play(0,0,new SoundTransform(SBAudio.isMusicMuted ? 0 : volumeLevel()));
|
||||
_talkingTutorialPopup.currSoundChannel.addEventListener(Event.SOUND_COMPLETE,onPlaybackComplete);
|
||||
}
|
||||
if(_talkingTutorialPopup.buttonToTurnOn)
|
||||
{
|
||||
_talkingTutorialPopup.buttonToTurnOn.gotoAndStop("new");
|
||||
_talkingTutorialPopup.buttonToTurnOn.setButtonState(2);
|
||||
}
|
||||
if(_talkingTutorialPopup.layerToTurnOn)
|
||||
{
|
||||
_talkingTutorialPopup.layerToTurnOn.parent.gotoAndStop("new");
|
||||
_talkingTutorialPopup.layerToTurnOn.visible = true;
|
||||
}
|
||||
_talkingTutorialTimer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
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(MouseEvent.MOUSE_DOWN,onTutorialPopup,false,0,true);
|
||||
_talkingTutorialPopup.cont.popupCont.bx.addEventListener(MouseEvent.MOUSE_DOWN,onTutorialPopup,false,0,true);
|
||||
_talkingTutorialPopup.cont.popupCont.voBtn.addEventListener(MouseEvent.MOUSE_DOWN,onTutorialVoBtn,false,0,true);
|
||||
_talkingTutorialPopup.cont.popupCont.txt.autoSize = TextFieldAutoSize.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(TimerEvent.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(Event.SOUND_COMPLETE,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(Event.SOUND_COMPLETE,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(Boolean(_tutorialTextPopup) && Boolean(_tutorialTextPopup.currSoundChannel))
|
||||
{
|
||||
_tutorialTextPopup.currSoundChannel.soundTransform = new SoundTransform(SBAudio.isMusicMuted ? 0 : volumeLevel());
|
||||
}
|
||||
if(Boolean(_talkingTutorialPopup) && Boolean(_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(MouseEvent.MOUSE_DOWN,onTutorialPopup);
|
||||
_talkingTutorialPopup.cont.popupCont.bx.removeEventListener(MouseEvent.MOUSE_DOWN,onTutorialPopup);
|
||||
_talkingTutorialPopup = null;
|
||||
if(_talkingTutorialTimer)
|
||||
{
|
||||
_talkingTutorialTimer.reset();
|
||||
_talkingTutorialTimer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user