Exemplo n.º 1
0
 protected override Drawable CreateLayout() => new FillFlowContainer
 {
     AutoSizeAxes = Axes.Both,
     Direction    = FillDirection.Horizontal,
     Spacing      = new Vector2(5, 0),
     Margin       = new MarginPadding
     {
         Horizontal = 10,
         Vertical   = 3,
     },
     Anchor   = Anchor.Centre,
     Origin   = Anchor.Centre,
     Children = new Drawable[]
     {
         new CircularContainer
         {
             Anchor  = Anchor.CentreLeft,
             Origin  = Anchor.CentreLeft,
             Masking = true,
             Width   = 4,
             Height  = 13,
             Child   = new Box
             {
                 RelativeSizeAxes = Axes.Both,
                 Colour           = string.IsNullOrEmpty(User.Colour) ? Color4Extensions.FromHex("0087ca") : Color4Extensions.FromHex(User.Colour)
             }
         },
         CreateUsername().With(u =>
         {
             u.Anchor = Anchor.CentreLeft;
             u.Origin = Anchor.CentreLeft;
             u.Font   = OsuFont.GetFont(size: 13, weight: FontWeight.Bold);
         })
     }
 };
Exemplo n.º 2
0
        public ModSelectOverlay()
        {
            Waves.FirstWaveColour  = Color4Extensions.FromHex(@"19b0e2");
            Waves.SecondWaveColour = Color4Extensions.FromHex(@"2280a2");
            Waves.ThirdWaveColour  = Color4Extensions.FromHex(@"005774");
            Waves.FourthWaveColour = Color4Extensions.FromHex(@"003a4e");

            RelativeSizeAxes = Axes.Both;

            Padding = new MarginPadding {
                Horizontal = -OsuScreen.HORIZONTAL_OVERFLOW_PADDING
            };

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = new Color4(36, 50, 68, 255)
                        },
                        new Triangles
                        {
                            TriangleScale    = 5,
                            RelativeSizeAxes = Axes.Both,
                            ColourLight      = new Color4(53, 66, 82, 255),
                            ColourDark       = new Color4(41, 54, 70, 255),
                        },
                    },
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    RowDimensions    = new[]
                    {
                        new Dimension(GridSizeMode.Absolute, 90),
                        new Dimension(GridSizeMode.Distributed),
                        new Dimension(GridSizeMode.AutoSize),
                    },
                    Content = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = OsuColour.Gray(10).Opacity(100),
                                    },
                                    new FillFlowContainer
                                    {
                                        Origin           = Anchor.Centre,
                                        Anchor           = Anchor.Centre,
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical,
                                        Width            = content_width,
                                        Padding          = new MarginPadding {
                                            Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                        },
                                        Children = new Drawable[]
                                        {
                                            new OsuSpriteText
                                            {
                                                Text   = @"Gameplay Mods",
                                                Font   = OsuFont.GetFont(size: 22, weight: FontWeight.Bold),
                                                Shadow = true,
                                                Margin = new MarginPadding
                                                {
                                                    Bottom = 4,
                                                },
                                            },
                                            new OsuTextFlowContainer(text =>
                                            {
                                                text.Font   = text.Font.With(size: 18);
                                                text.Shadow = true;
                                            })
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                AutoSizeAxes     = Axes.Y,
                                                Text             = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.\nOthers are just for fun.",
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        new Drawable[]
                        {
                            // Body
                            new OsuScrollContainer
                            {
                                ScrollbarVisible = false,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Vertical   = 10,
                                    Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                },
                                Child = ModSectionsContainer = new FillFlowContainer <ModSection>
                                {
                                    Origin           = Anchor.TopCentre,
                                    Anchor           = Anchor.TopCentre,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Spacing          = new Vector2(0f, 10f),
                                    Width            = content_width,
                                    LayoutDuration   = 200,
                                    LayoutEasing     = Easing.OutQuint,
                                    Children         = new ModSection[]
                                    {
                                        new DifficultyReductionSection {
                                            Action = modButtonPressed
                                        },
                                        new DifficultyIncreaseSection {
                                            Action = modButtonPressed
                                        },
                                        new AutomationSection {
                                            Action = modButtonPressed
                                        },
                                        new ConversionSection {
                                            Action = modButtonPressed
                                        },
                                        new FunSection {
                                            Action = modButtonPressed
                                        },
                                    }
                                },
                            },
                        },
                        new Drawable[]
                        {
                            // Footer
                            new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Origin           = Anchor.TopCentre,
                                Anchor           = Anchor.TopCentre,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = new Color4(172, 20, 116, 255),
                                        Alpha            = 0.5f,
                                    },
                                    footerContainer = new FillFlowContainer
                                    {
                                        Origin           = Anchor.BottomCentre,
                                        Anchor           = Anchor.BottomCentre,
                                        AutoSizeAxes     = Axes.Y,
                                        RelativeSizeAxes = Axes.X,
                                        Width            = content_width,
                                        Spacing          = new Vector2(footer_button_spacing, footer_button_spacing / 2),
                                        LayoutDuration   = 100,
                                        LayoutEasing     = Easing.OutQuint,
                                        Padding          = new MarginPadding
                                        {
                                            Vertical   = 15,
                                            Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                        },
                                        Children = new Drawable[]
                                        {
                                            DeselectAllButton = new TriangleButton
                                            {
                                                Width  = 180,
                                                Text   = "Deselect All",
                                                Action = DeselectAll,
                                                Origin = Anchor.CentreLeft,
                                                Anchor = Anchor.CentreLeft,
                                            },
                                            CustomiseButton = new TriangleButton
                                            {
                                                Width   = 180,
                                                Text    = "Customisation",
                                                Action  = () => ModSettingsContainer.Alpha = ModSettingsContainer.Alpha == 1 ? 0 : 1,
                                                Enabled = { Value = false },
                                                Origin  = Anchor.CentreLeft,
                                                Anchor  = Anchor.CentreLeft,
                                            },
                                            CloseButton = new TriangleButton
                                            {
                                                Width  = 180,
                                                Text   = "Close",
                                                Action = Hide,
                                                Origin = Anchor.CentreLeft,
                                                Anchor = Anchor.CentreLeft,
                                            },
                                            new FillFlowContainer
                                            {
                                                AutoSizeAxes = Axes.Both,
                                                Spacing      = new Vector2(footer_button_spacing / 2, 0),
                                                Origin       = Anchor.CentreLeft,
                                                Anchor       = Anchor.CentreLeft,
                                                Children     = new Drawable[]
                                                {
                                                    new OsuSpriteText
                                                    {
                                                        Text   = @"Score Multiplier:",
                                                        Font   = OsuFont.GetFont(size: 30),
                                                        Origin = Anchor.CentreLeft,
                                                        Anchor = Anchor.CentreLeft,
                                                    },
                                                    MultiplierLabel = new OsuSpriteText
                                                    {
                                                        Font   = OsuFont.GetFont(size: 30, weight: FontWeight.Bold),
                                                        Origin = Anchor.CentreLeft,
                                                        Anchor = Anchor.CentreLeft,
                                                        Width  = 70, // make width fixed so reflow doesn't occur when multiplier number changes.
                                                    },
                                                },
                                            },
                                        }
                                    }
                                },
                            }
                        },
                    },
                },
                ModSettingsContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.BottomRight,
                    Origin           = Anchor.BottomRight,
                    Width            = 0.25f,
                    Alpha            = 0,
                    X        = -100,
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = new Color4(0, 0, 0, 192)
                        },
                        new OsuScrollContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Child            = ModSettingsContent = new FillFlowContainer <ModControlSection>
                            {
                                Anchor           = Anchor.TopCentre,
                                Origin           = Anchor.TopCentre,
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Spacing          = new Vector2(0f, 10f),
                                Padding          = new MarginPadding(20),
                            }
                        }
                    }
                }
            };
        }
