home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / lightsprites.swf / scripts / __Packages / BagunkScores.as next >
Encoding:
Text File  |  2007-09-27  |  2.5 KB  |  76 lines

  1. class BagunkScores
  2. {
  3.    var strFilePath;
  4.    var loadVarObject;
  5.    var xmlLoader;
  6.    var intGameID;
  7.    var strConnectionKey;
  8.    var firstChild;
  9.    function BagunkScores()
  10.    {
  11.       this.strFilePath = "http://www.bagunk.com/receiveScores.php";
  12.       this.loadVarObject = new LoadVars();
  13.       this.xmlLoader = new XML();
  14.    }
  15.    function SetGameID(id)
  16.    {
  17.       this.intGameID = id;
  18.    }
  19.    function SetCode(passwordString)
  20.    {
  21.       this.strConnectionKey = passwordString;
  22.    }
  23.    function SendScores(username, score)
  24.    {
  25.       var _loc3_ = new ScoreEncrypter(128,128);
  26.       var _loc2_ = String(score);
  27.       var _loc4_ = _loc3_.encrypt(_loc2_,this.strConnectionKey,"ECB");
  28.       this.loadVarObject.name = username;
  29.       this.loadVarObject.score = _loc4_;
  30.       this.loadVarObject.gameID = this.intGameID;
  31.       this.loadVarObject.pageMode = 1;
  32.       this.loadVarObject.send(this.strFilePath,"_blank","POST");
  33.    }
  34.    function UserLogin(score)
  35.    {
  36.       var _loc3_ = new ScoreEncrypter(128,128);
  37.       var _loc2_ = String(score);
  38.       var _loc4_ = _loc3_.encrypt(_loc2_,this.strConnectionKey,"ECB");
  39.       this.loadVarObject.gameID = this.intGameID;
  40.       this.loadVarObject.score = _loc4_;
  41.       this.loadVarObject.pageMode = 2;
  42.       this.loadVarObject.send(this.strFilePath,"_blank","POST");
  43.    }
  44.    function GetScores()
  45.    {
  46.       var thisRef = this;
  47.       this.xmlLoader.ignoreWhite = true;
  48.       this.xmlLoader.onLoad = function(blnSuccess)
  49.       {
  50.          thisRef.scoreArray = new Array();
  51.          if(blnSuccess)
  52.          {
  53.             var _loc11_ = this.firstChild.attributes.userProfilePage;
  54.             var _loc12_ = this.firstChild.firstChild;
  55.             if(_loc12_.attributes.blnSuccess == 0)
  56.             {
  57.                trace("Bagunk Scores Loading Failed!");
  58.             }
  59.             _loc12_ = _loc12_.nextSibling;
  60.             var _loc2_ = _loc12_.firstChild;
  61.             while(_loc2_)
  62.             {
  63.                var _loc5_ = _loc2_.attributes.username;
  64.                var _loc4_ = _loc2_.attributes.verified;
  65.                var _loc6_ = _loc2_.attributes.score;
  66.                var _loc3_ = _loc11_ + _loc2_.attributes.userID;
  67.                thisRef.scoreArray.push({username:_loc5_,verified:_loc4_,score:_loc6_,profileURL:_loc3_});
  68.                _loc2_ = _loc2_.nextSibling;
  69.             }
  70.             thisRef.OnGetScoresCompleted(thisRef.scoreArray);
  71.          }
  72.       };
  73.       this.xmlLoader.load("http://www.bagunk.com/sendScores.php?gameID=" + this.intGameID);
  74.    }
  75. }
  76.