Ejemplo n.º 1
0
        public DefaultGround()
        {
            AutoSizeAxes     = Axes.X;
            RelativeSizeAxes = Axes.Y;

            InternalChild = new FillFlowContainer
            {
                AutoSizeAxes     = Axes.X,
                RelativeSizeAxes = Axes.Y,
                Direction        = FillDirection.Vertical,
                Children         = new Drawable[]
                {
                    new Box
                    {
                        Name             = "Top line",
                        Colour           = platform_colour.Opacity(1f).Lighten(1f),
                        RelativeSizeAxes = Axes.X,
                        Height           = 3f,
                        Depth            = -1,
                    },
                    new Container
                    {
                        Name         = "Platform",
                        Masking      = true,
                        AutoSizeAxes = Axes.Both,
                        Children     = new Drawable[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = platform_colour,
                            },
                            slatsFlow = new FillFlowContainer
                            {
                                AutoSizeAxes = Axes.Both,
                            },
                        }
                    },
                    new Box
                    {
                        Name             = "Bottom line",
                        Colour           = platform_colour.Opacity(1f).Lighten(2f),
                        RelativeSizeAxes = Axes.X,
                        Height           = 3f,
                    },
                    new Box
                    {
                        Name             = "Ground",
                        Colour           = ground_colour,
                        RelativeSizeAxes = Axes.Both,
                    }
                }
            };
        }
Ejemplo n.º 2
0
        private void updateColour()
        {
            Color4 baseColour = colours.Blue;

            if (user.Value?.IsSupporter ?? false)
            {
                baseColour = skin.Value.GetValue <SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("MenuGlow") ? s.CustomColours["MenuGlow"] : (Color4?)null) ?? baseColour;
            }

            // linear colour looks better in this case, so let's use it for now.
            Color4 gradientDark  = baseColour.Opacity(0).ToLinear();
            Color4 gradientLight = baseColour.Opacity(0.6f).ToLinear();

            leftBox.Colour  = ColourInfo.GradientHorizontal(gradientLight, gradientDark);
            rightBox.Colour = ColourInfo.GradientHorizontal(gradientDark, gradientLight);
        }
Ejemplo n.º 3
0
        private void updateColour()
        {
            Color4 baseColour = colours.Blue;

            if (user.Value?.IsSupporter ?? false)
            {
                baseColour = skin.Value.GetConfig <GlobalSkinColours, Color4>(GlobalSkinColours.MenuGlow)?.Value ?? baseColour;
            }

            // linear colour looks better in this case, so let's use it for now.
            Color4 gradientDark  = baseColour.Opacity(0).ToLinear();
            Color4 gradientLight = baseColour.Opacity(0.6f).ToLinear();

            leftBox.Colour  = ColourInfo.GradientHorizontal(gradientLight, gradientDark);
            rightBox.Colour = ColourInfo.GradientHorizontal(gradientDark, gradientLight);
        }
Ejemplo n.º 4
0
        private void load(OsuColour colours)
        {
            Origin = Anchor.CentreLeft;
            Anchor = Anchor.CentreLeft;

            AutoSizeAxes = Axes.Both;

            Color4 colour = point.GetRepresentingColour(colours);

            InternalChildren = new Drawable[]
            {
                new Box
                {
                    Alpha            = 0.9f,
                    Colour           = ColourInfo.GradientHorizontal(colour, colour.Opacity(0.5f)),
                    RelativeSizeAxes = Axes.Both,
                },
                bpmText = new OsuSpriteText
                {
                    Alpha   = 0.9f,
                    Padding = new MarginPadding(3),
                    Font    = OsuFont.Default.With(size: 40)
                }
            };

            beatLength.BindValueChanged(beatLength =>
            {
                bpmText.Text = $"{60000 / beatLength.NewValue:n1} BPM";
            }, true);
        }
Ejemplo n.º 5
0
        public HexLane(int index, int laneCount, bool biggerBase = false)
        {
            Direction.Value = ScrollingDirection.Left;
            Padding         = new MarginPadding {
                Left = Constants.PaddingBase * laneCount / 10f
            };

            RelativeSizeAxes = Axes.None;
            AutoSizeAxes     = Axes.X;

            _laneCount             = laneCount;
            _laneColor             = Utils.GetAccentColor(index, laneCount);
            VisibleTimeRange.Value = Constants.NoteSpeedBase;

            float scaledHeight = Height = Utils.GetHitobjectSize(laneCount);

            InternalChildren = new Drawable[]
            {
                _lanePath = new Container {
                    Name  = "LanePathContainer",
                    Child = new Box {
                        Name             = "LanePathBox",
                        RelativeSizeAxes = Axes.Both
                    },
                    Height = 3,                                       //thickness of the bar
                    X      = scaledHeight / 2,                        //starts at the center of the polygon
                    Width  = Constants.LaneLength - scaledHeight / 2, //length, should be long enough so that the end cannot be seen
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,

                    Masking    = true,
                    EdgeEffect = new EdgeEffectParameters {
                        Colour = _laneColor.Opacity(0f),    //invisible until hovered over
                        Type   = EdgeEffectType.Glow,
                        Radius = scaledHeight * 0.15f,
                    }
                },

                // TODO: use biggerBase to put a different lane base here, which is a triangle that stretches to the center
                _laneBase = new HexLaneBase(this)
                {
                    Name   = "LaneBase",
                    Size   = new Vector2(scaledHeight), //should be same size as notes
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                },
                new Container
                {
                    Name             = "HitobjectContainer",
                    RelativeSizeAxes = Axes.Y,
                    X      = scaledHeight / 2,      //starts at the center of the polygon, otherwise notes pop too late
                    Width  = Constants.LaneLength,
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.Centre,
                    Child  = HitObjectContainer
                }
            };
        }
