home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2008-09-04 | 60.8 KB | 1,450 lines
package classes.manager { import classes.basic.Button.*; import classes.basic.Events.TFEvent; import classes.basic.MovieClip.*; import classes.basic.SceneLoader.*; import classes.basic.StateMachine.*; import classes.basic.Utils.*; import classes.game.ManagerGamePlay; import classes.game.ProgressMainChar; import classes.global.*; import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.MovieClip; import flash.display.StageQuality; import flash.events.*; public class ManagerGAME { internal static var EVENT_GO_TO_GAME:String = "EVENT_GO_TO_GAME"; internal static var ST_MAIN_MENU:String = "ST_MAIN_MENU"; internal static var ST_HOW_TO_PLAY:String = "ST_HOW_TO_PLAY"; internal static var ST_GAME:String = "ST_GAME"; internal static var ST_VICTORY:String = "ST_VICTORY"; internal static var EVENT_GO_TO_HOW_TO_PLAY:String = "EVENT_GO_TO_HOW_TO_PLAY"; internal static var ST_PROGRESS_SCREEN:String = "ST_PROGRESS_SCREEN"; internal static var ST_GAME_OVER:String = "ST_GAME_OVER"; internal static var EVENT_GO_TO_PROGRESS_SCREEN:String = "EVENT_GO_TO_PROGRESS_SCREEN"; internal static var EVENT_GO_TO_GAME_OVER:String = "EVENT_GO_TO_GAME_OVER"; internal static var EVENT_GO_TO_MENU:String = "EVENT_GO_TO_MENU"; internal static var ST_HIGH_SCORE:String = "ST_HIGH_SCORE"; internal static var EVENT_GO_TO_HIGH_SCORE:String = "EVENT_GO_TO_HIGH_SCORE"; internal static var EVENT_GO_TO_VICTORY:String = "EVENT_GO_TO_VICTORY"; private var progressMainChar:ProgressMainChar; private var buttons:Array; private var stMachine:TFStateMachine; private var stopSound:Boolean; private var gamePlay:ManagerGamePlay; private var scenary:Bitmap; private var stage:MovieClip; public function ManagerGAME(param1:MovieClip) { super(); this.buttons = new Array(); this.stage = param1; stMachine = new TFStateMachine(null); stopSound = true; stMachine.createEvent(EVENT_GO_TO_MENU,null); stMachine.createEvent(EVENT_GO_TO_GAME,null); stMachine.createEvent(EVENT_GO_TO_PROGRESS_SCREEN,null); stMachine.createEvent(EVENT_GO_TO_GAME_OVER,null); stMachine.createEvent(EVENT_GO_TO_HOW_TO_PLAY,null); stMachine.createEvent(EVENT_GO_TO_VICTORY,null); stMachine.createEvent(EVENT_GO_TO_HIGH_SCORE,null); stMachine.createState(ST_MAIN_MENU,false,this,startMainMenu,null,stopMainMenu); stMachine.createState(ST_GAME,false,this,startGame,processGame,stopGame); stMachine.createState(ST_PROGRESS_SCREEN,false,this,startProgressScreen,processProgress,stopProgressScreen); stMachine.createState(ST_GAME_OVER,false,this,startGameOver,null,stopGameOver); stMachine.createState(ST_HOW_TO_PLAY,false,this,startHowToPlay,null,stopHowToPlay); stMachine.createState(ST_VICTORY,false,this,startVictory,null,stopVictory); stMachine.createState(ST_HIGH_SCORE,false,this,startHighScore,null,stopHighScore); stMachine.createTransition(ST_MAIN_MENU,EVENT_GO_TO_PROGRESS_SCREEN,ST_PROGRESS_SCREEN); stMachine.createTransition(ST_MAIN_MENU,EVENT_GO_TO_HOW_TO_PLAY,ST_HOW_TO_PLAY); stMachine.createTransition(ST_HOW_TO_PLAY,EVENT_GO_TO_MENU,ST_MAIN_MENU); stMachine.createTransition(ST_GAME,EVENT_GO_TO_MENU,ST_MAIN_MENU); stMachine.createTransition(ST_GAME,EVENT_GO_TO_PROGRESS_SCREEN,ST_PROGRESS_SCREEN); stMachine.createTransition(ST_PROGRESS_SCREEN,EVENT_GO_TO_GAME,ST_GAME); stMachine.createTransition(ST_GAME,EVENT_GO_TO_GAME_OVER,ST_GAME_OVER); stMachine.createTransition(ST_GAME,EVENT_GO_TO_VICTORY,ST_VICTORY); stMachine.createTransition(ST_VICTORY,EVENT_GO_TO_HIGH_SCORE,ST_HIGH_SCORE); stMachine.createTransition(ST_GAME_OVER,EVENT_GO_TO_HIGH_SCORE,ST_HIGH_SCORE); stMachine.createTransition(ST_MAIN_MENU,EVENT_GO_TO_HIGH_SCORE,ST_HIGH_SCORE); stMachine.createTransition(ST_HIGH_SCORE,EVENT_GO_TO_MENU,ST_MAIN_MENU); stMachine.initialize(ST_MAIN_MENU); } public function dispatchGameOver() : * { try { return stMachine.receiveEvent(EVENT_GO_TO_GAME_OVER); } catch(e:Error) { } } private function onEventHowToPlay(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: dispatchHowToPlay(); break; case TFEvent.EVENT_INIT: case TFEvent.EVENT_MOUSEOUT: case TFEvent.EVENT_MOUSEOVER: } } private function onHowToPlayPage1LoadFrame() : * { TFMovieClip.addLabelScript(stage,"page1",null); stage.stop(); if(buttons["button1"] == null) { buttons["button1"] = new TFTextButton(stage.mcMainMenu,Global.xmlLocalization.howToPlay.mainmenu,onEventButton1); buttons["button1"].setFxOver(Global.soundsFX["mouse_over"]); buttons["button1"].setFxClick(Global.soundsFX["mouse_click"]); } if(buttons["button2"] == null) { buttons["button2"] = new TFTextButton(stage.mcNext,Global.xmlLocalization.howToPlay.next,onEventButton2); buttons["button2"].setFxOver(Global.soundsFX["mouse_over"]); buttons["button2"].setFxClick(Global.soundsFX["mouse_click"]); } buttons["button1"].setText(Global.xmlLocalization.howToPlay.mainmenu); buttons["button2"].setText(Global.xmlLocalization.howToPlay.next); stage.mcText1.text = Global.xmlLocalization.howToPlay.text1; stage.mcText2.text = Global.xmlLocalization.howToPlay.text2; stage.mcLogo.gotoAndStop(Global.localization_branding_nr); stage.mcLogo.mcHitArea.addEventListener(MouseEvent.CLICK,onMCClick,false,0,true); } private function onEventBackground(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSEUP: if(Global.mouse.getLastLocal() != null) { Global.mouse.getLastLocal().addCustomer(Global.mouse.removeCustomer()); } } } private function onEventQuality(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: switch(Global.main.stage.quality) { case "HIGH": Global.main.stage.quality = StageQuality.LOW; break; case "MEDIUM": Global.main.stage.quality = StageQuality.HIGH; break; case "LOW": Global.main.stage.quality = StageQuality.MEDIUM; } buttons["quality"].setText(Global.xmlLocalization.mainmenu.quality + " " + Global.xmlLocalization.mainmenu.child(Global.main.stage.quality.toLowerCase())[0].toString()); break; case TFEvent.EVENT_INIT: case TFEvent.EVENT_MOUSEOUT: case TFEvent.EVENT_MOUSEOVER: } } private function onEventFX(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_ON: Global.soundManager.setSFXVolume(100); break; case TFEvent.EVENT_OFF: Global.soundManager.setSFXVolume(0); } } private function processGame(param1:Object) : * { if(gamePlay != null) { gamePlay.process(param1); } } public function dispatchGame() : * { try { return stMachine.receiveEvent(EVENT_GO_TO_GAME); } catch(e:Error) { } } private function stopGame() : * { gamePlay = null; } public function onCheatNextLevel() : * { var _loc1_:Number = NaN; var _loc2_:Number = NaN; Global.soundTrackStage1.stop(); Global.soundTrackStage2.stop(); Global.soundTrackStage3.stop(); Global.soundTrackStage4.stop(); Global.cash = Levels.stages.stage[Levels.indexStage].levels.level[Levels.indexLevel].goal; _loc1_ = 300 - int(gamePlay.getTime() / 1000); if(_loc1_ < 0) { _loc1_ = 0; } if(Global.cash == 0) { _loc1_ = 0; } _loc2_ = Global.cash * 10 + _loc1_ * 10; Global.score += _loc2_; nextLevel(); } private function stopGameOver() : * { delete buttons["moregames"]; buttons["moregames"] = undefined; delete buttons["submit"]; buttons["submit"] = undefined; } public function dispatchProgressScreen() : * { try { return stMachine.receiveEvent(EVENT_GO_TO_PROGRESS_SCREEN); } catch(e:Error) { } } private function stopProgressScreen() : * { delete buttons["play"]; buttons["play"] = undefined; delete buttons["fx"]; buttons["fx"] = undefined; delete buttons["music"]; buttons["music"] = undefined; Global.soundTrackMenu.stop(); this.progressMainChar = null; } private function onEventSubmitVictory(param1:TFEvent) : * { var _loc2_:Object = null; switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: if(stage.mcPainel.mcName.length) { _loc2_ = new Object(); _loc2_.name = stage.mcPainel.mcName.text; _loc2_.score = Global.score; Global.cookie.data.highScore.push(_loc2_); Global.cookie.data.highScore.sortOn("score",Array.NUMERIC | Array.DESCENDING); if(Global.cookie.data.highScore.length > 9) { Global.cookie.data.highScore.splice(9,Global.cookie.data.highScore.length - 9); } Global.cookie.flush(); Global.cash = 0; Global.score = 0; dispatchHighScore(); } } } private function onFinishGameLoadFrame() : * { TFMovieClip.addLabelScript(stage,"finishGame",null); Global.main.mcUpgradeView.visible = false; Global.main.mcNewStage.visible = false; stage.stop(); buttons["start"] = new TFTextButton(Global.main.mcUpgradeView.mcStart,Global.xmlLocalization.game.play,onEventStart); buttons["start"].setFxOver(Global.soundsFX["mouse_over"]); buttons["start"].setFxClick(Global.soundsFX["mouse_click"]); Global.main.mcUpgradeView.mcMsgBlink.mcText.text = Global.xmlLocalization.update.msg; Global.main.mcUpgradeView.mcMsg.mcText.text = Global.xmlLocalization.update.msg; if(Levels.indexStage == 0) { Global.main.mcStatue.visible = true; } else { Global.main.mcStatue.visible = false; } if(Levels.indexStage == 1) { Global.main.mcTropicalDeco.visible = true; } else { Global.main.mcTropicalDeco.visible = false; } if(Levels.indexStage == 0 && Levels.indexLevel == 0) { buttons["startStage"] = new TFTextButton(Global.main.mcNewStage.btnPlay,Global.xmlLocalization.game.play,onEventStart); buttons["startStage"].setFxOver(Global.soundsFX["mouse_over"]); buttons["startStage"].setFxClick(Global.soundsFX["mouse_click"]); Global.main.mcNewStage.visible = true; TFMovieClip.setTextBalloon(Global.xmlLocalization.game.msg1,Global.main.mcNewStage); return; } if(Levels.indexStage == 0 && Levels.indexLevel == 1) { Global.main.mcUpgradeView.mcRoom2.visible = false; Global.main.mcUpgradeView.mcRoom3.visible = false; Global.main.mcUpgradeView.mcBath1.visible = false; Global.main.mcUpgradeView.mcBath2.visible = false; Global.main.mcUpgradeView.mcBath3.visible = false; Global.main.mcUpgradeView.mcBath4.visible = false; Global.main.mcUpgradeView.mcTreatment1.visible = false; Global.main.mcUpgradeView.mcTreatment2.visible = false; Global.main.mcUpgradeView.mcTreatment3.visible = false; Global.main.mcUpgradeView.mcTreatment4.visible = false; Global.main.mcUpgradeView.gotoAndPlay("anima"); Global.main.mcUpgradeView.visible = true; return; } if(Levels.indexStage == 0 && Levels.indexLevel == 3) { Global.main.mcUpgradeView.mcRoom1.visible = false; Global.main.mcUpgradeView.mcRoom2.visible = false; Global.main.mcUpgradeView.mcRoom3.visible = false; Global.main.mcUpgradeView.mcBath1.visible = false; Global.main.mcUpgradeView.mcBath3.visible = false; Global.main.mcUpgradeView.mcBath4.visible = false; Global.main.mcUpgradeView.mcTreatment1.visible = false; Global.main.mcUpgradeView.mcTreatment2.visible = false; Global.main.mcUpgradeView.mcTreatment3.visible = false; Global.main.mcUpgradeView.mcTreatment4.visible = false; Global.main.mcUpgradeView.gotoAndPlay("anima"); Global.main.mcUpgradeView.visible = true; return; } if(Levels.indexStage == 0 && Levels.indexLevel == 5) { Global.main.mcUpgradeView.mcRoom1.visible = false; Global.main.mcUpgradeView.mcRoom2.visible = false; Global.main.mcUpgradeView.mcRoom3.visible = false; Global.main.mcUpgradeView.mcBath1.visible = false; Global.main.mcUpgradeView.mcBath2.visible = false; Global.main.mcUpgradeView.mcBath3.visible = false; Global.main.mcUpgradeView.mcBath4.visible = false; Global.main.mcUpgradeView.mcTreatment1.visible = false; Global.main.mcUpgradeView.mcTreatment3.visible = false; Global.main.mcUpgradeView.mcTreatment4.visible = false; Global.main.mcUpgradeView.gotoAndPlay("anima"); Global.main.mcUpgradeView.visible = true; return; } if(Levels.indexStage == 1 && Levels.indexLevel == 0) { buttons["startStage"] = new TFTextButton(Global.main.mcNewStage.btnPlay,Global.xmlLocalization.game.play,onEventStart); buttons["startStage"].setFxOver(Global.soundsFX["mouse_over"]); buttons["startStage"].setFxClick(Global.soundsFX["mouse_click"]); Global.main.mcNewStage.visible = true; TFMovieClip.setTextBalloon(Global.xmlLocalization.game.msg2,Global.main.mcNewStage); return; } if(Levels.indexStage == 1 && Levels.indexLevel == 2) { Global.main.mcUpgradeView.mcRoom1.visible = false; Global.main.mcUpgradeView.mcRoom3.visible = false; Global.main.mcUpgradeView.mcBath1.visible = false; Global.main.mcUpgradeView.mcBath2.visible = false; Global.main.mcUpgradeView.mcBath3.visible = false; Global.main.mcUpgradeView.mcBath4.visible = false; Global.main.mcUpgradeView.mcTreatment1.visible = false; Global.main.mcUpgradeView.mcTreatment2.visible = false; Global.main.mcUpgradeView.mcTreatment3.visible = false; Global.main.mcUpgradeView.mcTreatment4.visible = false; Global.main.mcUpgradeView.gotoAndPlay("anima"); Global.main.mcUpgradeView.visible = true; return; } if(Levels.indexStage == 1 && Levels.indexLevel == 5) { Global.main.mcUpgradeView.mcRoom1.visible = false; Global.main.mcUpgradeView.mcRoom2.visible = false; Global.main.mcUpgradeView.mcRoom3.visible = false; Global.main.mcUpgradeView.mcBath1.visible = false; Global.main.mcUpgradeView.mcBath2.visible = false; Global.main.mcUpgradeView.mcBath4.visible = false; Global.main.mcUpgradeView.mcTreatment1.visible = false; Global.main.mcUpgradeView.mcTreatment2.visible = false; Global.main.mcUpgradeView.mcTreatment3.visible = false; Global.main.mcUpgradeView.mcTreatment4.visible = false; Global.main.mcUpgradeView.gotoAndPlay("anima"); Global.main.mcUpgradeView.visible = true; return; } if(Levels.indexStage == 2 && Levels.indexLevel == 0) { buttons["startStage"] = new TFTextButton(Global.main.mcNewStage.btnPlay,Global.xmlLocalization.game.play,onEventStart); buttons["startStage"].setFxOver(Global.soundsFX["mouse_over"]); buttons["startStage"].setFxClick(Global.soundsFX["mouse_click"]); Global.main.mcNewStage.visible = true; TFMovieClip.setTextBalloon(Global.xmlLocalization.game.msg3,Global.main.mcNewStage); return; } if(Levels.indexStage == 2 && Levels.indexLevel == 2) { Global.main.mcUpgradeView.mcRoom1.visible = false; Global.main.mcUpgradeView.mcRoom2.visible = false; Global.main.mcUpgradeView.mcRoom3.visible = false; Global.main.mcUpgradeView.mcBath1.visible = false; Global.main.mcUpgradeView.mcBath2.visible = false; Global.main.mcUpgradeView.mcBath3.visible = false; Global.main.mcUpgradeView.mcBath4.visible = false; Global.main.mcUpgradeView.mcTreatment1.visible = false; Global.main.mcUpgradeView.mcTreatment2.visible = false; Global.main.mcUpgradeView.mcTreatment4.visible = false; Global.main.mcUpgradeView.gotoAndPlay("anima"); Global.main.mcUpgradeView.visible = true; return; } if(Levels.indexStage == 2 && Levels.indexLevel == 5) { Global.main.mcUpgradeView.mcRoom1.visible = false; Global.main.mcUpgradeView.mcRoom2.visible = false; Global.main.mcUpgradeView.mcRoom3.visible = false; Global.main.mcUpgradeView.mcBath1.visible = false; Global.main.mcUpgradeView.mcBath2.visible = false; Global.main.mcUpgradeView.mcBath3.visible = false; Global.main.mcUpgradeView.mcTreatment1.visible = false; Global.main.mcUpgradeView.mcTreatment2.visible = false; Global.main.mcUpgradeView.mcTreatment3.visible = false; Global.main.mcUpgradeView.mcTreatment4.visible = false; Global.main.mcUpgradeView.gotoAndPlay("anima"); Global.main.mcUpgradeView.visible = true; return; } if(Levels.indexStage == 3 && Levels.indexLevel == 0) { buttons["startStage"] = new TFTextButton(Global.main.mcNewStage.btnPlay,Global.xmlLocalization.game.play,onEventStart); buttons["startStage"].setFxOver(Global.soundsFX["mouse_over"]); buttons["startStage"].setFxClick(Global.soundsFX["mouse_click"]); Global.main.mcNewStage.visible = true; TFMovieClip.setTextBalloon(Global.xmlLocalization.game.msg4,Global.main.mcNewStage); return; } if(Levels.indexStage == 3 && Levels.indexLevel == 2) { Global.main.mcUpgradeView.mcRoom1.visible = false; Global.main.mcUpgradeView.mcRoom2.visible = false; Global.main.mcUpgradeView.mcBath1.visible = false; Global.main.mcUpgradeView.mcBath2.visible = false; Global.main.mcUpgradeView.mcBath3.visible = false; Global.main.mcUpgradeView.mcBath4.visible = false; Global.main.mcUpgradeView.mcTreatment1.visible = false; Global.main.mcUpgradeView.mcTreatment2.visible = false; Global.main.mcUpgradeView.mcTreatment3.visible = false; Global.main.mcUpgradeView.mcTreatment4.visible = false; Global.main.mcUpgradeView.gotoAndPlay("anima"); Global.main.mcUpgradeView.visible = true; return; } if(Levels.indexStage == 3 && Levels.indexLevel == 5) { Global.main.mcUpgradeView.mcRoom1.visible = false; Global.main.mcUpgradeView.mcRoom2.visible = false; Global.main.mcUpgradeView.mcRoom3.visible = false; Global.main.mcUpgradeView.mcBath1.visible = false; Global.main.mcUpgradeView.mcBath2.visible = false; Global.main.mcUpgradeView.mcBath3.visible = false; Global.main.mcUpgradeView.mcBath4.visible = false; Global.main.mcUpgradeView.mcTreatment1.visible = false; Global.main.mcUpgradeView.mcTreatment2.visible = false; Global.main.mcUpgradeView.mcTreatment3.visible = false; Global.main.mcUpgradeView.gotoAndPlay("anima"); Global.main.mcUpgradeView.visible = true; return; } gamePlay.start(); buttons["pause"].enable(); } private function onHowToPlayPage2LoadFrame() : * { TFMovieClip.addLabelScript(stage,"page2",null); stage.stop(); stage.mcText3.text = Global.xmlLocalization.howToPlay.text3; stage.mcText4.text = Global.xmlLocalization.howToPlay.text4; stage.mcLogo.gotoAndStop(Global.localization_branding_nr); stage.mcLogo.mcHitArea.addEventListener(MouseEvent.CLICK,onMCClick,false,0,true); buttons["button1"].setText(Global.xmlLocalization.howToPlay.back); buttons["button2"].setText(Global.xmlLocalization.howToPlay.next); } private function onEventStart(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: Global.main.mcUpgradeView.visible = false; Global.main.mcNewStage.visible = false; buttons["pause"].enable(); gamePlay.start(); } } private function onEventMusicGame(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSEUP: if(Global.mouse.getLastLocal() != null) { Global.mouse.getLastLocal().addCustomer(Global.mouse.removeCustomer()); } break; case TFEvent.EVENT_ON: Global.soundManager.setMusicVolume(50); break; case TFEvent.EVENT_OFF: Global.soundManager.setMusicVolume(0); } } private function stopHighScore() : * { delete buttons["moregames"]; buttons["moregames"] = undefined; delete buttons["mainmenu"]; buttons["mainmenu"] = undefined; } private function onInitHowToPlayLoadFrame() : * { TFMovieClip.addLabelScript(stage,"initNowToPlay",null); stage.mcText1.text = Global.xmlLocalization.howToPlay.text1; stage.mcText2.text = Global.xmlLocalization.howToPlay.text2; stage.mcLogo.gotoAndStop(Global.localization_branding_nr); stage.mcLogo.mcHitArea.addEventListener(MouseEvent.CLICK,onMCClick,false,0,true); } private function stopVictory() : * { delete buttons["moregames"]; buttons["moregames"] = undefined; delete buttons["submit"]; buttons["submit"] = undefined; Global.soundVictory.stop(); } private function onEventMoreGames(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: TFURLNavigator.changePage(Global.localization_url1,"_blank"); break; case TFEvent.EVENT_INIT: case TFEvent.EVENT_MOUSEOUT: case TFEvent.EVENT_MOUSEOVER: } } private function onVictoryLoadFrame() : * { TFMovieClip.addLabelScript(this.stage,"victory",null); TFMovieClip.addLabelScript(this.stage,"buttons",onButtonsVictoryLoadFrame); stage.mcTitle.mcText.text = Global.xmlLocalization.victory.title; stage.mcTitleBlink.mcText.text = Global.xmlLocalization.victory.title; Global.soundVictory.play(); } private function onHighScoreLoadFrame() : * { var _loc1_:Number = NaN; TFMovieClip.addLabelScript(stage,"highscore",null); stage.mcRank.text = Global.xmlLocalization.highscore.rank; stage.mcName.text = Global.xmlLocalization.highscore.name; stage.mcScore.text = Global.xmlLocalization.highscore.score; stage.mcTitle.mcText.text = Global.xmlLocalization.highscore.title; stage.mcTitleBlink.mcText.text = Global.xmlLocalization.highscore.title; buttons["moregames"] = new TFTextButton(stage.mcMore,Global.xmlLocalization.highscore.moregames,onEventMoreGames); buttons["moregames"].setFxOver(Global.soundsFX["mouse_over"]); buttons["moregames"].setFxClick(Global.soundsFX["mouse_click"]); buttons["mainmenu"] = new TFTextButton(stage.mcMenu,Global.xmlLocalization.highscore.menu,onEventMainMenu); buttons["mainmenu"].setFxOver(Global.soundsFX["mouse_over"]); buttons["mainmenu"].setFxClick(Global.soundsFX["mouse_click"]); _loc1_ = 0; while(true) { if(_loc1_ < Global.cookie.data.highScore.length) { if(_loc1_ > 9) { break; } switch(_loc1_) { case 0: stage.mcName1.text = Global.cookie.data.highScore[_loc1_].name; stage.mcScore1.text = Global.cookie.data.highScore[_loc1_].score; break; case 1: stage.mcName2.text = Global.cookie.data.highScore[_loc1_].name; stage.mcScore2.text = Global.cookie.data.highScore[_loc1_].score; break; case 2: stage.mcName3.text = Global.cookie.data.highScore[_loc1_].name; stage.mcScore3.text = Global.cookie.data.highScore[_loc1_].score; break; case 3: stage.mcName4.text = Global.cookie.data.highScore[_loc1_].name; stage.mcScore4.text = Global.cookie.data.highScore[_loc1_].score; break; case 4: stage.mcName5.text = Global.cookie.data.highScore[_loc1_].name; stage.mcScore5.text = Global.cookie.data.highScore[_loc1_].score; break; case 5: stage.mcName6.text = Global.cookie.data.highScore[_loc1_].name; stage.mcScore6.text = Global.cookie.data.highScore[_loc1_].score; break; case 6: stage.mcName7.text = Global.cookie.data.highScore[_loc1_].name; stage.mcScore7.text = Global.cookie.data.highScore[_loc1_].score; break; case 7: stage.mcName8.text = Global.cookie.data.highScore[_loc1_].name; stage.mcScore8.text = Global.cookie.data.highScore[_loc1_].score; break; case 8: stage.mcName9.text = Global.cookie.data.highScore[_loc1_].name; stage.mcScore9.text = Global.cookie.data.highScore[_loc1_].score; break; } } break; _loc1_++; } } private function onMainMenuLoadFrame() : * { TFMovieClip.addLabelScript(stage,"menu",null); stage.stop(); stage.mcLogo.gotoAndStop(Global.localization_branding_nr); stage.mcLogo.mcHitArea.addEventListener(MouseEvent.CLICK,onMCClick,false,0,true); buttons["startgame"] = new TFTextButton(stage.btnStartGame,Global.xmlLocalization.mainmenu.startgame,onEventStartGame); buttons["startgame"].setFxOver(Global.soundsFX["mouse_over"]); buttons["startgame"].setFxClick(Global.soundsFX["mouse_click"]); buttons["howtoplay"] = new TFTextButton(stage.btnHowToPlay,Global.xmlLocalization.mainmenu.howtoplay,onEventHowToPlay); buttons["howtoplay"].setFxOver(Global.soundsFX["mouse_over"]); buttons["howtoplay"].setFxClick(Global.soundsFX["mouse_click"]); buttons["highscore"] = new TFTextButton(stage.btnHighScore,Global.xmlLocalization.mainmenu.highscore,onEventHighScore); buttons["highscore"].setFxOver(Global.soundsFX["mouse_over"]); buttons["highscore"].setFxClick(Global.soundsFX["mouse_click"]); buttons["moregames"] = new TFTextButton(stage.btnMoreGames,Global.xmlLocalization.mainmenu.moregames,onEventMoreGames); buttons["moregames"].setFxOver(Global.soundsFX["mouse_over"]); buttons["moregames"].setFxClick(Global.soundsFX["mouse_click"]); buttons["quality"] = new TFTextButton(stage.btnQuality,Global.xmlLocalization.mainmenu.quality + " " + Global.xmlLocalization.mainmenu.child(Global.main.stage.quality.toLowerCase())[0].toString(),onEventQuality); buttons["quality"].setFxOver(Global.soundsFX["mouse_over"]); buttons["quality"].setFxClick(Global.soundsFX["mouse_click"]); buttons["fx"] = new TFSwitchButton(stage.btnFX,onEventFX); buttons["fx"].setFxOver(Global.soundsFX["mouse_over"]); buttons["fx"].setFxClick(Global.soundsFX["mouse_click"]); buttons["music"] = new TFSwitchButton(stage.btnMusic,onEventMusic); buttons["music"].setFxOver(Global.soundsFX["mouse_over"]); buttons["music"].setFxClick(Global.soundsFX["mouse_click"]); if(Global.soundManager.getSFXVolume() == 0) { buttons["fx"].off(); } if(Global.soundManager.getMusicVolume() == 0) { buttons["music"].off(); } buttons.length = 6; if(stopSound) { Global.soundTrackMenu.play(); } stopSound = true; } public function dispatchVictory() : * { try { return stMachine.receiveEvent(EVENT_GO_TO_VICTORY); } catch(e:Error) { } } private function onEventStartGame(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: dispatchProgressScreen(); break; case TFEvent.EVENT_INIT: case TFEvent.EVENT_MOUSEOUT: case TFEvent.EVENT_MOUSEOVER: } } private function startMainMenu() : * { stage.gotoAndPlay("menu"); TFMovieClip.addLabelScript(this.stage,"menu",onMainMenuLoadFrame); } private function onEventPause(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: buttons["pause"].on(); break; case TFEvent.EVENT_MOUSEUP: if(Global.mouse.getLastLocal() != null) { Global.mouse.getLastLocal().addCustomer(Global.mouse.removeCustomer()); } break; case TFEvent.EVENT_ON: case TFEvent.EVENT_OFF: gamePlay.pause(); stage.mcDialogPause.visible = !stage.mcDialogPause.visible; } } private function processProgress(param1:Object) : * { if(progressMainChar != null) { progressMainChar.processWalking(param1); } } public function dispatchHighScore() : * { stopSound = false; try { return stMachine.receiveEvent(EVENT_GO_TO_HIGH_SCORE); } catch(e:Error) { } } private function onEventFXGame(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSEUP: if(Global.mouse.getLastLocal() != null) { Global.mouse.getLastLocal().addCustomer(Global.mouse.removeCustomer()); } break; case TFEvent.EVENT_ON: Global.soundManager.setSFXVolume(100); break; case TFEvent.EVENT_OFF: Global.soundManager.setSFXVolume(0); } } private function onGameOverLoadFrame() : * { TFMovieClip.addLabelScript(stage,"gameOver",null); stage.mcLogo.gotoAndStop(Global.localization_branding_nr); stage.mcLogo.mcHitArea.addEventListener(MouseEvent.CLICK,onMCClick,false,0,true); stage.mcTitle.mcText.text = Global.xmlLocalization.gameOver.title; stage.mcTitleBlink.mcText.text = Global.xmlLocalization.gameOver.title; stage.mcTextScore.text = Global.xmlLocalization.gameOver.score; stage.mcName.text = Global.xmlLocalization.sarah; stage.mcTextName.text = Global.xmlLocalization.gameOver.name; stage.mcScore.text = Global.score.toString(); buttons["moregames"] = new TFTextButton(stage.mcBtnMore,Global.xmlLocalization.mainmenu.moregames,onEventMoreGames); buttons["moregames"].setFxOver(Global.soundsFX["mouse_over"]); buttons["moregames"].setFxClick(Global.soundsFX["mouse_click"]); buttons["submit"] = new TFTextButton(stage.mcBtnSubmit,Global.xmlLocalization.gameOver.submit,onEventSubmit); buttons["submit"].setFxOver(Global.soundsFX["mouse_over"]); buttons["submit"].setFxClick(Global.soundsFX["mouse_click"]); } private function onHowToPlayPage3LoadFrame() : * { TFMovieClip.addLabelScript(stage,"page3",null); stage.stop(); stage.mcText5.text = Global.xmlLocalization.howToPlay.text5; stage.mcText6.text = Global.xmlLocalization.howToPlay.text6; stage.mcText7.text = Global.xmlLocalization.howToPlay.text7; stage.mcLogo.gotoAndStop(Global.localization_branding_nr); stage.mcLogo.mcHitArea.addEventListener(MouseEvent.CLICK,onMCClick,false,0,true); buttons["button1"].setText(Global.xmlLocalization.howToPlay.back); buttons["button2"].setText(Global.xmlLocalization.howToPlay.mainmenu); } private function onEventButton1(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: switch(stage.currentFrame) { case 102: dispatchMainMenu(); break; case 103: stage.gotoAndStop("page1"); TFMovieClip.addLabelScript(stage,"page1",onHowToPlayPage1LoadFrame); break; case 104: stage.gotoAndStop("page2"); TFMovieClip.addLabelScript(stage,"page2",onHowToPlayPage2LoadFrame); } } } private function onEventButton2(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: switch(stage.currentFrame) { case 102: stage.gotoAndStop("page2"); TFMovieClip.addLabelScript(stage,"page2",onHowToPlayPage2LoadFrame); break; case 103: stage.gotoAndStop("page3"); TFMovieClip.addLabelScript(stage,"page3",onHowToPlayPage3LoadFrame); break; case 104: dispatchMainMenu(); } } } private function startHighScore() : * { stage.gotoAndPlay("highscore"); TFMovieClip.addLabelScript(stage,"highscore",onHighScoreLoadFrame); } private function startVictory() : * { stage.gotoAndPlay("victory"); TFMovieClip.addLabelScript(this.stage,"victory",onVictoryLoadFrame); } public function nextLevel() : * { var _loc1_:Class = null; var _loc2_:BitmapData = null; if(Global.cash >= Levels.stages.stage[Levels.indexStage].levels.level[Levels.indexLevel].goal) { ++Levels.indexLevel; Global.cookie.data.currentLevel = Levels.indexLevel; Global.cookie.data.currentStage = Levels.indexStage; Global.cookie.data.currentScore = Global.score; Global.cookie.flush(); if(Levels.indexLevel >= Levels.stages.stage[Levels.indexStage].levels.level.length()) { Levels.indexLevel = 0; ++Levels.indexStage; Global.cookie.data.currentLevel = 0; Global.cookie.data.currentStage = 0; Global.cookie.flush(); if(Levels.indexStage >= Levels.stages.stage.length()) { Global.cookie.data.currentLevel = 0; Global.cookie.data.currentStage = 0; Global.cookie.data.currentScore = 0; Global.cookie.flush(); Levels.indexLevel = 0; Levels.indexStage = 0; scenary = null; dispatchVictory(); return; } _loc1_ = Global.main.getAsset(Levels.stages.stage[Levels.indexStage].scenary); _loc2_ = new _loc1_(600,450); scenary = new Bitmap(_loc2_); Global.main.mcBackground.addChild(scenary); } } else { --Global.life; } if(Global.life <= 0) { Global.cookie.data.currentLevel = 0; Global.cookie.data.currentStage = 0; Global.cookie.data.currentScore = 0; Global.cookie.flush(); Levels.indexLevel = 0; Levels.indexStage = 0; dispatchGameOver(); } else { dispatchProgressScreen(); } } public function dispatchMainMenu() : * { try { return stMachine.receiveEvent(EVENT_GO_TO_MENU); } catch(e:Error) { } } private function onMCClick(param1:MouseEvent) : void { TFURLNavigator.changePage(Global.localization_url1,"_blank"); } private function onEventHighScore(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: dispatchHighScore(); break; case TFEvent.EVENT_INIT: case TFEvent.EVENT_MOUSEOUT: case TFEvent.EVENT_MOUSEOVER: } } private function onEventPlay(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: dispatchGame(); } } private function onGameLoadFrame() : * { var _loc1_:Class = null; var _loc2_:BitmapData = null; var _loc3_:Number = NaN; stage.mcDialogDummy.enabled = false; stage.mcDialogDummy.mouseEnabled = false; stage.mcGoalReached.visible = false; stage.mcGoalReached.enabled = false; stage.mcGoalReached.mouseEnabled = false; stage.mcGoalReached.mcGoal.enabled = false; stage.mcGoalReached.mcGoal.mouseEnabled = false; stage.mcGoalReached.mcGoalBlink.enabled = false; stage.mcGoalReached.mcGoalBlink.mouseEnabled = false; stage.mcDialogPause.enabled = false; stage.mcDialogPause.mouseEnabled = false; stage.mcDialogPause.visible = false; stage.mcDialogPause.mcText.text = Global.xmlLocalization.pause.msg; buttons["continue"] = new TFTextButton(stage.mcDialogPause.btnContinue,Global.xmlLocalization.pause.msgContinue,onEventPause); buttons["continue"].setFxOver(Global.soundsFX["mouse_over"]); buttons["continue"].setFxClick(Global.soundsFX["mouse_click"]); buttons["continue"].setVertAlign(5,57); stage.mcLogo.gotoAndStop(Global.localization_branding_nr); stage.mcLogo.mcHitArea.addEventListener(MouseEvent.CLICK,onMCClick,false,0,true); if(scenary == null) { _loc1_ = Global.main.getAsset(Levels.stages.stage[Levels.indexStage].scenary); _loc2_ = new _loc1_(600,450); scenary = new Bitmap(_loc2_); } Global.main.mcBackground.addChild(scenary); if(gamePlay == null) { _loc3_ = Number(Levels.stages.stage[Levels.indexStage].levels.level[Levels.indexLevel].maxTimeCustomer) - Number(Levels.stages.stage[Levels.indexStage].levels.level[Levels.indexLevel].minTimeCustomer); _loc3_ *= 1000; _loc3_ *= Math.random(); _loc3_ += Number(Levels.stages.stage[Levels.indexStage].levels.level[Levels.indexLevel].minTimeCustomer * 1000); _loc3_ = Math.round(_loc3_); gamePlay = new ManagerGamePlay(Levels.stages.stage[Levels.indexStage].levels.level[Levels.indexLevel].simultaneousClients,_loc3_,Levels.stages.stage[Levels.indexStage].levels.level[Levels.indexLevel].numberCustomer); } TFMovieClip.addLabelScript(stage,"game",null); TFMovieClip.addLabelScript(stage,"finishGame",onFinishGameLoadFrame); buttons["fx"] = new TFSwitchButton(stage.btnFX,onEventFXGame); buttons["fx"].setFxOver(Global.soundsFX["mouse_over"]); buttons["fx"].setFxClick(Global.soundsFX["mouse_click"]); buttons["music"] = new TFSwitchButton(stage.btnMusic,onEventMusicGame); buttons["music"].setFxOver(Global.soundsFX["mouse_over"]); buttons["music"].setFxClick(Global.soundsFX["mouse_click"]); if(Global.soundManager.getSFXVolume() == 0) { buttons["fx"].off(); } if(Global.soundManager.getMusicVolume() == 0) { buttons["music"].off(); } buttons["pause"] = new TFSwitchButton(stage.btnPause,onEventPause); buttons["pause"].setFxOver(Global.soundsFX["mouse_over"]); buttons["pause"].setFxClick(Global.soundsFX["mouse_click"]); buttons["pause"].disable(); buttons["background"] = new TFButton(stage.mcBackground,onEventBackground); } private function onProgressLoadFrame() : * { var _loc1_:Number = NaN; TFMovieClip.addLabelScript(stage,"progress",null); buttons["play"] = new TFTextButton(stage.btnPlay,Global.xmlLocalization.progress.play,onEventPlay); buttons["play"].setFxOver(Global.soundsFX["mouse_over"]); buttons["play"].setFxClick(Global.soundsFX["mouse_click"]); buttons["fx"] = new TFSwitchButton(stage.btnProgressFX,onEventFX); buttons["fx"].setFxOver(Global.soundsFX["mouse_over"]); buttons["fx"].setFxClick(Global.soundsFX["mouse_click"]); if(Global.soundManager.getSFXVolume() == 0) { buttons["fx"].off(); } buttons["music"] = new TFSwitchButton(stage.btnProgressMusic,onEventMusic); buttons["music"].setFxOver(Global.soundsFX["mouse_over"]); buttons["music"].setFxClick(Global.soundsFX["mouse_click"]); if(Global.soundManager.getMusicVolume() == 0) { buttons["music"].off(); } Global.main.txtLife.text = "x" + Global.life; Global.main.mcTextCash.text = Global.xmlLocalization.progress.score; Global.main.mcCash.text = String(Global.score); Global.main.mcSpa2.visible = false; Global.main.mcSpa3.visible = false; Global.main.mcSpa4.visible = false; Global.soundTrackMenu.play(); this.progressMainChar = new ProgressMainChar(); switch(Levels.indexStage) { case 3: switch(Levels.indexLevel) { case 0: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE3_PATHNODE); this.progressMainChar.goto(ProgressMainChar.STAGE4_PATHNODE); Global.main.mcMark41.gotoAndStop("current"); break; case 1: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE4_PATHNODE); this.progressMainChar.action(); Global.main.mcMark42.gotoAndStop("current"); break; case 2: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE4_PATHNODE); this.progressMainChar.action(); Global.main.mcMark43.gotoAndStop("current"); break; case 3: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE4_PATHNODE); this.progressMainChar.action(); Global.main.mcMark44.gotoAndStop("current"); break; case 4: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE4_PATHNODE); this.progressMainChar.action(); Global.main.mcMark45.gotoAndStop("current"); break; case 5: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE4_PATHNODE); this.progressMainChar.action(); Global.main.mcMark46.gotoAndStop("current"); break; case 6: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE4_PATHNODE); this.progressMainChar.action(); Global.main.mcMark47.gotoAndStop("current"); } break; case 2: switch(Levels.indexLevel) { case 0: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE2_PATHNODE); this.progressMainChar.goto(ProgressMainChar.STAGE3_PATHNODE); Global.main.mcMark31.gotoAndStop("current"); break; case 1: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE3_PATHNODE); this.progressMainChar.action(); Global.main.mcMark32.gotoAndStop("current"); break; case 2: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE3_PATHNODE); this.progressMainChar.action(); Global.main.mcMark33.gotoAndStop("current"); break; case 3: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE3_PATHNODE); this.progressMainChar.action(); Global.main.mcMark34.gotoAndStop("current"); break; case 4: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE3_PATHNODE); this.progressMainChar.action(); Global.main.mcMark35.gotoAndStop("current"); break; case 5: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE3_PATHNODE); this.progressMainChar.action(); Global.main.mcMark36.gotoAndStop("current"); break; case 6: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE3_PATHNODE); this.progressMainChar.action(); Global.main.mcMark37.gotoAndStop("current"); } break; case 1: switch(Levels.indexLevel) { case 0: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE1_PATHNODE); this.progressMainChar.goto(ProgressMainChar.STAGE2_PATHNODE); Global.main.mcMark21.gotoAndStop("current"); break; case 1: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE2_PATHNODE); this.progressMainChar.action(); Global.main.mcMark22.gotoAndStop("current"); break; case 2: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE2_PATHNODE); this.progressMainChar.action(); Global.main.mcMark23.gotoAndStop("current"); break; case 3: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE2_PATHNODE); this.progressMainChar.action(); Global.main.mcMark24.gotoAndStop("current"); break; case 4: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE2_PATHNODE); this.progressMainChar.action(); Global.main.mcMark25.gotoAndStop("current"); break; case 5: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE2_PATHNODE); this.progressMainChar.action(); Global.main.mcMark26.gotoAndStop("current"); break; case 6: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE2_PATHNODE); this.progressMainChar.action(); Global.main.mcMark27.gotoAndStop("current"); } break; case 0: this.progressMainChar.setCurrentNode(ProgressMainChar.STAGE1_PATHNODE); this.progressMainChar.action(); switch(Levels.indexLevel) { case 0: Global.main.mcMark11.gotoAndStop("current"); break; case 1: Global.main.mcMark12.gotoAndStop("current"); break; case 2: Global.main.mcMark13.gotoAndStop("current"); break; case 3: Global.main.mcMark14.gotoAndStop("current"); break; case 4: Global.main.mcMark15.gotoAndStop("current"); break; case 5: Global.main.mcMark16.gotoAndStop("current"); break; case 6: Global.main.mcMark17.gotoAndStop("current"); } } _loc1_ = Levels.indexLevel; switch(Levels.indexStage) { case 3: Global.main.mcSpa4.visible = true; switch(_loc1_) { case 7: Global.main.mcMark47.gotoAndStop("completed"); case 6: Global.main.mcMark46.gotoAndStop("completed"); case 5: Global.main.mcMark45.gotoAndStop("completed"); case 4: Global.main.mcMark44.gotoAndStop("completed"); case 3: Global.main.mcMark43.gotoAndStop("completed"); case 2: Global.main.mcMark42.gotoAndStop("completed"); case 1: Global.main.mcMark41.gotoAndStop("completed"); case 0: _loc1_ = 7; } case 2: Global.main.mcSpa3.visible = true; switch(_loc1_) { case 7: Global.main.mcMark37.gotoAndStop("completed"); case 6: Global.main.mcMark36.gotoAndStop("completed"); case 5: Global.main.mcMark35.gotoAndStop("completed"); case 4: Global.main.mcMark34.gotoAndStop("completed"); case 3: Global.main.mcMark33.gotoAndStop("completed"); case 2: Global.main.mcMark32.gotoAndStop("completed"); case 1: Global.main.mcMark31.gotoAndStop("completed"); case 0: _loc1_ = 7; } case 1: Global.main.mcSpa2.visible = true; switch(_loc1_) { case 7: Global.main.mcMark27.gotoAndStop("completed"); case 6: Global.main.mcMark26.gotoAndStop("completed"); case 5: Global.main.mcMark25.gotoAndStop("completed"); case 4: Global.main.mcMark24.gotoAndStop("completed"); case 3: Global.main.mcMark23.gotoAndStop("completed"); case 2: Global.main.mcMark22.gotoAndStop("completed"); case 1: Global.main.mcMark21.gotoAndStop("completed"); case 0: _loc1_ = 7; } case 0: switch(_loc1_) { case 7: Global.main.mcMark17.gotoAndStop("completed"); case 6: Global.main.mcMark16.gotoAndStop("completed"); case 5: Global.main.mcMark15.gotoAndStop("completed"); case 4: Global.main.mcMark14.gotoAndStop("completed"); case 3: Global.main.mcMark13.gotoAndStop("completed"); case 2: Global.main.mcMark12.gotoAndStop("completed"); case 1: Global.main.mcMark11.gotoAndStop("completed"); case 0: } } } private function stopHowToPlay() : * { delete buttons["button1"]; buttons["button1"] = undefined; delete buttons["button2"]; buttons["button2"] = undefined; } private function stopMainMenu() : * { delete buttons["startgame"]; buttons["startgame"] = undefined; delete buttons["howtoplay"]; buttons["howtoplay"] = undefined; delete buttons["highscore"]; buttons["highscore"] = undefined; delete buttons["freegames"]; buttons["freegames"] = undefined; delete buttons["quality"]; buttons["quality"] = undefined; delete buttons["fx"]; buttons["fx"] = undefined; delete buttons["music"]; buttons["music"] = undefined; if(stopSound) { Global.soundTrackMenu.stop(); } } private function onEventMainMenu(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: dispatchMainMenu(); } } public function dispatchHowToPlay() : * { stopSound = false; try { return stMachine.receiveEvent(EVENT_GO_TO_HOW_TO_PLAY); } catch(e:Error) { } } private function onHowToPlayLoadFrame() : * { TFMovieClip.addLabelScript(stage,"howToPlay",null); stage.mcTitle.mcText.text = Global.xmlLocalization.howToPlay.title; stage.mcTitleBlink.mcText.text = Global.xmlLocalization.howToPlay.title; } private function startGameOver() : * { stage.gotoAndPlay("gameOver"); TFMovieClip.addLabelScript(stage,"gameOver",onGameOverLoadFrame); } private function onEventMusic(param1:TFEvent) : * { switch(param1.event) { case TFEvent.EVENT_ON: Global.soundManager.setMusicVolume(50); break; case TFEvent.EVENT_OFF: Global.soundManager.setMusicVolume(0); } } public function process(param1:Object) : * { stMachine.process(param1); } private function onEventSubmit(param1:TFEvent) : * { var _loc2_:Object = null; switch(param1.event) { case TFEvent.EVENT_MOUSECLICK: if(stage.mcName.length) { _loc2_ = new Object(); _loc2_.name = stage.mcName.text; _loc2_.score = Global.score; Global.cookie.data.highScore.push(_loc2_); Global.cookie.data.highScore.sortOn("score",Array.NUMERIC | Array.DESCENDING); if(Global.cookie.data.highScore.length > 9) { Global.cookie.data.highScore.splice(9,Global.cookie.data.highScore.length - 8); } Global.cookie.flush(); Global.cash = 0; Global.score = 0; dispatchHighScore(); } } } private function startGame() : * { stage.gotoAndPlay("game"); TFMovieClip.addLabelScript(stage,"game",onGameLoadFrame); } private function onButtonsVictoryLoadFrame() : * { TFMovieClip.addLabelScript(this.stage,"buttons",null); stage.mcPainel.mcLogo.gotoAndStop(Global.localization_branding_nr); stage.mcPainel.mcLogo.mcHitArea.addEventListener(MouseEvent.CLICK,onMCClick,false,0,true); stage.mcPainel.mcTextScore.text = Global.xmlLocalization.victory.score; stage.mcPainel.mcName.text = Global.xmlLocalization.sarah; stage.mcPainel.mcTextName.text = Global.xmlLocalization.victory.name; stage.mcPainel.mcScore.text = Global.score.toString(); buttons["moregames"] = new TFTextButton(stage.mcPainel.mcMore,Global.xmlLocalization.mainmenu.moregames,onEventMoreGames); buttons["moregames"].setFxOver(Global.soundsFX["mouse_over"]); buttons["moregames"].setFxClick(Global.soundsFX["mouse_click"]); buttons["submit"] = new TFTextButton(stage.mcPainel.mcSubimit,Global.xmlLocalization.gameOver.submit,onEventSubmitVictory); buttons["submit"].setFxOver(Global.soundsFX["mouse_over"]); buttons["submit"].setFxClick(Global.soundsFX["mouse_click"]); } private function startProgressScreen() : * { stage.gotoAndStop("progress"); TFMovieClip.addLabelScript(stage,"progress",onProgressLoadFrame); } private function startHowToPlay() : * { stage.gotoAndPlay("howToPlay"); TFMovieClip.addLabelScript(stage,"howToPlay",onHowToPlayLoadFrame); TFMovieClip.addLabelScript(stage,"initHowToPlay",onInitHowToPlayLoadFrame); TFMovieClip.addLabelScript(stage,"page1",onHowToPlayPage1LoadFrame); } } }