Пример #1
0
        public override void Reset()
        {
            base.Reset();

            OsuSpriteText             text;
            OsuTabControl <GroupMode> filter;

            Add(filter = new OsuTabControl <GroupMode>
            {
                Margin   = new MarginPadding(4),
                Size     = new Vector2(229, 24),
                AutoSort = true
            });
            Add(text = new OsuSpriteText
            {
                Text     = "None",
                Margin   = new MarginPadding(4),
                Position = new Vector2(275, 5)
            });

            filter.PinItem(GroupMode.All);
            filter.PinItem(GroupMode.RecentlyPlayed);

            filter.Current.ValueChanged += newFilter =>
            {
                text.Text = "Currently Selected: " + newFilter.ToString();
            };
        }
Пример #2
0
        public BeatmapDetailAreaTabControl()
        {
            Height = HEIGHT;

            Children = new Drawable[]
            {
                new Box
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.X,
                    Height           = 1,
                    Colour           = Color4.White.Opacity(0.2f),
                },
                tabs = new OsuTabControl <BeatmapDetailTab>
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.Both,
                },
                modsCheckbox = new OsuTabControlCheckBox
                {
                    Anchor = Anchor.BottomRight,
                    Origin = Anchor.BottomRight,
                    Text   = @"Mods",
                },
            };

            tabs.ItemChanged    += (sender, e) => invokeOnFilter();
            modsCheckbox.Action += (sender, e) => invokeOnFilter();

            tabs.SelectedItem = BeatmapDetailTab.Global;
        }
Пример #3
0
        public BeatmapDetailAreaTabControl()
        {
            Height = HEIGHT;

            Children = new Drawable[]
            {
                new Box
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.X,
                    Height           = 1,
                    Colour           = Color4.White.Opacity(0.2f),
                },
                tabs = new OsuTabControl <BeatmapDetailTab>
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.Both,
                },
                modsCheckbox = new OsuTabControlCheckbox
                {
                    Anchor = Anchor.BottomRight,
                    Origin = Anchor.BottomRight,
                    Text   = @"Mods",
                },
            };

            tabs.Current.ValueChanged         += item => invokeOnFilter();
            modsCheckbox.Current.ValueChanged += item => invokeOnFilter();
        }
Пример #4
0
        public TestCaseTabControl()
        {
            OsuSpriteText             text;
            OsuTabControl <GroupMode> filter;

            Add(filter = new OsuTabControl <GroupMode>
            {
                Margin   = new MarginPadding(4),
                Size     = new Vector2(229, 24),
                AutoSort = true
            });
            Add(text = new OsuSpriteText
            {
                Text     = "None",
                Margin   = new MarginPadding(4),
                Position = new Vector2(275, 5)
            });

            filter.PinItem(GroupMode.All);
            filter.PinItem(GroupMode.RecentlyPlayed);

            filter.Current.ValueChanged += grouping =>
            {
                text.Text = "Currently Selected: " + grouping.NewValue.ToString();
            };
        }