Exemplo n.º 3
0
        private void load(IAPIProvider api, OsuColour colour, ScoreManager scoreManager)
        {
            var user = score.User;

            statisticsLabels = GetStatistics(score).Select(s => new ScoreComponentLabel(s)).ToList();

            ClickableAvatar innerAvatar;

            Children = new Drawable[]
            {
                new RankLabel(rank)
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = rank_width,
                },
                content = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = rank_width,
                    },
                    Children = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            CornerRadius     = corner_radius,
                            Masking          = true,
                            Children         = new[]
                            {
                                background = new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = user.Id == api.LocalUser.Value.Id && allowHighlight ? colour.Green : Color4.Black,
                                    Alpha            = background_alpha,
                                },
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding(edge_margin),
                            Children         = new[]
                            {
                                avatar          = new DelayedLoadWrapper(
                                    innerAvatar = new ClickableAvatar(user)
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    CornerRadius     = corner_radius,
                                    Masking          = true,
                                    EdgeEffect       = new EdgeEffectParameters
                                    {
                                        Type   = EdgeEffectType.Shadow,
                                        Radius = 1,
                                        Colour = Color4.Black.Opacity(0.2f),
                                    },
                                })
                                {
                                    RelativeSizeAxes = Axes.None,
                                    Size             = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2),
                                },
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Y,
                                    AutoSizeAxes     = Axes.X,
                                    Position         = new Vector2(HEIGHT - edge_margin, 0f),
                                    Children         = new Drawable[]
                                    {
                                        nameLabel = new OsuSpriteText
                                        {
                                            Text = user.Username,
                                            Font = OsuFont.GetFont(size: 23, weight: FontWeight.Bold, italics: true)
                                        },
                                        new FillFlowContainer
                                        {
                                            Origin       = Anchor.BottomLeft,
                                            Anchor       = Anchor.BottomLeft,
                                            AutoSizeAxes = Axes.Both,
                                            Direction    = FillDirection.Horizontal,
                                            Spacing      = new Vector2(10f, 0f),
                                            Children     = new Drawable[]
                                            {
                                                flagBadgeContainer = new Container
                                                {
                                                    Origin   = Anchor.BottomLeft,
                                                    Anchor   = Anchor.BottomLeft,
                                                    Size     = new Vector2(87f, 20f),
                                                    Masking  = true,
                                                    Children = new Drawable[]
                                                    {
                                                        new UpdateableFlag(user.Country)
                                                        {
                                                            Width            = 30,
                                                            RelativeSizeAxes = Axes.Y,
                                                        },
                                                    },
                                                },
                                                new FillFlowContainer
                                                {
                                                    Origin       = Anchor.BottomLeft,
                                                    Anchor       = Anchor.BottomLeft,
                                                    AutoSizeAxes = Axes.Both,
                                                    Direction    = FillDirection.Horizontal,
                                                    Spacing      = new Vector2(10f, 0f),
                                                    Margin       = new MarginPadding {
                                                        Left = edge_margin
                                                    },
                                                    Children = statisticsLabels
                                                },
                                            },
                                        },
                                    },
                                },
                                new FillFlowContainer
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Anchor       = Anchor.TopRight,
                                    Origin       = Anchor.TopRight,
                                    Direction    = FillDirection.Horizontal,
                                    Spacing      = new Vector2(5f, 0f),
                                    Children     = new Drawable[]
                                    {
                                        scoreLabel = new GlowingSpriteText
                                        {
                                            TextColour = Color4.White,
                                            GlowColour = Color4Extensions.FromHex(@"83ccfa"),
                                            Current    = scoreManager.GetBindableTotalScoreString(score),
                                            Font       = OsuFont.Numeric.With(size: 23),
                                        },
                                        RankContainer = new Container
                                        {
                                            Size     = new Vector2(40f, 20f),
                                            Children = new[]
                                            {
                                                scoreRank = new UpdateableRank(score.Rank)
                                                {
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Size   = new Vector2(40f)
                                                },
                                            },
                                        },
                                    },
                                },
                                modsContainer = new FillFlowContainer <ModIcon>
                                {
                                    Anchor             = Anchor.BottomRight,
                                    Origin             = Anchor.BottomRight,
                                    AutoSizeAxes       = Axes.Both,
                                    Direction          = FillDirection.Horizontal,
                                    Spacing            = new Vector2(1),
                                    ChildrenEnumerable = score.Mods.Select(mod => new ModIcon(mod)
                                    {
                                        Scale = new Vector2(0.375f)
                                    })
                                },
                            },
                        },
                    },
                },
            };

            innerAvatar.OnLoadComplete += d => d.FadeInFromZero(200);
        }
Exemplo n.º 4
0
        private void load()
        {
            const int line_offset   = 80;
            const int circle_offset = 250;

            Children = new Drawable[]
            {
                lines = new Container <Box>
                {
                    Anchor       = Anchor.Centre,
                    Origin       = Anchor.Centre,
                    AutoSizeAxes = Axes.Both,
                    Children     = new[]
                    {
                        lineTopLeft = new Box
                        {
                            Origin   = Anchor.CentreLeft,
                            Anchor   = Anchor.Centre,
                            Position = new Vector2(-line_offset, -line_offset),
                            Rotation = 45,
                            Colour   = Color4.White.Opacity(180),
                        },
                        lineTopRight = new Box
                        {
                            Origin   = Anchor.CentreRight,
                            Anchor   = Anchor.Centre,
                            Position = new Vector2(line_offset, -line_offset),
                            Rotation = -45,
                            Colour   = Color4.White.Opacity(80),
                        },
                        lineBottomLeft = new Box
                        {
                            Origin   = Anchor.CentreLeft,
                            Anchor   = Anchor.Centre,
                            Position = new Vector2(-line_offset, line_offset),
                            Rotation = -45,
                            Colour   = Color4.White.Opacity(230),
                        },
                        lineBottomRight = new Box
                        {
                            Origin   = Anchor.CentreRight,
                            Anchor   = Anchor.Centre,
                            Position = new Vector2(line_offset, line_offset),
                            Rotation = 45,
                            Colour   = Color4.White.Opacity(130),
                        },
                    }
                },
                bigRing     = new Ring(Color4Extensions.FromHex(@"B6C5E9"), 0.85f),
                mediumRing  = new Ring(Color4.White.Opacity(130), 0.7f),
                smallRing   = new Ring(Color4.White, 0.6f),
                welcomeText = new OsuSpriteText
                {
                    Anchor  = Anchor.Centre,
                    Origin  = Anchor.Centre,
                    Text    = "welcome",
                    Padding = new MarginPadding {
                        Bottom = 10
                    },
                    Font    = OsuFont.GetFont(weight: FontWeight.Light, size: 42),
                    Alpha   = 0,
                    Spacing = new Vector2(5),
                },
                new CircularContainer
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Size     = new Vector2(logo_size),
                    Masking  = true,
                    Children = new Drawable[]
                    {
                        backgroundFill = new Box
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                            RelativeSizeAxes = Axes.Both,
                            Height           = 0,
                            Colour           = Color4Extensions.FromHex(@"C6D8FF").Opacity(160),
                        },
                        foregroundFill = new Box
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                            Size             = Vector2.Zero,
                            RelativeSizeAxes = Axes.Both,
                            Width            = 0,
                            Colour           = Color4.White,
                        },
                    }
                },
                purpleCircle = new Circle
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.TopCentre,
                    Position = new Vector2(0, circle_offset),
                    Colour   = Color4Extensions.FromHex(@"AA92FF"),
                },
                blueCircle = new Circle
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.CentreRight,
                    Position = new Vector2(-circle_offset, 0),
                    Colour   = Color4Extensions.FromHex(@"8FE5FE"),
                },
                yellowCircle = new Circle
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.BottomCentre,
                    Position = new Vector2(0, -circle_offset),
                    Colour   = Color4Extensions.FromHex(@"FFD64C"),
                },
                pinkCircle = new Circle
                {
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.CentreLeft,
                    Position = new Vector2(circle_offset, 0),
                    Colour   = Color4Extensions.FromHex(@"e967a1"),
                },
            };

            foreach (var line in lines)
            {
                line.Size  = new Vector2(105, 1.5f);
                line.Alpha = 0;
            }

            Scale = new Vector2(0.5f);
        }
 private void load()
 {
     InternalChild = new GridContainer
     {
         RelativeSizeAxes = Axes.Both,
         Content          = new[]
         {
             new Drawable[]
             {
                 new Container
                 {
                     RelativeSizeAxes = Axes.Both,
                     Masking          = true,
                     CornerExponent   = 2.5f,
                     CornerRadius     = 20,
                     EdgeEffect       = new EdgeEffectParameters
                     {
                         Colour = Color4.Black.Opacity(0.25f),
                         Type   = EdgeEffectType.Shadow,
                         Radius = 1,
                         Offset = new Vector2(0, 4)
                     },
                     Children = new Drawable[]
                     {
                         new Box
                         {
                             RelativeSizeAxes = Axes.Both,
                             Colour           = Color4Extensions.FromHex("444")
                         },
                         new UserCoverBackground
                         {
                             RelativeSizeAxes = Axes.Both,
                             User             = score.User,
                             Colour           = ColourInfo.GradientVertical(Color4.White.Opacity(0.5f), Color4Extensions.FromHex("#444").Opacity(0))
                         },
                         new FillFlowContainer
                         {
                             RelativeSizeAxes = Axes.Both,
                             Padding          = new MarginPadding(10),
                             Direction        = FillDirection.Vertical,
                             Spacing          = new Vector2(0, 10),
                             Children         = new Drawable[]
                             {
                                 new UpdateableAvatar(score.User)
                                 {
                                     Anchor         = Anchor.TopCentre,
                                     Origin         = Anchor.TopCentre,
                                     Size           = new Vector2(110),
                                     Masking        = true,
                                     CornerExponent = 2.5f,
                                     CornerRadius   = 20,
                                     EdgeEffect     = new EdgeEffectParameters
                                     {
                                         Colour = Color4.Black.Opacity(0.25f),
                                         Type   = EdgeEffectType.Shadow,
                                         Radius = 8,
                                         Offset = new Vector2(0, 4),
                                     }
                                 },
                                 new OsuSpriteText
                                 {
                                     Anchor = Anchor.TopCentre,
                                     Origin = Anchor.TopCentre,
                                     Text   = score.UserString,
                                     Font   = OsuFont.GetFont(size: 16, weight: FontWeight.SemiBold)
                                 },
                                 new FillFlowContainer
                                 {
                                     RelativeSizeAxes   = Axes.X,
                                     AutoSizeAxes       = Axes.Y,
                                     Direction          = FillDirection.Vertical,
                                     Spacing            = new Vector2(0, 5),
                                     ChildrenEnumerable = score.GetStatisticsForDisplay().Where(s => !s.Result.IsBonus()).Select(createStatistic)
                                 },
                                 new FillFlowContainer
                                 {
                                     RelativeSizeAxes = Axes.X,
                                     AutoSizeAxes     = Axes.Y,
                                     Margin           = new MarginPadding {
                                         Top = 10
                                     },
                                     Direction = FillDirection.Vertical,
                                     Spacing   = new Vector2(0, 5),
                                     Children  = new[]
                                     {
                                         createStatistic("Max Combo", $"x{score.MaxCombo}"),
                                         createStatistic("Accuracy", $"{score.Accuracy.FormatAccuracy()}"),
                                     }
                                 },
                                 new ModDisplay
                                 {
                                     Anchor              = Anchor.TopCentre,
                                     Origin              = Anchor.TopCentre,
                                     AutoSizeAxes        = Axes.Both,
                                     ExpansionMode       = ExpansionMode.AlwaysExpanded,
                                     DisplayUnrankedText = false,
                                     Current             = { Value = score.Mods },
                                     Scale = new Vector2(0.5f),
                                 }
                             }
                         }
                     }
                 },
             },
             new Drawable[]
             {
                 new Container
                 {
                     RelativeSizeAxes = Axes.Both,
                     Padding          = new MarginPadding {
                         Vertical = 5
                     },
                     Child = new GridContainer
                     {
                         RelativeSizeAxes = Axes.Both,
                         Content          = new[]
                         {
                             new Drawable[]
                             {
                                 new OsuSpriteText
                                 {
                                     Anchor  = Anchor.Centre,
                                     Origin  = Anchor.Centre,
                                     Current = scoreManager.GetBindableTotalScoreString(score),
                                     Font    = OsuFont.GetFont(size: 20, weight: FontWeight.Medium, fixedWidth: true),
                                     Spacing = new Vector2(-1, 0)
                                 },
                             },
                             new Drawable[]
                             {
                                 new Container
                                 {
                                     RelativeSizeAxes = Axes.Both,
                                     Padding          = new MarginPadding {
                                         Top = 2
                                     },
                                     Child = new DrawableRank(score.Rank)
                                     {
                                         Anchor = Anchor.Centre,
                                         Origin = Anchor.Centre,
                                     }
                                 }
                             },
                         },
                         RowDimensions = new[]
                         {
                             new Dimension(GridSizeMode.AutoSize),
                         }
                     }
                 }
             },
         },
         RowDimensions = new[]
         {
             new Dimension(),
             new Dimension(GridSizeMode.Absolute, 45),
         }
     };
 }
