Ejemplo n.º 1
0
 public TestSceneSectionsContainer()
 {
     container = new SectionsContainer <TestSection>
     {
         RelativeSizeAxes = Axes.Y,
         Width            = 300,
         Origin           = Anchor.Centre,
         Anchor           = Anchor.Centre,
         FixedHeader      = new Box
         {
             Alpha  = 0.5f,
             Width  = 300,
             Height = header_height,
             Colour = Color4.Red
         }
     };
     container.SelectedSection.ValueChanged += section =>
     {
         if (section.OldValue != null)
         {
             section.OldValue.Selected = false;
         }
         if (section.NewValue != null)
         {
             section.NewValue.Selected = true;
         }
     };
     Add(container);
 }
Ejemplo n.º 2
0
        private void keyBindingOverlay_StateChanged(Visibility visibility)
        {
            switch (visibility)
            {
            case Visibility.Visible:
                Background.FadeTo(0.9f, 300, Easing.OutQuint);
                Sidebar?.FadeColour(Color4.DarkGray, 300, Easing.OutQuint);

                SectionsContainer.FadeOut(300, Easing.OutQuint);
                ContentContainer.MoveToX(hidden_width - WIDTH, 500, Easing.OutQuint);

                backButton.Delay(100).FadeIn(100);
                break;

            case Visibility.Hidden:
                Background.FadeTo(0.6f, 500, Easing.OutQuint);
                Sidebar?.FadeColour(Color4.White, 300, Easing.OutQuint);

                SectionsContainer.FadeIn(500, Easing.OutQuint);
                ContentContainer.MoveToX(0, 500, Easing.OutQuint);

                backButton.FadeOut(100);
                break;
            }
        }
Ejemplo n.º 3
0
 private void load()
 {
     Child = new Container
     {
         RelativeSizeAxes = Axes.Both,
         Padding          = new MarginPadding(50),
         Child            = new Container
         {
             RelativeSizeAxes = Axes.Both,
             Masking          = true,
             CornerRadius     = 10,
             Children         = new Drawable[]
             {
                 new Box
                 {
                     Colour           = ColourProvider.Dark4,
                     RelativeSizeAxes = Axes.Both,
                 },
                 sections = new SectionsContainer <SetupSection>
                 {
                     FixedHeader      = header,
                     RelativeSizeAxes = Axes.Both,
                     Children         = new SetupSection[]
                     {
                         new ResourcesSection(),
                         new MetadataSection(),
                         new DifficultySection(),
                     }
                 },
             }
         }
     };
 }
Ejemplo n.º 4
0
        public void SetUpSteps()
        {
            AddStep("setup container", () =>
            {
                container = new SectionsContainer <TestSection>
                {
                    RelativeSizeAxes = Axes.Y,
                    Width            = 300,
                    Origin           = Anchor.Centre,
                    Anchor           = Anchor.Centre,
                };

                container.SelectedSection.ValueChanged += section =>
                {
                    if (section.OldValue != null)
                    {
                        section.OldValue.Selected = false;
                    }
                    if (section.NewValue != null)
                    {
                        section.NewValue.Selected = true;
                    }
                };

                Child = container;
            });

            AddToggleStep("disable expandable header", v => container.ExpandableHeader = v
                ? null
                : new TestBox(@"Expandable Header")
            {
                RelativeSizeAxes = Axes.X,
                Height           = header_expandable_height,
                BackgroundColour = new OsuColour().GreySky,
            });

            AddToggleStep("disable fixed header", v => container.FixedHeader = v
                ? null
                : new TestBox(@"Fixed Header")
            {
                RelativeSizeAxes = Axes.X,
                Height           = header_fixed_height,
                BackgroundColour = new OsuColour().Red.Opacity(0.5f),
            });

            AddToggleStep("disable footer", v => container.Footer = v
                ? null
                : new TestBox("Footer")
            {
                RelativeSizeAxes = Axes.X,
                Height           = 200,
                BackgroundColour = new OsuColour().Green4,
            });
        }
Ejemplo n.º 5
0
        private void subPanelStateChanged(ValueChangedEvent <Visibility> state)
        {
            switch (state.NewValue)
            {
            case Visibility.Visible:
                Sidebar?.FadeColour(Color4.DarkGray, 300, Easing.OutQuint);

                SectionsContainer.FadeOut(300, Easing.OutQuint);
                ContentContainer.MoveToX(-WIDTH, 500, Easing.OutQuint);
                break;

            case Visibility.Hidden:
                Sidebar?.FadeColour(Color4.White, 300, Easing.OutQuint);

                SectionsContainer.FadeIn(500, Easing.OutQuint);
                ContentContainer.MoveToX(0, 500, Easing.OutQuint);
                break;
            }
        }
