Example #1
0
        private void Load(UserManager userManager)
        {
            _activeUser = userManager.User;

            Width  = 256;
            Height = 80;

            _textFlowContainer = new TextFlowContainer
            {
                AutoSizeAxes   = Axes.Both,
                Padding        = new MarginPadding(4),
                OriginPosition = new Vector2(-75, 0)
            };

            _textFlowContainer.AddParagraph($"{_activeUser.Username}", text => text.Font = new FontUsage(size: 24, weight: "Bold"));
            _textFlowContainer.AddParagraph($"Performance: {_activeUser.Statistics.PerformancePoints}pp", text => text.Font = new FontUsage(size: 14));
            _textFlowContainer.AddParagraph($"Accuracy: {_activeUser.Statistics.Accuracy:0.00}%", text => text.Font         = new FontUsage(size: 14));
            _textFlowContainer.AddParagraph($"Level: {_activeUser.Statistics.GetLevel()}", text => text.Font = new FontUsage(size: 14));

            AddRangeInternal(new Drawable[]
            {
                _background = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.White,
                    Alpha            = 0f
                },
                _avatar = new DrawableAvatar(),
                new SpriteText
                {
                    Font   = new FontUsage(size: 32, weight: "Bold"),
                    Colour = Color4.DarkGray,
                    Text   = new LocalisedString("#1"),

                    Anchor   = Anchor.BottomRight,
                    Origin   = Anchor.BottomRight,
                    Padding  = new MarginPadding(0),
                    Position = new Vector2(0, -5)
                },
                _textFlowContainer,
                _levelBar = new DrawableLevelBar(_activeUser)
                {
                    Anchor = Anchor.BottomRight,
                    Origin = Anchor.BottomRight,
                }
            });

            _avatar.User.Value = _activeUser;
        }
        public PrivateChannelTabItem(Channel value)
            : base(value)
        {
            if (value.Type != ChannelType.PM)
                throw new ArgumentException("Argument value needs to have the targettype user!");

            DrawableAvatar avatar;

            AddRange(new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    AutoSizeAxes = Axes.X,
                    Margin = new MarginPadding
                    {
                        Horizontal = 3
                    },
                    Origin = Anchor.BottomLeft,
                    Anchor = Anchor.BottomLeft,
                    Children = new Drawable[]
                    {
                        new CircularContainer
                        {
                            Scale = new Vector2(0.95f),
                            Size = new Vector2(ChatOverlay.TAB_AREA_HEIGHT),
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Masking = true,
                            Child = new DelayedLoadWrapper(avatar = new DrawableAvatar(value.Users.First())
                            {
                                RelativeSizeAxes = Axes.Both,
                                OpenOnClick = { Value = false },
                            })
                            {
                                RelativeSizeAxes = Axes.Both,
                            }
                        },
                    }
                },
            });

            avatar.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint);

            Text.X = ChatOverlay.TAB_AREA_HEIGHT;
            TextBold.X = ChatOverlay.TAB_AREA_HEIGHT;
        }
Example #3
0
        private void load()
        {
            var user = score.User;

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

            DrawableAvatar innerAvatar;

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = rank_width,
                    Children         = new[]
                    {
                        new OsuSpriteText
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Font   = OsuFont.GetFont(size: 22, italics: true),
                            Text   = RankPosition.ToString(),
                        },
                    },
                },
                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           = Color4.Black,
                                    Alpha            = background_alpha,
                                },
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding(edge_margin),
                            Children         = new[]
                            {
                                avatar          = new DelayedLoadWrapper(
                                    innerAvatar = new DrawableAvatar(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 = OsuColour.FromHex(@"83ccfa"),
                                            Text       = score.TotalScore.ToString(@"N0"),
                                            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,
                                    ChildrenEnumerable = score.Mods.Select(mod => new ModIcon(mod)
                                    {
                                        Scale = new Vector2(0.375f)
                                    })
                                },
                            },
                        },
                    },
                },
            };

            innerAvatar.OnLoadComplete += d => d.FadeInFromZero(200);
        }