AboutBox.cs 8.5 KB

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