コード例 #1
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the limit object.
        /// </summary>
        /// <param name="prefix">Prefix that identifies the exact type of the limit type.</param>
        /// <param name="limitData">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public LimitCommonGUI(string prefix, LimitCommon limitData, GUILayout layout, SerializableProperties properties)
        {
            this.limitData  = limitData;
            this.properties = properties;
            this.prefix     = prefix;

            hardFoldout.OnToggled += x =>
            {
                properties.SetBool(prefix + "_hardLimit_Expanded", x);
                ToggleLimitFields();
            };

            contactDistanceField.OnChanged   += x => { this.limitData.contactDist = x; MarkAsModified(); };
            contactDistanceField.OnFocusLost += ConfirmModify;
            contactDistanceField.OnConfirmed += ConfirmModify;

            softFoldout.OnToggled += x =>
            {
                properties.SetBool(prefix + "_softLimit_Expanded", x);
                ToggleLimitFields();
            };

            restitutionField.OnChanged   += x => { this.limitData.restitution = x; MarkAsModified(); };
            restitutionField.OnFocusLost += ConfirmModify;

            springFoldout.OnToggled += x =>
            {
                properties.SetBool(prefix + "_spring_Expanded", x);
                ToggleLimitFields();
            };

            hardLimitLayout = layout.AddLayoutX();
            {
                hardLimitLayout.AddSpace(10);

                GUILayoutY hardLimitContentsLayout = hardLimitLayout.AddLayoutY();
                hardLimitContentsLayout.AddElement(contactDistanceField);
            }

            softLimitLayout = layout.AddLayoutX();
            layout.AddElement(softFoldout);
            {
                softLimitLayout.AddSpace(10);

                GUILayoutY softLimitContentsLayout = softLimitLayout.AddLayoutY();
                softLimitContentsLayout.AddElement(restitutionField);
                softLimitContentsLayout.AddElement(springFoldout);
                springLayout = softLimitContentsLayout.AddLayoutX();
                {
                    springLayout.AddSpace(10);

                    GUILayoutY springContentsLayout = springLayout.AddLayoutY();
                    springGUI              = new SpringGUI(limitData.spring, springContentsLayout);
                    springGUI.OnChanged   += x => { this.limitData.spring = x; MarkAsModified(); };
                    springGUI.OnConfirmed += ConfirmModify;
                }
            }
        }
コード例 #2
0
        /// <inheritoc/>
        protected internal override void Initialize(int layoutIndex)
        {
            GUILayoutX boundsLayout = new GUILayoutX();

            centerField = new GUIVector3Field(new LocEdString("Center"), 50);
            sizeField   = new GUIVector3Field(new LocEdString("Size"), 50);

            layout.AddElement(layoutIndex, boundsLayout);

            boundsLayout.AddElement(new GUILabel(new LocEdString(title), GUIOption.FixedWidth(100)));

            GUILayoutY boundsContent = boundsLayout.AddLayoutY();

            boundsContent.AddElement(centerField);
            boundsContent.AddElement(sizeField);

            centerField.OnValueChanged += x =>
            {
                AABox   bounds = property.GetValue <AABox>();
                Vector3 min    = x - bounds.Size * 0.5f;
                Vector3 max    = x + bounds.Size * 0.5f;

                RecordStateForUndoIfNeeded();
                property.SetValue(new AABox(min, max));
                state |= InspectableState.ModifyInProgress;
            };
            centerField.OnConfirm     += x => OnFieldValueConfirm();
            centerField.OnFocusLost   += OnFieldValueConfirm;
            centerField.OnFocusGained += RecordStateForUndoRequested;

            sizeField.OnValueChanged += x =>
            {
                AABox   bounds = property.GetValue <AABox>();
                Vector3 min    = bounds.Center - x * 0.5f;
                Vector3 max    = bounds.Center + x * 0.5f;

                RecordStateForUndoIfNeeded();
                property.SetValue(new AABox(min, max));
                state |= InspectableState.ModifyInProgress;
            };
            sizeField.OnConfirm     += x => OnFieldValueConfirm();
            sizeField.OnFocusLost   += OnFieldValueConfirm;
            sizeField.OnFocusGained += RecordStateForUndoRequested;
        }
コード例 #3
0
            /// <inheritdoc/>
            protected override void CreateValueGUI(GUILayoutY layout)
            {
                string value = GetValue <string>();

                valueField = new GUITextField(new LocEdString(value));
                layout.AddElement(valueField);

                valueField.OnChanged   += x => { SetValue(x); MarkAsModified(); };
                valueField.OnConfirmed += ConfirmModify;
                valueField.OnFocusLost += ConfirmModify;
            }
コード例 #4
0
            /// <inheritdoc/>
            public override void BuildGUI()
            {
                main     = Layout.AddPanel(0, 1, 1, GUIOption.FixedHeight(ENTRY_HEIGHT));
                overlay  = main.AddPanel(-1, 0, 0, GUIOption.FixedHeight(ENTRY_HEIGHT));
                underlay = main.AddPanel(1, 0, 0, GUIOption.FixedHeight(ENTRY_HEIGHT));

                GUILayoutX mainLayout     = main.AddLayoutX();
                GUILayoutY overlayLayout  = overlay.AddLayoutY();
                GUILayoutY underlayLayout = underlay.AddLayoutY();

                icon          = new GUITexture(null, GUIOption.FixedWidth(32), GUIOption.FixedHeight(32));
                messageLabel  = new GUILabel(new LocEdString(""), EditorStyles.MultiLineLabel, GUIOption.FixedHeight(MESSAGE_HEIGHT));
                functionLabel = new GUILabel(new LocEdString(""), GUIOption.FixedHeight(CALLER_LABEL_HEIGHT));

                mainLayout.AddSpace(PADDING);
                GUILayoutY iconLayout = mainLayout.AddLayoutY();

                iconLayout.AddFlexibleSpace();
                iconLayout.AddElement(icon);
                iconLayout.AddFlexibleSpace();

                mainLayout.AddSpace(PADDING);
                GUILayoutY messageLayout = mainLayout.AddLayoutY();

                messageLayout.AddSpace(PADDING);
                messageLayout.AddElement(messageLabel);
                messageLayout.AddElement(functionLabel);
                messageLayout.AddSpace(PADDING);
                mainLayout.AddFlexibleSpace();
                mainLayout.AddSpace(PADDING);

                background = new GUITexture(Builtin.WhiteTexture, GUIOption.FixedHeight(ENTRY_HEIGHT));
                underlayLayout.AddElement(background);

                GUIButton button = new GUIButton(new LocEdString(""), EditorStyles.Blank, GUIOption.FixedHeight(ENTRY_HEIGHT));

                overlayLayout.AddElement(button);

                button.OnClick       += OnClicked;
                button.OnDoubleClick += OnDoubleClicked;
            }
