home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 148 / MOBICLIC148.ISO / mac / DATA / DSS148 / DSS148_00 / DSS148_00.swf / scripts / dss148_00 / CapsuleAlgo.as
Text File  |  2012-10-16  |  8KB  |  231 lines

  1. package dss148_00
  2. {
  3.    import com.milanpresse.engine.Engine;
  4.    import com.milanpresse.engine.initmovieclip.InteractiveMovie;
  5.    import com.milanpresse.engine.managers.PauseManager;
  6.    import com.milanpresse.engine.managers.TimelineManager;
  7.    import com.milanpresse.engine.medias.MediaSwf;
  8.    import com.milanpresse.engine.timelines.Timeline;
  9.    import com.milanpresse.engine.timelines.TimelineLinear;
  10.    import com.milanpresse.engineaddons.facades.EngineExt;
  11.    import com.milanpresse.engineaddons.initdisplayobject.ExtendedClip;
  12.    import com.milanpresse.tools.debug.TestBox;
  13.    import dss148.Commun;
  14.    import flash.display.MovieClip;
  15.    import flash.net.SharedObject;
  16.    
  17.    public class CapsuleAlgo
  18.    {
  19.        
  20.       
  21.       private var menu:MediaSwf;
  22.       
  23.       private var menuTimeline:MovieClip;
  24.       
  25.       private var menuTL:Timeline;
  26.       
  27.       private var mainClip:MediaSwf;
  28.       
  29.       private var mainTimeline:MovieClip;
  30.       
  31.       public var _engine:Engine;
  32.       
  33.       public var _e:EngineExt;
  34.       
  35.       private var labelList:Array;
  36.       
  37.       private var _timeline_:TimelineLinear;
  38.       
  39.       public var _timelineManager:TimelineManager;
  40.       
  41.       private var _pauseManager:PauseManager;
  42.       
  43.       private var labelsCallback:Object;
  44.       
  45.       private var firstLabel:String;
  46.       
  47.       private var so:SharedObject;
  48.       
  49.       private var goLabelATTENTE:String;
  50.       
  51.       private var BT_ZAP_INTRO:InteractiveMovie;
  52.       
  53.       private var zapIntroDone:Boolean = false;
  54.       
  55.       private var gClic:int;
  56.       
  57.       private var gRoll:MovieClip;
  58.       
  59.       private var gListDone:Array;
  60.       
  61.       private var gDoneMythe:Boolean = false;
  62.       
  63.       private var gFromNumMod:int;
  64.       
  65.       private var TRANSITION:InteractiveMovie;
  66.       
  67.       private var gImageNum:int;
  68.       
  69.       private var playedDER_EPR:Boolean = false;
  70.       
  71.       private var _commun:Commun;
  72.       
  73.       private var testBox:TestBox;
  74.       
  75.       private var choixPartie:ExtendedClip;
  76.       
  77.       public function CapsuleAlgo(param1:Engine, param2:Commun)
  78.       {
  79.          var btn:ExtendedClip = null;
  80.          var engine:Engine = param1;
  81.          var commun:Commun = param2;
  82.          this.labelsCallback = {};
  83.          super();
  84.          this._engine = engine;
  85.          this._engine.playMusic({"code":"MU"});
  86.          this._engine.setSubtitles(this._engine.host.subtitlesOn);
  87.          this._engine.setFrameRate(12);
  88.          this._engine.levelCZ = this._engine.config.layers["top"];
  89.          this._timelineManager = new TimelineManager();
  90.          this._e = new EngineExt(this._engine,this._timelineManager);
  91.          this._commun = commun;
  92.          this._commun.init(this);
  93.          if(this._commun.memo.savePoint.moduleNum == 0 && this._commun.memo.savePoint.status == "NEW_GAME")
  94.          {
  95.             this.mainClip = this._engine.showSwf({
  96.                "code":"A_" + this._engine.config.moduleName,
  97.                "parent":this._engine.config.layers["content"]
  98.             });
  99.             this.mainTimeline = this.mainClip.swfContent;
  100.             this._timeline_ = new TimelineLinear(this.mainTimeline,this._engine,this,this._timelineManager,this.labelsCallback);
  101.             this._timeline_.GotoAndStop(1);
  102.             this.mainTimeline.visible = false;
  103.          }
  104.          this.testBox = new TestBox(this._engine);
  105.          this.testBox.buttons = [{
  106.             "name":"CHOIX",
  107.             "label":"Aller au CHOIX"
  108.          }];
  109.          this.testBox.onClick = function(param1:String):void
  110.          {
  111.             switch(param1)
  112.             {
  113.                case "CHOIX":
  114.                   _engine.stopComment();
  115.                   if(mainTimeline != null)
  116.                   {
  117.                      mainTimeline.visible = false;
  118.                      _timeline_.GotoAndStop(1);
  119.                   }
  120.                   _commun.memo.savePoint = {"status":"CHOIX"};
  121.                   _commun.memo.save();
  122.                   _commun.ecranChoixShow();
  123.             }
  124.          };
  125.          this.testBox.visible = false;
  126.          if(this._commun.memo.savePoint.moduleNum == 0 && this._commun.memo.savePoint.status == "NEW_GAME")
  127.          {
  128.             if(this.mainTimeline != null)
  129.             {
  130.                this._timeline_.GotoAndPlayUntil({"labelStop":"WAIT_zanim01"});
  131.                this.mainTimeline.visible = true;
  132.             }
  133.          }
  134.          else
  135.          {
  136.             this.choixPartie = new ExtendedClip(this._engine.showSwf({
  137.                "code":"A_" + this._e.config.rubriqueName + "_MEMO",
  138.                "parent":this._engine.config.layers["content"]
  139.             }).swfContent as MovieClip,this._e);
  140.             this.choixPartie.gotoAndStop("ATTENTE");
  141.             this.choixPartie.movie.mouseChildren = true;
  142.             this.choixPartie.movie.useHandCursor = false;
  143.             btn = new ExtendedClip(this.choixPartie.getChildByName("BT_NEW") as MovieClip,this._e);
  144.             btn.onRollOverState = {
  145.                "label":"E2",
  146.                "noiseCode":"B_NEW"
  147.             };
  148.             btn.onRollOutState = {"label":"E1"};
  149.             btn.timeline = new Timeline(btn.movie,this._timelineManager,this._engine);
  150.             btn.onPress = function():void
  151.             {
  152.                this.enabled = false;
  153.                _e.noisePlay({"code":"B_CLIC"});
  154.                _commun.memo.clear();
  155.                this.timeline.GotoAndPlayUntil({
  156.                   "labelPlay":"E3",
  157.                   "beforelabelStop":"FIN",
  158.                   "callback":function():void
  159.                   {
  160.                      _engine.host.changeModule({"numMod":0});
  161.                   }
  162.                });
  163.             };
  164.             btn.init();
  165.             btn.enabled = true;
  166.             btn = new ExtendedClip(this.choixPartie.getChildByName("BT_REPRISE") as MovieClip,this._e);
  167.             btn.onRollOverState = {
  168.                "label":"E2",
  169.                "noiseCode":"B_REP"
  170.             };
  171.             btn.onRollOutState = {"label":"E1"};
  172.             btn.timeline = new Timeline(btn.movie,this._timelineManager,this._engine);
  173.             btn.onPress = function():void
  174.             {
  175.                this.enabled = false;
  176.                _e.noisePlay({"code":"B_CLIC"});
  177.                this.timeline.GotoAndPlayUntil({
  178.                   "labelPlay":"E3",
  179.                   "beforelabelStop":"FIN",
  180.                   "callback":function():void
  181.                   {
  182.                      if(_commun.memo.nbModulesFinished >= 5)
  183.                      {
  184.                         _engine.host.changeModule({"numMod":5});
  185.                      }
  186.                      else if(_commun.memo.savePoint.moduleNum != 0 && _commun.memo.modules[_commun.memo.savePoint.moduleNum].vu == false)
  187.                      {
  188.                         _engine.host.changeModule({"numMod":_commun.memo.savePoint.moduleNum});
  189.                      }
  190.                      else
  191.                      {
  192.                         choixPartie.visible = false;
  193.                         _commun.ecranChoixShow();
  194.                      }
  195.                   }
  196.                });
  197.             };
  198.             btn.init();
  199.             btn.enabled = true;
  200.          }
  201.       }
  202.       
  203.       public function endMODULE() : void
  204.       {
  205.          this._commun.memo.savePoint = {"status":"CHOIX"};
  206.          this._commun.memo.save();
  207.          this._commun.ecranChoixShow();
  208.       }
  209.       
  210.       public function sleep() : void
  211.       {
  212.          this._pauseManager = new PauseManager(this._engine,this._timelineManager);
  213.          this._pauseManager.sleepMovie(this._engine.config.scene);
  214.       }
  215.       
  216.       public function wake() : void
  217.       {
  218.          if(this._pauseManager != null)
  219.          {
  220.             this._pauseManager.wakeMovie(this._engine.config.scene);
  221.          }
  222.       }
  223.       
  224.       public function destroy() : void
  225.       {
  226.          this._engine.stopAllSounds();
  227.          this._timeline_.kilListeners();
  228.       }
  229.    }
  230. }
  231.