home *** CD-ROM | disk | FTP | other *** search
- package ENGINE.CORE
- {
- import flash.display.Sprite;
- import flash.display.Stage;
- import flash.geom.Rectangle;
- import flash.net.LocalConnection;
-
- public class OGlobal
- {
-
- private static var iFPS:int = 60;
-
- private static var iDomain:String;
-
- private static var iSRect:Rectangle = new Rectangle();
-
- private static var iVRect:Rectangle = new Rectangle(0,0,800,600);
-
- private static var iStage:Stage;
-
- private static var iScale:Number = 1;
-
- private static var iAppName:String;
-
- private static var iOldScale:Number = 1;
-
-
- public function OGlobal()
- {
- super();
- }
-
- public static function get FPS() : int
- {
- return OGlobal.iFPS;
- }
-
- public static function CheckDomain(param1:String) : Boolean
- {
- var _loc2_:int = 0;
- _loc2_ = OGlobal.iDomain.indexOf(param1);
- return _loc2_ >= 0 && _loc2_ <= 4;
- }
-
- public static function ToLocal(param1:Number) : Number
- {
- return param1 / OGlobal.iScale;
- }
-
- public static function set FPS(param1:int) : void
- {
- OGlobal.iFPS = param1;
- if(OGlobal.iStage)
- {
- OGlobal.iStage.frameRate = param1;
- }
- }
-
- public static function Rescale(param1:Sprite, param2:Boolean = true) : void
- {
- var _loc3_:Number = NaN;
- _loc3_ = OGlobal.iStage.stageWidth / OGlobal.iStage.stageHeight <= 800 / 600 ? OGlobal.iStage.stageWidth / 800 : OGlobal.iStage.stageHeight / 600;
- OGlobal.iSRect.x = 0;
- OGlobal.iSRect.y = 0;
- OGlobal.iSRect.width = OGlobal.iStage.stageWidth;
- OGlobal.iSRect.height = OGlobal.iStage.stageHeight;
- OGlobal.iVRect.width = Math.round(800 * _loc3_);
- OGlobal.iVRect.height = Math.round(600 * _loc3_);
- OGlobal.iVRect.x = Math.floor((OGlobal.iStage.stageWidth - OGlobal.iVRect.width) / 2);
- OGlobal.iVRect.y = Math.floor((OGlobal.iStage.stageHeight - OGlobal.iVRect.height) / 2);
- if(param2)
- {
- param1.x = OGlobal.iVRect.x;
- param1.y = OGlobal.iVRect.y;
- }
- OGlobal.iScale = _loc3_;
- }
-
- public static function get prStage() : Stage
- {
- return OGlobal.iStage;
- }
-
- public static function ClearScale() : void
- {
- OGlobal.iOldScale = OGlobal.iScale;
- OGlobal.iScale = 1;
- OGlobal.iVRect = OGlobal.iSRect.clone();
- }
-
- public static function ToGlobal(param1:Number) : Number
- {
- return param1 * OGlobal.iScale;
- }
-
- public static function set AppName(param1:String) : void
- {
- OGlobal.iAppName = "WellGames_" + param1;
- }
-
- public static function get Domain() : String
- {
- return OGlobal.iDomain;
- }
-
- public static function SetDomain() : void
- {
- var _loc1_:LocalConnection = null;
- _loc1_ = new LocalConnection();
- OGlobal.iDomain = _loc1_.domain;
- }
-
- public static function get StageRect() : Rectangle
- {
- return OGlobal.iSRect;
- }
-
- public static function ScaleFloor(param1:Number) : Number
- {
- return Math.floor(param1 * OGlobal.iScale) / OGlobal.iScale;
- }
-
- public static function get Scale() : Number
- {
- return OGlobal.iScale;
- }
-
- public static function get ViewporRect() : Rectangle
- {
- return OGlobal.iVRect;
- }
-
- public static function get AppName() : String
- {
- return OGlobal.iAppName;
- }
-
- public static function set prStage(param1:Stage) : void
- {
- OGlobal.iStage = param1;
- }
-
- public static function RestoreScale() : void
- {
- OGlobal.iScale = OGlobal.iOldScale;
- }
-
- public static function ScaleMod(param1:Number) : Number
- {
- var _loc2_:Number = NaN;
- _loc2_ = param1 * OGlobal.iScale;
- return (_loc2_ - Math.floor(_loc2_)) / OGlobal.iScale;
- }
- }
- }
-