Beispiel #1
0
        /// <summary>
        /// Updates GUI for the recent projects list.
        /// </summary>
        private void RefreshRecentProjects()
        {
            GUILayout scrollLayout = recentProjectsArea.Layout;

            while (scrollLayout.ChildCount > 0)
            {
                scrollLayout.GetChild(0).Destroy();
            }

            RecentProject[] recentProjects = EditorSettings.RecentProjects;
            Array.Sort(recentProjects, (a, b) => a.accessTimestamp.CompareTo(b.accessTimestamp));

            GUIToggleGroup grp = new GUIToggleGroup();

            for (int i = 0; i < recentProjects.Length; i++)
            {
                string projectPath = recentProjects[i].path;

                GUIToggle entryBtn = new GUIToggle(projectPath, grp, EditorStylesInternal.SelectableLabel);
                entryBtn.OnClick       += () => OnEntryClicked(projectPath);
                entryBtn.OnDoubleClick += () => OnEntryDoubleClicked(projectPath);

                if (PathEx.Compare(projectPath, projectInputBox.Value))
                {
                    entryBtn.Value = true;
                }

                scrollLayout.AddElement(entryBtn);
            }
        }
Beispiel #2
0
        private void OnInitialize()
        {
            mainLayout = GUI.AddLayoutY();

            GUIContent viewIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.View),
                                                 new LocEdString("View"));
            GUIContent moveIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Move),
                                                 new LocEdString("Move"));
            GUIContent rotateIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Rotate),
                                                   new LocEdString("Rotate"));
            GUIContent scaleIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Scale),
                                                  new LocEdString("Scale"));

            GUIContent localIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Local),
                                                  new LocEdString("Local"));
            GUIContent worldIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.World),
                                                  new LocEdString("World"));

            GUIContent pivotIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Pivot),
                                                  new LocEdString("Pivot"));
            GUIContent centerIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Center),
                                                   new LocEdString("Center"));

            GUIContent moveSnapIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.MoveSnap),
                                                     new LocEdString("Move snap"));
            GUIContent rotateSnapIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.RotateSnap),
                                                       new LocEdString("Rotate snap"));

            GUIToggleGroup handlesTG = new GUIToggleGroup();

            viewButton   = new GUIToggle(viewIcon, handlesTG, EditorStyles.Button, GUIOption.FlexibleWidth(35));
            moveButton   = new GUIToggle(moveIcon, handlesTG, EditorStyles.Button, GUIOption.FlexibleWidth(35));
            rotateButton = new GUIToggle(rotateIcon, handlesTG, EditorStyles.Button, GUIOption.FlexibleWidth(35));
            scaleButton  = new GUIToggle(scaleIcon, handlesTG, EditorStyles.Button, GUIOption.FlexibleWidth(35));

            GUIToggleGroup coordModeTG = new GUIToggleGroup();

            localCoordButton = new GUIToggle(localIcon, coordModeTG, EditorStyles.Button, GUIOption.FlexibleWidth(75));
            worldCoordButton = new GUIToggle(worldIcon, coordModeTG, EditorStyles.Button, GUIOption.FlexibleWidth(75));

            GUIToggleGroup pivotModeTG = new GUIToggleGroup();

            pivotButton  = new GUIToggle(pivotIcon, pivotModeTG, EditorStyles.Button, GUIOption.FlexibleWidth(35));
            centerButton = new GUIToggle(centerIcon, pivotModeTG, EditorStyles.Button, GUIOption.FlexibleWidth(35));

            moveSnapButton = new GUIToggle(moveSnapIcon, EditorStyles.Button, GUIOption.FlexibleWidth(35));
            moveSnapInput  = new GUIFloatField("", GUIOption.FlexibleWidth(35));

            rotateSnapButton = new GUIToggle(rotateSnapIcon, EditorStyles.Button, GUIOption.FlexibleWidth(35));
            rotateSnapInput  = new GUIFloatField("", GUIOption.FlexibleWidth(35));

            GUIContent cameraOptionsIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.SceneCameraOptions), new LocEdString("Camera options"));

            cameraOptionsButton = new GUIButton(cameraOptionsIcon);

            viewButton.OnClick   += () => OnSceneToolButtonClicked(SceneViewTool.View);
            moveButton.OnClick   += () => OnSceneToolButtonClicked(SceneViewTool.Move);
            rotateButton.OnClick += () => OnSceneToolButtonClicked(SceneViewTool.Rotate);
            scaleButton.OnClick  += () => OnSceneToolButtonClicked(SceneViewTool.Scale);

            localCoordButton.OnClick += () => OnCoordinateModeButtonClicked(HandleCoordinateMode.Local);
            worldCoordButton.OnClick += () => OnCoordinateModeButtonClicked(HandleCoordinateMode.World);

            pivotButton.OnClick  += () => OnPivotModeButtonClicked(HandlePivotMode.Pivot);
            centerButton.OnClick += () => OnPivotModeButtonClicked(HandlePivotMode.Center);

            moveSnapButton.OnToggled += (bool active) => OnMoveSnapToggled(active);
            moveSnapInput.OnChanged  += (float value) => OnMoveSnapValueChanged(value);

            rotateSnapButton.OnToggled += (bool active) => OnRotateSnapToggled(active);
            rotateSnapInput.OnChanged  += (float value) => OnRotateSnapValueChanged(value);

            cameraOptionsButton.OnClick += () => OnCameraOptionsClicked();

            GUILayout handlesLayout = mainLayout.AddLayoutX();

            handlesLayout.AddElement(viewButton);
            handlesLayout.AddElement(moveButton);
            handlesLayout.AddElement(rotateButton);
            handlesLayout.AddElement(scaleButton);
            handlesLayout.AddSpace(10);
            handlesLayout.AddElement(localCoordButton);
            handlesLayout.AddElement(worldCoordButton);
            handlesLayout.AddSpace(10);
            handlesLayout.AddElement(pivotButton);
            handlesLayout.AddElement(centerButton);
            handlesLayout.AddFlexibleSpace();
            handlesLayout.AddElement(moveSnapButton);
            handlesLayout.AddElement(moveSnapInput);
            handlesLayout.AddSpace(10);
            handlesLayout.AddElement(rotateSnapButton);
            handlesLayout.AddElement(rotateSnapInput);
            handlesLayout.AddSpace(10);
            handlesLayout.AddElement(cameraOptionsButton);
            handlesLayout.SetHeight(viewButton.Bounds.height);

            GUIPanel mainPanel = mainLayout.AddPanel();

            rtPanel = mainPanel.AddPanel();

            // Loading progress
            loadLabel       = new GUILabel(new LocEdString("Loading scene..."));
            loadProgressBar = new GUIProgressBar("", GUIOption.FixedWidth(200));

            progressLayout = mainPanel.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;

            selectionPanel = mainPanel.AddPanel(-1);

            sceneAxesPanel = mainPanel.AddPanel(-1);
            sceneAxesGUI   = new SceneAxesGUI(this, sceneAxesPanel, HandleAxesGUISize, HandleAxesGUISize, ProjectionType.Perspective);

            focusCatcher = new GUIButton("", EditorStyles.Blank);
            focusCatcher.OnFocusGained += () => hasContentFocus = true;
            focusCatcher.OnFocusLost   += () => hasContentFocus = false;

            GUIPanel focusPanel = GUI.AddPanel(-2);

            focusPanel.AddElement(focusCatcher);

            viewToolKey   = new VirtualButton(ViewToolBinding);
            moveToolKey   = new VirtualButton(MoveToolBinding);
            rotateToolKey = new VirtualButton(RotateToolBinding);
            scaleToolKey  = new VirtualButton(ScaleToolBinding);
            frameKey      = new VirtualButton(FrameBinding);

            UpdateRenderTexture(Width, Height - HeaderHeight);
            UpdateLoadingProgress();
        }
