Ejemplo n.º 1
0
            private void load(OsuColour colours, Framework.Game game)
            {
                Size = new Vector2(60);

                Child = new CircularContainer
                {
                    Masking          = true,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = colours.Gray1,
                            Alpha            = 0.5f,
                        },
                        circularProgress = new CircularProgress
                        {
                            RelativeSizeAxes = Axes.Both,
                            InnerRadius      = 1
                        },
                        overlayCircle = new Circle
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                            RelativeSizeAxes = Axes.Both,
                            Colour           = colours.Gray1,
                            Size             = new Vector2(0.9f),
                        },
                        icon = new SpriteIcon
                        {
                            Shadow = false,
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Size   = new Vector2(15),
                            Icon   = FontAwesome.Solid.Times
                        },
                    }
                };

                bind();

                gameActive.BindTo(game.IsActive);
            }
Ejemplo n.º 2
0
        private void load(TextureStore textures)
        {
            ButtonFlowContainer.Add(editButton = new IconButton(FontAwesome.Solid.Download, Colour4.SkyBlue, true, Colour4.PowderBlue));

            BottomContainer.Add(new SpriteText
            {
                Font = new FontUsage(size: SMALL_TEXT_SIZE),
                Text = @"Este proyecto está en el servidor, descargalo para editarlo!",
            });

            ImageContainer.Add(loadingIcon = new SpriteIcon
            {
                Size             = new Vector2(.7f),
                RelativeSizeAxes = Axes.Both,
                FillMode         = FillMode.Fit,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                Icon             = FontAwesome.Solid.Spinner,
            });

            editButton.Enabled.Value = false;
            loadingIcon.RotateTo(0).Then().RotateTo(360, 1500).Loop();

            ProjectName.Text         = onlineProject.Name;
            ProjectDescription.Text  = onlineProject.Description;
            editButton.Enabled.Value = true;
            Schedule(async() =>
            {
                var texture = await textures.GetAsync(@$ "https://gamestogo.company/api/Games/DownloadFile/{onlineProject.Image}");

                Schedule(() =>
                {
                    ProjectImage.Texture = texture;
                    loadingIcon.FadeOut();
                });
            });

            editButton.Action += downloadProject;

            var userRequest = new GetUserRequest(onlineProject.Creator.ID);

            userRequest.Success += user => UsernameBox.Text = @$ "De {user.Username} (Ultima vez editado {onlineProject.DateTimeLastEdited:dd/MM/yyyy HH:mm}) Estado: {onlineProject.Status.GetDescription()}";
            api.Queue(userRequest);
        }
Ejemplo n.º 3
0
        public PreviewButton()
        {
            Height = 42;

            Children = new Drawable[]
            {
                audioWrapper = new Container(),
                bg           = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black.Opacity(0.25f),
                },
                new Container
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.X,
                    Height           = 3,
                    Child            = progress = new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Width            = 0f,
                        Alpha            = 0f,
                    },
                },
                icon = new SpriteIcon
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Icon   = FontAwesome.fa_play,
                    Size   = new Vector2(18),
                    Shadow = false,
                },
                loadingAnimation = new LoadingAnimation
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                },
            };

            Action = () => Playing = !Playing;
        }
Ejemplo n.º 4
0
 public Saw()
 {
     InternalChildren = new Drawable[]
     {
         outerSawIcon = new SpriteIcon
         {
             Origin           = Anchor.Centre,
             Anchor           = Anchor.Centre,
             Icon             = FontAwesome.Solid.Sun,
             Colour           = Color4.White,
             RelativeSizeAxes = Axes.Both,
             Scale            = new Vector2(1.1f)
         },
         innerSawIcon = new SpriteIcon
         {
             Origin           = Anchor.Centre,
             Anchor           = Anchor.Centre,
             Icon             = FontAwesome.Solid.Sun,
             RelativeSizeAxes = Axes.Both,
         },
         new CircularContainer
         {
             Anchor           = Anchor.Centre,
             Origin           = Anchor.Centre,
             RelativeSizeAxes = Axes.Both,
             BorderThickness  = DrawableNoteSheet.NOTE_SHEET_SIZE * 0.1f,
             BorderColour     = Color4.White,
             Masking          = true,
             Size             = new Vector2(0.75f),
             Children         = new Drawable[]
             {
                 backgroundBox = new Box {
                     RelativeSizeAxes = Axes.Both
                 },
                 triangles = new Triangles {
                     RelativeSizeAxes = Axes.Both
                 }
             }
         }
     };
 }
Ejemplo n.º 5
0
 public BreadcrumbTabItem(T value) : base(value)
 {
     Text.TextSize = 18;
     Text.Margin   = new MarginPadding {
         Vertical = 8
     };
     Padding = new MarginPadding {
         Right = padding + item_chevron_size
     };
     Add(Chevron = new SpriteIcon
     {
         Anchor = Anchor.CentreRight,
         Origin = Anchor.CentreLeft,
         Size   = new Vector2(item_chevron_size),
         Icon   = FontAwesome.fa_chevron_right,
         Margin = new MarginPadding {
             Left = padding
         },
         Alpha = 0f,
     });
 }
Ejemplo n.º 6
0
            public DisplayStyleToggleButton(FontAwesome icon, PanelDisplayStyle style, Bindable <PanelDisplayStyle> bindable)
            {
                this.bindable = bindable;
                this.style    = style;
                Size          = new Vector2(25f);

                Children = new Drawable[]
                {
                    this.icon = new SpriteIcon
                    {
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Icon   = icon,
                        Size   = new Vector2(18),
                        Alpha  = 0.5f,
                    },
                };

                bindable.ValueChanged += Bindable_ValueChanged;
                Bindable_ValueChanged(new ValueChangedEvent <PanelDisplayStyle>(bindable.Value, bindable.Value));
                Action = () => bindable.Value = this.style;
            }
Ejemplo n.º 7
0
        private void load(DrawableHitObject drawableHitObject)
        {
            spinner = (DrawableSpinner)drawableHitObject;

            InternalChildren = new Drawable[]
            {
                glow   = new GlowPiece(),
                circle = new CirclePiece
                {
                    Position = Vector2.Zero,
                    Anchor   = Anchor.Centre,
                },
                new RingPiece(),
                symbol = new SpriteIcon
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Size   = new Vector2(48),
                    Icon   = FontAwesome.Solid.Asterisk,
                    Shadow = false,
                },
            };
        }
