home *** CD-ROM | disk | FTP | other *** search
/ Champak 48 / cdrom_image.iso / Games / breakawish.swf / scripts / __Packages / NickHS.as < prev    next >
Encoding:
Text File  |  2007-09-28  |  4.0 KB  |  154 lines

  1. class NickHS
  2. {
  3.    var bHSAvailable;
  4.    var G_TestHighScore;
  5.    var bSubmitHS;
  6.    var bGetHS;
  7.    var G_GameID;
  8.    var mcHSZone;
  9.    var G_NoTxtField;
  10.    var G_NameTxtField;
  11.    var G_ScoreTxtField;
  12.    static var oNickHS;
  13.    function NickHS(_sGameID, _bHSAvailable, _bTestHighScore)
  14.    {
  15.       this.bHSAvailable = _bHSAvailable;
  16.       this.G_TestHighScore = _bTestHighScore;
  17.       this.bSubmitHS = false;
  18.       this.bGetHS = false;
  19.       this.G_GameID = _sGameID;
  20.       this.mcHSZone = undefined;
  21.       this.initHiScores();
  22.       if(this.G_TestHighScore == true)
  23.       {
  24.          _global.gProxyObj.setServer("www.nick.com");
  25.          _global.gProxyObj.setScreenName("SbkRR");
  26.          _global.gProxyObj.setIsLoggedIn(true);
  27.       }
  28.       NickHS.oNickHS = this;
  29.    }
  30.    function doHSInit()
  31.    {
  32.       this.initHiScores();
  33.    }
  34.    function doSubmitHS()
  35.    {
  36.       this.bSubmitHS = true;
  37.    }
  38.    function doViewHS()
  39.    {
  40.       this.bGetHS = true;
  41.    }
  42.    function setHSBoard(_mcRef)
  43.    {
  44.       this.mcHSZone = _mcRef;
  45.       this.G_NoTxtField = this.mcHSZone.txtHSNumber;
  46.       this.G_NameTxtField = this.mcHSZone.txtHSName;
  47.       this.G_ScoreTxtField = this.mcHSZone.txtHSScore;
  48.    }
  49.    static function get Instance()
  50.    {
  51.       return NickHS.oNickHS;
  52.    }
  53.    function getIsLoggedIn()
  54.    {
  55.       var _loc2_ = true;
  56.       if(_global.gProxyObj != undefined)
  57.       {
  58.          _loc2_ = _global.gProxyObj.getIsLoggedIn();
  59.       }
  60.       return _loc2_;
  61.    }
  62.    function getScores()
  63.    {
  64.       if(_global.gProxyObj == undefined)
  65.       {
  66.          this.listScores();
  67.       }
  68.       else
  69.       {
  70.          _global.gProxyObj.getScores(this.cbFunc2);
  71.       }
  72.    }
  73.    function submitScore(theScore)
  74.    {
  75.       this.G_NoTxtField.text = "";
  76.       this.G_NameTxtField.text = "The high score list is updating!";
  77.       this.G_ScoreTxtField.text = "";
  78.       _global.gProxyObj.submitScore(theScore,this.cbFunc);
  79.       _global.ipbSend();
  80.    }
  81.    function initHiScores()
  82.    {
  83.       _global.gProxyObj.setGame_Id(this.G_GameID);
  84.    }
  85.    function getScoreString()
  86.    {
  87.       var _loc11_ = "Oops! The high score list is not available right now!";
  88.       if(_global.gProxyObj != undefined)
  89.       {
  90.          var _loc10_ = _global.gProxyObj.getScoreCount();
  91.          if(_loc10_ > 0)
  92.          {
  93.             var _loc3_ = undefined;
  94.             var _loc4_ = undefined;
  95.             var _loc9_ = undefined;
  96.             var _loc8_ = undefined;
  97.             _loc11_ = "";
  98.             var _loc5_ = "";
  99.             var _loc6_ = "";
  100.             var _loc7_ = "";
  101.             _loc3_ = 0;
  102.             while(_loc3_ < _loc10_)
  103.             {
  104.                _loc4_ = _global.gProxyObj.getScoreItem(_loc3_);
  105.                _loc9_ = _loc4_[0];
  106.                _loc8_ = Library.Utils.Tools.returnFormatedNumber(_loc4_[1]);
  107.                _loc5_ += _loc3_ + 1 + "\n";
  108.                _loc6_ += _loc9_ + "\n";
  109.                _loc7_ += _loc8_ + " pts" + "\n";
  110.                _loc3_ = _loc3_ + 1;
  111.             }
  112.             this.G_NoTxtField.text = _loc5_;
  113.             this.G_NameTxtField.text = _loc6_;
  114.             this.G_ScoreTxtField.text = _loc7_;
  115.          }
  116.          else
  117.          {
  118.             this.G_NameTxtField.text = "Oops! The high score list is not available right now!";
  119.          }
  120.       }
  121.       else
  122.       {
  123.          this.G_NameTxtField.text = "Oops! The high score list is not available right now!";
  124.       }
  125.       return _loc11_;
  126.    }
  127.    function listScores()
  128.    {
  129.       this.getScoreString();
  130.    }
  131.    function cbFunc(thisBool)
  132.    {
  133.       if(thisBool)
  134.       {
  135.          NickHS.Instance.listScores();
  136.       }
  137.       else
  138.       {
  139.          NickHS.Instance.G_NameTxtField.text = "Oops! The high score list is not available right now!";
  140.       }
  141.    }
  142.    function cbFunc2(thisBool)
  143.    {
  144.       if(thisBool)
  145.       {
  146.          NickHS.Instance.listScores();
  147.       }
  148.       else
  149.       {
  150.          NickHS.Instance.G_NameTxtField.text = "Oops! The high score list is not available right now!";
  151.       }
  152.    }
  153. }
  154.