home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 162 / MOBICLIC162.ISO / pc / DATA / GAM162 / GAM162_00 / GAM162_00.swf / scripts / gam162_00 / CapsuleAlgo.as < prev    next >
Text File  |  2014-02-17  |  7KB  |  206 lines

  1. package gam162_00
  2. {
  3.    import com.milanpresse.engine.managers.PauseManager;
  4.    import gam162_00.engineaddons.facades.GameEngine;
  5.    import gam162_00.engineaddons.gamesprotos.Actor;
  6.    import gam162_00.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 testBox:TestBox;
  19.       
  20.       private var actor:Actor;
  21.       
  22.       private var actorClip:ActorClip;
  23.       
  24.       private var comeFromGame:Boolean = false;
  25.       
  26.       private var currentZoneNo:int = -1;
  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.testBox = new TestBox(this.game,this);
  43.          this.testBox.visible = false;
  44.          this.mainTimeline = this.game.addActor({
  45.             "code":"A_" + this.game.config.moduleName,
  46.             "parent":this.game.config.layers.content
  47.          });
  48.          this.mainTimeline.onLabelEnter = function(param1:* = null):void
  49.          {
  50.             var result:* = param1;
  51.             switch(result.label)
  52.             {
  53.                case "ATTENTE_01":
  54.                   currentLabelActorGroup.addActor({
  55.                      "type":ATTENTE_01,
  56.                      "container":mainTimeline,
  57.                      "infos":game.moduleConfig[result.label + "_CONFIG"],
  58.                      "onEvent":function(param1:* = null):void
  59.                      {
  60.                         mainTimeline.gotoAndStop("FIN");
  61.                      }
  62.                   });
  63.                   break;
  64.                case "FIN":
  65.                   game.commentPlay({
  66.                      "code":"FIN",
  67.                      "callback":function():void
  68.                      {
  69.                         var lastScore:* = game.memo.getValue("MODULE.lastScore",0);
  70.                         var record:* = game.memo.getValue("MODULE.record",0);
  71.                         if(lastScore > record)
  72.                         {
  73.                            game.memo.setValue("MODULE.record",lastScore);
  74.                         }
  75.                         game.moduleConfig["ATTENTE_01_CONFIG"].comeFromEnd = true;
  76.                         if(record == 0)
  77.                         {
  78.                            if(lastScore == 0)
  79.                            {
  80.                               game.commentPlay({
  81.                                  "code":"S3",
  82.                                  "callback":function():void
  83.                                  {
  84.                                     game.commentPlay({
  85.                                        "code":"N4",
  86.                                        "callback":function():void
  87.                                        {
  88.                                           mainTimeline.gotoAndStop("ATTENTE_01");
  89.                                        }
  90.                                     });
  91.                                  }
  92.                               });
  93.                            }
  94.                            else
  95.                            {
  96.                               game.commentPlay({
  97.                                  "code":"N4",
  98.                                  "callback":function():void
  99.                                  {
  100.                                     mainTimeline.gotoAndStop("ATTENTE_01");
  101.                                  }
  102.                               });
  103.                            }
  104.                         }
  105.                         else if(lastScore > record)
  106.                         {
  107.                            game.commentPlay({
  108.                               "code":"S1",
  109.                               "callback":function():void
  110.                               {
  111.                                  game.commentPlay({
  112.                                     "code":"N1",
  113.                                     "callback":function():void
  114.                                     {
  115.                                        mainTimeline.gotoAndStop("ATTENTE_01");
  116.                                     }
  117.                                  });
  118.                               }
  119.                            });
  120.                         }
  121.                         else
  122.                         {
  123.                            game.commentPlay({
  124.                               "code":"S2",
  125.                               "callback":function():void
  126.                               {
  127.                                  game.commentPlay({
  128.                                     "code":"N2",
  129.                                     "callback":function():void
  130.                                     {
  131.                                        mainTimeline.gotoAndStop("ATTENTE_01");
  132.                                     }
  133.                                  });
  134.                               }
  135.                            });
  136.                         }
  137.                      }
  138.                   });
  139.             }
  140.          };
  141.          this.mainTimeline.onLabelExit = function(param1:* = null):void
  142.          {
  143.             currentLabelActorGroup.destroyChildren();
  144.          };
  145.          this.mainTimeline.endMODULE = this.endMODULE;
  146.          this.currentLabelActorGroup = this.game.addActor(new Actor(this.game));
  147.          this.currentLabelActorGroup.name = "currentLabelActorGroup";
  148.       }
  149.       
  150.       private function getLastZoneLabels(param1:int) : Object
  151.       {
  152.          var _loc2_:Object = {
  153.             "startLabel":"",
  154.             "endLabel":""
  155.          };
  156.          var _loc3_:int = 0;
  157.          while(_loc3_ < this.mainTimeline.currentLabels.length)
  158.          {
  159.             if(_loc2_.startLabel == "" && this.mainTimeline.currentLabels[_loc3_].name.search("^_0" + param1) != -1)
  160.             {
  161.                _loc2_.startLabel = this.mainTimeline.currentLabels[_loc3_].name;
  162.             }
  163.             else if(_loc2_.startLabel != "" && this.mainTimeline.currentLabels[_loc3_].name.search("^_0" + param1) == -1)
  164.             {
  165.                _loc2_.endLabel = this.mainTimeline.currentLabels[_loc3_ - 1].name;
  166.                return _loc2_;
  167.             }
  168.             _loc3_++;
  169.          }
  170.          return _loc2_;
  171.       }
  172.       
  173.       public function start() : void
  174.       {
  175.          this.game.playMusic({"code":"MU"});
  176.          this.mainTimeline.gotoAndPlay("firstLabel");
  177.       }
  178.       
  179.       public function endMODULE() : void
  180.       {
  181.       }
  182.       
  183.       public function sleep() : void
  184.       {
  185.          this.toWake = [];
  186.          if(this.contentIsSleeping == false)
  187.          {
  188.          }
  189.       }
  190.       
  191.       public function wake() : void
  192.       {
  193.          var _loc1_:int = 0;
  194.          while(_loc1_ < this.toWake.length)
  195.          {
  196.             this.toWake[_loc1_]();
  197.             _loc1_++;
  198.          }
  199.       }
  200.       
  201.       public function destroy() : void
  202.       {
  203.       }
  204.    }
  205. }
  206.