Ejemplo n.º 8
0
        public DrawableOrb(Orb hitObject)
            : base(hitObject)
        {
            Size = new Vector2(RushPlayfield.HIT_TARGET_SIZE);

            Content.AddRange(new Drawable[]
            {
                orbSpriteIcon = new SpriteIcon
                {
                    Origin           = Anchor.Centre,
                    Anchor           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    Icon             = FontAwesome.Solid.Cog
                },
                new CircularContainer
                {
                    Origin          = Anchor.Centre,
                    Anchor          = Anchor.Centre,
                    Size            = new Vector2(RushPlayfield.HIT_TARGET_SIZE),
                    Scale           = new Vector2(0.7f),
                    BorderThickness = RushPlayfield.HIT_TARGET_SIZE * 0.1f,
                    BorderColour    = Color4.White,
                    Masking         = true,
                    Children        = new Drawable[]
                    {
                        background = new Box {
                            RelativeSizeAxes = Axes.Both
                        },
                        triangles = new Triangles {
                            RelativeSizeAxes = Axes.Both
                        }
                    }
                },
            });

            AccentColour.ValueChanged += evt => updateColours(evt.NewValue);
        }
Ejemplo n.º 9
0
 private void load()
 {
     AddRange(new Drawable[]
     {
         new Box
         {
             Colour           = FrameworkColour.Green,
             RelativeSizeAxes = Axes.Both
         },
         leftBoxContainer = new Container
         {
             RelativeSizeAxes = Axes.Both,
             Width            = 0,
             Padding          = new MarginPadding {
                 Right = -left_box_width
             },
             Child = new Box
             {
                 Colour           = FrameworkColour.YellowGreen,
                 RelativeSizeAxes = Axes.Both,
             },
         },
         icon = new SpriteIcon
         {
             Size   = new Vector2(10),
             Icon   = FontAwesome.Solid.ChevronDown,
             Colour = Color4.White,
             Y      = -1,
             Margin = new MarginPadding {
                 Right = left_box_width + 5
             },
             Anchor = Anchor.CentreRight,
             Origin = Anchor.CentreRight,
         }
     });
 }
Ejemplo n.º 10
0
        private void load()
        {
            RelativeSizeAxes = Axes.X;
            Height           = 60;
            Children         = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Horizontal = -10
                    },
                    Child = hoverBackground = new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = ColourProvider.Background3,
                        Alpha            = 0
                    }
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Child            = new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        ColumnDimensions = new[]
                        {
                            new Dimension(GridSizeMode.Absolute, 70),
                            new Dimension(),
                            new Dimension(GridSizeMode.AutoSize)
                        },
                        RowDimensions = new[]
                        {
                            new Dimension()
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Masking          = true,
                                    CornerRadius     = 6,
                                    Child            = new UpdateableOnlineBeatmapSetCover
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Anchor           = Anchor.Centre,
                                        Origin           = Anchor.Centre,
                                        OnlineInfo       = BeatmapSet
                                    }
                                },
                                new Container
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Padding          = new MarginPadding {
                                        Horizontal = 10
                                    },
                                    Child = new FillFlowContainer
                                    {
                                        Anchor           = Anchor.CentreLeft,
                                        Origin           = Anchor.CentreLeft,
                                        AutoSizeAxes     = Axes.Y,
                                        RelativeSizeAxes = Axes.X,
                                        Direction        = FillDirection.Vertical,
                                        Children         = new Drawable[]
                                        {
                                            new OsuSpriteText
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                Truncate         = true,
                                                Font             = OsuFont.GetFont(weight: FontWeight.Regular),
                                                Text             = BeatmapSet.Title
                                            },
                                            new OsuSpriteText
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                Truncate         = true,
                                                Font             = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
                                                Text             = BeatmapSet.Artist
                                            },
                                            new LinkFlowContainer(f => f.Font = OsuFont.GetFont(size: 10, weight: FontWeight.Regular))
                                            {
                                                AutoSizeAxes     = Axes.Y,
                                                RelativeSizeAxes = Axes.X,
                                                Spacing          = new Vector2(3),
                                                Margin           = new MarginPadding {
                                                    Top = 2
                                                }
                                            }.With(c =>
                                            {
                                                c.AddText("by");
                                                c.AddUserLink(BeatmapSet.Author);
                                                c.AddArbitraryDrawable(CreateInfo());
                                            })
                                        }
                                    }
                                },
                                chevron = new SpriteIcon
                                {
                                    Anchor = Anchor.CentreRight,
                                    Origin = Anchor.CentreRight,
                                    Size   = new Vector2(16),
                                    Icon   = FontAwesome.Solid.ChevronRight,
                                    Colour = ColourProvider.Foreground1
                                }
                            }
                        }
                    }
                }
            };

            Action = () =>
            {
                if (BeatmapSet.OnlineID > 0)
                {
                    beatmapOverlay?.FetchAndShowBeatmapSet(BeatmapSet.OnlineID);
                }
            };
        }
