EULAWindow.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. import EditorUI = require("ui/EditorUI");
  23. import ModalWindow = require("../ModalWindow");
  24. class EULAWindow extends ModalWindow {
  25. constructor() {
  26. super();
  27. this.settings = Atomic.UI_WINDOW_SETTINGS.UI_WINDOW_SETTINGS_DEFAULT & ~Atomic.UI_WINDOW_SETTINGS.UI_WINDOW_SETTINGS_CLOSE_BUTTON;
  28. this.init("License Agreement", "AtomicEditor/editor/ui/eulaagreement.tb.txt");
  29. this.age_license = <Atomic.UIEditField> this.getWidget("age_license");
  30. this.thirdparty_license = <Atomic.UIEditField> this.getWidget("thirdparty_license");
  31. this.externaltool_license = <Atomic.UIEditField> this.getWidget("externaltool_license");
  32. this.eulaCheck = <Atomic.UICheckBox> this.getWidget("eula_check");
  33. var container = this.getWidget("tabcontainer");
  34. container.value = 0;
  35. var cache = Atomic.cache;
  36. var file = cache.getFile("AtomicEditor/eulas/atomic_game_engine_eula.txt");
  37. this.age_license.text = file.readText();
  38. file = cache.getFile("AtomicEditor/eulas/atomic_thirdparty_eula.txt");
  39. this.thirdparty_license.text = file.readText();
  40. file = cache.getFile("AtomicEditor/eulas/atomic_external_tools_eula.txt");
  41. this.externaltool_license.text = file.readText();
  42. }
  43. handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
  44. if (ev.type == Atomic.UI_EVENT_TYPE.UI_EVENT_TYPE_CLICK) {
  45. var id = ev.target.id;
  46. if (id == "quit") {
  47. this.sendEvent(Atomic.ExitRequestedEventType);
  48. return true;
  49. } else if (id == "ok") {
  50. if (!this.eulaCheck.value) {
  51. EditorUI.showModalError("License Agreement", "Please agree to licensing terms and conditions to continue");
  52. return true;
  53. }
  54. this.hide();
  55. var licenseSystem = ToolCore.getLicenseSystem();
  56. licenseSystem.licenseAgreementConfirmed();
  57. this.sendEvent(ToolCore.LicenseEulaAcceptedEventType);
  58. return true;
  59. }
  60. }
  61. }
  62. age_license: Atomic.UIEditField;
  63. thirdparty_license: Atomic.UIEditField;
  64. externaltool_license: Atomic.UIEditField;
  65. eulaCheck: Atomic.UICheckBox;
  66. }
  67. export = EULAWindow;