Exemplo n.º 6
0
        private ColourInfo getRankNameColour()
        {
            switch (rank)
            {
            case ScoreRank.XH:
            case ScoreRank.SH:
                return(ColourInfo.GradientVertical(Color4.White, Color4Extensions.FromHex("afdff0")));

            case ScoreRank.X:
            case ScoreRank.S:
                return(ColourInfo.GradientVertical(Color4Extensions.FromHex(@"ffe7a8"), Color4Extensions.FromHex(@"ffb800")));

            case ScoreRank.A:
                return(Color4Extensions.FromHex(@"275227"));

            case ScoreRank.B:
                return(Color4Extensions.FromHex(@"553a2b"));

            case ScoreRank.C:
                return(Color4Extensions.FromHex(@"473625"));

            default:
                return(Color4Extensions.FromHex(@"512525"));
            }
        }
Exemplo n.º 7
0
            private void load(OsuColour colours)
            {
                Container dimContent;

                InternalChildren = new Drawable[]
                {
                    dimContent = new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Children         = new Drawable[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = Color4Extensions.FromHex(@"28242d"),
                            },
                            new GridContainer
                            {
                                RelativeSizeAxes = Axes.Both,
                                RowDimensions    = new[]
                                {
                                    new Dimension(GridSizeMode.Distributed),
                                    new Dimension(GridSizeMode.AutoSize),
                                },
                                Content = new[]
                                {
                                    new Drawable[]
                                    {
                                        new OsuScrollContainer
                                        {
                                            Padding = new MarginPadding
                                            {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                                Vertical   = 10
                                            },
                                            RelativeSizeAxes = Axes.Both,
                                            Children         = new[]
                                            {
                                                new Container
                                                {
                                                    Padding = new MarginPadding {
                                                        Horizontal = SearchableListOverlay.WIDTH_PADDING
                                                    },
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Children         = new Drawable[]
                                                    {
                                                        new SectionContainer
                                                        {
                                                            Padding = new MarginPadding {
                                                                Right = field_padding / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Room name")
                                                                {
                                                                    Child = NameField = new SettingsTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                    },
                                                                },
                                                                new Section("Duration")
                                                                {
                                                                    Child = DurationField = new DurationDropdown
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Items            = new[]
                                                                        {
                                                                            TimeSpan.FromMinutes(30),
                                                                            TimeSpan.FromHours(1),
                                                                            TimeSpan.FromHours(2),
                                                                            TimeSpan.FromHours(4),
                                                                            TimeSpan.FromHours(8),
                                                                            TimeSpan.FromHours(12),
                                                                            //TimeSpan.FromHours(16),
                                                                            TimeSpan.FromHours(24),
                                                                            TimeSpan.FromDays(3),
                                                                            TimeSpan.FromDays(7)
                                                                        }
                                                                    }
                                                                },
                                                                new Section("Room visibility")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                                    {
                                                                        Enabled = { Value = false }
                                                                    },
                                                                },
                                                                new Section("Game type")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = new FillFlowContainer
                                                                    {
                                                                        AutoSizeAxes     = Axes.Y,
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Direction        = FillDirection.Vertical,
                                                                        Spacing          = new Vector2(7),
                                                                        Children         = new Drawable[]
                                                                        {
                                                                            TypePicker = new GameTypePicker
                                                                            {
                                                                                RelativeSizeAxes = Axes.X,
                                                                                Enabled          = { Value = false }
                                                                            },
                                                                            typeLabel = new OsuSpriteText
                                                                            {
                                                                                Font   = OsuFont.GetFont(size: 14),
                                                                                Colour = colours.Yellow
                                                                            },
                                                                        },
                                                                    },
                                                                },
                                                                new Section("Max participants")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = MaxParticipantsField = new SettingsNumberTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                                new Section("Password (optional)")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = new SettingsPasswordTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                            },
                                                        },
                                                        new SectionContainer
                                                        {
                                                            Anchor  = Anchor.TopRight,
                                                            Origin  = Anchor.TopRight,
                                                            Padding = new MarginPadding {
                                                                Left = field_padding / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Playlist")
                                                                {
                                                                    Child = new GridContainer
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Height           = 300,
                                                                        Content          = new[]
                                                                        {
                                                                            new Drawable[]
                                                                            {
                                                                                playlist = new DrawableRoomPlaylist(true, true)
                                                                                {
                                                                                    RelativeSizeAxes = Axes.Both
                                                                                }
                                                                            },
                                                                            new Drawable[]
                                                                            {
                                                                                new PurpleTriangleButton
                                                                                {
                                                                                    RelativeSizeAxes = Axes.X,
                                                                                    Height           = 40,
                                                                                    Text             = "Edit playlist",
                                                                                    Action           = () => EditPlaylist?.Invoke()
                                                                                }
                                                                            }
                                                                        },
                                                                        RowDimensions = new[]
                                                                        {
                                                                            new Dimension(),
                                                                            new Dimension(GridSizeMode.AutoSize),
                                                                        }
                                                                    }
                                                                },
                                                            },
                                                        },
                                                    },
                                                }
                                            },
                                        },
                                    },
                                    new Drawable[]
                                    {
                                        new Container
                                        {
                                            Anchor           = Anchor.BottomLeft,
                                            Origin           = Anchor.BottomLeft,
                                            Y                = 2,
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Children         = new Drawable[]
                                            {
                                                new Box
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Colour           = Color4Extensions.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
                                                },
                                                new FillFlowContainer
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Direction        = FillDirection.Vertical,
                                                    Spacing          = new Vector2(0, 20),
                                                    Margin           = new MarginPadding {
                                                        Vertical = 20
                                                    },
                                                    Padding = new MarginPadding {
                                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                                    },
                                                    Children = new Drawable[]
                                                    {
                                                        ApplyButton = new CreateRoomButton
                                                        {
                                                            Anchor  = Anchor.BottomCentre,
                                                            Origin  = Anchor.BottomCentre,
                                                            Size    = new Vector2(230, 55),
                                                            Enabled = { Value = false },
                                                            Action  = apply,
                                                        },
                                                        ErrorText = new OsuSpriteText
                                                        {
                                                            Anchor = Anchor.BottomCentre,
                                                            Origin = Anchor.BottomCentre,
                                                            Alpha  = 0,
                                                            Depth  = 1,
                                                            Colour = colours.RedDark
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                        }
                    },
                    loadingLayer = new LoadingLayer(dimContent)
                };

                TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true);
                RoomName.BindValueChanged(name => NameField.Text           = name.NewValue, true);
                Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
                Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true);
                Duration.BindValueChanged(duration => DurationField.Current.Value   = duration.NewValue, true);

                playlist.Items.BindTo(Playlist);
            }
