| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- function CStadium( oStadiumContainer){
- var _oAudioToggle;
- var _oButExit;
-
- var _oStadiumContainer = oStadiumContainer;
-
- var _bUpdate;
-
- var _iArea;
-
- var _oAreaBottom;
- var _oAreaTop;
- var _oCrowdLeft;
- var _oCrowdRight;
-
- var _oBall;
-
- this._init = function(){
- var oBg = createBitmap(s_oSpriteLibrary.getSprite('air_view'));
- oStadiumContainer.addChild(oBg);
-
- _oAreaBottom = createBitmap(s_oSpriteLibrary.getSprite('area_bottom'));
- _oAreaBottom.y = CANVAS_HEIGHT/2;
- _oAreaBottom.alpha = 0.5;
- oStadiumContainer.addChild(_oAreaBottom);
-
- _oAreaTop = createBitmap(s_oSpriteLibrary.getSprite('area_top'));
- _oAreaTop.y = CANVAS_HEIGHT/2-55;
- _oAreaTop.alpha = 0.5;
- oStadiumContainer.addChild(_oAreaTop);
-
- _oCrowdLeft = createBitmap(s_oSpriteLibrary.getSprite('crowd_left'));
- _oCrowdLeft.x = CANVAS_WIDTH/2+56;
- _oCrowdLeft.y = CANVAS_HEIGHT/2-150;
- _oCrowdLeft.alpha = 0.5;
- oStadiumContainer.addChild(_oCrowdLeft);
-
- _oCrowdRight = createBitmap(s_oSpriteLibrary.getSprite('crowd_right'));
- _oCrowdRight.y = CANVAS_HEIGHT/2-150;
- _oCrowdRight.alpha = 0.5;
- oStadiumContainer.addChild(_oCrowdRight);
-
- _oStadiumContainer.visible = false;
- _bUpdate = false;
- };
-
- this.viewAndGetScore = function(oHitValue, pEndPoint){
- var iX = pEndPoint.x;
- var pEndPointBounce = {x: 0, y: 0};
- var pStartPoint = {x: START_POINT_STADIUM_X, y: START_POINT_STADIUM_Y};
-
- switch(iX){
- case END_POINT_X_ALMOST_MINUS_LEFT:
- if(oHitValue < (OFFSET_FOR_HIT/2)){
- _iArea = 1;
- pEndPoint.y = _oAreaTop.y + 30;
- pEndPointBounce.x = pEndPoint.x - 10;
- pEndPointBounce.y = pEndPoint.y - 10;
- }else if(oHitValue < OFFSET_FOR_HIT && oHitValue >= (OFFSET_FOR_HIT/2)){
- _iArea = 0;
- pEndPoint.y = _oAreaBottom.y + 30;
- pEndPointBounce.x = pEndPoint.x - 10;
- pEndPointBounce.y = pEndPoint.y - 10;
- }
- break;
-
- case END_POINT_X_ALMOST_MINUS_RIGHT:
- if(oHitValue < (OFFSET_FOR_HIT/2)){
- _iArea = 1;
- pEndPoint.y = _oAreaTop.y + 30;
- pEndPointBounce.x = pEndPoint.x + 10;
- pEndPointBounce.y = pEndPoint.y - 10;
- }else if(oHitValue < OFFSET_FOR_HIT && oHitValue >= (OFFSET_FOR_HIT/2)){
- _iArea = 0;
- pEndPoint.y = _oAreaBottom.y + 30;
- pEndPointBounce.x = pEndPoint.x + 10;
- pEndPointBounce.y = pEndPoint.y - 10;
- }
- break;
- case END_POINT_X_ALMOST_PLUS_LEFT:
- if(oHitValue < (OFFSET_FOR_HIT/2)){
- _iArea = 1;
- pEndPoint.y = _oAreaTop.y + 30;
- pEndPointBounce.x = pEndPoint.x - 10;
- pEndPointBounce.y = pEndPoint.y - 10;
- }else if(oHitValue < OFFSET_FOR_HIT && oHitValue >= (OFFSET_FOR_HIT/2)){
- _iArea = 0;
- pEndPoint.y = _oAreaBottom.y + 40;
- pEndPointBounce.x = pEndPoint.x - 10;
- pEndPointBounce.y = pEndPoint.y - 10;
- }
- break;
- case END_POINT_X_ALMOST_PLUS_RIGHT:
- if(oHitValue < (OFFSET_FOR_HIT/2)){
- _iArea = 1;
- pEndPoint.y = _oAreaTop.y + 30;
- pEndPointBounce.x = pEndPoint.x + 10;
- pEndPointBounce.y = pEndPoint.y - 10;
- }else if(oHitValue < OFFSET_FOR_HIT && oHitValue >= (OFFSET_FOR_HIT/2)){
- _iArea = 0;
- pEndPoint.y = _oAreaBottom.y + 50;
- pEndPointBounce.x = pEndPoint.x + 10;
- pEndPointBounce.y = pEndPoint.y - 10;
- }
- break;
- case END_POINT_X_PERFECT_LEFT:
- _iArea = 3;
- s_bBounce = false;
- pEndPoint.x -= 30;
- pEndPoint.y = _oCrowdLeft.y + 30;
- break;
- case END_POINT_X_PERFECT_RIGHT:
- _iArea = 2;
- s_bBounce = false;
- pEndPoint.y = _oCrowdRight.y + 30;
- break;
- }
- var _oStadiumBallContainer = new createjs.Container();
- s_oStage.addChild(_oStadiumBallContainer);
- _oBall = new CStadiumBall(pStartPoint, pEndPoint, pEndPointBounce, _oStadiumBallContainer, _iArea, oHitValue);
- _bUpdate = true;
- };
-
- this.update = function(){
- if(_bUpdate){
- _oBall.update();
- }
- };
-
- this.viewAreaEffect = function(iArea, iScore){
- switch(iArea){
- case 0:
- createjs.Tween.get(_oAreaBottom).to({alpha:1 }, 300).call(function() {
- createjs.Tween.get(_oAreaBottom).to({alpha:0.5 }, 300).call(function() {
- createjs.Tween.get(_oAreaBottom).to({alpha:1 }, 300).call(function() {
- createjs.Tween.get(_oAreaBottom).to({alpha:0.5 }, 300).call(function() {
- var oPanel = new CPanel(iScore);
- s_oGame._setScore(iScore);
- });
- });
- });
- });
- break;
- case 1:
- createjs.Tween.get(_oAreaTop).to({alpha:1 }, 300).call(function() {
- createjs.Tween.get(_oAreaTop).to({alpha:0.5 }, 300).call(function() {
- createjs.Tween.get(_oAreaTop).to({alpha:1 }, 300).call(function() {
- createjs.Tween.get(_oAreaTop).to({alpha:0.5 }, 300).call(function() {
- var oPanel = new CPanel(iScore);
- s_oGame._setScore(iScore);
- });
- });
- });
- });
- break;
- case 2:
- createjs.Tween.get(_oCrowdLeft).to({alpha:1 }, 300).call(function() {
- createjs.Tween.get(_oCrowdLeft).to({alpha:0.5 }, 300).call(function() {
- createjs.Tween.get(_oCrowdLeft).to({alpha:1 }, 300).call(function() {
- createjs.Tween.get(_oCrowdLeft).to({alpha:0.5 }, 300).call(function() {
- var oPanel = new CPanel(iScore);
- s_oGame._setScore(iScore);
- });
- });
- });
- });
- break;
- case 3:
- createjs.Tween.get(_oCrowdRight).to({alpha:1 }, 300).call(function() {
- createjs.Tween.get(_oCrowdRight).to({alpha:0.5 }, 300).call(function() {
- createjs.Tween.get(_oCrowdRight).to({alpha:1 }, 300).call(function() {
- createjs.Tween.get(_oCrowdRight).to({alpha:0.5 }, 300).call(function() {
- var oPanel = new CPanel(iScore);
- s_oGame._setScore(iScore);
- });
- });
- });
- });
- break;
- }
- };
-
- this.unload = function(){
- if(DISABLE_SOUND_MOBILE === false || s_bMobile === false){
- _oAudioToggle.unload();
- _oAudioToggle = null;
- }
-
- oStadiumContainer.removeAllChildren();
- s_oStadium = null;
- };
-
- this.setVisible = function(){
- _oStadiumContainer.visible = true;
- };
-
- this.setInvisible = function(){
- _oStadiumContainer.visible = false;
- _oBall.unload();
- };
-
- s_oStadium = this;
-
- this._init();
-
- return this;
- }
- var s_oStadium = null;
|