Ejemplo n.º 6
0
 /// <param name="text">Text on the button.</param>
 /// <param name="colour">Colour of the button.</param>
 /// <param name="hotkey">Hotkey of the button.</param>
 /// <param name="action">Action the button does.</param>
 /// <param name="depth">
 /// <para>Higher depth to be put on the left, and lower to be put on the right.</para>
 /// <para>Notice this is different to <see cref="Options.BeatmapOptionsOverlay"/>!</para>
 /// </param>
 public void AddButton(string text, Color4 colour, Action action, Key?hotkey = null, float depth = 0) => buttons.Add(new FooterButton
 {
     Text             = text,
     Height           = play_song_select_button_height,
     Width            = play_song_select_button_width,
     Depth            = depth,
     SelectedColour   = colour,
     DeselectedColour = colour.Opacity(0.5f),
     Hotkey           = hotkey,
     Hovered          = updateModeLight,
     HoverLost        = updateModeLight,
     Action           = action,
 });
Ejemplo n.º 7
0
        public void AddButton(string text, Color4 colour, Action action)
        {
            var button = new FooterButton
            {
                Text             = text,
                Height           = play_song_select_button_height,
                Width            = play_song_select_button_width,
                SelectedColour   = colour,
                DeselectedColour = colour.Opacity(0.5f),
            };

            button.Hovered   = () => updateModeLight(button);
            button.HoverLost = () => updateModeLight();
            button.Action    = action;
            buttons.Add(button);
        }
Ejemplo n.º 8
0
            protected override void Update()
            {
                base.Update();

                if (editorClock == null)
                {
                    return;
                }

                float  distanceSpacingMultiplier = (float)snapProvider.DistanceSpacingMultiplier.Value;
                double timeFromReferencePoint    = editorClock.CurrentTime - referenceObject.GetEndTime();

                float distanceForCurrentTime = snapProvider.DurationToDistance(referenceObject, timeFromReferencePoint)
                                               * distanceSpacingMultiplier;

                float timeBasedAlpha = 1 - Math.Clamp(Math.Abs(distanceForCurrentTime - Size.X / 2) / 30, 0, 1);

                Colour = baseColour.Opacity(Math.Max(baseColour.A, timeBasedAlpha));
            }
Ejemplo n.º 9
0
            private void load(OsuColour colour)
            {
                buttonColour = colour.Yellow;

                Child = new Container
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.Both,
                    CornerRadius     = 3,
                    Masking          = true,
                    Colour           = buttonColour,
                    EdgeEffect       = new EdgeEffectParameters
                    {
                        Colour = buttonColour.Opacity(0.1f),
                        Type   = EdgeEffectType.Glow,
                        Radius = 2,
                    },
                    Size  = new Vector2(0.33f, 0.8f),
                    Child = new Box {
                        RelativeSizeAxes = Axes.Both
                    },
                };
            }
Ejemplo n.º 10
0
        protected virtual void UpdateLayout()
        {
            paths.Clear();
            headings.Clear();

            int id = 1;

            foreach (var match in MatchesContainer.OrderBy(d => d.Y).ThenBy(d => d.X))
            {
                match.Match.ID = id++;

                if (match.Match.Progression.Value != null)
                {
                    var dest = MatchesContainer.FirstOrDefault(p => p.Match == match.Match.Progression.Value);

                    if (dest == null)
                    {
                        // clean up outdated progressions.
                        match.Match.Progression.Value = null;
                    }
                    else
                    {
                        paths.Add(new ProgressionPath(match, dest)
                        {
                            Colour = match.Match.Losers.Value ? losersPathColour : normalPathColour
                        });
                    }
                }

                if (DrawLoserPaths)
                {
                    if (match.Match.LosersProgression.Value != null)
                    {
                        var dest = MatchesContainer.FirstOrDefault(p => p.Match == match.Match.LosersProgression.Value);

                        if (dest == null)
                        {
                            // clean up outdated progressions.
                            match.Match.LosersProgression.Value = null;
                        }
                        else
                        {
                            paths.Add(new ProgressionPath(match, dest)
                            {
                                Colour = losersPathColour.Opacity(0.1f)
                            });
                        }
                    }
                }
            }

            foreach (var round in LadderInfo.Rounds)
            {
                var topMatch = MatchesContainer.Where(p => !p.Match.Losers.Value && p.Match.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault();

                if (topMatch == null)
                {
                    continue;
                }

                headings.Add(new DrawableTournamentRound(round)
                {
                    Position = headings.ToLocalSpace((topMatch.ScreenSpaceDrawQuad.TopLeft + topMatch.ScreenSpaceDrawQuad.TopRight) / 2),
                    Margin   = new MarginPadding {
                        Bottom = 10
                    },
                    Origin = Anchor.BottomCentre,
                });
            }

            foreach (var round in LadderInfo.Rounds)
            {
                var topMatch = MatchesContainer.Where(p => p.Match.Losers.Value && p.Match.Round.Value == round).OrderBy(p => p.Y).FirstOrDefault();

                if (topMatch == null)
                {
                    continue;
                }

                headings.Add(new DrawableTournamentRound(round, true)
                {
                    Position = headings.ToLocalSpace((topMatch.ScreenSpaceDrawQuad.TopLeft + topMatch.ScreenSpaceDrawQuad.TopRight) / 2),
                    Margin   = new MarginPadding {
                        Bottom = 10
                    },
                    Origin = Anchor.BottomCentre,
                });
            }

            layout.Validate();
        }