コード例 #5
0
        /// <summary>
        /// Creates a new scene axes GUI.
        /// </summary>
        /// <param name="window">Window in which the GUI is located in.</param>
        /// <param name="panel">Panel onto which to place the GUI element.</param>
        /// <param name="width">Width of the GUI element.</param>
        /// <param name="height">Height of the GUI element.</param>
        /// <param name="projType">Projection type to display on the GUI.</param>
        public SceneAxesGUI(SceneWindow window, GUIPanel panel, int width, int height, ProjectionType projType)
        {
            renderTexture          = new RenderTexture(PixelFormat.RGBA8, width, height);
            renderTexture.Priority = 1;

            SceneObject cameraSO = new SceneObject("SceneAxesCamera", true);

            camera = cameraSO.AddComponent <Camera>();
            camera.Viewport.Target = renderTexture;
            camera.Viewport.Area   = new Rect2(0.0f, 0.0f, 1.0f, 1.0f);

            cameraSO.Position = new Vector3(0, 0, 5);
            cameraSO.LookAt(new Vector3(0, 0, 0));

            camera.Priority            = 2;
            camera.NearClipPlane       = 0.05f;
            camera.FarClipPlane        = 1000.0f;
            camera.Viewport.ClearColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
            camera.ProjectionType      = ProjectionType.Orthographic;
            camera.Layers      = SceneAxesHandle.LAYER;
            camera.AspectRatio = 1.0f;
            camera.OrthoHeight = 2.0f;
            camera.RenderSettings.EnableHDR    = false;
            camera.RenderSettings.EnableSkybox = false;
            camera.Flags |= CameraFlag.OnDemand;

            renderTextureGUI = new GUIRenderTexture(renderTexture, true);

            GUILayoutY layout        = panel.AddLayoutY();
            GUILayoutX textureLayout = layout.AddLayoutX();

            textureLayout.AddElement(renderTextureGUI);
            textureLayout.AddFlexibleSpace();

            Rect2I bounds = new Rect2I(0, 0, width, height);

            sceneHandles            = new SceneHandles(window, camera);
            renderTextureGUI.Bounds = bounds;

            labelGUI = new GUILabel(projType.ToString(), EditorStyles.LabelCentered);
            layout.AddElement(labelGUI);
            layout.AddFlexibleSpace();

            this.panel  = panel;
            this.bounds = bounds;

            NotifyNeedsRedraw();
        }
コード例 #6
0
        /// <summary>
        /// Initializes the drop down window by creating the necessary GUI. Must be called after construction and before
        /// use.
        /// </summary>
        /// <param name="parent">Scene window that this drop down window is a part of.</param>
        /// <param name="cameraOptions">Reference to the current scene camera options.</param>
        internal void Initialize(SceneWindow parent)
        {
            this.Parent = parent;

            GUIEnumField cameraProjectionTypeField = new GUIEnumField(typeof(ProjectionType), new LocEdString("Projection type"));

            cameraProjectionTypeField.Value = (ulong)Parent.ProjectionType;
            cameraProjectionTypeField.OnSelectionChanged += SetCameraProjectionType;

            nearClipPlaneInput            = new GUIFloatField(new LocEdString("Near plane"));
            nearClipPlaneInput.Value      = Parent.NearClipPlane;
            nearClipPlaneInput.OnChanged += OnNearClipPlaneChanged;
            nearClipPlaneInput.SetRange(SceneCameraOptions.MinNearClipPlane, SceneCameraOptions.MaxNearClipPlane);

            farClipPlaneInput            = new GUIFloatField(new LocEdString("Far plane"));
            farClipPlaneInput.Value      = Parent.FarClipPlane;
            farClipPlaneInput.OnChanged += OnFarClipPlaneChanged;
            farClipPlaneInput.SetRange(SceneCameraOptions.MinFarClipPlane, SceneCameraOptions.MaxFarClipPlane);

            cameraFieldOfView            = new GUISliderField(1, 360, new LocEdString("Field of view"));
            cameraFieldOfView.Value      = Parent.FieldOfView.Degrees;
            cameraFieldOfView.OnChanged += SetFieldOfView;

            cameraOrthographicSize            = new GUIFloatField(new LocEdString("Orthographic size"));
            cameraOrthographicSize.Value      = Parent.OrthographicSize;
            cameraOrthographicSize.OnChanged += SetOrthographicSize;

            GUISliderField cameraScrollSpeed = new GUISliderField(SceneCameraOptions.MinScrollSpeed, SceneCameraOptions.MaxScrollSpeed,
                                                                  new LocEdString("Scroll speed"));

            cameraScrollSpeed.Value      = Parent.ScrollSpeed;
            cameraScrollSpeed.OnChanged += SetScrollSpeed;

            GUILayoutY vertLayout = GUI.AddLayoutY();

            vertLayout.AddSpace(10);

            GUILayoutX cameraOptionsLayoutX = vertLayout.AddLayoutX();

            cameraOptionsLayoutX.AddSpace(10);

            GUILayoutY cameraOptionsLayoutY = cameraOptionsLayoutX.AddLayoutY();

            cameraOptionsLayoutY.AddElement(cameraProjectionTypeField);
            cameraOptionsLayoutY.AddElement(nearClipPlaneInput);
            cameraOptionsLayoutY.AddElement(farClipPlaneInput);
            cameraOptionsLayoutY.AddElement(cameraFieldOfView);
            cameraOptionsLayoutY.AddElement(cameraOrthographicSize);
            cameraOptionsLayoutY.AddElement(cameraScrollSpeed);
            cameraOptionsLayoutX.AddSpace(10);

            vertLayout.AddSpace(10);

            ToggleTypeSpecificFields((ProjectionType)cameraProjectionTypeField.Value);
        }