Ejemplo n.º 11
0
        private void load(OsuColour colours, IAPIProvider api)
        {
            InternalChildren = new Drawable[]
            {
                icon = new SpriteIcon
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Icon   = FontAwesome.Solid.ExclamationTriangle,
                    Size   = new Vector2(icon_size),
                    Y      = icon_y,
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Y        = icon_y + icon_size,
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.TopCentre,
                    Children = new Drawable[]
                    {
                        textFlow = new LinkFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            TextAnchor       = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Origin           = Anchor.TopCentre,
                            Spacing          = new Vector2(0, 2),
                        },
                        supportFlow = new LinkFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            TextAnchor       = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Origin           = Anchor.TopCentre,
                            Alpha            = 0,
                            Spacing          = new Vector2(0, 2),
                        },
                    }
                }
            };

            textFlow.AddText("This is ", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.Light));
            textFlow.AddText("Powerlated's OSU CHEAT", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.SemiBold));

            textFlow.AddParagraph("Things may not work as expected", t => t.Font = t.Font.With(size: 20));
            textFlow.NewParagraph();

            Action <SpriteText> format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold);

            textFlow.AddParagraph("Don't ask.", format);
            textFlow.NewParagraph();

            textFlow.NewParagraph();
            textFlow.NewParagraph();
            textFlow.NewParagraph();

            iconColour = colours.Yellow;

            currentUser.BindTo(api.LocalUser);
            currentUser.BindValueChanged(e =>
            {
                supportFlow.Children.ForEach(d => d.FadeOut().Expire());

                if (e.NewValue.IsSupporter)
                {
                    supportFlow.AddText("Thank you for supporting osu!", format);
                }
                else
                {
                    supportFlow.AddText("Consider sucking on ", format);
                    supportFlow.AddLink("my!c**k", "https://pornhub.com", creationParameters: format);
                    supportFlow.AddText(" to make me nut", format);
                }

                heart = supportFlow.AddIcon(FontAwesome.Solid.Heart, t =>
                {
                    t.Padding = new MarginPadding {
                        Left = 5
                    };
                    t.Font   = t.Font.With(size: 12);
                    t.Origin = Anchor.Centre;
                    t.Colour = colours.Pink;
                }).First();

                if (IsLoaded)
                {
                    animateHeart();
                }

                if (supportFlow.IsPresent)
                {
                    supportFlow.FadeInFromZero(500);
                }
            }, true);
        }
Ejemplo n.º 12
0
        public DrawableSpinner(Spinner s)
            : base(s)
        {
            Origin   = Anchor.Centre;
            Position = s.Position;

            RelativeSizeAxes = Axes.Both;

            // we are slightly bigger than our parent, to clip the top and bottom of the circle
            Height = 1.3f;

            Spinner = s;

            InternalChildren = new Drawable[]
            {
                circleContainer = new Container
                {
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.Centre,
                    Origin       = Anchor.Centre,
                    Children     = new Drawable[]
                    {
                        glow   = new GlowPiece(),
                        circle = new CirclePiece
                        {
                            Position = Vector2.Zero,
                            Anchor   = Anchor.Centre,
                        },
                        new RingPiece(),
                        symbol = new SpriteIcon
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Size   = new Vector2(48),
                            Icon   = FontAwesome.Solid.Asterisk,
                            Shadow = false,
                        },
                    }
                },
                mainContainer = new AspectContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Y,
                    Children         = new[]
                    {
                        Background = new SpinnerBackground
                        {
                            Alpha  = 0.6f,
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                        },
                        Disc = new SpinnerDisc(Spinner)
                        {
                            Scale  = Vector2.Zero,
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                        },
                        circleContainer.CreateProxy(),
                        Ticks = new SpinnerTicks
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                        },
                    }
                },
                SpmCounter = new SpinnerSpmCounter
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Y      = 120,
                    Alpha  = 0
                }
            };
        }
Ejemplo n.º 13
0
        private void load(OsuColour colours, OsuConfigManager config)
        {
            overlayDim.BindTo(config.GetBindable <double>(OsuSetting.OverlayDim));
            InternalChild = new FillFlowContainer
            {
                AutoSizeAxes = Axes.X,
                Height       = bar_height,
                Direction    = FillDirection.Horizontal,
                Spacing      = new Vector2(spacing, 0),
                Margin       = new MarginPadding(2),
                Alpha        = 1 - (float)overlayDim.Value,
                Children     = new Drawable[]
                {
                    judgementsContainer = new Container
                    {
                        Anchor           = Anchor.y1 | alignment,
                        Origin           = Anchor.y1 | alignment,
                        Width            = judgement_line_width,
                        RelativeSizeAxes = Axes.Y,
                    },
                    colourBars = new Container
                    {
                        Width            = bar_width,
                        RelativeSizeAxes = Axes.Y,
                        Anchor           = Anchor.y1 | alignment,
                        Origin           = Anchor.y1 | alignment,
                        Alpha            = 1 - (float)overlayDim.Value,
                        Children         = new Drawable[]
                        {
                            colourBarsEarly = new Container
                            {
                                Anchor           = Anchor.y1 | alignment,
                                Origin           = alignment,
                                RelativeSizeAxes = Axes.Both,
                                Height           = 0.5f,
                                Scale            = new Vector2(1, -1),
                                Alpha            = 1 - (float)overlayDim.Value,
                            },
                            colourBarsLate = new Container
                            {
                                Anchor           = Anchor.y1 | alignment,
                                Origin           = alignment,
                                RelativeSizeAxes = Axes.Both,
                                Height           = 0.5f,
                                Alpha            = 1 - (float)overlayDim.Value,
                            },
                            new SpriteIcon
                            {
                                Y      = -10,
                                Size   = new Vector2(10),
                                Icon   = FontAwesome.Solid.ShippingFast,
                                Anchor = Anchor.TopCentre,
                                Origin = Anchor.TopCentre,
                            },
                            new SpriteIcon
                            {
                                Y      = 10,
                                Size   = new Vector2(10),
                                Icon   = FontAwesome.Solid.Bicycle,
                                Anchor = Anchor.BottomCentre,
                                Origin = Anchor.BottomCentre,
                            }
                        }
                    },
                    new Container
                    {
                        Anchor           = Anchor.y1 | alignment,
                        Origin           = Anchor.y1 | alignment,
                        Width            = chevron_size,
                        RelativeSizeAxes = Axes.Y,
                        Child            = arrow = new SpriteIcon
                        {
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.Centre,
                            RelativePositionAxes = Axes.Y,
                            Y    = 0.5f,
                            Icon = alignment == Anchor.x2 ? FontAwesome.Solid.ChevronRight : FontAwesome.Solid.ChevronLeft,
                            Size = new Vector2(chevron_size),
                        }
                    },
                }
            };

            createColourBars(colours);
        }
Ejemplo n.º 14
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(30, 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),
                        },
                    },
                }
            };
        }
