About.ts 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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("../EditorUI");
  23. import ModalWindow = require("./ModalWindow");
  24. class About extends ModalWindow {
  25. constructor() {
  26. super();
  27. // we're not calling this.init here as it calls resizeToFitContent
  28. // and center, which screw up the generated About text being resized
  29. this.text = "About the Atomic Game Engine";
  30. this.load("AtomicEditor/editor/ui/about.tb.txt");
  31. this.age_license = <Atomic.UIEditField>this.getWidget("age_license");
  32. this.thirdparty_license = <Atomic.UIEditField>this.getWidget("thirdparty_license");
  33. this.externaltool_license = <Atomic.UIEditField>this.getWidget("externaltool_license");
  34. this.about_text = <Atomic.UIEditField>this.getWidget("about_text");
  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. this.about_text.text = this.generateAboutText();
  43. var get_pro = <Atomic.UIButton>this.getWidget("purchase_pro");
  44. if (get_pro) {
  45. get_pro.onClick = function() {
  46. Atomic.fileSystem.systemOpen("https://store.atomicgameengine.com/site");
  47. };
  48. }
  49. this.resizeToFitContent();
  50. this.center();
  51. this.getWidget("tabcontainer").value = 0;
  52. }
  53. handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
  54. if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
  55. var id = ev.target.id;
  56. if (id == "ok") {
  57. this.hide();
  58. return true;
  59. }
  60. }
  61. }
  62. generateAboutText(): string {
  63. var text = "";
  64. text += "<widget TBImageWidget: filename: 'AtomicEditor/editor/images/atomic_logo.png'>\n\n";
  65. text += "<color #D4FB79>Git SHA: " + Atomic.getGitRevision() +"</color>\n\n";
  66. text += "(c) 2014-2016 THUNDERBEAST GAMES LLC\n\n\n";
  67. text += "<color #D4FB79>Installed platforms and modules:</color>\n\n";
  68. var licenseSystem = ToolCore.licenseSystem;
  69. var installedText = " <widget TBSkinImage: skin: 'LogoMac-Small'> <widget TBSkinImage: skin: 'LogoWindows-Small'> <widget TBSkinImage: skin: 'LogoHTML5-Small'> ";
  70. var availableText = " ";
  71. if (licenseSystem.licenseAndroid)
  72. installedText += "<widget TBSkinImage: skin: 'LogoAndroid-Small'> ";
  73. else
  74. availableText += "<widget TBSkinImage: skin: 'LogoAndroid-Small'> ";
  75. if (licenseSystem.licenseIOS)
  76. installedText += "<widget TBSkinImage: skin: 'LogoIOS-Small'> ";
  77. else
  78. availableText += "<widget TBSkinImage: skin: 'LogoIOS-Small'> ";
  79. installedText += "<widget TBSkinImage: skin: 'Module2D-Small'> ";
  80. if (licenseSystem.licenseModule3D)
  81. installedText += "<widget TBSkinImage: skin: 'Module3D-Small'> ";
  82. else
  83. availableText += "<widget TBSkinImage: skin: 'Module3D-Small'> ";
  84. text += installedText + "\n\n\n";
  85. if (!licenseSystem.licenseIOS || !licenseSystem.licenseAndroid || !licenseSystem.licenseModule3D) {
  86. text += "<color #76D6FF>Available platforms and modules:</color>\n\n";
  87. text += availableText + "\n\n\n";
  88. }
  89. text += "<color #76D6FF>Special Thanks:</color>\n\n";
  90. text += " The Urho3D Project - http://urho3d.github.io\n\n";
  91. text += " Sami Vaarala - http://www.duktape.org";
  92. return text;
  93. }
  94. age_license: Atomic.UIEditField;
  95. thirdparty_license: Atomic.UIEditField;
  96. externaltool_license: Atomic.UIEditField;
  97. about_text: Atomic.UIEditField;
  98. }
  99. export = About;