home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Puzzle / Clusterz / Clusterz.swf / scripts / RES / OBJECTS / ORecord.as < prev   
Encoding:
Text File  |  2008-09-12  |  3.4 KB  |  129 lines

  1. package RES.OBJECTS
  2. {
  3.    import ENGINE.CORE.OUtils;
  4.    
  5.    public class ORecord
  6.    {
  7.       
  8.       private static var iCount:int = 62;
  9.       
  10.       private static var sAlphabet:String;
  11.        
  12.       
  13.       private var iStr:String;
  14.       
  15.       private var iPos:int;
  16.       
  17.       private var iRecLen:int = 2;
  18.       
  19.       public function ORecord()
  20.       {
  21.          iRecLen = 2;
  22.          super();
  23.          this.iPos = -1;
  24.       }
  25.       
  26.       public static function CodeToInt(param1:String) : int
  27.       {
  28.          return sAlphabet.indexOf(param1.charAt(0)) * iCount + sAlphabet.indexOf(param1.charAt(1));
  29.       }
  30.       
  31.       public function WriteStart() : void
  32.       {
  33.          this.iStr = "";
  34.          this.iPos = 0;
  35.          sAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  36.       }
  37.       
  38.       public function ReadSmallInt() : int
  39.       {
  40.          var _loc1_:String = null;
  41.          if(this.iPos >= this.iStr.length)
  42.          {
  43.             return -1;
  44.          }
  45.          _loc1_ = this.iStr.substr(this.iPos,1);
  46.          ++this.iPos;
  47.          return sAlphabet.indexOf(_loc1_);
  48.       }
  49.       
  50.       public function ReadTime() : int
  51.       {
  52.          var _loc1_:String = null;
  53.          if(this.iPos >= this.iStr.length)
  54.          {
  55.             return -1;
  56.          }
  57.          _loc1_ = this.iStr.substr(this.iPos,2);
  58.          this.iPos += 2;
  59.          return int(_loc1_);
  60.       }
  61.       
  62.       public function ReadStart() : void
  63.       {
  64.          sAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  65.          this.iPos = 0;
  66.       }
  67.       
  68.       public function get prStr() : String
  69.       {
  70.          return this.iStr;
  71.       }
  72.       
  73.       private function IntToCode(param1:int) : String
  74.       {
  75.          var _loc2_:int = 0;
  76.          var _loc3_:int = 0;
  77.          var _loc4_:int = 0;
  78.          _loc2_ = param1 >= iCount * iCount ? iCount * iCount - 1 : param1;
  79.          _loc3_ = _loc2_ % iCount;
  80.          _loc4_ = (_loc2_ - _loc3_) / iCount % iCount;
  81.          return sAlphabet.charAt(_loc4_) + sAlphabet.charAt(_loc3_);
  82.       }
  83.       
  84.       public function ReadFall() : Boolean
  85.       {
  86.          var _loc1_:String = null;
  87.          if(this.iPos >= this.iStr.length)
  88.          {
  89.             return false;
  90.          }
  91.          _loc1_ = this.iStr.substr(this.iPos,1);
  92.          ++this.iPos;
  93.          return int(_loc1_) == 1 ? true : false;
  94.       }
  95.       
  96.       public function WriteNode(param1:int, param2:int, param3:int, param4:int, param5:Boolean, param6:int, param7:int) : void
  97.       {
  98.          if(this.iPos < 0)
  99.          {
  100.             return;
  101.          }
  102.          this.iStr += OUtils.AddZero(param3.toString(),2);
  103.          this.iStr += IntToCode(param1);
  104.          this.iStr += IntToCode(param2);
  105.          this.iStr += sAlphabet.substr(param4,1);
  106.          this.iStr += (param5 ? 1 : 0).toString();
  107.          this.iStr += sAlphabet.substr(param6,1);
  108.          this.iStr += sAlphabet.substr(param7,1);
  109.       }
  110.       
  111.       public function set prStr(param1:String) : void
  112.       {
  113.          this.iStr = param1;
  114.       }
  115.       
  116.       public function ReadCoord() : int
  117.       {
  118.          var _loc1_:String = null;
  119.          if(this.iPos >= this.iStr.length)
  120.          {
  121.             return -1;
  122.          }
  123.          _loc1_ = this.iStr.substr(this.iPos,2);
  124.          this.iPos += 2;
  125.          return CodeToInt(_loc1_);
  126.       }
  127.    }
  128. }
  129.