예제 #1
0
        private static ISayConfig getDefaultConfig()
        {
            AGSSayConfig config = new AGSSayConfig();

            config.Border = AGSBorders.Gradient(AGSGame.Resolver.Container.Resolve <IGLUtils>(), new FourCorners <Color>(Colors.DarkOliveGreen,
                                                                                                                         Colors.LightGreen, Colors.LightGreen, Colors.DarkOliveGreen), 3f, true);
            config.TextConfig = new AGSTextConfig(autoFit: AutoFit.TextShouldWrapAndLabelShouldFitHeight
                                                  , paddingLeft: 8, paddingTop: 8, paddingBottom: 8, paddingRight: 8);
            config.LabelSize = new SizeF(AGSGame.Game.Settings.VirtualResolution.Width * 3 / 4f,
                                         AGSGame.Game.Settings.VirtualResolution.Height * 3 / 4f);
            config.BackgroundColor = Colors.Black;
            return(config);
        }
예제 #2
0
        private static ISayConfig getDefaultConfig()
        {
            AGSSayConfig config = new AGSSayConfig();

            config.Border = AGSBorders.Gradient(AGSGame.Resolver.Container.Resolve <IGLUtils>(), new FourCorners <Color>(Colors.DarkOliveGreen,
                                                                                                                         Colors.LightGreen, Colors.LightGreen, Colors.DarkOliveGreen), 3f, true);
            config.TextConfig = new AGSTextConfig(autoFit: AutoFit.TextShouldWrapAndLabelShouldFitHeight, alignment: Alignment.TopCenter
                                                  , paddingLeft: 30, paddingTop: 30, paddingBottom: 30, paddingRight: 30);
            var screenWidth  = AGSGame.Game.Settings.VirtualResolution.Width;
            var screenHeight = AGSGame.Game.Settings.VirtualResolution.Height;

            if (RenderLayer.IndependentResolution != null)
            {
                screenWidth  = RenderLayer.IndependentResolution.Value.Width;
                screenHeight = RenderLayer.IndependentResolution.Value.Height;
            }
            config.LabelSize       = new SizeF(screenWidth * 3 / 4f, screenHeight * 3 / 4f);
            config.BackgroundColor = Colors.Black;
            return(config);
        }
예제 #3
0
        public static async Task <bool> YesNoAsync(string text, string yes = "Yes", string no = "No")
        {
            var        factory = AGSGame.Game.Factory;
            IAnimation idle    = new AGSSingleFrameAnimation(new EmptyImage(ButtonWidth, ButtonHeight), factory.Graphics);

            idle.Sprite.Tint = Colors.Black;
            IAnimation hovered = new AGSSingleFrameAnimation(new EmptyImage(ButtonWidth, ButtonHeight), factory.Graphics);

            hovered.Sprite.Tint = Colors.Yellow;
            IAnimation pushed = new AGSSingleFrameAnimation(new EmptyImage(ButtonWidth, ButtonHeight), factory.Graphics);

            pushed.Sprite.Tint = Colors.DarkSlateBlue;
            var border = AGSBorders.Gradient(AGSGame.Resolver.Container.Resolve <IGLUtils>(), new FourCorners <Color>(Colors.DarkOliveGreen,
                                                                                                                      Colors.LightGreen, Colors.LightGreen, Colors.DarkOliveGreen), 3f, true);

            IButton yesButton = factory.UI.GetButton("Dialog Yes Button", idle, hovered, pushed, 0f, 0f, null, yes, ButtonConfig, false);
            IButton noButton  = factory.UI.GetButton("Dialog No Button", idle, hovered, pushed, 0f, 0f, null, no, ButtonConfig, false);

            yesButton.Border = border;
            noButton.Border  = border;
            return(await DisplayAsync(text, yesButton, noButton) == yesButton);
        }
예제 #4
0
        private void selectObject(ITreeStringNode node)
        {
            var obj = node.Properties.Entities.GetValue(Fields.Entity);

            _inspector.Inspector.Show(obj);
            var animation        = obj.GetComponent <IAnimationComponent>();
            var visibleComponent = obj.GetComponent <IVisibleComponent>();
            var image            = obj.GetComponent <IImageComponent>();

            if (animation != null)
            {
                _lastSelectedObject = animation;
                IBorderStyle border = null;
                border            = animation.Border;
                _lastObjectBorder = border;
                IBorderStyle hoverBorder = AGSBorders.Gradient(new FourCorners <Color>(Colors.Yellow, Colors.Yellow.WithAlpha(150),
                                                                                       Colors.Yellow.WithAlpha(150), Colors.Yellow), 1, true);
                if (border == null)
                {
                    animation.Border = hoverBorder;
                }
                else
                {
                    animation.Border = AGSBorders.Multiple(border, hoverBorder);
                }
            }
            if (visibleComponent != null)
            {
                _lastMaskVisible         = visibleComponent.Visible;
                _lastSelectedMaskVisible = visibleComponent;
                visibleComponent.Visible = true;
            }
            if (image != null && image.Opacity == 0)
            {
                _lastOpacity           = image.Opacity;
                _lastSelectedMaskImage = image;
                image.Opacity          = 100;
            }
        }