Ejemplo n.º 6
0
        private void subPanelStateChanged(Visibility visibility)
        {
            switch (visibility)
            {
            case Visibility.Visible:
                Background.FadeTo(0.9f, 300, Easing.OutQuint);
                Sidebar?.FadeColour(Color4.DarkGray, 300, Easing.OutQuint);

                SectionsContainer.FadeOut(300, Easing.OutQuint);
                ContentContainer.MoveToX(-WIDTH, 500, Easing.OutQuint);
                break;

            case Visibility.Hidden:
                Background.FadeTo(0.6f, 500, Easing.OutQuint);
                Sidebar?.FadeColour(Color4.White, 300, Easing.OutQuint);

                SectionsContainer.FadeIn(500, Easing.OutQuint);
                ContentContainer.MoveToX(0, 500, Easing.OutQuint);
                break;
            }
        }
Ejemplo n.º 7
0
        public void ShowUser(User user, bool fetchOnline = true)
        {
            userReq?.Cancel();
            Clear();
            lastSection = null;

            sections = new ProfileSection[]
            {
                //new AboutSection(),
                new RecentSection(),
                new RanksSection(),
                //new MedalsSection(),
                new HistoricalSection(),
                new BeatmapsSection(),
                new KudosuSection()
            };
            tabs = new ProfileTabControl
            {
                RelativeSizeAxes = Axes.X,
                Anchor           = Anchor.TopCentre,
                Origin           = Anchor.TopCentre,
                Height           = 30
            };

            Add(new Box
            {
                RelativeSizeAxes = Axes.Both,
                Colour           = OsuColour.Gray(0.2f)
            });

            Header = new ProfileHeader(user);

            Add(sectionsContainer = new SectionsContainer <ProfileSection>
            {
                RelativeSizeAxes = Axes.Both,
                ExpandableHeader = Header,
                FixedHeader      = tabs,
                HeaderBackground = new Box
                {
                    Colour           = OsuColour.Gray(34),
                    RelativeSizeAxes = Axes.Both
                }
            });
            sectionsContainer.SelectedSection.ValueChanged += s =>
            {
                if (lastSection != s)
                {
                    lastSection        = s;
                    tabs.Current.Value = lastSection;
                }
            };

            tabs.Current.ValueChanged += s =>
            {
                if (lastSection == null)
                {
                    lastSection = sectionsContainer.Children.FirstOrDefault();
                    if (lastSection != null)
                    {
                        tabs.Current.Value = lastSection;
                    }
                    return;
                }
                if (lastSection != s)
                {
                    lastSection = s;
                    sectionsContainer.ScrollTo(lastSection);
                }
            };

            if (fetchOnline)
            {
                userReq          = new GetUserRequest(user.Id);
                userReq.Success += userLoadComplete;
                api.Queue(userReq);
            }
            else
            {
                userReq = null;
                userLoadComplete(user);
            }

            Show();
            sectionsContainer.ScrollToTop();
        }
Ejemplo n.º 8
0
        public WikiOverlay()
        {
            Waves.FirstWaveColour  = OsuColour.Gray(0.4f);
            Waves.SecondWaveColour = OsuColour.Gray(0.3f);
            Waves.ThirdWaveColour  = OsuColour.Gray(0.2f);
            Waves.FourthWaveColour = OsuColour.Gray(0.1f);

            RelativeSizeAxes     = Axes.Both;
            RelativePositionAxes = Axes.Both;
            Width  = 0.85f;
            Anchor = Anchor.TopCentre;
            Origin = Anchor.TopCentre;

            Masking       = true;
            AlwaysPresent = true;
            EdgeEffect    = new EdgeEffectParameters
            {
                Colour = Color4.Black.Opacity(0),
                Type   = EdgeEffectType.Shadow,
                Radius = 10
            };

            tabs = new WikiTabControl
            {
                RelativeSizeAxes = Axes.X,
                Anchor           = Anchor.TopCentre,
                Origin           = Anchor.TopCentre,
                Height           = 30
            };

            Add(new Box
            {
                RelativeSizeAxes = Axes.Both,
                Colour           = OsuColour.Gray(0.2f)
            });

            Add(sectionsContainer = new SectionsContainer <WikiSection>
            {
                RelativeSizeAxes = Axes.Both,
                ExpandableHeader = Header,
                FixedHeader      = tabs,
                HeaderBackground = new Box
                {
                    Colour           = OsuColour.Gray(34),
                    RelativeSizeAxes = Axes.Both
                }
            });

            sectionsContainer.SelectedSection.ValueChanged += s =>
            {
                if (lastSection != s)
                {
                    lastSection        = s;
                    tabs.Current.Value = lastSection;
                }
            };

            tabs.Current.ValueChanged += s =>
            {
                if (lastSection == null)
                {
                    lastSection = sectionsContainer.Children.FirstOrDefault();
                    if (lastSection != null)
                    {
                        tabs.Current.Value = lastSection;
                    }
                    return;
                }
                if (lastSection != s)
                {
                    lastSection = s;
                    sectionsContainer.ScrollTo(lastSection);
                }
            };

            foreach (WikiSection sec in Sections)
            {
                if (sec != null)
                {
                    sectionsContainer.Add(sec);
                    tabs.AddItem(sec);
                }
            }

            sectionsContainer.ScrollToTop();
        }