CEndPanel.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. function CEndPanel(oSpriteBg){
  2. var _iScore;
  3. var _oBg;
  4. var _oScoreTextBack;
  5. var _oScoreText;
  6. var _oMsgText;
  7. var _oMsgTextBack;
  8. var _oGroup;
  9. this._init = function(oSpriteBg){
  10. _oGroup = new createjs.Container();
  11. _oGroup.alpha = 0;
  12. _oGroup.visible=false;
  13. s_oStage.addChild(_oGroup);
  14. _oBg = createBitmap(oSpriteBg);
  15. _oGroup.addChild(_oBg);
  16. _oMsgTextBack = new createjs.Text("","60px "+FONT_GAME, "#000");
  17. _oMsgTextBack.x = CANVAS_WIDTH/2 +1;
  18. _oMsgTextBack.y = (CANVAS_HEIGHT/2)-160;
  19. _oMsgTextBack.textAlign = "center";
  20. _oGroup.addChild(_oMsgTextBack);
  21. _oMsgText = new createjs.Text("","60px "+FONT_GAME, "#ffffff");
  22. _oMsgText.x = CANVAS_WIDTH/2;
  23. _oMsgText.y = (CANVAS_HEIGHT/2)-162;
  24. _oMsgText.textAlign = "center";
  25. _oGroup.addChild(_oMsgText);
  26. _oScoreTextBack = new createjs.Text("","40px "+FONT_GAME, "#000");
  27. _oScoreTextBack.x = CANVAS_WIDTH/2 +1;
  28. _oScoreTextBack.y = (CANVAS_HEIGHT/2) + 50;
  29. _oScoreTextBack.textAlign = "center";
  30. _oGroup.addChild(_oScoreTextBack);
  31. _oScoreText = new createjs.Text("","40px "+FONT_GAME, "#ffffff");
  32. _oScoreText.x = CANVAS_WIDTH/2;
  33. _oScoreText.y = (CANVAS_HEIGHT/2) + 52;
  34. _oScoreText.textAlign = "center";
  35. _oGroup.addChild(_oScoreText);
  36. };
  37. this.unload = function(){
  38. _oGroup.off("mousedown",this._onExit);
  39. };
  40. this._initListener = function(){
  41. _oGroup.on("mousedown",this._onExit);
  42. $(s_oMain).trigger("show_interlevel_ad");
  43. };
  44. this.show = function(iScore,bChallengeMode){
  45. _iScore = iScore;
  46. _oMsgTextBack.text = TEXT_GAMEOVER;
  47. _oMsgText.text = TEXT_GAMEOVER;
  48. _oScoreTextBack.text = TEXT_SCORE +": "+iScore;
  49. _oScoreText.text = TEXT_SCORE +": "+iScore;
  50. _oGroup.visible = true;
  51. var oParent = this;
  52. createjs.Tween.get(_oGroup).to({alpha:1 }, 500).call(function() {oParent._initListener();});
  53. $(s_oMain).trigger("save_score",[iScore,bChallengeMode?"challenge":"normal"]);
  54. };
  55. this._onExit = function(){
  56. $(s_oMain).trigger("share_event",_iScore);
  57. _oGroup.off("mousedown",this._onExit);
  58. s_oStage.removeChild(_oGroup);
  59. s_oGame.unload();
  60. };
  61. this._init(oSpriteBg);
  62. return this;
  63. }