Ejemplo n.º 15
0
        private void load()
        {
            Masking      = true;
            CornerRadius = 5;
            Anchor       = Anchor.CentreRight;
            Origin       = Anchor.CentreRight;
            Size         = new Vector2(35 * 1.5f, 35);
            Children     = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = backgroundColour,
                },
                hoverBox = new Box
                {
                    Alpha            = 0,
                    RelativeSizeAxes = Axes.Both,
                    Colour           = buttonColour,
                },
                progressBox = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = progressColour,
                    Width            = 0,
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding(5),
                    Children         = new[]
                    {
                        loadingIcon = new SpriteIcon
                        {
                            RelativeSizeAxes = Axes.Both,
                            Icon             = FontAwesome.Solid.Spinner,
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.Centre,
                            Alpha            = 0,
                        },
                        icon = new SpriteIcon
                        {
                            RelativeSizeAxes = Axes.Both,
                            Icon             = buttonIcon,
                        },
                    },
                },
            };

            Enabled.ValueChanged += e =>
            {
                if (IsHovered && e.NewValue)
                {
                    fadeToColour();
                }
                else
                {
                    fadeToWait();
                }
            };
        }
Ejemplo n.º 16
0
 protected SpriteIcon CreateStatusIcon() => statusIcon = new SpriteIcon
 {
     Icon = FontAwesome.Regular.Circle,
     Size = new Vector2(25)
 };
Ejemplo n.º 17
0
        private void load(OsuColour colours, IAPIProvider api)
        {
            InternalChildren = new Drawable[]
            {
                icon = new SpriteIcon
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Icon   = FontAwesome.Solid.ExclamationTriangle,
                    Size   = new Vector2(icon_size),
                    Y      = icon_y,
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Y        = icon_y + icon_size,
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.TopCentre,
                    Children = new Drawable[]
                    {
                        textFlow = new LinkFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            TextAnchor       = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Origin           = Anchor.TopCentre,
                            Spacing          = new Vector2(0, 2),
                        },
                        supportFlow = new LinkFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            TextAnchor       = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Origin           = Anchor.TopCentre,
                            Alpha            = 0,
                            Spacing          = new Vector2(0, 2),
                        },
                    }
                }
            };

            textFlow.AddText("这是一个 ", t => t.Font     = t.Font.With(Typeface.Exo, 30, FontWeight.Light));
            textFlow.AddText("非常早期的构建版本", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.SemiBold));

            textFlow.AddParagraph("一些事情可能不会按预期工作", t => t.Font = t.Font.With(size: 20));
            textFlow.NewParagraph();

            Action <SpriteText> format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold);

            textFlow.AddParagraph("欢迎来到github的issues页进行反馈", format);
            textFlow.NewParagraph();

            textFlow.AddText("访问 ", format);
            textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy", creationParameters: format);
            textFlow.AddText("来一起帮助开发或获取最新进度!", format);

            textFlow.NewParagraph();
            textFlow.NewParagraph();
            textFlow.NewParagraph();

            iconColour = colours.Yellow;

            currentUser.BindTo(api.LocalUser);
            currentUser.BindValueChanged(e =>
            {
                supportFlow.Children.ForEach(d => d.FadeOut().Expire());

                if (e.NewValue.IsSupporter)
                {
                    supportFlow.AddText("感谢支持osu!", format);
                }
                else
                {
                    supportFlow.AddText("考虑成为一名 ", format);
                    supportFlow.AddLink("osu!supporter", "https://osu.ppy.sh/home/support", creationParameters: format);
                    supportFlow.AddText("来帮助我们维护这个游戏", format);
                }

                heart = supportFlow.AddIcon(FontAwesome.Solid.Heart, t =>
                {
                    t.Padding = new MarginPadding {
                        Left = 5
                    };
                    t.Font   = t.Font.With(size: 12);
                    t.Origin = Anchor.Centre;
                    t.Colour = colours.Pink;
                }).First();

                if (IsLoaded)
                {
                    animateHeart();
                }

                if (supportFlow.IsPresent)
                {
                    supportFlow.FadeInFromZero(500);
                }
            }, true);
        }
Ejemplo n.º 18
0
        public PopupDialog()
        {
            RelativeSizeAxes = Axes.Both;

            Children = new Drawable[]
            {
                content = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    Width            = 0.4f,
                    Alpha            = 0f,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Masking          = true,
                            EdgeEffect       = new EdgeEffectParameters
                            {
                                Type   = EdgeEffectType.Shadow,
                                Colour = Color4.Black.Opacity(0.5f),
                                Radius = 8,
                            },
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = OsuColour.FromHex(@"221a21"),
                                },
                                new Triangles
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    ColourLight      = OsuColour.FromHex(@"271e26"),
                                    ColourDark       = OsuColour.FromHex(@"1e171e"),
                                    TriangleScale    = 4,
                                },
                            },
                        },
                        new FillFlowContainer
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.BottomCentre,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Position         = new Vector2(0f, -50f),
                            Direction        = FillDirection.Vertical,
                            Spacing          = new Vector2(0f, 10f),
                            Children         = new Drawable[]
                            {
                                new Container
                                {
                                    Origin = Anchor.TopCentre,
                                    Anchor = Anchor.TopCentre,
                                    Size   = ringSize,
                                    Margin = new MarginPadding
                                    {
                                        Bottom = 30,
                                    },
                                    Children = new Drawable[]
                                    {
                                        ring = new CircularContainer
                                        {
                                            Origin          = Anchor.Centre,
                                            Anchor          = Anchor.Centre,
                                            Masking         = true,
                                            BorderColour    = Color4.White,
                                            BorderThickness = 5f,
                                            Children        = new Drawable[]
                                            {
                                                new Box
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Colour           = Color4.Black.Opacity(0),
                                                },
                                                icon = new SpriteIcon
                                                {
                                                    Origin = Anchor.Centre,
                                                    Anchor = Anchor.Centre,
                                                    Icon   = FontAwesome.fa_close,
                                                    Size   = new Vector2(50),
                                                },
                                            },
                                        },
                                    },
                                },
                                header = new OsuSpriteText
                                {
                                    Origin   = Anchor.TopCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Text     = @"Header",
                                    TextSize = 25,
                                    Shadow   = true,
                                },
                                body = new OsuSpriteText
                                {
                                    Origin   = Anchor.TopCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Text     = @"Body",
                                    TextSize = 18,
                                    Shadow   = true,
                                },
                            },
                        },
                        buttonsContainer = new FillFlowContainer <PopupDialogButton>
                        {
                            Anchor           = Anchor.Centre,
                            Origin           = Anchor.TopCentre,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Direction        = FillDirection.Vertical,
                        },
                    },
                },
            };
        }
