コード例 #1
0
                public UserDropdownHeader()
                {
                    Foreground.Padding = new MarginPadding {
                        Left = 10, Right = 10
                    };
                    Margin = new MarginPadding {
                        Bottom = 5
                    };
                    Masking      = true;
                    CornerRadius = 5;
                    EdgeEffect   = new EdgeEffectParameters
                    {
                        Type   = EdgeEffectType.Shadow,
                        Colour = Color4.Black.Opacity(0.25f),
                        Radius = 4,
                    };

                    Icon.TextSize = 14;
                    Icon.Margin   = new MarginPadding(0);

                    Foreground.Add(statusIcon = new TextAwesome
                    {
                        Anchor   = Anchor.CentreLeft,
                        Origin   = Anchor.CentreLeft,
                        Icon     = FontAwesome.fa_circle_o,
                        TextSize = 14,
                    });

                    Text.Margin = new MarginPadding {
                        Left = LABEL_LEFT_MARGIN
                    };
                }
コード例 #2
0
ファイル: SimpleNotification.cs プロジェクト: PaoMoXML/osu
        public SimpleNotification()
        {
            IconContent.Add(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    ColourInfo       = ColourInfo.GradientVertical(OsuColour.Gray(0.2f), OsuColour.Gray(0.5f))
                },
                iconDrawable = new TextAwesome
                {
                    Anchor = Anchor.Centre,
                    Icon   = icon,
                }
            });

            Content.Add(textDrawable = new OsuSpriteText
            {
                TextSize         = 16,
                Colour           = OsuColour.Gray(128),
                AutoSizeAxes     = Axes.Y,
                RelativeSizeAxes = Axes.X,
                Text             = text
            });
        }
コード例 #3
0
ファイル: StarCounter.cs プロジェクト: Jonasrems/osu
        protected override void Load(BaseGame game)
        {
            base.Load(game);

            starContainer.Width  = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing;
            starContainer.Height = StarSize;

            for (int i = 0; i < MaxStars; i++)
            {
                TextAwesome star = new TextAwesome
                {
                    Icon     = FontAwesome.fa_star,
                    Anchor   = Anchor.CentreLeft,
                    Origin   = Anchor.Centre,
                    TextSize = StarSize,
                    Scale    = new Vector2(minStarScale),
                    Alpha    = minStarAlpha,
                    Position = new Vector2((StarSize + StarSpacing) * i + (StarSize + StarSpacing) / 2, 0),
                };

                //todo: user Container<T> once we have it.
                stars.Add(star);
                starContainer.Add(star);
            }
        }
コード例 #4
0
ファイル: ButtonSystem.cs プロジェクト: deanmongel/osu
            public override void Load()
            {
                base.Load();
                Alpha = 0;

                Children = new Drawable[]
                {
                    box = new WedgedBox(new Vector2(button_width + Math.Abs(extraWidth), button_area_height), wedge_width)
                    {
                        Anchor = Anchor.Centre,
                        Origin = Anchor.Centre,
                        Colour = colour,
                        Scale  = new Vector2(0, 1)
                    },
                    iconText = new AutoSizeContainer
                    {
                        Position = new Vector2(extraWidth / 2, 0),
                        Anchor   = Anchor.Centre,
                        Origin   = Anchor.Centre,
                        Children = new Drawable[]
                        {
                            icon = new TextAwesome(symbol, 40, Vector2.Zero),
                            new SpriteText
                            {
                                Direction = FlowDirection.HorizontalOnly,
                                Anchor    = Anchor.Centre,
                                Origin    = Anchor.Centre,
                                Position  = new Vector2(0, 25),
                                Text      = text
                            }
                        }
                    }
                };
            }
コード例 #5
0
ファイル: StarCounter.cs プロジェクト: fystir/osu
        /// <summary>
        /// Shows a float count as stars. Used as star difficulty display.
        /// </summary>
        /// <param name="maxstars">Maximum amount of stars to display.</param>
        public StarCounter(int maxstars)
        {
            MaxStars = Math.Max(maxstars, 0);

            Children = new Drawable[]
            {
                starContainer = new Container
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                }
            };

            starContainer.Width  = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing;
            starContainer.Height = StarSize;

            for (int i = 0; i < MaxStars; i++)
            {
                TextAwesome star = new TextAwesome
                {
                    Icon     = FontAwesome.fa_star,
                    Anchor   = Anchor.CentreLeft,
                    Origin   = Anchor.Centre,
                    TextSize = StarSize,
                    Scale    = new Vector2(minStarScale),
                    Alpha    = minStarAlpha,
                    Position = new Vector2((StarSize + StarSpacing) * i + (StarSize + StarSpacing) / 2, 0),
                };

                //todo: user Container<T> once we have it.
                stars.Add(star);
                starContainer.Add(star);
            }
        }