Beispiel #3
0
        private void OnInitialize()
        {
            GUILabel title    = new GUILabel(new LocEdString("Banshee Engine v0.4"), EditorStyles.TitleLabel);
            GUILabel subTitle = new GUILabel(new LocEdString("A modern open-source game development toolkit"),
                                             EditorStyles.LabelCentered);
            GUILabel license = new GUILabel(new LocEdString(
                                                "This program is licensed under the GNU Lesser General Public License V3"), EditorStyles.LabelCentered);
            GUILabel copyright = new GUILabel(new LocEdString("Copyright (C) 2015 Marko Pintera. All rights reserved."),
                                              EditorStyles.LabelCentered);

            GUILabel authorLabel = new GUILabel(new LocEdString("Banshee was created, and is being actively developed by Marko Pintera."));
            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"));

            GUIToggleGroup foldoutGroup         = new GUIToggleGroup(true);
            GUIToggle      contactFoldout       = new GUIToggle(new LocEdString("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      collaboratorsFoldout = new GUIToggle(new LocEdString("Collaborators"), foldoutGroup, EditorStyles.Foldout);

            contactFoldout.AcceptsKeyFocus       = false;
            thirdPartyFoldout.AcceptsKeyFocus    = false;
            noticesFoldout.AcceptsKeyFocus       = false;
            collaboratorsFoldout.AcceptsKeyFocus = false;

            GUILabel freeTypeNotice = new GUILabel(new LocEdString(
                                                       "Portions of this software are copyright (C) 2015 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 2013 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));

            GUILayoutY mainLayout = GUI.AddLayoutY();

            mainLayout.AddSpace(10);
            mainLayout.AddElement(title);
            mainLayout.AddElement(subTitle);
            mainLayout.AddSpace(10);
            mainLayout.AddElement(license);
            mainLayout.AddElement(copyright);
            mainLayout.AddSpace(10);
            mainLayout.AddElement(contactFoldout);

            GUILayoutY contactLayout = mainLayout.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);

            mainLayout.AddSpace(5);
            mainLayout.AddElement(thirdPartyFoldout);
            GUILayoutY thirdPartyLayout = mainLayout.AddLayoutY();

            CreateThirdPartyGUI(thirdPartyLayout, "Autodesk FBX SDK",
                                "http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775847");
            CreateThirdPartyGUI(thirdPartyLayout, "FreeImage", "http://freeimage.sourceforge.net/");
            CreateThirdPartyGUI(thirdPartyLayout, "FreeType", "http://www.freetype.org/");
            CreateThirdPartyGUI(thirdPartyLayout, "Mono", "http://www.mono-project.com/");
            CreateThirdPartyGUI(thirdPartyLayout, "NVIDIA Texture Tools",
                                "https://github.com/castano/nvidia-texture-tools");
            CreateThirdPartyGUI(thirdPartyLayout, "libFLAC", "https://xiph.org/flac/");
            CreateThirdPartyGUI(thirdPartyLayout, "libOgg", "https://www.xiph.org/ogg/");
            CreateThirdPartyGUI(thirdPartyLayout, "libVorbis", "http://www.vorbis.com/");
            CreateThirdPartyGUI(thirdPartyLayout, "OpenAL Soft", "http://kcat.strangesoft.net/openal.html");

            mainLayout.AddSpace(5);
            mainLayout.AddElement(noticesFoldout);
            GUILayout noticesLayout = mainLayout.AddLayoutY();

            noticesLayout.AddElement(freeTypeNotice);
            noticesLayout.AddSpace(10);
            noticesLayout.AddElement(fbxSdkNotice);

            mainLayout.AddSpace(5);
            mainLayout.AddElement(collaboratorsFoldout);
            GUILayoutY collaboratorsLayout = mainLayout.AddLayoutY();

            CreateCollaboratorGUI(collaboratorsLayout, "Danijel Ribic", "Logo, UI icons, 3D models & textures");
            CreateCollaboratorGUI(collaboratorsLayout, "Marco Bellan", "Bugfixes, editor enhancements");

            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;

            collaboratorsLayout.Active      = false;
            collaboratorsFoldout.OnToggled += x => collaboratorsLayout.Active = x;

            emailLabel.Text      = "*****@*****.**";
            linkedInBtn.OnClick += () => { System.Diagnostics.Process.Start("http://hr.linkedin.com/in/markopintera"); };
        }
Beispiel #4
0
        /// <summary>
        /// Initializes the drop down window by creating the necessary GUI. Must be called after construction and before
        /// use.
        /// </summary>
        /// <param name="parent">Libary window that this drop down window is a part of.</param>
        internal void Initialize(LibraryWindow parent)
        {
            this.parent = parent;

            GUIToggleGroup group = new GUIToggleGroup();

            GUIToggle list16 = new GUIToggle(new LocEdString("16"), group, EditorStyles.Button, GUIOption.FixedWidth(30));
            GUIToggle grid32 = new GUIToggle(new LocEdString("32"), group, EditorStyles.Button, GUIOption.FixedWidth(30));
            GUIToggle grid48 = new GUIToggle(new LocEdString("48"), group, EditorStyles.Button, GUIOption.FixedWidth(30));
            GUIToggle grid64 = new GUIToggle(new LocEdString("64"), group, EditorStyles.Button, GUIOption.FixedWidth(30));

            ProjectViewType activeType = parent.ViewType;

            switch (activeType)
            {
            case ProjectViewType.List16:
                list16.Value = true;
                break;

            case ProjectViewType.Grid32:
                grid32.Value = true;
                break;

            case ProjectViewType.Grid48:
                grid48.Value = true;
                break;

            case ProjectViewType.Grid64:
                grid64.Value = true;
                break;
            }

            list16.OnToggled += (active) =>
            {
                if (active)
                {
                    ChangeViewType(ProjectViewType.List16);
                }
            };

            grid32.OnToggled += (active) =>
            {
                if (active)
                {
                    ChangeViewType(ProjectViewType.Grid32);
                }
            };

            grid48.OnToggled += (active) =>
            {
                if (active)
                {
                    ChangeViewType(ProjectViewType.Grid48);
                }
            };

            grid64.OnToggled += (active) =>
            {
                if (active)
                {
                    ChangeViewType(ProjectViewType.Grid64);
                }
            };

            GUILayoutY vertLayout = GUI.AddLayoutY();

            vertLayout.AddFlexibleSpace();
            GUILayoutX contentLayout = vertLayout.AddLayoutX();

            contentLayout.AddFlexibleSpace();
            contentLayout.AddElement(list16);
            contentLayout.AddElement(grid32);
            contentLayout.AddElement(grid48);
            contentLayout.AddElement(grid64);
            contentLayout.AddFlexibleSpace();
            vertLayout.AddFlexibleSpace();
        }
Beispiel #5
0
        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();
        }
Beispiel #6
0
 private static extern void Internal_CreateInstance(GUIToggleGroup instance, bool allowAllOff);
Beispiel #7
0
        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"); };
        }
Beispiel #8
0
        private void OnInitialize()
        {
            mainLayout = GUI.AddLayoutY();

            GUIContent viewIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.View), 
                new LocEdString("View"));
            GUIContent moveIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Move), 
                new LocEdString("Move"));
            GUIContent rotateIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Rotate), 
                new LocEdString("Rotate"));
            GUIContent scaleIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Scale), 
                new LocEdString("Scale"));

            GUIContent localIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Local), 
                new LocEdString("Local"));
            GUIContent worldIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.World), 
                new LocEdString("World"));

            GUIContent pivotIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Pivot), 
                new LocEdString("Pivot"));
            GUIContent centerIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.Center), 
                new LocEdString("Center"));

            GUIContent moveSnapIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.MoveSnap), 
                new LocEdString("Move snap"));
            GUIContent rotateSnapIcon = new GUIContent(EditorBuiltin.GetSceneWindowIcon(SceneWindowIcon.RotateSnap), 
                new LocEdString("Rotate snap"));

            GUIToggleGroup handlesTG = new GUIToggleGroup();
            viewButton = new GUIToggle(viewIcon, handlesTG, EditorStyles.Button, GUIOption.FlexibleWidth(35));
            moveButton = new GUIToggle(moveIcon, handlesTG, EditorStyles.Button, GUIOption.FlexibleWidth(35));
            rotateButton = new GUIToggle(rotateIcon, handlesTG, EditorStyles.Button, GUIOption.FlexibleWidth(35));
            scaleButton = new GUIToggle(scaleIcon, handlesTG, EditorStyles.Button, GUIOption.FlexibleWidth(35));

            GUIToggleGroup coordModeTG = new GUIToggleGroup();
            localCoordButton = new GUIToggle(localIcon, coordModeTG, EditorStyles.Button, GUIOption.FlexibleWidth(75));
            worldCoordButton = new GUIToggle(worldIcon, coordModeTG, EditorStyles.Button, GUIOption.FlexibleWidth(75));

            GUIToggleGroup pivotModeTG = new GUIToggleGroup();
            pivotButton = new GUIToggle(pivotIcon, pivotModeTG, EditorStyles.Button, GUIOption.FlexibleWidth(35));
            centerButton = new GUIToggle(centerIcon, pivotModeTG, EditorStyles.Button, GUIOption.FlexibleWidth(35));

            moveSnapButton = new GUIToggle(moveSnapIcon, EditorStyles.Button, GUIOption.FlexibleWidth(35));
            moveSnapInput = new GUIFloatField("", GUIOption.FlexibleWidth(35));

            rotateSnapButton = new GUIToggle(rotateSnapIcon, EditorStyles.Button, GUIOption.FlexibleWidth(35));
            rotateSnapInput = new GUIFloatField("", GUIOption.FlexibleWidth(35));

            viewButton.OnClick += () => OnSceneToolButtonClicked(SceneViewTool.View);
            moveButton.OnClick += () => OnSceneToolButtonClicked(SceneViewTool.Move);
            rotateButton.OnClick += () => OnSceneToolButtonClicked(SceneViewTool.Rotate);
            scaleButton.OnClick += () => OnSceneToolButtonClicked(SceneViewTool.Scale);

            localCoordButton.OnClick += () => OnCoordinateModeButtonClicked(HandleCoordinateMode.Local);
            worldCoordButton.OnClick += () => OnCoordinateModeButtonClicked(HandleCoordinateMode.World);

            pivotButton.OnClick += () => OnPivotModeButtonClicked(HandlePivotMode.Pivot);
            centerButton.OnClick += () => OnPivotModeButtonClicked(HandlePivotMode.Center);

            moveSnapButton.OnToggled += (bool active) => OnMoveSnapToggled(active);
            moveSnapInput.OnChanged += (float value) => OnMoveSnapValueChanged(value);

            rotateSnapButton.OnToggled += (bool active) => OnRotateSnapToggled(active);
            rotateSnapInput.OnChanged += (float value) => OnRotateSnapValueChanged(value);

            GUILayout handlesLayout = mainLayout.AddLayoutX();
            handlesLayout.AddElement(viewButton);
            handlesLayout.AddElement(moveButton);
            handlesLayout.AddElement(rotateButton);
            handlesLayout.AddElement(scaleButton);
            handlesLayout.AddSpace(10);
            handlesLayout.AddElement(localCoordButton);
            handlesLayout.AddElement(worldCoordButton);
            handlesLayout.AddSpace(10);
            handlesLayout.AddElement(pivotButton);
            handlesLayout.AddElement(centerButton);
            handlesLayout.AddFlexibleSpace();
            handlesLayout.AddElement(moveSnapButton);
            handlesLayout.AddElement(moveSnapInput);
            handlesLayout.AddSpace(10);
            handlesLayout.AddElement(rotateSnapButton);
            handlesLayout.AddElement(rotateSnapInput);

            GUIPanel mainPanel = mainLayout.AddPanel();
            rtPanel = mainPanel.AddPanel();

            GUIPanel sceneAxesPanel = mainPanel.AddPanel(-1);
            sceneAxesGUI = new SceneAxesGUI(this, sceneAxesPanel, HandleAxesGUISize, HandleAxesGUISize, ProjectionType.Perspective);

            toggleProfilerOverlayKey = new VirtualButton(ToggleProfilerOverlayBinding);
            viewToolKey = new VirtualButton(ViewToolBinding);
            moveToolKey = new VirtualButton(MoveToolBinding);
            rotateToolKey = new VirtualButton(RotateToolBinding);
            scaleToolKey = new VirtualButton(ScaleToolBinding);
            duplicateKey = new VirtualButton(DuplicateBinding);
            deleteKey = new VirtualButton(DeleteBinding);
            frameKey = new VirtualButton(FrameBinding);

            UpdateRenderTexture(Width, Height - HeaderHeight);
            UpdateProfilerOverlay();
        }
