home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Esportes / CrossingCup.swf / scripts / __Packages / CTeamManager.as < prev    next >
Text File  |  2007-12-11  |  2KB  |  61 lines

  1. class CTeamManager
  2. {
  3.    function CTeamManager()
  4.    {
  5.       this.teams = new Array();
  6.       EventCenter.access().addEventListener("changeTeam",this);
  7.    }
  8.    function addTeam(id, flagid, teamname, shirtcolor1, pantscolor1, shirtcolor2, pantscolor2, goalie, cornerkicker, kicker)
  9.    {
  10.       var _loc2_ = new CTeam(id,flagid,teamname,shirtcolor1,pantscolor1,shirtcolor2,pantscolor2,goalie,cornerkicker,kicker);
  11.       this.teams.push(_loc2_);
  12.    }
  13.    function randomTeam2()
  14.    {
  15.       var _loc2_ = 0;
  16.       while(_loc2_ < 32)
  17.       {
  18.          var _loc3_ = Math.floor(Math.random() * 32);
  19.          var _loc4_ = undefined;
  20.          _loc4_ = this.teams[_loc2_];
  21.          this.teams[_loc2_] = this.teams[_loc3_];
  22.          this.teams[_loc3_] = _loc4_;
  23.          _loc2_ = _loc2_ + 1;
  24.       }
  25.    }
  26.    function randomTeam()
  27.    {
  28.       var _loc2_ = 0;
  29.       while(_loc2_ < 32)
  30.       {
  31.          var _loc3_ = Math.floor(Math.random() * 32);
  32.          var _loc4_ = undefined;
  33.          var _loc5_ = this.teams[_loc2_].id;
  34.          this.teams[_loc2_].id = this.teams[_loc3_].id;
  35.          this.teams[_loc3_].id = _loc5_;
  36.          _loc4_ = this.teams[_loc2_];
  37.          this.teams[_loc2_] = this.teams[_loc3_];
  38.          this.teams[_loc3_] = _loc4_;
  39.          _loc2_ = _loc2_ + 1;
  40.       }
  41.    }
  42.    function changeTeam(event)
  43.    {
  44.       this.currentTeam = this.teams[event.id - 1];
  45.       _global.__DISPATCH({type:"teamChanged"});
  46.    }
  47.    function getTeam()
  48.    {
  49.       return this.teams;
  50.    }
  51.    static function _buildInstance()
  52.    {
  53.       CTeamManager._oI = new CTeamManager();
  54.       return CTeamManager._oI;
  55.    }
  56.    static function ins()
  57.    {
  58.       return !(CTeamManager._oI instanceof CTeamManager) ? CTeamManager._buildInstance() : CTeamManager._oI;
  59.    }
  60. }
  61.