Пример #1
0
        private void load()
        {
            InternalChild = ContentContainer = new NonMaskedContent
            {
                X                = -WIDTH + ExpandedPosition,
                Width            = PANEL_WIDTH,
                RelativeSizeAxes = Axes.Y,
                Children         = new Drawable[]
                {
                    new Box
                    {
                        Anchor           = Anchor.TopRight,
                        Origin           = Anchor.TopRight,
                        Scale            = new Vector2(2, 1), // over-extend to the left for transitions
                        RelativeSizeAxes = Axes.Both,
                        Colour           = OsuColour.Gray(0.05f),
                        Alpha            = 1,
                    },
                    SectionsContainer = new SettingsSectionsContainer
                    {
                        Masking          = true,
                        RelativeSizeAxes = Axes.Both,
                        ExpandableHeader = CreateHeader(),
                        FixedHeader      = searchTextBox = new SeekLimitedSearchTextBox
                        {
                            RelativeSizeAxes = Axes.X,
                            Origin           = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Width            = 0.95f,
                            Margin           = new MarginPadding
                            {
                                Top    = 20,
                                Bottom = 20
                            },
                        },
                        Footer = CreateFooter()
                    },
                }
            };

            if (showSidebar)
            {
                AddInternal(Sidebar = new Sidebar {
                    Width = sidebar_width
                });

                SectionsContainer.SelectedSection.ValueChanged += section =>
                {
                    selectedSidebarButton.Selected = false;
                    selectedSidebarButton          = Sidebar.Children.Single(b => b.Section == section.NewValue);
                    selectedSidebarButton.Selected = true;
                };
            }

            searchTextBox.Current.ValueChanged += term => SectionsContainer.SearchContainer.SearchTerm = term.NewValue;

            CreateSections()?.ForEach(AddSection);
        }
Пример #2
0
        private void load()
        {
            InternalChild = ContentContainer = new NonMaskedContent
            {
                X                = -WIDTH + ExpandedPosition,
                Width            = PANEL_WIDTH,
                RelativeSizeAxes = Axes.Y,
                Children         = new Drawable[]
                {
                    new Box
                    {
                        Anchor           = Anchor.TopRight,
                        Origin           = Anchor.TopRight,
                        Scale            = new Vector2(2, 1), // over-extend to the left for transitions
                        RelativeSizeAxes = Axes.Both,
                        Colour           = OsuColour.Gray(0.05f),
                        Alpha            = 1,
                    },
                    loading = new LoadingLayer
                    {
                        State = { Value = Visibility.Visible }
                    }
                }
            };

            Add(SectionsContainer = new SettingsSectionsContainer
            {
                Masking          = true,
                RelativeSizeAxes = Axes.Both,
                ExpandableHeader = CreateHeader(),
                SelectedSection  = { BindTarget = CurrentSection },
                FixedHeader      = searchTextBox = new SeekLimitedSearchTextBox
                {
                    RelativeSizeAxes = Axes.X,
                    Origin           = Anchor.TopCentre,
                    Anchor           = Anchor.TopCentre,
                    Width            = 0.95f,
                    Margin           = new MarginPadding
                    {
                        Top    = 20,
                        Bottom = 20
                    },
                },
                Footer = CreateFooter().With(f => f.Alpha = 0)
            });

            if (showSidebar)
            {
                AddInternal(Sidebar = new Sidebar {
                    Width = sidebar_width
                });
            }

            CreateSections()?.ForEach(AddSection);
        }
Пример #3
0
        private void load()
        {
            InternalChild = ContentContainer = new Container
            {
                Width            = WIDTH,
                RelativeSizeAxes = Axes.Y,
                Children         = new Drawable[]
                {
                    Background = new Box
                    {
                        Anchor           = Anchor.TopRight,
                        Origin           = Anchor.TopRight,
                        Scale            = new Vector2(2, 1), // over-extend to the left for transitions
                        RelativeSizeAxes = Axes.Both,
                        Colour           = OsuColour.Gray(0.05f),
                        Alpha            = 1,
                    },
                    SectionsContainer = CreateSettingsSections().With(x =>
                    {
                        x.Masking          = true;
                        x.RelativeSizeAxes = Axes.Both;
                        x.ExpandableHeader = CreateHeader();
                        x.FixedHeader      = searchTextBox = new SeekLimitedSearchTextBox
                        {
                            RelativeSizeAxes = Axes.X,
                            Origin           = Anchor.TopCentre,
                            Anchor           = Anchor.TopCentre,
                            Width            = 0.95f,
                            Margin           = new MarginPadding
                            {
                                Top    = 20,
                                Bottom = 20
                            },
                        };
                        x.Footer = CreateFooter();
                    }),
                }
            };

            searchTextBox.Current.ValueChanged += term => SectionsContainer.SearchContainer.SearchTerm = term.NewValue;

            CreateSections()?.ForEach(AddSection);
        }
Пример #4
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();
        }
Пример #5
0
        public FilterControl()
        {
            Children = new Drawable[]
            {
                Background = new Box
                {
                    Colour           = Color4.Black,
                    Alpha            = 0.8f,
                    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,
                            Children         = new Drawable[]
                            {
                                groupTabs = new OsuTabControl <GroupMode>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    Height           = 24,
                                    Width            = 0.5f,
                                    AutoSort         = true,
                                },
                                //spriteText = new OsuSpriteText
                                //{
                                //    Font = @"Exo2.0-Bold",
                                //    Text = "Sort results by",
                                //    Size = 14,
                                //    Margin = new MarginPadding
                                //    {
                                //        Top = 5,
                                //        Bottom = 5
                                //    },
                                //},
                                sortTabs = new OsuTabControl <SortMode>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    Width            = 0.5f,
                                    Height           = 24,
                                    AutoSort         = true,
                                }
                            }
                        },
                    }
                }
            };

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

            groupTabs.PinItem(GroupMode.All);
            groupTabs.PinItem(GroupMode.RecentlyPlayed);
        }
Пример #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();
        }