Пример #5
0
        private void load(OsuColour colours, IBindable <RulesetInfo> parentRuleset, OsuConfigManager config)
        {
            sortMode  = config.GetBindable <SortMode>(OsuSetting.SongSelectSortingMode);
            groupMode = config.GetBindable <GroupMode>(OsuSetting.SongSelectGroupingMode);

            Children = new Drawable[]
            {
                new Box
                {
                    Colour           = Color4.Black,
                    Alpha            = 0.8f,
                    Width            = 2,
                    RelativeSizeAxes = Axes.Both,
                },
                new Container
                {
                    Padding          = new MarginPadding(side_margin),
                    RelativeSizeAxes = Axes.Both,
                    Width            = 0.5f,
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    // Reverse ChildID so that dropdowns in the top section appear on top of the bottom section.
                    Child = new ReverseChildIDFillFlowContainer <Drawable>
                    {
                        RelativeSizeAxes = Axes.Both,
                        Spacing          = new Vector2(0, 5),
                        Children         = new[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                Height           = 60,
                                Children         = new Drawable[]
                                {
                                    searchTextBox = new SeekLimitedSearchTextBox {
                                        RelativeSizeAxes = Axes.X
                                    },
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = 1,
                                        Colour           = OsuColour.Gray(80),
                                        Origin           = Anchor.BottomLeft,
                                        Anchor           = Anchor.BottomLeft,
                                    },
                                    new FillFlowContainer
                                    {
                                        Anchor           = Anchor.BottomRight,
                                        Origin           = Anchor.BottomRight,
                                        Direction        = FillDirection.Horizontal,
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Spacing          = new Vector2(OsuTabControl <SortMode> .HORIZONTAL_SPACING, 0),
                                        Children         = new Drawable[]
                                        {
                                            new OsuTabControlCheckbox
                                            {
                                                Text    = "顯示已轉換圖譜",
                                                Current = config.GetBindable <bool>(OsuSetting.ShowConvertedBeatmaps),
                                                Anchor  = Anchor.BottomRight,
                                                Origin  = Anchor.BottomRight,
                                            },
                                            sortTabs = new OsuTabControl <SortMode>
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                Width            = 0.5f,
                                                Height           = 24,
                                                AutoSort         = true,
                                                Anchor           = Anchor.BottomRight,
                                                Origin           = Anchor.BottomRight,
                                                AccentColour     = colours.GreenLight,
                                                Current          = { BindTarget = sortMode }
                                            },
                                            new OsuSpriteText
                                            {
                                                Text   = "排序方式",
                                                Font   = OsuFont.GetFont(size: 14),
                                                Margin = new MarginPadding(5),
                                                Anchor = Anchor.BottomRight,
                                                Origin = Anchor.BottomRight,
                                            },
                                        }
                                    },
                                }
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.X,
                                Height           = 20,
                                Children         = new Drawable[]
                                {
                                    collectionDropdown = new CollectionFilterDropdown
                                    {
                                        Anchor           = Anchor.TopRight,
                                        Origin           = Anchor.TopRight,
                                        RelativeSizeAxes = Axes.X,
                                        Width            = 0.4f,
                                    }
                                }
                            },
                        }
                    }
                }
            };

            config.BindWith(OsuSetting.ShowConvertedBeatmaps, showConverted);
            showConverted.ValueChanged += _ => updateCriteria();

            config.BindWith(OsuSetting.DisplayStarsMinimum, minimumStars);
            minimumStars.ValueChanged += _ => updateCriteria();

            config.BindWith(OsuSetting.DisplayStarsMaximum, maximumStars);
            maximumStars.ValueChanged += _ => updateCriteria();

            ruleset.BindTo(parentRuleset);
            ruleset.BindValueChanged(_ => updateCriteria());

            groupMode.BindValueChanged(_ => updateCriteria());
            sortMode.BindValueChanged(_ => updateCriteria());

            collectionDropdown.Current.ValueChanged += val =>
            {
                if (val.NewValue == null)
                {
                    // may be null briefly while menu is repopulated.
                    return;
                }

                updateCriteria();
            };

            searchTextBox.Current.ValueChanged += _ => updateCriteria();

            updateCriteria();
        }
