<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 System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Utils;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
    public class DrawableSliderRepeat : DrawableOsuHitObject, ITrackSnaking
    {
        private readonly SliderRepeat sliderRepeat;
        private readonly DrawableSlider drawableSlider;

        private double animDuration;

        private readonly Drawable scaleContainer;

        public readonly Drawable CirclePiece;

        public override bool DisplayResult => false;

        public DrawableSliderRepeat(SliderRepeat sliderRepeat, DrawableSlider drawableSlider)
            : base(sliderRepeat)
        {
            this.sliderRepeat = sliderRepeat;
            this.drawableSlider = drawableSlider;

            Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);

            Origin = Anchor.Centre;

            InternalChild = scaleContainer = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Children = new Drawable[]
                {
                    // no default for this; only visible in legacy skins.
                    CirclePiece = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderTailHitCircle), _ => Empty()),
                    arrow = new ReverseArrowPiece(),
                }
            };
        }

        private readonly IBindable<float> scaleBindable = new BindableFloat();

        [BackgroundDependencyLoader]
        private void load()
        {
            scaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue), true);
            scaleBindable.BindTo(HitObject.ScaleBindable);
        }

        protected override void CheckForResult(bool userTriggered, double timeOffset)
        {
            if (sliderRepeat.StartTime <= Time.Current)
                ApplyResult(r => r.Type = drawableSlider.Tracking.Value ? r.Judgement.MaxResult : r.Judgement.MinResult);
        }

        protected override void UpdateInitialTransforms()
        {
            animDuration = Math.Min(300, sliderRepeat.SpanDuration);

            this.Animate(
                d => d.FadeIn(animDuration),<commit_msg>Remove redundant array type specification<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 System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Utils;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Osu.Objects.Drawables
{
    public class DrawableSliderRepeat : DrawableOsuHitObject, ITrackSnaking
    {
        private readonly SliderRepeat sliderRepeat;
        private readonly DrawableSlider drawableSlider;

        private double animDuration;

        private readonly Drawable scaleContainer;

        public readonly Drawable CirclePiece;

        public override bool DisplayResult => false;

        public DrawableSliderRepeat(SliderRepeat sliderRepeat, DrawableSlider drawableSlider)
            : base(sliderRepeat)
        {
            this.sliderRepeat = sliderRepeat;
            this.drawableSlider = drawableSlider;

            Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);

            Origin = Anchor.Centre;

            InternalChild = scaleContainer = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Children = new[]
                {
                    // no default for this; only visible in legacy skins.
                    CirclePiece = new SkinnableDrawable(new OsuSkinComponent(OsuSkinComponents.SliderTailHitCircle), _ => Empty()),
                    arrow = new ReverseArrowPiece(),
                }
            };
        }

        private readonly IBindable<float> scaleBindable = new BindableFloat();

        [BackgroundDependencyLoader]
        private void load()
        {
            scaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue), true);
            scaleBindable.BindTo(HitObject.ScaleBindable);
        }

        protected override void CheckForResult(bool userTriggered, double timeOffset)
        {
            if (sliderRepeat.StartTime <= Time.Current)
                ApplyResult(r => r.Type = drawableSlider.Tracking.Value ? r.Judgement.MaxResult : r.Judgement.MinResult);
        }

        protected override void UpdateInitialTransforms()
        {
            animDuration = Math.Min(300, sliderRepeat.SpanDuration);

            this.Animate(
                d => d.FadeIn(animDuration),
{'fraction_non_alphanumeric': 0.07633587786259542, 'fraction_numerical': 0.0022342208154905977, 'mean_word_length': 2.3871374527112232, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '2014004', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1414, 'n_words': 330}