home *** CD-ROM | disk | FTP | other *** search
- package RES.WINDOWS
- {
- import ENGINE.CORE.OSound;
- import ENGINE.GAME.OGame;
- import ENGINE.INTERFACE.OButton;
- import ENGINE.INTERFACE.ODialog;
- import ENGINE.INTERFACE.OIObject;
- import RES.API.highscores;
- import flash.events.Event;
- import flash.events.TimerEvent;
- import flash.utils.Timer;
-
- public class OWResults extends ODialog
- {
-
-
- public var iGHighScores:OButton;
-
- private var iNewGame:Boolean;
-
- public var iButton:OButton;
-
- private var so:int;
-
- private var iTimer:Timer;
-
- private var iRecord:Boolean;
-
- private var _highscore:highscores;
-
- public var iSubmit:OButton;
-
- public function OWResults(param1:Boolean = false)
- {
- this.iNewGame = param1;
- so = ClusterzL.iGAME.Read(OGame.catTmp,"Score");
- this.iRecord = true;
- if(this.iRecord)
- {
- ClusterzL.iGAME.SetLevelScore(so);
- }
- ClusterzL.iGAME.AddScore(so);
- ClusterzL.iGAME.AddScoreInTable(ClusterzL.iGAME.prScore);
- ClusterzL.iMP.Turn(["wrr",ClusterzL.iGAME.prPlayerName,ClusterzL.iGAME.prScore]);
- if(this.iNewGame)
- {
- ClusterzL.OWResults[0][3] = ClusterzL.strGameOver;
- ClusterzL.OWResults[0][5] = ClusterzL.iPosXLabelGameOver;
- }
- else
- {
- ClusterzL.OWResults[0][3] = ClusterzL.strLevelComplete;
- ClusterzL.OWResults[0][5] = 30;
- }
- ClusterzL.OWResultsLevelScore[1][5] = so.toString();
- ClusterzL.OWResultsReiting[1][4] = ClusterzL.iGAME.prScore;
- if(this.iNewGame || !this.iRecord)
- {
- ClusterzL.OWResults[3][3] = "yellow";
- ClusterzL.OWResults[3][4] = "yellow";
- ClusterzL.OWResults[3][6] = ClusterzL.strReplayLevel;
- }
- else
- {
- ClusterzL.OWResults[3][3] = "yellow1";
- ClusterzL.OWResults[3][4] = "yellow1";
- ClusterzL.OWResults[3][6] = ClusterzL.strNextLevel;
- }
- super(ClusterzL.OWResults);
- }
-
- public function GHighScores() : void
- {
- _highscore = new highscores(this,ClusterzL.cHs_initObj);
- _highscore.openHub("view",0);
- this.addChild(_highscore);
- }
-
- override public function Init() : void
- {
- super.Init();
- this.iGHighScores.prVisible = false;
- this.iTimer = new Timer(750,5);
- this.iTimer.addEventListener(TimerEvent.TIMER,OnTimer);
- this.iTimer.start();
- }
-
- public function Submit() : void
- {
- _highscore = new highscores(this,ClusterzL.cHs_initObj);
- _highscore.openHub("submit",ClusterzL.iGAME.Read(OGame.catTmp,"Score"));
- this.addChild(_highscore);
- }
-
- private function OnITimer(param1:TimerEvent) : void
- {
- playAgain();
- }
-
- override public function OnPress(param1:Event, param2:*) : void
- {
- if(!this.prMouseEnabled)
- {
- return;
- }
- if(param2 == this.iButton)
- {
- this.prVisible = false;
- return;
- }
- if(param2 == this.iSubmit)
- {
- Submit();
- return;
- }
- if(param2 == this.iGHighScores)
- {
- GHighScores();
- }
- }
-
- override public function Free() : void
- {
- this.iTimer.stop();
- this.iTimer.removeEventListener(TimerEvent.TIMER,OnTimer);
- this.iTimer = null;
- this.iButton = null;
- this.iSubmit = null;
- this.iGHighScores = null;
- if(_highscore)
- {
- this.removeChild(_highscore);
- }
- super.Free();
- }
-
- private function OnTimer(param1:TimerEvent) : void
- {
- switch(this.iTimer.currentCount)
- {
- case 1:
- (this.getChildAt(0) as OIObject).prVisible = true;
- OSound.PlaySoundInd(1);
- break;
- case 2:
- (this.getChildAt(1) as OIObject).prVisible = true;
- OSound.PlaySoundInd(1);
- break;
- case 3:
- (this.getChildAt(2) as OIObject).prVisible = true;
- OSound.PlaySoundInd(1);
- break;
- case 4:
- this.iButton.prVisible = true;
- OSound.PlaySoundInd(4);
- break;
- case 5:
- if(so > 0)
- {
- this.iGHighScores.prVisible = false;
- this.iSubmit.prVisible = true;
- }
- else
- {
- this.iSubmit.prVisible = false;
- this.iGHighScores.prVisible = true;
- }
- OSound.PlaySoundInd(4);
- }
- }
-
- public function playAgain() : void
- {
- this.iSubmit.visible = false;
- }
- }
- }
-