AboutBox.cs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 creator 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";
  30. Width = 400;
  31. Height = 400;
  32. }
  33. private void OnInitialize()
  34. {
  35. GUILabel title = new GUILabel(new LocEdString("Banshee Engine v0.4"), EditorStyles.TitleLabel);
  36. GUILabel subTitle = new GUILabel(new LocEdString("A modern open-source game development toolkit"),
  37. EditorStyles.LabelCentered);
  38. GUILabel license = new GUILabel(new LocEdString(
  39. "This program is licensed under the GNU Lesser General Public License V3"), EditorStyles.LabelCentered);
  40. GUILabel copyright = new GUILabel(new LocEdString("Copyright (C) 2015 Marko Pintera. All rights reserved."),
  41. EditorStyles.LabelCentered);
  42. GUILabel authorLabel = new GUILabel(new LocEdString("Banshee was created, and is being actively developed by Marko Pintera."));
  43. GUILabel emailTitle = new GUILabel(new LocEdString("E-mail"), GUIOption.FixedWidth(150));
  44. emailLabel = new GUITextBox();
  45. GUILabel linkedInTitle = new GUILabel(new LocEdString("LinkedIn"), GUIOption.FixedWidth(150));
  46. GUIButton linkedInBtn = new GUIButton(new LocEdString("Profile"));
  47. GUIToggleGroup foldoutGroup = new GUIToggleGroup(true);
  48. GUIToggle contactFoldout = new GUIToggle(new LocEdString("Author"), foldoutGroup, EditorStyles.Foldout);
  49. GUIToggle thirdPartyFoldout = new GUIToggle(new LocEdString("Used third party libraries"), foldoutGroup, EditorStyles.Foldout);
  50. GUIToggle noticesFoldout = new GUIToggle(new LocEdString("Third party notices"), foldoutGroup, EditorStyles.Foldout);
  51. GUIToggle collaboratorsFoldout = new GUIToggle(new LocEdString("Collaborators"), foldoutGroup, EditorStyles.Foldout);
  52. contactFoldout.AcceptsKeyFocus = false;
  53. thirdPartyFoldout.AcceptsKeyFocus = false;
  54. noticesFoldout.AcceptsKeyFocus = false;
  55. collaboratorsFoldout.AcceptsKeyFocus = false;
  56. GUILabel freeTypeNotice = new GUILabel(new LocEdString(
  57. "Portions of this software are copyright (C) 2015 The FreeType Project (www.freetype.org). " +
  58. "All rights reserved."), EditorStyles.MultiLineLabelCentered,
  59. GUIOption.FlexibleHeight(), GUIOption.FixedWidth(380));
  60. GUILabel fbxSdkNotice = new GUILabel(new LocEdString(
  61. "This software contains Autodesk(R) FBX(R) code developed by Autodesk, Inc. Copyright 2013 Autodesk, Inc. " +
  62. "All rights, reserved. Such code is provided \"as is\" and Autodesk, Inc. disclaims any and all warranties, " +
  63. "whether express or implied, including without limitation the implied warranties of merchantability, " +
  64. "fitness for a particular purpose or non-infringement of third party rights. In no event shall Autodesk, " +
  65. "Inc. be liable for any direct, indirect, incidental, special, exemplary, or consequential damages " +
  66. "(including, but not limited to, procurement of substitute goods or services; loss of use, data, or " +
  67. "profits; or business interruption) however caused and on any theory of liability, whether in contract, " +
  68. "strict liability, or tort (including negligence or otherwise) arising in any way out of such code."),
  69. EditorStyles.MultiLineLabelCentered, GUIOption.FlexibleHeight(), GUIOption.FixedWidth(380));
  70. GUILayoutY mainLayout = GUI.AddLayoutY();
  71. mainLayout.AddSpace(10);
  72. mainLayout.AddElement(title);
  73. mainLayout.AddElement(subTitle);
  74. mainLayout.AddSpace(10);
  75. mainLayout.AddElement(license);
  76. mainLayout.AddElement(copyright);
  77. mainLayout.AddSpace(10);
  78. mainLayout.AddElement(contactFoldout);
  79. GUILayoutY contactLayout = mainLayout.AddLayoutY();
  80. contactLayout.AddSpace(15);
  81. GUILayout authorLayout = contactLayout.AddLayoutX();
  82. authorLayout.AddFlexibleSpace();
  83. authorLayout.AddElement(authorLabel);
  84. authorLayout.AddFlexibleSpace();
  85. contactLayout.AddSpace(15);
  86. GUILayout emailLayout = contactLayout.AddLayoutX();
  87. emailLayout.AddSpace(10);
  88. emailLayout.AddElement(emailTitle);
  89. emailLayout.AddElement(emailLabel);
  90. emailLayout.AddSpace(10);
  91. GUILayout linkedInLayout = contactLayout.AddLayoutX();
  92. linkedInLayout.AddSpace(10);
  93. linkedInLayout.AddElement(linkedInTitle);
  94. linkedInLayout.AddElement(linkedInBtn);
  95. linkedInLayout.AddSpace(10);
  96. mainLayout.AddSpace(5);
  97. mainLayout.AddElement(thirdPartyFoldout);
  98. GUILayoutY thirdPartyLayout = mainLayout.AddLayoutY();
  99. CreateThirdPartyGUI(thirdPartyLayout, "Autodesk FBX SDK",
  100. "http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775847");
  101. CreateThirdPartyGUI(thirdPartyLayout, "FreeImage", "http://freeimage.sourceforge.net/");
  102. CreateThirdPartyGUI(thirdPartyLayout, "FreeType", "http://www.freetype.org/");
  103. CreateThirdPartyGUI(thirdPartyLayout, "Mono", "http://www.mono-project.com/");
  104. CreateThirdPartyGUI(thirdPartyLayout, "NVIDIA Texture Tools",
  105. "https://github.com/castano/nvidia-texture-tools");
  106. CreateThirdPartyGUI(thirdPartyLayout, "libFLAC", "https://xiph.org/flac/");
  107. CreateThirdPartyGUI(thirdPartyLayout, "libOgg", "https://www.xiph.org/ogg/");
  108. CreateThirdPartyGUI(thirdPartyLayout, "libVorbis", "http://www.vorbis.com/");
  109. CreateThirdPartyGUI(thirdPartyLayout, "OpenAL Soft", "http://kcat.strangesoft.net/openal.html");
  110. mainLayout.AddSpace(5);
  111. mainLayout.AddElement(noticesFoldout);
  112. GUILayout noticesLayout = mainLayout.AddLayoutY();
  113. noticesLayout.AddElement(freeTypeNotice);
  114. noticesLayout.AddSpace(10);
  115. noticesLayout.AddElement(fbxSdkNotice);
  116. mainLayout.AddSpace(5);
  117. mainLayout.AddElement(collaboratorsFoldout);
  118. GUILayoutY collaboratorsLayout = mainLayout.AddLayoutY();
  119. CreateCollaboratorGUI(collaboratorsLayout, "Danijel Ribic", "Logo, UI icons, 3D models & textures");
  120. CreateCollaboratorGUI(collaboratorsLayout, "Marco Bellan", "Bugfixes, editor enhancements");
  121. mainLayout.AddFlexibleSpace();
  122. contactLayout.Active = false;
  123. contactFoldout.OnToggled += x =>
  124. {
  125. contactLayout.Active = x;
  126. };
  127. thirdPartyLayout.Active = false;
  128. thirdPartyFoldout.OnToggled += x => thirdPartyLayout.Active = x;
  129. noticesLayout.Active = false;
  130. noticesFoldout.OnToggled += x => noticesLayout.Active = x;
  131. collaboratorsLayout.Active = false;
  132. collaboratorsFoldout.OnToggled += x => collaboratorsLayout.Active = x;
  133. emailLabel.Text = "[email protected]";
  134. linkedInBtn.OnClick += () => { System.Diagnostics.Process.Start("http://hr.linkedin.com/in/markopintera"); };
  135. }
  136. private void CreateThirdPartyGUI(GUILayoutY layout, string name, string webURL)
  137. {
  138. GUILabel label = new GUILabel(new LocEdString(name), GUIOption.FixedWidth(150));
  139. GUIButton linkBtn = new GUIButton(new LocEdString("Website"), GUIOption.FixedWidth(50));
  140. GUILayoutX horzLayout = layout.AddLayoutX();
  141. horzLayout.AddSpace(10);
  142. horzLayout.AddElement(label);
  143. horzLayout.AddSpace(10);
  144. horzLayout.AddElement(linkBtn);
  145. horzLayout.AddSpace(10);
  146. linkBtn.OnClick += () => { System.Diagnostics.Process.Start(webURL); };
  147. }
  148. private void CreateCollaboratorGUI(GUILayoutY layout, string name, string area)
  149. {
  150. GUILabel nameLabel = new GUILabel(new LocEdString(name), GUIOption.FixedWidth(150));
  151. GUILabel areaLabel = new GUILabel(new LocEdString(area), GUIOption.FixedWidth(220));
  152. GUILayoutX horzLayout = layout.AddLayoutX();
  153. horzLayout.AddSpace(10);
  154. horzLayout.AddElement(nameLabel);
  155. horzLayout.AddSpace(10);
  156. horzLayout.AddElement(areaLabel);
  157. horzLayout.AddSpace(10);
  158. }
  159. private void OnEditorUpdate()
  160. {
  161. emailLabel.Text = "[email protected]";
  162. }
  163. }
  164. /** @} */
  165. }