Exemplo n.º 1
0
        public ToolbarUserButton()
        {
            AutoSizeAxes = Axes.X;

            DrawableText.Font = @"Exo2.0-MediumItalic";

            Add(new OpaqueBackground {
                Depth = 1
            });

            Flow.Add(avatar = new UpdateableAvatar
            {
                Masking      = true,
                Size         = new Vector2(32),
                Anchor       = Anchor.CentreLeft,
                Origin       = Anchor.CentreLeft,
                CornerRadius = 4,
                OpenOnClick  = { Value = false },
                EdgeEffect   = new EdgeEffectParameters
                {
                    Type   = EdgeEffectType.Shadow,
                    Radius = 4,
                    Colour = Color4.Black.Opacity(0.1f),
                }
            });
        }
Exemplo n.º 2
0
        public AuthorInfo()
        {
            RelativeSizeAxes = Axes.X;
            Height           = height;

            Children = new Drawable[]
            {
                clickableArea = new ClickableArea
                {
                    AutoSizeAxes = Axes.Both,
                    CornerRadius = 3,
                    Masking      = true,
                    Child        = avatar = new UpdateableAvatar
                    {
                        Size = new Vector2(height),
                    },
                    EdgeEffect = new EdgeEffectParameters
                    {
                        Colour = Color4.Black.Opacity(0.25f),
                        Type   = EdgeEffectType.Shadow,
                        Radius = 3,
                        Offset = new Vector2(0f, 1f),
                    },
                },
                fields = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Direction        = FillDirection.Vertical,
                    Padding          = new MarginPadding {
                        Left = height + 5
                    },
                },
            };
        }
Exemplo n.º 3
0
        public HostInfo()
        {
            AutoSizeAxes = Axes.X;
            Height       = 50;

            InternalChild = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction    = FillDirection.Horizontal,
                Spacing      = new Vector2(5, 0),
                Children     = new Drawable[]
                {
                    avatar = new UpdateableAvatar {
                        Size = new Vector2(50)
                    },
                    new FillFlowContainer
                    {
                        Anchor       = Anchor.CentreLeft,
                        Origin       = Anchor.CentreLeft,
                        AutoSizeAxes = Axes.Both,
                        Direction    = FillDirection.Vertical,
                        Child        = linkContainer = new LinkFlowContainer {
                            AutoSizeAxes = Axes.Both
                        }
                    }
                }
            };

            Host.BindValueChanged(host => updateHost(host.NewValue));
        }
Exemplo n.º 4
0
        public ToolbarUserButton()
        {
            AutoSizeAxes = Axes.X;

            DrawableText.Font = OsuFont.GetFont(italics: true);

            Add(new OpaqueBackground {
                Depth = 1
            });

            Flow.Add(avatar = new UpdateableAvatar(isInteractive: false)
            {
                Masking      = true,
                Size         = new Vector2(32),
                Anchor       = Anchor.CentreLeft,
                Origin       = Anchor.CentreLeft,
                CornerRadius = 4,
                EdgeEffect   = new EdgeEffectParameters
                {
                    Type   = EdgeEffectType.Shadow,
                    Radius = 4,
                    Colour = Color4.Black.Opacity(0.1f),
                }
            });
        }
Exemplo n.º 5
0
        public ToolbarUserButton()
        {
            TooltipMain = "我";
            TooltipSub  = $"在这里查看个人信息";

            AutoSizeAxes = Axes.X;

            DrawableText.Font = OsuFont.GetFont(italics: true);

            Add(new OpaqueBackground {
                Depth = 1
            });

            Flow.Add(avatar = new UpdateableAvatar
            {
                Masking      = true,
                Size         = new Vector2(32),
                Anchor       = Anchor.CentreLeft,
                Origin       = Anchor.CentreLeft,
                CornerRadius = 4,
                OpenOnClick  = { Value = false },
                EdgeEffect   = new EdgeEffectParameters
                {
                    Type   = EdgeEffectType.Shadow,
                    Radius = 4,
                    Colour = Color4.Black.Opacity(0.1f),
                }
            });
        }
