Пример #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(OsuGame game)
        {
            var sections = new SettingsSection[]
            {
                new GeneralSection(),
                new GraphicsSection(),
                new GameplaySection(),
                new AudioSection(),
                new SkinSection(),
                new InputSection(),
                new OnlineSection(),
                new MaintenanceSection(),
                new DebugSection(),
            };

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black,
                    Alpha            = 0.6f,
                },
                sectionsContainer = new SettingsSectionsContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = width,
                    Margin           = new MarginPadding {
                        Left = SIDEBAR_WIDTH
                    },
                    ExpandableHeader = new SettingsHeader(),
                    FixedHeader      = searchTextBox = new SearchTextBox
                    {
                        RelativeSizeAxes = Axes.X,
                        Origin           = Anchor.TopCentre,
                        Anchor           = Anchor.TopCentre,
                        Width            = 0.95f,
                        Margin           = new MarginPadding
                        {
                            Top    = 20,
                            Bottom = 20
                        },
                        Exit = Hide,
                    },
                    Sections = sections,
                    Footer   = new SettingsFooter()
                },
                sidebar = new Sidebar
                {
                    Width    = SIDEBAR_WIDTH,
                    Children = sidebarButtons = sections.Select(section =>
                                                                new SidebarButton
                    {
                        Section = section,
                        Action  = sectionsContainer.ScrollContainer.ScrollIntoView,
                    }
                                                                ).ToArray()
                }
            };

            selectedSidebarButton          = sidebarButtons[0];
            selectedSidebarButton.Selected = true;

            sectionsContainer.SelectedSection.ValueChanged += section =>
            {
                selectedSidebarButton.Selected = false;
                selectedSidebarButton          = sidebarButtons.Single(b => b.Section == section);
                selectedSidebarButton.Selected = true;
            };

            searchTextBox.Current.ValueChanged += newValue => sectionsContainer.SearchContainer.SearchTerm = newValue;

            sectionsContainer.Padding = new MarginPadding {
                Top = game?.Toolbar.DrawHeight ?? 0
            };
        }