home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / Interface.as < prev    next >
Encoding:
Text File  |  2013-04-24  |  2.4 KB  |  90 lines

  1. class Interface extends State
  2. {
  3.    var bTimePaused;
  4.    var sState;
  5.    var mcRef;
  6.    static var sSTATE_IDLE = "Idle";
  7.    static var sSTATE_SHOW = "ShowScreen";
  8.    function Interface(_mcRef)
  9.    {
  10.       super(_mcRef);
  11.       CTRLGame.getRef().modifyTime(LD.getSongsMax(CTRLGame.getRef().Level));
  12.       this.bTimePaused = false;
  13.       this.setState(Interface.sSTATE_IDLE);
  14.    }
  15.    function doShow()
  16.    {
  17.       if(this.sState == Interface.sSTATE_IDLE)
  18.       {
  19.          this.setState(Interface.sSTATE_SHOW);
  20.          CTRLGame.getRef().modifyTime(LD.getSongsMax(CTRLGame.getRef().Level));
  21.          this.mcRef.btnMenu.onRollOver = Delegate.create(Main.getRef(),Main.getRef().rollOverButton);
  22.          this.mcRef.btnMenu.onRelease = Delegate.create(Main.getRef(),Main.getRef().clickMenuButton);
  23.          this.setScoreValue(CTRLGame.getRef().Score);
  24.       }
  25.    }
  26.    function doHide()
  27.    {
  28.       if(this.sState != Interface.sSTATE_IDLE)
  29.       {
  30.          this.setState(Interface.sSTATE_IDLE);
  31.       }
  32.    }
  33.    function setScoreValue(_nScore)
  34.    {
  35.       if(this.sState == Interface.sSTATE_SHOW)
  36.       {
  37.          this.mcRef.txtScore.text = Utils.styleNumber(_nScore);
  38.       }
  39.    }
  40.    function doPause()
  41.    {
  42.    }
  43.    function doUnPause()
  44.    {
  45.    }
  46.    function pauseTime()
  47.    {
  48.       this.bTimePaused = true;
  49.    }
  50.    function unPauseTime()
  51.    {
  52.       this.bTimePaused = false;
  53.    }
  54.    function setToLife(_nValue)
  55.    {
  56.       CTRLGame.getRef().modifyTime(CTRLGame.getRef().Songs + _nValue);
  57.       if(CTRLGame.getRef().Songs < 0)
  58.       {
  59.          CTRLGame.getRef().modifyTime(0);
  60.       }
  61.       else if(CTRLGame.getRef().Songs > LD.getSongsMax(CTRLGame.getRef().Level))
  62.       {
  63.          CTRLGame.getRef().modifyTime(LD.getSongsMax(CTRLGame.getRef().Level));
  64.       }
  65.    }
  66.    function Idle()
  67.    {
  68.    }
  69.    function ShowScreen()
  70.    {
  71.       if(!Controller.getRef().isPaused() && !this.bTimePaused)
  72.       {
  73.          if(CTRLGame.getRef().Songs > 0)
  74.          {
  75.             CTRLGame.getRef().modifyTime(CTRLGame.getRef().Songs - 1);
  76.          }
  77.          else
  78.          {
  79.             Main.getRef().loseGame();
  80.          }
  81.       }
  82.       var _loc2_ = this.mcRef.mcSongs._totalframes - Math.round(CTRLGame.getRef().Songs / LD.getSongsMax(CTRLGame.getRef().Level) * 100);
  83.       if(_loc2_ <= 0)
  84.       {
  85.          _loc2_ = 1;
  86.       }
  87.       this.mcRef.mcSongs.gotoAndStop(_loc2_);
  88.    }
  89. }
  90.