コード例 #6
0
ファイル: OptionsSidebar.cs プロジェクト: Jonasrems/osu
 public SidebarButton()
 {
     Height           = default_width;
     RelativeSizeAxes = Axes.X;
     Children         = new Drawable[]
     {
         backgroundBox = new Box
         {
             RelativeSizeAxes = Axes.Both,
             BlendingMode     = BlendingMode.Additive,
             Colour           = new Color4(60, 60, 60, 255),
             Alpha            = 0,
         },
         new Container
         {
             Width            = default_width,
             RelativeSizeAxes = Axes.Y,
             Children         = new[]
             {
                 drawableIcon = new TextAwesome
                 {
                     Anchor = Anchor.Centre,
                     Origin = Anchor.Centre,
                 },
             }
         },
         headerText = new SpriteText
         {
             Position = new Vector2(default_width + 10, 0),
             Anchor   = Anchor.CentreLeft,
             Origin   = Anchor.CentreLeft,
         }
     };
 }
コード例 #7
0
ファイル: PlaylistItem.cs プロジェクト: librast/osu
        private void load(OsuColour colours, LocalisationEngine localisation)
        {
            BeatmapMetadata metadata = BeatmapSetInfo.Metadata;

            FilterTerms = metadata.SearchableTerms;

            Children = new Drawable[]
            {
                handle = new TextAwesome
                {
                    Anchor   = Anchor.TopLeft,
                    Origin   = Anchor.TopLeft,
                    TextSize = 12,
                    Colour   = colours.Gray5,
                    Icon     = FontAwesome.fa_bars,
                    Alpha    = 0f,
                    Margin   = new MarginPadding {
                        Left = 5
                    },
                    Padding = new MarginPadding {
                        Top = 2
                    },
                },
                new FillFlowContainer <OsuSpriteText>
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Padding          = new MarginPadding {
                        Left = 20
                    },
                    Spacing  = new Vector2(5f, 0f),
                    Children = new []
                    {
                        title = new OsuSpriteText
                        {
                            TextSize = 16,
                            Font     = @"Exo2.0-Regular",
                            Current  = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title),
                        },
                        new OsuSpriteText
                        {
                            TextSize = 14,
                            Font     = @"Exo2.0-Bold",
                            Colour   = colours.Gray9,
                            Padding  = new MarginPadding {
                                Top = 1
                            },
                            Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist),
                        }
                    }
                },
            };

            hoverColour = colours.Yellow;
        }
コード例 #8
0
ファイル: Button.cs プロジェクト: Vexus178/osu
        public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown)
        {
            this.internalName = internalName;
            this.symbol       = symbol;
            this.colour       = colour;
            this.clickAction  = clickAction;
            this.extraWidth   = extraWidth;
            this.triggerKey   = triggerKey;
            this.text         = text;

            AutoSizeAxes = Axes.Both;
            Alpha        = 0;

            Vector2 boxSize = new Vector2(ButtonSystem.button_width + Math.Abs(extraWidth), ButtonSystem.button_area_height);

            Children = new Drawable[]
            {
                box = new Box
                {
                    Anchor         = Anchor.Centre,
                    Origin         = Anchor.Centre,
                    Colour         = colour,
                    Scale          = new Vector2(0, 1),
                    Size           = boxSize,
                    Shear          = new Vector2(ButtonSystem.wedge_width / boxSize.Y, 0),
                    EdgeSmoothness = new Vector2(2, 0),
                },
                iconText = new Container
                {
                    AutoSizeAxes = Axes.Both,
                    Position     = new Vector2(extraWidth / 2, 0),
                    Anchor       = Anchor.Centre,
                    Origin       = Anchor.Centre,
                    Children     = new Drawable[]
                    {
                        icon = new TextAwesome
                        {
                            Anchor   = Anchor.Centre,
                            TextSize = 30,
                            Position = new Vector2(0, 0),
                            Icon     = symbol
                        },
                        new SpriteText
                        {
                            Direction = FlowDirection.HorizontalOnly,
                            Anchor    = Anchor.Centre,
                            Origin    = Anchor.Centre,
                            TextSize  = 16,
                            Position  = new Vector2(0, 35),
                            Text      = text
                        }
                    }
                }
            };
        }
