home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 161 / MOBICLIC161.ISO / pc / DATA / DSS161 / DSS161_00 / DSS161_00.swf / scripts / dss161_00 / CapsuleAlgo.as < prev    next >
Text File  |  2014-01-15  |  11KB  |  318 lines

  1. package dss161_00
  2. {
  3.    import com.milanpresse.engine.managers.PauseManager;
  4.    import dss161.engineaddons.facades.GameEngine;
  5.    import dss161.engineaddons.gamesprotos.Actor;
  6.    import dss161.engineaddons.gamesprotos.actors.actorClip.ActorClip;
  7.    
  8.    public class CapsuleAlgo
  9.    {
  10.        
  11.       
  12.       private var game:GameEngine;
  13.       
  14.       private var mainTimeline:ActorClip;
  15.       
  16.       protected var currentLabelActorGroup:Actor;
  17.       
  18.       private var memoClip:MemoClip;
  19.       
  20.       private var testBox:TestBox;
  21.       
  22.       private var actor:Actor;
  23.       
  24.       private var actorClip:ActorClip;
  25.       
  26.       private var comeFromGame:Boolean = false;
  27.       
  28.       private var _pauseManager_:PauseManager;
  29.       
  30.       private var contentIsSleeping:Boolean = false;
  31.       
  32.       public var toWake:Array;
  33.       
  34.       public function CapsuleAlgo()
  35.       {
  36.          this.toWake = [];
  37.          super();
  38.          this.game = Actor.game;
  39.          this.game.framerate = 24;
  40.          this.game.levelCZ = this.game.config.layers.content;
  41.          this.game.moduleConfig = new ModuleConfig(this.game.config.XmlConfig.Module.Config.Params);
  42.          this.game.memo.clear("MODULE");
  43.          this.testBox = new TestBox(this.game,this);
  44.          this.testBox.visible = false;
  45.          this.currentLabelActorGroup = this.game.addActor(new Actor(this.game));
  46.          this.currentLabelActorGroup.name = "currentLabelActorGroup";
  47.       }
  48.       
  49.       public function start() : void
  50.       {
  51.          var memoClip:MemoClip = null;
  52.          this.game.playMusic({"code":"MU"});
  53.          var savePoint:Object = this.game.memo.getValue("RUBRIQUE.savePoint",{
  54.             "mod":0,
  55.             "step":"INTRO"
  56.          });
  57.          if(savePoint.mod == 0 && savePoint.step == "INTRO")
  58.          {
  59.             this.showMainTimeline();
  60.             this.mainTimeline.gotoAndPlay("firstLabel");
  61.          }
  62.          else
  63.          {
  64.             memoClip = this.game.addActor({
  65.                "type":MemoClip,
  66.                "name":"memoClip",
  67.                "onNew":function():void
  68.                {
  69.                   game.memo.clear("RUBRIQUE");
  70.                   game.changeModule({"numMod":0});
  71.                },
  72.                "onContinue":function():void
  73.                {
  74.                   var _loc1_:* = game.memo.getValue("RUBRIQUE.savePoint",{
  75.                      "mod":0,
  76.                      "step":"INTRO"
  77.                   });
  78.                   if(_loc1_.mod == 0)
  79.                   {
  80.                      showMainTimeline();
  81.                      switch(_loc1_.step)
  82.                      {
  83.                         case "INTRO_JEU_PLANCHE":
  84.                            mainTimeline.gotoAndPlay("_JEU_01_INTRO_1");
  85.                            break;
  86.                         case "FIN_JEU_PLANCHE":
  87.                            mainTimeline.gotoAndPlay("_13");
  88.                            break;
  89.                         case "INTRO_JEU_INDICES":
  90.                            mainTimeline.gotoAndPlay("_JEU_02_INTRO");
  91.                            break;
  92.                         case "FIN_JEU_INDICES":
  93.                            mainTimeline.gotoAndPlay("_23");
  94.                      }
  95.                   }
  96.                   else
  97.                   {
  98.                      game.changeModule({"numMod":_loc1_.mod});
  99.                   }
  100.                }
  101.             });
  102.          }
  103.          Performer.dico[this.mainTimeline] = "maintimeline";
  104.          Performer.dico[memoClip] = "memoClip";
  105.       }
  106.       
  107.       private function showMainTimeline() : void
  108.       {
  109.          this.mainTimeline = this.game.addActor({
  110.             "code":"A_" + this.game.config.moduleName,
  111.             "parent":this.game.config.layers.content
  112.          });
  113.          this.mainTimeline.labelATTENTE_01 = this.mainTimeline.label_JEU_01_INTRO_1 = function(param1:* = null):void
  114.          {
  115.             var result:* = param1;
  116.             game.memo.setValue("RUBRIQUE.savePoint.step","INTRO_JEU_PLANCHE");
  117.             var attente:* = currentLabelActorGroup.addActor({
  118.                "type":ATTENTE_01,
  119.                "container":mainTimeline,
  120.                "onEvent":function(param1:* = null):void
  121.                {
  122.                   var result:* = param1;
  123.                   if(result == "zap")
  124.                   {
  125.                      mainTimeline.gotoAndStop("_JEU_01_ZAP",{"labelLastCallback":function():void
  126.                      {
  127.                         mainTimeline.gotoAndPlay("WAIT_zanim14");
  128.                      }});
  129.                   }
  130.                   else if(game.memo.getValue("MODULE.jeuplanche1",false))
  131.                   {
  132.                      mainTimeline.gotoAndStop("ATTENTE_02");
  133.                   }
  134.                   else
  135.                   {
  136.                      game.memo.setValue("MODULE.jeuplanche1",true);
  137.                      mainTimeline.gotoAndPlay("_JEU_PLANCHE_01");
  138.                   }
  139.                }
  140.             });
  141.             attente.name = "ATTENTE";
  142.          };
  143.          this.mainTimeline.label_JEU_PLANCHE_01 = this.mainTimeline.label_JEU_PLANCHE_02 = this.mainTimeline.label_JEU_PLANCHE_03 = this.mainTimeline.labelATTENTE_02 = function(param1:* = null):void
  144.          {
  145.             var result:* = param1;
  146.             var attente:* = currentLabelActorGroup.addActor({
  147.                "type":JEU_PLANCHE,
  148.                "container":mainTimeline,
  149.                "onEvent":function(param1:* = null):void
  150.                {
  151.                   if(game.numCaptures < 10)
  152.                   {
  153.                      mainTimeline.gotoAndStop("ATTENTE_01");
  154.                   }
  155.                   else
  156.                   {
  157.                      game.memo.setValue("RUBRIQUE.savePoint.step","FIN_JEU_PLANCHE");
  158.                      mainTimeline.gotoAndPlay("_13");
  159.                   }
  160.                }
  161.             });
  162.          };
  163.          this.mainTimeline.labelATTENTE_03 = this.mainTimeline.label_JEU_02_INTRO = function(param1:* = null):void
  164.          {
  165.             var result:* = param1;
  166.             game.memo.setValue("RUBRIQUE.savePoint.step","INTRO_JEU_INDICES");
  167.             var attente:* = currentLabelActorGroup.addActor({
  168.                "type":ATTENTE_03,
  169.                "container":mainTimeline,
  170.                "onEvent":function(param1:* = null):void
  171.                {
  172.                   var result:* = param1;
  173.                   if(result == "zap")
  174.                   {
  175.                      game.memo.setValue("RUBRIQUE.savePoint.step","FIN_JEU_INDICES");
  176.                      mainTimeline.gotoAndPlay("_JEU_02_ZONE_01");
  177.                      return;
  178.                   }
  179.                   mainTimeline.gotoAndStop("_JEU_02_ZONE_0" + result,{"labelLastCallback":function():void
  180.                   {
  181.                      var _loc1_:* = 0;
  182.                      var _loc2_:* = 1;
  183.                      while(_loc2_ <= 5)
  184.                      {
  185.                         if(game.memo.getValue("MODULE.zone" + _loc2_,false))
  186.                         {
  187.                            _loc1_++;
  188.                         }
  189.                         _loc2_++;
  190.                      }
  191.                      if(_loc1_ < 5)
  192.                      {
  193.                         mainTimeline.gotoAndStop("ATTENTE_03");
  194.                      }
  195.                      else
  196.                      {
  197.                         game.memo.setValue("RUBRIQUE.savePoint.step","FIN_JEU_INDICES");
  198.                         mainTimeline.gotoAndPlay("_23");
  199.                      }
  200.                   }});
  201.                }
  202.             });
  203.          };
  204.          this.mainTimeline.onLabelExit = function(param1:* = null):void
  205.          {
  206.             currentLabelActorGroup.destroyChildren();
  207.          };
  208.          this.mainTimeline.endMODULE = this.endMODULE;
  209.       }
  210.       
  211.       public function restart() : void
  212.       {
  213.          this.game.memo.clear("MODULE");
  214.          this.mainTimeline.gotoAndPlay("firstLabel");
  215.       }
  216.       
  217.       public function endMODULE() : void
  218.       {
  219.          this.game.memo.setValue("RUBRIQUE.savePoint",{"mod":1});
  220.          this.game.changeModule({"numMod":1});
  221.       }
  222.       
  223.       public function sleep() : void
  224.       {
  225.          this.toWake = [];
  226.       }
  227.       
  228.       public function wake() : void
  229.       {
  230.          var _loc1_:int = 0;
  231.          while(_loc1_ < this.toWake.length)
  232.          {
  233.             this.toWake[_loc1_]();
  234.             _loc1_++;
  235.          }
  236.       }
  237.       
  238.       public function destroy() : void
  239.       {
  240.          var _loc1_:* = undefined;
  241.          this.currentLabelActorGroup.destroy();
  242.          this.currentLabelActorGroup = null;
  243.          for(_loc1_ in this.mainTimeline)
  244.          {
  245.             if(this.mainTimeline[_loc1_] is Function)
  246.             {
  247.                this.mainTimeline[_loc1_] = null;
  248.             }
  249.          }
  250.          this.mainTimeline = null;
  251.          this.currentLabelActorGroup = null;
  252.          this.testBox = null;
  253.          this.actorClip = null;
  254.          this.game = null;
  255.       }
  256.    }
  257. }
  258.  
  259. import dss161.engineaddons.gamesprotos.Actor;
  260. import dss161.engineaddons.gamesprotos.actors.actorClip.ActorClip;
  261.  
  262. class MemoClip extends Actor
  263. {
  264.     
  265.    
  266.    private var memoClip:ActorClip;
  267.    
  268.    function MemoClip(param1:* = null)
  269.    {
  270.       var params:* = param1;
  271.       super();
  272.       this.memoClip = game.addActor({
  273.          "code":"A_" + game.config.moduleName + "_MEMO",
  274.          "parent":game.config.layers.content
  275.       });
  276.       if(game.memo.getValue("RUBRIQUE.allFinished",false) == false)
  277.       {
  278.          this.memoClip.addActor({
  279.             "mc":this.memoClip.getChildByName("BT_REPRISE"),
  280.             "onRollOverState":{
  281.                "label":"E2",
  282.                "noiseCode":"B_ROLL"
  283.             },
  284.             "onRollOutState":{"label":"E1"},
  285.             "onClick":function(param1:ActorClip):void
  286.             {
  287.                game.noisePlay({"code":"B_REP"});
  288.                params.onContinue();
  289.             },
  290.             "enabled":true
  291.          });
  292.       }
  293.       else
  294.       {
  295.          this.memoClip.gotoAndStop(2);
  296.       }
  297.       this.memoClip.addActor({
  298.          "mc":this.memoClip.getChildByName("BT_NEW"),
  299.          "onRollOverState":{
  300.             "label":"E2",
  301.             "noiseCode":"B_ROLL"
  302.          },
  303.          "onRollOutState":{"label":"E1"},
  304.          "onClick":function(param1:ActorClip):void
  305.          {
  306.             game.noisePlay({"code":"B_NEW"});
  307.             params.onNew();
  308.          },
  309.          "enabled":true
  310.       });
  311.    }
  312.    
  313.    override protected function _destroy() : void
  314.    {
  315.       this.memoClip = null;
  316.    }
  317. }
  318.