<commit_before>﻿// Copyright (c) 2007-2018 ppy Pty Ltd <<EMAIL>>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Scoring;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Screens;
using osu.Game.Graphics.Containers;
using osu.Game.Screens.Backgrounds;
using OpenTK;
using OpenTK.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;

namespace osu.Game.Screens.Ranking
{
    public class Results : OsuScreen
    {
        private readonly Score score;
        private Container circleOuterBackground;
        private Container circleOuter;
        private Container circleInner;

        private ParallaxContainer backgroundParallax;

        private ResultModeTabControl modeChangeButtons;

        public override bool AllowBeatmapRulesetChange => false;

        private Container currentPage;

        private static readonly Vector2 background_blur = new Vector2(20);

        protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);

        private const float overscan = 1.3f;

        private const float circle_outer_scale = 0.96f;

        public Results(Score score)
        {
            this.score = score;
        }

        private const float transition_time = 800;

        private IEnumerable<Drawable> allCircles => new Drawable[] { circleOuterBackground, circleInner, circleOuter };

        protected override void OnEntering(Screen last)
        {
            base.OnEntering(last);
            (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, Easing.OutQuint);

            allCircles.ForEach(c =>
            {
                c.FadeOut();
                c.ScaleTo(0);
            });

            backgroundParallax.FadeOut();
            modeChangeButtons.FadeOut();
            currentPage.FadeOut();

            circleOuterBackground
                .FadeIn(transition_time, Easing.OutQuint)
                .ScaleTo(1, transition_time, Easing.OutQuint);

            using (BeginDelayedSequence(transition_time * 0.25f, true))
            {
                circleOuter
                    .FadeIn(transition_time, Easing.OutQuint)
                    .ScaleTo(1, transition_time, Easing.OutQuint);

                using (BeginDelayedSequence(transition_time * 0.3f, true))
                {
                    backgroundParallax.FadeIn(transition_time, Easing.OutQuint);

                    circleInner
                        .FadeIn(transition_time, Easing.OutQuint)
                        .ScaleTo(1, transition_time, Easing.OutQuint);

                    using (BeginDelayedSequence(transition_time * 0.4f, true))
                    {
                        modeChangeButtons.FadeIn(transition_time, Easing.OutQuint);
                        currentPage.FadeIn(transition_time, Easing.OutQuint);
                    }
                }
            }
        }

        protected override bool OnExiting(Screen next)
        {
            allCircles.ForEach(c =>
            {
                c.ScaleTo(0, transition_time, Easing.OutSine);
            });

            Content.FadeOut(transition_time / 4);

            return base.OnExiting(next);
        }