Exemplo n.º 6
0
        private void load(OsuColour colours)
        {
            InternalChild = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction    = FillDirection.Horizontal,
                Spacing      = new Vector2(10, 0),
                Children     = new Drawable[]
                {
                    avatar = new UpdateableAvatar
                    {
                        Size         = new Vector2(50),
                        Masking      = true,
                        CornerRadius = 10,
                    },
                    new FillFlowContainer
                    {
                        AutoSizeAxes = Axes.Both,
                        Direction    = FillDirection.Vertical,
                        Children     = new Drawable[]
                        {
                            new OsuSpriteText
                            {
                                Font    = OsuFont.GetFont(size: 30),
                                Current = { BindTarget = RoomName }
                            },
                            hostText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold))
                            {
                                AutoSizeAxes = Axes.Both,
                                Direction    = FillDirection.Horizontal,
                            }
                        }
                    }
                }
            };

            Host.BindValueChanged(host =>
            {
                avatar.User = host.NewValue;

                hostText.Clear();

                if (host.NewValue != null)
                {
                    hostText.AddText("hosted by ");
                    hostText.AddUserLink(host.NewValue);
                }
            }, true);
        }
Exemplo n.º 7
0
        public DrawableRoom(Room room)
        {
            Room = room;

            RelativeSizeAxes = Axes.X;
            Height           = height;
            CornerRadius     = 5;
            Masking          = true;
            EdgeEffect       = new EdgeEffectParameters
            {
                Type   = EdgeEffectType.Shadow,
                Colour = Color4.Black.Opacity(40),
                Radius = 5,
            };

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.Gray(34),
                },
                sideStrip = new Box
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = content_padding,
                },
                avatar = new UpdateableAvatar
                {
                    Size         = new Vector2(Height - content_padding * 2),
                    Masking      = true,
                    CornerRadius = 5f,
                    Margin       = new MarginPadding {
                        Left = content_padding * 2, Top = content_padding
                    },
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = content_padding, Bottom = content_padding, Left = Height + content_padding * 2, Right = content_padding
                    },
                    Children = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                            Spacing          = new Vector2(5f),
                            Children         = new Drawable[]
                            {
                                name = new OsuSpriteText
                                {
                                    TextSize = 18,
                                },
                                new Container
                                {
                                    RelativeSizeAxes = Axes.X,
                                    Height           = 20f,
                                    Children         = new Drawable[]
                                    {
                                        new FillFlowContainer
                                        {
                                            AutoSizeAxes     = Axes.X,
                                            RelativeSizeAxes = Axes.Y,
                                            Direction        = FillDirection.Horizontal,
                                            Spacing          = new Vector2(5f, 0f),
                                            Children         = new Drawable[]
                                            {
                                                flagContainer = new Container
                                                {
                                                    Width            = 30f,
                                                    RelativeSizeAxes = Axes.Y,
                                                },
                                                new Container
                                                {
                                                    Width            = 40f,
                                                    RelativeSizeAxes = Axes.Y,
                                                },
                                                new OsuSpriteText
                                                {
                                                    Text     = "hosted by",
                                                    Anchor   = Anchor.CentreLeft,
                                                    Origin   = Anchor.CentreLeft,
                                                    TextSize = 14,
                                                },
                                                host = new OsuSpriteText
                                                {
                                                    Anchor   = Anchor.CentreLeft,
                                                    Origin   = Anchor.CentreLeft,
                                                    TextSize = 14,
                                                    Font     = @"Exo2.0-BoldItalic",
                                                },
                                            },
                                        },
                                        rankBounds = new OsuSpriteText
                                        {
                                            Anchor   = Anchor.CentreRight,
                                            Origin   = Anchor.CentreRight,
                                            Text     = "#0 - #0",
                                            TextSize = 14,
                                            Margin   = new MarginPadding {
                                                Right = 10
                                            },
                                        },
                                    },
                                },
                            },
                        },
                        new FillFlowContainer
                        {
                            Anchor           = Anchor.BottomLeft,
                            Origin           = Anchor.BottomLeft,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                            Margin           = new MarginPadding {
                                Bottom = content_padding
                            },
                            Children = new Drawable[]
                            {
                                status = new OsuSpriteText
                                {
                                    TextSize = 14,
                                    Font     = @"Exo2.0-Bold",
                                },
                                beatmapInfoFlow = new FillFlowContainer <OsuSpriteText>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Horizontal,
                                    Children         = new[]
                                    {
                                        beatmapTitle = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-BoldItalic",
                                        },
                                        beatmapDash = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-RegularItalic",
                                        },
                                        beatmapArtist = new OsuSpriteText
                                        {
                                            TextSize = 14,
                                            Font     = @"Exo2.0-RegularItalic",
                                        },
                                    },
                                },
                            },
                        },
                    },
                },
            };

            Room.Name.ValueChanged    += displayName;
            Room.Host.ValueChanged    += displayUser;
            Room.Status.ValueChanged  += displayStatus;
            Room.Beatmap.ValueChanged += displayBeatmap;
        }