Exemplo n.º 8
0
        private void load(BeatmapManager manager, SongSelect songSelect)
        {
            Header.Height = height;

            if (songSelect != null)
            {
                startRequested = b => songSelect.FinaliseSelection(b);
                if (songSelect.AllowEditing)
                {
                    editRequested = songSelect.Edit;
                }
            }

            if (manager != null)
            {
                hideRequested = manager.Hide;
            }

            Header.Children = new Drawable[]
            {
                background = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                },
                triangles = new Triangles
                {
                    TriangleScale    = 2,
                    RelativeSizeAxes = Axes.Both,
                    ColourLight      = Color4Extensions.FromHex(@"3a7285"),
                    ColourDark       = Color4Extensions.FromHex(@"123744")
                },
                new FillFlowContainer
                {
                    Padding      = new MarginPadding(5),
                    Direction    = FillDirection.Horizontal,
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.CentreLeft,
                    Origin       = Anchor.CentreLeft,
                    Children     = new Drawable[]
                    {
                        new DifficultyIcon(beatmap, shouldShowTooltip: false)
                        {
                            Scale = new Vector2(1.8f),
                        },
                        new FillFlowContainer
                        {
                            Padding = new MarginPadding {
                                Left = 5
                            },
                            Direction    = FillDirection.Vertical,
                            AutoSizeAxes = Axes.Both,
                            Children     = new Drawable[]
                            {
                                new FillFlowContainer
                                {
                                    Direction    = FillDirection.Horizontal,
                                    Spacing      = new Vector2(4, 0),
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new[]
                                    {
                                        new OsuSpriteText
                                        {
                                            Text   = beatmap.Version,
                                            Font   = OsuFont.GetFont(size: 20),
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft
                                        },
                                        new OsuSpriteText
                                        {
                                            Text   = "mapped by",
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft
                                        },
                                        new OsuSpriteText
                                        {
                                            Text   = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author.Username}",
                                            Font   = OsuFont.GetFont(italics: true),
                                            Anchor = Anchor.BottomLeft,
                                            Origin = Anchor.BottomLeft
                                        },
                                    }
                                },
                                new FillFlowContainer
                                {
                                    Direction    = FillDirection.Horizontal,
                                    Spacing      = new Vector2(4, 0),
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new Drawable[]
                                    {
                                        new TopLocalRank(beatmap)
                                        {
                                            Scale = new Vector2(0.8f),
                                            Size  = new Vector2(40, 20)
                                        },
                                        starCounter = new StarCounter
                                        {
                                            Scale = new Vector2(0.8f),
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };
        }
Exemplo n.º 9
0
 private void addCircleStep(ScoreInfo score) => AddStep("add panel", () =>
 {
     Children = new Drawable[]
     {
         new Container
         {
             Anchor   = Anchor.Centre,
             Origin   = Anchor.Centre,
             Size     = new Vector2(500, 700),
             Children = new Drawable[]
             {
                 new Box
                 {
                     RelativeSizeAxes = Axes.Both,
                     Colour           = ColourInfo.GradientVertical(Color4Extensions.FromHex("#555"), Color4Extensions.FromHex("#333"))
                 }
             }
         },
         new AccuracyCircle(score, true)
         {
             Anchor = Anchor.Centre,
             Origin = Anchor.Centre,
             Size   = new Vector2(230)
         }
     };
 });
Exemplo n.º 10
0
        public Multiplayer()
        {
            Anchor           = Anchor.Centre;
            Origin           = Anchor.Centre;
            RelativeSizeAxes = Axes.Both;
            Padding          = new MarginPadding {
                Horizontal = -HORIZONTAL_OVERFLOW_PADDING
            };

            var backgroundColour = Color4Extensions.FromHex(@"3e3a44");

            InternalChild = waves = new MultiplayerWaveContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = backgroundColour,
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Top = Header.HEIGHT
                        },
                        Children = new[]
                        {
                            header = new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                Height           = 400,
                                Children         = new[]
                                {
                                    headerBackground = new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Width            = 1.25f,
                                        Masking          = true,
                                        Children         = new Drawable[]
                                        {
                                            new HeaderBackgroundSprite
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                Height           = 400 // Keep a static height so the header doesn't change as it's resized between subscreens
                                            },
                                        }
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding {
                                            Bottom = -1
                                        },                                           // 1px padding to avoid a 1px gap due to masking
                                        Child = new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = ColourInfo.GradientVertical(backgroundColour.Opacity(0.5f), backgroundColour)
                                        },
                                    }
                                }
                            },
                            screenStack = new MultiplayerSubScreenStack {
                                RelativeSizeAxes = Axes.Both
                            }
                        }
                    },
                    new Header(screenStack),
                    createButton = new CreateRoomButton
                    {
                        Anchor = Anchor.TopRight,
                        Origin = Anchor.TopRight,
                        Action = createRoom
                    },
                    roomManager = new RoomManager()
                }
            };

            screenStack.Push(loungeSubScreen = new LoungeSubScreen());

            screenStack.ScreenPushed += screenPushed;
            screenStack.ScreenExited += screenExited;
        }
Exemplo n.º 11
0
        private void load()
        {
            InternalChild = new Container
            {
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                RelativeSizeAxes = Axes.Both,
                FillMode         = FillMode.Fit,
                Children         = new Drawable[]
                {
                    new CircularContainer
                    {
                        Anchor           = Anchor.Centre,
                        Origin           = Anchor.Centre,
                        RelativeSizeAxes = Axes.Both,
                        Size             = new Vector2(inner_portion),
                        Masking          = true,
                        BorderThickness  = line_thickness,
                        BorderColour     = Color4.White,
                        Child            = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = Color4Extensions.FromHex("#202624")
                        }
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Children         = new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding(1),
                                Child            = new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Masking          = true,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            Anchor           = Anchor.Centre,
                                            Origin           = Anchor.Centre,
                                            EdgeSmoothness   = new Vector2(1),
                                            RelativeSizeAxes = Axes.Y,
                                            Height           = 2, // We're rotating along a diagonal - we don't really care how big this is.
                                            Width            = line_thickness / 2,
                                            Rotation         = -rotation,
                                            Alpha            = 0.3f,
                                        },
                                        new Box
                                        {
                                            Anchor           = Anchor.Centre,
                                            Origin           = Anchor.Centre,
                                            EdgeSmoothness   = new Vector2(1),
                                            RelativeSizeAxes = Axes.Y,
                                            Height           = 2,                  // We're rotating along a diagonal - we don't really care how big this is.
                                            Width            = line_thickness / 2, // adjust for edgesmoothness
                                            Rotation         = rotation
                                        },
                                    }
                                },
                            },
                            new Box
                            {
                                Anchor         = Anchor.TopRight,
                                Origin         = Anchor.TopRight,
                                Width          = 10,
                                EdgeSmoothness = new Vector2(1),
                                Height         = line_thickness / 2, // adjust for edgesmoothness
                            },
                            new Box
                            {
                                Anchor         = Anchor.TopRight,
                                Origin         = Anchor.TopRight,
                                EdgeSmoothness = new Vector2(1),
                                Width          = line_thickness / 2, // adjust for edgesmoothness
                                Height         = 10,
                            }
                        }
                    },
                    bufferedGrid = new BufferedContainer
                    {
                        RelativeSizeAxes      = Axes.Both,
                        CacheDrawnFrameBuffer = true,
                        BackgroundColour      = Color4Extensions.FromHex("#202624").Opacity(0),
                        Child = pointGrid = new GridContainer
                        {
                            RelativeSizeAxes = Axes.Both
                        }
                    },
                }
            };

            Vector2 centre      = new Vector2(points_per_dimension) / 2;
            float   innerRadius = centre.X * inner_portion;

            Drawable[][] points = new Drawable[points_per_dimension][];

            for (int r = 0; r < points_per_dimension; r++)
            {
                points[r] = new Drawable[points_per_dimension];

                for (int c = 0; c < points_per_dimension; c++)
                {
                    HitPointType pointType = Vector2.Distance(new Vector2(c, r), centre) <= innerRadius
                        ? HitPointType.Hit
                        : HitPointType.Miss;

                    var point = new HitPoint(pointType, this)
                    {
                        BaseColour = pointType == HitPointType.Hit ? new Color4(102, 255, 204, 255) : new Color4(255, 102, 102, 255)
                    };

                    points[r][c] = point;
                }
            }

            pointGrid.Content = points;

            if (score.HitEvents == null || score.HitEvents.Count == 0)
            {
                return;
            }

            // Todo: This should probably not be done like this.
            float radius = OsuHitObject.OBJECT_RADIUS * (1.0f - 0.7f * (playableBeatmap.BeatmapInfo.BaseDifficulty.CircleSize - 5) / 5) / 2;

            foreach (var e in score.HitEvents.Where(e => e.HitObject is HitCircle && !(e.HitObject is SliderTailCircle)))
            {
                if (e.LastHitObject == null || e.Position == null)
                {
                    continue;
                }

                AddPoint(((OsuHitObject)e.LastHitObject).StackedEndPosition, ((OsuHitObject)e.HitObject).StackedEndPosition, e.Position.Value, radius);
            }
        }
Exemplo n.º 12
0
 private void load()
 {
     InternalChildren = new Drawable[]
     {
         new SmoothCircularProgress
         {
             Name             = "Background circle",
             Anchor           = Anchor.Centre,
             Origin           = Anchor.Centre,
             RelativeSizeAxes = Axes.Both,
             Colour           = OsuColour.Gray(47),
             Alpha            = 0.5f,
             InnerRadius      = accuracy_circle_radius + 0.01f, // Extends a little bit into the circle
             Current          = { Value = 1 },
         },
         accuracyCircle = new SmoothCircularProgress
         {
             Name             = "Accuracy circle",
             Anchor           = Anchor.Centre,
             Origin           = Anchor.Centre,
             RelativeSizeAxes = Axes.Both,
             Colour           = ColourInfo.GradientVertical(Color4Extensions.FromHex("#7CF6FF"), Color4Extensions.FromHex("#BAFFA9")),
             InnerRadius      = accuracy_circle_radius,
         },
         new BufferedContainer
         {
             Name             = "Graded circles",
             Anchor           = Anchor.Centre,
             Origin           = Anchor.Centre,
             RelativeSizeAxes = Axes.Both,
             Size             = new Vector2(0.8f),
             Padding          = new MarginPadding(2),
             Children         = new Drawable[]
             {
                 new SmoothCircularProgress
                 {
                     RelativeSizeAxes = Axes.Both,
                     Colour           = Color4Extensions.FromHex("#BE0089"),
                     InnerRadius      = RANK_CIRCLE_RADIUS,
                     Current          = { Value = 1 }
                 },
                 new SmoothCircularProgress
                 {
                     RelativeSizeAxes = Axes.Both,
                     Colour           = Color4Extensions.FromHex("#0096A2"),
                     InnerRadius      = RANK_CIRCLE_RADIUS,
                     Current          = { Value = 1 - virtual_ss_percentage }
                 },
                 new SmoothCircularProgress
                 {
                     RelativeSizeAxes = Axes.Both,
                     Colour           = Color4Extensions.FromHex("#72C904"),
                     InnerRadius      = RANK_CIRCLE_RADIUS,
                     Current          = { Value = 0.95f }
                 },
                 new SmoothCircularProgress
                 {
                     RelativeSizeAxes = Axes.Both,
                     Colour           = Color4Extensions.FromHex("#D99D03"),
                     InnerRadius      = RANK_CIRCLE_RADIUS,
                     Current          = { Value = 0.9f }
                 },
                 new SmoothCircularProgress
                 {
                     RelativeSizeAxes = Axes.Both,
                     Colour           = Color4Extensions.FromHex("#EA7948"),
                     InnerRadius      = RANK_CIRCLE_RADIUS,
                     Current          = { Value = 0.8f }
                 },
                 new SmoothCircularProgress
                 {
                     RelativeSizeAxes = Axes.Both,
                     Colour           = Color4Extensions.FromHex("#FF5858"),
                     InnerRadius      = RANK_CIRCLE_RADIUS,
                     Current          = { Value = 0.7f }
                 },
                 new RankNotch(0),
                 new RankNotch((float)(1 - virtual_ss_percentage)),
                 new RankNotch(0.95f),
                 new RankNotch(0.9f),
                 new RankNotch(0.8f),
                 new RankNotch(0.7f),
                 new BufferedContainer
                 {
                     Name             = "Graded circle mask",
                     RelativeSizeAxes = Axes.Both,
                     Padding          = new MarginPadding(1),
                     Blending         = new BlendingParameters
                     {
                         Source           = BlendingType.DstColor,
                         Destination      = BlendingType.OneMinusSrcAlpha,
                         SourceAlpha      = BlendingType.One,
                         DestinationAlpha = BlendingType.SrcAlpha
                     },
                     Child = innerMask = new SmoothCircularProgress
                     {
                         RelativeSizeAxes = Axes.Both,
                         InnerRadius      = RANK_CIRCLE_RADIUS - 0.01f,
                     }
                 }
             }
         },
         badges = new Container <RankBadge>
         {
             Name             = "Rank badges",
             RelativeSizeAxes = Axes.Both,
             Padding          = new MarginPadding {
                 Vertical = -15, Horizontal = -20
             },
             Children = new[]
             {
                 new RankBadge(1f, ScoreRank.X),
                 new RankBadge(0.95f, ScoreRank.S),
                 new RankBadge(0.9f, ScoreRank.A),
                 new RankBadge(0.8f, ScoreRank.B),
                 new RankBadge(0.7f, ScoreRank.C),
             }
         },
         rankText = new RankText(score.Rank)
     };
 }
