AboutBox.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using BansheeEngine;
  4. namespace BansheeEditor
  5. {
  6. /// <summary>
  7. /// Displays information about the engine, its creator and licenses.
  8. /// </summary>
  9. public class AboutBox : ModalWindow
  10. {
  11. private GUITextBox emailLabel;
  12. /// <summary>
  13. /// Opens the about box.
  14. /// </summary>
  15. [MenuItem("Help/About", 5000)]
  16. public static void Open()
  17. {
  18. new AboutBox();
  19. }
  20. /// <summary>
  21. /// Constructs the about box.
  22. /// </summary>
  23. protected AboutBox()
  24. : base(true)
  25. {
  26. Title = "About";
  27. Width = 400;
  28. Height = 400;
  29. }
  30. private void OnInitialize()
  31. {
  32. GUILabel title = new GUILabel(new LocEdString("Banshee Engine v0.3"), EditorStyles.TitleLabel);
  33. GUILabel subTitle = new GUILabel(new LocEdString("A modern open-source game development toolkit"),
  34. EditorStyles.LabelCentered);
  35. GUILabel license = new GUILabel(new LocEdString(
  36. "This program is licensed under the GNU General Public License V3"), EditorStyles.LabelCentered);
  37. GUILabel copyright = new GUILabel(new LocEdString("Copyright (C) 2015 Marko Pintera. All rights reserved."),
  38. EditorStyles.LabelCentered);
  39. GUILabel emailTitle = new GUILabel(new LocEdString("E-mail"), GUIOption.FixedWidth(150));
  40. emailLabel = new GUITextBox();
  41. GUILabel linkedInTitle = new GUILabel(new LocEdString("LinkedIn"), GUIOption.FixedWidth(150));
  42. GUIButton linkedInBtn = new GUIButton(new LocEdString("Profile"));
  43. GUIToggleGroup foldoutGroup = new GUIToggleGroup(true);
  44. GUIToggle contactFoldout = new GUIToggle(new LocEdString("Author contact"), foldoutGroup, EditorStyles.Foldout);
  45. GUIToggle thirdPartyFoldout = new GUIToggle(new LocEdString("Used third party libraries"), foldoutGroup, EditorStyles.Foldout);
  46. GUIToggle noticesFoldout = new GUIToggle(new LocEdString("Third party notices"), foldoutGroup, EditorStyles.Foldout);
  47. GUIToggle collaboratorsFoldout = new GUIToggle(new LocEdString("Collaborators"), foldoutGroup, EditorStyles.Foldout);
  48. GUILabel freeTypeNotice = new GUILabel(new LocEdString(
  49. "Portions of this software are copyright (C) 2015 The FreeType Project (www.freetype.org). " +
  50. "All rights reserved."), EditorStyles.MultiLineLabelCentered,
  51. GUIOption.FlexibleHeight(), GUIOption.FixedWidth(380));
  52. GUILabel fbxSdkNotice = new GUILabel(new LocEdString(
  53. "This software contains Autodesk(R) FBX(R) code developed by Autodesk, Inc. Copyright 2013 Autodesk, Inc. " +
  54. "All rights, reserved. Such code is provided \"as is\" and Autodesk, Inc. disclaims any and all warranties, " +
  55. "whether express or implied, including without limitation the implied warranties of merchantability, " +
  56. "fitness for a particular purpose or non-infringement of third party rights. In no event shall Autodesk, " +
  57. "Inc. be liable for any direct, indirect, incidental, special, exemplary, or consequential damages " +
  58. "(including, but not limited to, procurement of substitute goods or services; loss of use, data, or " +
  59. "profits; or business interruption) however caused and on any theory of liability, whether in contract, " +
  60. "strict liability, or tort (including negligence or otherwise) arising in any way out of such code."),
  61. EditorStyles.MultiLineLabelCentered, GUIOption.FlexibleHeight(), GUIOption.FixedWidth(380));
  62. GUILayoutY mainLayout = GUI.AddLayoutY();
  63. mainLayout.AddSpace(10);
  64. mainLayout.AddElement(title);
  65. mainLayout.AddElement(subTitle);
  66. mainLayout.AddSpace(10);
  67. mainLayout.AddElement(license);
  68. mainLayout.AddElement(copyright);
  69. mainLayout.AddSpace(10);
  70. mainLayout.AddElement(contactFoldout);
  71. GUILayoutY contactLayout = mainLayout.AddLayoutY();
  72. GUILayout emailLayout = contactLayout.AddLayoutX();
  73. emailLayout.AddSpace(10);
  74. emailLayout.AddElement(emailTitle);
  75. emailLayout.AddElement(emailLabel);
  76. emailLayout.AddSpace(10);
  77. GUILayout linkedInLayout = contactLayout.AddLayoutX();
  78. linkedInLayout.AddSpace(10);
  79. linkedInLayout.AddElement(linkedInTitle);
  80. linkedInLayout.AddElement(linkedInBtn);
  81. linkedInLayout.AddSpace(10);
  82. mainLayout.AddSpace(5);
  83. mainLayout.AddElement(thirdPartyFoldout);
  84. GUILayoutY thirdPartyLayout = mainLayout.AddLayoutY();
  85. CreateThirdPartyGUI(thirdPartyLayout, "Autodesk FBX SDK",
  86. "http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775847", "FBX_SDK_License.rtf");
  87. CreateThirdPartyGUI(thirdPartyLayout, "FreeImage", "http://freeimage.sourceforge.net/", "freeimage-license.txt");
  88. CreateThirdPartyGUI(thirdPartyLayout, "FreeType", "http://www.freetype.org/", "FTL.TXT");
  89. CreateThirdPartyGUI(thirdPartyLayout, "Mono", "http://www.mono-project.com/", "Mono.txt");
  90. CreateThirdPartyGUI(thirdPartyLayout, "NVIDIA Texture Tools",
  91. "https://github.com/castano/nvidia-texture-tools", "NVIDIATextureTools.txt");
  92. mainLayout.AddSpace(5);
  93. mainLayout.AddElement(noticesFoldout);
  94. GUILayout noticesLayout = mainLayout.AddLayoutY();
  95. noticesLayout.AddElement(freeTypeNotice);
  96. noticesLayout.AddSpace(10);
  97. noticesLayout.AddElement(fbxSdkNotice);
  98. mainLayout.AddSpace(5);
  99. mainLayout.AddElement(collaboratorsFoldout);
  100. GUILayoutY collaboratorsLayout = mainLayout.AddLayoutY();
  101. CreateCollaboratorGUI(collaboratorsLayout, "Danijel Ribic", "Logo, UI icons, 3D models & textures");
  102. mainLayout.AddFlexibleSpace();
  103. contactLayout.Active = false;
  104. contactFoldout.OnToggled += x =>
  105. {
  106. contactLayout.Active = x;
  107. };
  108. thirdPartyLayout.Active = false;
  109. thirdPartyFoldout.OnToggled += x => thirdPartyLayout.Active = x;
  110. noticesLayout.Active = false;
  111. noticesFoldout.OnToggled += x => noticesLayout.Active = x;
  112. collaboratorsLayout.Active = false;
  113. collaboratorsFoldout.OnToggled += x => collaboratorsLayout.Active = x;
  114. emailLabel.Text = "[email protected]";
  115. linkedInBtn.OnClick += () => { System.Diagnostics.Process.Start("http://hr.linkedin.com/in/markopintera"); };
  116. }
  117. private void CreateThirdPartyGUI(GUILayoutY layout, string name, string webURL, string licenseFile)
  118. {
  119. GUILabel label = new GUILabel(new LocEdString(name), GUIOption.FixedWidth(150));
  120. GUIButton linkBtn = new GUIButton(new LocEdString("Website"), GUIOption.FixedWidth(50));
  121. GUIButton licenseBtn = new GUIButton(new LocEdString("License"), GUIOption.FixedWidth(50));
  122. string licensePath = "..\\..\\..\\License\\Third Party\\" + licenseFile;
  123. GUILayoutX horzLayout = layout.AddLayoutX();
  124. horzLayout.AddSpace(10);
  125. horzLayout.AddElement(label);
  126. horzLayout.AddSpace(10);
  127. horzLayout.AddElement(linkBtn);
  128. horzLayout.AddSpace(5);
  129. horzLayout.AddElement(licenseBtn);
  130. horzLayout.AddSpace(10);
  131. linkBtn.OnClick += () => { System.Diagnostics.Process.Start(webURL); };
  132. licenseBtn.OnClick += () => { System.Diagnostics.Process.Start(licensePath); };
  133. }
  134. private void CreateCollaboratorGUI(GUILayoutY layout, string name, string area)
  135. {
  136. GUILabel nameLabel = new GUILabel(new LocEdString(name), GUIOption.FixedWidth(150));
  137. GUILabel areaLabel = new GUILabel(new LocEdString(area), GUIOption.FixedWidth(220));
  138. GUILayoutX horzLayout = layout.AddLayoutX();
  139. horzLayout.AddSpace(10);
  140. horzLayout.AddElement(nameLabel);
  141. horzLayout.AddSpace(10);
  142. horzLayout.AddElement(areaLabel);
  143. horzLayout.AddSpace(10);
  144. }
  145. private void OnEditorUpdate()
  146. {
  147. emailLabel.Text = "[email protected]";
  148. }
  149. }
  150. }