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

  1. package RES.WINDOWS
  2. {
  3.    import ENGINE.INTERFACE.OButton;
  4.    import ENGINE.INTERFACE.ODialog;
  5.    import ENGINE.INTERFACE.OListBox;
  6.    import ENGINE.INTERFACE.OWindow;
  7.    import flash.events.Event;
  8.    
  9.    public class OWChoosePlayer extends ODialog
  10.    {
  11.        
  12.       
  13.       public var iCancel:OButton;
  14.       
  15.       public var iDelete:OButton;
  16.       
  17.       public var iNew:OButton;
  18.       
  19.       public var iListBox:OListBox;
  20.       
  21.       public var iAccept:OButton;
  22.       
  23.       private var iData:*;
  24.       
  25.       private var iCurPlayer:String;
  26.       
  27.       public function OWChoosePlayer()
  28.       {
  29.          super(ClusterzL.OWChoosePlayer);
  30.       }
  31.       
  32.       override public function Init() : void
  33.       {
  34.          super.Init();
  35.          this.iData = ClusterzL.iGAME.prPlayersData;
  36.          this.iCurPlayer = ClusterzL.iGAME.prPlayerName;
  37.          this.iListBox.SetCurrentElement(ClusterzL.iGAME.prPlayerName,ClusterzL.iGAME.prPlayerNames);
  38.       }
  39.       
  40.       override public function set prActive(param1:Boolean) : void
  41.       {
  42.          if(param1)
  43.          {
  44.             this.iListBox.SetCurrentElement(ClusterzL.iGAME.prPlayerName,ClusterzL.iGAME.prPlayerNames);
  45.          }
  46.          super.prActive = param1;
  47.       }
  48.       
  49.       override public function OnPress(param1:Event, param2:*) : void
  50.       {
  51.          if(!this.prMouseEnabled)
  52.          {
  53.             return;
  54.          }
  55.          if(param2 == this.iNew)
  56.          {
  57.             (this.parent as OWindow).OnPress(null,ClusterzL.miEnterNewName);
  58.             this.prActive = false;
  59.             return;
  60.          }
  61.          if(param2 == this.iDelete)
  62.          {
  63.             (this.parent as OWindow).OnPress(null,ClusterzL.miDeletePlayerConfirm);
  64.             this.prActive = false;
  65.             return;
  66.          }
  67.          if(param2 == this.iCancel)
  68.          {
  69.             ClusterzL.iGAME.prPlayersData = this.iData;
  70.             ClusterzL.iGAME.prPlayerName = this.iCurPlayer;
  71.             (this.parent as OWindow).OnPress(null,ClusterzL.miMenu);
  72.             this.prVisible = false;
  73.             return;
  74.          }
  75.          if(param2 == this.iAccept)
  76.          {
  77.             if(ClusterzL.iMP.isConnected)
  78.             {
  79.                ClusterzL.iMP.disconnect();
  80.             }
  81.             (this.parent as OWindow).OnPress(null,ClusterzL.miMenu);
  82.             this.prVisible = false;
  83.             return;
  84.          }
  85.          if(param2 == this.iListBox && ClusterzL.iGAME.prPlayerName != this.iListBox.prCurrentLBParam)
  86.          {
  87.             ClusterzL.iGAME.prPlayerName = this.iListBox.prCurrentLBParam;
  88.             return;
  89.          }
  90.       }
  91.       
  92.       override public function Free() : void
  93.       {
  94.          this.iListBox = null;
  95.          this.iNew = null;
  96.          this.iDelete = null;
  97.          this.iAccept = null;
  98.          this.iCancel = null;
  99.          super.Free();
  100.       }
  101.    }
  102. }
  103.