Exemplo n.º 8
0
        private void load(OsuColour colours)
        {
            Height = 150;

            InternalChildren = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = colours.GreySeafoamDark,
                },
                new FillFlowContainer
                {
                    Direction = FillDirection.Horizontal,
                    Margin    = new MarginPadding {
                        Left = UserProfileOverlay.CONTENT_X_MARGIN
                    },
                    Height       = avatar_size,
                    AutoSizeAxes = Axes.X,
                    Anchor       = Anchor.CentreLeft,
                    Origin       = Anchor.CentreLeft,
                    Children     = new Drawable[]
                    {
                        avatar = new UpdateableAvatar
                        {
                            Size            = new Vector2(avatar_size),
                            Masking         = true,
                            CornerRadius    = avatar_size * 0.25f,
                            OpenOnClick     = { Value = false },
                            ShowGuestOnNull = false,
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.Y,
                            AutoSizeAxes     = Axes.X,
                            Padding          = new MarginPadding {
                                Left = 10
                            },
                            Children = new Drawable[]
                            {
                                new FillFlowContainer
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Children     = new Drawable[]
                                    {
                                        usernameText = new OsuSpriteText
                                        {
                                            Font = OsuFont.GetFont(size: 24, weight: FontWeight.Regular)
                                        },
                                        openUserExternally = new ExternalLinkButton
                                        {
                                            Margin = new MarginPadding {
                                                Left = 5
                                            },
                                            Anchor = Anchor.CentreLeft,
                                            Origin = Anchor.CentreLeft,
                                        },
                                    }
                                },
                                new FillFlowContainer
                                {
                                    Origin       = Anchor.BottomLeft,
                                    Anchor       = Anchor.BottomLeft,
                                    Direction    = FillDirection.Vertical,
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new Drawable[]
                                    {
                                        titleText = new OsuSpriteText
                                        {
                                            Font = OsuFont.GetFont(size: 18, weight: FontWeight.Regular)
                                        },
                                        supporterTag = new SupporterIcon
                                        {
                                            Height = 20,
                                            Margin = new MarginPadding {
                                                Top = 5
                                            }
                                        },
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            Height           = 1.5f,
                                            Margin           = new MarginPadding {
                                                Top = 10
                                            },
                                            Colour = colours.GreySeafoamLighter,
                                        },
                                        new Container
                                        {
                                            AutoSizeAxes = Axes.Both,
                                            Margin       = new MarginPadding {
                                                Top = 5
                                            },
                                            Children = new Drawable[]
                                            {
                                                userFlag = new UpdateableFlag
                                                {
                                                    Size = new Vector2(30, 20),
                                                    ShowPlaceholderOnNull = false,
                                                },
                                                userCountryText = new OsuSpriteText
                                                {
                                                    Font   = OsuFont.GetFont(size: 17.5f, weight: FontWeight.Regular),
                                                    Margin = new MarginPadding {
                                                        Left = 40
                                                    },
                                                    Origin = Anchor.CentreLeft,
                                                    Anchor = Anchor.CentreLeft,
                                                    Colour = colours.GreySeafoamLighter,
                                                }
                                            }
                                        },
                                    }
                                }
                            }
                        }
                    }
                },
                userStats = new FillFlowContainer
                {
                    Anchor       = Anchor.TopRight,
                    Origin       = Anchor.TopRight,
                    AutoSizeAxes = Axes.Y,
                    Width        = 300,
                    Margin       = new MarginPadding {
                        Right = UserProfileOverlay.CONTENT_X_MARGIN
                    },
                    Padding = new MarginPadding {
                        Vertical = 15
                    },
                    Spacing = new Vector2(0, 2)
                }
            };

            User.BindValueChanged(user => updateUser(user.NewValue));
        }
