CEndPanel.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. function CEndPanel(oSpriteBg){
  2. var _oBg;
  3. var _oScoreText;
  4. var _oScoreTextBack;
  5. var _oMsgText;
  6. var _oMsgTextBack;
  7. var _oGroup;
  8. this._init = function(oSpriteBg){
  9. _oBg = createBitmap(oSpriteBg);
  10. _oMsgTextBack = new createjs.Text("","50px "+FONT_GAME, "#000");
  11. _oMsgTextBack.x = CANVAS_WIDTH/2 + 2;
  12. _oMsgTextBack.y = (CANVAS_HEIGHT/2)-148;
  13. _oMsgTextBack.textAlign = "center";
  14. _oMsgText = new createjs.Text("","50px "+FONT_GAME, "#ffffff");
  15. _oMsgText.x = CANVAS_WIDTH/2;
  16. _oMsgText.y = (CANVAS_HEIGHT/2)-150;
  17. _oMsgText.textAlign = "center";
  18. _oScoreTextBack = new createjs.Text("","50px "+FONT_GAME, "#000");
  19. _oScoreTextBack.x = CANVAS_WIDTH/2 + 2;
  20. _oScoreTextBack.y = (CANVAS_HEIGHT/2) +42;
  21. _oScoreTextBack.textAlign = "center";
  22. _oScoreText = new createjs.Text("","50px "+FONT_GAME, "#ffffff");
  23. _oScoreText.x = CANVAS_WIDTH/2;
  24. _oScoreText.y = (CANVAS_HEIGHT/2) +40;
  25. _oScoreText.textAlign = "center";
  26. _oGroup = new createjs.Container();
  27. _oGroup.alpha = 0;
  28. _oGroup.visible=false;
  29. _oGroup.addChild(_oBg, _oScoreTextBack,_oScoreText,_oMsgTextBack,_oMsgText);
  30. s_oStage.addChild(_oGroup);
  31. var oParent = this;
  32. _oGroup.on("pressup",function(){oParent._onExit()});
  33. };
  34. this.unload = function(){
  35. var oParent = this;
  36. _oGroup.off("pressup",function(){oParent._onExit()});
  37. };
  38. this.show = function(iScore,bWin){
  39. if(bWin){
  40. _oMsgTextBack.text = TEXT_WIN;
  41. _oMsgText.text = TEXT_WIN;
  42. }else{
  43. _oMsgTextBack.text = TEXT_GAME_OVER;
  44. _oMsgText.text = TEXT_GAME_OVER;
  45. }
  46. _oScoreTextBack.text = TEXT_SCORE+": "+iScore;
  47. _oScoreText.text = TEXT_SCORE+": "+iScore;
  48. _oGroup.visible = true;
  49. createjs.Tween.get(_oGroup).to({alpha:1 }, 500).call(function(){$(s_oMain).trigger("show_interlevel_ad");});
  50. $(s_oMain).trigger("save_score",iScore);
  51. };
  52. this._onExit = function(){
  53. s_oGame._onExit();
  54. };
  55. this._init(oSpriteBg);
  56. }