Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. var Place = (function () {
  2. // Constructor
  3. function Place(game) {
  4. this.game = game;
  5. }
  6. // Public methods
  7. Place.prototype.addBackToButton = function (renderArea, callbackCollection, text, translated, otherClass, y, x) {
  8. if (y === void 0) { y = 0; }
  9. if (x === void 0) { x = -1; }
  10. // If the x position is under zero, we set it so that the button will be centered
  11. if (x < 0) {
  12. x = renderArea.getWidth() / 2 - text.length / 2;
  13. }
  14. renderArea.addAsciiRealButton(text, x, y, otherClass, translated, true);
  15. renderArea.addLinkCall("." + otherClass, callbackCollection);
  16. };
  17. Place.prototype.addBackToMainMapButton = function (renderArea, otherClass, textName) {
  18. if (textName === void 0) { textName = "buttonBackToTheMap"; }
  19. this.addBackToButton(renderArea, new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), Database.getText(textName), Database.getTranslatedText(textName), otherClass);
  20. };
  21. // Public getters
  22. Place.prototype.getDefaultScroll = function () {
  23. return 0;
  24. };
  25. Place.prototype.getGame = function () {
  26. return this.game;
  27. };
  28. Place.prototype.getGap = function () {
  29. return 0;
  30. };
  31. Place.prototype.getRenderArea = function () {
  32. return new RenderArea(); // We return a new render area, but this should not happen, since our daughter class should override this function
  33. };
  34. Place.prototype.getScrolling = function () {
  35. return false; // By default, we disable scrolling on the place
  36. };
  37. Place.prototype.willBeClosed = function () { };
  38. Place.prototype.willBeDisplayed = function () { };
  39. Place.prototype.willStopBeingDisplayed = function () { };
  40. return Place;
  41. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement