CHelp.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. function CHelp(){
  2. var _oParent = this;
  3. var _oBg;
  4. var _oGroup1;
  5. var _oButPlay;
  6. var _oCursorMovingContainer;
  7. var _oTargetContainer;
  8. var _oMsgTextOutline;
  9. var _oMsgText;
  10. var _oMsgTextReleaseOutline;
  11. var _oMsgTextRelease;
  12. this._init = function(){
  13. _oBg = createBitmap(s_oSpriteLibrary.getSprite('bg_menu'));
  14. s_oStage.addChild(_oBg);
  15. var oShape = new createjs.Shape();
  16. oShape.graphics.beginFill("#000000").drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);
  17. oShape.alpha = 0.7;
  18. s_oStage.addChild(oShape);
  19. _oGroup1 = new createjs.Container();
  20. _oGroup1.y = CANVAS_WIDTH;
  21. _oGroup1.alpha = 0;
  22. _oBg = createBitmap(s_oSpriteLibrary.getSprite('msg_box'));
  23. _oGroup1.addChild(_oBg);
  24. _oMsgTextOutline = new createjs.Text(""," 25px "+FONT, "#000");
  25. _oMsgTextOutline.x = CANVAS_WIDTH/2+2;
  26. _oMsgTextOutline.y = (CANVAS_HEIGHT/2)-113;
  27. _oMsgTextOutline.textAlign = "center";
  28. _oMsgTextOutline.textBaseline = "alphabetic";
  29. _oMsgTextOutline.lineWidth = 400;
  30. _oGroup1.addChild(_oMsgTextOutline);
  31. _oMsgText = new createjs.Text(""," 25px "+FONT, "#ffc949");
  32. _oMsgText.x = CANVAS_WIDTH/2;
  33. _oMsgText.y = (CANVAS_HEIGHT/2)-115;
  34. _oMsgText.textAlign = "center";
  35. _oMsgText.textBaseline = "alphabetic";
  36. _oMsgText.lineWidth = 400;
  37. _oGroup1.addChild(_oMsgText);
  38. _oMsgTextReleaseOutline = new createjs.Text(""," 25px "+FONT, "#000");
  39. _oMsgTextReleaseOutline.x = CANVAS_WIDTH/2+2;
  40. _oMsgTextReleaseOutline.y = (CANVAS_HEIGHT/2)+52;
  41. _oMsgTextReleaseOutline.textAlign = "center";
  42. _oMsgTextReleaseOutline.textBaseline = "alphabetic";
  43. _oMsgTextReleaseOutline.lineWidth = 400;
  44. _oGroup1.addChild(_oMsgTextReleaseOutline);
  45. _oMsgTextRelease = new createjs.Text(""," 25px "+FONT, "#ffc949");
  46. _oMsgTextRelease.x = CANVAS_WIDTH/2;
  47. _oMsgTextRelease.y = (CANVAS_HEIGHT/2)+50;
  48. _oMsgTextRelease.textAlign = "center";
  49. _oMsgTextRelease.textBaseline = "alphabetic";
  50. _oMsgTextRelease.lineWidth = 400;
  51. _oGroup1.addChild(_oMsgTextRelease);
  52. _oCursorMovingContainer = new createjs.Container();
  53. _oCursorMovingContainer.x = 150;
  54. _oCursorMovingContainer.y = 440;
  55. _oGroup1.addChild(_oCursorMovingContainer);
  56. var oPlayer = createBitmap(s_oSpriteLibrary.getSprite('player'));
  57. _oCursorMovingContainer.addChild(oPlayer);
  58. var oCursor = createBitmap(s_oSpriteLibrary.getSprite('cursor_help'));
  59. oCursor.x = 8;
  60. oCursor.y = 20;
  61. _oCursorMovingContainer.addChild(oCursor);
  62. _oTargetContainer = new createjs.Container();
  63. _oTargetContainer.x = 250;
  64. _oTargetContainer.y = 600;
  65. _oGroup1.addChild(_oTargetContainer);
  66. var oTargetSprite = createBitmap(s_oSpriteLibrary.getSprite('target'));
  67. oTargetSprite.scaleX = oTargetSprite.scaleY = 0.6;
  68. _oTargetContainer.addChild(oTargetSprite); //Draws on canvas
  69. var oGoalTextStroke = new createjs.Text("12/30"," 25px "+FONT, "#000");
  70. oGoalTextStroke.x = 35+2;
  71. oGoalTextStroke.y = 25;
  72. oGoalTextStroke.textAlign = "left";
  73. oGoalTextStroke.textBaseline = "alphabetic";
  74. oGoalTextStroke.lineWidth = 650;
  75. _oTargetContainer.addChild(oGoalTextStroke); //Draws on canvas
  76. var oGoalText = new createjs.Text("12/30"," 25px "+FONT, "#ffc949");
  77. oGoalText.x = 35;
  78. oGoalText.y = 23;
  79. oGoalText.textAlign = "left";
  80. oGoalText.textBaseline = "alphabetic";
  81. oGoalText.lineWidth = 650;
  82. _oTargetContainer.addChild(oGoalText); //Draws on canvas
  83. s_oStage.addChild(_oGroup1);
  84. _oButPlay = createBitmap(s_oSpriteLibrary.getSprite('but_next'));
  85. _oButPlay.x = CANVAS_WIDTH/2-45;
  86. _oButPlay.y = CANVAS_HEIGHT/2+190;
  87. _oButPlay.cursor = "pointer";
  88. _oGroup1.addChild(_oButPlay);
  89. this.show();
  90. this.startCursorAnimationRight();
  91. };
  92. this._initListener = function(){
  93. _oButPlay.addEventListener("click",this._onExit);
  94. };
  95. this.show = function(){
  96. _oMsgTextOutline.text = TEXT_HELP_PANEL_MOVE;
  97. _oMsgText.text = TEXT_HELP_PANEL_MOVE;
  98. _oMsgTextReleaseOutline.text = TEXT_HELP_PANEL_RELEASE;
  99. _oMsgTextRelease.text = TEXT_HELP_PANEL_RELEASE;
  100. createjs.Tween.get(_oGroup1).to({alpha:1 }, 500).call(function() {_oParent._initListener();});
  101. createjs.Tween.get(_oGroup1).to({y: 0 }, 500, createjs.Ease.quadOut).call(function() {});
  102. };
  103. this.startCursorAnimationRight = function(){
  104. createjs.Tween.get(_oCursorMovingContainer).to({ x: 450 }, 2000).call(function() {_oParent.startCursorAnimationLeft();});
  105. };
  106. this.startCursorAnimationLeft = function(){
  107. createjs.Tween.get(_oCursorMovingContainer).to({ x: 150 }, 2000).call(function() {_oParent.startCursorAnimationRight();});
  108. };
  109. this._onExit = function(){
  110. _oParent.unload();
  111. s_oMain.gotoGame(0);
  112. };
  113. this.unload = function(){
  114. createjs.Tween.removeAllTweens();
  115. s_oStage.removeAllChildren();
  116. };
  117. this._init();
  118. return this;
  119. }