Ejemplo n.º 19
0
            public WedgeButton()
            {
                Child = new Container
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomCentre,
                    RelativeSizeAxes = Axes.Y,
                    Width            = 100,
                    Shear            = new Vector2(-0.1f, 0),
                    Masking          = true,
                    Child            = clickCon = new ClickableContainer
                    {
                        Shear      = new Vector2(0.1f, 0),
                        Anchor     = Anchor.BottomRight,
                        Origin     = Anchor.BottomRight,
                        Size       = new Vector2(wedge_width * 1.1f),
                        Action     = () => Action?.Invoke(),
                        Masking    = true,
                        EdgeEffect = new EdgeEffectParameters
                        {
                            Colour = Color4.Black.Opacity(0.05f),
                            Type   = EdgeEffectType.Shadow,
                            Radius = 10
                        },
                        Children = new Drawable[]
                        {
                            background = new Box
                            {
                                Anchor           = Anchor.BottomRight,
                                Origin           = Anchor.BottomRight,
                                RelativeSizeAxes = Axes.Both,
                                Shear            = new Vector2(-0.05f, 0.05f),
                                Width            = 0.95f,
                                Colour           = ActiveColour,
                                EdgeSmoothness   = Vector2.One
                            },
                            new Box
                            {
                                Anchor           = Anchor.BottomRight,
                                Origin           = Anchor.BottomRight,
                                RelativeSizeAxes = Axes.Both,
                                Shear            = new Vector2(-0.05f, 0.05f),
                                Width            = 0.95f,
                                Colour           = Color4.White.Opacity(0.1f),
                                Alpha            = 0
                            },
                            ButtonIcon = new SpriteIcon
                            {
                                RelativeSizeAxes = Axes.Both,
                                Y        = -10,
                                Anchor   = Anchor.Centre,
                                Origin   = Anchor.Centre,
                                FillMode = FillMode.Fit,
                                Colour   = Color4.White
                            },
                            buttonText = new SpriteText
                            {
                                Y              = 25,
                                Shadow         = true,
                                AllowMultiline = false,
                                Anchor         = Anchor.Centre,
                                Origin         = Anchor.Centre,
                                TextSize       = 20
                            }
                        }
                    }
                };

                buttonText.Hide();
            }
Ejemplo n.º 20
0
            private void load()
            {
                AutoSizeAxes = Axes.X;
                Height       = tagSelection.TagSize;

                Children = new Drawable[]
                {
                    backgroundBox = new Box
                    {
                        RelativeSizeAxes = Axes.Y,
                        Colour           = new Colour4(50, 50, 50, 255),
                        Alpha            = 0.8f,
                    },
                    iconContainer = new Container
                    {
                        Anchor           = Anchor.CentreRight,
                        Origin           = Anchor.CentreRight,
                        RelativeSizeAxes = Axes.Both,
                        FillMode         = FillMode.Fit,
                        Margin           = new MarginPadding {
                            Horizontal = 5
                        },
                        Alpha    = 0f,
                        Children = new Drawable[]
                        {
                            new SpriteIcon
                            {
                                Anchor           = Anchor.Centre,
                                Origin           = Anchor.Centre,
                                RelativeSizeAxes = Axes.Both,
                                Size             = new Vector2(0.85f),
                                Icon             = FontAwesome.Regular.Square,
                            },
                            activeIcon = new SpriteIcon
                            {
                                Anchor           = Anchor.Centre,
                                Origin           = Anchor.Centre,
                                RelativeSizeAxes = Axes.Both,
                                Size             = new Vector2(0.6f),
                                Icon             = FontAwesome.Solid.Check,
                                Alpha            = 0,
                            },
                        },
                    },
                    content = new FillFlowContainer
                    {
                        AutoSizeAxes     = Axes.X,
                        RelativeSizeAxes = Axes.Y,
                        Padding          = new MarginPadding {
                            Horizontal = 5
                        },
                        Children = new Drawable[]
                        {
                            new SpriteText
                            {
                                Anchor = Anchor.CentreLeft,
                                Origin = Anchor.CentreLeft,
                                Text   = Value.GetDescription(),
                                Font   = new FontUsage(size: tagSelection.TagSize),
                            },
                            layoutContainer = new Container
                            {
                                Anchor           = Anchor.CentreLeft,
                                Origin           = Anchor.CentreLeft,
                                RelativeSizeAxes = Axes.Y,
                                Height           = 1,
                                Width            = 0,
                            },
                        },
                    },
                };

                Action = () => Selected.Value = !Selected.Value;

                Invalidate();

                Selected.BindValueChanged(s => updateVisibility());
            }