コード例 #9
0
ファイル: BackButton.cs プロジェクト: Sh0keR0/osu
        public BackButton()
        {
            Size = size_retracted;

            Children = new Drawable[]
            {
                leftContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Width            = 0.4f,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour           = new Color4(195, 40, 140, 255),
                            Shear            = new Vector2(shear, 0),
                        },
                        icon = new TextAwesome
                        {
                            Anchor   = Anchor.Centre,
                            TextSize = 25,
                            Icon     = FontAwesome.fa_osu_left_o
                        },
                    }
                },
                rightContainer = new Container
                {
                    Origin           = Anchor.TopRight,
                    Anchor           = Anchor.TopRight,
                    RelativeSizeAxes = Axes.Both,
                    Width            = 0.6f,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = new Color4(238, 51, 153, 255),
                            Origin           = Anchor.TopLeft,
                            Anchor           = Anchor.TopLeft,
                            RelativeSizeAxes = Axes.Both,
                            Shear            = new Vector2(shear, 0),
                            EdgeSmoothness   = new Vector2(1.5f, 0),
                        },
                        new SpriteText
                        {
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre,
                            Text   = @"Back",
                        }
                    }
                }
            };
        }
コード例 #10
0
ファイル: StarCounter.cs プロジェクト: zenithlight/osu
            public Star()
            {
                Size = new Vector2(star_size);

                Children = new[]
                {
                    Icon = new TextAwesome
                    {
                        TextSize = star_size,
                        Icon     = FontAwesome.fa_star,
                        Anchor   = Anchor.Centre,
                        Origin   = Anchor.Centre,
                    }
                };
            }
コード例 #11
0
ファイル: Button.cs プロジェクト: Jonasrems/osu
        protected override void Load(BaseGame game)
        {
            base.Load(game);
            Alpha = 0;

            Vector2 boxSize = new Vector2(ButtonSystem.button_width + Math.Abs(extraWidth), ButtonSystem.button_area_height);

            Children = new Drawable[]
            {
                box = new Box
                {
                    Anchor         = Anchor.Centre,
                    Origin         = Anchor.Centre,
                    Colour         = colour,
                    Scale          = new Vector2(0, 1),
                    Size           = boxSize,
                    Shear          = new Vector2(ButtonSystem.wedge_width / boxSize.Y, 0),
                    EdgeSmoothness = new Vector2(2, 0),
                },
                iconText = new Container
                {
                    AutoSizeAxes = Axes.Both,
                    Position     = new Vector2(extraWidth / 2, 0),
                    Anchor       = Anchor.Centre,
                    Origin       = Anchor.Centre,
                    Children     = new Drawable[]
                    {
                        icon = new TextAwesome
                        {
                            Anchor   = Anchor.Centre,
                            TextSize = 30,
                            Position = new Vector2(0, 0),
                            Icon     = symbol
                        },
                        new SpriteText
                        {
                            Direction = FlowDirection.HorizontalOnly,
                            Anchor    = Anchor.Centre,
                            Origin    = Anchor.Centre,
                            TextSize  = 16,
                            Position  = new Vector2(0, 35),
                            Text      = text
                        }
                    }
                }
            };
        }
コード例 #12
0
 public BreadcrumbTabItem(T value) : base(value)
 {
     Text.TextSize = 16;
     Padding       = new MarginPadding {
         Right = padding + 8
     };                                                   //padding + chevron width
     Add(Chevron = new TextAwesome
     {
         Anchor   = Anchor.CentreRight,
         Origin   = Anchor.CentreLeft,
         TextSize = 12,
         Icon     = FontAwesome.fa_chevron_right,
         Margin   = new MarginPadding {
             Left = padding
         },
         Alpha = 0f,
     });
 }
