home *** CD-ROM | disk | FTP | other *** search
- class ScrollingPanel extends State
- {
- var nInstructionsPage;
- var nKeyPosition;
- var sLastState;
- var sState;
- var mcRef;
- static var sSTATE_TITLE = "TitleCard";
- static var sSTATE_TITLE_TO_HOWTOPLAY = "TitleToHowToPlay";
- static var sSTATE_HOWTOPLAY = "HowToPlay";
- static var sSTATE_HOWTOPLAY_TO_TITLE = "HowToPlayToTitle";
- static var sSTATE_HIGHSCORES = "HighScores";
- static var sSTATE_HIGHSCORES_TO_TITLE = "HighScoresToTitle";
- static var sSTATE_TITLE_TO_HIGHSCORES = "TitleToHighScores";
- function ScrollingPanel(_mcRef)
- {
- super(_mcRef);
- this.setState(ScrollingPanel.sSTATE_TITLE);
- this.nInstructionsPage = 1;
- this.nKeyPosition = 1;
- }
- function setState(_sState)
- {
- this.sLastState = this.sState;
- super.setState(_sState);
- this.initState(_sState);
- }
- function TitleToHowToPlay()
- {
- if(this.stateFinished())
- {
- var _loc2_ = this.mcRef.mcState.mcPanel.mcPage.mcKeys._currentframe;
- this.setState(ScrollingPanel.sSTATE_HOWTOPLAY);
- this.mcRef.mcState.mcPanel.mcPage.mcKeys.gotoAndPlay(_loc2_);
- }
- }
- function HowToPlayToTitle()
- {
- if(this.stateFinished())
- {
- this.nKeyPosition = this.mcRef.mcState.mcPanel.mcPage.mcKeys._currentframe;
- this.setState(ScrollingPanel.sSTATE_TITLE);
- }
- }
- function TitleToHighScores()
- {
- if(this.stateFinished())
- {
- this.changeStateKeepingInfo(ScrollingPanel.sSTATE_HIGHSCORES);
- }
- }
- function HighScoresToTitle()
- {
- if(this.stateFinished())
- {
- this.setState(ScrollingPanel.sSTATE_TITLE);
- }
- }
- function TitleCard()
- {
- }
- function HighScores()
- {
- }
- function Instructions()
- {
- }
- function moveTitleToIns()
- {
- this.setState(ScrollingPanel.sSTATE_TITLE_TO_HOWTOPLAY);
- this.mcRef.mcState.mcPanel.mcPage.mcKeys.gotoAndPlay(this.nKeyPosition);
- this.initPage();
- }
- function moveTitleToHighScores()
- {
- Main.getRef().setMustSendScore(false);
- this.setState(ScrollingPanel.sSTATE_TITLE_TO_HIGHSCORES);
- Main.getRef().showHighScoreStuff(this.mcRef.mcState.mcPanel.mcSubmit);
- this.checkToSubmitHighScore();
- this.mcRef.mcState.mcPanel.mcSubmit._visible = false;
- this.mcRef.mcState.mcPanel.mcMain.gotoAndStop(2);
- }
- function desactivateButton(_mcButton)
- {
- delete _mcButton.button.onRollOver;
- _mcButton.button.onRollOver = undefined;
- delete _mcButton.button.onRelease;
- _mcButton.button.onRelease = undefined;
- _mcButton.gotoAndStop(2);
- }
- function activateButton(_mcButton, _onRelease)
- {
- _mcButton.gotoAndStop(1);
- _mcButton.button.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
- _mcButton.button.onRelease = Delegate.create(this,_onRelease);
- }
- function nextPage()
- {
- Controller.getRef().playClickSound();
- this.nInstructionsPage = this.nInstructionsPage + 1;
- this.initPage();
- }
- function previousPage()
- {
- Controller.getRef().playClickSound();
- this.nInstructionsPage = this.nInstructionsPage - 1;
- this.initPage();
- }
- function initPage()
- {
- if(this.nInstructionsPage == 1)
- {
- this.desactivateButton(this.mcRef.mcState.mcPanel.mcBack);
- this.activateButton(this.mcRef.mcState.mcPanel.mcNext,this.nextPage);
- }
- else if(this.nInstructionsPage == 2)
- {
- this.activateButton(this.mcRef.mcState.mcPanel.mcBack,this.previousPage);
- this.activateButton(this.mcRef.mcState.mcPanel.mcNext,this.nextPage);
- }
- else if(this.nInstructionsPage == 3)
- {
- this.activateButton(this.mcRef.mcState.mcPanel.mcBack,this.previousPage);
- this.desactivateButton(this.mcRef.mcState.mcPanel.mcNext);
- }
- this.mcRef.mcState.mcPanel.mcPage.gotoAndStop(this.nInstructionsPage);
- }
- function checkToSubmitHighScore()
- {
- if(_global.gProxyObj.getIsLoggedIn())
- {
- this.mcRef.mcState.mcPanel.mcSubmit._visible = true;
- }
- else
- {
- this.mcRef.mcState.mcPanel.mcSubmit._visible = false;
- }
- if(Main.getRef().MustSendScore)
- {
- this.clickSubmitButton();
- }
- else
- {
- _global.HS.getScores();
- }
- }
- function initState(_sState)
- {
- switch(_sState)
- {
- case ScrollingPanel.sSTATE_TITLE:
- _global.HS.initHiScores();
- this.mcRef.mcState.mcPanel.btnPlay2.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
- this.mcRef.mcState.mcPanel.btnPlay2.onRelease = Delegate.create(Main.getRef(),Main.getRef().clickPlayButton);
- this.mcRef.mcState.mcPanel.btnHighScores.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
- this.mcRef.mcState.mcPanel.btnHighScores.onRelease = Delegate.create(this,this.clickTitleToHSButton);
- this.mcRef.mcState.mcPanel.btnHowToPlay.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
- this.mcRef.mcState.mcPanel.btnHowToPlay.onRelease = Delegate.create(this,this.clickTitleToInsButton);
- this.mcRef.mcState.mcPanel.btnCheat.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
- this.mcRef.mcState.mcPanel.btnCheat.onRelease = Delegate.create(this,this.clickEnterCodeButton);
- break;
- case ScrollingPanel.sSTATE_HOWTOPLAY:
- this.mcRef.mcState.mcPanel.btnPlay1.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
- this.mcRef.mcState.mcPanel.btnPlay1.onRelease = Delegate.create(Main.getRef(),Main.getRef().clickPlayButton);
- this.initPage();
- break;
- case ScrollingPanel.sSTATE_HIGHSCORES:
- if(this.sLastState == ScrollingPanel.sSTATE_TITLE_TO_HIGHSCORES)
- {
- this.mcRef.mcState.mcPanel.mcSubmit._visible = false;
- }
- else
- {
- Main.getRef().showHighScoreStuff(this.mcRef.mcState.mcPanel.mcSubmit);
- this.checkToSubmitHighScore();
- }
- if(this.mcRef.mcState.mcPanel.mcSubmit._visible)
- {
- this.mcRef.mcState.mcPanel.mcSubmit.btnSubmit.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
- this.mcRef.mcState.mcPanel.mcSubmit.btnSubmit.onRelease = Delegate.create(this,this.clickSubmitButton);
- this.mcRef.mcState.mcPanel.mcMain.gotoAndStop(1);
- }
- else
- {
- this.mcRef.mcState.mcPanel.mcMain.gotoAndStop(2);
- }
- this.mcRef.mcState.mcPanel.mcMain.btnHSToTitle.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
- this.mcRef.mcState.mcPanel.mcMain.btnHSToTitle.onRelease = Delegate.create(this,this.clickHSToTitleButton);
- }
- }
- function clickTitleToInsButton()
- {
- Controller.getRef().playClickSound();
- this.moveTitleToIns();
- }
- function clickTitleToHSButton()
- {
- Controller.getRef().playClickSound();
- this.moveTitleToHighScores();
- }
- function clickHSToTitleButton()
- {
- Controller.getRef().playClickSound();
- this.changeStateKeepingInfo(ScrollingPanel.sSTATE_HIGHSCORES_TO_TITLE);
- }
- function clickInsToTitleButton()
- {
- Controller.getRef().playClickSound();
- var _loc2_ = this.mcRef.mcState.mcPanel.mcPage.mcKeys._currentframe;
- this.setState(ScrollingPanel.sSTATE_HOWTOPLAY_TO_TITLE);
- this.mcRef.mcState.mcPanel.mcPage.mcKeys.gotoAndPlay(_loc2_);
- this.initPage();
- }
- function clickEnterCodeButton()
- {
- Controller.getRef().playClickSound();
- Controller.getRef().getCheatPop().doShow();
- }
- function clickSubmitButton()
- {
- _global.HS.submitScore(CTRLGame.getRef().Score);
- this.mcRef.mcState.mcPanel.mcSubmit._visible = false;
- if(this.mcRef.mcState.mcPanel.mcSubmit._visible)
- {
- this.mcRef.mcState.mcPanel.mcMain.gotoAndStop(1);
- }
- else
- {
- this.mcRef.mcState.mcPanel.mcMain.gotoAndStop(2);
- }
- }
- function changeStateKeepingInfo(_sNextState)
- {
- var _loc3_ = this.mcRef.mcState.mcPanel.mcSubmit._visible;
- var _loc4_ = this.mcRef.mcState.mcPanel.txt_highScoreNumber.text;
- var _loc5_ = this.mcRef.mcState.mcPanel.txt_highScoreName.text;
- var _loc6_ = this.mcRef.mcState.mcPanel.txt_highScoreScore.text;
- var _loc7_ = this.mcRef.mcState.mcPanel.txt_highScoreScore.scroll;
- this.setState(_sNextState);
- this.mcRef.mcState.mcPanel.mcSubmit._visible = _loc3_;
- if(this.mcRef.mcState.mcPanel.mcSubmit._visible)
- {
- this.mcRef.mcState.mcPanel.mcMain.gotoAndStop(1);
- }
- else
- {
- this.mcRef.mcState.mcPanel.mcMain.gotoAndStop(2);
- }
- this.mcRef.mcState.mcPanel.txt_highScoreNumber.text = _loc4_;
- this.mcRef.mcState.mcPanel.txt_highScoreName.text = _loc5_;
- this.mcRef.mcState.mcPanel.txt_highScoreScore.text = _loc6_;
- this.mcRef.mcState.mcPanel.txt_highScoreNumber.scroll = _loc7_;
- this.mcRef.mcState.mcPanel.txt_highScoreName.scroll = _loc7_;
- this.mcRef.mcState.mcPanel.txt_highScoreScore.scroll = _loc7_;
- }
- }
-