home *** CD-ROM | disk | FTP | other *** search
- class Summary extends MovieClip
- {
- var onEnterFrame;
- var sURL;
- var mcDescription;
- var oSpaceLst;
- var mcStatusBar;
- static var instance;
- function Summary()
- {
- super();
- Summary.instance = this;
- this.onEnterFrame = this.init;
- }
- function init(Void)
- {
- this.onEnterFrame = null;
- this.sURL = Application.sBasePath + "SaveScore.php";
- if(Game.getInstance().sMissionType == "hostages")
- {
- this.setHostAlpha(100);
- }
- else
- {
- this.setHostAlpha(20);
- }
- this.mcDescription.mcTexts.gotoAndStop(1);
- this.mcDescription.btnPlay.onRelease = mx.utils.Delegate.create(this,this.onReleasePlayFirst);
- this.oSpaceLst = new Object();
- this.oSpaceLst.onKeyDown = mx.utils.Delegate.create(this,this.onPressSpaceFirst);
- Key.addListener(this.oSpaceLst);
- this.setBonusGauge(Game.getInstance().bonus);
- }
- static function getInstance(Void)
- {
- return Summary.instance;
- }
- function startGame(Void)
- {
- Game.getInstance().startGame();
- }
- function onReleasePlayFirst(Void)
- {
- Key.removeListener(this.oSpaceLst);
- Sounds.stopAllSounds();
- this.gotoAndPlay("firstOut");
- }
- function setFuelGauge(amount)
- {
- this.mcStatusBar.mcFuelGauge.gotoAndStop(101 - amount);
- }
- function setChafsGauge(amount)
- {
- this.mcStatusBar.chaffs = amount;
- }
- function setLivesGauge(amount)
- {
- this.mcStatusBar.lives = amount;
- }
- function setPointsGauge(amount)
- {
- this.mcStatusBar.points = amount;
- }
- function setOnBoardGauge(amount, maxAmount)
- {
- this.mcStatusBar.onBoard = amount + "/" + maxAmount;
- }
- function setBonusGauge(amount)
- {
- this.mcStatusBar.bonus = amount;
- }
- function showMission(Void)
- {
- this.mcDescription.mcTexts.gotoAndStop(Game.level + 2);
- this.mcDescription.btnPlay.onRelease = mx.utils.Delegate.create(this,this.onReleasePlay);
- this.oSpaceLst = new Object();
- this.oSpaceLst.onKeyDown = mx.utils.Delegate.create(this,this.onPressSpace);
- Key.addListener(this.oSpaceLst);
- this.gotoAndPlay("panelIn");
- }
- function showGameOver(bSuccess)
- {
- §§push(this.gotoAndPlay("panelIn"));
- if(bSuccess)
- {
- this.mcDescription.gotoAndStop("win");
- this.mcDescription.btnEnter.onRelease = mx.utils.Delegate.create(this,this.onReleaseSend);
- this.oSpaceLst = new Object();
- this.oSpaceLst.onKeyDown = mx.utils.Delegate.create(this,this.onPressEnterWin);
- Key.addListener(this.oSpaceLst);
- Selection.setFocus(this.mcDescription.tfName);
- }
- else
- {
- this.mcDescription.gotoAndStop("lose");
- this.mcDescription.btnPlay.onRelease = mx.utils.Delegate.create(this,this.onReleasePlayAgain);
- this.mcDescription.btnFriend.onRelease = mx.utils.Delegate.create(this,this.onReleaseFriend);
- this.oSpaceLst = new Object();
- this.oSpaceLst.onKeyDown = mx.utils.Delegate.create(this,this.onPressSpaceLose);
- Key.addListener(this.oSpaceLst);
- }
- }
- function onReleasePlay(Void)
- {
- Key.removeListener(this.oSpaceLst);
- Game.getInstance().setNextLevel();
- Sounds.stopAllSounds();
- this.gotoAndPlay("panelOut");
- }
- function onReleasePlayAgain(Void)
- {
- Key.removeListener(this.oSpaceLst);
- _root.gotoAndPlay("gameOut");
- }
- function onReleaseSend(Void)
- {
- Key.removeListener(this.oSpaceLst);
- var _loc3_ = this.mcDescription;
- if(_loc3_.tfName.length > 0)
- {
- _loc3_.mcBlockade.gotoAndStop("show");
- var _loc2_ = new LoadVars();
- _loc2_.NAME = _loc3_.tfName.text;
- _loc2_.SCORE = Game.getInstance().getPoints();
- _loc2_.onLoad = mx.utils.Delegate.create(this,this.onSendScore);
- _loc2_.sendAndLoad(this.sURL,_loc2_,"POST");
- }
- else
- {
- _loc3_.mcName.gotoAndPlay("error");
- Selection.setFocus(_loc3_.tfName);
- this.oSpaceLst = new Object();
- this.oSpaceLst.onKeyDown = mx.utils.Delegate.create(this,this.onPressEnterWin);
- Key.addListener(this.oSpaceLst);
- }
- }
- function onSendScore(bSuccess)
- {
- if(bSuccess)
- {
- this.mcDescription.mcBlockade.gotoAndStop("hide");
- _root.gotoAndPlay("gameOut");
- _root.mcInterface.gotoAndStop("high");
- }
- else
- {
- this.mcDescription.mcBlockade.gotoAndPlay("error");
- this.oSpaceLst = new Object();
- this.oSpaceLst.onKeyDown = mx.utils.Delegate.create(this,this.onPressEnterWin);
- Key.addListener(this.oSpaceLst);
- }
- }
- function onPressSpaceFirst(Void)
- {
- if(Key.isDown(32))
- {
- this.onReleasePlayFirst();
- }
- }
- function onPressSpace(Void)
- {
- if(Key.isDown(32))
- {
- this.onReleasePlay();
- }
- }
- function onPressSpaceLose(Void)
- {
- if(Key.isDown(32))
- {
- this.onReleasePlayAgain();
- }
- }
- function onPressEnterWin(Void)
- {
- if(Key.isDown(13))
- {
- this.onReleaseSend();
- }
- }
- function setHostAlpha(value)
- {
- this.mcStatusBar.tfHostages._alpha = value;
- }
- function onReleaseFriend(Void)
- {
- Key.removeListener(this.oSpaceLst);
- _root.gotoAndPlay("gameOut");
- _root.mcInterface.gotoAndStop("send");
- }
- }
-