コード例 #13
0
ファイル: SidebarButton.cs プロジェクト: nairaner/osu
 public SidebarButton()
 {
     Height           = Sidebar.DEFAULT_WIDTH;
     RelativeSizeAxes = Axes.X;
     Children         = new Drawable[]
     {
         backgroundBox = new Box
         {
             RelativeSizeAxes = Axes.Both,
             BlendingMode     = BlendingMode.Additive,
             Colour           = OsuColour.Gray(60),
             Alpha            = 0,
         },
         text = new Container
         {
             Width            = Sidebar.DEFAULT_WIDTH,
             RelativeSizeAxes = Axes.Y,
             Colour           = OsuColour.Gray(0.6f),
             Children         = new[]
             {
                 headerText = new OsuSpriteText
                 {
                     Position = new Vector2(Sidebar.DEFAULT_WIDTH + 10, 0),
                     Anchor   = Anchor.CentreLeft,
                     Origin   = Anchor.CentreLeft,
                 },
                 drawableIcon = new TextAwesome
                 {
                     Anchor   = Anchor.Centre,
                     Origin   = Anchor.Centre,
                     TextSize = 20
                 },
             }
         },
         selectionIndicator = new Box
         {
             Alpha            = 0,
             RelativeSizeAxes = Axes.Y,
             Width            = 5,
             Anchor           = Anchor.CentreRight,
             Origin           = Anchor.CentreRight,
         }
     };
 }
コード例 #14
0
ファイル: FilterControl.cs プロジェクト: akrolsmir/osu
            public RulesetToggleButton(Bindable <RulesetInfo> bindable, RulesetInfo ruleset)
            {
                this.bindable = bindable;
                AutoSizeAxes  = Axes.Both;

                Children = new[]
                {
                    icon = new TextAwesome
                    {
                        Origin   = Anchor.TopLeft,
                        Anchor   = Anchor.TopLeft,
                        TextSize = 32,
                    }
                };

                Ruleset = ruleset;
                bindable.ValueChanged += Bindable_ValueChanged;
                Bindable_ValueChanged(bindable.Value);
                Action = () => bindable.Value = Ruleset;
            }
コード例 #15
0
            public override void Load()
            {
                base.Load();
                Alpha = 0;

                Add(box = new WedgedBox(new Vector2(button_width + Math.Abs(extraWidth), button_area_height), wedge_width)
                {
                    Anchor      = Anchor.Centre,
                    Origin      = Anchor.Centre,
                    Colour      = colour,
                    VectorScale = new Vector2(0, 1)
                });

                iconText = new AutoSizeContainer
                {
                    Position = new Vector2(extraWidth / 2, 0),
                    Anchor   = Anchor.Centre,
                    Origin   = Anchor.Centre,
                };

                Add(iconText);

                icon = new TextAwesome(symbol, 40, Vector2.Zero)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Scale  = 0.7f,
                };
                iconText.Add(icon);

                SpriteText ft = new SpriteText()
                {
                    Direction = FlowDirection.HorizontalOnly,
                    Anchor    = Anchor.Centre,
                    Origin    = Anchor.Centre,
                    Position  = new Vector2(0, 25),
                    Text      = text
                };

                iconText.Add(ft);
            }
コード例 #16
0
            public OsuDropdownMenuItem(string text, T value) : base(text, value)
            {
                Foreground.Padding = new MarginPadding(2);

                Masking      = true;
                CornerRadius = 6;

                Children = new[]
                {
                    new FillFlowContainer
                    {
                        Direction        = FillDirection.Horizontal,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Children         = new Drawable[]
                        {
                            chevron = new TextAwesome
                            {
                                AlwaysPresent      = true,
                                Icon               = FontAwesome.fa_chevron_right,
                                UseFullGlyphHeight = false,
                                Colour             = Color4.Black,
                                Alpha              = 0.5f,
                                TextSize           = 8,
                                Margin             = new MarginPadding {
                                    Left = 3, Right = 3
                                },
                                Origin = Anchor.CentreLeft,
                                Anchor = Anchor.CentreLeft,
                            },
                            new OsuSpriteText {
                                Text   = text,
                                Origin = Anchor.CentreLeft,
                                Anchor = Anchor.CentreLeft,
                            }
                        }
                    }
                };
            }
コード例 #17
0
            public DisplayStyleToggleButton(FontAwesome icon, DirectOverlay.PanelDisplayStyle style, Bindable <DirectOverlay.PanelDisplayStyle> bindable)
            {
                this.bindable = bindable;
                this.style    = style;
                Size          = new Vector2(SlimEnumDropdown <DirectTab> .HEIGHT);

                Children = new Drawable[]
                {
                    this.icon = new TextAwesome
                    {
                        Anchor             = Anchor.Centre,
                        Origin             = Anchor.Centre,
                        Icon               = icon,
                        TextSize           = 18,
                        UseFullGlyphHeight = false,
                        Alpha              = 0.5f,
                    },
                };

                bindable.ValueChanged += Bindable_ValueChanged;
                Bindable_ValueChanged(bindable.Value);
                Action = () => bindable.Value = this.style;
            }
