public ScreenButton(Type type)
            {
                Type             = type;
                BackgroundColour = OsuColour.Gray(0.2f);
                Action           = () => RequestSelection?.Invoke(type);

                RelativeSizeAxes = Axes.X;
            }
Exemple #2
0
            public ScreenButton(Type type, Key?shortcutKey = null)
            {
                this.shortcutKey = shortcutKey;

                Type = type;

                BackgroundColour = OsuColour.Gray(0.2f);
                Action           = () => RequestSelection?.Invoke(type);

                RelativeSizeAxes = Axes.X;

                if (shortcutKey != null)
                {
                    Add(new Container
                    {
                        Anchor       = Anchor.CentreLeft,
                        Origin       = Anchor.CentreLeft,
                        Size         = new Vector2(24),
                        Margin       = new MarginPadding(5),
                        Masking      = true,
                        CornerRadius = 4,
                        Alpha        = 0.5f,
                        Blending     = BlendingParameters.Additive,
                        Children     = new Drawable[]
                        {
                            new Box
                            {
                                Colour           = OsuColour.Gray(0.1f),
                                RelativeSizeAxes = Axes.Both,
                            },
                            new OsuSpriteText
                            {
                                Font   = OsuFont.Default.With(size: 24),
                                Y      = -2,
                                Anchor = Anchor.Centre,
                                Origin = Anchor.Centre,
                                Text   = shortcutKey.ToString(),
                            }
                        }
                    });
                }
            }