Exemplo n.º 9
0
        public TopScoreUserSection()
        {
            AutoSizeAxes = Axes.Both;

            InternalChild = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction    = FillDirection.Horizontal,
                Spacing      = new Vector2(10, 0),
                Children     = new Drawable[]
                {
                    new FillFlowContainer
                    {
                        Anchor       = Anchor.Centre,
                        Origin       = Anchor.Centre,
                        AutoSizeAxes = Axes.Both,
                        Direction    = FillDirection.Vertical,
                        Children     = new Drawable[]
                        {
                            rankText = new OsuSpriteText
                            {
                                Anchor = Anchor.Centre,
                                Origin = Anchor.Centre,
                                Font   = OsuFont.GetFont(size: 24, weight: FontWeight.Bold, italics: true)
                            },
                            rank = new UpdateableRank(ScoreRank.D)
                            {
                                Anchor   = Anchor.Centre,
                                Origin   = Anchor.Centre,
                                Size     = new Vector2(40),
                                FillMode = FillMode.Fit,
                            },
                        }
                    },
                    avatar = new UpdateableAvatar(hideImmediately: true)
                    {
                        Anchor       = Anchor.Centre,
                        Origin       = Anchor.Centre,
                        Size         = new Vector2(80),
                        Masking      = true,
                        CornerRadius = 5,
                        EdgeEffect   = new EdgeEffectParameters
                        {
                            Type   = EdgeEffectType.Shadow,
                            Colour = Color4.Black.Opacity(0.25f),
                            Offset = new Vector2(0, 2),
                            Radius = 1,
                        },
                        ShowGuestOnNull = false,
                    },
                    new FillFlowContainer
                    {
                        Anchor       = Anchor.Centre,
                        Origin       = Anchor.Centre,
                        AutoSizeAxes = Axes.Both,
                        Direction    = FillDirection.Vertical,
                        Spacing      = new Vector2(0, 3),
                        Children     = new Drawable[]
                        {
                            usernameText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold, italics: true))
                            {
                                Anchor       = Anchor.CentreLeft,
                                Origin       = Anchor.CentreLeft,
                                AutoSizeAxes = Axes.Both,
                            },
                            date = new OsuSpriteText
                            {
                                Anchor = Anchor.CentreLeft,
                                Origin = Anchor.CentreLeft,
                                Font   = OsuFont.GetFont(size: 15, weight: FontWeight.Bold)
                            },
                            flag = new UpdateableFlag(hideImmediately: true)
                            {
                                Anchor = Anchor.CentreLeft,
                                Origin = Anchor.CentreLeft,
                                Size   = new Vector2(20, 13),
                                ShowPlaceholderOnNull = false,
                            },
                        }
                    }
                }
            };
        }