コード例 #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 EdgeEffect
                            {
                                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),
                                                },
                                                iconText = new TextAwesome
                                                {
                                                    Origin   = Anchor.Centre,
                                                    Anchor   = Anchor.Centre,
                                                    Icon     = FontAwesome.fa_close,
                                                    TextSize = 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,
                        },
                    },
                },
            };
        }
コード例 #19
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 TextAwesome
                        {
                            Anchor   = Anchor.TopCentre,
                            Origin   = Anchor.TopCentre,
                            Icon     = FontAwesome.fa_warning,
                            TextSize = 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.",
                        },
                    }
                }
            };
        }
コード例 #20
0
 public GroupSortTabs()
 {
     RelativeSizeAxes = Axes.X;
     AutoSizeAxes     = Axes.Y;
     Children         = new Drawable[]
     {
         new Box
         {
             RelativeSizeAxes = Axes.X,
             Height           = 1,
             Colour           = OsuColour.Gray(80),
             Origin           = Anchor.BottomLeft,
             Anchor           = Anchor.BottomLeft,
         },
         new FlowContainer
         {
             AutoSizeAxes = Axes.Both,
             Direction    = FlowDirections.Horizontal,
             Spacing      = new Vector2(10, 0),
             Children     = new Drawable[]
             {
                 new TabItem
                 {
                     Text   = "All",
                     Active = true,
                 },
                 new TabItem
                 {
                     Text   = "Recently Played",
                     Active = false,
                 },
                 new TabItem
                 {
                     Text   = "Collections",
                     Active = false,
                 },
                 groupsEllipsis = new TextAwesome
                 {
                     Icon     = FontAwesome.fa_ellipsis_h,
                     TextSize = 14,
                     Margin   = new MarginPadding {
                         Top = 5, Bottom = 5
                     },
                     Origin = Anchor.BottomLeft,
                     Anchor = Anchor.BottomLeft,
                 }
             }
         },
         new FlowContainer
         {
             AutoSizeAxes = Axes.Both,
             Direction    = FlowDirections.Horizontal,
             Spacing      = new Vector2(10, 0),
             Origin       = Anchor.TopRight,
             Anchor       = Anchor.TopRight,
             Children     = new Drawable[]
             {
                 sortLabel = new OsuSpriteText
                 {
                     Font     = @"Exo2.0-Bold",
                     Text     = "Sort results by",
                     TextSize = 14,
                     Margin   = new MarginPadding {
                         Top = 5, Bottom = 5
                     },
                 },
                 new TabItem
                 {
                     Text   = "Artist",
                     Active = true,
                 },
                 sortEllipsis = new TextAwesome
                 {
                     Icon     = FontAwesome.fa_ellipsis_h,
                     TextSize = 14,
                     Margin   = new MarginPadding {
                         Top = 5, Bottom = 5
                     },
                     Origin = Anchor.BottomLeft,
                     Anchor = Anchor.BottomLeft,
                 }
             }
         },
     };
 }
コード例 #21
0
ファイル: TwoLayerButton.cs プロジェクト: iLastWhisp/osu
        public TwoLayerButton()
        {
            Size = SIZE_RETRACTED;

            Children = new Drawable[]
            {
                c2 = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Width            = 0.4f,
                    Children         = new Drawable[]
                    {
                        new Container {
                            RelativeSizeAxes  = Axes.Both,
                            Shear             = new Vector2(shear, 0),
                            Masking           = true,
                            MaskingSmoothness = 2,
                            EdgeEffect        = new EdgeEffect {
                                Type   = EdgeEffectType.Shadow,
                                Colour = Color4.Black.Opacity(0.2f),
                                Offset = new Vector2(2, 0),
                                Radius = 2,
                            },
                            Children = new [] {
                                IconLayer = new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    EdgeSmoothness   = new Vector2(2, 0),
                                },
                            }
                        },
                        icon = new TextAwesome
                        {
                            Anchor   = Anchor.Centre,
                            Origin   = Anchor.Centre,
                            TextSize = 25,
                        },
                    }
                },
                c1 = new Container
                {
                    Origin           = Anchor.TopRight,
                    Anchor           = Anchor.TopRight,
                    RelativeSizeAxes = Axes.Both,
                    Width            = 0.6f,
                    Children         = new Drawable[]
                    {
                        new Container {
                            RelativeSizeAxes  = Axes.Both,
                            Shear             = new Vector2(shear, 0),
                            Masking           = true,
                            MaskingSmoothness = 2,
                            EdgeEffect        = new EdgeEffect {
                                Type   = EdgeEffectType.Shadow,
                                Colour = Color4.Black.Opacity(0.2f),
                                Offset = new Vector2(2, 0),
                                Radius = 2,
                            },
                            Children = new [] {
                                TextLayer = new Box
                                {
                                    Origin           = Anchor.TopLeft,
                                    Anchor           = Anchor.TopLeft,
                                    RelativeSizeAxes = Axes.Both,
                                    EdgeSmoothness   = new Vector2(2, 0),
                                },
                            }
                        },
                        text = new OsuSpriteText
                        {
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre,
                        }
                    }
                },
            };
        }
