CEndPanel.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. function CEndPanel(oSpriteBg){
  2. var _oBg;
  3. var _oGroup;
  4. var _oMsgText;
  5. var _oMsgText1;
  6. var _oScoreText;
  7. var _oScoreText1;
  8. this._init = function(oSpriteBg){
  9. playSound("baseball_buzzer",1,false);
  10. _oBg = createBitmap(oSpriteBg);
  11. _oBg.x = 0;
  12. _oBg.y = 0;
  13. _oMsgText = new createjs.Text(""," 60px "+FONT2, "#ffffff");
  14. _oMsgText.x = CANVAS_WIDTH/2;
  15. _oMsgText.y = (CANVAS_HEIGHT/2)-150;
  16. _oMsgText.textAlign = "center";
  17. _oMsgText.textBaseline = "alphabetic";
  18. _oMsgText.lineWidth = 500;
  19. _oMsgText.lineHeight = 60;
  20. _oMsgText.outline = 5;
  21. _oMsgText1 = new createjs.Text(""," 60px "+FONT2, "#ff0000");
  22. _oMsgText1.x = CANVAS_WIDTH/2;
  23. _oMsgText1.y = (CANVAS_HEIGHT/2)-150;
  24. _oMsgText1.textAlign = "center";
  25. _oMsgText1.textBaseline = "alphabetic";
  26. _oMsgText1.lineHeight = 60;
  27. _oMsgText1.lineWidth = 500;
  28. _oScoreText = new createjs.Text(""," 60px "+FONT2, "#ffffff");
  29. _oScoreText.x = CANVAS_WIDTH/2;
  30. _oScoreText.y = (CANVAS_HEIGHT/2) + 40;
  31. _oScoreText.textAlign = "center";
  32. _oScoreText.textBaseline = "alphabetic";
  33. _oScoreText.lineWidth = 500;
  34. _oScoreText.outline = 5;
  35. _oScoreText1 = new createjs.Text(""," 60px "+FONT2, "#ff0000");
  36. _oScoreText1.x = CANVAS_WIDTH/2;
  37. _oScoreText1.y = (CANVAS_HEIGHT/2) + 40;
  38. _oScoreText1.textAlign = "center";
  39. _oScoreText1.textBaseline = "alphabetic";
  40. _oScoreText1.lineWidth = 500;
  41. _oGroup = new createjs.Container();
  42. _oGroup.alpha = 0;
  43. _oGroup.visible=false;
  44. _oGroup.addChild(_oBg, _oScoreText, _oScoreText1, _oMsgText, _oMsgText1);
  45. s_oStage.addChild(_oGroup);
  46. };
  47. this.unload = function(){
  48. _oGroup.off("mousedown",this._onExit);
  49. };
  50. this._initListener = function(){
  51. _oGroup.on("mousedown",this._onExit);
  52. };
  53. this.show = function(iScore){
  54. _oMsgText.text = TEXT_GAMEOVER;
  55. _oMsgText1.text = TEXT_GAMEOVER;
  56. _oScoreText.text = TEXT_SCORE + iScore;
  57. _oScoreText1.text = TEXT_SCORE + iScore;
  58. _oGroup.visible = true;
  59. var oParent = this;
  60. createjs.Tween.get(_oGroup).to({alpha:1 }, 500).call(function() {oParent._initListener();});
  61. $(s_oMain).trigger("share_event",iScore);
  62. $(s_oMain).trigger("save_score",iScore);
  63. };
  64. this._onExit = function(){
  65. _oGroup.off("mousedown",this._onExit);
  66. s_oStage.removeChild(_oGroup);
  67. s_oGame.onExit();
  68. };
  69. this._init(oSpriteBg);
  70. return this;
  71. }