CScoreBoard.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. function CScoreBoard(iX, iY, oSprite, oParentContainer) {
  2. var _oBg;
  3. var _oTextScoreAmount;
  4. var _oTextScoreAmountAmountStroke;
  5. var _oContainer;
  6. var _pStartPos;
  7. var _oParentContainer = oParentContainer;
  8. this._init = function (iX, iY, oSprite) {
  9. _pStartPos = {x: iX, y: iY};
  10. _oContainer = new createjs.Container();
  11. _oContainer.x = iX;
  12. _oContainer.y = iY;
  13. _oParentContainer.addChild(_oContainer);
  14. _oBg = createBitmap(oSprite);
  15. _oBg.regX = oSprite.width * 0.5;
  16. _oBg.regY = oSprite.height * 0.5;
  17. _oContainer.addChild(_oBg);
  18. var oTextScoreAmountStroke = new CTLText(_oContainer,
  19. -90, -45, 180, 36,
  20. 36, "center", "#025cce", PRIMARY_FONT, 1,
  21. 0, 0,
  22. TEXT_SCORE,
  23. true, true, false,
  24. false );
  25. oTextScoreAmountStroke.setOutline(4);
  26. var oTextScore = new CTLText(_oContainer,
  27. -90, -45, 180, 36,
  28. 36, "center", "#ffd800", PRIMARY_FONT, 1,
  29. 0, 0,
  30. TEXT_SCORE,
  31. true, true, false,
  32. false );
  33. _oTextScoreAmountAmountStroke = new CTLText(_oContainer,
  34. -80, 6, 170, 36,
  35. 36, "center", "#025cce", PRIMARY_FONT, 1,
  36. 0, 0,
  37. "0",
  38. true, true, false,
  39. false );
  40. _oTextScoreAmountAmountStroke.setOutline(4);
  41. _oTextScoreAmount = new CTLText(_oContainer,
  42. -80, 6, 170, 36,
  43. 36, "center", "#ffd800", PRIMARY_FONT, 1,
  44. 0, 0,
  45. "0",
  46. true, true, false,
  47. false );
  48. };
  49. this.refreshScore = function (iScore) {
  50. _oTextScoreAmount.refreshText(iScore);
  51. _oTextScoreAmountAmountStroke.refreshText(iScore);
  52. };
  53. this.getStartPos = function () {
  54. return _pStartPos;
  55. };
  56. this.setPosition = function (iX, iY) {
  57. _oContainer.x = iX;
  58. _oContainer.y = iY;
  59. };
  60. this._init(iX, iY, oSprite);
  61. return this;
  62. }