        [BackgroundDependencyLoader]
        private void load(OsuColour colours)
        {
            Children = new Drawable[]
            {
                new AspectContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Height = overscan,
                    Children = new Drawable[]
                    {
                        circleOuterBackground = new CircularContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Masking = true,
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    Alpha = 0.2f,
                                    RelativeSizeAxes = Axes.Both,
                                    Colour = Color4.Black,
                                }
                            }
                        },
                        circleOuter = new CircularContainer
                        {
                            Size = new Vector2(circle_outer_scale),
                            EdgeEffect = new EdgeEffectParameters
                            {
                                Colour = Color4.Black.Opacity(0.4f),
                                Type = EdgeEffectType.Shadow,
                                Radius = 15,
                            },
                            RelativeSizeAxes = Axes.Both,
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Masking = true,
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour = Color4.White,
                                },
                                backgroundParallax = new ParallaxContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    ParallaxAmount = 0.01f,
                                    Scale = new Vector2(1 / circle_outer_scale / overscan),
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,
                                    Children = new Drawable[]
                                    {
                                        new Sprite
                                        {<commit_msg>Fix results screen parallax being cut off<commit_after>﻿// Copyright (c) 2007-2018 ppy Pty Ltd <<EMAIL>>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Scoring;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Screens;
using osu.Game.Graphics.Containers;
using osu.Game.Screens.Backgrounds;
using OpenTK;
using OpenTK.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Sprites;

namespace osu.Game.Screens.Ranking
{
    public class Results : OsuScreen
    {
        private readonly Score score;
        private Container circleOuterBackground;
        private Container circleOuter;
        private Container circleInner;

        private ParallaxContainer backgroundParallax;

        private ResultModeTabControl modeChangeButtons;

        public override bool AllowBeatmapRulesetChange => false;

        private Container currentPage;

        private static readonly Vector2 background_blur = new Vector2(20);

        protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);

        private const float overscan = 1.3f;

        private const float circle_outer_scale = 0.96f;

        public Results(Score score)
        {
            this.score = score;
        }

        private const float transition_time = 800;

        private IEnumerable<Drawable> allCircles => new Drawable[] { circleOuterBackground, circleInner, circleOuter };

        protected override void OnEntering(Screen last)
        {
            base.OnEntering(last);
            (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, Easing.OutQuint);
            Background.ScaleTo(1.1f, transition_time, Easing.OutQuint);

            allCircles.ForEach(c =>
            {
                c.FadeOut();
                c.ScaleTo(0);
            });

            backgroundParallax.FadeOut();
            modeChangeButtons.FadeOut();
            currentPage.FadeOut();

            circleOuterBackground
                .FadeIn(transition_time, Easing.OutQuint)
                .ScaleTo(1, transition_time, Easing.OutQuint);

            using (BeginDelayedSequence(transition_time * 0.25f, true))
            {
                circleOuter
                    .FadeIn(transition_time, Easing.OutQuint)
                    .ScaleTo(1, transition_time, Easing.OutQuint);

                using (BeginDelayedSequence(transition_time * 0.3f, true))
                {
                    backgroundParallax.FadeIn(transition_time, Easing.OutQuint);

                    circleInner
                        .FadeIn(transition_time, Easing.OutQuint)
                        .ScaleTo(1, transition_time, Easing.OutQuint);

                    using (BeginDelayedSequence(transition_time * 0.4f, true))
                    {
                        modeChangeButtons.FadeIn(transition_time, Easing.OutQuint);
                        currentPage.FadeIn(transition_time, Easing.OutQuint);
                    }
                }
            }
        }

        protected override bool OnExiting(Screen next)
        {
            allCircles.ForEach(c =>
            {
                c.ScaleTo(0, transition_time, Easing.OutSine);
            });

            Background.ScaleTo(1f, transition_time / 4, Easing.OutQuint);

            Content.FadeOut(transition_time / 4);

            return base.OnExiting(next);
        }

        [BackgroundDependencyLoader]
        private void load(OsuColour colours)
        {
            Children = new Drawable[]
            {
                new AspectContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Height = overscan,
                    Children = new Drawable[]
                    {
                        circleOuterBackground = new CircularContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Masking = true,
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    Alpha = 0.2f,
                                    RelativeSizeAxes = Axes.Both,
                                    Colour = Color4.Black,
                                }
                            }
                        },
                        circleOuter = new CircularContainer
                        {
                            Size = new Vector2(circle_outer_scale),
                            EdgeEffect = new EdgeEffectParameters
                            {
                                Colour = Color4.Black.Opacity(0.4f),
                                Type = EdgeEffectType.Shadow,
                                Radius = 15,
                            },
                            RelativeSizeAxes = Axes.Both,
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Masking = true,
                            Children = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Colour = Color4.White,
                                },
                                backgroundParallax = new ParallaxContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    ParallaxAmount = 0.01f,
                                    Anchor = Anchor.Centre,
                                    Origin = Anchor.Centre,
                                    Children = new Drawable[]
                                    {
                                        new Sprite
                                        {
{'fraction_non_alphanumeric': 0.06612085769980507, 'fraction_numerical': 0.008421052631578947, 'mean_word_length': 1.1585324806462471, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 33, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2997325', 'n_tokens_mistral': 3185, 'n_tokens_neox': 2904, 'n_words': 576}