コード例 #22
0
ファイル: Button.cs プロジェクト: Naeferith/osu
        public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown)
        {
            this.internalName = internalName;
            this.symbol       = symbol;
            this.colour       = colour;
            this.clickAction  = clickAction;
            this.extraWidth   = extraWidth;
            this.triggerKey   = triggerKey;
            this.text         = text;

            AutoSizeAxes = Axes.Both;
            Alpha        = 0;

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

            Children = new Drawable[]
            {
                box = new Container
                {
                    Masking           = true,
                    MaskingSmoothness = 2,
                    EdgeEffect        = new EdgeEffect
                    {
                        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 []
                    {
                        boxColourLayer = 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,
                            BlendingMode     = 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 TextAwesome
                        {
                            Shadow   = true,
                            Anchor   = Anchor.Centre,
                            TextSize = 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
                        }
                    }
                }
            };
        }
コード例 #23
0
        public DrawableSpinner(Spinner s) : base(s)
        {
            AlwaysReceiveInput = true;

            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;

            Children = 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 TextAwesome
                        {
                            Anchor             = Anchor.Centre,
                            Origin             = Anchor.Centre,
                            UseFullGlyphHeight = true,
                            TextSize           = 48,
                            Icon   = FontAwesome.fa_asterisk,
                            Shadow = false,
                        },
                    }
                },
                mainContainer = new AspectContainer
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Y,
                    Children         = new Drawable[]
                    {
                        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,
                        },
                    }
                },
            };
        }
コード例 #24
0
ファイル: ChannelListItem.cs プロジェクト: nairaner/osu
        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 TextAwesome
                                {
                                    Anchor   = Anchor.TopRight,
                                    Origin   = Anchor.TopRight,
                                    Icon     = FontAwesome.fa_check_circle,
                                    TextSize = text_size,
                                    Shadow   = false,
                                    Margin   = new MarginPadding {
                                        Right = 10f
                                    },
                                    Alpha = 0f,
                                },
                            },
                        },
                        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,
                                    Alpha    = 0.8f,
                                },
                            },
                        },
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Horizontal,
                            Margin       = new MarginPadding {
                                Left = width_padding
                            },
                            Spacing  = new Vector2(3f, 0f),
                            Children = new Drawable[]
                            {
                                new TextAwesome
                                {
                                    Icon     = FontAwesome.fa_user,
                                    TextSize = text_size - 2,
                                    Shadow   = false,
                                    Margin   = new MarginPadding {
                                        Top = 1
                                    },
                                },
                                new OsuSpriteText
                                {
                                    Text     = @"0",
                                    TextSize = text_size,
                                    Font     = @"Exo2.0-SemiBold",
                                    Shadow   = false,
                                },
                            },
                        },
                    },
                },
            };
        }
コード例 #25
0
ファイル: StarCounter.cs プロジェクト: yheno/osu
        /// <summary>
        /// Shows a float count as stars. Used as star difficulty display.
        /// </summary>
        /// <param name="maxstars">Maximum amount of stars to display.</param>
        public StarCounter(int maxstars)
        {
            MaxStars = Math.Max(maxstars, 0);

            Children = new Drawable[]
            {
                starContainer = new Container
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                }
            };

            starContainer.Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing;
            starContainer.Height = StarSize;

            for (int i = 0; i < MaxStars; i++)
            {
                TextAwesome star = new TextAwesome
                {
                    Icon = FontAwesome.fa_star,
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.Centre,
                    TextSize = StarSize,
                    Scale = new Vector2(minStarScale),
                    Alpha = minStarAlpha,
                    Position = new Vector2((StarSize + StarSpacing) * i + (StarSize + StarSpacing) / 2, 0),
                };

                //todo: user Container<T> once we have it.
                stars.Add(star);
                starContainer.Add(star);
            }
        }