Frame 1
var _oPreloaderScreen = (new com.disney.gem.games.restoRush.screens.PreloaderScreen(mcScreens.mcPreloader));
com.sarbakan.BaseDisneyController.bDEBUG = false;
new com.disney.gem.games.restoRush.Controller(this, _oPreloaderScreen);
Symbol 1015 MovieClip [__Packages.com.sarbakan.BaseDisneyController] Frame 0
class com.sarbakan.BaseDisneyController
{
static var oInstance;
var mcTimeline, oPreloaderScreen, oMainBroadcaster, oFrameRate, aPopups, oTransitionManager, bSoundMuted, nLastSoundToggleTimer, bPaused, oDXDControllerWrapper, nGamePhase, oCurrentScreen, fScreenShowTransitionCallBack, fScreenHideCallBack, nLevel, nScore, bInstructionCanBeDisplayed, bInstructionActive, nLastUpdateTimer;
function BaseDisneyController (_mcTimeline, _oPreloaderScreen) {
oInstance = this;
mcTimeline = _mcTimeline;
_mcTimeline.stop();
oPreloaderScreen = _oPreloaderScreen;
oMainBroadcaster = new Object();
AsBroadcaster.initialize(oMainBroadcaster);
oMainBroadcaster.addListener(this);
if (bDEBUG) {
oFrameRate = new com.sarbakan.utils.FrameRateDisplayer(_mcTimeline, nFRAME_RATE, nGAME_STAGE_WIDTH);
oMainBroadcaster.addListener(oFrameRate);
} else {
Stage.showMenu = false;
mcTimeline._focusrect = false;
}
aPopups = new Array();
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
setDXDCallback();
} else {
initStandAloneController();
}
}
static function getInstance() {
return(oInstance);
}
function init() {
setGamePhase(nGAME_PHASE_PACKAGING);
stopScreenContainers();
oTransitionManager = new com.sarbakan.utils.TransitionManager(mcTimeline.mcTransitions);
oMainBroadcaster.addListener(oTransitionManager);
bSoundMuted = false;
nLastSoundToggleTimer = getTimer();
}
function update(_nElapsed) {
if (bPaused) {
oMainBroadcaster.broadcastMessage("onUpdatePaused", _nElapsed);
} else {
oMainBroadcaster.broadcastMessage("onUpdate", _nElapsed);
}
checkGlobalKeys();
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
bSoundMuted = oDXDControllerWrapper.isMuted();
}
}
function pause() {
if (!bPaused) {
bPaused = true;
oMainBroadcaster.broadcastMessage("onPause");
}
}
function unpause() {
if (bPaused) {
bPaused = false;
oMainBroadcaster.broadcastMessage("onUnPause");
}
}
function togglePause() {
if (bPaused) {
unpause();
} else {
pause();
}
}
function getControllerMode() {
var _local1;
if (com.disney.gem.base.BaseObject == undefined) {
_local1 = nCONTROLLER_MODE_STANDALONE;
} else {
_local1 = nCONTROLLER_MODE_DXD;
}
return(_local1);
}
function setGamePhase(_nPhase) {
nGamePhase = _nPhase;
switch (_nPhase) {
case nGAME_PHASE_PRELOADER :
mcTimeline.gotoAndStop("preloader");
break;
case nGAME_PHASE_PACKAGING :
mcTimeline.gotoAndStop("packaging");
break;
case nGAME_PHASE_INGAME :
mcTimeline.gotoAndStop("game");
}
}
function getGamePhase() {
return(nGamePhase);
}
function gameLog(_sText) {
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.gameLog(_sText);
} else {
trace(_sText);
}
}
function showScreen(_oScreenController, _bInOut, _sTransitionID, _fMidTransitionCallBack) {
if (oCurrentScreen) {
hideCurrentScreen(com.sarbakan.utils.Delegate.create(this, showScreen, _oScreenController, _bInOut), _sTransitionID);
} else {
oCurrentScreen = _oScreenController;
oCurrentScreen.setGameController(this);
if (_sTransitionID != undefined) {
fScreenShowTransitionCallBack = _fMidTransitionCallBack;
oTransitionManager.playTransition(_sTransitionID, com.sarbakan.utils.Delegate.create(this, onScreenShowTransitionMiddle, _bInOut));
} else {
oCurrentScreen.show(_bInOut);
}
oMainBroadcaster.addListener(oCurrentScreen);
}
}
function hideCurrentScreen(_fHideCallBack, _sTransition) {
fScreenHideCallBack = _fHideCallBack;
if (_sTransition != undefined) {
oTransitionManager.playTransition(_sTransition, com.sarbakan.utils.Delegate.create(oCurrentScreen, oCurrentScreen.hide, com.sarbakan.utils.Delegate.create(this, onScreenHidden)));
} else {
oCurrentScreen.hide(com.sarbakan.utils.Delegate.create(this, onScreenHidden));
}
}
function showPopup(_oPopupController, _bInOut) {
var _local5 = false;
var _local2 = aPopups.length - 1;
while (_local2 >= 0) {
var _local3 = aPopups[_local2];
if (_oPopupController.getRef() == _local3.getRef()) {
_local5 = true;
_local3.destroy();
oMainBroadcaster.removeListener(_local3);
aPopups[_local2] = _oPopupController;
break;
}
_local2--;
}
if (!_local5) {
aPopups.push(_oPopupController);
}
_oPopupController.setGameController(this);
_oPopupController.show(_bInOut);
oMainBroadcaster.addListener(_oPopupController);
}
function setLevel(_nLevel) {
nLevel = _nLevel;
}
function getLevel() {
return(nLevel);
}
function setScore(_nScore) {
nScore = _nScore;
}
function increaseScore(_nIncrement) {
nScore = nScore + _nIncrement;
}
function getScore() {
return(nScore);
}
function allowInstructions() {
bInstructionCanBeDisplayed = true;
}
function disallowInstructions() {
bInstructionCanBeDisplayed = false;
}
function showInstructions() {
if (canShowInstructions()) {
bInstructionActive = true;
showInstructionsScreen();
}
}
function hideInstructions() {
if (canHideInstructions()) {
bInstructionActive = false;
hideInstructionsScreen();
}
}
function toggleSound() {
if ((getTimer() - nLastSoundToggleTimer) >= nSOUND_TOGGLE_DELAY) {
bSoundMuted = !bSoundMuted;
nLastSoundToggleTimer = getTimer();
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.toggleSound();
} else {
toggleSoundStandalone();
}
}
}
function onPreloadingDone() {
hideCurrentScreen();
init();
}
function onGameStart() {
setLevel(1);
setScore(0);
}
function onLevelStart() {
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.startLevel(nLevel, nScore);
}
}
function onLevelEnd() {
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.endLevel(nLevel, nScore);
}
}
function onGameEnd() {
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.endGame(nLevel, nScore);
}
}
function onTransitionStart(_mcTransition) {
}
function onTransitionMiddle(_mcTransition) {
}
function onEnterFrame() {
var _local2 = getTimer();
update(_local2 - nLastUpdateTimer);
nLastUpdateTimer = _local2;
}
function onScreenShowTransitionMiddle(_bInOut) {
fScreenShowTransitionCallBack();
oCurrentScreen.show(_bInOut);
}
function onScreenHidden() {
oMainBroadcaster.removeListener(oCurrentScreen);
delete oCurrentScreen;
fScreenHideCallBack();
}
function setDXDCallback() {
mcTimeline.init = com.sarbakan.utils.Delegate.create(this, initDXDController);
}
function initDXDController(_oOwner) {
oDXDControllerWrapper = new com.sarbakan.DXDControllerWrapper(this, mcTimeline, _oOwner);
return(oDXDControllerWrapper);
}
function initStandAloneController() {
mcTimeline.onEnterFrame = com.sarbakan.utils.Delegate.create(this, onEnterFrame);
nLastUpdateTimer = getTimer();
initPreloader();
}
function initPreloader() {
setGamePhase(nGAME_PHASE_PRELOADER);
showScreen(oPreloaderScreen);
}
function checkGlobalKeys() {
if (Key.isDown(nKEY_INSTRUCTIONS)) {
if (!bInstructionActive) {
showInstructions();
} else {
hideInstructions();
}
}
if (Key.isDown(nKEY_SOUND)) {
toggleSound();
}
}
function toggleSoundStandalone() {
var _local2 = new Sound(mcTimeline);
if (!bSoundMuted) {
_local2.setVolume(100);
} else {
_local2.setVolume(0);
}
}
function canShowInstructions() {
return((((!bInstructionActive) && (bInstructionCanBeDisplayed)) && (!oCurrentScreen.isInOutTransitionning())) && (!oTransitionManager.isTransitionning()));
}
function canHideInstructions() {
return(((bInstructionActive && (bInstructionCanBeDisplayed)) && (!oCurrentScreen.isInOutTransitionning())) && (!oTransitionManager.isTransitionning()));
}
function showInstructionsScreen() {
}
function hideInstructionsScreen() {
}
function stopScreenContainers() {
var _local3 = [mcTimeline.mcPopups, mcTimeline.mcScreens];
var _local2 = _local3.length - 1;
while (_local2 >= 0) {
for (var _local4 in _local3[_local2]) {
_local3[_local2][_local4].stop();
}
_local2--;
}
}
static var bDEBUG = true;
static var nFRAME_RATE = 30;
static var nCONTROLLER_MODE_STANDALONE = 1;
static var nCONTROLLER_MODE_DXD = 2;
static var nGAME_PHASE_PRELOADER = 1;
static var nGAME_PHASE_PACKAGING = 2;
static var nGAME_PHASE_INGAME = 3;
static var nKEY_INSTRUCTIONS = 72;
static var nKEY_SOUND = 77;
static var nGAME_STAGE_WIDTH = 580;
static var nGAME_STAGE_HEIGHT = 400;
static var nSOUND_TOGGLE_DELAY = 100;
}
Symbol 1016 MovieClip [__Packages.com.sarbakan.utils.StateManaged] Frame 0
class com.sarbakan.utils.StateManaged
{
var mcRef, bPausable, sNextState, sState;
function StateManaged (_mcRef) {
setMC(_mcRef);
setPausable(true);
}
function setMC(_mcRef) {
mcRef = _mcRef;
}
function setPausable(_bPausable) {
bPausable = _bPausable;
}
function setState(_sState, _bInstant, _bForce) {
sNextState = _sState;
if (_bInstant) {
onUpdate();
}
if (_bForce) {
mcRef.mcState.gotoAndPlay(1);
}
}
function getState() {
return(sState);
}
function stateStarting() {
return(mcRef.mcState._currentframe == 1);
}
function stateFinished() {
return(mcRef.mcState._currentframe == mcRef.mcState._totalframes);
}
function stateCurrentFrame() {
return(mcRef.mcState._currentframe);
}
function stateIsNot() {
var _local4 = false;
var _local3 = arguments.length - 1;
while (_local3 >= 0) {
if (arguments[_local3] == sState) {
_local4 = true;
break;
}
_local3--;
}
return(!_local4);
}
function destroy() {
delete mcRef;
}
function onUpdate() {
if (sNextState != undefined) {
this[("state_" + sState) + "_end"]();
sState = sNextState;
sNextState = undefined;
mcRef.gotoAndStop(sState);
this[("state_" + sState) + "_init"]();
}
this["state_" + sState]();
}
function onUpdatePaused() {
if (bPausable == false) {
onUpdate();
}
}
function onPause() {
if (bPausable) {
mcRef.mcState.stop();
}
}
function onUnPause() {
if (bPausable) {
mcRef.mcState.play();
}
}
}
Symbol 1017 MovieClip [__Packages.com.sarbakan.utils.TransitionManager] Frame 0
class com.sarbakan.utils.TransitionManager extends com.sarbakan.utils.StateManaged
{
var setPausable, mcTransitionContainer, mcTransition, fMiddleCallBack, fEndCallBack, bTransitionning, setMC, setState, stateFinished, mcRef;
function TransitionManager (_mcTransition) {
super();
setPausable(false);
mcTransitionContainer = _mcTransition;
for (var _local3 in mcTransitionContainer) {
mcTransitionContainer[_local3].stop();
}
}
function playTransition(_sTransitionID, _fMiddleCallBack, _fEndCallBack) {
mcTransition = mcTransitionContainer["mc" + com.sarbakan.utils.MoreString.upperFirstChar(_sTransitionID)];
fMiddleCallBack = _fMiddleCallBack;
fEndCallBack = _fEndCallBack;
if (mcTransition == undefined) {
trace(("TransitionManager error: Unable to find mc" + com.sarbakan.utils.MoreString.upperFirstChar(_sTransitionID)) + " in transition movieclip");
} else {
bTransitionning = true;
setMC(mcTransition);
setState(sSTATE_IN);
}
}
function isTransitionning() {
return(bTransitionning);
}
function state_in() {
if (stateFinished()) {
setState(sSTATE_OUT);
fMiddleCallBack();
}
}
function state_out() {
if (stateFinished()) {
bTransitionning = false;
setState(sSTATE_HIDDEN);
fEndCallBack();
}
}
function state_in_init() {
com.sarbakan.BaseDisneyController.getInstance().onTransitionStart(mcTransition);
mcRef.btBlocker.useHandCursor = false;
}
function state_out_init() {
com.sarbakan.BaseDisneyController.getInstance().onTransitionMiddle(mcTransition);
mcRef.btBlocker.useHandCursor = false;
}
static var sSTATE_IN = "in";
static var sSTATE_OUT = "out";
static var sSTATE_HIDDEN = "hidden";
}
Symbol 1018 MovieClip [__Packages.com.sarbakan.utils.MoreString] Frame 0
class com.sarbakan.utils.MoreString
{
function MoreString () {
}
static function pad(_sToPad, _sCharPad, _nMinLength, _sSideToPad) {
var _local1 = String(_sToPad);
while (_local1.length < _nMinLength) {
if (_sSideToPad == "RIGHT") {
_local1 = _local1 + _sCharPad;
} else {
_local1 = _sCharPad + _local1;
}
}
return(_local1);
}
static function trim(_sToTrim, _sCharTrim, _sSideToTrim) {
var _local1 = String(_sToTrim);
if (_sSideToTrim == "RIGHT") {
while (_local1.substr(_local1.length - 2, 1) == _sCharTrim) {
_local1 = _local1.slice(-1);
}
} else {
while (_local1.substr(0, 1) == _sCharTrim) {
_local1 = _local1.slice(1);
}
}
return(_local1);
}
static function replace(_sString, _sFind, _sReplace) {
return(_sString.split(_sFind).join(_sReplace));
}
static function formatTime(_nTime) {
var _local2 = _nTime;
var _local1 = Math.floor(_local2 / 60);
var _local3 = Math.round(_local2 - (_local1 * 60));
return((pad(String(_local1), "0", 2) + ":") + pad(String(_local3), "0", 2));
}
static function formatNumber(__sNumber, __nMinimumChar) {
var _local1 = String(__sNumber);
var _local3 = "";
var _local4 = _local1.length;
_local4 = _local4 / 3;
var _local5;
var _local2;
if (_local4 <= 1) {
_local5 = _local1;
if (_local5.length < __nMinimumChar) {
_local5 = "0" + _local5;
}
} else {
_local2 = _local4;
while (_local2 > 1) {
_local3 = (" " + _local1.substr(-3)) + _local3;
_local1 = _local1.substr(0, -3);
_local2--;
}
_local5 = _local1 + _local3;
if (_local5.length < __nMinimumChar) {
_local5 = "0" + _local5;
}
}
return(_local5);
}
static function upperFirstChar(_sString) {
return(_sString.substr(0, 1).toUpperCase() + _sString.substr(1));
}
static function lowerFirstChar(_sString) {
return(_sString.substr(0, 1).toLowerCase() + _sString.substr(1));
}
static function convertToBoolean(_sString) {
return(_sString.toLowerCase() == "true");
}
static function formatMoney(_nMoney, _sDelimiteur, _bDecimalOpt) {
var _local5;
var _local3;
var _local2;
var _local1;
var _local6;
if (_bDecimalOpt == undefined) {
_local6 = true;
} else {
_local6 = _bDecimalOpt;
}
_local5 = String(_nMoney).split(".");
if (_local5[1] != undefined) {
_local3 = _local5[1].substr(0, 2);
switch (_local3.length) {
case 0 :
_local3 = _local3 + "00";
break;
case 1 :
_local3 = _local3 + "0";
break;
case 2 :
break;
default :
_local3 = "00";
}
} else {
_local3 = "00";
}
_local1 = _local5[0];
_local2 = "";
while (_local1.length > 3) {
_local2 = (_sDelimiteur + _local1.substr(_local1.length - 3)) + _local2;
_local1 = _local1.substr(0, _local1.length - 3);
}
_local2 = _local1 + _local2;
if (_local6) {
return(((_local2 + ".") + _local3) + "$");
}
return(_local2 + " $");
}
static function getOrdinalSuffix(_nNumber) {
var _local2;
var _local1 = String(_nNumber);
if (((_local1.substr(-2, 2) == 11) || (_local1.substr(-2, 2) == 12)) || (_local1.substr(-2, 2) == 13)) {
_local2 = "th";
} else if (_local1.substr(-1, 1) == 1) {
_local2 = "st";
} else if (_local1.substr(-1, 1) == 2) {
_local2 = "nd";
} else if (_local1.substr(-1, 1) == 3) {
_local2 = "rd";
} else {
_local2 = "th";
}
return(_local2);
}
}
Symbol 1019 MovieClip [__Packages.com.sarbakan.DXDControllerWrapper] Frame 0
class com.sarbakan.DXDControllerWrapper extends com.disney.gem.games.BaseGameController
{
var oRealController, __owner;
function DXDControllerWrapper (_oRealController, _mcTimeline, _oOwner) {
super(_mcTimeline, _oOwner);
oRealController = _oRealController;
}
function init() {
super.init();
oRealController.init();
}
function update(_nElapsed) {
oRealController.update(_nElapsed);
}
function toggleSound() {
__owner.onToggleSound();
}
function isMuted() {
return(!__owner.__soundOn);
}
function gameLog(_sText) {
__owner.gameLog(_sText, "game");
}
}
Symbol 1020 MovieClip [__Packages.com.disney.gem.games.GameContainer] Frame 0
interface com.disney.gem.games.GameContainer
{
}
Symbol 1021 MovieClip [__Packages.com.sarbakan.utils.FrameRateDisplayer] Frame 0
class com.sarbakan.utils.FrameRateDisplayer
{
var nMovieFPS, nUpdateCounter, nAverageFps, nCurrentFPS, nUpdateCount, mcDebug, nLastGetTimer;
function FrameRateDisplayer (_mcTimeline, _nMovieFPS, _nStageWidth) {
nMovieFPS = _nMovieFPS;
nUpdateCounter = 0;
nAverageFps = 0;
nCurrentFPS = nMovieFPS;
reset();
startDebug(_mcTimeline, _nStageWidth);
}
function get fps() {
return(nCurrentFPS);
}
function onUpdate() {
if ((++nUpdateCount) == nMovieFPS) {
computeFrameRate();
updateDebug();
}
}
function onUpdatePaused() {
onUpdate();
}
function startDebug(_mcTimeline, _nStageWidth) {
mcDebug = _mcTimeline.createEmptyMovieClip("PerformanceWatcherDebug", DEBUG_DEPTH);
mcDebug._x = (_nStageWidth - DEBUG_RIGHT_MARGIN) - 400;
mcDebug._y = DEBUG_TOP_MARGIN;
mcDebug.createTextField("field", 2, 0, 0, 400, 50);
var _local2 = new TextFormat();
_local2.font = DEBUG_FONT;
_local2.size = DEBUG_FONT_SIZE;
_local2.color = DEBUG_FONT_COLOR;
_local2.align = "right";
mcDebug.field.setNewTextFormat(_local2);
mcDebug.field.selectable = false;
mcDebug.createTextField("fieldShadow", 1, 1, 1, 400, 50);
var _local3 = new TextFormat();
_local3.font = DEBUG_FONT;
_local3.size = DEBUG_FONT_SIZE;
_local3.color = DEBUG_FONT_SHADOW_COLOR;
_local3.align = "right";
mcDebug.fieldShadow.setNewTextFormat(_local3);
mcDebug.fieldShadow.selectable = false;
}
function reset() {
nUpdateCount = 0;
nLastGetTimer = getTimer();
}
function computeFrameRate() {
var _local2 = getTimer() - nLastGetTimer;
var _local3 = _local2 / 1000;
nCurrentFPS = Math.round(nMovieFPS / _local3);
reset();
}
function updateDebug() {
if (mcDebug != undefined) {
nUpdateCounter++;
var _local2 = ((nCurrentFPS + " fps (avg ") + getAverage()) + ")";
mcDebug.field.text = _local2;
mcDebug.fieldShadow.text = _local2;
}
}
function getAverage() {
nAverageFps = nAverageFps + ((nCurrentFPS - nAverageFps) * (1 / nUpdateCounter));
var _local3 = "";
var _local2 = String(nAverageFps).split(".");
if (_local2[1] == undefined) {
_local3 = nAverageFps + ".00";
} else if (_local2[1].length == 1) {
_local3 = (_local2[0] + ".0") + _local2[1];
} else {
_local3 = (_local2[0] + ".") + _local2[1].substr(0, 2);
}
return(_local3);
}
static var DEBUG_DEPTH = 123456;
static var DEBUG_RIGHT_MARGIN = 0;
static var DEBUG_TOP_MARGIN = 0;
static var DEBUG_FONT = "Verdana";
static var DEBUG_FONT_SIZE = 10;
static var DEBUG_FONT_COLOR = 16777215;
static var DEBUG_FONT_SHADOW_COLOR = 0;
}
Symbol 1022 MovieClip [__Packages.com.sarbakan.utils.ScreenController] Frame 0
class com.sarbakan.utils.ScreenController extends com.sarbakan.utils.StateManaged
{
var setMC, setState, setPausable, oController, bInOut, fHideCallBack, mcRef, sState, stateFinished;
function ScreenController (_mcRef) {
super();
setMC(_mcRef);
setState(sSTATE_HIDDEN);
setPausable(false);
}
function setGameController(_oController) {
oController = _oController;
}
function show(_bInOut) {
bInOut = _bInOut;
if (bInOut) {
setState(sSTATE_IN, true);
} else {
setState(sSTATE_IDLE, true);
}
}
function hide(_fHideCallBack, _bInOutOverride) {
fHideCallBack = _fHideCallBack;
var _local2 = bInOut;
if (_bInOutOverride != undefined) {
_local2 = _bInOutOverride;
}
if (_local2) {
setState(sSTATE_OUT);
} else {
setState(sSTATE_HIDDEN, true);
fHideCallBack();
}
}
function getRef() {
return(mcRef);
}
function isInOutTransitionning() {
return(sState != sSTATE_IDLE);
}
function state_in() {
if (stateFinished()) {
setState(sSTATE_IDLE);
}
}
function state_out() {
if (stateFinished()) {
setState(sSTATE_HIDDEN, true);
fHideCallBack();
}
}
function state_in_init() {
mcRef.btBlocker.useHandCursor = false;
}
function state_idle_init() {
mcRef.btBlocker.useHandCursor = false;
}
function state_out_init() {
mcRef.btBlocker.useHandCursor = false;
}
static var sSTATE_HIDDEN = "hidden";
static var sSTATE_IN = "in";
static var sSTATE_IDLE = "idle";
static var sSTATE_OUT = "out";
}
Symbol 1023 MovieClip [__Packages.com.sarbakan.utils.Delegate] Frame 0
class com.sarbakan.utils.Delegate extends Object
{
var func;
function Delegate () {
super();
}
function DelegateArgs(f) {
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local3 = arguments.callee.target;
var _local4 = arguments.callee.func;
var _local2 = arguments.callee.arg;
_local2 = _local2.concat(arguments);
return(_local4.apply(_local3, _local2));
};
_local2.target = obj;
_local2.func = func;
_local2.arg = arguments.slice(2);
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 1024 MovieClip [__Packages.com.disney.gem.games.restoRush.Controller] Frame 0
class com.disney.gem.games.restoRush.Controller extends com.sarbakan.BaseDisneyController
{
var bMenuOpen, showScreen, mcTimeline, allowInstructions, onGameStart, setLevel, bPaused, unpause, setGamePhase, oGame, oMainBroadcaster, hideCurrentScreen, onLevelStart, pause, nGamePhase, showPopup, nFinalScore, aPopups, onGameEnd, onLevelEnd, disallowInstructions, oTransitionManager, oMusicPack;
function Controller (_mcTimeline, _oPreloaderScreen) {
super(_mcTimeline, _oPreloaderScreen);
bMenuOpen = false;
var _local3 = _mcTimeline.createEmptyMovieClip(sMC_SOUND_NAME, nMC_SOUND_DEPTH);
com.sarbakan.sound.SoundManager.doInit(_local3);
com.sarbakan.sound.SoundManager.setCategoryVolume(sSOUND_CAT_MUSIC, nSOUND_VOLUME_MUSIC);
com.sarbakan.sound.SoundManager.setCategoryVolume(sSOUND_CAT_SOUND, nSOUND_VOLUME_SOUND);
}
function init() {
super.init();
showTitleScreen();
startPackMusic();
}
function showTitleScreen() {
showScreen(new com.disney.gem.games.restoRush.screens.TitleScreen(mcTimeline.mcScreens.mcTitle), false, sTRANSITION_DEFAULT);
playTransitionSound();
allowInstructions();
}
function startNewGame() {
onGameStart();
setLevel(0);
startNextLevel();
}
function startNextLevel() {
if (bPaused) {
unpause();
}
setGamePhase(com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME);
oGame = new com.disney.gem.games.restoRush.GameEngine(this, mcTimeline.mcGame);
oMainBroadcaster.addListener(oGame);
hideCurrentScreen(com.sarbakan.utils.Delegate.create(this, onLevelTransitionDone), sTRANSITION_DEFAULT);
playTransitionSound();
stopPackMusic();
onLevelStart();
}
function showInstructionsScreen() {
if (!bMenuOpen) {
pause();
}
showScreen(new com.disney.gem.games.restoRush.screens.HelpScreen(mcTimeline.mcScreens.mcHelp), false, sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, clearOpenPopups));
playTransitionSound();
}
function hideInstructionsScreen() {
if (nGamePhase == com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME) {
if (bMenuOpen) {
hideCurrentScreen(com.sarbakan.utils.Delegate.create(this, openMenu), sTRANSITION_DEFAULT);
} else {
hideCurrentScreen(undefined, sTRANSITION_DEFAULT);
unpause();
}
} else {
startNewGame();
}
playTransitionSound();
}
function openMenu() {
showPopup(new com.disney.gem.games.restoRush.popups.MenuPopup(mcTimeline.mcPopups.mcMenu), false);
}
function get Score() {
return(nFinalScore);
}
function btClickTryAgain() {
showScreen(new com.disney.gem.games.restoRush.screens.TitleScreen(mcTimeline.mcScreens.mcTitle), false, sTRANSITION_DEFAULT);
playTransitionSound();
allowInstructions();
}
function doApplyButtonSound(_btRef) {
_btRef.onRollOver = com.sarbakan.utils.Delegate.create(this, doButtonRoll);
}
function doButtonRelease() {
var _local1 = com.sarbakan.sound.SoundManager.isSoundPlaying(sSOUND_CLICK).oSound.doStop();
com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SOUND, sSOUND_CLICK, nSOUND_VOLUME_SOUND);
}
function clearOpenPopups() {
var _local2 = 0;
while (_local2 < aPopups.length) {
com.sarbakan.utils.ScreenController(aPopups[_local2]).hide(undefined, false);
_local2++;
}
}
function onLevelTransitionDone() {
oGame.init();
}
function onGameOver(_nScore) {
if (bPaused) {
unpause();
}
nFinalScore = _nScore;
onGameEnd();
oGame.stopGameMusic();
oGame.stopKitchAmbiance();
oGame.doDestroy();
onLevelEnd();
showScreen(new com.disney.gem.games.restoRush.screens.EndScreen(mcTimeline.mcScreens.mcEnd), false, sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, onQuittingGame));
disallowInstructions();
playTransitionSound();
startPackMusic();
}
function onGameRestart() {
oTransitionManager.playTransition(sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, onRestartReady));
playTransitionSound();
}
function onRestartReady() {
hidePopups();
oGame.restart();
unpause();
}
function onQuittingGame() {
clearOpenPopups();
setGamePhase(com.sarbakan.BaseDisneyController.nGAME_PHASE_PACKAGING);
}
function doSoundEvent(_nEvent, _oSound) {
if (_nEvent == com.sarbakan.sound.SoundManager.nEVENT_SOUND_COMPLETE) {
if (_oSound == oMusicPack) {
delete oMusicPack;
}
}
}
function startPackMusic() {
if (oMusicPack == undefined) {
oMusicPack = com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_MUSIC, sMUSIC_PACK, nSOUND_VOLUME_MUSIC, 999999999);
oMusicPack.doAddListener(this);
}
oMusicPack.doFadeTo(100);
}
function stopPackMusic() {
oMusicPack.doFadeTo(0);
}
function doButtonRoll() {
var _local1 = com.sarbakan.sound.SoundManager.isSoundPlaying(sSOUND_ROLL).oSound.doStop();
com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SOUND, sSOUND_ROLL, nSOUND_VOLUME_SOUND);
}
function playTransitionSound() {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SOUND, sSOUND_TRANSITION, nSOUND_TRANSITION_VOLUME);
}
function hidePopups() {
var _local2 = 0;
while (_local2 < aPopups.length) {
com.sarbakan.utils.ScreenController(aPopups[_local2]).hide(undefined, false);
_local2++;
}
}
static var sTRANSITION_DEFAULT = "default";
static var sMC_SOUND_NAME = "mcSoundManager";
static var nMC_SOUND_DEPTH = 80000;
static var sSOUND_CAT_SOUND = "SFX";
static var sSOUND_CAT_MUSIC = "Music";
static var nSOUND_VOLUME_SOUND = 100;
static var nSOUND_VOLUME_MUSIC = 40;
static var sSOUND_ROLL = "BtRollOver.wav";
static var sSOUND_CLICK = "BtClick.wav";
static var sSOUND_TRANSITION = "Transition.wav";
static var nSOUND_TRANSITION_VOLUME = 70;
static var sMUSIC_PACK = "Music_Pack.wav";
}
Symbol 1025 MovieClip [__Packages.com.disney.gem.games.restoRush.GameEngine] Frame 0
class com.disney.gem.games.restoRush.GameEngine
{
var oController, mcGame, aFoods, nAttachDepths, nOrderMadeTotal, nTries, oPlayer, oSkinner, oCountersManager, nScore, nLevel, nHappyStreak, oMusicGame;
function GameEngine (_oController, _mcGame) {
oController = _oController;
mcGame = _mcGame;
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, sSOUND_KITCHEN, nSOUND_KITCHEN_VOLUME, 99999);
}
function init() {
aFoods = new Array();
nAttachDepths = 1;
nOrderMadeTotal = 0;
nTries = com.disney.gem.games.restoRush.GameData.nPLAYER_TRIES;
updateTries();
oPlayer = new com.disney.gem.games.restoRush.Player(mcGame.mcDynamicObjects.mcPlayerPositions);
oPlayer.setGameController(this);
mcGame.mcDynamicObjects.mcPlayerPositions.swapDepths(nDEPTH_PLAYER);
oController.oMainBroadcaster.addListener(oPlayer);
oSkinner = new com.disney.gem.games.restoRush.Skinner(mcGame.mcSkinner);
oSkinner.setController(this);
oController.oMainBroadcaster.addListener(oSkinner);
oCountersManager = new com.disney.gem.games.restoRush.CountersManager(buildCountersArray(), buildOrderBubbleArray());
oController.oMainBroadcaster.addListener(oCountersManager);
oCountersManager.setGameController(this);
oCountersManager.init();
mcGame.mcHud.txtScore.text = com.sarbakan.utils.Tools.getFormatedNumber(oController.getScore(), 0);
mcGame.mcHud.txtLevel.text = oController.getLevel();
mcGame.mcHud.txtLevel2.text = oController.getLevel();
nScore = oController.getScore();
nLevel = oController.getLevel();
mcGame.mcHud.btMenu.onRelease = com.sarbakan.utils.Delegate.create(this, onBtMenu);
oController.doApplyButtonSound(mcGame.mcHud.btMenu);
var _local2 = ((nPOT_ROW_1 * nDEPTH_ROW) + nAttachDepths) + nDEPTH_DECO;
mcGame.mcDynamicObjects.mcPot1.swapDepths(_local2);
nAttachDepths++;
_local2 = ((nPOT_ROW_2 * nDEPTH_ROW) + nAttachDepths) + nDEPTH_DECO;
mcGame.mcDynamicObjects.mcPot2.swapDepths(_local2);
nAttachDepths++;
_local2 = ((nPOT_ROW_2 * nDEPTH_ROW) + nAttachDepths) + nDEPTH_DECO;
mcGame.mcDynamicObjects.mcPot3.swapDepths(_local2);
nAttachDepths++;
startGameMusic();
}
function addLevel() {
oController.onLevelEnd();
nLevel++;
oController.setLevel(nLevel);
mcGame.mcHud.txtLevel.text = oController.getLevel();
mcGame.mcHud.txtLevel2.text = oController.getLevel();
oController.onLevelStart();
}
function get Score() {
return(nScore);
}
function get Ref() {
return(mcGame);
}
function get CounterRows() {
return(aCOUNTER_ROWS);
}
function getFoods() {
return(aFoods);
}
function currentLevel() {
var _local2 = oController.getLevel();
return(_local2);
}
function addFood(_nType, _nCurrentRow, _sDirection, _nScale) {
nAttachDepths++;
var _local6 = ((aCOUNTER_ROWS[aCOUNTER_ROWS.length - _nCurrentRow] * nDEPTH_ROW) + nDEPTH_FOOD) + nAttachDepths;
var _local5 = com.disney.gem.games.restoRush.GameData.aATTACH_NAMES[_nType - 1];
var _local2 = mcGame.mcDynamicObjects.attachMovie(_local5, _local5 + nAttachDepths, _local6);
var _local7 = oPlayer.__get__Ref().mcState.mcHand.getBounds(mcGame);
var _local4 = com.sarbakan.utils.MoreMath.getBoundsCenter(_local7);
_local2._xscale = _nScale;
_local2._yscale = _nScale;
_local2._x = _local4.x;
_local2._y = _local4.y;
_local2.gotoAndStop(_nType);
var _local3 = new com.disney.gem.games.restoRush.Food(_local2, _sDirection, _nType, _nCurrentRow);
oController.oMainBroadcaster.addListener(_local3);
_local3.setGameEngine(this);
aFoods.push(_local3);
}
function removeFood(_oFoodToRemove) {
if (!_oFoodToRemove.__get__isCatched()) {
nScore = nScore + com.disney.gem.games.restoRush.GameData.nPOINTS_BAD_CATCH;
}
updateScore();
oController.oMainBroadcaster.removeListener(_oFoodToRemove);
var _local2 = 0;
while (_local2 < aFoods.length) {
if (aFoods[_local2] == _oFoodToRemove) {
com.disney.gem.games.restoRush.Food(aFoods[_local2]).doDestroy();
aFoods.splice(_local2, 1);
}
_local2++;
}
}
function cookStatus(_isHappy, _oCook) {
if (_isHappy) {
nScore = nScore + com.disney.gem.games.restoRush.GameData.nPOINTS_HAPPY_COOK;
nScore = nScore + (com.disney.gem.games.restoRush.GameData.nPOINTS_GOOD_CATCH * _oCook.__get__CatchedItems());
nHappyStreak++;
} else {
nScore = nScore + com.disney.gem.games.restoRush.GameData.nPOINTS_MAD_COOK;
nTries--;
nHappyStreak = 0;
oSkinner.comesIn();
oCountersManager.skinnerComesIn();
}
addOrder();
updateStreak();
updateTries();
updateScore();
}
function checkEndGame() {
if (nTries <= 0) {
oCountersManager.gameEnded();
oController.onGameOver(nScore);
stopKitchAmbiance();
}
}
function restart() {
oCountersManager.restart();
oSkinner.restart();
oPlayer.restart();
nTries = com.disney.gem.games.restoRush.GameData.nPLAYER_TRIES;
updateTries();
nAttachDepths = 1;
nScore = oController.getScore();
nLevel = oController.getLevel();
mcGame.mcHud.txtScore.text = com.sarbakan.utils.Tools.getFormatedNumber(oController.getScore(), 0);
}
function stopGameMusic() {
oMusicGame.doFadeTo(0);
}
function stopKitchAmbiance() {
var _local1 = com.sarbakan.sound.SoundManager.isSoundPlaying(sSOUND_KITCHEN).oSound.doStop();
}
function skinnersOut() {
oCountersManager.skinnerComesOut();
}
function doDestroy() {
deleteFood();
oController.oMainBroadcaster.removeListener(oPlayer);
oController.oMainBroadcaster.removeListener(oCountersManager);
oController.oMainBroadcaster.removeListener(oSkinner);
aFoods = new Array();
oPlayer.doDestroy();
oCountersManager.doDestroy();
oSkinner.doDestroy();
delete oController;
delete oPlayer;
delete oCountersManager;
delete aFoods;
delete oSkinner;
}
function onBtMenu() {
oController.pause();
oController.bMenuOpen = true;
oController.showPopup(new com.disney.gem.games.restoRush.popups.MenuPopup(oController.mcTimeline.mcPopups.mcMenu), true);
oController.doButtonRelease();
}
function onPause() {
}
function onUnPause() {
}
function buildCountersArray() {
var _local4 = new Array();
var _local2 = 0;
while (_local2 < aCOUNTERS_MC.length) {
nAttachDepths++;
_local4.push(mcGame.mcDynamicObjects[aCOUNTERS_MC[_local2]]);
var _local3 = ((aCOUNTER_ROWS[(aCOUNTER_ROWS.length - 1) - _local2] * nDEPTH_ROW) + nAttachDepths) + nDEPTH_COOK;
MovieClip(_local4[_local2]).swapDepths(_local3);
_local2++;
}
return(_local4);
}
function buildOrderBubbleArray() {
var _local4 = new Array();
var _local2 = 0;
while (_local2 < aBUBBLES_MC.length) {
nAttachDepths++;
_local4.push(mcGame.mcDynamicObjects[aBUBBLES_MC[_local2]]);
var _local3 = ((aCOUNTER_ROWS[(aCOUNTER_ROWS.length - 1) - _local2] * nDEPTH_ROW) + nAttachDepths) + nDEPTH_BUBBLE;
MovieClip(_local4[_local2]).swapDepths(_local3);
_local2++;
}
return(_local4);
}
function addOrder() {
nOrderMadeTotal++;
if ((nOrderMadeTotal > 0) && ((nOrderMadeTotal % com.disney.gem.games.restoRush.GameData.nORDERS_LEVEL_CHANGE) == 0)) {
addLevel();
}
}
function deleteFood() {
var _local2 = 0;
while (_local2 < aFoods.length) {
oController.oMainBroadcaster.removeListener(aFoods[_local2]);
com.disney.gem.games.restoRush.Food(aFoods[_local2]).doDestroy();
aFoods.splice(_local2, 1);
_local2++;
}
}
function updateScore() {
oController.setScore(nScore);
mcGame.mcHud.txtScore.text = com.sarbakan.utils.Tools.getFormatedNumber(oController.getScore(), 0);
}
function updateTries() {
if (nTries > com.disney.gem.games.restoRush.GameData.nPLAYER_TRIES) {
nTries = com.disney.gem.games.restoRush.GameData.nPLAYER_TRIES;
}
mcGame.mcHud.mcTries.gotoAndStop(nTries + 1);
}
function updateStreak() {
if ((nHappyStreak > 0) && ((nHappyStreak % com.disney.gem.games.restoRush.GameData.nPLAYER_TRIES_STREAK) == 0)) {
nTries++;
}
if ((nHappyStreak > 0) && ((nHappyStreak % com.disney.gem.games.restoRush.GameData.nPLAYER_BONUS_STREAK) == 0)) {
nScore = nScore + com.disney.gem.games.restoRush.GameData.nPOINTS_STREAK;
updateScore();
}
}
function startGameMusic() {
if (oMusicGame == undefined) {
oMusicGame = com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_MUSIC, sMUSIC_GAME, nSOUND_VOLUME_MUSIC, 9999999);
oMusicGame.doAddListener(this);
}
oMusicGame.doFadeTo(100);
}
static var aCOUNTERS_MC = ["mcCounter0", "mcCounter1", "mcCounter2", "mcCounter3", "mcCounter4", "mcCounter5", "mcCounter6", "mcCounter7"];
static var aCOUNTER_ROWS = [1, 1, 3, 3, 5, 5, 7, 7];
static var aBUBBLES_MC = ["mcBubble0", "mcBubble1", "mcBubble2", "mcBubble3", "mcBubble4", "mcBubble5", "mcBubble6", "mcBubble7"];
static var nDEPTH_PLAYER = 999999;
static var nDEPTH_COOK = 500;
static var nDEPTH_BUBBLE = 700;
static var nDEPTH_DECO = 990;
static var nDEPTH_FOOD = 1;
static var nDEPTH_ROW = 10000;
static var nPOT_ROW_1 = 5;
static var nPOT_ROW_2 = 5;
static var nPOT_ROW_3 = 1;
static var sMUSIC_GAME = "Music_Game.wav";
static var sSOUND_KITCHEN = "KitchenAmbiance.wav";
static var nSOUND_KITCHEN_VOLUME = 30;
static var nSOUND_VOLUME_MUSIC = 20;
}
Symbol 1026 MovieClip [__Packages.com.disney.gem.games.restoRush.Player] Frame 0
class com.disney.gem.games.restoRush.Player extends com.sarbakan.utils.StateManaged
{
var mcScale, setMC, sHorizontalDirection, sVerticalDirection, oController, mcRef, stateFinished, bStillNeedWalk, nFoodTypeAttach, setState, sState;
function Player (_mcRef) {
super();
_mcRef.gotoAndStop(1);
mcScale = _mcRef;
setMC(_mcRef.mcPlayer);
sHorizontalDirection = sDIRECTION_RIGHT;
sVerticalDirection = sDIRECTION_UP;
setPlayerState(sSTATE_IDLE);
}
function setGameController(_oController) {
oController = _oController;
}
function get Ref() {
return(mcRef);
}
function restart() {
mcScale.gotoAndStop(1);
setMC(mcScale.mcPlayer);
setPlayerState(sSTATE_IDLE);
}
function doDestroy() {
super.destroy();
delete oController;
delete mcScale;
}
function onUpdate() {
checkKeys();
super.onUpdate();
}
function state_IdleLeft() {
state_Idle();
}
function state_IdleRight() {
state_Idle();
}
function state_Idle() {
if (mcRef.mcState._currentframe == nSOUND_IDLE_TIME) {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, sSOUND_IDLE, com.disney.gem.games.restoRush.Controller.nSOUND_VOLUME_SOUND);
}
}
function state_WalkUpLeft() {
state_Walk();
}
function state_WalkDownLeft() {
state_Walk();
}
function state_WalkUpRight() {
state_Walk();
}
function state_WalkDownRight() {
state_Walk();
}
function state_Walk() {
if (stateFinished()) {
setPlayerState(sSTATE_IDLE);
}
}
function state_WalkUpLeft_end() {
state_Walk_end();
}
function state_WalkDownLeft_end() {
state_Walk_end();
}
function state_WalkUpRight_end() {
state_Walk_end();
}
function state_WalkDownRight_end() {
state_Walk_end();
}
function state_Walk_end() {
changePlayerScale();
if (bStillNeedWalk) {
bStillNeedWalk = false;
if (sVerticalDirection == sDIRECTION_UP) {
setPlayerState(sSTATE_WALK_UP);
} else {
setPlayerState(sSTATE_WALK_DOWN);
}
}
}
function state_TurnLeft() {
turn();
}
function state_TurnRight() {
turn();
}
function turn() {
if (stateFinished()) {
setPlayerState(sSTATE_IDLE);
}
}
function state_ThrowLeft() {
throwing();
}
function state_ThrowRight() {
throwing();
}
function throwing() {
if (stateFinished()) {
setPlayerState(sSTATE_IDLE);
} else {
if (mcRef.mcState.mcHand) {
mcRef.mcState.mcHand._visible = false;
}
if (mcRef.mcState.mcFood) {
mcRef.mcState.mcFood.gotoAndStop(nFoodTypeAttach);
}
if (mcRef.mcState._currentframe == nFRAME_FOOD_ATTACH) {
oController.addFood(nFoodTypeAttach, mcScale._currentframe, sHorizontalDirection, mcRef._xscale);
}
}
}
function checkKeys() {
if (Key.isDown(38)) {
movePlayer(1);
} else if (Key.isDown(40)) {
movePlayer(-1);
}
if (Key.isDown(37)) {
turnPlayer(sDIRECTION_LEFT);
} else if (Key.isDown(39)) {
turnPlayer(sDIRECTION_RIGHT);
}
if (Key.isDown(String("1").charCodeAt(0))) {
throwFood(1);
} else if (Key.isDown(String("2").charCodeAt(0))) {
throwFood(2);
} else if (Key.isDown(String("3").charCodeAt(0))) {
throwFood(3);
}
}
function setPlayerState(_sState) {
var _local2 = _sState + sHorizontalDirection;
setState(_local2);
}
function canMove() {
var _local2 = true;
if (sState != (sSTATE_IDLE + sHorizontalDirection)) {
_local2 = false;
}
return(_local2);
}
function movePlayer(_nDirection) {
if (canMove()) {
bStillNeedWalk = true;
if (_nDirection > 0) {
sVerticalDirection = sDIRECTION_UP;
if (mcScale._currentframe < mcScale._totalframes) {
setPlayerState(sSTATE_WALK_UP);
playWalkSound();
}
} else {
sVerticalDirection = sDIRECTION_DOWN;
if (mcScale._currentframe > 1) {
setPlayerState(sSTATE_WALK_DOWN);
playWalkSound();
}
}
}
}
function playWalkSound() {
var _local1 = Math.floor(Math.random() * aSOUNDS_WALK.length);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, aSOUNDS_WALK[_local1], com.disney.gem.games.restoRush.Controller.nSOUND_VOLUME_SOUND);
}
function turnPlayer(_sNewDirection) {
if (canMove()) {
if (sHorizontalDirection != _sNewDirection) {
sHorizontalDirection = _sNewDirection;
setPlayerState(sSTATE_TURN);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, sSOUND_TURN, com.disney.gem.games.restoRush.Controller.nSOUND_VOLUME_SOUND);
}
}
}
function throwFood(_nFoodType) {
if (canMove()) {
nFoodTypeAttach = _nFoodType;
setPlayerState(sSTATE_THROW);
var _local2 = com.sarbakan.sound.SoundManager.isSoundPlaying(sSOUND_THROW).oSound.doStop();
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, sSOUND_THROW, com.disney.gem.games.restoRush.Controller.nSOUND_VOLUME_SOUND);
}
}
function changePlayerScale() {
if (sVerticalDirection == sDIRECTION_UP) {
mcScale.nextFrame();
} else {
mcScale.prevFrame();
}
setMC(mcScale.mcPlayer);
setPlayerState(sSTATE_IDLE);
}
static var sSTATE_IDLE = "Idle";
static var sSTATE_WALK_UP = "WalkUp";
static var sSTATE_WALK_DOWN = "WalkDown";
static var sSTATE_THROW = "Throw";
static var sSTATE_TURN = "Turn";
static var sDIRECTION_LEFT = "Left";
static var sDIRECTION_RIGHT = "Right";
static var sDIRECTION_UP = "Up";
static var sDIRECTION_DOWN = "Down";
static var nFRAME_FOOD_ATTACH = 8;
static var sSOUND_THROW = "PlayerThrow.wav";
static var sSOUND_TURN = "PlayerTurn.wav";
static var sSOUND_IDLE = "Player_Idle.wav";
static var aSOUNDS_WALK = ["PlayerWalk0.wav", "PlayerWalk1.wav"];
static var nSOUND_IDLE_TIME = 34;
}
Symbol 1027 MovieClip [__Packages.com.sarbakan.sound.SoundManager] Frame 0
class com.sarbakan.sound.SoundManager
{
static var aSounds, mcAttach, nSoundNum, aSoundCategories, nMasterVolume, oEnterFrameListener;
function SoundManager () {
}
static function doPlaySound(_sLinkage, _nVolume, _nLoop, _bUnique) {
return(doPlaySoundInCat(sDEFAULT_CATEGORY, _sLinkage, _nVolume, _nLoop, _bUnique));
}
static function doPlaySoundInCat(_sCategoryName, _sLinkage, _nVolume, _nLoop, _bUnique) {
doCheckInit();
var _local1;
if (NewSoundAllowed) {
if (_nVolume == undefined) {
_nVolume = 100;
}
if (_nLoop == undefined) {
_nLoop = 1;
}
if (_bUnique == undefined) {
_bUnique = false;
}
var _local2;
if (_bUnique) {
var _local4 = isSoundPlaying(_sLinkage);
if (_local4.bPlaying) {
_local2 = false;
_local1 = _local4.oSound;
} else {
_local2 = true;
}
} else {
_local2 = true;
}
if (_local2) {
doManageCategory(_sCategoryName);
var _local5 = getMCForSound();
var _local3 = new Sound(_local5);
_local3.attachSound(_sLinkage);
if (_local3.duration != undefined) {
_local1 = new com.sarbakan.sound.SoundItem(_local3, _sLinkage, _nVolume, _nLoop, _sCategoryName, _local5);
} else {
trace("**** BAD SOUND LINKAGE : " + _sLinkage);
}
_local1.doAddListener(com.sarbakan.sound.SoundManager);
aSounds.push(_local1);
}
} else {
trace("ERROR - ***** - MAX SOUND NUM REACHED : " + nMAX_SOUNDS_PLAYING);
}
return(_local1);
}
static function isSoundPlaying(_sLinkageName) {
var _local2 = new Object();
_local2.bPlaying = false;
_local2.oSound = undefined;
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
if (aSounds[_local1].LinkageName == _sLinkageName) {
_local2.oSound = aSounds[_local1];
_local2.bPlaying = true;
}
_local1--;
}
return(_local2);
}
function getPlayingQty(_sLinkageName) {
var _local2 = 0;
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
if (aSounds[_local1].LinkageName == _sLinkageName) {
_local2++;
}
_local1--;
}
return(_local2);
}
static function doManageExternalSound(_oSound) {
doCheckInit();
doManageCategory(_oSound.__get__Category());
_oSound.doAddListener(com.sarbakan.sound.SoundManager);
aSounds.push(_oSound);
}
static function getMCForSound() {
var _local1 = getNextDepth();
var _local2 = mcAttach.createEmptyMovieClip("Snd" + _local1, _local1);
return(_local2);
}
static function getNextDepth() {
nSoundNum++;
return(nSoundNum);
}
static function doInit(_mcAttach) {
if (!bInited) {
mcAttach = _mcAttach;
bInited = true;
nSoundNum = 0;
aSounds = new Array();
aSoundCategories = new Array();
nMasterVolume = 100;
mx.transitions.OnEnterFrameBeacon.init();
oEnterFrameListener = new Object();
oEnterFrameListener.onEnterFrame = com.sarbakan.utils.Delegate.create(com.sarbakan.sound.SoundManager, doEnterFrame);
MovieClip.addListener(oEnterFrameListener);
}
}
static function doEnterFrame() {
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
aSounds[_local1].doEnterFrame();
_local1--;
}
}
static function setCategoryVolume(_sCategoryName, _nVol) {
doManageCategory(_sCategoryName);
var _local1 = aSoundCategories.length - 1;
while (_local1 >= 0) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
aSoundCategories[_local1].nVolume = _nVol;
}
_local1--;
}
doUpdateAllSoundsVolume();
}
static function getCategoryVolume(_sCategoryName) {
doManageCategory(_sCategoryName);
var _local2;
var _local1 = aSoundCategories.length - 1;
while (_local1 >= 0) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
_local2 = aSoundCategories[_local1].nVolume;
}
_local1--;
}
return(_local2);
}
static function isCategoryMuted(_sCategoryName) {
doManageCategory(_sCategoryName);
var _local2;
var _local1 = aSoundCategories.length - 1;
while (_local1 >= 0) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
_local2 = aSoundCategories[_local1].bMuted;
}
_local1--;
}
return(_local2);
}
static function doSoundEvent(_nEvent, _oSound) {
if (!(_nEvent === nEVENT_SOUND_COMPLETE)) {
} else {
var _local2 = false;
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
if (!_local2) {
if (aSounds[_local1] == _oSound) {
_local2 = true;
delete aSounds[_local1];
aSounds.splice(Number(_local1), 1);
}
}
_local1--;
}
}
}
static function doMuteCategory(_sCategoryName) {
var _local1 = aSoundCategories.length - 1;
while (_local1 >= 0) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
aSoundCategories[_local1].bMuted = true;
}
_local1--;
}
doUpdateAllSoundsVolume();
}
static function doUnMuteCategory(_sCategoryName) {
var _local1 = aSoundCategories.length - 1;
while (_local1 >= 0) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
aSoundCategories[_local1].bMuted = false;
}
_local1--;
}
doUpdateAllSoundsVolume();
}
static function setMasterVolume(_nVol) {
nMasterVolume = _nVol;
doUpdateAllSoundsVolume();
}
static function get NewSoundAllowed() {
return(aSounds.length < nMAX_SOUNDS_PLAYING);
}
static function get MasterVolume() {
return(nMasterVolume);
}
static function doRemoveListenerFromAllSounds(_oListener) {
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
aSounds[_local1].doRemoveListener(_oListener);
_local1--;
}
}
static function doDestroy() {
doRemoveListenerFromAllSounds();
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
aSounds[_local1].doDestroy();
_local1--;
}
mcAttach.removeMovieClip();
delete mcAttach;
nSoundNum = 0;
bInited = false;
nMasterVolume = 100;
delete aSounds;
delete aSoundCategories;
delete oEnterFrameListener;
}
static function get Inited() {
return(bInited);
}
static function doUpdateAllSoundsVolume() {
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
aSounds[_local1].doUpdateSound();
_local1--;
}
}
static function doCheckInit() {
if (!bInited) {
trace("**** NORMAL SM ERROR, NEED TO INIT SOUND MANAGER FIRST");
}
}
static function doManageCategory(_sCategoryName) {
doCheckInit();
var _local2 = false;
var _local1 = aSoundCategories.length - 1;
while (_local1 >= 0) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
_local2 = true;
}
_local1--;
}
if (!_local2) {
var _local4 = new Object();
_local4.sName = _sCategoryName;
_local4.nVolume = 100;
_local4.bMuted = false;
aSoundCategories.push(_local4);
}
}
static var nEVENT_SOUND_COMPLETE = 1;
static var sDEFAULT_CATEGORY = "SFX";
static var nMAX_SOUNDS_PLAYING = 32;
static var bInited = false;
}
Symbol 1028 MovieClip [__Packages.com.sarbakan.sound.SoundItem] Frame 0
class com.sarbakan.sound.SoundItem
{
var sndObj, sLinkage, mcRef, nRemainingLoop, nCurrentVolume, nTargetVolume, nFadeRate, sCategory, bFadeAtEnd, bMuted, bPaused, bNeedFreshStart, nCurrentTime, aEventListeners, bStopAfterFade;
function SoundItem (_sndObject, _sLinkage, _nVolume, _nLoop, _sCategory, _mc) {
sndObj = _sndObject;
sLinkage = _sLinkage;
mcRef = _mc;
nRemainingLoop = _nLoop;
nCurrentVolume = _nVolume;
nTargetVolume = _nVolume;
nFadeRate = nFADE_RATE;
sCategory = _sCategory;
bFadeAtEnd = false;
bMuted = false;
bPaused = false;
bNeedFreshStart = false;
sndObj.onSoundComplete = com.sarbakan.utils.Delegate.create(this, doSoundComplete);
doStart(_nLoop);
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
nCurrentTime = 0;
aEventListeners = new Array();
}
function doEnterFrame() {
if (!bPaused) {
if (nCurrentTime > sndObj.position) {
nRemainingLoop--;
}
nCurrentTime = sndObj.position;
}
doCheckFadeAtEnd();
doManageFade();
}
function doAddListener(_oListener) {
aEventListeners.push(_oListener);
}
function doRemoveListener(_oListener) {
var _local2 = 0;
while (_local2 < aEventListeners.length) {
if (aEventListeners[_local2] == _oListener) {
delete aEventListeners[_local2];
aEventListeners.splice(_local2, 1);
}
_local2++;
}
}
function doSoundComplete() {
if (bNeedFreshStart && (nRemainingLoop > 1)) {
sndObj.start(0, nRemainingLoop - 1);
} else {
doManageEndEvent();
}
}
function doUpdateSound() {
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
}
function doMute() {
bMuted = true;
doUpdateSound();
}
function doUnMute() {
bMuted = false;
doUpdateSound();
}
function doPause() {
sndObj.stop();
bPaused = true;
}
function doResume() {
bPaused = false;
bNeedFreshStart = true;
sndObj.start(nCurrentTime / 1000, 1);
}
function doStart(_nLoop) {
if (_nLoop == undefined) {
_nLoop = 1;
}
if (sLinkage.indexOf(".mp3") != -1) {
sndObj.start(0.015, _nLoop);
} else {
sndObj.start(0, _nLoop);
}
}
function doStop() {
sndObj.stop();
doManageEndEvent();
}
function doFadeTo(_nVolume, _bStopAndDelete) {
if (_bStopAndDelete == undefined) {
_bStopAndDelete = true;
}
bStopAfterFade = _bStopAndDelete;
nTargetVolume = _nVolume;
}
function setFadeRate(_nRate) {
if (_nRate == undefined) {
_nRate = nFADE_RATE;
}
nFadeRate = _nRate;
}
function setFadeAtEnd(_bFadeAtEnd) {
bFadeAtEnd = true;
}
function setPan(_nPan) {
sndObj.setPan(_nPan);
}
function get Category() {
return(sCategory);
}
function get LinkageName() {
return(sLinkage);
}
function doDestroy() {
sndObj.stop();
delete sndObj;
mcRef.removeMovieClip();
}
function doCheckFadeAtEnd() {
if (bFadeAtEnd) {
if (nRemainingLoop == 1) {
if ((sndObj.duration - nCurrentTime) <= nFADE_AT_END_TIME) {
doFadeTo(0);
}
}
}
}
function doManageEndEvent() {
var _local2 = 0;
while (_local2 < aEventListeners.length) {
aEventListeners[_local2].doSoundEvent(com.sarbakan.sound.SoundManager.nEVENT_SOUND_COMPLETE, this);
_local2++;
}
aEventListeners = new Array();
mcRef.removeMovieClip();
delete mcRef;
delete aEventListeners;
delete sndObj.onSoundComplete;
delete sndObj;
}
function doManageFade() {
if (nCurrentVolume != nTargetVolume) {
nCurrentVolume = com.sarbakan.utils.MoreMath.getReachNum(nCurrentVolume, nTargetVolume, nFadeRate);
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
}
if ((nCurrentVolume <= 0) && (bStopAfterFade)) {
sndObj.stop();
doManageEndEvent();
}
}
function returnComputedVolume(_nVolume) {
var _local2;
if ((!bMuted) && (!com.sarbakan.sound.SoundManager.isCategoryMuted(sCategory))) {
var _local3 = com.sarbakan.sound.SoundManager.__get__MasterVolume() / 100;
var _local4 = com.sarbakan.sound.SoundManager.getCategoryVolume(sCategory) / 100;
_local2 = _nVolume;
_local2 = _local2 * _local4;
_local2 = _local2 * _local3;
} else {
_local2 = 0;
}
return(_local2);
}
static var nFADE_RATE = 8;
static var nFADE_AT_END_TIME = 800;
}
Symbol 1029 MovieClip [__Packages.com.sarbakan.utils.MoreMath] Frame 0
class com.sarbakan.utils.MoreMath
{
function MoreMath () {
}
static function getRandomRange(__nMin, __nMax) {
return(Math.floor(Math.random() * ((__nMax + 1) - __nMin)) + __nMin);
}
static function getPolarity(__nNum) {
var _local1 = 0;
if (__nNum < 0) {
_local1 = -1;
} else if (__nNum > 0) {
_local1 = 1;
}
return(_local1);
}
static function getReachZero(__nNum, __nReducer) {
return(getReachNum(__nNum, 0, __nReducer));
}
static function getReachNum(__nNum, __nTargetNum, __nReducer) {
var _local1 = __nNum;
if (_local1 != __nTargetNum) {
if (_local1 < __nTargetNum) {
_local1 = _local1 + __nReducer;
if (_local1 > __nTargetNum) {
_local1 = __nTargetNum;
}
} else {
_local1 = _local1 - __nReducer;
if (_local1 < __nTargetNum) {
_local1 = __nTargetNum;
}
}
}
return(_local1);
}
static function getDistance(__nX1, __nY1, __nX2, __nY2) {
return(Math.sqrt(Math.pow(Math.abs(__nX2 - __nX1), 2) + Math.pow(Math.abs(__nY2 - __nY1), 2)));
}
static function getManhattanDistance(_x1, _y1, _x2, _y2) {
return(Math.abs(_x1 - _x2) + Math.abs(_y1 - _y2));
}
static function getHypotenuse(__nDX, __nDY) {
return(Math.sqrt(Math.pow(__nDX, 2) + Math.pow(__nDY, 2)));
}
static function getAngle(__nX1, __nY1, __nX2, __nY2) {
var _local2;
var _local1;
var _local4;
var _local3;
_local2 = __nX2 - __nX1;
_local1 = __nY2 - __nY1;
_local4 = Math.atan2(_local1, _local2);
_local3 = getDegreeFromRadius(_local4);
return(_local3);
}
static function getCleanedAngle(_nAngle) {
while (_nAngle < 360) {
_nAngle = _nAngle + 360;
}
_nAngle = _nAngle % 360;
return(_nAngle);
}
static function getDegreeFromRadius(__nRadius) {
var _local1 = (__nRadius / MATH_PI) * 180;
return(_local1);
}
static function getRadianFromDegree(__nDegree) {
var _local1 = __nDegree * (MATH_PI / 180);
return(_local1);
}
static function getBoundsCenter(_oBox) {
var _local3 = (_oBox.xMin + _oBox.xMax) / 2;
var _local2 = (_oBox.yMin + _oBox.yMax) / 2;
return({x:_local3, y:_local2});
}
static var MATH_PI = Math.PI;
}
Symbol 1030 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 1031 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 1032 MovieClip [__Packages.com.disney.gem.games.restoRush.GameData] Frame 0
class com.disney.gem.games.restoRush.GameData
{
function GameData () {
}
static var nSECONDS = 30;
static var nDIFFERENT_COOKS = 4;
static var nDIFFERENT_INGREDIENT = 3;
static var aATTACH_NAMES = ["mcFood1", "mcFood2", "mcFood3"];
static var nSTAGE_WIDTH = 580;
static var nPOINTS_GOOD_CATCH = 50;
static var nPOINTS_BAD_CATCH = 0;
static var nPOINTS_HAPPY_COOK = 0;
static var nPOINTS_MAD_COOK = 0;
static var nPLAYER_TRIES_STREAK = 100;
static var nPLAYER_BONUS_STREAK = 50;
static var nPOINTS_STREAK = 5000;
static var nPLAYER_TRIES = 3;
static var nPLAYER_MOVING_SPEED = 12;
static var nTIMER_ASKING = 4.5 * nSECONDS;
static var nTIMER_ASKING_RAMPING = 0.5 * nSECONDS;
static var nTIMER_RANDOM = 0 * nSECONDS;
static var nPAN_DIFFERENT = 4;
static var nORDER_MAX_ITEMS = 5;
static var nORDER_MIN_ITEMS = 1;
static var nORDERS_LEVEL_CHANGE = 12;
static var nORDER_LEVEL_ADDING = 1;
static var nORDER_ADDING_CHANCES = 80;
static var nTIMER_PATIENCE_BASE = 8 * nSECONDS;
static var nTIMER_PATIENCE_PER_ITEMS = 0.2 * nSECONDS;
static var nTIMER_PATIENCE_RAMPING = 0 * nSECONDS;
static var nTIMER_ADDED_PER_GOOD_ORDER = 0.8 * nSECONDS;
static var nTIMER_ADDED_SKINNERS_COMES = 5 * nSECONDS;
static var nFOOD_MOVING_SPEED = 20;
static var nFOOD_ROTATION_SPEED = 15;
}
Symbol 1033 MovieClip [__Packages.com.disney.gem.games.restoRush.CountersManager] Frame 0
class com.disney.gem.games.restoRush.CountersManager
{
var aCooks, aAvaibleCooks, aAvaibleCounters, aCounters, aBubbles, aAvaibleOrderBubbles, bTimerPaused, nTimer, oGameEngine;
function CountersManager (_aStagesCounters, _aStagesBubbles) {
aCooks = new Array();
aAvaibleCooks = new Array();
aAvaibleCounters = new Array();
aCounters = new Array();
aBubbles = new Array();
aAvaibleCounters = _aStagesCounters;
aAvaibleOrderBubbles = _aStagesBubbles;
aCounters = com.sarbakan.utils.Tools.doCopyArray(_aStagesCounters);
bTimerPaused = false;
buildCookArray();
nTimer = nINITIAL_DELAY;
var _local2 = 0;
while (_local2 < aAvaibleCounters.length) {
setCounterState(aAvaibleCounters[_local2], sSTATE_HIDDEN);
_local2++;
}
}
function init() {
initBubbles(aAvaibleOrderBubbles);
}
function setGameController(_oGameEngine) {
oGameEngine = _oGameEngine;
}
function getGameController() {
return(oGameEngine);
}
function givesCounterBack(_mcCounter) {
setCounterState(_mcCounter, sSTATE_HIDDEN);
aAvaibleCounters.push(_mcCounter);
}
function givesCookBack(_oCook, _bRestarting) {
var _local5 = _oCook.__get__CookNumberRef();
aAvaibleCooks.push(_local5 - 1);
var _local2 = 0;
while (_local2 < aCooks.length) {
if (aCooks[_local2] == _oCook) {
com.sarbakan.BaseDisneyController.getInstance().oMainBroadcaster.removeListener(aCooks[_local2]);
givesCounterBack(com.disney.gem.games.restoRush.Cook(aCooks[_local2]).__get__Ref()._parent);
com.disney.gem.games.restoRush.Cook(aCooks[_local2]).doDestroy();
if (!_bRestarting) {
aCooks.splice(_local2, 1);
}
}
_local2++;
}
}
function setCookMood(_isHappy, _oCook) {
oGameEngine.cookStatus(_isHappy, _oCook);
}
function skinnerComesIn() {
pauseTimer();
var _local2 = 0;
while (_local2 < aCooks.length) {
com.disney.gem.games.restoRush.Cook(aCooks[_local2]).pauseTimer();
_local2++;
}
}
function skinnerComesOut() {
resumeTimer();
var _local2 = 0;
while (_local2 < aCooks.length) {
com.disney.gem.games.restoRush.Cook(aCooks[_local2]).resumeTimer();
com.disney.gem.games.restoRush.Cook(aCooks[_local2]).addTimer(com.disney.gem.games.restoRush.GameData.nTIMER_ADDED_SKINNERS_COMES);
_local2++;
}
}
function gameEnded() {
var _local2 = 0;
while (_local2 < aCooks.length) {
com.disney.gem.games.restoRush.Cook(aCooks[_local2]).gameEnded();
_local2++;
}
}
function restart() {
var _local2 = 0;
while (_local2 < aCooks.length) {
com.disney.gem.games.restoRush.Cook(aCooks[_local2]).restart();
_local2++;
}
aCooks = new Array();
_local2 = 0;
while (_local2 < aBubbles.length) {
com.disney.gem.games.restoRush.Bubble(aBubbles[_local2]).hideOrder(true);
_local2++;
}
}
function pauseTimer() {
bTimerPaused = true;
}
function resumeTimer() {
bTimerPaused = false;
}
function doDestroy() {
deleteCooks();
deleteBubbles();
delete oGameEngine;
aCooks = new Array();
delete aCooks;
aBubbles = new Array();
delete aBubbles;
aCounters = new Array();
delete aCounters;
aAvaibleCooks = new Array();
delete aAvaibleCooks;
aAvaibleCounters = new Array();
delete aAvaibleCounters;
aAvaibleOrderBubbles = new Array();
delete aAvaibleOrderBubbles;
}
function onUpdate() {
super.onUpdate();
checkTimer();
}
function deleteCooks() {
var _local2 = 0;
while (_local2 < aCooks.length) {
com.sarbakan.BaseDisneyController.getInstance().oMainBroadcaster.removeListener(aCooks[_local2]);
com.disney.gem.games.restoRush.Cook(aCooks[_local2]).doDestroy();
aCooks.splice(_local2, 1);
_local2++;
}
}
function deleteBubbles() {
var _local2 = 0;
while (_local2 < aBubbles.length) {
com.sarbakan.BaseDisneyController.getInstance().oMainBroadcaster.removeListener(aBubbles[_local2]);
com.disney.gem.games.restoRush.Bubble(aBubbles[_local2]).doDestroy();
aBubbles.splice(_local2, 1);
_local2++;
}
}
function buildCookArray() {
var _local2 = 0;
while (_local2 < com.disney.gem.games.restoRush.GameData.nDIFFERENT_COOKS) {
aAvaibleCooks.push(_local2);
_local2++;
}
}
function setCounterState(_mcCounter, _sState) {
_mcCounter.gotoAndStop(_sState);
}
function checkTimer() {
if (!bTimerPaused) {
nTimer--;
if (nTimer <= 0) {
checkTimedAction();
}
}
}
function checkTimedAction() {
nTimer = com.disney.gem.games.restoRush.GameData.nTIMER_ASKING - (com.disney.gem.games.restoRush.GameData.nTIMER_ASKING_RAMPING * oGameEngine.currentLevel());
nTimer = nTimer + Math.floor(Math.random() * com.disney.gem.games.restoRush.GameData.nTIMER_RANDOM);
addCook();
}
function addCook() {
var _local4 = pickCook();
if (_local4 != null) {
var _local2 = pickCounter();
_local2.gotoAndStop(_local4 + 1);
_local2.mcCook.gotoAndStop(sSTATE_HIDDEN);
var _local5 = IndexOf(aCounters, _local2);
var _local6 = Math.floor(oGameEngine.__get__CounterRows()[_local5]);
var _local3 = new com.disney.gem.games.restoRush.Cook(_local2.mcCook, _local4 + 1, _local6, aBubbles[_local5]);
_local3.setController(this);
com.sarbakan.BaseDisneyController.getInstance().oMainBroadcaster.addListener(_local3);
aCooks.push(_local3);
}
}
function IndexOf(_aArray, _oObject) {
var _local3;
var _local1 = 0;
while (_local1 < _aArray.length) {
if (_aArray[_local1] == _oObject) {
_local3 = _local1;
}
_local1++;
}
return(_local3);
}
function pickCounter() {
var _local2;
_local2 = Math.floor(Math.random() * aAvaibleCounters.length);
var _local3 = aAvaibleCounters[_local2];
aAvaibleCounters.splice(_local2, 1);
return(_local3);
}
function pickCook() {
var _local3;
if (aAvaibleCooks.length > 0) {
var _local2 = Math.floor(Math.random() * aAvaibleCooks.length);
_local3 = aAvaibleCooks[_local2];
aAvaibleCooks.splice(_local2, 1);
} else {
_local3 = null;
}
return(_local3);
}
function initBubbles(_aBubblesMC) {
var _local3 = 0;
while (_local3 < _aBubblesMC.length) {
var _local2 = new com.disney.gem.games.restoRush.Bubble(_aBubblesMC[_local3]);
_local2.setController(this);
com.sarbakan.BaseDisneyController.getInstance().oMainBroadcaster.addListener(_local2);
aBubbles.push(_local2);
_local3++;
}
}
static var sSTATE_HIDDEN = "Hidden";
static var nINITIAL_DELAY = 2 * com.disney.gem.games.restoRush.GameData.nSECONDS;
}
Symbol 1034 MovieClip [__Packages.com.sarbakan.utils.Tools] Frame 0
class com.sarbakan.utils.Tools
{
function Tools () {
}
static function isItemInArray(_aArray, _oItem) {
var _local3 = false;
var _local1 = _aArray.length - 1;
while (_local1 >= 0) {
if (_aArray[_local1] == _oItem) {
_local3 = true;
}
_local1--;
}
return(_local3);
}
static function doCopyArray(_aArraySource) {
var _local3 = new Array();
var _local1 = 0;
_local1 = 0;
while (_local1 < _aArraySource.length) {
if (_aArraySource[_local1] instanceof Array) {
_local3.push(doCopyArray(_aArraySource[_local1]));
} else {
_local3.push(_aArraySource[_local1]);
}
_local1++;
}
return(_local3);
}
static function getFormatedNumber(_nNumber, _nMinimumChar) {
return(returnFormatedNumber(_nNumber, _nMinimumChar));
}
static function returnFormatedNumber(_nNumber, _nMinimumChar) {
var _local1 = String(_nNumber);
while (_local1.length < _nMinimumChar) {
_local1 = "0" + _local1;
}
var _local3 = new Array();
var _local6 = _local1.length - 1;
var _local2;
_local2 = 0;
while (_local2 <= _local6) {
var _local5 = _local1.charAt(_local2);
_local3.push(_local5);
_local2++;
}
_local1 = "";
var _local4 = 0;
_local2 = _local3.length - 1;
while (_local2 >= 0) {
if (((_local4 % 3) == 0) && (_local4 != 0)) {
_local1 = "," + _local1;
}
_local1 = _local3[_local2] + _local1;
_local4++;
_local2--;
}
return(_local1);
}
static function getFormatedTime(_nTime, _bIncludeMilliseconds, _bShowMinutes) {
if (_bIncludeMilliseconds == undefined) {
_bIncludeMilliseconds = false;
}
if (_bShowMinutes == undefined) {
_bShowMinutes = true;
}
var _local6 = false;
if (_nTime < 0) {
_local6 = true;
_nTime = Math.abs(_nTime);
}
var _local4 = Math.floor(_nTime / 1000);
var _local3;
if (_bIncludeMilliseconds) {
var _local5;
if (_nTime >= 1000) {
_local5 = _nTime % (_local4 * 1000);
} else {
_local5 = _nTime;
}
_local3 = String(_local5).substr(0, 2);
if (_local3.length <= 1) {
_local3 = "0" + _local3;
}
}
var _local7 = Math.floor(_local4 / 60);
var _local8 = Math.floor(_local4 % 60);
var _local11 = "";
var _local9 = "";
if (_local8 < 10) {
_local9 = "0";
}
if (_local7 < 10) {
_local11 = "0";
}
var _local1 = "";
if (_bShowMinutes) {
_local1 = _local1 + String((_local11 + _local7) + ":");
}
_local1 = _local1 + (_local9 + _local8);
if (_bIncludeMilliseconds) {
_local1 = _local1 + (":" + _local3);
}
if (_local6) {
_local1 = "-" + _local1;
}
return(_local1);
}
static function getTrimmedString(_sStr) {
while (_sStr.charAt(0) == " ") {
_sStr = _sStr.substring(1, _sStr.length);
}
while (_sStr.charAt(_sStr.length - 1) == " ") {
_sStr = _sStr.substring(0, _sStr.length - 1);
}
return(_sStr);
}
}
Symbol 1035 MovieClip [__Packages.com.disney.gem.games.restoRush.Cook] Frame 0
class com.disney.gem.games.restoRush.Cook extends com.sarbakan.utils.StateManaged
{
var nTimer, nRow, nItemCatched, bOrderSet, bPauseTimer, oBubble, nCookNumberRef, setState, oController, mcRef, aOrder, stateFinished, nCatchFood, sState;
function Cook (_mcRef, _nCook, _nRow, _oBubble) {
super(_mcRef);
nTimer = 0;
nRow = _nRow;
nItemCatched = 0;
bOrderSet = false;
bPauseTimer = false;
oBubble = _oBubble;
nCookNumberRef = Math.ceil(Math.random() * com.disney.gem.games.restoRush.GameData.nPAN_DIFFERENT);
nCookNumberRef = _nCook;
setState(sSTATE_IN);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, sSOUNDS_IN, com.disney.gem.games.restoRush.Controller.nSOUND_VOLUME_SOUND);
}
function setController(_oController) {
oController = _oController;
}
function get CookNumberRef() {
return(nCookNumberRef);
}
function get Ref() {
return(mcRef);
}
function get CatchedItems() {
return(nItemCatched);
}
function pauseTimer() {
bPauseTimer = true;
}
function resumeTimer() {
bPauseTimer = false;
}
function addTimer(_nTime) {
nTimer = nTimer + _nTime;
}
function gameEnded(_nTime) {
pauseTimer();
}
function restart() {
oController.givesCookBack(this, true);
}
function doDestroy() {
super.destroy();
delete oController;
aOrder = new Array();
delete aOrder;
delete oBubble;
}
function onUpdate() {
super.onUpdate();
checkTimer();
checkFoodHits();
mcRef.txtTimer.text = nTimer;
if (mcRef.mcState.mcPan) {
mcRef.mcState.mcPan.gotoAndStop(nCookNumberRef);
}
}
function state_In() {
if (stateFinished()) {
setState(sSTATE_ASK);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, sSOUNDS_ASK, sSOUNDS_ASK_VOLUME);
}
}
function state_Ask_init() {
setOrder();
}
function state_Ask() {
if (stateFinished()) {
setState(sSTATE_WAIT);
}
}
function state_Dodge_init() {
setOrder();
}
function state_Angry_init() {
oController.setCookMood(false, this);
oBubble.hideOrder(false);
}
function state_Angry() {
if (stateFinished()) {
setState(sSTATE_OUT);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, sSOUNDS_OUT, com.disney.gem.games.restoRush.Controller.nSOUND_VOLUME_SOUND);
}
}
function state_Dodge() {
if (stateFinished()) {
setState(sSTATE_WAIT);
}
}
function state_Catch_init() {
setOrder();
nItemCatched++;
nTimer = nTimer + com.disney.gem.games.restoRush.GameData.nTIMER_ADDED_PER_GOOD_ORDER;
pauseTimer();
}
function state_Catch() {
if (mcRef.mcState.mcFood) {
mcRef.mcState.mcFood.gotoAndStop(nCatchFood);
}
if (stateFinished()) {
if (aOrder.length <= 0) {
setState(sSTATE_HAPPY);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, aSOUNDS_HAPPY[nCookNumberRef - 1], aSOUNDS_HAPPY_VOLUME[nCookNumberRef - 1]);
} else {
setState(sSTATE_ASK);
}
}
}
function state_Happy_init() {
oController.setCookMood(true, this);
}
function state_Happy() {
if (stateFinished()) {
setState(sSTATE_OUT);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, sSOUNDS_OUT, com.disney.gem.games.restoRush.Controller.nSOUND_VOLUME_SOUND);
}
}
function state_Out() {
if (stateFinished()) {
setState(sSTATE_HIDDEN);
oController.givesCookBack(this, false);
}
}
function setOrder() {
if (!bOrderSet) {
var _local7 = oController.getGameController();
aOrder = new Array();
var _local5 = com.disney.gem.games.restoRush.GameData.nORDER_MIN_ITEMS;
var _local6 = Math.floor(_local7.currentLevel() / com.disney.gem.games.restoRush.GameData.nORDER_LEVEL_ADDING);
var _local2 = 0;
while (_local2 < _local6) {
var _local4 = Math.floor(Math.random() * 100);
if (_local4 <= com.disney.gem.games.restoRush.GameData.nORDER_ADDING_CHANCES) {
_local5++;
}
_local2++;
}
if (_local5 > com.disney.gem.games.restoRush.GameData.nORDER_MAX_ITEMS) {
_local5 = com.disney.gem.games.restoRush.GameData.nORDER_MAX_ITEMS;
}
_local2 = 0;
while (_local2 < _local5) {
var _local3 = Math.ceil(Math.random() * com.disney.gem.games.restoRush.GameData.nDIFFERENT_INGREDIENT);
aOrder.push(_local3);
_local2++;
}
bOrderSet = true;
nTimer = nTimer + com.disney.gem.games.restoRush.GameData.nTIMER_PATIENCE_BASE;
nTimer = nTimer + (com.disney.gem.games.restoRush.GameData.nTIMER_PATIENCE_PER_ITEMS * _local5);
nTimer = nTimer - (com.disney.gem.games.restoRush.GameData.nTIMER_PATIENCE_RAMPING * _local7.currentLevel());
oBubble.setOrder(aOrder);
} else {
updateOrder();
}
}
function updateOrder() {
if (aOrder.length > 0) {
resumeTimer();
oBubble.updateOrder(aOrder);
} else if (aOrder.length == 0) {
oBubble.hideOrder(false);
} else {
pauseTimer();
}
}
function checkTimer() {
if ((nTimer > 0) && (!bPauseTimer)) {
nTimer--;
if (nTimer <= 0) {
setState(sSTATE_ANGRY);
}
}
}
function checkFoodHits() {
if (canCatch()) {
var _local8 = oController.getGameController();
var _local4 = _local8.getFoods();
var _local3 = 0;
while (_local3 < _local4.length) {
if (!com.disney.gem.games.restoRush.Food(_local4[_local3]).bChecked) {
if (nRow == com.disney.gem.games.restoRush.Food(_local4[_local3]).__get__Row()) {
if (mcRef.mcState.mcCatchZone.hitTest(com.disney.gem.games.restoRush.Food(_local4[_local3]).__get__Ref())) {
com.disney.gem.games.restoRush.Food(_local4[_local3]).bChecked = true;
var _local5 = false;
var _local2 = 0;
while (_local2 < aOrder.length) {
if (com.disney.gem.games.restoRush.Food(_local4[_local3]).__get__FoodType() == aOrder[_local2]) {
_local5 = true;
nCatchFood = com.disney.gem.games.restoRush.Food(_local4[_local3]).FoodType;
com.disney.gem.games.restoRush.Food(_local4[_local3]).catched();
aOrder.splice(_local2, 1);
_local2 = aOrder.length;
}
_local2++;
}
if (_local5) {
setState(sSTATE_CATCH, false, true);
var _local7 = Math.floor(Math.random() * aSOUNDS_CATCH.length);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, sSOUNDS_CATCH, sSOUNDS_CATCH_VOLUME);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, aSOUNDS_CATCH[_local7], aSOUNDS_CATCH_VOLUME[_local7]);
} else {
setState(sSTATE_DODGE);
var _local6 = com.sarbakan.sound.SoundManager.isSoundPlaying(sSOUNDS_DODGE);
if (_local6.bPlaying) {
_local6.oSound.doStop();
}
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, sSOUNDS_DODGE, com.disney.gem.games.restoRush.Controller.nSOUND_VOLUME_SOUND);
}
}
}
}
_local3++;
}
}
}
function canCatch() {
var _local2 = false;
if ((((sState == sSTATE_ASK) || (sState == sSTATE_DODGE)) || (sState == sSTATE_CATCH)) || (sState == sSTATE_WAIT)) {
mcRef.mcState.mcCatchZone._visible = false;
if (aOrder.length > 0) {
_local2 = true;
}
}
return(_local2);
}
static var sSTATE_IN = "In";
static var sSTATE_ASK = "Ask";
static var sSTATE_WAIT = "Wait";
static var sSTATE_CATCH = "Catch";
static var sSTATE_DODGE = "Dodge";
static var sSTATE_HAPPY = "Happy";
static var sSTATE_ANGRY = "Angry";
static var sSTATE_OUT = "Out";
static var sSTATE_HIDDEN = "Hidden";
static var sFOOD_ORDER_MC = "mcFood";
static var sSOUNDS_ASK = "CookAsk.wav";
static var sSOUNDS_ASK_VOLUME = 70;
static var aSOUNDS_CATCH = ["CookCatch0.wav", "CookCatch1.wav", "CookCatch2.wav", "CookCatch3.wav"];
static var aSOUNDS_CATCH_VOLUME = [100, 100, 100, 70];
static var aSOUNDS_HAPPY = ["Cook_Happy_1.wav", "Cook_Happy_2.wav", "Cook_Happy_3.wav", "Cook_Happy_4.wav"];
static var aSOUNDS_HAPPY_VOLUME = [140, 140, 140, 120];
static var sSOUNDS_DODGE = "CookDodge.wav";
static var sSOUNDS_IN = "CookIn.wav";
static var sSOUNDS_OUT = "CookOut.wav";
static var sSOUNDS_CATCH = "CookCatchFood.wav";
static var sSOUNDS_CATCH_VOLUME = 70;
}
Symbol 1036 MovieClip [__Packages.com.disney.gem.games.restoRush.Bubble] Frame 0
class com.disney.gem.games.restoRush.Bubble extends com.sarbakan.utils.StateManaged
{
var setState, oCounter, aCurrentOrder, stateFinished, mcRef;
function Bubble (_mcRef) {
super(_mcRef);
setState(sSTATE_HIDDEN);
}
function setController(_oCounter) {
oCounter = _oCounter;
}
function setOrder(_aOrder) {
setState(sSTATE_APPEAR);
aCurrentOrder = new Array();
aCurrentOrder = com.sarbakan.utils.Tools.doCopyArray(_aOrder);
}
function updateOrder(_aOrder) {
if (_aOrder.length > 0) {
aCurrentOrder = new Array();
aCurrentOrder = com.sarbakan.utils.Tools.doCopyArray(_aOrder);
}
showOrder();
}
function hideOrder(_bInstant) {
if (!_bInstant) {
setState(sSTATE_DISAPPEAR);
} else {
aCurrentOrder = new Array();
setState(sSTATE_HIDDEN);
}
}
function doDestroy() {
super.destroy();
delete oCounter;
aCurrentOrder = new Array();
delete aCurrentOrder;
}
function onUpdate() {
super.onUpdate();
}
function state_Appear_init() {
showOrder();
}
function state_Appear() {
if (stateFinished()) {
setState(sSTATE_IDLE);
}
}
function state_Idle_init() {
showOrder();
}
function state_Disappear_init() {
showOrder();
}
function state_Disappear() {
if (stateFinished()) {
setState(sSTATE_HIDDEN);
}
}
function showOrder() {
var _local3 = aCurrentOrder.length;
mcRef.mcState.mcOrder.gotoAndStop(_local3);
var _local2 = 0;
while (_local2 < _local3) {
mcRef.mcState.mcOrder[sFOOD_MC + _local2].gotoAndStop(aCurrentOrder[_local2]);
_local2++;
}
}
static var sSTATE_IDLE = "Idle";
static var sSTATE_DISAPPEAR = "Disappear";
static var sSTATE_APPEAR = "Appear";
static var sSTATE_HIDDEN = "Hidden";
static var sFOOD_MC = "mcFood";
}
Symbol 1037 MovieClip [__Packages.com.disney.gem.games.restoRush.Food] Frame 0
class com.disney.gem.games.restoRush.Food extends com.sarbakan.utils.StateManaged
{
var nRow, nMovingSpeed, nFoodType, bCatched, bChecked, sDirection, setState, oGameController, mcRef;
function Food (_mcRef, _sDirection, _nType, _nRow) {
super(_mcRef);
nRow = _nRow;
nMovingSpeed = com.disney.gem.games.restoRush.GameData.nFOOD_MOVING_SPEED;
nFoodType = _nType;
bCatched = false;
bChecked = false;
sDirection = _sDirection;
setState(sSTATE_IDLE);
}
function setGameEngine(_oGameEngine) {
oGameController = _oGameEngine;
}
function get Ref() {
return(mcRef);
}
function get FoodType() {
return(nFoodType);
}
function get Row() {
return(nRow);
}
function get isCatched() {
return(bCatched);
}
function catched() {
bCatched = true;
oGameController.removeFood(this);
}
function doDestroy() {
mcRef.removeMovieClip();
delete oGameController;
super.destroy();
}
function onUpdate() {
super.onUpdate();
checkMouvement();
}
function checkMouvement() {
if (sDirection == sDIRECTION_LEFT) {
mcRef._x = mcRef._x - nMovingSpeed;
} else if (sDirection == sDIRECTION_RIGHT) {
mcRef._x = mcRef._x + nMovingSpeed;
}
mcRef._rotation = mcRef._rotation + com.disney.gem.games.restoRush.GameData.nFOOD_ROTATION_SPEED;
if ((mcRef._x > com.disney.gem.games.restoRush.GameData.nSTAGE_WIDTH) || ((mcRef._x + mcRef._width) < mcRef._width)) {
oGameController.removeFood(this);
}
}
static var sSTATE_IDLE = "Idle";
static var sDIRECTION_LEFT = "Left";
static var sDIRECTION_RIGHT = "Right";
}
Symbol 1038 MovieClip [__Packages.com.disney.gem.games.restoRush.Skinner] Frame 0
class com.disney.gem.games.restoRush.Skinner extends com.sarbakan.utils.StateManaged
{
var setState, oController, mcRef, stateFinished;
function Skinner (_mcRef) {
super(_mcRef);
setState(sSTATE_HIDDEN);
}
function comesIn() {
setState(sSTATE_IN);
var _local2 = com.sarbakan.sound.SoundManager.isSoundPlaying(sSOUND_COOKMAD);
if (!_local2.bPlaying) {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.restoRush.Controller.sSOUND_CAT_SOUND, sSOUND_COOKMAD, com.disney.gem.games.restoRush.Controller.nSOUND_VOLUME_SOUND);
}
}
function setController(_oController) {
oController = _oController;
}
function restart() {
setState(sSTATE_HIDDEN);
}
function doDestroy() {
mcRef.gotoAndStop(sSTATE_HIDDEN);
delete oController;
super.destroy();
}
function onUpdate() {
super.onUpdate();
}
function state_In() {
if (stateFinished()) {
setState(sSTATE_HIDDEN);
oController.skinnersOut();
oController.checkEndGame();
}
}
static var sSTATE_HIDDEN = "Hidden";
static var sSTATE_IN = "In";
static var sSOUND_COOKMAD = "CookMad.wav";
}
Symbol 1039 MovieClip [__Packages.com.disney.gem.games.restoRush.popups.MenuPopup] Frame 0
class com.disney.gem.games.restoRush.popups.MenuPopup extends com.sarbakan.utils.ScreenController
{
var oController, hide, mcRef;
function MenuPopup (_mcRef) {
super(_mcRef);
}
function onBtSound() {
com.disney.gem.games.restoRush.Controller(oController).toggleSound();
updateSoundGroup();
oController.doButtonRelease();
}
function onBtHelp() {
com.disney.gem.games.restoRush.Controller(oController).showInstructions();
oController.doButtonRelease();
}
function onBtQuit() {
com.disney.gem.games.restoRush.Controller(oController).showPopup(new com.disney.gem.games.restoRush.popups.ConfirmPopupQuit(com.disney.gem.games.restoRush.Controller(oController).mcTimeline.mcPopups.mcConfirm, this), true);
oController.doButtonRelease();
}
function onBtResume() {
com.disney.gem.games.restoRush.Controller(oController).unpause();
hide(undefined, true);
com.disney.gem.games.restoRush.Controller(oController).doButtonRelease();
com.disney.gem.games.restoRush.Controller(oController).bMenuOpen = false;
}
function onBtRestart() {
com.disney.gem.games.restoRush.Controller(oController).showPopup(new com.disney.gem.games.restoRush.popups.ConfirmPopupRestart(com.disney.gem.games.restoRush.Controller(oController).mcTimeline.mcPopups.mcConfirmRestart, this), true);
oController.doButtonRelease();
}
function state_in_init() {
super.state_in_init();
setBts();
}
function state_in() {
super.state_in();
}
function state_idle_init() {
super.state_idle_init();
setBts();
}
function state_idle() {
updateSoundGroup();
}
function state_out_init() {
super.state_out_init();
setBts();
}
function setBts() {
mcRef.mcState.mcContent.btHelp.onRelease = com.sarbakan.utils.Delegate.create(this, onBtHelp);
oController.doApplyButtonSound(mcRef.mcState.mcContent.btHelp);
mcRef.mcState.mcContent.btResume.onRelease = com.sarbakan.utils.Delegate.create(this, onBtResume);
oController.doApplyButtonSound(mcRef.mcState.mcContent.btResume);
mcRef.mcState.mcContent.btQuit.onRelease = com.sarbakan.utils.Delegate.create(this, onBtQuit);
oController.doApplyButtonSound(mcRef.mcState.mcContent.btQuit);
mcRef.mcState.mcContent.btRestart.onRelease = com.sarbakan.utils.Delegate.create(this, onBtRestart);
oController.doApplyButtonSound(mcRef.mcState.mcContent.btRestart);
updateSoundGroup();
}
function updateSoundGroup() {
var _local2 = sLABEL_SOUND_ON;
if (com.disney.gem.games.restoRush.Controller(oController).bSoundMuted) {
_local2 = sLABEL_SOUND_OFF;
}
mcRef.mcState.mcContent.mcSoundToggle.gotoAndStop(_local2);
mcRef.mcState.mcContent.mcSoundToggle.btSound.onRelease = com.sarbakan.utils.Delegate.create(this, onBtSound);
oController.doApplyButtonSound(mcRef.mcState.mcContent.mcSoundToggle.btSound);
}
static var sLABEL_SOUND_ON = "On";
static var sLABEL_SOUND_OFF = "Off";
}
Symbol 1040 MovieClip [__Packages.com.disney.gem.games.restoRush.popups.ConfirmPopupQuit] Frame 0
class com.disney.gem.games.restoRush.popups.ConfirmPopupQuit extends com.sarbakan.utils.ScreenController
{
var oMenuOrigin, hide, oController, mcRef;
function ConfirmPopupQuit (_mcRef, _oMenuOrigin) {
super(_mcRef);
oMenuOrigin = _oMenuOrigin;
}
function onBtNo() {
hide();
oController.doButtonRelease();
}
function onBtYes() {
com.disney.gem.games.restoRush.Controller(oController).onGameOver(com.disney.gem.games.restoRush.Controller(oController).getScore());
oController.doButtonRelease();
}
function state_in_init() {
super.state_in_init();
setBts();
}
function state_idle_init() {
super.state_idle_init();
setBts();
}
function state_out_init() {
super.state_out_init();
setBts();
}
function setBts() {
mcRef.mcState.mcContent.btYes.onRelease = com.sarbakan.utils.Delegate.create(this, onBtYes);
mcRef.mcState.mcContent.btNo.onRelease = com.sarbakan.utils.Delegate.create(this, onBtNo);
oController.doApplyButtonSound(mcRef.mcState.mcContent.btYes);
oController.doApplyButtonSound(mcRef.mcState.mcContent.btNo);
}
}
Symbol 1041 MovieClip [__Packages.com.disney.gem.games.restoRush.popups.ConfirmPopupRestart] Frame 0
class com.disney.gem.games.restoRush.popups.ConfirmPopupRestart extends com.sarbakan.utils.ScreenController
{
var oMenuOrigin, hide, oController, mcRef;
function ConfirmPopupRestart (_mcRef, _oMenuOrigin) {
super(_mcRef);
oMenuOrigin = _oMenuOrigin;
}
function onBtNo() {
hide();
oController.doButtonRelease();
}
function onBtYes() {
hide();
com.disney.gem.games.restoRush.Controller(oController).doButtonRelease();
com.disney.gem.games.restoRush.Controller(oController).setLevel(0);
com.disney.gem.games.restoRush.Controller(oController).setScore(0);
com.disney.gem.games.restoRush.Controller(oController).onGameRestart();
}
function state_in_init() {
super.state_in_init();
setBts();
}
function state_idle_init() {
super.state_idle_init();
setBts();
}
function state_out_init() {
super.state_out_init();
setBts();
}
function setBts() {
mcRef.mcState.mcContent.btYes.onRelease = com.sarbakan.utils.Delegate.create(this, onBtYes);
mcRef.mcState.mcContent.btNo.onRelease = com.sarbakan.utils.Delegate.create(this, onBtNo);
oController.doApplyButtonSound(mcRef.mcState.mcContent.btYes);
oController.doApplyButtonSound(mcRef.mcState.mcContent.btNo);
}
}
Symbol 1042 MovieClip [__Packages.com.disney.gem.games.restoRush.screens.TitleScreen] Frame 0
class com.disney.gem.games.restoRush.screens.TitleScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function TitleScreen (_mcRef) {
super(_mcRef);
}
function onBtHelp() {
oController.showInstructions();
oController.doButtonRelease(mcRef);
}
function onBtPlay() {
oController.startNewGame();
oController.doButtonRelease(mcRef);
}
function state_idle_init() {
mcRef.mcState.mcContent.btHelp.onRelease = com.sarbakan.utils.Delegate.create(this, onBtHelp);
mcRef.mcState.mcContent.btPlay.onRelease = com.sarbakan.utils.Delegate.create(this, onBtPlay);
oController.doApplyButtonSound(mcRef.mcState.mcContent.btHelp);
oController.doApplyButtonSound(mcRef.mcState.mcContent.btPlay);
}
}
Symbol 1043 MovieClip [__Packages.com.disney.gem.games.restoRush.screens.HelpScreen] Frame 0
class com.disney.gem.games.restoRush.screens.HelpScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function HelpScreen (_mcRef) {
super(_mcRef);
}
function onBtBack() {
com.disney.gem.games.restoRush.Controller(oController).hideInstructions();
oController.doButtonRelease();
}
function state_idle_init() {
super.state_idle_init();
if (com.disney.gem.games.restoRush.Controller(oController).getGamePhase() == 2) {
mcRef.mcState.mcContent.mcButtons.gotoAndStop(sLABEL_PLAY);
} else {
mcRef.mcState.mcContent.mcButtons.gotoAndStop(sLABEL_RESUME);
}
mcRef.mcState.mcContent.btPlay.onRelease = com.sarbakan.utils.Delegate.create(this, onBtBack);
oController.doApplyButtonSound(mcRef.mcState.mcContent.btPlay);
}
static var sLABEL_PLAY = "Play";
static var sLABEL_RESUME = "Resume";
}
Symbol 1044 MovieClip [__Packages.com.disney.gem.games.restoRush.screens.EndScreen] Frame 0
class com.disney.gem.games.restoRush.screens.EndScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function EndScreen (_mcRef) {
super(_mcRef);
}
function onBtOk() {
oController.btClickTryAgain();
oController.doButtonRelease();
}
function state_idle_init() {
mcRef.mcState.mcContent.btOk.onRelease = com.sarbakan.utils.Delegate.create(this, onBtOk);
mcRef.mcState.mcContent.txtScore.text = com.sarbakan.utils.Tools.getFormatedNumber(oController.Score, 0);
oController.doApplyButtonSound(mcRef.mcState.mcContent.btOk);
}
}
Symbol 1045 MovieClip [__Packages.com.disney.gem.games.restoRush.screens.PreloaderScreen] Frame 0
class com.disney.gem.games.restoRush.screens.PreloaderScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function PreloaderScreen (_mcRef) {
super(_mcRef);
}
function state_idle() {
var _local2 = oController.mcTimeline.getBytesLoaded() / oController.mcTimeline.getBytesTotal();
mcRef.mcState.txtLoading.text = Math.round(_local2 * 100);
if (_local2 == 1) {
oController.onPreloadingDone();
}
}
}
Symbol 78 MovieClip Frame 1
stop();