Exemplo n.º 13
0
        private void load()
        {
            Children = new[]
            {
                spinner = new LoadingSpinner(true)
                {
                    Origin = Anchor.Centre,
                    Anchor = Anchor.Centre
                },
                content = new FillFlowContainer
                {
                    Alpha            = 0,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Width            = 0.6f,
                    Origin           = Anchor.TopCentre,
                    Anchor           = Anchor.TopCentre,
                    Spacing          = new Vector2(15, 15),
                    Children         = new Drawable[]
                    {
                        new GridContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            Width            = 0.8f,
                            AutoSizeAxes     = Axes.Y,
                            Origin           = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            ColumnDimensions = new[]
                            {
                                new Dimension(),
                                new Dimension(GridSizeMode.AutoSize)
                            },
                            RowDimensions = new[]
                            {
                                new Dimension(GridSizeMode.AutoSize),
                                new Dimension(GridSizeMode.AutoSize)
                            },
                            Content = new[]
                            {
                                new Drawable[]
                                {
                                    new OsuSpriteText
                                    {
                                        Origin = Anchor.CentreLeft,
                                        Anchor = Anchor.CentreLeft,
                                        Font   = OsuFont.GetFont(weight: FontWeight.Regular, size: 18),
                                        Text   = "Achieved PP",
                                        Colour = Color4Extensions.FromHex("#66FFCC")
                                    },
                                    achievedPerformance = new OsuSpriteText
                                    {
                                        Origin = Anchor.CentreRight,
                                        Anchor = Anchor.CentreRight,
                                        Font   = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 18),
                                        Colour = Color4Extensions.FromHex("#66FFCC")
                                    }
                                },
                                new Drawable[]
                                {
                                    new OsuSpriteText
                                    {
                                        Origin = Anchor.CentreLeft,
                                        Anchor = Anchor.CentreLeft,
                                        Font   = OsuFont.GetFont(weight: FontWeight.Regular, size: 18),
                                        Text   = "Maximum",
                                        Colour = OsuColour.Gray(0.7f)
                                    },
                                    maximumPerformance = new OsuSpriteText
                                    {
                                        Origin = Anchor.CentreLeft,
                                        Anchor = Anchor.CentreLeft,
                                        Font   = OsuFont.GetFont(weight: FontWeight.Regular, size: 18),
                                        Colour = OsuColour.Gray(0.7f)
                                    }
                                }
                            }
                        },
                        chart = new GridContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Origin           = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            ColumnDimensions = new[]
                            {
                                new Dimension(GridSizeMode.AutoSize),
                                new Dimension(),
                                new Dimension(GridSizeMode.AutoSize)
                            }
                        }
                    }
                }
            };

            spinner.Show();

            new PerformanceBreakdownCalculator(playableBeatmap, difficultyCache, performanceCache)
            .CalculateAsync(score, cancellationTokenSource.Token)
            .ContinueWith(t => Schedule(() => setPerformanceValue(t.GetResultSafely())));
        }
Exemplo n.º 14
0
 protected override Drawable CreateContent() => new FillFlowContainer
 {
     AutoSizeAxes = Axes.Both,
     Direction    = FillDirection.Horizontal,
     Spacing      = new Vector2(10, 0),
     Children     = new[]
     {
         base.CreateContent().With(d =>
         {
             Anchor = Anchor.CentreLeft;
             Origin = Anchor.CentreLeft;
         }),
         perfectText = new OsuSpriteText
         {
             Anchor             = Anchor.CentreLeft,
             Origin             = Anchor.CentreLeft,
             Text               = "PERFECT",
             Font               = OsuFont.Torus.With(size: 11, weight: FontWeight.SemiBold),
             Colour             = ColourInfo.GradientVertical(Color4Extensions.FromHex("#66FFCC"), Color4Extensions.FromHex("#FF9AD7")),
             Alpha              = 0,
             UseFullGlyphHeight = false,
         }
     }
 };
Exemplo n.º 15
0
        protected OnlinePlayScreen()
        {
            Anchor           = Anchor.Centre;
            Origin           = Anchor.Centre;
            RelativeSizeAxes = Axes.Both;
            Padding          = new MarginPadding {
                Horizontal = -HORIZONTAL_OVERFLOW_PADDING
            };

            var backgroundColour = Color4Extensions.FromHex(@"3e3a44");

            InternalChild = waves = new MultiplayerWaveContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = backgroundColour,
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Top = Header.HEIGHT
                        },
                        Children = new[]
                        {
                            header = new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                Height           = 400,
                                Children         = new[]
                                {
                                    headerBackground = new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Width            = 1.25f,
                                        Masking          = true,
                                        Children         = new Drawable[]
                                        {
                                            new HeaderBackgroundSprite
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                Height           = 400 // Keep a static height so the header doesn't change as it's resized between subscreens
                                            },
                                        }
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding {
                                            Bottom = -1
                                        },                                           // 1px padding to avoid a 1px gap due to masking
                                        Child = new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = ColourInfo.GradientVertical(backgroundColour.Opacity(0.5f), backgroundColour)
                                        },
                                    }
                                }
                            },
                            screenStack = new OnlinePlaySubScreenStack {
                                RelativeSizeAxes = Axes.Both
                            }
                        }
                    },
                    new Header(ScreenTitle, screenStack),
                    createButton = CreateNewMultiplayerGameButton().With(button =>
                    {
                        button.Anchor = Anchor.TopRight;
                        button.Origin = Anchor.TopRight;
                        button.Size   = new Vector2(150, Header.HEIGHT - 20);
                        button.Margin = new MarginPadding
                        {
                            Top   = 10,
                            Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
                        };
                        button.Action = () => OpenNewRoom();
                    }),
                    RoomManager             = CreateRoomManager(),
                    ongoingOperationTracker = new OngoingOperationTracker()
                }
            };

            screenStack.ScreenPushed += screenPushed;
            screenStack.ScreenExited += screenExited;

            screenStack.Push(loungeSubScreen = CreateLounge());
        }
Exemplo n.º 16
0
 protected override void LoadComplete()
 {
     base.LoadComplete();
     AccentColour = Color4Extensions.FromHex("#e35c99");
 }
