Пример #1
0
 public IncompatibilityDisplayingModPanel(ModState modState)
     : base(modState)
 {
 }
Пример #2
0
 protected override ModPanel CreateModPanel(ModState modState) => new IncompatibilityDisplayingModPanel(modState);
Пример #3
0
        public ModPanel(ModState modState)
        {
            this.modState = modState;

            RelativeSizeAxes = Axes.X;
            Height           = 42;

            // all below properties are applied to `Content` rather than the `ModPanel` in its entirety
            // to allow external components to set these properties on the panel without affecting
            // its "internal" appearance.
            Content.Masking         = true;
            Content.CornerRadius    = CORNER_RADIUS;
            Content.BorderThickness = 2;
            Shear = new Vector2(ShearedOverlayContainer.SHEAR, 0);

            Children = new Drawable[]
            {
                Background = new Box
                {
                    RelativeSizeAxes = Axes.Both
                },
                SwitchContainer = new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    Child            = new ModSwitchSmall(Mod)
                    {
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Active = { BindTarget = Active },
                        Shear  = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
                        Scale  = new Vector2(HEIGHT / ModSwitchSmall.DEFAULT_SIZE)
                    }
                },
                MainContentContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Child            = new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Masking          = true,
                        CornerRadius     = CORNER_RADIUS,
                        Children         = new Drawable[]
                        {
                            TextBackground = new Box
                            {
                                RelativeSizeAxes = Axes.Both
                            },
                            TextFlow = new FillFlowContainer
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Horizontal = 17.5f,
                                    Vertical   = 4
                                },
                                Direction = FillDirection.Vertical,
                                Children  = new[]
                                {
                                    new OsuSpriteText
                                    {
                                        Text   = Mod.Name,
                                        Font   = OsuFont.TorusAlternate.With(size: 18, weight: FontWeight.SemiBold),
                                        Shear  = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
                                        Margin = new MarginPadding
                                        {
                                            Left = -18 * ShearedOverlayContainer.SHEAR
                                        }
                                    },
                                    new OsuSpriteText
                                    {
                                        Text             = Mod.Description,
                                        Font             = OsuFont.Default.With(size: 12),
                                        RelativeSizeAxes = Axes.X,
                                        Truncate         = true,
                                        Shear            = new Vector2(-ShearedOverlayContainer.SHEAR, 0)
                                    }
                                }
                            }
                        }
                    }
                }
            };

            Action = Active.Toggle;
        }