AtomicNETWindow.ts 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 AtomicNETWindow extends ModalWindow {
  25. constructor() {
  26. super();
  27. this.settings = Atomic.UI_WINDOW_SETTINGS_DEFAULT & ~Atomic.UI_WINDOW_SETTINGS_CLOSE_BUTTON;
  28. // we're not calling this.init here as it calls resizeToFitContent
  29. // and center, which screw up the generated About text being resized
  30. this.text = "Atomic C# Requirements";
  31. this.load("AtomicEditor/editor/ui/atomicnetwindow.tb.txt");
  32. this.downloadButton = <Atomic.UIButton>this.getWidget("download_button");
  33. this.atomicnet_text = <Atomic.UIEditField>this.getWidget("atomicnet_text");
  34. this.atomicnet_text.text = this.generateAtomicNETText();
  35. this.resizeToFitContent();
  36. this.center();
  37. }
  38. handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
  39. if (ev.type == Atomic.UI_EVENT_TYPE_CLICK) {
  40. var id = ev.target.id;
  41. if (id == "ok") {
  42. this.hide();
  43. return true;
  44. }
  45. if (id == "download_button") {
  46. this.hide();
  47. if ( Atomic.platform == "Windows")
  48. Atomic.fileSystem.systemOpen( "https://www.visualstudio.com/vs/community/" );
  49. if ( Atomic.platform == "MacOSX")
  50. Atomic.fileSystem.systemOpen( "https://www.xamarin.com/download/");
  51. if ( Atomic.platform == "Linux")
  52. Atomic.fileSystem.systemOpen( "https://github.com/AtomicGameEngine/AtomicGameEngine/wiki/Detailed-instructions-for-building-on-Linux");
  53. }
  54. }
  55. }
  56. generateAtomicNETText(): string {
  57. // start at Atomic.platform == "Windows"
  58. let ideText:string = "Visual Studio";
  59. if ( Atomic.platform == "MacOSX") ideText = "Visual Studio for Mac";
  60. if ( Atomic.platform == "Linux") ideText = "MonoDevelop";
  61. let installText = `Please install ${ideText} with <color #D4FB79>Xamarin.Android</color> and <color #D4FB79>Xamarin.iOS</color>`;
  62. if ( Atomic.platform != "Linux" )
  63. this.downloadButton.text = `Download ${ideText}`;
  64. else
  65. this.downloadButton.text = `Install ${ideText}`;
  66. let text = "";
  67. text += `
  68. Atomic C# is integrated with <color #D4FB79>Visual Studio</color>, <color #D4FB79>Visual Studio for Mac</color>, and <color #D4FB79>MonoDevelop</color> to provide a first class editing, debugging, and deployment experience.
  69. ${installText}
  70. `;
  71. return text;
  72. }
  73. atomicnet_text: Atomic.UIEditField;
  74. downloadButton: Atomic.UIButton;
  75. }
  76. export = AtomicNETWindow;