Exemplo n.º 17
0
        private void load(AudioManager audio)
        {
            sampleStart = audio.Samples.Get(@"SongSelect/confirm-selection");

            InternalChildren = new Drawable[]
            {
                beatmapAvailabilityTracker,
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    RowDimensions    = new[]
                    {
                        new Dimension(),
                        new Dimension(GridSizeMode.Absolute, 50)
                    },
                    Content = new[]
                    {
                        // Padded main content (drawable room + main content)
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Horizontal = WaveOverlayContainer.WIDTH_PADDING,
                                    Bottom     = 30
                                },
                                Children = new[]
                                {
                                    mainContent = new GridContainer
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        RowDimensions    = new[]
                                        {
                                            new Dimension(GridSizeMode.AutoSize),
                                            new Dimension(GridSizeMode.Absolute, 10)
                                        },
                                        Content = new[]
                                        {
                                            new Drawable[]
                                            {
                                                new DrawableMatchRoom(Room, allowEdit)
                                                {
                                                    OnEdit       = () => settingsOverlay.Show(),
                                                    SelectedItem = { BindTarget = SelectedItem }
                                                }
                                            },
                                            null,
                                            new Drawable[]
                                            {
                                                new Container
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Children         = new[]
                                                    {
                                                        new Container
                                                        {
                                                            RelativeSizeAxes = Axes.Both,
                                                            Masking          = true,
                                                            CornerRadius     = 10,
                                                            Child            = new Box
                                                            {
                                                                RelativeSizeAxes = Axes.Both,
                                                                Colour           = Color4Extensions.FromHex(@"3e3a44") // Temporary.
                                                            },
                                                        },
                                                        new Container
                                                        {
                                                            RelativeSizeAxes = Axes.Both,
                                                            Padding          = new MarginPadding(20),
                                                            Child            = CreateMainContent(),
                                                        },
                                                        new Container
                                                        {
                                                            Anchor           = Anchor.BottomLeft,
                                                            Origin           = Anchor.BottomLeft,
                                                            RelativeSizeAxes = Axes.X,
                                                            AutoSizeAxes     = Axes.Y,
                                                            Child            = userModsSelectOverlay = new UserModSelectOverlay
                                                            {
                                                                SelectedMods = { BindTarget = UserMods },
                                                                IsValidMod   = _ => false
                                                            }
                                                        },
                                                    }
                                                }
                                            }
                                        }
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        // Resolves 1px masking errors between the settings overlay and the room panel.
                                        Padding = new MarginPadding(-1),
                                        Child   = settingsOverlay = CreateRoomSettingsOverlay(Room)
                                    }
                                },
                            },
                        },
                        // Footer
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Color4Extensions.FromHex(@"28242d") // Temporary.
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding(5),
                                        Child            = CreateFooter()
                                    },
                                }
                            }
                        }
                    }
                }
            };
        }
        private void load(OsuColour colours)
        {
            var    starRatingParts = beatmap.StarDifficulty.ToString("0.00", CultureInfo.InvariantCulture).Split('.');
            string wholePart       = starRatingParts[0];
            string fractionPart    = starRatingParts[1];
            string separator       = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;

            ColourInfo backgroundColour = beatmap.DifficultyRating == DifficultyRating.ExpertPlus
                ? ColourInfo.GradientVertical(Color4Extensions.FromHex("#C1C1C1"), Color4Extensions.FromHex("#595959"))
                : (ColourInfo)colours.ForDifficultyRating(beatmap.DifficultyRating);

            InternalChildren = new Drawable[]
            {
                new CircularContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = backgroundColour
                        },
                    }
                },
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Padding      = new MarginPadding {
                        Horizontal = 8, Vertical = 4
                    },
                    Direction = FillDirection.Horizontal,
                    Spacing   = new Vector2(2, 0),
                    Children  = new Drawable[]
                    {
                        new SpriteIcon
                        {
                            Anchor = Anchor.CentreLeft,
                            Origin = Anchor.CentreLeft,
                            Size   = new Vector2(7),
                            Icon   = FontAwesome.Solid.Star,
                            Colour = Color4.Black
                        },
                        new OsuTextFlowContainer(s => s.Font = OsuFont.Numeric.With(weight: FontWeight.Black))
                        {
                            Anchor       = Anchor.CentreLeft,
                            Origin       = Anchor.CentreLeft,
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Horizontal,
                            TextAnchor   = Anchor.BottomLeft,
                        }.With(t =>
                        {
                            t.AddText($"{wholePart}", s =>
                            {
                                s.Colour             = Color4.Black;
                                s.Font               = s.Font.With(size: 14);
                                s.UseFullGlyphHeight = false;
                            });

                            t.AddText($"{separator}{fractionPart}", s =>
                            {
                                s.Colour             = Color4.Black;
                                s.Font               = s.Font.With(size: 7);
                                s.UseFullGlyphHeight = false;
                            });
                        })
                    }
                }
            };
        }
Exemplo n.º 19
0
 protected override Drawable CreateBackground() =>
 new Container
 {
     RelativeSizeAxes = Axes.X,
     Height           = 150,
     Masking          = true,
     Children         = new Drawable[]
     {
         coverContainer = new ProfileCoverBackground
         {
             RelativeSizeAxes = Axes.Both,
         },
         new Box
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = ColourInfo.GradientVertical(Color4Extensions.FromHex("222").Opacity(0.8f), Color4Extensions.FromHex("222").Opacity(0.2f))
         },
     }
 };
Exemplo n.º 20
0
        private void load()
        {
            var user = User.User;

            var backgroundColour = Color4Extensions.FromHex("#33413C");

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 18),
                    new Dimension(GridSizeMode.AutoSize),
                    new Dimension(),
                    new Dimension(GridSizeMode.AutoSize),
                },
                Content = new[]
                {
                    new Drawable[]
                    {
                        crown = new SpriteIcon
                        {
                            Anchor = Anchor.CentreLeft,
                            Origin = Anchor.CentreLeft,
                            Icon   = FontAwesome.Solid.Crown,
                            Size   = new Vector2(14),
                            Colour = Color4Extensions.FromHex("#F7E65D"),
                            Alpha  = 0
                        },
                        new TeamDisplay(User),
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Masking          = true,
                            CornerRadius     = 5,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = backgroundColour
                                },
                                new UserCoverBackground
                                {
                                    Anchor           = Anchor.CentreRight,
                                    Origin           = Anchor.CentreRight,
                                    RelativeSizeAxes = Axes.Both,
                                    Width            = 0.75f,
                                    User             = user,
                                    Colour           = ColourInfo.GradientHorizontal(Color4.White.Opacity(0), Color4.White.Opacity(0.25f))
                                },
                                new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Spacing          = new Vector2(10),
                                    Direction        = FillDirection.Horizontal,
                                    Children         = new Drawable[]
                                    {
                                        new UpdateableAvatar
                                        {
                                            Anchor           = Anchor.CentreLeft,
                                            Origin           = Anchor.CentreLeft,
                                            RelativeSizeAxes = Axes.Both,
                                            FillMode         = FillMode.Fit,
                                            User             = user
                                        },
                                        new UpdateableFlag
                                        {
                                            Anchor  = Anchor.CentreLeft,
                                            Origin  = Anchor.CentreLeft,
                                            Size    = new Vector2(28, 20),
                                            Country = user?.Country
                                        },
                                        new OsuSpriteText
                                        {
                                            Anchor = Anchor.CentreLeft,
                                            Origin = Anchor.CentreLeft,
                                            Font   = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
                                            Text   = user?.Username
                                        },
                                        userRankText = new OsuSpriteText
                                        {
                                            Anchor = Anchor.CentreLeft,
                                            Origin = Anchor.CentreLeft,
                                            Font   = OsuFont.GetFont(size: 14),
                                        }
                                    }
                                },
                                new Container
                                {
                                    Anchor       = Anchor.CentreRight,
                                    Origin       = Anchor.CentreRight,
                                    AutoSizeAxes = Axes.Both,
                                    Margin       = new MarginPadding {
                                        Right = 70
                                    },
                                    Child = userModsDisplay = new ModDisplay
                                    {
                                        Scale         = new Vector2(0.5f),
                                        ExpansionMode = ExpansionMode.AlwaysContracted,
                                    }
                                },
                                userStateDisplay = new StateDisplay
                                {
                                    Anchor = Anchor.CentreRight,
                                    Origin = Anchor.CentreRight,
                                    Margin = new MarginPadding {
                                        Right = 10
                                    },
                                }
                            }
                        },
                        kickButton = new KickButton
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Alpha  = 0,
                            Margin = new MarginPadding(4),
                            Action = () => Client.KickUser(User.UserID).FireAndForget(),
                        },
                    },
                }
            };
        }
Exemplo n.º 21
0
 public void TestShader()
 {
     AddStep("Set colour", () => video.Colour = Color4Extensions.FromHex("#ea7948").Opacity(0.75f));
     AddStep("Use normal shader", () => video.UseRoundedShader  = false);
     AddStep("Use rounded shader", () => video.UseRoundedShader = true);
 }
Exemplo n.º 22
0
        private void load()
        {
            FillFlowContainer buttons;

            InternalChild = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                Content          = new[]
                {
                    new Drawable[]
                    {
                        new VerticalScrollContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            ScrollbarVisible = false,
                            Child            = new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    statisticsPanel = new StatisticsPanel
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Score            = { BindTarget = SelectedScore }
                                    },
                                    ScorePanelList = new ScorePanelList
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        SelectedScore    = { BindTarget = SelectedScore },
                                        PostExpandAction = () => statisticsPanel.ToggleVisibility()
                                    },
                                    detachedPanelContainer = new Container <ScorePanel>
                                    {
                                        RelativeSizeAxes = Axes.Both
                                    },
                                }
                            }
                        },
                    },
                    new[]
                    {
                        bottomPanel = new Container
                        {
                            Anchor           = Anchor.BottomLeft,
                            Origin           = Anchor.BottomLeft,
                            RelativeSizeAxes = Axes.X,
                            Height           = TwoLayerButton.SIZE_EXTENDED.Y,
                            Alpha            = 0,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4Extensions.FromHex("#333")
                                },
                                buttons = new FillFlowContainer
                                {
                                    Anchor       = Anchor.Centre,
                                    Origin       = Anchor.Centre,
                                    AutoSizeAxes = Axes.Both,
                                    Spacing      = new Vector2(5),
                                    Direction    = FillDirection.Horizontal
                                }
                            }
                        }
                    }
                },
                RowDimensions = new[]
                {
                    new Dimension(),
                    new Dimension(GridSizeMode.AutoSize)
                }
            };

            if (Score != null)
            {
                // only show flair / animation when arriving after watching a play that isn't autoplay.
                bool shouldFlair = player != null && Score.Mods.All(m => m.UserPlayable);

                ScorePanelList.AddScore(Score, shouldFlair);
            }

            if (allowWatchingReplay)
            {
                buttons.Add(new ReplayDownloadButton(null)
                {
                    Score = { BindTarget = SelectedScore },
                    Width = 300
                });
            }

            if (player != null && allowRetry)
            {
                buttons.Add(new RetryButton {
                    Width = 300
                });

                AddInternal(new HotkeyRetryOverlay
                {
                    Action = () =>
                    {
                        if (!this.IsCurrentScreen())
                        {
                            return;
                        }

                        player?.Restart();
                    },
                });
            }
        }
