AboutBox.cs 8.7 KB

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