コード例 #7
0
        /// <summary>
        /// Recreates all the GUI elements used by this inspector.
        /// </summary>
        private void BuildGUI()
        {
            Layout.Clear();

            Animation animation = InspectedObject as Animation;

            if (animation == null)
            {
                return;
            }

            animationClipField.OnChanged += x =>
            {
                AnimationClip clip = Resources.Load <AnimationClip>(x.UUID);

                animation.DefaultClip = clip;
                MarkAsModified();
                ConfirmModify();
            };

            wrapModeField.OnSelectionChanged += x =>
            {
                animation.WrapMode = (AnimWrapMode)x;
                MarkAsModified();
                ConfirmModify();
            };

            speedField.OnChanged   += x => { animation.Speed = x; MarkAsModified(); };
            speedField.OnConfirmed += ConfirmModify;
            speedField.OnFocusLost += ConfirmModify;

            cullingField.OnChanged        += x => { animation.Cull = x; MarkAsModified(); ConfirmModify(); };
            overrideBoundsField.OnChanged += x => { animation.UseBounds = x; MarkAsModified(); ConfirmModify(); };
            centerField.OnChanged         += x =>
            {
                AABox   bounds = animation.Bounds;
                Vector3 min    = x - bounds.Size * 0.5f;
                Vector3 max    = x + bounds.Size * 0.5f;

                animation.Bounds = new AABox(min, max);
                MarkAsModified();
            };
            centerField.OnConfirmed += ConfirmModify;
            centerField.OnFocusLost += ConfirmModify;

            sizeField.OnChanged += x =>
            {
                AABox   bounds = animation.Bounds;
                Vector3 min    = bounds.Center - x * 0.5f;
                Vector3 max    = bounds.Center + x * 0.5f;

                animation.Bounds = new AABox(min, max);
                MarkAsModified();
            };
            sizeField.OnConfirmed += ConfirmModify;
            sizeField.OnFocusLost += ConfirmModify;

            Layout.AddElement(animationClipField);
            Layout.AddElement(wrapModeField);
            Layout.AddElement(speedField);
            Layout.AddElement(cullingField);
            Layout.AddElement(overrideBoundsField);

            GUILayoutX boundsLayout = Layout.AddLayoutX();

            boundsLayout.AddElement(new GUILabel(new LocEdString("Bounds"), GUIOption.FixedWidth(100)));

            GUILayoutY boundsContent = boundsLayout.AddLayoutY();

            boundsContent.AddElement(centerField);
            boundsContent.AddElement(sizeField);

            // Morph shapes
            Renderable  renderable  = animation.SceneObject.GetComponent <Renderable>();
            MorphShapes morphShapes = renderable?.Mesh.Value?.MorphShapes;

            if (morphShapes != null)
            {
                GUIToggle morphShapesToggle = new GUIToggle(new LocEdString("Morph shapes"), EditorStyles.Foldout);

                Layout.AddElement(morphShapesToggle);
                GUILayoutY channelsLayout = Layout.AddLayoutY();

                morphShapesToggle.OnToggled += x =>
                {
                    channelsLayout.Active = x;
                    Persistent.SetBool("Channels_Expanded", x);
                };

                channelsLayout.Active = Persistent.GetBool("Channels_Expanded");

                MorphChannel[] channels = morphShapes.Channels;
                for (int i = 0; i < channels.Length; i++)
                {
                    GUILayoutY channelLayout = channelsLayout.AddLayoutY();

                    GUILayoutX channelTitleLayout = channelLayout.AddLayoutX();
                    channelLayout.AddSpace(5);
                    GUILayoutY channelContentLayout = channelLayout.AddLayoutY();

                    string    channelName      = channels[i].Name;
                    GUIToggle channelNameField = new GUIToggle(channelName, EditorStyles.Expand, GUIOption.FlexibleWidth());

                    channelTitleLayout.AddSpace(15); // Indent
                    channelTitleLayout.AddElement(channelNameField);
                    channelTitleLayout.AddFlexibleSpace();

                    channelNameField.OnToggled += x =>
                    {
                        channelContentLayout.Active = x;

                        Persistent.SetBool(channelName + "_Expanded", x);
                    };

                    channelContentLayout.Active = Persistent.GetBool(channelName + "_Expanded");

                    MorphShape[] shapes = channels[i].Shapes;
                    for (int j = 0; j < shapes.Length; j++)
                    {
                        GUILayoutX shapeLayout = channelContentLayout.AddLayoutX();
                        channelContentLayout.AddSpace(5);

                        LocString nameString = new LocString("[{0}]. {1}");
                        nameString.SetParameter(0, j.ToString());
                        nameString.SetParameter(1, shapes[j].Name);
                        GUILabel shapeNameField = new GUILabel(shapes[j].Name);

                        LocString weightString = new LocEdString("Weight: {0}");
                        weightString.SetParameter(0, shapes[j].Weight.ToString());
                        GUILabel weightField = new GUILabel(weightString);

                        shapeLayout.AddSpace(30); // Indent
                        shapeLayout.AddElement(shapeNameField);
                        shapeLayout.AddFlexibleSpace();
                        shapeLayout.AddElement(weightField);
                    }
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// Creates GUI elements required for displaying <see cref="SceneObject"/> fields like name, prefab data and
        /// transform (position, rotation, scale). Assumes that necessary inspector scroll area layout has already been
        /// created.
        /// </summary>
        private void CreateSceneObjectFields()
        {
            GUIPanel sceneObjectPanel = inspectorLayout.AddPanel();

            sceneObjectPanel.SetHeight(GetTitleBounds().height);

            GUILayoutY sceneObjectLayout = sceneObjectPanel.AddLayoutY();

            sceneObjectLayout.SetPosition(PADDING, PADDING);

            GUIPanel sceneObjectBgPanel = sceneObjectPanel.AddPanel(1);

            GUILayoutX nameLayout = sceneObjectLayout.AddLayoutX();

            soActiveToggle            = new GUIToggle("");
            soActiveToggle.OnToggled += OnSceneObjectActiveStateToggled;
            GUILabel nameLbl = new GUILabel(new LocEdString("Name"), GUIOption.FixedWidth(50));

            soNameInput              = new GUITextBox(false, GUIOption.FlexibleWidth(180));
            soNameInput.Text         = activeSO.Name;
            soNameInput.OnChanged   += OnSceneObjectRename;
            soNameInput.OnConfirmed += OnModifyConfirm;
            soNameInput.OnFocusLost += OnModifyConfirm;

            nameLayout.AddElement(soActiveToggle);
            nameLayout.AddSpace(3);
            nameLayout.AddElement(nameLbl);
            nameLayout.AddElement(soNameInput);
            nameLayout.AddFlexibleSpace();

            GUILayoutX mobilityLayout = sceneObjectLayout.AddLayoutX();
            GUILabel   mobilityLbl    = new GUILabel(new LocEdString("Mobility"), GUIOption.FixedWidth(50));

            soMobility       = new GUIEnumField(typeof(ObjectMobility), "", 0, GUIOption.FixedWidth(85));
            soMobility.Value = (ulong)activeSO.Mobility;
            soMobility.OnSelectionChanged += value => activeSO.Mobility = (ObjectMobility)value;
            mobilityLayout.AddElement(mobilityLbl);
            mobilityLayout.AddElement(soMobility);

            soPrefabLayout = sceneObjectLayout.AddLayoutX();

            soPos = new GUIVector3Field(new LocEdString("Position"), 50);
            sceneObjectLayout.AddElement(soPos);

            soPos.OnChanged   += OnPositionChanged;
            soPos.OnConfirmed += OnModifyConfirm;
            soPos.OnFocusLost += OnModifyConfirm;

            soRot = new GUIVector3Field(new LocEdString("Rotation"), 50);
            sceneObjectLayout.AddElement(soRot);

            soRot.OnChanged   += OnRotationChanged;
            soRot.OnConfirmed += OnModifyConfirm;
            soRot.OnFocusLost += OnModifyConfirm;

            soScale = new GUIVector3Field(new LocEdString("Scale"), 50);
            sceneObjectLayout.AddElement(soScale);

            soScale.OnChanged   += OnScaleChanged;
            soScale.OnConfirmed += OnModifyConfirm;
            soScale.OnFocusLost += OnModifyConfirm;

            sceneObjectLayout.AddFlexibleSpace();

            GUITexture titleBg = new GUITexture(null, EditorStylesInternal.InspectorTitleBg);

            sceneObjectBgPanel.AddElement(titleBg);
        }
コード例 #9
0
            /// <summary>
            /// Builds GUI for the specified GUI element style.
            /// </summary>
            /// <param name="layout">Layout to append the GUI elements to.</param>
            /// <param name="depth">Determines the depth at which the element is rendered.</param>
            public void BuildGUI(GUILayout layout, int depth)
            {
                short  backgroundDepth = (short)(Inspector.START_BACKGROUND_DEPTH - depth - 1);
                string bgPanelStyle    = depth % 2 == 0
                    ? EditorStylesInternal.InspectorContentBgAlternate
                    : EditorStylesInternal.InspectorContentBg;

                GUIToggle foldout = new GUIToggle(new LocEdString("Style"), EditorStyles.Foldout);

                foldout.AcceptsKeyFocus = false;

                GUITexture inspectorContentBg = new GUITexture(null, bgPanelStyle);

                layout.AddElement(foldout);
                GUIPanel panel           = layout.AddPanel();
                GUIPanel backgroundPanel = panel.AddPanel(backgroundDepth);

                backgroundPanel.AddElement(inspectorContentBg);

                GUILayoutX guiIndentLayoutX = panel.AddLayoutX();

                guiIndentLayoutX.AddSpace(IndentAmount);
                GUILayoutY guiIndentLayoutY = guiIndentLayoutX.AddLayoutY();

                guiIndentLayoutY.AddSpace(IndentAmount);
                GUILayoutY contentLayout = guiIndentLayoutY.AddLayoutY();

                guiIndentLayoutY.AddSpace(IndentAmount);
                guiIndentLayoutX.AddSpace(IndentAmount);

                fontField          = new GUIResourceField(typeof(Font), new LocEdString("Font"));
                fontSizeField      = new GUIIntField(new LocEdString("Font size"));
                horzAlignField     = new GUIEnumField(typeof(TextHorzAlign), new LocEdString("Horizontal alignment"));
                vertAlignField     = new GUIEnumField(typeof(TextVertAlign), new LocEdString("Vertical alignment"));
                imagePositionField = new GUIEnumField(typeof(GUIImagePosition), new LocEdString("Image position"));
                wordWrapField      = new GUIToggleField(new LocEdString("Word wrap"));

                contentLayout.AddElement(fontField);
                contentLayout.AddElement(fontSizeField);
                contentLayout.AddElement(horzAlignField);
                contentLayout.AddElement(vertAlignField);
                contentLayout.AddElement(imagePositionField);
                contentLayout.AddElement(wordWrapField);

                normalGUI.BuildGUI(new LocEdString("Normal"), contentLayout);
                hoverGUI.BuildGUI(new LocEdString("Hover"), contentLayout);
                activeGUI.BuildGUI(new LocEdString("Active"), contentLayout);
                focusedGUI.BuildGUI(new LocEdString("Focused"), contentLayout);
                normalOnGUI.BuildGUI(new LocEdString("NormalOn"), contentLayout);
                hoverOnGUI.BuildGUI(new LocEdString("HoverOn"), contentLayout);
                activeOnGUI.BuildGUI(new LocEdString("ActiveOn"), contentLayout);
                focusedOnGUI.BuildGUI(new LocEdString("FocusedOn"), contentLayout);

                borderGUI        = new RectOffsetGUI(new LocEdString("Border"), contentLayout);
                marginsGUI       = new RectOffsetGUI(new LocEdString("Margins"), contentLayout);
                contentOffsetGUI = new RectOffsetGUI(new LocEdString("Content offset"), contentLayout);

                fixedWidthField = new GUIToggleField(new LocEdString("Fixed width"));
                widthField      = new GUIIntField(new LocEdString("Width"));
                minWidthField   = new GUIIntField(new LocEdString("Min. width"));
                maxWidthField   = new GUIIntField(new LocEdString("Max. width"));

                fixedHeightField = new GUIToggleField(new LocEdString("Fixed height"));
                heightField      = new GUIIntField(new LocEdString("Height"));
                minHeightField   = new GUIIntField(new LocEdString("Min. height"));
                maxHeightField   = new GUIIntField(new LocEdString("Max. height"));

                contentLayout.AddElement(fixedWidthField);
                contentLayout.AddElement(widthField);
                contentLayout.AddElement(minWidthField);
                contentLayout.AddElement(maxWidthField);

                contentLayout.AddElement(fixedHeightField);
                contentLayout.AddElement(heightField);
                contentLayout.AddElement(minHeightField);
                contentLayout.AddElement(maxHeightField);

                foldout.OnToggled += x =>
                {
                    panel.Active = x;
                    isExpanded   = x;
                };

                fontField.OnChanged += x =>
                {
                    Font font = Resources.Load <Font>(x.UUID);

                    GetStyle().Font = font;
                    MarkAsModified();
                    ConfirmModify();
                };
                fontSizeField.OnChanged           += x => { GetStyle().FontSize = x; MarkAsModified(); };
                fontSizeField.OnFocusLost         += ConfirmModify;
                fontSizeField.OnConfirmed         += ConfirmModify;
                horzAlignField.OnSelectionChanged += x =>
                {
                    GetStyle().TextHorzAlign = (TextHorzAlign)x;
                    MarkAsModified();
                    ConfirmModify();
                };
                vertAlignField.OnSelectionChanged += x =>
                {
                    GetStyle().TextVertAlign = (TextVertAlign)x;
                    MarkAsModified();
                    ConfirmModify();
                };
                imagePositionField.OnSelectionChanged += x =>
                {
                    GetStyle().ImagePosition = (GUIImagePosition)x;
                    MarkAsModified();
                    ConfirmModify();
                };
                wordWrapField.OnChanged += x => { GetStyle().WordWrap = x; MarkAsModified(); ConfirmModify(); };

                normalGUI.OnChanged    += x => { GetStyle().Normal = x; MarkAsModified(); ConfirmModify(); };
                hoverGUI.OnChanged     += x => { GetStyle().Hover = x; MarkAsModified(); ConfirmModify(); };
                activeGUI.OnChanged    += x => { GetStyle().Active = x; MarkAsModified(); ConfirmModify(); };
                focusedGUI.OnChanged   += x => { GetStyle().Focused = x; MarkAsModified(); ConfirmModify(); };
                normalOnGUI.OnChanged  += x => { GetStyle().NormalOn = x; MarkAsModified(); ConfirmModify(); };
                hoverOnGUI.OnChanged   += x => { GetStyle().HoverOn = x; MarkAsModified(); ConfirmModify(); };
                activeOnGUI.OnChanged  += x => { GetStyle().ActiveOn = x; MarkAsModified(); ConfirmModify(); };
                focusedOnGUI.OnChanged += x => { GetStyle().FocusedOn = x; MarkAsModified(); ConfirmModify(); };

                borderGUI.OnChanged        += x => { GetStyle().Border = x; MarkAsModified(); };
                marginsGUI.OnChanged       += x => { GetStyle().Margins = x; MarkAsModified(); };
                contentOffsetGUI.OnChanged += x => { GetStyle().ContentOffset = x; MarkAsModified(); };

                borderGUI.OnConfirmed        += ConfirmModify;
                marginsGUI.OnConfirmed       += ConfirmModify;
                contentOffsetGUI.OnConfirmed += ConfirmModify;

                fixedWidthField.OnChanged += x => { GetStyle().FixedWidth = x; MarkAsModified(); ConfirmModify(); };
                widthField.OnChanged      += x => GetStyle().Width = x;
                widthField.OnFocusLost    += ConfirmModify;
                widthField.OnConfirmed    += ConfirmModify;
                minWidthField.OnChanged   += x => GetStyle().MinWidth = x;
                minWidthField.OnFocusLost += ConfirmModify;
                minWidthField.OnConfirmed += ConfirmModify;
                maxWidthField.OnChanged   += x => GetStyle().MaxWidth = x;
                maxWidthField.OnFocusLost += ConfirmModify;
                maxWidthField.OnConfirmed += ConfirmModify;

                fixedHeightField.OnChanged += x => { GetStyle().FixedHeight = x; MarkAsModified(); ConfirmModify(); };
                heightField.OnChanged      += x => GetStyle().Height = x;
                heightField.OnFocusLost    += ConfirmModify;
                heightField.OnConfirmed    += ConfirmModify;
                minHeightField.OnChanged   += x => GetStyle().MinHeight = x;
                minHeightField.OnFocusLost += ConfirmModify;
                minHeightField.OnConfirmed += ConfirmModify;
                maxHeightField.OnChanged   += x => GetStyle().MaxHeight = x;
                maxHeightField.OnFocusLost += ConfirmModify;
                maxHeightField.OnConfirmed += ConfirmModify;

                foldout.Value = isExpanded;
                panel.Active  = isExpanded;
            }
コード例 #10
0
        /// <summary>
        /// Creates GUI elements for fields specific to the spherical joint.
        /// </summary>
        protected void BuildGUI(D6Joint joint)
        {
            for (int i = 0; i < (int)D6JointAxis.Count; i++)
            {
                D6JointAxis axis      = (D6JointAxis)i;
                string      entryName = Enum.GetName(typeof(D6JointAxis), axis);

                motionFields[i] = new GUIEnumField(typeof(D6JointMotion), new LocEdString(entryName));
                motionFields[i].OnSelectionChanged += x =>
                {
                    joint.SetMotion(axis, (D6JointMotion)x);

                    MarkAsModified();
                    ConfirmModify();
                };
            }

            linearLimitFoldout.AcceptsKeyFocus = false;
            linearLimitFoldout.OnToggled      += x =>
            {
                linearLimitLayout.Active = x;
                Persistent.SetBool("linearLimit_Expanded", x);
            };

            twistLimitFoldout.AcceptsKeyFocus = false;
            twistLimitFoldout.OnToggled      += x =>
            {
                twistLimitLayout.Active = x;
                Persistent.SetBool("twistLimit_Expanded", x);
            };

            swingLimitFoldout.AcceptsKeyFocus = false;
            swingLimitFoldout.OnToggled      += x =>
            {
                swingLimitLayout.Active = x;
                Persistent.SetBool("swingLimit_Expanded", x);
            };

            driveFoldout.AcceptsKeyFocus = false;
            driveFoldout.OnToggled      += x =>
            {
                driveLayout.Active = x;
                Persistent.SetBool("drive_Expanded", x);
            };

            drivePositionField.OnChanged   += x => { joint.SetDriveTransform(x, joint.DriveRotation); MarkAsModified(); };
            drivePositionField.OnFocusLost += ConfirmModify;
            drivePositionField.OnConfirmed += ConfirmModify;

            driveRotationField.OnChanged   += x => { joint.SetDriveTransform(joint.DrivePosition, Quaternion.FromEuler(x)); MarkAsModified(); };
            driveRotationField.OnFocusLost += ConfirmModify;
            driveRotationField.OnConfirmed += ConfirmModify;

            driveLinVelocityField.OnChanged   += x => { joint.SetDriveVelocity(x, joint.DriveAngularVelocity); MarkAsModified(); };
            driveLinVelocityField.OnFocusLost += ConfirmModify;
            driveLinVelocityField.OnConfirmed += ConfirmModify;

            driveAngVelocityField.OnChanged   += x => { joint.SetDriveVelocity(joint.DriveLinearVelocity, x); MarkAsModified(); };
            driveAngVelocityField.OnFocusLost += ConfirmModify;
            driveAngVelocityField.OnConfirmed += ConfirmModify;

            for (int i = 0; i < (int)D6JointAxis.Count; i++)
            {
                Layout.AddElement(motionFields[i]);
            }

            Layout.AddElement(linearLimitFoldout);
            linearLimitLayout = Layout.AddLayoutX();
            {
                linearLimitLayout.AddSpace(10);
                GUILayoutY linearLimitContentsLayout = linearLimitLayout.AddLayoutY();
                limitLinearGUI            = new LimitLinearGUI(joint.LimitLinear, linearLimitContentsLayout, Persistent);
                limitLinearGUI.OnChanged += (x, y) =>
                {
                    joint.LimitLinear = x;
                    joint.LimitLinear.SetBase(y);

                    MarkAsModified();
                };
                limitLinearGUI.OnConfirmed += ConfirmModify;
            }

            Layout.AddElement(twistLimitFoldout);
            twistLimitLayout = Layout.AddLayoutX();
            {
                twistLimitLayout.AddSpace(10);
                GUILayoutY twistLimitContentsLayout = twistLimitLayout.AddLayoutY();
                limitTwistGUI            = new LimitAngularRangeGUI(joint.LimitTwist, twistLimitContentsLayout, Persistent);
                limitTwistGUI.OnChanged += (x, y) =>
                {
                    joint.LimitTwist = x;
                    joint.LimitTwist.SetBase(y);

                    MarkAsModified();
                };
                limitTwistGUI.OnConfirmed += ConfirmModify;
            }

            Layout.AddElement(swingLimitFoldout);
            swingLimitLayout = Layout.AddLayoutX();
            {
                swingLimitLayout.AddSpace(10);
                GUILayoutY swingLimitContentsLayout = swingLimitLayout.AddLayoutY();
                limitSwingGUI            = new LimitConeRangeGUI(joint.LimitSwing, swingLimitContentsLayout, Persistent);
                limitSwingGUI.OnChanged += (x, y) =>
                {
                    joint.LimitSwing = x;
                    joint.LimitSwing.SetBase(y);

                    MarkAsModified();
                };
                limitSwingGUI.OnConfirmed += ConfirmModify;
            }

            Layout.AddElement(driveFoldout);
            driveLayout = Layout.AddLayoutX();
            {
                driveLayout.AddSpace(10);
                GUILayoutY driveContentsLayout = driveLayout.AddLayoutY();

                for (int i = 0; i < (int)D6JointDriveType.Count; i++)
                {
                    D6JointDriveType type = (D6JointDriveType)i;

                    drivesGUI[i]              = new D6JointDriveGUI(joint.GetDrive(type), driveContentsLayout);
                    drivesGUI[i].OnChanged   += x => { joint.SetDrive(type, x); MarkAsModified(); };
                    drivesGUI[i].OnConfirmed += ConfirmModify;
                }

                driveContentsLayout.AddElement(drivePositionField);
                driveContentsLayout.AddElement(driveRotationField);
                driveContentsLayout.AddElement(driveLinVelocityField);
                driveContentsLayout.AddElement(driveAngVelocityField);
            }

            linearLimitLayout.Active = Persistent.GetBool("linearLimit_Expanded");
            twistLimitLayout.Active  = Persistent.GetBool("twistLimit_Expanded");
            swingLimitLayout.Active  = Persistent.GetBool("swingLimit_Expanded");
            driveLayout.Active       = Persistent.GetBool("drive_Expanded");

            base.BuildGUI(joint, true);
        }
コード例 #11
0
        /// <summary>
        /// Updates the contents of the details panel according to the currently selected element.
        /// </summary>
        private void RefreshDetailsPanel()
        {
            detailsArea.Layout.Clear();

            if (sSelectedElementIdx != -1)
            {
                GUILayoutX paddingX = detailsArea.Layout.AddLayoutX();
                paddingX.AddSpace(5);
                GUILayoutY paddingY = paddingX.AddLayoutY();
                paddingX.AddSpace(5);

                paddingY.AddSpace(5);
                GUILayoutY mainLayout = paddingY.AddLayoutY();
                paddingY.AddSpace(5);

                ConsoleEntryData entry = filteredEntries[sSelectedElementIdx];

                LocString message      = new LocEdString(entry.message);
                GUILabel  messageLabel = new GUILabel(message, EditorStyles.MultiLineLabel, GUIOption.FlexibleHeight());
                mainLayout.AddElement(messageLabel);
                mainLayout.AddSpace(10);

                if (entry.callstack != null)
                {
                    foreach (var call in entry.callstack)
                    {
                        string fileName = Path.GetFileName(call.file);

                        string callMessage;
                        if (string.IsNullOrEmpty(call.method))
                        {
                            callMessage = "\tin " + fileName + ":" + call.line;
                        }
                        else
                        {
                            callMessage = "\t" + call.method + " in " + fileName + ":" + call.line;
                        }

                        GUIButton callBtn = new GUIButton(new LocEdString(callMessage));
                        mainLayout.AddElement(callBtn);

                        CallStackEntry hoistedCall = call;
                        callBtn.OnClick += () =>
                        {
                            CodeEditor.OpenFile(hoistedCall.file, hoistedCall.line);
                        };
                    }
                }

                mainLayout.AddFlexibleSpace();
            }
            else
            {
                GUILayoutX centerX = detailsArea.Layout.AddLayoutX();
                centerX.AddFlexibleSpace();
                GUILayoutY centerY = centerX.AddLayoutY();
                centerX.AddFlexibleSpace();

                centerY.AddFlexibleSpace();
                GUILabel nothingSelectedLbl = new GUILabel(new LocEdString("(No entry selected)"));
                centerY.AddElement(nothingSelectedLbl);
                centerY.AddFlexibleSpace();
            }
        }
コード例 #12
0
ファイル: AboutBox.cs プロジェクト: xuebai5/BansheeEngine
        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"); };
        }
コード例 #13
0
        /// <inheritoc/>
        protected internal override void Initialize(int layoutIndex)
        {
            GUILayoutX boundsLayout = new GUILayoutX();

            centerField = new GUIVector3Field(new LocEdString("Center"), 50);
            sizeField   = new GUIVector3Field(new LocEdString("Size"), 50);

            layout.AddElement(layoutIndex, boundsLayout);

            boundsLayout.AddElement(new GUILabel(new LocEdString(title), GUIOption.FixedWidth(100)));

            GUILayoutY boundsContent = boundsLayout.AddLayoutY();

            boundsContent.AddElement(centerField);
            boundsContent.AddElement(sizeField);

            centerField.OnValueChanged += x =>
            {
                AABox   bounds = property.GetValue <AABox>();
                Vector3 min    = x - bounds.Size * 0.5f;
                Vector3 max    = x + bounds.Size * 0.5f;

                property.SetValue(new AABox(min, max));
                state |= InspectableState.ModifyInProgress;
            };
            centerField.OnConfirm += x =>
            {
                OnFieldValueConfirm();
                StartUndo("center." + x.ToString());
            };
            centerField.OnComponentFocusChanged += (focus, comp) =>
            {
                if (focus)
                {
                    StartUndo("center." + comp.ToString());
                }
                else
                {
                    OnFieldValueConfirm();
                }
            };

            sizeField.OnValueChanged += x =>
            {
                AABox   bounds = property.GetValue <AABox>();
                Vector3 min    = bounds.Center - x * 0.5f;
                Vector3 max    = bounds.Center + x * 0.5f;

                property.SetValue(new AABox(min, max));
                state |= InspectableState.ModifyInProgress;
            };
            sizeField.OnConfirm += x =>
            {
                OnFieldValueConfirm();
                StartUndo("size." + x.ToString());
            };
            sizeField.OnComponentFocusChanged += (focus, comp) =>
            {
                if (focus)
                {
                    StartUndo("size." + comp.ToString());
                }
                else
                {
                    OnFieldValueConfirm();
                }
            };
        }
コード例 #14
0
        /// <summary>
        /// Creates a new GUI layout of the specified type, with a texture background.
        /// </summary>
        /// <typeparam name="T">Type of layout to create.</typeparam>
        /// <param name="layout">Parent layout to add the layout to.</param>
        /// <param name="background">Texture to display on the background.</param>
        /// <param name="backgroundColor">Color to apply to the background texture.</param>
        /// <param name="padding">Optional padding to apply between element borders and content.</param>
        /// <returns>New GUI layout with background object.</returns>
        public static GUILayoutWithBackground Create <T>(GUILayout layout, SpriteTexture background, Color backgroundColor,
                                                         RectOffset padding = new RectOffset()) where T : GUILayout, new()
        {
            GUIPanel   mainPanel  = layout.AddPanel();
            GUILayoutX mainLayout = mainPanel.AddLayoutX();

            GUILayout contentLayout;

            if (padding.top > 0 || padding.bottom > 0)
            {
                GUILayoutY paddingVertLayout = mainLayout.AddLayoutY();

                if (padding.top > 0)
                {
                    paddingVertLayout.AddSpace(padding.top);
                }

                if (padding.left > 0 || padding.right > 0)
                {
                    GUILayoutX paddingHorzLayout = paddingVertLayout.AddLayoutX();

                    if (padding.left > 0)
                    {
                        paddingHorzLayout.AddSpace(padding.left);
                    }

                    contentLayout = new T();
                    paddingHorzLayout.AddElement(contentLayout);

                    if (padding.right > 0)
                    {
                        paddingHorzLayout.AddSpace(padding.right);
                    }
                }
                else
                {
                    contentLayout = new T();
                    paddingVertLayout.AddElement(contentLayout);
                }

                if (padding.bottom > 0)
                {
                    paddingVertLayout.AddSpace(padding.bottom);
                }
            }
            else
            {
                if (padding.left > 0 || padding.right > 0)
                {
                    GUILayoutX paddingHorzLayout = mainLayout.AddLayoutX();

                    if (padding.left > 0)
                    {
                        paddingHorzLayout.AddSpace(padding.left);
                    }

                    contentLayout = new T();
                    paddingHorzLayout.AddElement(contentLayout);

                    if (padding.right > 0)
                    {
                        paddingHorzLayout.AddSpace(padding.right);
                    }
                }
                else
                {
                    contentLayout = new T();
                    mainLayout.AddElement(contentLayout);
                }
            }

            GUIPanel   bgPanel   = mainPanel.AddPanel(1);
            GUITexture bgTexture = new GUITexture(Builtin.WhiteTexture);

            bgTexture.SetTint(backgroundColor);
            bgPanel.AddElement(bgTexture);

            return(new GUILayoutWithBackground(mainPanel, contentLayout));
        }
コード例 #15
0
        /// <summary>
        /// Creates GUI elements for fields specific to the hinge joint.
        /// </summary>
        protected void BuildGUI(HingeJoint joint)
        {
            enableLimitField.OnChanged += x =>
            {
                joint.EnableLimit = x;
                MarkAsModified();
                ConfirmModify();

                ToggleLimitFields(x);
            };

            enableDriveField.OnChanged += x =>
            {
                joint.EnableDrive = x;
                MarkAsModified();
                ConfirmModify();

                ToggleDriveFields(x);
            };

            speedField.OnChanged += x =>
            {
                HingeJointDriveData driveData = joint.Drive.Data;
                driveData.speed = x;
                joint.Drive     = new HingeJointDrive(driveData);

                MarkAsModified();
            };
            speedField.OnFocusLost += ConfirmModify;
            speedField.OnConfirmed += ConfirmModify;

            forceLimitField.OnChanged += x =>
            {
                HingeJointDriveData driveData = joint.Drive.Data;
                driveData.forceLimit = x;
                joint.Drive          = new HingeJointDrive(driveData);

                MarkAsModified();
            };
            forceLimitField.OnFocusLost += ConfirmModify;
            forceLimitField.OnConfirmed += ConfirmModify;

            gearRatioField.OnChanged += x =>
            {
                HingeJointDriveData driveData = joint.Drive.Data;
                driveData.gearRatio = x;
                joint.Drive         = new HingeJointDrive(driveData);

                MarkAsModified();
            };
            gearRatioField.OnFocusLost += ConfirmModify;
            gearRatioField.OnConfirmed += ConfirmModify;

            freeSpinField.OnChanged += x =>
            {
                HingeJointDriveData driveData = joint.Drive.Data;
                driveData.freeSpin = x;
                joint.Drive        = new HingeJointDrive(driveData);

                MarkAsModified();
                ConfirmModify();
            };

            Layout.AddElement(enableLimitField);
            limitLayout = Layout.AddLayoutX();
            {
                limitLayout.AddSpace(10);

                GUILayoutY limitContentsLayout = limitLayout.AddLayoutY();
                limitGUI            = new LimitAngularRangeGUI(joint.Limit, limitContentsLayout, Persistent);
                limitGUI.OnChanged += (x, y) =>
                {
                    joint.Limit = new LimitAngularRange(x, y);

                    MarkAsModified();
                };
                limitGUI.OnConfirmed += ConfirmModify;
            }

            Layout.AddElement(enableDriveField);
            driveLayout = Layout.AddLayoutX();
            {
                driveLayout.AddSpace(10);

                GUILayoutY driveContentsLayout = driveLayout.AddLayoutY();
                driveContentsLayout.AddElement(speedField);
                driveContentsLayout.AddElement(forceLimitField);
                driveContentsLayout.AddElement(gearRatioField);
                driveContentsLayout.AddElement(freeSpinField);
            }

            ToggleLimitFields(joint.EnableLimit);
            ToggleDriveFields(joint.EnableDrive);

            base.BuildGUI(joint, true);
        }
コード例 #16
0
        /// <summary>
        /// Recreates all the GUI elements used by this inspector.
        /// </summary>
        private void BuildGUI()
        {
            Layout.Clear();

            Animation animation = InspectedObject as Animation;

            if (animation == null)
            {
                return;
            }

            animationClipField.OnChanged += x =>
            {
                AnimationClip clip = Resources.Load <AnimationClip>(x);

                animation.DefaultClip = clip;
                MarkAsModified();
                ConfirmModify();
            };

            wrapModeField.OnSelectionChanged += x =>
            {
                animation.WrapMode = (AnimWrapMode)x;
                MarkAsModified();
                ConfirmModify();
            };

            speedField.OnChanged   += x => { animation.Speed = x; MarkAsModified(); };
            speedField.OnConfirmed += ConfirmModify;
            speedField.OnFocusLost += ConfirmModify;

            cullingField.OnChanged        += x => { animation.Cull = x; MarkAsModified(); ConfirmModify(); };
            overrideBoundsField.OnChanged += x => { animation.UseBounds = x; MarkAsModified(); ConfirmModify(); };
            centerField.OnChanged         += x =>
            {
                AABox   bounds = animation.Bounds;
                Vector3 min    = x - bounds.Size * 0.5f;
                Vector3 max    = x + bounds.Size * 0.5f;

                animation.Bounds = new AABox(min, max);
                MarkAsModified();
            };
            centerField.OnConfirmed += ConfirmModify;
            centerField.OnFocusLost += ConfirmModify;

            sizeField.OnChanged += x =>
            {
                AABox   bounds = animation.Bounds;
                Vector3 min    = bounds.Center - x * 0.5f;
                Vector3 max    = bounds.Center + x * 0.5f;

                animation.Bounds = new AABox(min, max);
                MarkAsModified();
            };
            sizeField.OnConfirmed += ConfirmModify;
            sizeField.OnFocusLost += ConfirmModify;

            Layout.AddElement(animationClipField);
            Layout.AddElement(wrapModeField);
            Layout.AddElement(speedField);
            Layout.AddElement(cullingField);
            Layout.AddElement(overrideBoundsField);

            GUILayoutX boundsLayout = Layout.AddLayoutX();

            boundsLayout.AddElement(new GUILabel(new LocEdString("Bounds"), GUIOption.FixedWidth(100)));

            GUILayoutY boundsContent = boundsLayout.AddLayoutY();

            boundsContent.AddElement(centerField);
            boundsContent.AddElement(sizeField);
        }
コード例 #17
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();
        }
コード例 #18
0
        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();
        }
コード例 #19
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"); };
        }