home *** CD-ROM | disk | FTP | other *** search
Wrap
package RES.WINDOWS { import ENGINE.CORE.OGlobal; import ENGINE.DISPLAY.OBitmap; import ENGINE.DISPLAY.ODisplay; import ENGINE.INTERFACE.OButton; import ENGINE.INTERFACE.OCounter; import ENGINE.INTERFACE.OWindow; import RES.OBJECTS.OCursor; import RES.OBJECTS.OField; import flash.events.Event; import flash.geom.Rectangle; import flash.utils.getTimer; public class OWInstructions extends OWindow { private static const iYPos:int = 120; private static const iXPos:int = 100; private static const iR:int = 10; public static const stEndGame:int = 3; public static const stShowGame:int = 1; public static const stStartGame:int = 0; private static const iBubRadius:int = 15; private var iDemo:OField; private var iCursor:RES.OBJECTS.OCursor; public var iClose:OButton; private var iTimer:int; public var iScore:OCounter; public var iInstr1:OBitmap; private const iRecordStr:String = "065S3I009A054y4B00AA06394600A6043d5000C704363n0095032x390075032s2w0075040P4L2049060e541064041t3N0084037W5Y109C041R1Y21K4087Y5y1089057U6B109A080S5j1093053R5L00E703384J0095044n5S00E904543I008A033C3J0086042U3o0094045I2z007A043O2x0076045F2o006A050E3G2046"; private const iLevelMap:Array = [[4,6,0],[0,1,2,3],[5,857455,477020,372779,420140,235998,176169,300672,190670,269648],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,8,4,3,3,2,2,4,8,0,0,0,0],[0,0,0,0,0,4,1,1,4,3,3,4,0,0,0,0],[0,0,0,0,0,3,1,8,8,3,2,0,0,0,0,0],[0,0,0,0,0,0,3,4,8,4,2,0,0,0,0,0],[0,0,0,0,0,0,1,2,2,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0]]; public var iInstr2:OBitmap; private const iGameIndex:int = 1; private var iRect:Rectangle; public function OWInstructions() { super(ClusterzL.OWInstructions); } override public function Init() : void { var _loc1_:OBitmap = null; super.Init(); _loc1_ = ODisplay.OBitmapRoundBorder([null,2 * iR * (OField.iFCols + 1),2 * iR * (OField.iFRows - 3),10,4,"GEL","120,0.5,0.7,120,0.5,0.7","border",0.5,OGlobal.ScaleFloor(iXPos - 5),OGlobal.ScaleFloor(iYPos - 5)]); this.addChild(_loc1_); iCursor = new RES.OBJECTS.OCursor(ODisplay.OBitmapSpriteFillRect([ODisplay.OBitmapSpriteFillRect,20,20,[ODisplay.SpriteLib,ClusterzL.OCursor],"GEL","white","border",1,0,0,null,0,true])); State = stStartGame; } override public function OnPress(param1:Event, param2:*) : void { if(param2 == iClose) { this.prVisible = false; } } override public function Free() : void { iDemo = null; iScore = null; super.Free(); } override public function OnEnterFrame(param1:Event) : void { super.OnEnterFrame(param1); switch(iState) { case stStartGame: if(Boolean(iDemo) && iDemo.State == OField.stNormal) { State = stShowGame; } break; case stShowGame: if(getTimer() - iTimer > 10000) { if(iInstr1.prVisible) { iInstr1.prVisible = false; iInstr2.prVisible = true; } else { iInstr2.prVisible = false; iInstr1.prVisible = true; } iTimer = getTimer(); } if(Boolean(iDemo) && iDemo.State == OField.stLevelComplete) { State = stEndGame; } break; case stEndGame: if(getTimer() - iTimer > 500) { State = stStartGame; } } } override public function set State(param1:int) : void { var _loc2_:Number = NaN; iState = param1; switch(iState) { case stStartGame: _loc2_ = Math.round(Math.sqrt(3) * iBubRadius); this.iRect = new Rectangle(0,0,2 * iBubRadius * OField.iFCols + iBubRadius,_loc2_ * (OField.iFRows - 1) + 2 * iBubRadius); iDemo = new OField(iR,iXPos,iYPos,iScore,null,iGameIndex,iRect); iDemo.prCursor = iCursor; iDemo.prRecord = iRecordStr; iDemo.NewLevel(-1,this.iLevelMap); this.addChild(iDemo); this.addChild(iCursor); iCursor.prVisible = false; this.iDemo.mouseEnabled = false; this.iDemo.mouseChildren = false; break; case stShowGame: iScore.prValue = 0; iScore.prVisible = true; iCursor.prVisible = true; iTimer = getTimer(); break; case stEndGame: this.removeChild(iDemo); iDemo.Free(); iCursor.prVisible = false; this.removeChild(iCursor); iScore.prVisible = false; iTimer = getTimer(); } } } }