Ejemplo n.º 21
0
        private void load(OsuColour colours)
        {
            InternalChild = new FillFlowContainer
            {
                AutoSizeAxes = Axes.X,
                Height       = bar_height,
                Direction    = FillDirection.Horizontal,
                Spacing      = new Vector2(spacing, 0),
                Margin       = new MarginPadding(2),
                Children     = new Drawable[]
                {
                    judgementsContainer = new Container
                    {
                        Anchor           = Anchor.y1 | alignment,
                        Origin           = Anchor.y1 | alignment,
                        Width            = judgement_line_width,
                        RelativeSizeAxes = Axes.Y,
                    },
                    colourBars = new Container
                    {
                        Width            = bar_width,
                        RelativeSizeAxes = Axes.Y,
                        Anchor           = Anchor.y1 | alignment,
                        Origin           = Anchor.y1 | alignment,
                        Children         = new Drawable[]
                        {
                            colourBarsEarly = new Container
                            {
                                Anchor           = Anchor.y1 | alignment,
                                Origin           = alignment,
                                RelativeSizeAxes = Axes.Both,
                                Height           = 0.5f,
                                Scale            = new Vector2(1, -1),
                            },
                            colourBarsLate = new Container
                            {
                                Anchor           = Anchor.y1 | alignment,
                                Origin           = alignment,
                                RelativeSizeAxes = Axes.Both,
                                Height           = 0.5f,
                            },
                            new SpriteIcon
                            {
                                Y      = -10,
                                Size   = new Vector2(10),
                                Icon   = FontAwesome.Solid.ShippingFast,
                                Anchor = Anchor.TopCentre,
                                Origin = Anchor.Centre,
                                // undo any layout rotation to display the icon the correct orientation
                                Rotation = -Rotation,
                            },
                            new SpriteIcon
                            {
                                Y      = 10,
                                Size   = new Vector2(10),
                                Icon   = FontAwesome.Solid.Bicycle,
                                Anchor = Anchor.BottomCentre,
                                Origin = Anchor.Centre,
                                // undo any layout rotation to display the icon the correct orientation
                                Rotation = -Rotation,
                            }
                        }
                    },
                    new Container
                    {
                        Anchor           = Anchor.y1 | alignment,
                        Origin           = Anchor.y1 | alignment,
                        Width            = chevron_size,
                        RelativeSizeAxes = Axes.Y,
                        Child            = arrow = new SpriteIcon
                        {
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.Centre,
                            RelativePositionAxes = Axes.Y,
                            Y    = 0.5f,
                            Icon = alignment == Anchor.x2 ? FontAwesome.Solid.ChevronRight : FontAwesome.Solid.ChevronLeft,
                            Size = new Vector2(chevron_size),
                        }
                    },
                }
            };

            createColourBars(colours);
        }
Ejemplo n.º 22
0
        private void load()
        {
            const int   centre_marker_size = 8;
            const int   bar_height         = 200;
            const int   bar_width          = 2;
            const float chevron_size       = 8;
            const float icon_size          = 14;

            var hitWindows = HitWindows.GetAllAvailableWindows().ToArray();

            InternalChild = new Container
            {
                AutoSizeAxes = Axes.X,
                Height       = bar_height,
                Margin       = new MarginPadding(2),
                Children     = new Drawable[]
                {
                    colourBars = new Container
                    {
                        Name             = "colour axis",
                        X                = chevron_size,
                        Anchor           = Anchor.CentreLeft,
                        Origin           = Anchor.CentreLeft,
                        Width            = judgement_line_width,
                        RelativeSizeAxes = Axes.Y,
                        Children         = new Drawable[]
                        {
                            iconEarly = new SpriteIcon
                            {
                                Y      = -10,
                                Size   = new Vector2(icon_size),
                                Icon   = FontAwesome.Solid.ShippingFast,
                                Anchor = Anchor.TopCentre,
                                Origin = Anchor.Centre,
                            },
                            iconLate = new SpriteIcon
                            {
                                Y      = 10,
                                Size   = new Vector2(icon_size),
                                Icon   = FontAwesome.Solid.Bicycle,
                                Anchor = Anchor.BottomCentre,
                                Origin = Anchor.Centre,
                            },
                            colourBarsEarly = new Container
                            {
                                Anchor           = Anchor.Centre,
                                Origin           = Anchor.TopCentre,
                                Width            = bar_width,
                                RelativeSizeAxes = Axes.Y,
                                Height           = 0.5f,
                                Scale            = new Vector2(1, -1),
                            },
                            colourBarsLate = new Container
                            {
                                Anchor           = Anchor.Centre,
                                Origin           = Anchor.TopCentre,
                                Width            = bar_width,
                                RelativeSizeAxes = Axes.Y,
                                Height           = 0.5f,
                            },
                            new Circle
                            {
                                Name   = "middle marker behind",
                                Colour = GetColourForHitResult(hitWindows.Last().result),
                                Anchor = Anchor.Centre,
                                Origin = Anchor.Centre,
                                Size   = new Vector2(centre_marker_size),
                            },
                            judgementsContainer = new Container
                            {
                                Name             = "judgements",
                                Anchor           = Anchor.TopCentre,
                                Origin           = Anchor.TopCentre,
                                RelativeSizeAxes = Axes.Y,
                                Width            = judgement_line_width,
                            },
                            new Circle
                            {
                                Name   = "middle marker in front",
                                Colour = GetColourForHitResult(hitWindows.Last().result).Darken(0.3f),
                                Anchor = Anchor.Centre,
                                Origin = Anchor.Centre,
                                Size   = new Vector2(centre_marker_size),
                                Scale  = new Vector2(0.5f),
                            },
                        }
                    },
                    new Container
                    {
                        Name             = "average chevron",
                        Anchor           = Anchor.CentreLeft,
                        Origin           = Anchor.CentreLeft,
                        Width            = chevron_size,
                        RelativeSizeAxes = Axes.Y,
                        Child            = arrow = new SpriteIcon
                        {
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.Centre,
                            RelativePositionAxes = Axes.Y,
                            Y    = 0.5f,
                            Icon = FontAwesome.Solid.ChevronRight,
                            Size = new Vector2(chevron_size),
                        }
                    },
                }
            };

            createColourBars(hitWindows);
        }
