home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Puzzle / Clusterz / Clusterz.swf / scripts / RES / WINDOWS / OWMenu.as < prev    next >
Encoding:
Text File  |  2008-09-12  |  4.6 KB  |  155 lines

  1. package RES.WINDOWS
  2. {
  3.    import ENGINE.INTERFACE.OButton;
  4.    import ENGINE.INTERFACE.ODialog;
  5.    import ENGINE.INTERFACE.OIObject;
  6.    import ENGINE.INTERFACE.OInterface;
  7.    import ENGINE.INTERFACE.OWindow;
  8.    import ENGINE.SMARTFOX.OMultiplayer;
  9.    import flash.events.Event;
  10.    import flash.utils.getTimer;
  11.    
  12.    public class OWMenu extends ODialog
  13.    {
  14.        
  15.       
  16.       public var iGHighScores:OButton;
  17.       
  18.       public var iPlayOnline:OButton;
  19.       
  20.       public var iOptions:OButton;
  21.       
  22.       public var iBName:OButton;
  23.       
  24.       public var iGameName:OIObject;
  25.       
  26.       public var iTimer:int;
  27.       
  28.       public var iInstructions:OButton;
  29.       
  30.       public var iInfo:OIObject;
  31.       
  32.       public function OWMenu()
  33.       {
  34.          super(ClusterzL.OWMenu);
  35.       }
  36.       
  37.       private function ShowUserReiting(param1:Boolean) : void
  38.       {
  39.          var _loc2_:String = null;
  40.          var _loc3_:String = null;
  41.          var _loc4_:Array = null;
  42.          _loc2_ = String(ClusterzL.OWColors[Math.round(Math.random() * (ClusterzL.OWColors.length - 1))]);
  43.          ClusterzL.OWMenuReiting[0][3] = _loc2_;
  44.          if(param1)
  45.          {
  46.             ClusterzL.iMP.ClearOpponentTurn(true);
  47.             ClusterzL.OWMenuReiting[0][4] = ClusterzL.iGAME.prPlayerName + ClusterzL.strReiting2 + ClusterzL.iGAME.prScore.toString();
  48.             this.InitObject(ClusterzL.OWMenuReiting);
  49.          }
  50.          this.iTimer = getTimer();
  51.          if(ClusterzL.iMP.State != OMultiplayer.stInZone)
  52.          {
  53.             return;
  54.          }
  55.          _loc3_ = ClusterzL.iMP.prOpponentTurn;
  56.          ClusterzL.iMP.ClearOpponentTurn(true);
  57.          ClusterzL.iMP.Turn(["rdr"]);
  58.          if(!_loc3_)
  59.          {
  60.             return;
  61.          }
  62.          _loc4_ = _loc3_.split(/,/);
  63.          ClusterzL.OWMenuReiting[0][4] = (int(_loc4_[0]) + 1).toString() + ClusterzL.strReiting1 + _loc4_[1] + ClusterzL.strReiting2 + _loc4_[2];
  64.          this.InitObject(ClusterzL.OWMenuReiting);
  65.       }
  66.       
  67.       override public function set prVisible(param1:Boolean) : void
  68.       {
  69.          super.prVisible = param1;
  70.       }
  71.       
  72.       override public function Init() : void
  73.       {
  74.          ClusterzL.OWMenu[0][4] = ClusterzL.strWelcome + "   " + ClusterzL.iGAME.prPlayerName;
  75.          super.Init();
  76.       }
  77.       
  78.       override public function set prActive(param1:Boolean) : void
  79.       {
  80.          super.prActive = param1;
  81.       }
  82.       
  83.       override public function OnPress(param1:Event, param2:*) : void
  84.       {
  85.          if(param2 == this.iBName)
  86.          {
  87.             (this.parent as OWindow).OnPress(null,ClusterzL.miChoosePlayer);
  88.             this.prVisible = false;
  89.             return;
  90.          }
  91.          if(param2 == this.iPlayOnline)
  92.          {
  93.             (this.parent as OWindow).OnPress(null,ClusterzL.miPlayGame);
  94.             this.prVisible = false;
  95.             return;
  96.          }
  97.          if(param2 == this.iOptions)
  98.          {
  99.             (this.parent as OWindow).OnPress(null,ClusterzL.miOptions);
  100.             this.prActive = false;
  101.             return;
  102.          }
  103.          if(param2 == this.iInstructions)
  104.          {
  105.             (this.parent as OWindow).OnPress(null,ClusterzL.miInstructions);
  106.             this.prActive = false;
  107.             return;
  108.          }
  109.          if(param2 == this.iGHighScores)
  110.          {
  111.             (this.parent as OWindow).OnPress(null,ClusterzL.miGlobalScores);
  112.             this.prActive = false;
  113.             return;
  114.          }
  115.          (this.parent as OWindow).OnPress(null,ClusterzL.miCommingSoon);
  116.          this.prActive = false;
  117.       }
  118.       
  119.       override public function Free() : void
  120.       {
  121.          this.iBName = null;
  122.          this.iGameName = null;
  123.          this.iPlayOnline = null;
  124.          this.iOptions = null;
  125.          this.iInstructions = null;
  126.          this.iGHighScores = null;
  127.          this.InitObject(null);
  128.          super.Free();
  129.       }
  130.       
  131.       private function InitObject(param1:Array) : void
  132.       {
  133.          if(this.iInfo)
  134.          {
  135.             this.removeChild(this.iInfo);
  136.             this.iInfo.Free();
  137.             this.iInfo = null;
  138.          }
  139.          if(!param1)
  140.          {
  141.             return;
  142.          }
  143.          this.iInfo = new OIObject(param1,OInterface.iDefSlowAnimators);
  144.          this.addChild(this.iInfo);
  145.          this.iInfo.SetVisible(false);
  146.          this.iInfo.prVisible = true;
  147.       }
  148.       
  149.       override public function OnEnterFrame(param1:Event) : void
  150.       {
  151.          super.OnEnterFrame(param1);
  152.       }
  153.    }
  154. }
  155.