EULAWindow.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import EditorEvents = require("../../editor/EditorEvents");
  2. import EditorUI = require("../EditorUI");
  3. import ModalWindow = require("../modal/ModalWindow");
  4. class EULAWindow extends ModalWindow {
  5. constructor() {
  6. super();
  7. this.settings = Atomic.UI_WINDOW_SETTINGS_DEFAULT & ~Atomic.UI_WINDOW_SETTINGS_CLOSE_BUTTON;
  8. this.init("License Agreement", "AtomicEditor/editor/ui/eulaagreement.tb.txt");
  9. this.age_license = <Atomic.UIEditField> this.getWidget("age_license");
  10. this.thirdparty_license = <Atomic.UIEditField> this.getWidget("thirdparty_license");
  11. this.externaltool_license = <Atomic.UIEditField> this.getWidget("externaltool_license");
  12. this.eulaCheck = <Atomic.UICheckBox> this.getWidget("eula_check");
  13. var container = this.getWidget("tabcontainer");
  14. container.value = 0;
  15. var cache = Atomic.cache;
  16. var file = cache.getFile("AtomicEditor/eulas/atomic_game_engine_eula.txt");
  17. this.age_license.text = file.readText();
  18. file = cache.getFile("AtomicEditor/eulas/atomic_thirdparty_eula.txt");
  19. this.thirdparty_license.text = file.readText();
  20. file = cache.getFile("AtomicEditor/eulas/atomic_external_tools_eula.txt");
  21. this.externaltool_license.text = file.readText();
  22. }
  23. handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
  24. if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
  25. var id = ev.target.id;
  26. if (id == "quit") {
  27. this.sendEvent(EditorEvents.Quit);
  28. return true;
  29. } else if (id == "ok") {
  30. if (!this.eulaCheck.value) {
  31. EditorUI.showModalError("License Agreement", "Please agree to licensing terms and conditions to continue");
  32. return true;
  33. }
  34. this.hide();
  35. var licenseSystem = ToolCore.getLicenseSystem();
  36. licenseSystem.licenseAgreementConfirmed();
  37. return true;
  38. }
  39. }
  40. }
  41. age_license: Atomic.UIEditField;
  42. thirdparty_license: Atomic.UIEditField;
  43. externaltool_license: Atomic.UIEditField;
  44. eulaCheck: Atomic.UICheckBox;
  45. }
  46. export = EULAWindow;