Ejemplo n.º 23
0
 protected override void LoadTheme(UITheme theme, bool fade)
 {
     this.TweenOrSet(nameof(FlashColour), theme.ButtonSelected, fade);
     Background.TweenOrSet(nameof(Background.Colour), theme.ButtonBackground, fade);
     SpriteIcon.TweenOrSet(nameof(SpriteIcon.Colour), theme.ForegroundColour, fade);
 }
            public CurveVisualiser()
            {
                easingFunction = new CustomEasingFunction {
                    EasingVertices = { BindTarget = easingVertices }
                };

                Container gridContainer;

                InternalChildren = new Drawable[]
                {
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Masking          = true,
                        BorderColour     = Color4.White,
                        BorderThickness  = 2,
                        Child            = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Alpha            = 0,
                            AlwaysPresent    = true
                        }
                    },
                    gridContainer = new Container {
                        RelativeSizeAxes = Axes.Both
                    },
                    path = new SmoothPath
                    {
                        PathRadius = 1
                    },
                    controlPointContainer = new Container <ControlPointVisualiser> {
                        RelativeSizeAxes = Axes.Both
                    },
                    sideTracker = new SpriteIcon
                    {
                        Anchor = Anchor.TopRight,
                        Origin = Anchor.BottomCentre,
                        RelativePositionAxes = Axes.Y,
                        Size     = new Vector2(10),
                        X        = 2,
                        Colour   = Color4.SkyBlue,
                        Rotation = 90,
                        Icon     = FontAwesome.Solid.MapMarker,
                    },
                    verticalTracker = new Box
                    {
                        Origin               = Anchor.CentreLeft,
                        RelativeSizeAxes     = Axes.X,
                        RelativePositionAxes = Axes.Y,
                        Height               = 1,
                        Colour               = Color4.SkyBlue
                    },
                    horizontalTracker = new Box
                    {
                        Origin               = Anchor.TopCentre,
                        RelativeSizeAxes     = Axes.Y,
                        RelativePositionAxes = Axes.X,
                        Width  = 1,
                        Colour = Color4.SkyBlue
                    }
                };

                for (int i = 0; i <= 10; i++)
                {
                    gridContainer.Add(new Box
                    {
                        Origin               = Anchor.CentreLeft,
                        RelativeSizeAxes     = Axes.X,
                        RelativePositionAxes = Axes.Y,
                        Height               = 2,
                        Y      = 0.1f * i,
                        Colour = Color4.White.Opacity(0.1f)
                    });

                    gridContainer.Add(new Box
                    {
                        Origin               = Anchor.TopCentre,
                        RelativeSizeAxes     = Axes.Y,
                        RelativePositionAxes = Axes.X,
                        Width  = 2,
                        X      = 0.1f * i,
                        Colour = Color4.White.Opacity(0.1f)
                    });
                }

                controlPointContainer.Add(new ControlPointVisualiser
                {
                    PointPosition = { Value = new Vector2(100, 100) }
                });
            }
Ejemplo n.º 25
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
                                },
                            }
                        }
                    }
                }
            };
        }
Ejemplo n.º 26
0
        private void load(OsuColour colours, IAPIProvider api)
        {
            InternalChildren = new Drawable[]
            {
                icon = new SpriteIcon
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Icon   = FontAwesome.Solid.ExclamationTriangle,
                    Size   = new Vector2(icon_size),
                    Y      = icon_y,
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Y        = icon_y + icon_size,
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.TopCentre,
                    Children = new Drawable[]
                    {
                        textFlow = new LinkFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            TextAnchor       = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Origin           = Anchor.TopCentre,
                            Spacing          = new Vector2(0, 2),
                        },
                        supportFlow = new LinkFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            TextAnchor       = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Origin           = Anchor.TopCentre,
                            Alpha            = 0,
                            Spacing          = new Vector2(0, 2),
                        },
                    }
                }
            };

            textFlow.AddText("This is an ", t => t.Font             = t.Font.With(Typeface.Exo, 30, FontWeight.Light));
            textFlow.AddText("early development build", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.SemiBold));

            textFlow.AddParagraph("Things may not work as expected", t => t.Font = t.Font.With(size: 20));
            textFlow.NewParagraph();

            Action <SpriteText> format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold);

            textFlow.AddParagraph("Detailed bug reports are welcomed via github issues.", format);
            textFlow.NewParagraph();

            textFlow.AddText("Visit ", format);
            textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy", creationParameters: format);
            textFlow.AddText(" to help out or follow progress!", format);

            textFlow.NewParagraph();
            textFlow.NewParagraph();
            textFlow.NewParagraph();

            iconColour = colours.Yellow;

            currentUser.BindTo(api.LocalUser);
            currentUser.BindValueChanged(e =>
            {
                supportFlow.Children.ForEach(d => d.FadeOut().Expire());

                if (e.NewValue.IsSupporter)
                {
                    supportFlow.AddText("Thank you for supporting osu!", format);
                }
                else
                {
                    supportFlow.AddText("Consider becoming an ", format);
                    supportFlow.AddLink("osu!supporter", "https://osu.ppy.sh/home/support", creationParameters: format);
                    supportFlow.AddText(" to help support the game", format);
                }

                heart = supportFlow.AddIcon(FontAwesome.Solid.Heart, t =>
                {
                    t.Padding = new MarginPadding {
                        Left = 5
                    };
                    t.Font   = t.Font.With(size: 12);
                    t.Origin = Anchor.Centre;
                    t.Colour = colours.Pink;
                }).First();

                if (IsLoaded)
                {
                    animateHeart();
                }

                if (supportFlow.IsPresent)
                {
                    supportFlow.FadeInFromZero(500);
                }
            }, true);
        }
Ejemplo n.º 27
0
        public ChannelListItem(Channel channel)
        {
            this.channel = channel;

            RelativeSizeAxes = Axes.X;
            AutoSizeAxes     = Axes.Y;

            Action = () => { (channel.Joined ? OnRequestLeave : OnRequestJoin)?.Invoke(channel); };

            Children = new Drawable[]
            {
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Horizontal,
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            Children = new[]
                            {
                                joinedCheckmark = new SpriteIcon
                                {
                                    Anchor = Anchor.TopRight,
                                    Origin = Anchor.TopRight,
                                    Icon   = FontAwesome.fa_check_circle,
                                    Size   = new Vector2(text_size),
                                    Shadow = false,
                                    Margin = new MarginPadding {
                                        Right = 10f
                                    },
                                },
                            },
                        },
                        new Container
                        {
                            Width        = channel_width,
                            AutoSizeAxes = Axes.Y,
                            Children     = new[]
                            {
                                name = new OsuSpriteText
                                {
                                    Text     = channel.ToString(),
                                    TextSize = text_size,
                                    Font     = @"Exo2.0-Bold",
                                    Shadow   = false,
                                },
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Width            = 0.7f,
                            AutoSizeAxes     = Axes.Y,
                            Margin           = new MarginPadding {
                                Left = width_padding
                            },
                            Children = new[]
                            {
                                topic = new OsuSpriteText
                                {
                                    Text     = channel.Topic,
                                    TextSize = text_size,
                                    Font     = @"Exo2.0-SemiBold",
                                    Shadow   = false,
                                },
                            },
                        },
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Horizontal,
                            Margin       = new MarginPadding {
                                Left = width_padding
                            },
                            Spacing  = new Vector2(3f, 0f),
                            Children = new Drawable[]
                            {
                                new SpriteIcon
                                {
                                    Icon   = FontAwesome.fa_user,
                                    Size   = new Vector2(text_size - 2),
                                    Shadow = false,
                                    Margin = new MarginPadding {
                                        Top = 1
                                    },
                                },
                                new OsuSpriteText
                                {
                                    Text     = @"0",
                                    TextSize = text_size,
                                    Font     = @"Exo2.0-SemiBold",
                                    Shadow   = false,
                                },
                            },
                        },
                    },
                },
            };
        }
