AboutBox.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using bs;
  4. namespace bs.Editor
  5. {
  6. /** @addtogroup Windows
  7. * @{
  8. */
  9. /// <summary>
  10. /// Displays information about the engine, its creators and licenses.
  11. /// </summary>
  12. public class AboutBox : ModalWindow
  13. {
  14. private GUITextBox emailLabel;
  15. /// <summary>
  16. /// Opens the about box.
  17. /// </summary>
  18. [MenuItem("Help/About", 5000)]
  19. public static void Open()
  20. {
  21. new AboutBox();
  22. }
  23. /// <summary>
  24. /// Constructs the about box.
  25. /// </summary>
  26. protected AboutBox()
  27. : base(true)
  28. {
  29. Title = "About Banshee";
  30. Width = 450;
  31. Height = 400;
  32. }
  33. private void OnInitialize()
  34. {
  35. GUILabel title = new GUILabel(new LocEdString("Banshee Editor " + EngineVersion.GetFullVersionString()), EditorStyles.TitleLabel);
  36. GUILabel subTitle = new GUILabel(new LocEdString("A modern open-source game development toolkit"),
  37. EditorStyles.LabelCentered);
  38. GUILabel bsfVersion = new GUILabel(new LocEdString("Powered by bs::framework " + FrameworkVersion.GetFullVersionString()), EditorStyles.LabelCentered);
  39. GUILabel license = new GUILabel(new LocEdString(
  40. "This program is licensed under the GNU Lesser General Public License V3 or later"), EditorStyles.LabelCentered);
  41. GUILabel copyright = new GUILabel(new LocEdString("Copyright (C) 2014 - " + EngineVersion.GetCurrentReleaseYearNumber() + " Marko Pintera and contributors. All rights reserved."),
  42. EditorStyles.LabelCentered);
  43. GUILabel editorContributorsLabel = new GUILabel(new LocEdString("Editor contributors"), EditorStyles.TitleLabel);
  44. GUILabel frameworkContributorsLabel = new GUILabel(new LocEdString("Framework contributors"), EditorStyles.TitleLabel);
  45. GUILabel engineLabel = new GUILabel(new LocEdString("Editor and engine"), EditorStyles.TitleLabel);
  46. GUILabel frameworkLabel = new GUILabel(new LocEdString("Framework"), EditorStyles.TitleLabel);
  47. GUILabel authorLabel = new GUILabel(new LocEdString("Banshee was created, and is being actively developed by Marko Pintera."));
  48. GUILabel emailTitle = new GUILabel(new LocEdString("E-mail"), GUIOption.FixedWidth(150));
  49. emailLabel = new GUITextBox();
  50. GUILabel linkedInTitle = new GUILabel(new LocEdString("LinkedIn"), GUIOption.FixedWidth(150));
  51. GUIButton linkedInBtn = new GUIButton(new LocEdString("Profile"));
  52. GUIButton patreonBtn = new GUIButton(new LocEdString("Support us on Patreon!"), GUIOption.FixedWidth(210));
  53. GUIButton paypalBtn = new GUIButton(new LocEdString("Donate via PayPal!"), GUIOption.FixedWidth(210));
  54. GUIScrollArea scrollArea = new GUIScrollArea();
  55. GUIToggleGroup foldoutGroup = new GUIToggleGroup(true);
  56. GUIToggle contactFoldout = new GUIToggle(new LocEdString("Main author"), foldoutGroup, EditorStyles.Foldout);
  57. GUIToggle thirdPartyFoldout = new GUIToggle(new LocEdString("Used third party libraries"), foldoutGroup, EditorStyles.Foldout);
  58. GUIToggle noticesFoldout = new GUIToggle(new LocEdString("Third party notices"), foldoutGroup, EditorStyles.Foldout);
  59. GUIToggle contributorsFoldout = new GUIToggle(new LocEdString("Contributors"), foldoutGroup, EditorStyles.Foldout);
  60. GUIToggle socialFoldout = new GUIToggle(new LocEdString("Social"), foldoutGroup, EditorStyles.Foldout);
  61. contactFoldout.AcceptsKeyFocus = false;
  62. thirdPartyFoldout.AcceptsKeyFocus = false;
  63. noticesFoldout.AcceptsKeyFocus = false;
  64. contributorsFoldout.AcceptsKeyFocus = false;
  65. socialFoldout.AcceptsKeyFocus = false;
  66. GUILabel freeTypeNotice = new GUILabel(new LocEdString(
  67. "Portions of this software are copyright (C) 2019 The FreeType Project (www.freetype.org). " +
  68. "All rights reserved."), EditorStyles.MultiLineLabelCentered,
  69. GUIOption.FlexibleHeight(), GUIOption.FixedWidth(380));
  70. GUILabel fbxSdkNotice = new GUILabel(new LocEdString(
  71. "This software contains Autodesk(R) FBX(R) code developed by Autodesk, Inc. Copyright 2019 Autodesk, Inc. " +
  72. "All rights, reserved. Such code is provided \"as is\" and Autodesk, Inc. disclaims any and all warranties, " +
  73. "whether express or implied, including without limitation the implied warranties of merchantability, " +
  74. "fitness for a particular purpose or non-infringement of third party rights. In no event shall Autodesk, " +
  75. "Inc. be liable for any direct, indirect, incidental, special, exemplary, or consequential damages " +
  76. "(including, but not limited to, procurement of substitute goods or services; loss of use, data, or " +
  77. "profits; or business interruption) however caused and on any theory of liability, whether in contract, " +
  78. "strict liability, or tort (including negligence or otherwise) arising in any way out of such code."),
  79. EditorStyles.MultiLineLabelCentered, GUIOption.FlexibleHeight(), GUIOption.FixedWidth(380));
  80. string[ , ] contributorListEditor = new string[ , ]
  81. {
  82. { "Danijel Ribic", "Logo, UI icons, 3D models & textures"},
  83. { "Marco Bellan", "Bugfixes, editor enhancements" },
  84. { "Robert Campbell", "Editor enhancements" },
  85. { "James Mitchell", "Build enhancements"},
  86. { "Patrick Recko", "Minor enhancements" }
  87. };
  88. string[] contributorListFramework = new string[]
  89. {
  90. "Marc Legendre",
  91. "Florian Will",
  92. "Marco Bellan",
  93. "Artur K. (@nemerle)",
  94. "Michael Jones",
  95. "Connor Fitzgerald",
  96. "Paolo Paoletto",
  97. "Patrick Recko",
  98. "Guillaume Meunier",
  99. "Andre Taulien",
  100. "James Mitchell",
  101. "and others..."
  102. };
  103. GUILayoutY mainLayout = GUI.AddLayoutY();
  104. mainLayout.AddSpace(10);
  105. mainLayout.AddElement(title);
  106. mainLayout.AddElement(subTitle);
  107. mainLayout.AddSpace(10);
  108. mainLayout.AddElement(bsfVersion);
  109. mainLayout.AddSpace(10);
  110. mainLayout.AddElement(license);
  111. mainLayout.AddSpace(5);
  112. mainLayout.AddElement(copyright);
  113. mainLayout.AddSpace(10);
  114. GUILayoutX donateButtonLayoutX = mainLayout.AddLayoutX();
  115. donateButtonLayoutX.AddSpace(10);
  116. donateButtonLayoutX.AddElement(patreonBtn);
  117. donateButtonLayoutX.AddSpace(10);
  118. donateButtonLayoutX.AddElement(paypalBtn);
  119. donateButtonLayoutX.AddSpace(10);
  120. mainLayout.AddSpace(10);
  121. mainLayout.AddElement(scrollArea);
  122. scrollArea.Layout.AddElement(contactFoldout);
  123. GUILayoutY contactLayout = scrollArea.Layout.AddLayoutY();
  124. contactLayout.AddSpace(15);
  125. GUILayout authorLayout = contactLayout.AddLayoutX();
  126. authorLayout.AddFlexibleSpace();
  127. authorLayout.AddElement(authorLabel);
  128. authorLayout.AddFlexibleSpace();
  129. contactLayout.AddSpace(15);
  130. GUILayout emailLayout = contactLayout.AddLayoutX();
  131. emailLayout.AddSpace(10);
  132. emailLayout.AddElement(emailTitle);
  133. emailLayout.AddElement(emailLabel);
  134. emailLayout.AddSpace(10);
  135. GUILayout linkedInLayout = contactLayout.AddLayoutX();
  136. linkedInLayout.AddSpace(10);
  137. linkedInLayout.AddElement(linkedInTitle);
  138. linkedInLayout.AddElement(linkedInBtn);
  139. linkedInLayout.AddSpace(10);
  140. scrollArea.Layout.AddSpace(5);
  141. scrollArea.Layout.AddElement(thirdPartyFoldout);
  142. GUILayoutY thirdPartyLayout = scrollArea.Layout.AddLayoutY();
  143. thirdPartyLayout.AddSpace(5);
  144. CreateNameURLBtnPair(thirdPartyLayout, "Autodesk FBX SDK",
  145. "https://www.autodesk.com/products/fbx/overview", "Website");
  146. CreateNameURLBtnPair(thirdPartyLayout, "FreeImage", "http://freeimage.sourceforge.net/", "Website");
  147. CreateNameURLBtnPair(thirdPartyLayout, "FreeType", "http://www.freetype.org/", "Website");
  148. CreateNameURLBtnPair(thirdPartyLayout, "Mono", "http://www.mono-project.com/", "Website");
  149. CreateNameURLBtnPair(thirdPartyLayout, "NVIDIA Texture Tools",
  150. "https://github.com/castano/nvidia-texture-tools", "Website");
  151. CreateNameURLBtnPair(thirdPartyLayout, "libFLAC", "https://xiph.org/flac/", "Website");
  152. CreateNameURLBtnPair(thirdPartyLayout, "libOgg", "https://www.xiph.org/ogg/", "Website");
  153. CreateNameURLBtnPair(thirdPartyLayout, "libVorbis", "http://www.vorbis.com/", "Website");
  154. CreateNameURLBtnPair(thirdPartyLayout, "OpenAL Soft", "http://kcat.strangesoft.net/openal.html", "Website");
  155. CreateNameURLBtnPair(thirdPartyLayout, "NVIDIA PhysX", "https://developer.nvidia.com/physx-sdk", "Website");
  156. scrollArea.Layout.AddSpace(5);
  157. scrollArea.Layout.AddElement(noticesFoldout);
  158. GUILayout noticesLayout = scrollArea.Layout.AddLayoutY();
  159. noticesLayout.AddSpace(5);
  160. noticesLayout.AddElement(freeTypeNotice);
  161. noticesLayout.AddSpace(10);
  162. noticesLayout.AddElement(fbxSdkNotice);
  163. scrollArea.Layout.AddSpace(5);
  164. scrollArea.Layout.AddElement(contributorsFoldout);
  165. GUILayoutY contributorsLayout = scrollArea.Layout.AddLayoutY();
  166. contributorsLayout.AddSpace(5);
  167. contributorsLayout.AddElement(editorContributorsLabel);
  168. contributorsLayout.AddSpace(5);
  169. for (int i = 0; i < contributorListEditor.Length / 2; i++)
  170. {
  171. CreateEditorContributorGUI(contributorsLayout, contributorListEditor[i, 0], contributorListEditor[i, 1]);
  172. contributorsLayout.AddSpace(5);
  173. }
  174. contributorsLayout.AddSpace(10);
  175. contributorsLayout.AddElement(frameworkContributorsLabel);
  176. contributorsLayout.AddSpace(5);
  177. for (int i = 0; i < contributorListFramework.Length; i++)
  178. {
  179. CreateFrameworkContributorGUI(contributorsLayout, contributorListFramework[i]);
  180. contributorsLayout.AddSpace(5);
  181. }
  182. scrollArea.Layout.AddSpace(5);
  183. scrollArea.Layout.AddElement(socialFoldout);
  184. GUILayoutY socialLayout = scrollArea.Layout.AddLayoutY();
  185. socialLayout.AddSpace(10);
  186. CreateNameURLBtnPair(socialLayout, "Discord", "https://discord.gg/8Xyf5gF", "Enter");
  187. socialLayout.AddSpace(10);
  188. socialLayout.AddElement(engineLabel);
  189. socialLayout.AddSpace(5);
  190. CreateNameURLBtnPair(socialLayout, "Website", "http://www.banshee3d.com", "Enter");
  191. CreateNameURLBtnPair(socialLayout, "Repository", "https://github.com/BearishSun/BansheeEngine", "Enter");
  192. CreateNameURLBtnPair(socialLayout, "Forums", "https://forum.banshee3d.com", "Enter");
  193. CreateNameURLBtnPair(socialLayout, "Twitter", "https://twitter.com/Banshee3D", "Enter");
  194. CreateNameURLBtnPair(socialLayout, "Facebook", "https://www.facebook.com/Banshee3D", "Enter");
  195. socialLayout.AddSpace(10);
  196. socialLayout.AddElement(frameworkLabel);
  197. socialLayout.AddSpace(5);
  198. CreateNameURLBtnPair(socialLayout, "Website", "http://www.bsframework.io", "Enter");
  199. CreateNameURLBtnPair(socialLayout, "Repository", "https://github.com/GameFoundry/bsf", "Enter");
  200. CreateNameURLBtnPair(socialLayout, "Forums", "https://discourse.bsframework.io/", "Enter");
  201. CreateNameURLBtnPair(socialLayout, "Twitter", "https://twitter.com/thebsframework", "Enter");
  202. CreateNameURLBtnPair(socialLayout, "Facebook", "https://www.facebook.com/bsframework", "Enter");
  203. mainLayout.AddFlexibleSpace();
  204. contactLayout.Active = false;
  205. contactFoldout.OnToggled += x => contactLayout.Active = x;
  206. thirdPartyLayout.Active = false;
  207. thirdPartyFoldout.OnToggled += x => thirdPartyLayout.Active = x;
  208. noticesLayout.Active = false;
  209. noticesFoldout.OnToggled += x => noticesLayout.Active = x;
  210. contributorsLayout.Active = false;
  211. contributorsFoldout.OnToggled += x => contributorsLayout.Active = x;
  212. socialLayout.Active = false;
  213. socialFoldout.OnToggled += x => socialLayout.Active = x;
  214. emailLabel.Text = "[email protected]";
  215. linkedInBtn.OnClick += () => { System.Diagnostics.Process.Start("https://www.linkedin.com/in/markopintera"); };
  216. patreonBtn.OnClick += () => { System.Diagnostics.Process.Start("https://www.patreon.com/bsf"); };
  217. paypalBtn.OnClick += () => { System.Diagnostics.Process.Start("https://www.paypal.me/MarkoPintera/10"); };
  218. }
  219. private void CreateNameURLBtnPair(GUILayoutY layout, string name, string webURL, string btnText)
  220. {
  221. GUILabel label = new GUILabel(new LocEdString(name), GUIOption.FixedWidth(300));
  222. GUIButton linkBtn = new GUIButton(new LocEdString(btnText), GUIOption.FixedWidth(100));
  223. GUILayoutX horzLayout = layout.AddLayoutX();
  224. horzLayout.AddSpace(10);
  225. horzLayout.AddElement(label);
  226. horzLayout.AddSpace(10);
  227. horzLayout.AddElement(linkBtn);
  228. horzLayout.AddSpace(10);
  229. linkBtn.OnClick += () => { System.Diagnostics.Process.Start(webURL); };
  230. }
  231. private void CreateEditorContributorGUI(GUILayoutY layout, string name, string area)
  232. {
  233. GUILabel nameLabel = new GUILabel(new LocEdString(name), GUIOption.FixedWidth(150));
  234. GUILabel areaLabel = new GUILabel(new LocEdString(area), GUIOption.FixedWidth(220));
  235. GUILayoutX horzLayout = layout.AddLayoutX();
  236. horzLayout.AddSpace(10);
  237. horzLayout.AddElement(nameLabel);
  238. horzLayout.AddSpace(10);
  239. horzLayout.AddElement(areaLabel);
  240. horzLayout.AddSpace(10);
  241. }
  242. private void CreateFrameworkContributorGUI(GUILayoutY layout, string name)
  243. {
  244. GUILabel nameLabel = new GUILabel(new LocEdString(name), EditorStyles.LabelCentered);
  245. GUILayoutX horzLayout = layout.AddLayoutX();
  246. horzLayout.AddElement(nameLabel);
  247. }
  248. private void OnEditorUpdate()
  249. {
  250. emailLabel.Text = "[email protected]";
  251. }
  252. }
  253. /** @} */
  254. }