home *** CD-ROM | disk | FTP | other *** search
- package RES.WINDOWS
- {
- import ENGINE.CORE.OGlobal;
- import ENGINE.CORE.OSound;
- import ENGINE.DISPLAY.OBitmap;
- import ENGINE.DISPLAY.ODisplay;
- import ENGINE.GAME.OGame;
- import ENGINE.INTERFACE.OButton;
- import ENGINE.INTERFACE.OCounter;
- import ENGINE.INTERFACE.ODialog;
- import ENGINE.INTERFACE.OIObject;
- import ENGINE.INTERFACE.OWindow;
- import RES.OBJECTS.OBang;
- import RES.OBJECTS.OBubble;
- import RES.OBJECTS.OField;
- import flash.events.Event;
- import flash.utils.getTimer;
-
- public class OWGame extends OWindow
- {
-
- public static const stInitGraphics:int = 0;
-
- public static const stNormal:int = 4;
-
- public static const stLevelComplete:int = 6;
-
- public static const stBGameOver:int = 7;
-
- public static const stLevelInfo:int = 2;
-
- public static const stLevelInit:int = 3;
-
- public static const stGameOver:int = 8;
-
- public static const stBLevelComplete:int = 5;
-
- public static const stLoadLevel:int = 1;
-
-
- public var iLevelC:OCounter;
-
- private var iNewGame:Boolean;
-
- private var iDAlpha:Number = 0.025;
-
- private var iField:OField;
-
- private var iBang:OBang;
-
- private var iTimer:int;
-
- public var iMenu:OButton;
-
- public var iScore:OCounter;
-
- public var iLevel:OIObject;
-
- private var iInfo:OIObject;
-
- private var iBangInd:int;
-
- public function OWGame(param1:OBang, param2:int, param3:Boolean)
- {
- iDAlpha = 0.025;
- this.iBang = param1;
- this.iBangInd = param2;
- this.iNewGame = param3;
- super(ClusterzL.OWGame,ODialog.iDefAnimators);
- }
-
- private function InitMaker() : Array
- {
- var _loc1_:Array = null;
- var _loc2_:int = 0;
- var _loc3_:int = 0;
- var _loc4_:int = 0;
- _loc1_ = new Array();
- _loc4_ = 0;
- _loc2_ = 4;
- while(_loc2_ <= 15)
- {
- _loc3_ = 0;
- while(_loc3_ < 6)
- {
- _loc1_.push([OBubble.MakeBubble,_loc2_ * 0.97,_loc2_ / 91 * 3,_loc3_,"Bubble",_loc4_,true]);
- _loc4_++;
- _loc3_++;
- }
- _loc2_++;
- }
- _loc4_ = 0;
- _loc2_ = 4;
- while(_loc2_ <= 15)
- {
- _loc3_ = 0;
- while(_loc3_ < 6)
- {
- _loc1_.push([OBubble.MakeShadow,_loc2_,_loc2_ / 91 * 3,_loc3_,"Shadow",_loc4_,true]);
- _loc4_++;
- _loc3_++;
- }
- _loc2_++;
- }
- return _loc1_;
- }
-
- override public function Init() : void
- {
- var _loc1_:OBitmap = null;
- var _loc2_:int = 0;
- super.Init();
- _loc1_ = ODisplay.OBitmapRoundBorder([null,485 + 30,544,40,8,"GEL","120,0.5,0.5,150,0.2,1.0","border",1,OGlobal.ScaleFloor(10),OGlobal.ScaleFloor(10)]);
- this.addChild(_loc1_);
- _loc2_ = getTimer();
- this.iField = new OField(15,20,20,this.iScore,this.iBang,_loc2_,null);
- this.addChild(this.iField);
- this.addChild(this.iBang);
- this.State = stInitGraphics;
- }
-
- private function VisibleElements(param1:Boolean) : void
- {
- if(param1)
- {
- if(!this.iLevel.prVisible)
- {
- this.iLevel.prVisible = true;
- }
- if(!this.iLevelC.prVisible)
- {
- this.iLevelC.prVisible = true;
- }
- if(!this.iScore.prVisible)
- {
- this.iScore.prVisible = true;
- }
- }
- else
- {
- this.iLevel.prVisible = false;
- this.iLevelC.prVisible = false;
- this.iScore.prVisible = false;
- }
- }
-
- override public function OnPress(param1:Event, param2:*) : void
- {
- if(param2 == this.iMenu)
- {
- this.parent.addChildAt(this.iBang,this.iBangInd);
- this.prVisible = false;
- return;
- }
- }
-
- public function SplashInfoMessage() : Boolean
- {
- var _loc1_:Boolean = false;
- _loc1_ = false;
- if(this.iInfo.prAnimation)
- {
- return false;
- }
- this.iInfo.alpha += this.iDAlpha;
- if(this.iDAlpha > 0 && this.iInfo.alpha >= 1)
- {
- this.iInfo.alpha = 1;
- this.iDAlpha *= -1;
- }
- if(this.iDAlpha < 0 && this.iInfo.alpha <= 0)
- {
- this.iInfo.alpha = 0;
- this.iDAlpha *= -1;
- _loc1_ = true;
- }
- return _loc1_;
- }
-
- override public function Free() : void
- {
- this.iLevel = null;
- this.iLevelC = null;
- this.iScore = null;
- this.iMenu = null;
- this.iField = null;
- super.Free();
- }
-
- private function AddInfo(param1:OIObject, param2:Boolean = true) : void
- {
- if(this.iInfo)
- {
- this.removeChild(this.iInfo);
- this.iInfo.Free();
- this.iInfo = null;
- }
- if(param1)
- {
- this.iInfo = param1;
- this.iInfo.Pos(0,0);
- this.iInfo.Pos(10 + (520 - this.iInfo.prWidth) / 2,300 - this.iInfo.prHeight / 2);
- if(param2)
- {
- this.iInfo.SetVisible(false);
- this.iInfo.prVisible = true;
- }
- this.addChild(this.iInfo);
- }
- }
-
- override public function OnEnterFrame(param1:Event) : void
- {
- var _loc2_:int = 0;
- var _loc3_:int = 0;
- super.OnEnterFrame(param1);
- switch(this.iState)
- {
- case stInitGraphics:
- if(!this.prAnimation)
- {
- this.State = stLoadLevel;
- }
- break;
- case stLoadLevel:
- _loc2_ = getTimer() - this.iTimer;
- if(_loc2_ > 70)
- {
- this.State = stLevelInfo;
- }
- break;
- case stLevelInfo:
- _loc2_ = getTimer();
- if(_loc2_ - this.iTimer > 2000)
- {
- if(this.iInfo.prVisible)
- {
- this.iInfo.prVisible = false;
- }
- else if(!this.iInfo.prAnimation)
- {
- this.AddInfo(null);
- this.State = stLevelInit;
- }
- }
- break;
- case stLevelInit:
- if(this.iField.State == OField.stNormal)
- {
- this.VisibleElements(true);
- this.State = stNormal;
- }
- break;
- case stNormal:
- _loc3_ = 0;
- switch(this.iField.State)
- {
- case OField.stLevelCompShow:
- break;
- case OField.stLevelComplete:
- this.State = stBLevelComplete;
- this.VisibleElements(false);
- break;
- case OField.stGameOver:
- this.State = stBGameOver;
- this.VisibleElements(false);
- }
- break;
- case stBLevelComplete:
- this.State = stLevelComplete;
- break;
- case stLevelComplete:
- if(!this.iInfo.prVisible && !this.iInfo.prAnimation)
- {
- this.AddInfo(null);
- this.State = stLoadLevel;
- }
- break;
- case stBGameOver:
- this.State = stGameOver;
- break;
- case stGameOver:
- if(!this.iInfo.prVisible && !this.iInfo.prAnimation)
- {
- this.AddInfo(null);
- this.State = stLoadLevel;
- }
- }
- }
-
- override public function set State(param1:int) : void
- {
- this.iState = param1;
- switch(this.iState)
- {
- case stInitGraphics:
- this.VisibleElements(false);
- break;
- case stLoadLevel:
- this.iTimer = getTimer();
- ClusterzL.iMP.ClearOpponentTurn(true);
- ClusterzL.iMP.Turn(["rdl",ClusterzL.iGAME.prLevel,this.iField.prGameIndex,ClusterzL.iGAME.prPlayerName]);
- break;
- case stLevelInfo:
- OSound.PlaySoundInd(1);
- this.iLevelC.prValue = ClusterzL.iGAME.prLevel + 1;
- ClusterzL.OWGameNewLevel[3] = ClusterzL.strLevel + " - " + (ClusterzL.iGAME.prLevel + 1).toString();
- this.AddInfo(ClusterzS.ColorText(ClusterzL.OWGameNewLevel),true);
- this.iTimer = getTimer();
- break;
- case stLevelInit:
- this.iField.NewLevel(ClusterzL.iGAME.prLevel);
- break;
- case stBLevelComplete:
- this.State = stLevelComplete;
- break;
- case stLevelComplete:
- ClusterzL.iGAME.Write(OGame.catTmp,"Score",this.iScore.prValue);
- ClusterzL.iGAME.NextLevel();
- this.iInfo = new OWResults(false);
- this.iInfo.Pos(0,0);
- this.addChild(iInfo);
- break;
- case stBGameOver:
- this.State = stGameOver;
- break;
- case stGameOver:
- ClusterzL.iGAME.Write(OGame.catTmp,"Score",0);
- this.iInfo = new OWResults(true);
- this.iInfo.Pos(0,0);
- this.addChild(iInfo);
- }
- }
- }
- }
-