home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Esportes / CrossingCup.swf / scripts / __Packages / game.as < prev    next >
Text File  |  2007-12-11  |  26KB  |  854 lines

  1. class game
  2. {
  3.    static var G_START = 1;
  4.    static var G_WHISTLE = 2;
  5.    static var G_AIM = 3;
  6.    static var G_POWER = 4;
  7.    static var G_CORNERKICK = 5;
  8.    static var G_CORNERSHOOT = 6;
  9.    static var G_TRANSITION = 7;
  10.    static var G_TIMING = 8;
  11.    static var G_RECEIVING = 9;
  12.    static var G_SHOOTING = 10;
  13.    static var G_SHOOT = 11;
  14.    static var G_WINLOOSE = 12;
  15.    static var G_GAMEOVER = 13;
  16.    static var G_RESTART = 30;
  17.    static var GX_WHISTLE = 102;
  18.    static var GX_AIM = 103;
  19.    static var GX_RECEIVING = 109;
  20.    static var GX2_RECEIVING = 110;
  21.    static var GX_SHOOT = 111;
  22.    var kickerHint = false;
  23.    var keeperHint = false;
  24.    var AILevel = 0;
  25.    var purgegame = false;
  26.    function game(mc)
  27.    {
  28.       this.mcParent = mc;
  29.       this.setup3d();
  30.       this.playtime = 0;
  31.       this.gameon = true;
  32.       this.def_playtime = CSessionManager.ins().numPlayPerGame;
  33.       this.world.addEventListener(sandy.core.World3D.onRenderEVENT,this,this.renderWorld);
  34.       this.iRender = setInterval(this,"renderWorldnow",10);
  35.       EventCenter.access().addEventListener("gameevent",this);
  36.       this.kickerHint = false;
  37.       this.keeperHint = false;
  38.       var _loc2_ = new Object();
  39.       _loc2_.ob = this;
  40.       _loc2_.onKeyDown = function()
  41.       {
  42.          this.ob.cekkey();
  43.       };
  44.       Key.addListener(_loc2_);
  45.    }
  46.    function introgame(human)
  47.    {
  48.       this.gameon = true;
  49.       this.purgegame = false;
  50.       if(!this.cornercam)
  51.       {
  52.          this.switchcam();
  53.       }
  54.       this.keeper.setLevel(0);
  55.       this.kicker.setLevel(0);
  56.       this.AILevel = 0;
  57.       this.kickerHint = false;
  58.       this.keeperHint = false;
  59.       if(human)
  60.       {
  61.          this.AutoAim = false;
  62.          this.AutoKick = false;
  63.          this.AutoCatch = true;
  64.          if(CTournament.ins().tournamentPhase > 3)
  65.          {
  66.             this.keeper.setLevel(1);
  67.             this.AILevel = 1;
  68.          }
  69.          this.cornerkicker.setHuman(true);
  70.          if(CSessionManager.ins().firstTimeOffense)
  71.          {
  72.             CSessionManager.ins().firstTimeOffense = false;
  73.             _global.__DISPATCH({type:"inGameMenu",name:"showtuto"});
  74.             CSessionManager.ins().justEndTutorial = CSessionManager.ins().justEndTutorial + 1;
  75.             this.kickerHint = true;
  76.          }
  77.          else
  78.          {
  79.             _global.__DISPATCH({type:"inGameMenu",name:"hidetuto"});
  80.          }
  81.       }
  82.       else
  83.       {
  84.          this.AutoAim = true;
  85.          this.AutoKick = true;
  86.          this.AutoCatch = false;
  87.          if(CTournament.ins().tournamentPhase > 3)
  88.          {
  89.             this.kicker.setLevel(1);
  90.             this.AILevel = 1;
  91.          }
  92.          this.cornerkicker.setHuman(false);
  93.          if(CSessionManager.ins().firstTimeDefense)
  94.          {
  95.             CSessionManager.ins().firstTimeDefense = false;
  96.             _global.__DISPATCH({type:"inGameMenu",name:"showtuto"});
  97.             CSessionManager.ins().justEndTutorial = CSessionManager.ins().justEndTutorial + 1;
  98.             this.keeperHint = true;
  99.          }
  100.          else
  101.          {
  102.             _global.__DISPATCH({type:"inGameMenu",name:"hidetuto"});
  103.          }
  104.       }
  105.       this.mball.reset();
  106.       this.mball.show();
  107.       this.carrow.hide();
  108.       this.kicker.restart();
  109.       this.kicker.hide();
  110.       this.keeper.restart();
  111.       this.keeper.hide();
  112.       this.cornerkicker.restart();
  113.       this.cornerkicker.show();
  114.    }
  115.    function initgame()
  116.    {
  117.       this.pumpgame(game.G_START);
  118.    }
  119.    function startgame()
  120.    {
  121.       this.xrot = 0;
  122.       this.pumpgame(game.GX_WHISTLE);
  123.    }
  124.    function endgame()
  125.    {
  126.       this.gameon = false;
  127.       SoundManager.ins().fadeAmbience(false);
  128.       this.GamePhase = -1;
  129.    }
  130.    function gameevent(event)
  131.    {
  132.       if(this.purgegame)
  133.       {
  134.          return undefined;
  135.       }
  136.       switch(event.param)
  137.       {
  138.          case "cheat":
  139.             var _loc3_ = CTournament.ins().currentMatch;
  140.             if(CTeamManager.ins().currentTeam == _loc3_.team1)
  141.             {
  142.                if(event.win)
  143.                {
  144.                   _loc3_.addScorea(1,0);
  145.                }
  146.                else
  147.                {
  148.                   _loc3_.addScorea(0,1);
  149.                }
  150.             }
  151.             else if(event.win)
  152.             {
  153.                _loc3_.addScorea(0,1);
  154.             }
  155.             else
  156.             {
  157.                _loc3_.addScorea(1,0);
  158.             }
  159.             _loc3_.round = 2;
  160.             _loc3_.totalkick1 = 0;
  161.             _loc3_.totalkick2 = 0;
  162.             this.playtime = this.def_playtime * 2;
  163.             this.pumpgame(game.G_RESTART);
  164.             break;
  165.          case "dialogendgame":
  166.             this.KillTheGame();
  167.             _global.__DISPATCH({type:"inGameMenu",name:"stopdialog"});
  168.             break;
  169.          case "dialognoendgame":
  170.             _global.__DISPATCH({type:"inGameMenu",name:"stopdialog"});
  171.             break;
  172.          case "skiptutorial":
  173.             CSessionManager.ins().firstTimeOffense = false;
  174.             CSessionManager.ins().firstTimeDefense = false;
  175.             CSessionManager.ins().justEndTutorial = 0;
  176.             this.kickerHint = false;
  177.             this.keeperHint = false;
  178.             _global.__DISPATCH({type:"inGameMenu",name:"hidetuto"});
  179.             _global.__DISPATCH({type:"inGameHelp",param:"stop"});
  180.             this.pumpgame(game.G_WHISTLE);
  181.             break;
  182.          case "playtutorial":
  183.             this.pumpgame(game.G_WHISTLE);
  184.             break;
  185.          case "startgamealready":
  186.             if(this.AutoAim)
  187.             {
  188.                event.obyek.indicator._visible = true;
  189.             }
  190.             else
  191.             {
  192.                event.obyek.indicator._visible = false;
  193.             }
  194.             this.startgame();
  195.             break;
  196.          case "playambience":
  197.             break;
  198.          case "cornerkick":
  199.             this.pumpgame(game.G_CORNERSHOOT);
  200.             break;
  201.          case "transition":
  202.             this.pumpgame(game.G_TRANSITION);
  203.             break;
  204.          case "finishtransition":
  205.             this.pumpgame(game.G_TIMING);
  206.             break;
  207.          case "shooting":
  208.             this.pumpgame(game.G_SHOOTING);
  209.             break;
  210.          case "shoot":
  211.             this.pumpgame(game.GX_SHOOT);
  212.             break;
  213.          case "headingcontact":
  214.             var _loc5_ = this.kicker.getPosition();
  215.             var _loc4_ = this.mball.getPosition();
  216.             var _loc9_ = Math.abs(_loc5_.x - _loc4_.x);
  217.             var _loc8_ = Math.abs(_loc5_.y + _loc4_.y + 2.5);
  218.             var _loc7_ = Math.abs(_loc5_.z - _loc4_.z);
  219.             if(_loc9_ < 2 && _loc8_ < 0.8 && _loc7_ < 0.5)
  220.             {
  221.                this.kicker.makeshoot();
  222.             }
  223.             break;
  224.          case "volleycontact":
  225.             _loc5_ = this.kicker.getPosition();
  226.             _loc4_ = this.mball.getPosition();
  227.             _loc9_ = Math.abs(_loc5_.x - _loc4_.x);
  228.             _loc8_ = Math.abs(_loc5_.y - _loc4_.y);
  229.             _loc7_ = Math.abs(_loc5_.z - _loc4_.z);
  230.             if(_loc9_ < 1.5 && _loc8_ < 1.5 && _loc7_ < 1)
  231.             {
  232.                this.kicker.makeshoot();
  233.             }
  234.             break;
  235.          case "backflipcontact":
  236.             _loc5_ = this.kicker.getPosition();
  237.             _loc4_ = this.mball.getPosition();
  238.             _loc9_ = Math.abs(_loc5_.x - _loc4_.x);
  239.             _loc8_ = Math.abs(_loc5_.y + _loc4_.y + 2);
  240.             _loc7_ = Math.abs(_loc5_.z - _loc4_.z);
  241.             if(_loc9_ < 2 && _loc8_ < 1 && _loc7_ < 1.1)
  242.             {
  243.                this.kicker.makeshoot();
  244.             }
  245.             break;
  246.          case "divecontact":
  247.             _loc5_ = this.kicker.getPosition();
  248.             _loc4_ = this.mball.getPosition();
  249.             _loc9_ = Math.abs(_loc5_.x - _loc4_.x);
  250.             _loc8_ = Math.abs(_loc5_.y + _loc4_.y);
  251.             _loc7_ = Math.abs(_loc5_.z - _loc4_.z);
  252.             if(_loc9_ < 5 && _loc8_ < 1.5 && _loc7_ < 1)
  253.             {
  254.                this.kicker.makeshoot();
  255.             }
  256.             break;
  257.          case "chestvolleycontact":
  258.             _loc5_ = this.kicker.getPosition();
  259.             _loc4_ = this.mball.getPosition();
  260.             _loc9_ = Math.abs(_loc5_.x - _loc4_.x);
  261.             _loc8_ = Math.abs(_loc5_.y + _loc4_.y + 0.5);
  262.             _loc7_ = Math.abs(_loc5_.z - _loc4_.z);
  263.             if(_loc9_ < 1 && _loc8_ < 2 && _loc7_ < 1.2)
  264.             {
  265.                this.mball.haltedit();
  266.                SoundManager.ins().playKick();
  267.             }
  268.             break;
  269.          case "chestvolleykick":
  270.             if(this.mball.halted)
  271.             {
  272.                this.kicker.makeshoot();
  273.             }
  274.             break;
  275.          case "heading":
  276.          case "volley":
  277.          case "dive":
  278.          case "backflip":
  279.          case "chestvolley":
  280.             this.kicker.toidle();
  281.             break;
  282.          case "ballout":
  283.             if(this.GamePhase != game.G_WINLOOSE)
  284.             {
  285.                this.keeper.win();
  286.                this.kicker.loose();
  287.                this.pumpgame(game.G_WINLOOSE);
  288.             }
  289.             break;
  290.          case "goal":
  291.             this.keeper.loose();
  292.             this.kicker.win();
  293.             SoundManager.ins().playVictory();
  294.             if(!this.kickerHint && !this.keeperHint)
  295.             {
  296.                CTournament.ins().currentMatch.addScore();
  297.                _global.__DISPATCH({type:"changeScore"});
  298.             }
  299.             this.pumpgame(game.G_WINLOOSE);
  300.             break;
  301.          case "loose":
  302.             this.keeper.win();
  303.             this.kicker.loose();
  304.             this.pumpgame(game.G_WINLOOSE);
  305.             break;
  306.          case "enteringhurdle":
  307.             if(!this.keeper.cekGoal(this.mball))
  308.             {
  309.                this.mball.deflect();
  310.                this.mball.ingoalsequence = 5;
  311.                this.kicker.loose();
  312.                this.pumpgame(game.G_WINLOOSE);
  313.             }
  314.             else
  315.             {
  316.                SoundManager.ins().playGoal();
  317.                _global.__DISPATCH({type:"gameevent",param:"goal"});
  318.                this.mball.ingoalsequence = 4;
  319.             }
  320.       }
  321.    }
  322.    function setIncomingBallTimer()
  323.    {
  324.       var _loc2_ = 0;
  325.       this.AILevel != 0 ? (_loc2_ = 1700) : (_loc2_ = 2200);
  326.       if(this.kickerHint)
  327.       {
  328.          _loc2_ += 2500;
  329.       }
  330.       this.iIncomingBall = setInterval(this,"IncomingBall",_loc2_);
  331.    }
  332.    function IncomingBall()
  333.    {
  334.       clearInterval(this.iIncomingBall);
  335.       if(!this.kickerHint && !this.keeperHint)
  336.       {
  337.          this.pumpgame(game.G_RECEIVING);
  338.       }
  339.    }
  340.    function endwhistle()
  341.    {
  342.       this.pumpgame(game.GX_AIM);
  343.    }
  344.    function pumpgame(phase)
  345.    {
  346.       if(phase == undefined)
  347.       {
  348.          this.GamePhase = this.GamePhase + 1;
  349.          phase = this.GamePhase;
  350.       }
  351.       else
  352.       {
  353.          this.GamePhase = phase;
  354.       }
  355.       switch(phase)
  356.       {
  357.          case game.G_START:
  358.             this.playtime = 0;
  359.             break;
  360.          case game.GX_WHISTLE:
  361.             if(CSessionManager.ins().firstTimer)
  362.             {
  363.                _global.__DISPATCH({type:"inGameHelp",param:"firsttimer"});
  364.                CSessionManager.ins().firstTimer = false;
  365.                return undefined;
  366.             }
  367.             if(CSessionManager.ins().justEndTutorial == 3)
  368.             {
  369.                _global.__DISPATCH({type:"inGameHelp",param:"endtutorial"});
  370.                _global.__DISPATCH({type:"inGameMenu",name:"hidetuto"});
  371.                return undefined;
  372.             }
  373.             if(CSessionManager.ins().justEndTutorial == 2)
  374.             {
  375.                CSessionManager.ins().justEndTutorial = CSessionManager.ins().justEndTutorial + 1;
  376.             }
  377.             this.pumpgame(game.G_WHISTLE);
  378.             break;
  379.          case game.G_WHISTLE:
  380.             if(this.kickerHint)
  381.             {
  382.                _global.__DISPATCH({type:"inGameHelp",param:"aiming"});
  383.             }
  384.             if(this.keeperHint)
  385.             {
  386.                _global.__DISPATCH({type:"inGameHelp",param:"keeperwait"});
  387.             }
  388.             SoundManager.ins().playWhistle();
  389.             EventCenter.access().addEventListener("endwhistle",this);
  390.             if(!this.AutoKick)
  391.             {
  392.                this.carrow.show();
  393.                this.mball.hide();
  394.             }
  395.             else
  396.             {
  397.                this.mball.show();
  398.                this.carrow.hide();
  399.             }
  400.             this.cornerkicker.show();
  401.             break;
  402.          case game.GX_AIM:
  403.             if(!this.kickerHint && !this.keeperHint && CSessionManager.ins().justEndTutorial != 3)
  404.             {
  405.                this.pumpgame(game.G_AIM);
  406.             }
  407.             break;
  408.          case game.G_POWER:
  409.             if(this.kickerHint)
  410.             {
  411.                _global.__DISPATCH({type:"inGameHelp",param:"power"});
  412.             }
  413.             this.carrow.powering();
  414.             break;
  415.          case game.G_CORNERKICK:
  416.             this.carrow.unpowering();
  417.             this.mball.show();
  418.             this.carrow.hide();
  419.             this.cornerkicker.setHuman(false);
  420.             this.cornerkicker.kick();
  421.             break;
  422.          case game.G_CORNERSHOOT:
  423.             if(this.kickerHint)
  424.             {
  425.                _global.__DISPATCH({type:"inGameHelp",param:"cross"});
  426.             }
  427.             SoundManager.ins().playKick();
  428.             this.mball.shoot(this.carrow.power,this.carrow.rx,this.carrow.ry);
  429.             break;
  430.          case game.G_TRANSITION:
  431.             this.mball.hide();
  432.             this.mcParent._parent.latar.gotoAndPlay(2);
  433.             this.mcParent._parent.indicator._visible = false;
  434.             this.mcParent._visible = false;
  435.             this.switchcam();
  436.             if(this.AutoKick)
  437.             {
  438.                this.kicker.startrun();
  439.             }
  440.             break;
  441.          case game.G_TIMING:
  442.             if(this.kickerHint)
  443.             {
  444.                _global.__DISPATCH({type:"inGameHelp",param:"moving"});
  445.                this.pumpgame(game.GX_RECEIVING);
  446.             }
  447.             if(this.keeperHint)
  448.             {
  449.                _global.__DISPATCH({type:"inGameHelp",param:"keepermove"});
  450.             }
  451.             if(!this.kickerHint && !this.keeperHint)
  452.             {
  453.                this.setIncomingBallTimer();
  454.             }
  455.             this.mcParent._visible = true;
  456.             this.kicker.show();
  457.             this.keeper.show();
  458.             if(this.AutoKick)
  459.             {
  460.                this.kicker.action();
  461.                this.kicker.setHuman(false);
  462.                this.keeper.setHuman(true);
  463.             }
  464.             else
  465.             {
  466.                this.kicker.setHuman(true);
  467.                this.keeper.setHuman(false);
  468.             }
  469.             break;
  470.          case game.GX_RECEIVING:
  471.             break;
  472.          case game.GX2_RECEIVING:
  473.             this.mball.show();
  474.             break;
  475.          case game.G_RECEIVING:
  476.             if(this.kickerHint)
  477.             {
  478.                this.setIncomingBallTimer();
  479.             }
  480.             this.mball.show();
  481.             if(this.AutoKick)
  482.             {
  483.                this.mball.startTrajectoryCounter(3);
  484.             }
  485.             break;
  486.          case game.G_SHOOTING:
  487.             this.mball.ingoalsequence = 1;
  488.             break;
  489.          case game.GX_SHOOT:
  490.             if(this.keeperHint)
  491.             {
  492.                _global.__DISPATCH({type:"inGameHelp",param:"keepercatch"});
  493.             }
  494.             else
  495.             {
  496.                this.pumpgame(game.G_SHOOT);
  497.             }
  498.             break;
  499.          case game.G_SHOOT:
  500.             SoundManager.ins().playKick();
  501.             this.kicker.setHuman(false);
  502.             if(this.AutoCatch)
  503.             {
  504.                this.keeper.catchball(this.mball);
  505.                this.keeper.startcatch();
  506.             }
  507.             break;
  508.          case game.G_WINLOOSE:
  509.             this.iCelebrate = setInterval(this,"endCelebrate",3000);
  510.             break;
  511.          case game.G_RESTART:
  512.             if(SoundManager.ins().goalplayed)
  513.             {
  514.                SoundManager.ins().fadeGoal(false);
  515.             }
  516.             this.mball.reset();
  517.             this.cornerkicker.hide();
  518.             this.kicker.setHuman(false);
  519.             this.kicker.hide();
  520.             this.keeper.setHuman(false);
  521.             this.keeper.hide();
  522.             this.mball.hide();
  523.             this.carrow.hide();
  524.             this.mcParent._parent.latar.gotoAndStop(1);
  525.             if(!this.cornercam)
  526.             {
  527.                this.switchcam();
  528.             }
  529.             if(!this.keeperHint && !this.kickerHint)
  530.             {
  531.                this.playtime = this.playtime + 1;
  532.                _global.__DISPATCH({type:"updateBallCounter"});
  533.             }
  534.             var _loc5_ = this.keeperHint;
  535.             this.keeperHint = false;
  536.             var _loc4_ = this.kickerHint;
  537.             this.kickerHint = false;
  538.             _global.__DISPATCH({type:"endGame",h1:_loc5_,h2:_loc4_});
  539.             this.GamePhase = game.G_GAMEOVER;
  540.       }
  541.    }
  542.    function playtimeover()
  543.    {
  544.       if(this.playtime >= this.def_playtime * 2)
  545.       {
  546.          return true;
  547.       }
  548.       return false;
  549.    }
  550.    function endCelebrate()
  551.    {
  552.       clearInterval(this.iCelebrate);
  553.       this.pumpgame(game.G_RESTART);
  554.    }
  555.    function renderWorld()
  556.    {
  557.       if(this.GamePhase == game.G_CORNERSHOOT)
  558.       {
  559.          this.mball.render();
  560.          return undefined;
  561.       }
  562.       if(this.GamePhase == game.G_RECEIVING)
  563.       {
  564.          this.mball.render();
  565.          return undefined;
  566.       }
  567.       if(this.GamePhase == game.G_SHOOTING)
  568.       {
  569.          this.mball.render();
  570.          return undefined;
  571.       }
  572.       if(this.GamePhase == game.G_SHOOT)
  573.       {
  574.          this.mball.render();
  575.          return undefined;
  576.       }
  577.       if(this.GamePhase == game.G_WINLOOSE)
  578.       {
  579.          this.mball.render();
  580.          return undefined;
  581.       }
  582.    }
  583.    function renderWorldnow()
  584.    {
  585.       if(!this.gameon)
  586.       {
  587.          return undefined;
  588.       }
  589.       if(this.GamePhase == game.G_AIM)
  590.       {
  591.          if(this.AutoAim)
  592.          {
  593.             if(!this.kickerHint && !this.keeperHint)
  594.             {
  595.                this.carrow.autoAim(false);
  596.             }
  597.             else
  598.             {
  599.                this.carrow.autoAim(true);
  600.             }
  601.             this.pumpgame(game.G_CORNERKICK);
  602.          }
  603.          if(Key.isDown(38))
  604.          {
  605.             this.carrow.up();
  606.          }
  607.          if(Key.isDown(40))
  608.          {
  609.             this.carrow.down();
  610.          }
  611.          if(Key.isDown(37))
  612.          {
  613.             this.carrow.left();
  614.          }
  615.          if(Key.isDown(39))
  616.          {
  617.             this.carrow.right();
  618.          }
  619.          return undefined;
  620.       }
  621.       if(this.GamePhase == game.G_TIMING)
  622.       {
  623.          if(this.AutoKick)
  624.          {
  625.             this.kicker.cekrun();
  626.          }
  627.          else
  628.          {
  629.             this.kicker.cekinput();
  630.          }
  631.          if(!this.AutoCatch)
  632.          {
  633.             this.keeper.cekinputA(this.mball);
  634.          }
  635.          return undefined;
  636.       }
  637.       if(this.GamePhase == game.GX2_RECEIVING)
  638.       {
  639.          this.kicker.cekinput(false);
  640.          return undefined;
  641.       }
  642.       if(this.GamePhase == game.G_RECEIVING)
  643.       {
  644.          if(this.AutoKick)
  645.          {
  646.             this.kicker.cekrun();
  647.          }
  648.          else
  649.          {
  650.             this.kicker.cekinput();
  651.          }
  652.          if(!this.AutoCatch)
  653.          {
  654.             this.keeper.cekinputA(this.mball);
  655.          }
  656.          return undefined;
  657.       }
  658.       if(this.GamePhase == game.G_SHOOTING)
  659.       {
  660.          if(!this.AutoCatch)
  661.          {
  662.             this.keeper.cekinputA(this.mball);
  663.          }
  664.          return undefined;
  665.       }
  666.       if(this.GamePhase == game.GX_SHOOT)
  667.       {
  668.          return undefined;
  669.       }
  670.       if(this.GamePhase == game.G_SHOOT)
  671.       {
  672.          if(!this.AutoCatch)
  673.          {
  674.             this.keeper.cekinputA(this.mball);
  675.          }
  676.          this.mball.cekinggoal();
  677.          return undefined;
  678.       }
  679.       if(this.GamePhase == game.G_WINLOOSE)
  680.       {
  681.          this.mball.cekinggoal();
  682.          return undefined;
  683.       }
  684.    }
  685.    function cekkey()
  686.    {
  687.       var _loc3_ = Key.getCode();
  688.       if(this.kickerHint)
  689.       {
  690.          if(Key.isDown(37) || Key.isDown(39) || Key.isDown(38) || Key.isDown(40))
  691.          {
  692.             if(this.GamePhase == game.GX_AIM)
  693.             {
  694.                this.pumpgame(game.G_AIM);
  695.                _global.__DISPATCH({type:"inGameHelp",param:"doneaiming"});
  696.                return undefined;
  697.             }
  698.          }
  699.          if(_loc3_ == 192 || _loc3_ == 13)
  700.          {
  701.             if(this.GamePhase == game.GX_RECEIVING)
  702.             {
  703.                this.pumpgame(game.GX2_RECEIVING);
  704.                _global.__DISPATCH({type:"inGameHelp",param:"moving2"});
  705.                return undefined;
  706.             }
  707.             if(this.GamePhase == game.GX2_RECEIVING)
  708.             {
  709.                this.pumpgame(game.G_RECEIVING);
  710.                _global.__DISPATCH({type:"inGameHelp",param:"stop"});
  711.                return undefined;
  712.             }
  713.             return undefined;
  714.          }
  715.       }
  716.       if(this.keeperHint)
  717.       {
  718.          if(_loc3_ == 192 || _loc3_ == 13)
  719.          {
  720.             if(this.GamePhase == game.G_TIMING)
  721.             {
  722.                this.pumpgame(game.G_RECEIVING);
  723.                _global.__DISPATCH({type:"inGameHelp",param:"stop"});
  724.                return undefined;
  725.             }
  726.             if(this.GamePhase == game.GX_SHOOT)
  727.             {
  728.                this.pumpgame(game.G_SHOOT);
  729.                _global.__DISPATCH({type:"inGameHelp",param:"stop"});
  730.                return undefined;
  731.             }
  732.             if(this.GamePhase == game.GX_AIM)
  733.             {
  734.                this.pumpgame(game.G_AIM);
  735.                _global.__DISPATCH({type:"inGameHelp",param:"stop"});
  736.                return undefined;
  737.             }
  738.          }
  739.       }
  740.       if(Key.isDown(32))
  741.       {
  742.          switch(this.GamePhase)
  743.          {
  744.             case game.G_AIM:
  745.                this.pumpgame(game.G_POWER);
  746.                break;
  747.             case game.G_POWER:
  748.                this.pumpgame(game.G_CORNERKICK);
  749.                break;
  750.             case game.G_SHOOTING:
  751.             case game.G_SHOOT:
  752.                if(!this.AutoCatch)
  753.                {
  754.                   this.keeper.spacehit(this.mball);
  755.                   break;
  756.                }
  757.          }
  758.       }
  759.       if(_loc3_ == 192 || _loc3_ == 13)
  760.       {
  761.          if(this.GamePhase == game.GX_WHISTLE)
  762.          {
  763.             this.pumpgame(game.G_WHISTLE);
  764.             _global.__DISPATCH({type:"inGameHelp",param:"stop"});
  765.             CSessionManager.ins().justEndTutorial = 0;
  766.             return undefined;
  767.          }
  768.       }
  769.    }
  770.    function switchcam()
  771.    {
  772.       if(this.cornercam)
  773.       {
  774.          this.cam.setPosition(28.339,4.808,0);
  775.          this.cam.rotateX(2);
  776.          this.cam.rotateY(90);
  777.       }
  778.       else
  779.       {
  780.          this.cam.setPosition(50,5.5,-51);
  781.          this.cam.rotateY(-90);
  782.          this.cam.rotateX(-2);
  783.       }
  784.       this.cornercam = !this.cornercam;
  785.    }
  786.    function setup3d()
  787.    {
  788.       this.world = sandy.core.World3D.getInstance();
  789.       this.screen = new sandy.view.ClipScreen(this.mcParent.createEmptyMovieClip("screen",1),640,400);
  790.       this.cam = new sandy.view.Camera3D(620,this.screen);
  791.       this.cam.setPosition(50,5.5,-51);
  792.       this.cam.rotateX(-10);
  793.       this.cornercam = true;
  794.       this.world.addCamera(this.cam);
  795.       var _loc2_ = new sandy.core.group.Group();
  796.       this.world.setRootGroup(_loc2_);
  797.       this.mball = new CBall(_loc2_,this.mcParent);
  798.       this.carrow = new CArrow(_loc2_,this.mcParent);
  799.       this.cornerkicker = new CCornerKicker(_loc2_,this.mcParent);
  800.       this.keeper = new CKeeper(_loc2_,this.mcParent);
  801.       this.kicker = new CKicker(_loc2_,this.mcParent,this.mball);
  802.       this.world.render();
  803.    }
  804.    function createField(bg, x, y, z)
  805.    {
  806.       var _loc4_ = new sandy.primitive.Plane3D(90,120,5,"tri");
  807.       var _loc6_ = new sandy.skin.MixedSkin(65280,80,0,100,1);
  808.       _loc4_.setSkin(_loc6_);
  809.       var _loc1_ = new sandy.core.group.TransformGroup();
  810.       var _loc2_ = new sandy.core.group.TransformGroup();
  811.       var _loc5_ = new sandy.core.transform.Transform3D();
  812.       var _loc3_ = new sandy.core.transform.Transform3D();
  813.       _loc5_.rot(0,0,0);
  814.       _loc3_.translate(x,y,z);
  815.       _loc1_.setTransform(_loc5_);
  816.       _loc2_.setTransform(_loc3_);
  817.       _loc1_.addChild(_loc4_);
  818.       _loc2_.addChild(_loc1_);
  819.       bg.addChild(_loc2_);
  820.    }
  821.    function setupfps()
  822.    {
  823.       this.mcParent.createTextField("fps",10000,0,200,50,20);
  824.       this.mcParent.fps.size = 14;
  825.       this.mcParent.fps.color = 16777215;
  826.       this._t = getTimer();
  827.       this._fps = 0;
  828.    }
  829.    function KillTheGame()
  830.    {
  831.       _global.__DISPATCH({type:"inGameHelp",param:"stopdialog"});
  832.       CSessionManager.ins().firstTimeOffense = false;
  833.       CSessionManager.ins().firstTimeDefense = false;
  834.       this.kickerHint = false;
  835.       this.keeperHint = false;
  836.       var _loc3_ = CTournament.ins().currentMatch;
  837.       if(CTeamManager.ins().currentTeam == _loc3_.team1)
  838.       {
  839.          _loc3_.addScorea(1,0);
  840.       }
  841.       else
  842.       {
  843.          _loc3_.addScorea(0,1);
  844.       }
  845.       _loc3_.round = 2;
  846.       _loc3_.totalkick1 = 0;
  847.       _loc3_.totalkick2 = 0;
  848.       this.playtime = this.def_playtime * 2;
  849.       CTournament.ins().endTournament();
  850.       this.pumpgame(game.G_RESTART);
  851.       this.purgegame = true;
  852.    }
  853. }
  854.