Exemplo n.º 23
0
        private void load()
        {
            // ScorePanel doesn't include the top extruding area in its own size.
            // Adding a manual offset here allows the expanded version to take on an "acceptable" vertical centre when at 100% UI scale.
            const float vertical_fudge = 20;

            InternalChild = content = new Container
            {
                Anchor   = Anchor.Centre,
                Origin   = Anchor.Centre,
                Size     = new Vector2(40),
                Y        = vertical_fudge,
                Children = new Drawable[]
                {
                    topLayerContainer = new Container
                    {
                        Name             = "Top layer",
                        RelativeSizeAxes = Axes.X,
                        Alpha            = 0,
                        Height           = 120,
                        Children         = new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                CornerRadius     = 20,
                                CornerExponent   = 2.5f,
                                Masking          = true,
                                Child            = topLayerBackground = new Box {
                                    RelativeSizeAxes = Axes.Both
                                }
                            },
                            topLayerContentContainer = new Container {
                                RelativeSizeAxes = Axes.Both
                            }
                        }
                    },
                    middleLayerContainer = new Container
                    {
                        Name             = "Middle layer",
                        RelativeSizeAxes = Axes.Both,
                        Children         = new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                CornerRadius     = 20,
                                CornerExponent   = 2.5f,
                                Masking          = true,
                                Children         = new[]
                                {
                                    middleLayerBackground = new Box {
                                        RelativeSizeAxes = Axes.Both
                                    },
                                    new UserCoverBackground
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        User             = Score.User,
                                        Colour           = ColourInfo.GradientVertical(Color4.White.Opacity(0.5f), Color4Extensions.FromHex("#444").Opacity(0))
                                    }
                                }
                            },
                            middleLayerContentContainer = new Container {
                                RelativeSizeAxes = Axes.Both
                            }
                        }
                    }
                }
            };
        }
Exemplo n.º 24
0
        public ChannelSelectionOverlay()
        {
            RelativeSizeAxes = Axes.X;

            Waves.FirstWaveColour  = Color4Extensions.FromHex("353535");
            Waves.SecondWaveColour = Color4Extensions.FromHex("434343");
            Waves.ThirdWaveColour  = Color4Extensions.FromHex("515151");
            Waves.FourthWaveColour = Color4Extensions.FromHex("595959");

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    Children         = new Drawable[]
                    {
                        bg = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                        },
                        triangles = new Triangles
                        {
                            RelativeSizeAxes = Axes.Both,
                            TriangleScale    = 5,
                        },
                    },
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = 85, Right = WIDTH_PADDING
                    },
                    Children = new[]
                    {
                        new OsuScrollContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Children         = new[]
                            {
                                sectionsFlow = new SearchContainer <ChannelSection>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    LayoutDuration   = 200,
                                    LayoutEasing     = Easing.OutQuint,
                                    Spacing          = new Vector2(0f, 20f),
                                    Padding          = new MarginPadding {
                                        Vertical = 20, Left = WIDTH_PADDING
                                    },
                                },
                            },
                        },
                    },
                },
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Children         = new Drawable[]
                    {
                        headerBg = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                        },
                        new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                            Spacing          = new Vector2(0f, 10f),
                            Padding          = new MarginPadding {
                                Top = 10f, Bottom = 10f, Left = WIDTH_PADDING, Right = WIDTH_PADDING
                            },
                            Children = new Drawable[]
                            {
                                new OsuSpriteText
                                {
                                    Text   = @"Chat Channels",
                                    Font   = OsuFont.GetFont(size: 20),
                                    Shadow = false,
                                },
                                search = new HeaderSearchTextBox {
                                    RelativeSizeAxes = Axes.X
                                },
                            },
                        },
                    },
                },
            };

            search.Current.ValueChanged += term => sectionsFlow.SearchTerm = term.NewValue;
        }
Exemplo n.º 25
0
            private void load(OsuColour colours)
            {
                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Color4Extensions.FromHex(@"28242d"),
                    },
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.AutoSize),
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                new OsuScrollContainer
                                {
                                    Padding = new MarginPadding
                                    {
                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                        Vertical   = 10
                                    },
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new[]
                                    {
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 10),
                                            Children         = new Drawable[]
                                            {
                                                new Container
                                                {
                                                    Anchor  = Anchor.TopCentre,
                                                    Origin  = Anchor.TopCentre,
                                                    Padding = new MarginPadding {
                                                        Horizontal = WaveOverlayContainer.WIDTH_PADDING
                                                    },
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Children         = new Drawable[]
                                                    {
                                                        new SectionContainer
                                                        {
                                                            Padding = new MarginPadding {
                                                                Right = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Room name")
                                                                {
                                                                    Child = NameField = new SettingsTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                    },
                                                                },
                                                                new Section("Room visibility")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                                    {
                                                                        Enabled = { Value = false }
                                                                    },
                                                                },
                                                                new Section("Game type")
                                                                {
                                                                    Child = new FillFlowContainer
                                                                    {
                                                                        AutoSizeAxes     = Axes.Y,
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Direction        = FillDirection.Vertical,
                                                                        Spacing          = new Vector2(7),
                                                                        Children         = new Drawable[]
                                                                        {
                                                                            TypePicker = new MatchTypePicker
                                                                            {
                                                                                RelativeSizeAxes = Axes.X,
                                                                            },
                                                                            typeLabel = new OsuSpriteText
                                                                            {
                                                                                Font   = OsuFont.GetFont(size: 14),
                                                                                Colour = colours.Yellow
                                                                            },
                                                                        },
                                                                    },
                                                                },
                                                            },
                                                        },
                                                        new SectionContainer
                                                        {
                                                            Anchor  = Anchor.TopRight,
                                                            Origin  = Anchor.TopRight,
                                                            Padding = new MarginPadding {
                                                                Left = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Max participants")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = MaxParticipantsField = new SettingsNumberTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                                new Section("Password (optional)")
                                                                {
                                                                    Child = PasswordTextBox = new SettingsPasswordTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                    },
                                                                },
                                                            }
                                                        }
                                                    },
                                                },
                                                initialBeatmapControl = new BeatmapSelectionControl
                                                {
                                                    Anchor           = Anchor.TopCentre,
                                                    Origin           = Anchor.TopCentre,
                                                    RelativeSizeAxes = Axes.X,
                                                    Width            = 0.5f
                                                }
                                            }
                                        }
                                    },
                                },
                            },
                            new Drawable[]
                            {
                                new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    Y                = 2,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = Color4Extensions.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 20),
                                            Margin           = new MarginPadding {
                                                Vertical = 20
                                            },
                                            Padding = new MarginPadding {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                            },
                                            Children = new Drawable[]
                                            {
                                                ApplyButton = new CreateOrUpdateButton
                                                {
                                                    Anchor  = Anchor.BottomCentre,
                                                    Origin  = Anchor.BottomCentre,
                                                    Size    = new Vector2(230, 55),
                                                    Enabled = { Value = false },
                                                    Action  = apply,
                                                },
                                                ErrorText = new OsuSpriteText
                                                {
                                                    Anchor = Anchor.BottomCentre,
                                                    Origin = Anchor.BottomCentre,
                                                    Alpha  = 0,
                                                    Depth  = 1,
                                                    Colour = colours.RedDark
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    loadingLayer = new LoadingLayer(true)
                };

                TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue.GetLocalisableDescription(), true);
                RoomName.BindValueChanged(name => NameField.Text           = name.NewValue, true);
                Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
                Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true);
                RoomID.BindValueChanged(roomId => initialBeatmapControl.Alpha       = roomId.NewValue == null ? 1 : 0, true);
                Password.BindValueChanged(password => PasswordTextBox.Text          = password.NewValue ?? string.Empty, true);

                operationInProgress.BindTo(ongoingOperationTracker.InProgress);
                operationInProgress.BindValueChanged(v =>
                {
                    if (v.NewValue)
                    {
                        loadingLayer.Show();
                    }
                    else
                    {
                        loadingLayer.Hide();
                    }
                });
            }