Exemplo n.º 10
0
        protected override Drawable CreateContent()
        {
            Action <SpriteText> fontParameters = s => s.Font = OsuFont.Default.With(weight: FontWeight.SemiBold);

            return(maskingContainer = new Container
            {
                RelativeSizeAxes = Axes.X,
                Height = HEIGHT,
                Masking = true,
                CornerRadius = 10,
                Children = new Drawable[]
                {
                    new Box // A transparent box that forces the border to be drawn if the panel background is opaque
                    {
                        RelativeSizeAxes = Axes.Both,
                        Alpha = 0,
                        AlwaysPresent = true
                    },
                    panelBackground = new PanelBackground
                    {
                        RelativeSizeAxes = Axes.Both,
                    },
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        ColumnDimensions = new[]
                        {
                            new Dimension(GridSizeMode.AutoSize),
                            new Dimension(),
                            new Dimension(GridSizeMode.AutoSize),
                            new Dimension(GridSizeMode.AutoSize)
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                difficultyIconContainer = new Container
                                {
                                    Anchor = Anchor.CentreLeft,
                                    Origin = Anchor.CentreLeft,
                                    AutoSizeAxes = Axes.Both,
                                    Margin = new MarginPadding {
                                        Left = 8, Right = 8
                                    },
                                },
                                new FillFlowContainer
                                {
                                    Anchor = Anchor.CentreLeft,
                                    Origin = Anchor.CentreLeft,
                                    AutoSizeAxes = Axes.Y,
                                    RelativeSizeAxes = Axes.X,
                                    Direction = FillDirection.Vertical,
                                    Children = new Drawable[]
                                    {
                                        beatmapText = new LinkFlowContainer(fontParameters)
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            // workaround to ensure only the first line of text shows, emulating truncation (but without ellipsis at the end).
                                            // TODO: remove when text/link flow can support truncation with ellipsis natively.
                                            Height = OsuFont.DEFAULT_FONT_SIZE,
                                            Masking = true
                                        },
                                        new FillFlowContainer
                                        {
                                            AutoSizeAxes = Axes.Both,
                                            Direction = FillDirection.Horizontal,
                                            Spacing = new Vector2(10f, 0),
                                            Children = new Drawable[]
                                            {
                                                new FillFlowContainer
                                                {
                                                    AutoSizeAxes = Axes.Both,
                                                    Direction = FillDirection.Horizontal,
                                                    Spacing = new Vector2(10f, 0),
                                                    Children = new Drawable[]
                                                    {
                                                        authorText = new LinkFlowContainer(fontParameters)
                                                        {
                                                            AutoSizeAxes = Axes.Both
                                                        },
                                                        explicitContentPill = new ExplicitContentBeatmapPill
                                                        {
                                                            Alpha = 0f,
                                                            Anchor = Anchor.CentreLeft,
                                                            Origin = Anchor.CentreLeft,
                                                            Margin = new MarginPadding {
                                                                Top = 3f
                                                            },
                                                        }
                                                    },
                                                },
                                                new Container
                                                {
                                                    Anchor = Anchor.CentreLeft,
                                                    Origin = Anchor.CentreLeft,
                                                    AutoSizeAxes = Axes.Both,
                                                    Child = modDisplay = new ModDisplay
                                                    {
                                                        Scale = new Vector2(0.4f),
                                                        ExpansionMode = ExpansionMode.AlwaysExpanded
                                                    }
                                                }
                                            }
                                        }
                                    }
                                },
                                new FillFlowContainer
                                {
                                    Anchor = Anchor.CentreRight,
                                    Origin = Anchor.CentreRight,
                                    Direction = FillDirection.Horizontal,
                                    Margin = new MarginPadding {
                                        Horizontal = 8
                                    },
                                    AutoSizeAxes = Axes.Both,
                                    Spacing = new Vector2(5),
                                    ChildrenEnumerable = CreateButtons().Select(button => button.With(b =>
                                    {
                                        b.Anchor = Anchor.Centre;
                                        b.Origin = Anchor.Centre;
                                    }))
                                },
                                ownerAvatar = new OwnerAvatar
                                {
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,
                                    Size = new Vector2(ICON_HEIGHT),
                                    Margin = new MarginPadding {
                                        Right = 8
                                    },
                                    Masking = true,
                                    CornerRadius = 4,
                                    Alpha = showItemOwner ? 1 : 0
                                },
                            }
                        }
                    },
                }
            });
        }
