home *** CD-ROM | disk | FTP | other *** search
- class BagunkScores
- {
- var strFilePath;
- var loadVarObject;
- var xmlLoader;
- var intGameID;
- var strConnectionKey;
- var firstChild;
- function BagunkScores()
- {
- this.strFilePath = "http://www.bagunk.com/receiveScores.php";
- this.loadVarObject = new LoadVars();
- this.xmlLoader = new XML();
- }
- function SetGameID(id)
- {
- this.intGameID = id;
- }
- function SetCode(passwordString)
- {
- this.strConnectionKey = passwordString;
- }
- function SendScores(username, score)
- {
- var _loc3_ = new ScoreEncrypter(128,128);
- var _loc2_ = String(score);
- var _loc4_ = _loc3_.encrypt(_loc2_,this.strConnectionKey,"ECB");
- this.loadVarObject.name = username;
- this.loadVarObject.score = _loc4_;
- this.loadVarObject.gameID = this.intGameID;
- this.loadVarObject.pageMode = 1;
- this.loadVarObject.send(this.strFilePath,"_blank","POST");
- }
- function UserLogin(score)
- {
- var _loc3_ = new ScoreEncrypter(128,128);
- var _loc2_ = String(score);
- var _loc4_ = _loc3_.encrypt(_loc2_,this.strConnectionKey,"ECB");
- this.loadVarObject.gameID = this.intGameID;
- this.loadVarObject.score = _loc4_;
- this.loadVarObject.pageMode = 2;
- this.loadVarObject.send(this.strFilePath,"_blank","POST");
- }
- function GetScores()
- {
- var thisRef = this;
- this.xmlLoader.ignoreWhite = true;
- this.xmlLoader.onLoad = function(blnSuccess)
- {
- thisRef.scoreArray = new Array();
- if(blnSuccess)
- {
- var _loc11_ = this.firstChild.attributes.userProfilePage;
- var _loc12_ = this.firstChild.firstChild;
- if(_loc12_.attributes.blnSuccess == 0)
- {
- trace("Bagunk Scores Loading Failed!");
- }
- _loc12_ = _loc12_.nextSibling;
- var _loc2_ = _loc12_.firstChild;
- while(_loc2_)
- {
- var _loc5_ = _loc2_.attributes.username;
- var _loc4_ = _loc2_.attributes.verified;
- var _loc6_ = _loc2_.attributes.score;
- var _loc3_ = _loc11_ + _loc2_.attributes.userID;
- thisRef.scoreArray.push({username:_loc5_,verified:_loc4_,score:_loc6_,profileURL:_loc3_});
- _loc2_ = _loc2_.nextSibling;
- }
- thisRef.OnGetScoresCompleted(thisRef.scoreArray);
- }
- };
- this.xmlLoader.load("http://www.bagunk.com/sendScores.php?gameID=" + this.intGameID);
- }
- }
-