Exemplo n.º 26
0
        private void load()
        {
            Masking      = true;
            CornerRadius = 5;

            OsuCheckbox waveformCheckbox;
            OsuCheckbox controlPointsCheckbox;
            OsuCheckbox ticksCheckbox;

            InternalChildren = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4Extensions.FromHex("111")
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Content          = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Y,
                                AutoSizeAxes     = Axes.X,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Color4Extensions.FromHex("222")
                                    },
                                    new FillFlowContainer
                                    {
                                        Anchor       = Anchor.CentreLeft,
                                        Origin       = Anchor.CentreLeft,
                                        AutoSizeAxes = Axes.Y,
                                        Width        = 160,
                                        Padding      = new MarginPadding {
                                            Horizontal = 10
                                        },
                                        Direction = FillDirection.Vertical,
                                        Spacing   = new Vector2(0, 4),
                                        Children  = new[]
                                        {
                                            waveformCheckbox = new OsuCheckbox
                                            {
                                                LabelText = "Waveform",
                                                Current   = { Value = true },
                                            },
                                            controlPointsCheckbox = new OsuCheckbox
                                            {
                                                LabelText = "Control Points",
                                                Current   = { Value = true },
                                            },
                                            ticksCheckbox = new OsuCheckbox
                                            {
                                                LabelText = "Ticks",
                                                Current   = { Value = true },
                                            }
                                        }
                                    }
                                }
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Y,
                                AutoSizeAxes     = Axes.X,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Color4Extensions.FromHex("333")
                                    },
                                    new Container <TimelineButton>
                                    {
                                        Anchor           = Anchor.CentreLeft,
                                        Origin           = Anchor.CentreLeft,
                                        RelativeSizeAxes = Axes.Y,
                                        AutoSizeAxes     = Axes.X,
                                        Masking          = true,
                                        Children         = new[]
                                        {
                                            new TimelineButton
                                            {
                                                RelativeSizeAxes = Axes.Y,
                                                Height           = 0.5f,
                                                Icon             = FontAwesome.Solid.SearchPlus,
                                                Action           = () => changeZoom(1)
                                            },
                                            new TimelineButton
                                            {
                                                Anchor           = Anchor.BottomLeft,
                                                Origin           = Anchor.BottomLeft,
                                                RelativeSizeAxes = Axes.Y,
                                                Height           = 0.5f,
                                                Icon             = FontAwesome.Solid.SearchMinus,
                                                Action           = () => changeZoom(-1)
                                            },
                                        }
                                    }
                                }
                            },
                            Timeline
                        },
                    },
                    ColumnDimensions = new[]
                    {
                        new Dimension(GridSizeMode.AutoSize),
                        new Dimension(GridSizeMode.AutoSize),
                        new Dimension(GridSizeMode.Distributed),
                    }
                }
            };

            Timeline.WaveformVisible.BindTo(waveformCheckbox.Current);
            Timeline.ControlPointsVisible.BindTo(controlPointsCheckbox.Current);
            Timeline.TicksVisible.BindTo(ticksCheckbox.Current);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Creates a new <see cref="LabelledComponent{T, U}"/>.
        /// </summary>
        /// <param name="padded">Whether the component should be padded or should be expanded to the bounds of this <see cref="LabelledComponent{T, U}"/>.</param>
        protected LabelledDrawable(bool padded)
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;

            CornerRadius = CORNER_RADIUS;
            Masking      = true;

            InternalChildren = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4Extensions.FromHex("1c2125"),
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Padding          = padded
                        ? new MarginPadding {
                        Horizontal = CONTENT_PADDING_HORIZONTAL, Vertical = CONTENT_PADDING_VERTICAL
                    }
                        : new MarginPadding {
                        Left = CONTENT_PADDING_HORIZONTAL
                    },
                    Spacing  = new Vector2(0, 12),
                    Children = new Drawable[]
                    {
                        new GridContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Content          = new[]
                            {
                                new Drawable[]
                                {
                                    labelText = new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(weight: FontWeight.Bold))
                                    {
                                        Anchor       = Anchor.CentreLeft,
                                        Origin       = Anchor.CentreLeft,
                                        AutoSizeAxes = Axes.Both,
                                        Padding      = new MarginPadding {
                                            Right = 20
                                        }
                                    },
                                    new Container
                                    {
                                        Anchor           = Anchor.CentreRight,
                                        Origin           = Anchor.CentreRight,
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Child            = Component = CreateComponent().With(d =>
                                        {
                                            d.Anchor = Anchor.CentreRight;
                                            d.Origin = Anchor.CentreRight;
                                        })
                                    }
                                },
                            },
                            RowDimensions    = new[] { new Dimension(GridSizeMode.AutoSize) },
                            ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }
                        },
                        descriptionText = new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold, italics: true))
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Padding          = new MarginPadding {
                                Bottom = padded ? 0 : CONTENT_PADDING_VERTICAL
                            },
                            Alpha = 0,
                        }
                    }
                }
            };
        }
Exemplo n.º 28
0
        private void load()
        {
            InternalChildren = new Drawable[]
            {
                new SmoothCircularProgress
                {
                    Name             = "Background circle",
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.Gray(47),
                    Alpha            = 0.5f,
                    InnerRadius      = accuracy_circle_radius + 0.01f, // Extends a little bit into the circle
                    Current          = { Value = 1 },
                },
                accuracyCircle = new SmoothCircularProgress
                {
                    Name             = "Accuracy circle",
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Colour           = ColourInfo.GradientVertical(Color4Extensions.FromHex("#7CF6FF"), Color4Extensions.FromHex("#BAFFA9")),
                    InnerRadius      = accuracy_circle_radius,
                },
                new BufferedContainer
                {
                    Name             = "Graded circles",
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Size             = new Vector2(0.8f),
                    Padding          = new MarginPadding(2),
                    Children         = new Drawable[]
                    {
                        new SmoothCircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = OsuColour.ForRank(ScoreRank.X),
                            InnerRadius      = RANK_CIRCLE_RADIUS,
                            Current          = { Value = 1 }
                        },
                        new SmoothCircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = OsuColour.ForRank(ScoreRank.S),
                            InnerRadius      = RANK_CIRCLE_RADIUS,
                            Current          = { Value = 1 - virtual_ss_percentage }
                        },
                        new SmoothCircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = OsuColour.ForRank(ScoreRank.A),
                            InnerRadius      = RANK_CIRCLE_RADIUS,
                            Current          = { Value = 0.95f }
                        },
                        new SmoothCircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = OsuColour.ForRank(ScoreRank.B),
                            InnerRadius      = RANK_CIRCLE_RADIUS,
                            Current          = { Value = 0.9f }
                        },
                        new SmoothCircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = OsuColour.ForRank(ScoreRank.C),
                            InnerRadius      = RANK_CIRCLE_RADIUS,
                            Current          = { Value = 0.8f }
                        },
                        new SmoothCircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = OsuColour.ForRank(ScoreRank.D),
                            InnerRadius      = RANK_CIRCLE_RADIUS,
                            Current          = { Value = 0.7f }
                        },
                        new RankNotch(0),
                        new RankNotch((float)(1 - virtual_ss_percentage)),
                        new RankNotch(0.95f),
                        new RankNotch(0.9f),
                        new RankNotch(0.8f),
                        new RankNotch(0.7f),
                        new BufferedContainer
                        {
                            Name             = "Graded circle mask",
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding(1),
                            Blending         = new BlendingParameters
                            {
                                Source           = BlendingType.DstColor,
                                Destination      = BlendingType.OneMinusSrcAlpha,
                                SourceAlpha      = BlendingType.One,
                                DestinationAlpha = BlendingType.SrcAlpha
                            },
                            Child = innerMask = new SmoothCircularProgress
                            {
                                RelativeSizeAxes = Axes.Both,
                                InnerRadius      = RANK_CIRCLE_RADIUS - 0.01f,
                            }
                        }
                    }
                },
                badges = new Container <RankBadge>
                {
                    Name             = "Rank badges",
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Vertical = -15, Horizontal = -20
                    },
                    Children = new[]
                    {
                        new RankBadge(1, getRank(ScoreRank.X)),
                        new RankBadge(0.95, getRank(ScoreRank.S)),
                        new RankBadge(0.9, getRank(ScoreRank.A)),
                        new RankBadge(0.8, getRank(ScoreRank.B)),
                        new RankBadge(0.7, getRank(ScoreRank.C)),
                        new RankBadge(0.35, getRank(ScoreRank.D)),
                    }
                },
                rankText = new RankText(score.Rank)
            };

            if (withFlair)
            {
                AddRangeInternal(new Drawable[]
                {
                    rankImpactSound   = new PoolableSkinnableSample(new SampleInfo(impactSampleName)),
                    rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", applauseSampleName)),
                    scoreTickSound    = new PoolableSkinnableSample(new SampleInfo(@"Results/score-tick")),
                    badgeTickSound    = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink")),
                    badgeMaxSound     = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink-max")),
                    swooshUpSound     = new PoolableSkinnableSample(new SampleInfo(@"Results/swoosh-up")),
                });
            }
        }
Exemplo n.º 29
0
        private void load()
        {
            Debug.Assert(User.User != null);

            var backgroundColour = Color4Extensions.FromHex("#33413C");

            InternalChildren = new Drawable[]
            {
                crown = new SpriteIcon
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    Icon   = FontAwesome.Solid.Crown,
                    Size   = new Vector2(14),
                    Colour = Color4Extensions.FromHex("#F7E65D"),
                    Alpha  = 0
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = 24
                    },
                    Child = new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Masking          = true,
                        CornerRadius     = 5,
                        Children         = new Drawable[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = backgroundColour
                            },
                            new UserCoverBackground
                            {
                                Anchor           = Anchor.CentreRight,
                                Origin           = Anchor.CentreRight,
                                RelativeSizeAxes = Axes.Both,
                                Width            = 0.75f,
                                User             = User.User,
                                Colour           = ColourInfo.GradientHorizontal(Color4.White.Opacity(0), Color4.White.Opacity(0.25f))
                            },
                            new FillFlowContainer
                            {
                                RelativeSizeAxes = Axes.Both,
                                Spacing          = new Vector2(10),
                                Direction        = FillDirection.Horizontal,
                                Children         = new Drawable[]
                                {
                                    new UpdateableAvatar
                                    {
                                        Anchor           = Anchor.CentreLeft,
                                        Origin           = Anchor.CentreLeft,
                                        RelativeSizeAxes = Axes.Both,
                                        FillMode         = FillMode.Fit,
                                        User             = User.User
                                    },
                                    new UpdateableFlag
                                    {
                                        Anchor  = Anchor.CentreLeft,
                                        Origin  = Anchor.CentreLeft,
                                        Size    = new Vector2(30, 20),
                                        Country = User.User.Country
                                    },
                                    new OsuSpriteText
                                    {
                                        Anchor = Anchor.CentreLeft,
                                        Origin = Anchor.CentreLeft,
                                        Font   = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
                                        Text   = User.User.Username
                                    },
                                    new OsuSpriteText
                                    {
                                        Anchor = Anchor.CentreLeft,
                                        Origin = Anchor.CentreLeft,
                                        Font   = OsuFont.GetFont(size: 14),
                                        Text   = User.User.CurrentModeRank != null ? $"#{User.User.CurrentModeRank}" : string.Empty
                                    }
                                }
                            },
                            userStateDisplay = new StateDisplay
                            {
                                Anchor = Anchor.CentreRight,
                                Origin = Anchor.CentreRight,
                                Margin = new MarginPadding {
                                    Right = 10
                                },
                            }
                        }
                    }
                }
            };
        }
Exemplo n.º 30
0
 private void load()
 {
     BackgroundColour      = Color4Extensions.FromHex(@"593790");
     Triangles.ColourLight = Color4Extensions.FromHex(@"7247b6");
     Triangles.ColourDark  = Color4Extensions.FromHex(@"593790");
 }