home *** CD-ROM | disk | FTP | other *** search
- class CNavigationStateManager
- {
- var AppState;
- var mcRoot;
- var modalscreen;
- var mcsIntro;
- var mcsMenu;
- var mcsNewGame;
- var mcsContinueGame1;
- var mcsContinueGame2;
- var mcsPreGame;
- var mcsGame;
- var mcsResult;
- var mcsGameOver;
- var mcsOptions;
- var mcsHighScore;
- var mcsCredits;
- var mcsHelp;
- var mcsDialog;
- var mcsPreloader;
- static var AS_IDLE = 0;
- static var AS_INTRO = 1;
- static var AS_MENU = 2;
- static var AS_NEWGAME = 3;
- static var AS_CONTINUEGAME1 = 4;
- static var AS_CONTINUEGAME2 = 5;
- static var AS_PREGAME = 6;
- static var AS_GAME = 7;
- static var AS_RESULT = 8;
- static var AS_OPTIONS = 9;
- static var AS_HELP = 10;
- static var AS_HIGHSCORE = 11;
- static var AS_CREDITS = 12;
- static var AS_QUIT = 13;
- static var AS_GAMEOVER = 14;
- static var AS_DIALOG = 15;
- static var AS_PRELOADER = 16;
- function CNavigationStateManager(_mcroot)
- {
- this.AppState = CNavigationStateManager.AS_IDLE;
- this.mcRoot = _mcroot;
- this.modalscreen = 0;
- EventCenter.access().addEventListener("endScreen",this);
- EventCenter.access().addEventListener("menuAccess",this);
- }
- function menuAccess(event)
- {
- var _loc2_ = false;
- if(event.tembus != undefined)
- {
- _loc2_ = true;
- }
- switch(event.name)
- {
- case "AddThisGames":
- getUrl("http://www.net-games.biz/downloads.php", "_blank");
- break;
- case "PlayMoreGames":
- getUrl("http://www.net-games.biz", "_blank");
- break;
- case "StartNewGame":
- SoundManager.ins().playMousedown();
- if(CTournament.ins().tournamentPhase != -1)
- {
- if(!_loc2_)
- {
- this.visibleScreen(false,this.AppState);
- }
- this.changeAppState(CNavigationStateManager.AS_DIALOG);
- return undefined;
- }
- SoundManager.ins().playMousedown();
- this.changeAppState(CNavigationStateManager.AS_NEWGAME);
- break;
- case "ContinueGame1":
- this.changeAppState(CNavigationStateManager.AS_CONTINUEGAME1);
- break;
- case "ContinueGame2":
- this.changeAppState(CNavigationStateManager.AS_CONTINUEGAME2);
- break;
- case "Options":
- SoundManager.ins().playMousedown();
- if(!_loc2_)
- {
- this.visibleScreen(false,this.AppState);
- }
- this.changeAppState(CNavigationStateManager.AS_OPTIONS);
- break;
- case "Help":
- SoundManager.ins().playMousedown();
- if(!_loc2_)
- {
- this.visibleScreen(false,this.AppState);
- }
- this.changeAppState(CNavigationStateManager.AS_HELP);
- break;
- case "HighScore":
- SoundManager.ins().playMousedown();
- if(!_loc2_)
- {
- this.visibleScreen(false,this.AppState);
- }
- this.changeAppState(CNavigationStateManager.AS_HIGHSCORE);
- break;
- case "Credits":
- SoundManager.ins().playMousedown();
- if(!_loc2_)
- {
- this.visibleScreen(false,this.AppState);
- }
- this.changeAppState(CNavigationStateManager.AS_CREDITS);
- break;
- case "Quit":
- SoundManager.ins().playMousedown();
- this.changeAppState(CNavigationStateManager.AS_QUIT);
- break;
- case "Menu":
- SoundManager.ins().playMousedown();
- this.changeAppState(CNavigationStateManager.AS_MENU);
- }
- }
- function endScreen(event)
- {
- switch(event.name)
- {
- case "ScreenIntro":
- this.removeScreen(CNavigationStateManager.AS_INTRO);
- this.changeAppState(CNavigationStateManager.AS_MENU);
- break;
- case "ScreenNewGame":
- SoundManager.ins().playMousedown();
- this.removeScreen(CNavigationStateManager.AS_NEWGAME);
- this.changeAppState(CNavigationStateManager.AS_CONTINUEGAME1);
- break;
- case "ScreenContinueGame1":
- SoundManager.ins().playMousedown();
- this.removeScreen(CNavigationStateManager.AS_CONTINUEGAME1);
- this.removeScreen(CNavigationStateManager.AS_CONTINUEGAME2);
- if(event.tonew)
- {
- this.changeAppState(CNavigationStateManager.AS_NEWGAME);
- }
- else
- {
- this.changeAppState(CNavigationStateManager.AS_PREGAME);
- }
- break;
- case "ScreenContinueGame2":
- SoundManager.ins().playMousedown();
- this.removeScreen(CNavigationStateManager.AS_CONTINUEGAME1);
- this.removeScreen(CNavigationStateManager.AS_CONTINUEGAME2);
- if(event.tonew)
- {
- this.changeAppState(CNavigationStateManager.AS_NEWGAME);
- }
- else
- {
- this.changeAppState(CNavigationStateManager.AS_PREGAME);
- }
- break;
- case "ScreenPreGame":
- SoundManager.ins().playMousedown();
- this.removeScreen(CNavigationStateManager.AS_PREGAME);
- this.removeScreen(CNavigationStateManager.AS_MENU);
- this.changeAppState(CNavigationStateManager.AS_GAME);
- break;
- case "ScreenGame":
- this.removeScreen(CNavigationStateManager.AS_GAME);
- this.changeAppState(CNavigationStateManager.AS_RESULT);
- break;
- case "ScreenResult":
- SoundManager.ins().playMousedown();
- this.removeScreen(CNavigationStateManager.AS_RESULT);
- if(event.round == 1)
- {
- this.changeAppState(CNavigationStateManager.AS_PREGAME);
- }
- else if(CTournament.ins().gameover)
- {
- this.changeAppState(CNavigationStateManager.AS_GAMEOVER);
- }
- else
- {
- this.setScreen(CNavigationStateManager.AS_MENU);
- if(CTournament.ins().tournamentPhase >= 4)
- {
- this.changeAppState(CNavigationStateManager.AS_CONTINUEGAME2);
- }
- else
- {
- this.changeAppState(CNavigationStateManager.AS_CONTINUEGAME1);
- }
- }
- break;
- case "ScreenGameOver":
- SoundManager.ins().playMousedown();
- this.removeScreen(CNavigationStateManager.AS_GAMEOVER);
- this.setScreen(CNavigationStateManager.AS_MENU);
- this.changeAppState(CNavigationStateManager.AS_CONTINUEGAME1);
- break;
- case "ScreenCredits":
- SoundManager.ins().playMousedown();
- this.removeScreen(CNavigationStateManager.AS_CREDITS);
- this.visibleScreen(true,this.AppState);
- this.changeAppState(CNavigationStateManager.AS_MENU);
- break;
- case "ScreenOptions":
- SoundManager.ins().playMousedown();
- this.removeScreen(CNavigationStateManager.AS_OPTIONS);
- this.visibleScreen(true,this.AppState);
- this.changeAppState(CNavigationStateManager.AS_MENU);
- break;
- case "ScreenHighScore":
- SoundManager.ins().playMousedown();
- this.removeScreen(CNavigationStateManager.AS_HIGHSCORE);
- this.visibleScreen(true,this.AppState);
- this.changeAppState(CNavigationStateManager.AS_MENU);
- break;
- case "ScreenHelp":
- SoundManager.ins().playMousedown();
- this.removeScreen(CNavigationStateManager.AS_HELP);
- this.visibleScreen(true,this.AppState);
- this.changeAppState(CNavigationStateManager.AS_MENU);
- break;
- case "ScreenDialog":
- SoundManager.ins().playMousedown();
- this.visibleScreen(true,this.AppState);
- this.removeScreen(CNavigationStateManager.AS_DIALOG);
- if(event.select)
- {
- this.removeScreen(CNavigationStateManager.AS_CONTINUEGAME1);
- this.removeScreen(CNavigationStateManager.AS_CONTINUEGAME2);
- this.removeScreen(CNavigationStateManager.AS_PREGAME);
- CTournament.ins().endTournament();
- this.changeAppState(CNavigationStateManager.AS_NEWGAME);
- }
- else
- {
- this.changeAppState(CNavigationStateManager.AS_MENU);
- }
- break;
- case "ScreenPreloader":
- SoundManager.ins().playMousedown();
- this.removeScreen(CNavigationStateManager.AS_PRELOADER);
- this.changeAppState(CNavigationStateManager.AS_INTRO);
- }
- }
- function removeScreen(screen)
- {
- this.modalscreen = 0;
- switch(screen)
- {
- case CNavigationStateManager.AS_INTRO:
- this.mcsIntro.removeMovieClip();
- SoundManager.ins().playBGM();
- break;
- case CNavigationStateManager.AS_MENU:
- this.mcsMenu.removeMovieClip();
- break;
- case CNavigationStateManager.AS_NEWGAME:
- this.mcsNewGame.removeMovieClip();
- break;
- case CNavigationStateManager.AS_CONTINUEGAME1:
- this.mcsContinueGame1.removeMovieClip();
- this.mcsContinueGame2.removeMovieClip();
- break;
- case CNavigationStateManager.AS_CONTINUEGAME2:
- this.mcsContinueGame1.removeMovieClip();
- this.mcsContinueGame2.removeMovieClip();
- break;
- case CNavigationStateManager.AS_PREGAME:
- this.mcsPreGame.removeMovieClip();
- break;
- case CNavigationStateManager.AS_GAME:
- this.mcsGame.hide();
- break;
- case CNavigationStateManager.AS_RESULT:
- this.mcsResult.removeMovieClip();
- break;
- case CNavigationStateManager.AS_GAMEOVER:
- this.mcsGameOver.removeMovieClip();
- break;
- case CNavigationStateManager.AS_OPTIONS:
- this.mcsOptions.removeMovieClip();
- break;
- case CNavigationStateManager.AS_HIGHSCORE:
- this.mcsHighScore.removeMovieClip();
- break;
- case CNavigationStateManager.AS_CREDITS:
- this.mcsCredits.removeMovieClip();
- break;
- case CNavigationStateManager.AS_HELP:
- this.mcsHelp.removeMovieClip();
- break;
- case CNavigationStateManager.AS_DIALOG:
- this.mcsDialog.removeMovieClip();
- break;
- case CNavigationStateManager.AS_PRELOADER:
- this.mcsPreloader.removeMovieClip();
- }
- }
- function setScreen(screen)
- {
- switch(screen)
- {
- case CNavigationStateManager.AS_PRELOADER:
- var _loc2_ = {_x:0,_y:0};
- this.mcsPreloader = this.mcRoot.attachMovie("mcCPreloaderScreen","ScreenPreloader",0,_loc2_);
- this.mcsPreloader.show();
- break;
- case CNavigationStateManager.AS_INTRO:
- _loc2_ = {_x:385.9,_y:287.6};
- this.mcsIntro = this.mcRoot.attachMovie("mcCIntroScreen","ScreenIntro",0,_loc2_);
- this.mcsIntro.show();
- break;
- case CNavigationStateManager.AS_MENU:
- SoundManager.ins().addSpeaker();
- _loc2_ = {_x:0,_y:0};
- this.mcsMenu = this.mcRoot.attachMovie("mcCMenuScreen","ScreenMenu",1,_loc2_);
- this.mcsMenu.show();
- break;
- case CNavigationStateManager.AS_NEWGAME:
- _loc2_ = {_x:0,_y:0};
- this.mcsNewGame = this.mcRoot.attachMovie("mcCNewGameScreen","ScreenNewGame",2,_loc2_);
- this.mcsNewGame.show();
- this.AppState = CNavigationStateManager.AS_NEWGAME;
- break;
- case CNavigationStateManager.AS_CONTINUEGAME1:
- _loc2_ = {_x:0,_y:0};
- this.mcsContinueGame1 = this.mcRoot.attachMovie("mcCContinueGameScreen1","ScreenContinueGame1",3,_loc2_);
- this.mcsContinueGame1.show();
- this.AppState = CNavigationStateManager.AS_CONTINUEGAME1;
- break;
- case CNavigationStateManager.AS_CONTINUEGAME2:
- _loc2_ = {_x:0,_y:0};
- this.mcsContinueGame2 = this.mcRoot.attachMovie("mcCContinueGameScreen2","ScreenContinueGame2",3,_loc2_);
- this.mcsContinueGame2.show();
- this.AppState = CNavigationStateManager.AS_CONTINUEGAME2;
- break;
- case CNavigationStateManager.AS_PREGAME:
- _loc2_ = {_x:0,_y:0};
- this.mcsPreGame = this.mcRoot.attachMovie("mcCPreGameScreen","ScreenPreGame",4,_loc2_);
- this.mcsPreGame.show();
- this.AppState = CNavigationStateManager.AS_PREGAME;
- break;
- case CNavigationStateManager.AS_GAME:
- SoundManager.ins().fadeBGM(false);
- this.AppState = CNavigationStateManager.AS_GAME;
- _loc2_ = {_x:0,_y:0};
- if(this.mcsGame == undefined)
- {
- this.mcsGame = this.mcRoot.attachMovie("mcCGameScreen","ScreenGame",5,_loc2_);
- }
- this.mcsGame.show();
- break;
- case CNavigationStateManager.AS_RESULT:
- SoundManager.ins().playBGM();
- _loc2_ = {_x:0,_y:0};
- this.mcsResult = this.mcRoot.attachMovie("mcCResultScreen","ScreenResult",6,_loc2_);
- this.mcsResult.show();
- this.AppState = CNavigationStateManager.AS_RESULT;
- break;
- case CNavigationStateManager.AS_GAMEOVER:
- _loc2_ = {_x:0,_y:0};
- this.mcsGameOver = this.mcRoot.attachMovie("mcCGameOverScreen","ScreenGameOver",7,_loc2_);
- this.mcsGameOver.show();
- this.AppState = CNavigationStateManager.AS_GAMEOVER;
- break;
- case CNavigationStateManager.AS_OPTIONS:
- _loc2_ = {_x:0,_y:0};
- this.mcsOptions = this.mcRoot.attachMovie("mcCOptionsScreen","ScreenOptions",8,_loc2_);
- this.mcsOptions.show();
- this.modalscreen = CNavigationStateManager.AS_OPTIONS;
- break;
- case CNavigationStateManager.AS_HIGHSCORE:
- _loc2_ = {_x:0,_y:0};
- this.mcsHighScore = this.mcRoot.attachMovie("mcCHighScoreScreen","ScreenHighScore",9,_loc2_);
- this.mcsHighScore.show();
- this.modalscreen = CNavigationStateManager.AS_HIGHSCORE;
- break;
- case CNavigationStateManager.AS_CREDITS:
- _loc2_ = {_x:0,_y:0};
- this.mcsCredits = this.mcRoot.attachMovie("mcCCreditsScreen","ScreenCredits",10,_loc2_);
- this.mcsCredits.show();
- this.modalscreen = CNavigationStateManager.AS_CREDITS;
- break;
- case CNavigationStateManager.AS_HELP:
- _loc2_ = {_x:0,_y:0};
- this.mcsHelp = this.mcRoot.attachMovie("mcCHelpScreen","ScreenHelp",11,_loc2_);
- this.mcsHelp.show();
- this.modalscreen = CNavigationStateManager.AS_HELP;
- break;
- case CNavigationStateManager.AS_DIALOG:
- _loc2_ = {_x:0,_y:0};
- this.mcsDialog = this.mcRoot.attachMovie("mcCDialogScreen","ScreenDialog",12,_loc2_);
- this.mcsDialog.show();
- this.modalscreen = CNavigationStateManager.AS_DIALOG;
- }
- }
- function changeAppState(tostate)
- {
- if(this.modalscreen != 0)
- {
- this.removeScreen(this.modalscreen);
- }
- this.setScreen(tostate);
- }
- function visibleScreen(visibility, screen)
- {
- switch(screen)
- {
- case CNavigationStateManager.AS_PRELOADER:
- this.mcsPreloader._visible = visibility;
- break;
- case CNavigationStateManager.AS_INTRO:
- this.mcsIntro._visible = visibility;
- break;
- case CNavigationStateManager.AS_MENU:
- this.mcsMenu._visible = visibility;
- break;
- case CNavigationStateManager.AS_NEWGAME:
- this.mcsNewGame._visible = visibility;
- break;
- case CNavigationStateManager.AS_CONTINUEGAME1:
- this.mcsContinueGame1._visible = visibility;
- break;
- case CNavigationStateManager.AS_CONTINUEGAME2:
- this.mcsContinueGame2._visible = visibility;
- break;
- case CNavigationStateManager.AS_PREGAME:
- this.mcsPreGame._visible = visibility;
- break;
- case CNavigationStateManager.AS_GAME:
- this.mcsGame._visible = visibility;
- break;
- case CNavigationStateManager.AS_RESULT:
- this.mcsResult._visible = visibility;
- break;
- case CNavigationStateManager.AS_GAMEOVER:
- this.mcsGameOver._visible = visibility;
- break;
- case CNavigationStateManager.AS_OPTIONS:
- this.mcsOptions._visible = visibility;
- break;
- case CNavigationStateManager.AS_HIGHSCORE:
- this.mcsHighScore._visible = visibility;
- break;
- case CNavigationStateManager.AS_CREDITS:
- this.mcsCredits._visible = visibility;
- break;
- case CNavigationStateManager.AS_HELP:
- this.mcsHelp._visible = visibility;
- case CNavigationStateManager.AS_DIALOG:
- this.mcsDialog._visible = visibility;
- }
- }
- }
-