Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
0
 public WikiTabItem(WikiSection value) : base(value)
 {
     Text.Text = value.Title;
 }