Ejemplo n.º 28
0
        public Disclaimer()
        {
            ValidForResume = false;

            Children = new Drawable[]
            {
                new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.Centre,
                    Origin       = Anchor.Centre,
                    Direction    = FillDirection.Vertical,
                    Spacing      = new Vector2(0, 2),
                    Children     = new Drawable[]
                    {
                        icon = new SpriteIcon
                        {
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,
                            Icon   = FontAwesome.fa_warning,
                            Size   = new Vector2(30),
                        },
                        new OsuSpriteText
                        {
                            Anchor   = Anchor.TopCentre,
                            Origin   = Anchor.TopCentre,
                            TextSize = 30,
                            Text     = "This is a development build",
                            Margin   = new MarginPadding
                            {
                                Bottom = 20
                            },
                        },
                        new OsuSpriteText
                        {
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,
                            Text   = "Don't expect shit to work perfectly as this is very much a work in progress."
                        },
                        new OsuSpriteText
                        {
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,
                            Text   = "Don't report bugs because we are aware. Don't complain about missing features because we are adding them."
                        },
                        new OsuSpriteText
                        {
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,
                            Text   = "Sit back and enjoy. Visit discord.gg/ppy if you want to help out!",
                            Margin = new MarginPadding {
                                Bottom = 20
                            },
                        },
                        new OsuSpriteText
                        {
                            Anchor   = Anchor.TopCentre,
                            Origin   = Anchor.TopCentre,
                            TextSize = 12,
                            Text     = "oh and yes, you will get seizures.",
                        },
                    }
                }
            };
        }
Ejemplo n.º 29
0
        public Button(string text, string sampleName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown)
        {
            this.sampleName  = sampleName;
            this.clickAction = clickAction;
            this.triggerKey  = triggerKey;

            AutoSizeAxes = Axes.Both;
            Alpha        = 0;

            Vector2 boxSize = new Vector2(ButtonSystem.BUTTON_WIDTH + Math.Abs(extraWidth), ButtonArea.BUTTON_AREA_HEIGHT);

            Children = new Drawable[]
            {
                box = new Container
                {
                    Masking           = true,
                    MaskingSmoothness = 2,
                    EdgeEffect        = new EdgeEffectParameters
                    {
                        Type      = EdgeEffectType.Shadow,
                        Colour    = Color4.Black.Opacity(0.2f),
                        Roundness = 5,
                        Radius    = 8,
                    },
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                    Scale    = new Vector2(0, 1),
                    Size     = boxSize,
                    Shear    = new Vector2(ButtonSystem.WEDGE_WIDTH / boxSize.Y, 0),
                    Children = new[]
                    {
                        new Box
                        {
                            EdgeSmoothness   = new Vector2(1.5f, 0),
                            RelativeSizeAxes = Axes.Both,
                            Colour           = colour,
                        },
                        boxHoverLayer = new Box
                        {
                            EdgeSmoothness   = new Vector2(1.5f, 0),
                            RelativeSizeAxes = Axes.Both,
                            Blending         = BlendingMode.Additive,
                            Colour           = Color4.White,
                            Alpha            = 0,
                        },
                    }
                },
                iconText = new Container
                {
                    AutoSizeAxes = Axes.Both,
                    Position     = new Vector2(extraWidth / 2, 0),
                    Anchor       = Anchor.Centre,
                    Origin       = Anchor.Centre,
                    Children     = new Drawable[]
                    {
                        icon = new SpriteIcon
                        {
                            Shadow   = true,
                            Anchor   = Anchor.Centre,
                            Origin   = Anchor.Centre,
                            Size     = new Vector2(30),
                            Position = new Vector2(0, 0),
                            Icon     = symbol
                        },
                        new OsuSpriteText
                        {
                            Shadow         = true,
                            AllowMultiline = false,
                            Anchor         = Anchor.Centre,
                            Origin         = Anchor.Centre,
                            TextSize       = 16,
                            Position       = new Vector2(0, 35),
                            Text           = text
                        }
                    }
                }
            };
        }
Ejemplo n.º 30
0
            public DraggableAudioContainer()
            {
                Size             = new Vector2(0.8f);
                RelativeSizeAxes = Axes.Both;

                Anchor = Anchor.Centre;
                Origin = Anchor.Centre;

                InternalChildren = new Drawable[]
                {
                    warpContent = new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Children         = new Drawable[]
                        {
                            new Box
                            {
                                Colour           = Color4.DarkGray,
                                Alpha            = 0.5f,
                                RelativeSizeAxes = Axes.Both,
                            },
                            volFill = new Box
                            {
                                Anchor           = Anchor.BottomLeft,
                                Origin           = Anchor.BottomLeft,
                                Colour           = Color4.DarkViolet,
                                Alpha            = 0.2f,
                                RelativeSizeAxes = Axes.Both,
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding(10),
                                Children         = new Drawable[]
                                {
                                    textLocal = new SpriteText
                                    {
                                        Anchor = Anchor.TopLeft,
                                        Origin = Anchor.TopLeft,
                                    },
                                    textAggregate = new SpriteText
                                    {
                                        Anchor = Anchor.BottomRight,
                                        Origin = Anchor.BottomRight,
                                    },
                                }
                            },
                            spinner = new SpriteIcon
                            {
                                Anchor   = Anchor.BottomLeft,
                                Origin   = Anchor.Centre,
                                Icon     = FontAwesome.Solid.CircleNotch,
                                Blending = BlendingParameters.Additive,
                                Colour   = Color4.White,
                                Alpha    = 0.2f,
                                Scale    = new Vector2(20),
                                Position = new Vector2(20, -20)
                            }
                        }
                    },

                    audio = new AudioContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        Child            = content = new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                        },
                    }
                };
            }