Пример #6
0
        private void load(OsuColour colours, IBindable <RulesetInfo> parentRuleset, OsuConfigManager config)
        {
            config.BindWith(OsuSetting.ShowConvertedBeatmaps, showConverted);
            showConverted.ValueChanged += _ => updateCriteria();

            config.BindWith(OsuSetting.DisplayStarsMinimum, minimumStars);
            minimumStars.ValueChanged += _ => updateCriteria();

            config.BindWith(OsuSetting.DisplayStarsMaximum, maximumStars);
            maximumStars.ValueChanged += _ => updateCriteria();

            ruleset.BindTo(parentRuleset);
            ruleset.BindValueChanged(_ => updateCriteria());

            sortMode  = config.GetBindable <SortMode>(OsuSetting.SongSelectSortingMode);
            groupMode = config.GetBindable <GroupMode>(OsuSetting.SongSelectGroupingMode);

            groupMode.BindValueChanged(_ => updateCriteria());
            sortMode.BindValueChanged(_ => updateCriteria());

            Children = new Drawable[]
            {
                new Box
                {
                    Colour           = Color4.Black,
                    Alpha            = 0.8f,
                    Width            = 2,
                    RelativeSizeAxes = Axes.Both,
                },
                new Container
                {
                    Padding          = new MarginPadding(20),
                    RelativeSizeAxes = Axes.Both,
                    Width            = 0.5f,
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    Children         = new Drawable[]
                    {
                        searchTextBox = new SeekLimitedSearchTextBox {
                            RelativeSizeAxes = Axes.X
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 1,
                            Colour           = OsuColour.Gray(80),
                            Origin           = Anchor.BottomLeft,
                            Anchor           = Anchor.BottomLeft,
                        },
                        new FillFlowContainer
                        {
                            Anchor           = Anchor.BottomRight,
                            Origin           = Anchor.BottomRight,
                            Direction        = FillDirection.Horizontal,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Spacing          = new Vector2(OsuTabControl <SortMode> .HORIZONTAL_SPACING, 0),
                            Children         = new Drawable[]
                            {
                                new OsuTabControlCheckbox
                                {
                                    Text    = "Show converted",
                                    Current = config.GetBindable <bool>(OsuSetting.ShowConvertedBeatmaps),
                                    Anchor  = Anchor.BottomRight,
                                    Origin  = Anchor.BottomRight,
                                },
                                sortTabs = new OsuTabControl <SortMode>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    Width            = 0.5f,
                                    Height           = 24,
                                    AutoSort         = true,
                                    Anchor           = Anchor.BottomRight,
                                    Origin           = Anchor.BottomRight,
                                    AccentColour     = colours.GreenLight,
                                    Current          = { BindTarget = sortMode }
                                },
                                new OsuSpriteText
                                {
                                    Text   = "Sort by",
                                    Font   = OsuFont.GetFont(size: 14),
                                    Margin = new MarginPadding(5),
                                    Anchor = Anchor.BottomRight,
                                    Origin = Anchor.BottomRight,
                                },
                            }
                        },
                    }
                }
            };

            searchTextBox.Current.ValueChanged += _ => FilterChanged?.Invoke(CreateCriteria());

            updateCriteria();
        }
Пример #7
0
        public Header()
        {
            Height = HEIGHT;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.FromHex(@"252f3a"),
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Left = DirectOverlay.WIDTH_PADDING, Right = DirectOverlay.WIDTH_PADDING
                    },
                    Children = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            Anchor       = Anchor.CentreLeft,
                            Origin       = Anchor.BottomLeft,
                            Position     = new Vector2(-35f, 5f),
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Horizontal,
                            Spacing      = new Vector2(10f, 0f),
                            Children     = new Drawable[]
                            {
                                new TextAwesome
                                {
                                    TextSize = 25,
                                    Icon     = FontAwesome.fa_osu_chevron_down_o,
                                },
                                new OsuSpriteText
                                {
                                    TextSize = 25,
                                    Text     = @"osu!direct",
                                },
                            },
                        },
                        tabStrip = new Box
                        {
                            Anchor = Anchor.BottomLeft,
                            Origin = Anchor.BottomLeft,
                            Width  = 282, //todo: make this actually match the tab control's width instead of hardcoding
                            Height = 1,
                        },
                        Tabs = new DirectTabControl
                        {
                            Anchor           = Anchor.BottomLeft,
                            Origin           = Anchor.BottomLeft,
                            RelativeSizeAxes = Axes.X,
                        },
                    },
                },
            };

            Tabs.Current.Value = DirectTab.Search;
            Tabs.Current.TriggerChange();
        }