Exemplo n.º 11
0
        public TopScoreUserSection()
        {
            AutoSizeAxes = Axes.Both;

            InternalChild = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction    = FillDirection.Horizontal,
                Spacing      = new Vector2(10, 0),
                Children     = new Drawable[]
                {
                    new FillFlowContainer
                    {
                        Anchor       = Anchor.Centre,
                        Origin       = Anchor.Centre,
                        AutoSizeAxes = Axes.Both,
                        Direction    = FillDirection.Vertical,
                        Children     = new Drawable[]
                        {
                            rankText = new OsuSpriteText
                            {
                                Anchor = Anchor.Centre,
                                Origin = Anchor.Centre,
                                Font   = OsuFont.GetFont(size: 18, weight: FontWeight.Bold)
                            },
                            rank = new UpdateableRank(ScoreRank.D)
                            {
                                Anchor   = Anchor.Centre,
                                Origin   = Anchor.Centre,
                                Size     = new Vector2(28),
                                FillMode = FillMode.Fit,
                            },
                        }
                    },
                    avatar = new UpdateableAvatar(showGuestOnNull: false)
                    {
                        Anchor       = Anchor.Centre,
                        Origin       = Anchor.Centre,
                        Size         = new Vector2(70),
                        Masking      = true,
                        CornerRadius = 4,
                        EdgeEffect   = new EdgeEffectParameters
                        {
                            Type   = EdgeEffectType.Shadow,
                            Colour = Color4.Black.Opacity(0.25f),
                            Offset = new Vector2(0, 2),
                            Radius = 1,
                        },
                    },
                    new FillFlowContainer
                    {
                        Anchor       = Anchor.Centre,
                        Origin       = Anchor.Centre,
                        AutoSizeAxes = Axes.Both,
                        Direction    = FillDirection.Vertical,
                        Spacing      = new Vector2(0, 3),
                        Children     = new Drawable[]
                        {
                            usernameText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true))
                            {
                                Anchor       = Anchor.CentreLeft,
                                Origin       = Anchor.CentreLeft,
                                AutoSizeAxes = Axes.Both,
                            },
                            new FillFlowContainer
                            {
                                AutoSizeAxes = Axes.Both,
                                Direction    = FillDirection.Horizontal,
                                Anchor       = Anchor.CentreLeft,
                                Origin       = Anchor.CentreLeft,
                                Children     = new[]
                                {
                                    new OsuSpriteText
                                    {
                                        Text = "achieved ",
                                        Font = OsuFont.GetFont(size: 10, weight: FontWeight.Bold)
                                    },
                                    achievedOn = new DrawableDate(DateTimeOffset.MinValue)
                                    {
                                        Font = OsuFont.GetFont(size: 10, weight: FontWeight.Bold)
                                    },
                                }
                            },
                            flag = new UpdateableFlag
                            {
                                Anchor = Anchor.CentreLeft,
                                Origin = Anchor.CentreLeft,
                                Size   = new Vector2(19, 14),
                                Margin = new MarginPadding {
                                    Top = 3
                                },                                      // makes spacing look more even
                                ShowPlaceholderOnNull = false,
                            },
                        }
                    }
                }
            };
        }
