private void OnInitialize() { treeScrollArea = new GUIScrollArea(); GUI.AddElement(treeScrollArea); treeView = new GUISceneTreeView(GUIOption.FlexibleHeight(20), GUIOption.FlexibleWidth(20)); treeScrollArea.Layout.AddElement(treeView); // Loading progress loadLabel = new GUILabel(new LocEdString("Loading scene...")); loadProgressBar = new GUIProgressBar(); progressLayout = GUI.AddLayoutY(); progressLayout.AddFlexibleSpace(); GUILayout loadLabelLayout = progressLayout.AddLayoutX(); loadLabelLayout.AddFlexibleSpace(); loadLabelLayout.AddElement(loadLabel); loadLabelLayout.AddFlexibleSpace(); GUILayout progressBarLayout = progressLayout.AddLayoutX(); progressBarLayout.AddFlexibleSpace(); progressBarLayout.AddElement(loadProgressBar); progressBarLayout.AddFlexibleSpace(); progressLayout.AddFlexibleSpace(); progressLayout.Active = false; EditorVirtualInput.OnButtonUp += OnButtonUp; }
public GUIComponent CreateScrollArea() { GUIComponent component = new GUIScrollArea(); this.components.Add(component); return(component); }
public GUIComponent CreateScrollArea() { GUIComponent component = new GUIScrollArea (); this.components.Add (component); return component; }
public GUIAnimFieldDisplay(GUILayout layout, int width, int height, SceneObject root) { this.root = root; scrollArea = new GUIScrollArea(ScrollBarType.ShowIfDoesntFit, ScrollBarType.NeverShow); layout.AddElement(scrollArea); SetSize(width, height); }
private void OnInitialize() { GUIScrollArea scrollArea = new GUIScrollArea(); GUI.AddElement(scrollArea); treeView = new GUISceneTreeView(GUIOption.FlexibleHeight(20), GUIOption.FlexibleWidth(20)); scrollArea.Layout.AddElement(treeView); }
/// <summary> /// Destroys all inspector GUI elements. /// </summary> internal void Clear() { for (int i = 0; i < inspectorComponents.Count; i++) { inspectorComponents[i].foldout.Destroy(); inspectorComponents[i].removeBtn.Destroy(); inspectorComponents[i].inspector.Destroy(); } inspectorComponents.Clear(); if (inspectorResource != null) { inspectorResource.inspector.Destroy(); inspectorResource = null; } if (inspectorScrollArea != null) { inspectorScrollArea.Destroy(); inspectorScrollArea = null; } if (scrollAreaHighlight != null) { scrollAreaHighlight.Destroy(); scrollAreaHighlight = null; } if (highlightPanel != null) { highlightPanel.Destroy(); highlightPanel = null; } activeSO = null; soNameInput = null; soActiveToggle = null; soMobility = null; soPrefabLayout = null; soHasPrefab = false; soPosX = null; soPosY = null; soPosZ = null; soRotX = null; soRotY = null; soRotZ = null; soScaleX = null; soScaleY = null; soScaleZ = null; dropAreas = new Rect2I[0]; activeResourcePath = null; currentType = InspectorType.None; }
/// <summary> /// Sets a resource whose GUI is to be displayed in the inspector. Clears any previous contents of the window. /// </summary> /// <param name="resourcePath">Resource path relative to the project of the resource to inspect.</param> private void SetObjectToInspect(String resourcePath) { activeResourcePath = resourcePath; if (!ProjectLibrary.Exists(resourcePath)) { return; } ResourceMeta meta = ProjectLibrary.GetMeta(resourcePath); Type resourceType = meta.Type; currentType = InspectorType.Resource; inspectorScrollArea = new GUIScrollArea(); GUI.AddElement(inspectorScrollArea); inspectorLayout = inspectorScrollArea.Layout; GUIPanel titlePanel = inspectorLayout.AddPanel(); titlePanel.SetHeight(RESOURCE_TITLE_HEIGHT); GUILayoutY titleLayout = titlePanel.AddLayoutY(); titleLayout.SetPosition(PADDING, PADDING); string name = Path.GetFileNameWithoutExtension(resourcePath); string type = resourceType.Name; LocString title = new LocEdString(name + " (" + type + ")"); GUILabel titleLabel = new GUILabel(title); titleLayout.AddFlexibleSpace(); GUILayoutX titleLabelLayout = titleLayout.AddLayoutX(); titleLabelLayout.AddElement(titleLabel); titleLayout.AddFlexibleSpace(); GUIPanel titleBgPanel = titlePanel.AddPanel(1); GUITexture titleBg = new GUITexture(null, EditorStylesInternal.InspectorTitleBg); titleBgPanel.AddElement(titleBg); inspectorLayout.AddSpace(COMPONENT_SPACING); inspectorResource = new InspectorResource(); inspectorResource.panel = inspectorLayout.AddPanel(); var persistentProperties = persistentData.GetProperties(meta.UUID.ToString()); inspectorResource.inspector = InspectorUtility.GetInspector(resourceType); inspectorResource.inspector.Initialize(inspectorResource.panel, activeResourcePath, persistentProperties); inspectorLayout.AddFlexibleSpace(); }
private void OnInitialize() { GUIScrollArea scrollArea = new GUIScrollArea(); GUI.AddElement(scrollArea); treeView = new GUISceneTreeView(GUIOption.FlexibleHeight(20), GUIOption.FlexibleWidth(20)); scrollArea.Layout.AddElement(treeView); EditorVirtualInput.OnButtonUp += OnButtonUp; }
/// <summary> /// Triggered when the user selects a new resource or a scene object, or deselects everything. /// </summary> /// <param name="objects">A set of new scene objects that were selected.</param> /// <param name="paths">A set of absolute resource paths that were selected.</param> private void OnSelectionChanged(SceneObject[] objects, string[] paths) { if (currentType == InspectorType.SceneObject && modifyState == InspectableState.NotModified) { UndoRedo.Global.PopCommand(undoCommandIdx); } Clear(); modifyState = InspectableState.NotModified; if (objects.Length == 0 && paths.Length == 0) { currentType = InspectorType.None; inspectorScrollArea = new GUIScrollArea(); GUI.AddElement(inspectorScrollArea); inspectorLayout = inspectorScrollArea.Layout; inspectorLayout.AddFlexibleSpace(); GUILayoutX layoutMsg = inspectorLayout.AddLayoutX(); layoutMsg.AddFlexibleSpace(); layoutMsg.AddElement(new GUILabel(new LocEdString("No object selected"))); layoutMsg.AddFlexibleSpace(); inspectorLayout.AddFlexibleSpace(); } else if ((objects.Length + paths.Length) > 1) { currentType = InspectorType.None; inspectorScrollArea = new GUIScrollArea(); GUI.AddElement(inspectorScrollArea); inspectorLayout = inspectorScrollArea.Layout; inspectorLayout.AddFlexibleSpace(); GUILayoutX layoutMsg = inspectorLayout.AddLayoutX(); layoutMsg.AddFlexibleSpace(); layoutMsg.AddElement(new GUILabel(new LocEdString("Multiple objects selected"))); layoutMsg.AddFlexibleSpace(); inspectorLayout.AddFlexibleSpace(); } else if (objects.Length == 1) { if (objects[0] != null) { UndoRedo.RecordSO(objects[0]); undoCommandIdx = UndoRedo.Global.TopCommandId; SetObjectToInspect(objects[0]); } } else if (paths.Length == 1) { SetObjectToInspect(paths[0]); } }
/// <summary> /// Initializes the GUI elements for the entry. /// </summary> /// <param name="parent">Scroll area into whose layout to insert the GUI elements.</param> internal void Initialize(GUIListViewBase <TData> parent) { this.parent = parent; GUIScrollArea scrollArea = parent.ScrollArea; int numElements = scrollArea.Layout.ChildCount; // Last panel is always the padding panel, so keep it there panel = scrollArea.Layout.InsertPanel(numElements - 1); layout = panel.AddLayoutY(); BuildGUI(); }
/// <summary> /// Creates a new empty list view. /// </summary> /// <param name="width">Width of the list view, in pixels.</param> /// <param name="height">Height of the list view, in pixels.</param> /// <param name="entryHeight">Height of a single element in the list, in pixels.</param> /// <param name="layout">GUI layout into which the list view will be placed into.</param> protected GUIListViewBase(int width, int height, int entryHeight, GUILayout layout) { scrollArea = new GUIScrollArea(ScrollBarType.ShowIfDoesntFit, ScrollBarType.NeverShow, GUIOption.FixedWidth(width), GUIOption.FixedHeight(height)); layout.AddElement(scrollArea); topPadding = new GUILabel(new LocString()); bottomPadding = new GUILabel(new LocString()); scrollArea.Layout.AddElement(topPadding); scrollArea.Layout.AddElement(bottomPadding); this.width = width; this.height = height; this.entryHeight = entryHeight; }
/// <summary> /// Creates a new GUIFieldSelector and registers its GUI elements in the provided layout. /// </summary> /// <param name="layout">Layout into which to add the selector GUI hierarchy.</param> /// <param name="so">Scene object to inspect the fields for.</param> /// <param name="width">Width of the selector area, in pixels.</param> /// <param name="height">Height of the selector area, in pixels.</param> public GUIFieldSelector(GUILayout layout, SceneObject so, int width, int height) { rootSO = so; scrollArea = new GUIScrollArea(); scrollArea.SetWidth(width); scrollArea.SetHeight(height); layout.AddElement(scrollArea); GUISkin skin = EditorBuiltin.GUISkin; GUIElementStyle style = skin.GetStyle(EditorStyles.Expand); foldoutWidth = style.Width; Rebuild(); }
/// <summary> /// Triggered when the user selects a new resource or a scene object, or deselects everything. /// </summary> /// <param name="objects">A set of new scene objects that were selected.</param> /// <param name="paths">A set of absolute resource paths that were selected.</param> private void OnSelectionChanged(SceneObject[] objects, string[] paths) { Clear(); modifyState = InspectableState.NotModified; if (objects.Length == 0 && paths.Length == 0) { currentType = InspectorType.None; inspectorScrollArea = new GUIScrollArea(ScrollBarType.ShowIfDoesntFit, ScrollBarType.NeverShow); GUI.AddElement(inspectorScrollArea); inspectorLayout = inspectorScrollArea.Layout; inspectorLayout.AddFlexibleSpace(); GUILayoutX layoutMsg = inspectorLayout.AddLayoutX(); layoutMsg.AddFlexibleSpace(); layoutMsg.AddElement(new GUILabel(new LocEdString("No object selected"))); layoutMsg.AddFlexibleSpace(); inspectorLayout.AddFlexibleSpace(); } else if ((objects.Length + paths.Length) > 1) { currentType = InspectorType.None; inspectorScrollArea = new GUIScrollArea(ScrollBarType.ShowIfDoesntFit, ScrollBarType.NeverShow); GUI.AddElement(inspectorScrollArea); inspectorLayout = inspectorScrollArea.Layout; inspectorLayout.AddFlexibleSpace(); GUILayoutX layoutMsg = inspectorLayout.AddLayoutX(); layoutMsg.AddFlexibleSpace(); layoutMsg.AddElement(new GUILabel(new LocEdString("Multiple objects selected"))); layoutMsg.AddFlexibleSpace(); inspectorLayout.AddFlexibleSpace(); } else if (objects.Length == 1) { if (objects[0] != null) { SetObjectToInspect(objects[0]); } } else if (paths.Length == 1) { SetObjectToInspect(paths[0]); } }
/// <summary> /// Sets a scene object whose GUI is to be displayed in the inspector. Clears any previous contents of the window. /// </summary> /// <param name="so">Scene object to inspect.</param> private void SetObjectToInspect(SceneObject so) { if (so == null) { return; } currentType = InspectorType.SceneObject; activeSO = so; inspectorScrollArea = new GUIScrollArea(); scrollAreaHighlight = new GUITexture(Builtin.WhiteTexture); scrollAreaHighlight.SetTint(HIGHLIGHT_COLOR); scrollAreaHighlight.Active = false; GUI.AddElement(inspectorScrollArea); GUIPanel inspectorPanel = inspectorScrollArea.Layout.AddPanel(); inspectorLayout = inspectorPanel.AddLayoutY(); highlightPanel = inspectorPanel.AddPanel(-1); highlightPanel.AddElement(scrollAreaHighlight); // SceneObject fields CreateSceneObjectFields(); RefreshSceneObjectFields(true); // Components Component[] allComponents = so.GetComponents(); for (int i = 0; i < allComponents.Length; i++) { inspectorLayout.AddSpace(COMPONENT_SPACING); InspectorComponent data = new InspectorComponent(); data.instanceId = allComponents[i].InstanceId; data.folded = false; data.foldout = new GUIToggle(allComponents[i].GetType().Name, EditorStyles.Foldout); data.foldout.AcceptsKeyFocus = false; SpriteTexture xBtnIcon = EditorBuiltin.GetEditorIcon(EditorIcon.X); data.removeBtn = new GUIButton(new GUIContent(xBtnIcon), GUIOption.FixedWidth(30)); data.title = inspectorLayout.AddLayoutX(); data.title.AddElement(data.foldout); data.title.AddElement(data.removeBtn); data.panel = inspectorLayout.AddPanel(); var persistentProperties = persistentData.GetProperties(allComponents[i].InstanceId); data.inspector = InspectorUtility.GetInspector(allComponents[i].GetType()); data.inspector.Initialize(data.panel, allComponents[i], persistentProperties); bool isExpanded = data.inspector.Persistent.GetBool(data.instanceId + "_Expanded", true); data.foldout.Value = isExpanded; if (!isExpanded) { data.inspector.SetVisible(false); } Type curComponentType = allComponents[i].GetType(); data.foldout.OnToggled += (bool expanded) => OnComponentFoldoutToggled(data, expanded); data.removeBtn.OnClick += () => OnComponentRemoveClicked(curComponentType); inspectorComponents.Add(data); } inspectorLayout.AddFlexibleSpace(); UpdateDropAreas(); }
private void OnInitialize() { GUILayoutY layout = GUI.AddLayoutY(); GUILayoutX titleLayout = layout.AddLayoutX(); GUIContentImages infoImages = new GUIContentImages( EditorBuiltin.GetLogMessageIcon(LogMessageIcon.Info, 16, false), EditorBuiltin.GetLogMessageIcon(LogMessageIcon.Info, 16, true)); GUIContentImages warningImages = new GUIContentImages( EditorBuiltin.GetLogMessageIcon(LogMessageIcon.Warning, 16, false), EditorBuiltin.GetLogMessageIcon(LogMessageIcon.Warning, 16, true)); GUIContentImages errorImages = new GUIContentImages( EditorBuiltin.GetLogMessageIcon(LogMessageIcon.Error, 16, false), EditorBuiltin.GetLogMessageIcon(LogMessageIcon.Error, 16, true)); GUIToggle infoBtn = new GUIToggle(new GUIContent(infoImages), EditorStyles.Button, GUIOption.FixedHeight(TITLE_HEIGHT)); GUIToggle warningBtn = new GUIToggle(new GUIContent(warningImages), EditorStyles.Button, GUIOption.FixedHeight(TITLE_HEIGHT)); GUIToggle errorBtn = new GUIToggle(new GUIContent(errorImages), EditorStyles.Button, GUIOption.FixedHeight(TITLE_HEIGHT)); GUIToggle detailsBtn = new GUIToggle(new LocEdString("Show details"), EditorStyles.Button, GUIOption.FixedHeight(TITLE_HEIGHT)); GUIButton clearBtn = new GUIButton(new LocEdString("Clear"), GUIOption.FixedHeight(TITLE_HEIGHT)); GUIToggle clearOnPlayBtn = new GUIToggle(new LocEdString("Clear on play"), EditorStyles.Button, GUIOption.FixedHeight(TITLE_HEIGHT)); titleLayout.AddElement(infoBtn); titleLayout.AddElement(warningBtn); titleLayout.AddElement(errorBtn); titleLayout.AddFlexibleSpace(); titleLayout.AddElement(detailsBtn); titleLayout.AddElement(clearBtn); titleLayout.AddElement(clearOnPlayBtn); infoBtn.Value = filter.HasFlag(EntryFilter.Info); warningBtn.Value = filter.HasFlag(EntryFilter.Warning); errorBtn.Value = filter.HasFlag(EntryFilter.Error); clearOnPlayBtn.Value = EditorSettings.GetBool(CLEAR_ON_PLAY_KEY, true); infoBtn.OnToggled += x => { if (x) { SetFilter(filter | EntryFilter.Info); } else { SetFilter(filter & ~EntryFilter.Info); } }; warningBtn.OnToggled += x => { if (x) { SetFilter(filter | EntryFilter.Warning); } else { SetFilter(filter & ~EntryFilter.Warning); } }; errorBtn.OnToggled += x => { if (x) { SetFilter(filter | EntryFilter.Error); } else { SetFilter(filter & ~EntryFilter.Error); } }; detailsBtn.OnToggled += ToggleDetailsPanel; clearBtn.OnClick += ClearLog; clearOnPlayBtn.OnToggled += ToggleClearOnPlay; GUILayoutX mainLayout = layout.AddLayoutX(); listView = new GUIListView <ConsoleGUIEntry, ConsoleEntryData>(Width, ListHeight, ENTRY_HEIGHT, mainLayout); detailsSeparator = new GUITexture(Builtin.WhiteTexture, GUIOption.FixedWidth(SEPARATOR_WIDTH)); detailsArea = new GUIScrollArea(ScrollBarType.ShowIfDoesntFit, ScrollBarType.NeverShow); mainLayout.AddElement(detailsSeparator); mainLayout.AddElement(detailsArea); detailsSeparator.Active = false; detailsArea.Active = false; detailsSeparator.SetTint(SEPARATOR_COLOR); Refresh(); Debug.OnAdded += OnEntryAdded; }
/// <summary> /// Constructs a new GUI library content object. /// </summary> /// <param name="window">Parent window the content area is part of.</param> /// <param name="parent">Scroll area the content area is part of.</param> public LibraryGUIContent(LibraryWindow window, GUIScrollArea parent) { this.window = window; this.parent = parent; }
private void OnInitialize() { GUILayoutX splitLayout = GUI.AddLayoutX(); GUIPanel platformPanel = splitLayout.AddPanel(); GUIPanel platformForeground = platformPanel.AddPanel(); GUILayoutY platformLayout = platformForeground.AddLayoutY(); GUIPanel platformBackground = platformPanel.AddPanel(1); GUITexture background = new GUITexture(Builtin.WhiteTexture); background.SetTint(PLATFORM_BG_COLOR); splitLayout.AddSpace(5); GUILayoutY optionsLayout = splitLayout.AddLayoutY(); GUILabel platformsLabel = new GUILabel(new LocEdString("Platforms"), EditorStyles.LabelCentered); platformLayout.AddSpace(5); platformLayout.AddElement(platformsLabel); platformLayout.AddSpace(5); GUIToggleGroup platformToggleGroup = new GUIToggleGroup(); PlatformType[] availablePlatforms = BuildManager.AvailablePlatforms; platformButtons = new GUIToggle[availablePlatforms.Length]; for (int i = 0; i < availablePlatforms.Length; i++) { PlatformType currentPlatform = availablePlatforms[i]; bool isActive = currentPlatform == BuildManager.ActivePlatform; string platformName = Enum.GetName(typeof(PlatformType), currentPlatform); if (isActive) { platformName += " (Active)"; } GUIToggle platformToggle = new GUIToggle(new LocEdString(platformName), platformToggleGroup, EditorStyles.Button); platformToggle.OnToggled += x => OnSelectedPlatformChanged(currentPlatform, x); platformLayout.AddElement(platformToggle); platformButtons[i] = platformToggle; if (isActive) { platformToggle.Value = true; selectedPlatform = currentPlatform; } } platformLayout.AddFlexibleSpace(); GUIButton changePlatformBtn = new GUIButton(new LocEdString("Set active")); platformLayout.AddElement(changePlatformBtn); changePlatformBtn.OnClick += ChangeActivePlatform; platformBackground.AddElement(background); optionsScrollArea = new GUIScrollArea(); optionsLayout.AddElement(optionsScrollArea); GUIButton buildButton = new GUIButton(new LocEdString("Build")); optionsLayout.AddFlexibleSpace(); optionsLayout.AddElement(buildButton); buildButton.OnClick += TryStartBuild; BuildPlatformOptionsGUI(); }
private void OnInitialize() { EditorApplication.OnProjectSave += SaveSettings; SceneWindow sceneWindow = SceneWindow.GetWindow <SceneWindow>(); if (sceneWindow != null) { viewSettings = sceneWindow.Camera.ViewSettings; moveSettings = sceneWindow.Camera.MoveSettings; renderSettings = sceneWindow.Camera.RenderSettings; gizmoSettings = sceneWindow.GizmoDrawSettings; } else { viewSettings = ProjectSettings.GetObject <SceneCameraViewSettings>(SceneCamera.ViewSettingsKey); moveSettings = ProjectSettings.GetObject <SceneCameraMoveSettings>(SceneCamera.MoveSettingsKey); renderSettings = ProjectSettings.GetObject <RenderSettings>(SceneCamera.RenderSettingsKey); if (ProjectSettings.HasKey(SceneWindow.GizmoDrawSettingsKey)) { gizmoSettings = ProjectSettings.GetObject <GizmoDrawSettings>(SceneWindow.GizmoDrawSettingsKey); } else { gizmoSettings = GizmoDrawSettings.Default(); } } expandStates = ProjectSettings.GetObject <SerializableProperties>(ExpandStatesKey); InspectableContext inspectableContext = new InspectableContext(expandStates); GUILayout mainLayout = GUI.AddLayoutY(); GUIScrollArea scrollArea = new GUIScrollArea(ScrollBarType.ShowIfDoesntFit, ScrollBarType.NeverShow); mainLayout.AddElement(scrollArea); GUILayoutX horzPadLayout = scrollArea.Layout.AddLayoutX(GUIOption.FlexibleWidth(100, 400)); horzPadLayout.AddSpace(5); GUILayout vertLayout = horzPadLayout.AddLayoutY(); horzPadLayout.AddSpace(5); vertLayout.AddSpace(5); vertLayout.AddElement(new GUILabel(new LocEdString("View Settings"), EditorStyles.LabelBold)); GUILayoutY viewSettingsLayout = vertLayout.AddLayoutY(); vertLayout.AddSpace(10); vertLayout.AddElement(new GUILabel(new LocEdString("Gizmo Settings"), EditorStyles.LabelBold)); GUILayoutY gizmoSettingsLayout = vertLayout.AddLayoutY(); vertLayout.AddSpace(10); vertLayout.AddElement(new GUILabel(new LocEdString("Move Settings"), EditorStyles.LabelBold)); GUILayoutY moveSettingsLayout = vertLayout.AddLayoutY(); vertLayout.AddSpace(10); vertLayout.AddElement(new GUILabel(new LocEdString("Render Settings"), EditorStyles.LabelBold)); GUILayoutY renderSettingsLayout = vertLayout.AddLayoutY(); guiViewSettings = new InspectorFieldDrawer(inspectableContext, viewSettingsLayout); guiGizmoSettings = new InspectorFieldDrawer(inspectableContext, gizmoSettingsLayout); guiMovementSettings = new InspectorFieldDrawer(inspectableContext, moveSettingsLayout); guiRenderSettings = new InspectorFieldDrawer(inspectableContext, renderSettingsLayout); objGizmoSettings = gizmoSettings; guiViewSettings.AddDefault(viewSettings); guiGizmoSettings.AddDefault(objGizmoSettings); guiMovementSettings.AddDefault(moveSettings); guiRenderSettings.AddDefault(renderSettings); mainLayout.AddSpace(5); GUILayout buttonCenterLayout = mainLayout.AddLayoutX(); mainLayout.AddSpace(5); GUIButton resetToDefaultBtn = new GUIButton(new LocEdString("Reset to defaults")); resetToDefaultBtn.OnClick += () => ConfirmResetToDefault(ResetToDefault, null); buttonCenterLayout.AddFlexibleSpace(); buttonCenterLayout.AddElement(resetToDefaultBtn); buttonCenterLayout.AddFlexibleSpace(); }
private void OnInitialize() { Title = "Project Manager"; Width = 500; Height = 290; GUILayout vertLayout = GUI.AddLayoutY(); vertLayout.AddSpace(5); GUILayout firstRow = vertLayout.AddLayoutX(); vertLayout.AddFlexibleSpace(); GUILayout secondRow = vertLayout.AddLayoutX(); vertLayout.AddSpace(5); GUILayout thirdRow = vertLayout.AddLayoutX(); vertLayout.AddFlexibleSpace(); GUILayout fourthRow = vertLayout.AddLayoutX(); vertLayout.AddSpace(5); projectInputBox = new GUITextField(new LocEdString("Project path"), 70, false, "", GUIOption.FixedWidth(398)); projectInputBox.Value = EditorSettings.LastOpenProject; GUIButton openBtn = new GUIButton(new LocEdString("Open"), GUIOption.FixedWidth(75)); openBtn.OnClick += OpenProject; firstRow.AddSpace(5); firstRow.AddElement(projectInputBox); firstRow.AddSpace(15); firstRow.AddElement(openBtn); firstRow.AddSpace(5); GUILabel recentProjectsLabel = new GUILabel(new LocEdString("Recent projects:")); secondRow.AddSpace(5); secondRow.AddElement(recentProjectsLabel); secondRow.AddFlexibleSpace(); GUIButton browseBtn = new GUIButton(new LocEdString("Browse"), GUIOption.FixedWidth(75)); browseBtn.OnClick += BrowseClicked; secondRow.AddElement(browseBtn); secondRow.AddSpace(5); thirdRow.AddSpace(5); GUIPanel recentProjectsPanel = thirdRow.AddPanel(); thirdRow.AddSpace(15); GUILayoutY thirdRowVertical = thirdRow.AddLayoutY(); GUIButton createBtn = new GUIButton(new LocEdString("Create new"), GUIOption.FixedWidth(75)); createBtn.OnClick += CreateClicked; thirdRowVertical.AddElement(createBtn); thirdRowVertical.AddFlexibleSpace(); thirdRow.AddSpace(5); recentProjectsArea = new GUIScrollArea(GUIOption.FixedWidth(385), GUIOption.FixedHeight(170)); GUILayoutX recentProjectsLayout = recentProjectsPanel.AddLayoutX(); recentProjectsLayout.AddSpace(10); GUILayoutY recentProjectsPanelY = recentProjectsLayout.AddLayoutY(); recentProjectsPanelY.AddSpace(5); recentProjectsPanelY.AddElement(recentProjectsArea); recentProjectsPanelY.AddSpace(5); recentProjectsLayout.AddFlexibleSpace(); GUIPanel scrollAreaBgPanel = recentProjectsPanel.AddPanel(1); GUITexture scrollAreaBgTex = new GUITexture(null, true, EditorStylesInternal.ScrollAreaBg); scrollAreaBgPanel.AddElement(scrollAreaBgTex); autoLoadToggle = new GUIToggle(""); autoLoadToggle.Value = EditorSettings.AutoLoadLastProject; GUILabel autoLoadLabel = new GUILabel(new LocEdString("Automatically load last open project")); GUIButton cancelBtn = new GUIButton(new LocEdString("Cancel"), GUIOption.FixedWidth(75)); cancelBtn.OnClick += CancelClicked; fourthRow.AddSpace(5); fourthRow.AddElement(autoLoadToggle); fourthRow.AddElement(autoLoadLabel); fourthRow.AddFlexibleSpace(); fourthRow.AddElement(cancelBtn); fourthRow.AddSpace(5); RefreshRecentProjects(); }
private void OnInitialize() { GUILabel title = new GUILabel(new LocEdString("Banshee Editor " + EngineVersion.GetFullVersionString()), EditorStyles.TitleLabel); GUILabel subTitle = new GUILabel(new LocEdString("A modern open-source game development toolkit"), EditorStyles.LabelCentered); GUILabel bsfVersion = new GUILabel(new LocEdString("Powered by bs::framework " + FrameworkVersion.GetFullVersionString()), EditorStyles.LabelCentered); GUILabel license = new GUILabel(new LocEdString( "This program is licensed under the GNU Lesser General Public License V3 or later"), EditorStyles.LabelCentered); GUILabel copyright = new GUILabel(new LocEdString("Copyright (C) 2014 - " + EngineVersion.GetCurrentReleaseYearNumber() + " Jonathan Harrison and contributors. All rights reserved."), EditorStyles.LabelCentered); GUILabel editorContributorsLabel = new GUILabel(new LocEdString("Editor contributors"), EditorStyles.TitleLabel); GUILabel frameworkContributorsLabel = new GUILabel(new LocEdString("Framework contributors"), EditorStyles.TitleLabel); GUILabel engineLabel = new GUILabel(new LocEdString("Editor and engine"), EditorStyles.TitleLabel); GUILabel frameworkLabel = new GUILabel(new LocEdString("Framework"), EditorStyles.TitleLabel); GUILabel authorLabel = new GUILabel(new LocEdString("Banshee was created, and is being actively developed by Jonathan Harrison.")); GUILabel emailTitle = new GUILabel(new LocEdString("E-mail"), GUIOption.FixedWidth(150)); emailLabel = new GUITextBox(); GUILabel linkedInTitle = new GUILabel(new LocEdString("LinkedIn"), GUIOption.FixedWidth(150)); GUIButton linkedInBtn = new GUIButton(new LocEdString("Profile")); GUIButton patreonBtn = new GUIButton(new LocEdString("Support us on Patreon!"), GUIOption.FixedWidth(210)); GUIButton paypalBtn = new GUIButton(new LocEdString("Donate via PayPal!"), GUIOption.FixedWidth(210)); GUIScrollArea scrollArea = new GUIScrollArea(); GUIToggleGroup foldoutGroup = new GUIToggleGroup(true); GUIToggle contactFoldout = new GUIToggle(new LocEdString("Main author"), foldoutGroup, EditorStyles.Foldout); GUIToggle thirdPartyFoldout = new GUIToggle(new LocEdString("Used third party libraries"), foldoutGroup, EditorStyles.Foldout); GUIToggle noticesFoldout = new GUIToggle(new LocEdString("Third party notices"), foldoutGroup, EditorStyles.Foldout); GUIToggle contributorsFoldout = new GUIToggle(new LocEdString("Contributors"), foldoutGroup, EditorStyles.Foldout); GUIToggle socialFoldout = new GUIToggle(new LocEdString("Social"), foldoutGroup, EditorStyles.Foldout); contactFoldout.AcceptsKeyFocus = false; thirdPartyFoldout.AcceptsKeyFocus = false; noticesFoldout.AcceptsKeyFocus = false; contributorsFoldout.AcceptsKeyFocus = false; socialFoldout.AcceptsKeyFocus = false; GUILabel freeTypeNotice = new GUILabel(new LocEdString( "Portions of this software are copyright (C) 2019 The FreeType Project (www.freetype.org). " + "All rights reserved."), EditorStyles.MultiLineLabelCentered, GUIOption.FlexibleHeight(), GUIOption.FixedWidth(380)); GUILabel fbxSdkNotice = new GUILabel(new LocEdString( "This software contains Autodesk(R) FBX(R) code developed by Autodesk, Inc. Copyright 2019 Autodesk, Inc. " + "All rights, reserved. Such code is provided \"as is\" and Autodesk, Inc. disclaims any and all warranties, " + "whether express or implied, including without limitation the implied warranties of merchantability, " + "fitness for a particular purpose or non-infringement of third party rights. In no event shall Autodesk, " + "Inc. be liable for any direct, indirect, incidental, special, exemplary, or consequential damages " + "(including, but not limited to, procurement of substitute goods or services; loss of use, data, or " + "profits; or business interruption) however caused and on any theory of liability, whether in contract, " + "strict liability, or tort (including negligence or otherwise) arising in any way out of such code."), EditorStyles.MultiLineLabelCentered, GUIOption.FlexibleHeight(), GUIOption.FixedWidth(380)); string[ , ] contributorListEditor = new string[, ] { { "Danijel Ribic", "Logo, UI icons, 3D models & textures" }, { "Marco Bellan", "Bugfixes, editor enhancements" }, { "Robert Campbell", "Editor enhancements" }, { "James Mitchell", "Build enhancements" }, { "Patrick Recko", "Minor enhancements" } }; string[] contributorListFramework = new string[] { "Marc Legendre", "Florian Will", "Marco Bellan", "Artur K. (@nemerle)", "Michael Jones", "Connor Fitzgerald", "Paolo Paoletto", "Patrick Recko", "Guillaume Meunier", "Andre Taulien", "James Mitchell", "and others..." }; GUILayoutY mainLayout = GUI.AddLayoutY(); mainLayout.AddSpace(10); mainLayout.AddElement(title); mainLayout.AddElement(subTitle); mainLayout.AddSpace(10); mainLayout.AddElement(bsfVersion); mainLayout.AddSpace(10); mainLayout.AddElement(license); mainLayout.AddSpace(5); mainLayout.AddElement(copyright); mainLayout.AddSpace(10); GUILayoutX donateButtonLayoutX = mainLayout.AddLayoutX(); donateButtonLayoutX.AddSpace(10); donateButtonLayoutX.AddElement(patreonBtn); donateButtonLayoutX.AddSpace(10); donateButtonLayoutX.AddElement(paypalBtn); donateButtonLayoutX.AddSpace(10); mainLayout.AddSpace(10); mainLayout.AddElement(scrollArea); scrollArea.Layout.AddElement(contactFoldout); GUILayoutY contactLayout = scrollArea.Layout.AddLayoutY(); contactLayout.AddSpace(15); GUILayout authorLayout = contactLayout.AddLayoutX(); authorLayout.AddFlexibleSpace(); authorLayout.AddElement(authorLabel); authorLayout.AddFlexibleSpace(); contactLayout.AddSpace(15); GUILayout emailLayout = contactLayout.AddLayoutX(); emailLayout.AddSpace(10); emailLayout.AddElement(emailTitle); emailLayout.AddElement(emailLabel); emailLayout.AddSpace(10); GUILayout linkedInLayout = contactLayout.AddLayoutX(); linkedInLayout.AddSpace(10); linkedInLayout.AddElement(linkedInTitle); linkedInLayout.AddElement(linkedInBtn); linkedInLayout.AddSpace(10); scrollArea.Layout.AddSpace(5); scrollArea.Layout.AddElement(thirdPartyFoldout); GUILayoutY thirdPartyLayout = scrollArea.Layout.AddLayoutY(); thirdPartyLayout.AddSpace(5); CreateNameURLBtnPair(thirdPartyLayout, "Autodesk FBX SDK", "https://www.autodesk.com/products/fbx/overview", "Website"); CreateNameURLBtnPair(thirdPartyLayout, "FreeImage", "http://freeimage.sourceforge.net/", "Website"); CreateNameURLBtnPair(thirdPartyLayout, "FreeType", "http://www.freetype.org/", "Website"); CreateNameURLBtnPair(thirdPartyLayout, "Mono", "http://www.mono-project.com/", "Website"); CreateNameURLBtnPair(thirdPartyLayout, "NVIDIA Texture Tools", "https://github.com/castano/nvidia-texture-tools", "Website"); CreateNameURLBtnPair(thirdPartyLayout, "libFLAC", "https://xiph.org/flac/", "Website"); CreateNameURLBtnPair(thirdPartyLayout, "libOgg", "https://www.xiph.org/ogg/", "Website"); CreateNameURLBtnPair(thirdPartyLayout, "libVorbis", "http://www.vorbis.com/", "Website"); CreateNameURLBtnPair(thirdPartyLayout, "OpenAL Soft", "http://kcat.strangesoft.net/openal.html", "Website"); CreateNameURLBtnPair(thirdPartyLayout, "NVIDIA PhysX", "https://developer.nvidia.com/physx-sdk", "Website"); scrollArea.Layout.AddSpace(5); scrollArea.Layout.AddElement(noticesFoldout); GUILayout noticesLayout = scrollArea.Layout.AddLayoutY(); noticesLayout.AddSpace(5); noticesLayout.AddElement(freeTypeNotice); noticesLayout.AddSpace(10); noticesLayout.AddElement(fbxSdkNotice); scrollArea.Layout.AddSpace(5); scrollArea.Layout.AddElement(contributorsFoldout); GUILayoutY contributorsLayout = scrollArea.Layout.AddLayoutY(); contributorsLayout.AddSpace(5); contributorsLayout.AddElement(editorContributorsLabel); contributorsLayout.AddSpace(5); for (int i = 0; i < contributorListEditor.Length / 2; i++) { CreateEditorContributorGUI(contributorsLayout, contributorListEditor[i, 0], contributorListEditor[i, 1]); contributorsLayout.AddSpace(5); } contributorsLayout.AddSpace(10); contributorsLayout.AddElement(frameworkContributorsLabel); contributorsLayout.AddSpace(5); for (int i = 0; i < contributorListFramework.Length; i++) { CreateFrameworkContributorGUI(contributorsLayout, contributorListFramework[i]); contributorsLayout.AddSpace(5); } scrollArea.Layout.AddSpace(5); scrollArea.Layout.AddElement(socialFoldout); GUILayoutY socialLayout = scrollArea.Layout.AddLayoutY(); socialLayout.AddSpace(10); CreateNameURLBtnPair(socialLayout, "Discord", "https://discord.gg/8Xyf5gF", "Enter"); socialLayout.AddSpace(10); socialLayout.AddElement(engineLabel); socialLayout.AddSpace(5); CreateNameURLBtnPair(socialLayout, "Website", "http://www.banshee3d.com", "Enter"); CreateNameURLBtnPair(socialLayout, "Repository", "https://github.com/BearishSun/BansheeEngine", "Enter"); CreateNameURLBtnPair(socialLayout, "Forums", "https://forum.banshee3d.com", "Enter"); CreateNameURLBtnPair(socialLayout, "Twitter", "https://twitter.com/Banshee3D", "Enter"); CreateNameURLBtnPair(socialLayout, "Facebook", "https://www.facebook.com/Banshee3D", "Enter"); socialLayout.AddSpace(10); socialLayout.AddElement(frameworkLabel); socialLayout.AddSpace(5); CreateNameURLBtnPair(socialLayout, "Website", "http://www.bsframework.io", "Enter"); CreateNameURLBtnPair(socialLayout, "Repository", "https://github.com/GameFoundry/bsf", "Enter"); CreateNameURLBtnPair(socialLayout, "Forums", "https://discourse.bsframework.io/", "Enter"); CreateNameURLBtnPair(socialLayout, "Twitter", "https://twitter.com/thebsframework", "Enter"); CreateNameURLBtnPair(socialLayout, "Facebook", "https://www.facebook.com/bsframework", "Enter"); mainLayout.AddFlexibleSpace(); contactLayout.Active = false; contactFoldout.OnToggled += x => contactLayout.Active = x; thirdPartyLayout.Active = false; thirdPartyFoldout.OnToggled += x => thirdPartyLayout.Active = x; noticesLayout.Active = false; noticesFoldout.OnToggled += x => noticesLayout.Active = x; contributorsLayout.Active = false; contributorsFoldout.OnToggled += x => contributorsLayout.Active = x; socialLayout.Active = false; socialFoldout.OnToggled += x => socialLayout.Active = x; emailLabel.Text = "*****@*****.**"; linkedInBtn.OnClick += () => { System.Diagnostics.Process.Start("https://www.linkedin.com/in/markopintera"); }; patreonBtn.OnClick += () => { System.Diagnostics.Process.Start("https://www.patreon.com/bsf"); }; paypalBtn.OnClick += () => { System.Diagnostics.Process.Start("https://www.paypal.me/MarkoPintera/10"); }; }
private static extern void Internal_CreateInstance(GUIScrollArea instance, ScrollBarType vertBarType, ScrollBarType horzBarType, string scrollBarStyle, string scrollAreaStyle, params GUIOption[] options);
protected static extern void Internal_CreateInstanceYFromScrollArea(GUILayout instance, GUIScrollArea parentArea);
/// <summary> /// Internal method used by the runtime. Initializes a managed version of the vertical layout that is referenced /// by a native GUI scroll area element. /// </summary> /// <param name="parentArea">Scroll area of which we want to reference the layout of.</param> internal GUILayoutY(GUIScrollArea parentArea) { Internal_CreateInstanceYFromScrollArea(this, parentArea); }