<commit_before>﻿// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Judgements;
using osuTK.Graphics;
using osuTK;
using osu.Framework.Graphics.Sprites;
using System.Collections.Generic;
using osu.Game.Rulesets.Objects;
using osu.Game.Beatmaps;
using osu.Framework.Bindables;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Colour;
using osu.Framework.Extensions.Color4Extensions;

namespace osu.Game.Screens.Play.HUD
{
    public class HitErrorDisplay : Container
    {
        private const int bar_width = 4;
        private const int bar_height = 250;
        private const int spacing = 3;

        public HitWindows HitWindows { get; set; }

        [Resolved]
        private Bindable<WorkingBeatmap> beatmap { get; set; }

        private readonly bool mirrored;
        private readonly SpriteIcon arrow;
        private readonly List<double> judgementOffsets = new List<double>();

        public HitErrorDisplay(bool mirrored = false)
        {
            this.mirrored = mirrored;

            Size = new Vector2(bar_width, bar_height);

            Children = new Drawable[]
            {
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Direction = FillDirection.Vertical,
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0), Color4.Orange),
                            Height = 0.3f
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = Color4.Green,
                            Height = 0.15f
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = Color4.Blue,
                            Height = 0.1f
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = Color4.Green,
                            Height = 0.15f
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = ColourInfo.GradientVertical(Color4.Orange, Color4.Black.Opacity(0)),
                            Height = 0.3f
                        }
                    }
                },
                arrow = new SpriteIcon
                {
                    Anchor = mirrored ? Anchor.CentreLeft : Anchor.CentreRight,
                    Origin = mirrored ? Anchor.CentreRight : Anchor.CentreLeft,
                    X = mirrored ? -spacing : spacing,
                    RelativePositionAxes = Axes.Y,
                    Icon = mirrored ? FontAwesome.Solid.ChevronRight : FontAwesome.Solid.ChevronLeft,
                    Size = new Vector2(10),
                }
            };
        }

        protected override void LoadComplete()
        {
            base.LoadComplete();
            HitWindows.SetDifficulty(beatmap.Value.BeatmapInfo.BaseDifficulty.OverallDifficulty);
        }

        public void OnNewJudgement(JudgementResult judgement)
        {
            if (!judgement.IsHit)
                return;

            Container judgementLine;

            Add(judgementLine = CreateJudgementLine(judgement));

            judgementLine.FadeOut(5000, Easing.OutQuint);
            judgementLine.Expire();

            arrow.MoveToY(getRelativeJudgementPosition(calculateArrowPosition(judgement)), 500, Easing.OutQuint);
        }

        protected virtual Container CreateJudgementLine(JudgementResult judgement) => new CircularContainer
        {
            Anchor = mirrored ? Anchor.CentreRight : Anchor.CentreLeft,<commit_msg>Make judgement lines alive for a bit longer<commit_after>﻿// Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Rulesets.Judgements;
using osuTK.Graphics;
using osuTK;
using osu.Framework.Graphics.Sprites;
using System.Collections.Generic;
using osu.Game.Rulesets.Objects;
using osu.Game.Beatmaps;
using osu.Framework.Bindables;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Colour;
using osu.Framework.Extensions.Color4Extensions;

namespace osu.Game.Screens.Play.HUD
{
    public class HitErrorDisplay : Container
    {
        private const int bar_width = 4;
        private const int bar_height = 250;
        private const int spacing = 3;

        public HitWindows HitWindows { get; set; }

        [Resolved]
        private Bindable<WorkingBeatmap> beatmap { get; set; }

        private readonly bool mirrored;
        private readonly SpriteIcon arrow;
        private readonly List<double> judgementOffsets = new List<double>();

        public HitErrorDisplay(bool mirrored = false)
        {
            this.mirrored = mirrored;

            Size = new Vector2(bar_width, bar_height);

            Children = new Drawable[]
            {
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Direction = FillDirection.Vertical,
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0), Color4.Orange),
                            Height = 0.3f
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = Color4.Green,
                            Height = 0.15f
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = Color4.Blue,
                            Height = 0.1f
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = Color4.Green,
                            Height = 0.15f
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = ColourInfo.GradientVertical(Color4.Orange, Color4.Black.Opacity(0)),
                            Height = 0.3f
                        }
                    }
                },
                arrow = new SpriteIcon
                {
                    Anchor = mirrored ? Anchor.CentreLeft : Anchor.CentreRight,
                    Origin = mirrored ? Anchor.CentreRight : Anchor.CentreLeft,
                    X = mirrored ? -spacing : spacing,
                    RelativePositionAxes = Axes.Y,
                    Icon = mirrored ? FontAwesome.Solid.ChevronRight : FontAwesome.Solid.ChevronLeft,
                    Size = new Vector2(10),
                }
            };
        }

        protected override void LoadComplete()
        {
            base.LoadComplete();
            HitWindows.SetDifficulty(beatmap.Value.BeatmapInfo.BaseDifficulty.OverallDifficulty);
        }

        public void OnNewJudgement(JudgementResult judgement)
        {
            if (!judgement.IsHit)
                return;

            Container judgementLine;

            Add(judgementLine = CreateJudgementLine(judgement));

            judgementLine.FadeOut(10000, Easing.OutQuint);
            judgementLine.Expire();

            arrow.MoveToY(getRelativeJudgementPosition(calculateArrowPosition(judgement)), 500, Easing.OutQuint);
        }

        protected virtual Container CreateJudgementLine(JudgementResult judgement) => new CircularContainer
        {
            Anchor = mirrored ? Anchor.CentreRight : Anchor.CentreLeft,
{'fraction_non_alphanumeric': 0.07003618536243726, 'fraction_numerical': 0.008987977121512782, 'mean_word_length': 1.3081896551724137, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4729973', 'n_tokens_mistral': 2322, 'n_tokens_neox': 2035, 'n_words': 446}