about.js 808 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. 'use strict';
  2. var game = Atomic.game;
  3. var view = game.uiView;
  4. var UI = Atomic.UI;
  5. var UIWindow = Atomic.UIWindow;
  6. var window;
  7. function closeWindow() {
  8. if (window)
  9. window.die();
  10. window = null;
  11. }
  12. exports.init = function(onClose) {
  13. window = new UIWindow();
  14. window.settings = UI.WINDOW_SETTINGS_TITLEBAR;
  15. window.text = "About Atomic Space Game";
  16. window.load("UI/about.ui.txt");
  17. window.resizeToFitContent();
  18. view.addChild(window);
  19. window.center();
  20. var file = game.cache.getFile("UI/about.txt");
  21. var text = file.readText();
  22. text = text.replace("$Platform", Atomic.platform);
  23. window.getWidget("about_text").text = text ;
  24. window.getWidget("ok").onClick = function () {
  25. closeWindow();
  26. onClose();
  27. };
  28. };
  29. exports.shutdown = function() {
  30. closeWindow();
  31. };