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

using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;
using osu.Game.Graphics;

namespace osu.Game.Screens.Select.Options
{
    public class BeatmapOptionsOverlay : FocusedOverlayContainer
    {
        private const float transition_duration = 500;
        private const float x_position = 290;

        private Container background;
        private FillFlowContainer<BeatmapOptionsButton> buttonsContainer;

        public Action OnRemoveFromUnplayed;
        public Action OnClearLocalScores;
        public Action OnEdit;
        public Action OnDelete;

        protected override void PopIn()
        {
            base.PopIn();

            if (buttonsContainer.Position.X >= DrawWidth || buttonsContainer.Alpha <= 0)
                buttonsContainer.MoveToX(-buttonsContainer.DrawWidth);

            buttonsContainer.Alpha = 1;

            background.FadeIn(transition_duration, EasingTypes.OutQuint);
            buttonsContainer.MoveToX(x_position, transition_duration, EasingTypes.OutQuint);
            buttonsContainer.TransformSpacingTo(Vector2.Zero, transition_duration, EasingTypes.OutQuint);
        }

        protected override void PopOut()
        {
            base.PopOut();

            background.FadeOut(transition_duration, EasingTypes.InSine);
            buttonsContainer.MoveToX(DrawWidth, transition_duration, EasingTypes.InSine);
            buttonsContainer.TransformSpacingTo(new Vector2(200f, 0f), transition_duration, EasingTypes.InSine);

            Delay(transition_duration);
            Schedule(() =>
            {
                if (State == Visibility.Hidden)
                    buttonsContainer.Alpha = 0;
            });
        }

        public BeatmapOptionsOverlay()
        {
            Children = new Drawable[]
            {
                background = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = Color4.Black.Opacity(0.5f),
                        },
                    },
                },
                buttonsContainer = new FillFlowContainer<BeatmapOptionsButton>
                {
                    AutoSizeAxes = Axes.Both,
                    Origin = Anchor.BottomLeft,
                    Anchor = Anchor.BottomLeft,
                    Direction = FillDirection.Left,
                    Padding = new MarginPadding
                    {
                        Left = BeatmapOptionsButton.SIZE.X, // For some reason autosize on this flow container is one button too short
                    },
                    Children = new BeatmapOptionsButton[]
                    {
                        new BeatmapOptionsDeleteButton
                        {
                            Action = () =>
                            {<commit_msg>Remove hack (fixed at framework level).<commit_after>﻿// Copyright (c) 2007-2017 ppy Pty Ltd <<EMAIL>>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;
using osu.Game.Graphics;

namespace osu.Game.Screens.Select.Options
{
    public class BeatmapOptionsOverlay : FocusedOverlayContainer
    {
        private const float transition_duration = 500;
        private const float x_position = 290;

        private Container background;
        private FillFlowContainer<BeatmapOptionsButton> buttonsContainer;

        public Action OnRemoveFromUnplayed;
        public Action OnClearLocalScores;
        public Action OnEdit;
        public Action OnDelete;

        protected override void PopIn()
        {
            base.PopIn();

            if (buttonsContainer.Position.X >= DrawWidth || buttonsContainer.Alpha <= 0)
                buttonsContainer.MoveToX(-buttonsContainer.DrawWidth);

            buttonsContainer.Alpha = 1;

            background.FadeIn(transition_duration, EasingTypes.OutQuint);
            buttonsContainer.MoveToX(x_position, transition_duration, EasingTypes.OutQuint);
            buttonsContainer.TransformSpacingTo(Vector2.Zero, transition_duration, EasingTypes.OutQuint);
        }

        protected override void PopOut()
        {
            base.PopOut();

            background.FadeOut(transition_duration, EasingTypes.InSine);
            buttonsContainer.MoveToX(DrawWidth, transition_duration, EasingTypes.InSine);
            buttonsContainer.TransformSpacingTo(new Vector2(200f, 0f), transition_duration, EasingTypes.InSine);

            Delay(transition_duration);
            Schedule(() =>
            {
                if (State == Visibility.Hidden)
                    buttonsContainer.Alpha = 0;
            });
        }

        public BeatmapOptionsOverlay()
        {
            Children = new Drawable[]
            {
                background = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Colour = Color4.Black.Opacity(0.5f),
                        },
                    },
                },
                buttonsContainer = new FillFlowContainer<BeatmapOptionsButton>
                {
                    AutoSizeAxes = Axes.Both,
                    Origin = Anchor.BottomLeft,
                    Anchor = Anchor.BottomLeft,
                    Direction = FillDirection.Left,
                    Children = new BeatmapOptionsButton[]
                    {
                        new BeatmapOptionsDeleteButton
                        {
                            Action = () =>
                            {
{'fraction_non_alphanumeric': 0.073689109525287, 'fraction_numerical': 0.008067018305926156, 'mean_word_length': 1.6357318070318887, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 2, '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': '933255', 'n_tokens_mistral': 1636, 'n_tokens_neox': 1492, 'n_words': 313}