Beispiel #9
0
 /// <summary>
 /// Creates a new toggle button with the specified label.
 /// </summary>
 /// <param name="content">Content to display on the button.</param>
 /// <param name="toggleGroup">Optional toggle group that is used for grouping multiple toggle buttons
 ///                           together. </param>
 /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as
 ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified
 ///                     default element style is used.</param>
 /// <param name="options">Options that allow you to control how is the element positioned and sized. This will
 ///                       override any similar options set by style.</param>
 public GUIToggle(GUIContent content, GUIToggleGroup toggleGroup, string style, params GUIOption[] options)
 {
     Internal_CreateInstance(this, ref content, toggleGroup, style, options);
 }
Beispiel #10
0
 private static extern void Internal_CreateInstance(GUIToggle instance, ref GUIContent content,
                                                    GUIToggleGroup toggleGroup, string style, GUIOption[] options);
Beispiel #11
0
 /// <summary>
 /// Creates a new toggle button with the specified label.
 /// </summary>
 /// <param name="content">Content to display on the button.</param>
 /// <param name="toggleGroup">Optional toggle group that is used for grouping multiple toggle buttons
 ///                           together.</param>
 /// <param name="style">Optional style to use for the element. Style controls the look of the element, as well as
 ///                     default layout options. Style will be retrieved from the active GUISkin. If not specified
 ///                     default element style is used.</param>
 public GUIToggle(GUIContent content, GUIToggleGroup toggleGroup, string style)
 {
     Internal_CreateInstance(this, ref content, toggleGroup, style, new GUIOption[0]);
 }