Exemplo n.º 12
0
 public DrawableTopScore()
 {
     RelativeSizeAxes = Axes.X;
     Height           = height;
     CornerRadius     = 5;
     BorderThickness  = 4;
     Masking          = true;
     Children         = new Drawable[]
     {
         background = new Box
         {
             RelativeSizeAxes = Axes.Both,
             Alpha            = 0,
             AlwaysPresent    = true, //used for correct border representation
         },
         avatar = new UpdateableAvatar
         {
             Size         = new Vector2(avatar_size),
             Masking      = true,
             CornerRadius = 5,
             EdgeEffect   = new EdgeEffectParameters
             {
                 Type   = EdgeEffectType.Shadow,
                 Colour = Color4.Black.Opacity(0.25f),
                 Offset = new Vector2(0, 2),
                 Radius = 1,
             },
             Margin = new MarginPadding {
                 Top = margin, Left = margin
             }
         },
         flag = new DrawableFlag
         {
             Size     = new Vector2(30, 20),
             Position = new Vector2(margin * 2 + avatar_size, height / 4),
         },
         username = new ClickableUsername
         {
             Origin   = Anchor.BottomLeft,
             TextSize = 30,
             Position = new Vector2(margin * 2 + avatar_size, height / 4),
             Margin   = new MarginPadding {
                 Bottom = 4
             }
         },
         rankText = new OsuSpriteText
         {
             Anchor   = Anchor.TopRight,
             Origin   = Anchor.BottomRight,
             Text     = "#1",
             TextSize = 40,
             Font     = @"Exo2.0-BoldItalic",
             Y        = height / 4,
             Margin   = new MarginPadding {
                 Right = margin
             }
         },
         date = new OsuSpriteText
         {
             Anchor = Anchor.TopRight,
             Origin = Anchor.TopRight,
             Y      = height / 4,
             Margin = new MarginPadding {
                 Right = margin
             }
         },
         new Container
         {
             Anchor           = Anchor.BottomCentre,
             Origin           = Anchor.BottomCentre,
             RelativeSizeAxes = Axes.Both,
             Height           = 0.5f,
             Children         = new Drawable[]
             {
                 bottomBackground = new Box {
                     RelativeSizeAxes = Axes.Both
                 },
                 middleLine = new Box
                 {
                     RelativeSizeAxes = Axes.X,
                     Height           = 1,
                 },
                 rank = new DrawableRank(ScoreRank.F)
                 {
                     Origin   = Anchor.BottomLeft,
                     Size     = new Vector2(avatar_size, 40),
                     FillMode = FillMode.Fit,
                     Y        = height / 4,
                     Margin   = new MarginPadding {
                         Left = margin
                     }
                 },
                 new FillFlowContainer <InfoColumn>
                 {
                     Origin       = Anchor.BottomLeft,
                     AutoSizeAxes = Axes.Both,
                     Position     = new Vector2(height / 2, height / 4),
                     Direction    = FillDirection.Horizontal,
                     Spacing      = new Vector2(15, 0),
                     Children     = new[]
                     {
                         totalScore = new InfoColumn("Score"),
                         accuracy   = new InfoColumn("Accuracy"),
                         statistics = new InfoColumn("300/100/50"),
                     },
                 },
                 modsContainer = new ScoreModsContainer
                 {
                     AutoSizeAxes = Axes.Y,
                     Width        = 80,
                     Position     = new Vector2(height / 2, height / 4),
                 }
             }
         },
     };
 }
        private void load(OsuColour colours)
        {
            InternalChildren = new Drawable[]
            {
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Spacing      = new Vector2(10, 0),
                    Children     = new Drawable[]
                    {
                        avatar = new UpdateableAvatar
                        {
                            Size         = new Vector2(50),
                            Masking      = true,
                            CornerRadius = 10,
                        },
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Vertical,
                            Children     = new Drawable[]
                            {
                                new OsuSpriteText
                                {
                                    Font    = OsuFont.GetFont(size: 30),
                                    Current = { BindTarget = RoomName }
                                },
                                hostText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 20))
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                }
                            }
                        }
                    }
                },
                openSettingsButton = new PurpleTriangleButton
                {
                    Anchor = Anchor.CentreRight,
                    Origin = Anchor.CentreRight,
                    Size   = new Vector2(150, HEIGHT),
                    Text   = "Open settings",
                    Action = () => OpenSettings?.Invoke(),
                    Alpha  = 0
                }
            };

            Host.BindValueChanged(host =>
            {
                avatar.User = host.NewValue;

                hostText.Clear();

                if (host.NewValue != null)
                {
                    hostText.AddText("hosted by ");
                    hostText.AddUserLink(host.NewValue, s => s.Font = s.Font.With(weight: FontWeight.SemiBold));
                }

                openSettingsButton.Alpha = host.NewValue?.Equals(api.LocalUser.Value) == true ? 1 : 0;
            }, true);
        }