<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.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
using osu.Game.Graphics;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Framework.Localisation;

namespace osu.Game.Screens.Menu
{
    public class SongTicker : Container
    {
        private const int fade_duration = 800;

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

        private readonly OsuSpriteText title, artist;

        public SongTicker()
        {
            AutoSizeAxes = Axes.Both;
            Child = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction = FillDirection.Vertical,
                Spacing = new Vector2(0, 3),
                Children = new Drawable[]
                {
                    title = new OsuSpriteText
                    {
                        Anchor = Anchor.TopRight,
                        Origin = Anchor.TopRight,
                        Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light, italics: true)
                    },
                    artist = new OsuSpriteText
                    {
                        Anchor = Anchor.TopRight,
                        Origin = Anchor.TopRight,
                        Font = OsuFont.GetFont(size: 16)
                    }
                }
            };
        }

        protected override void LoadComplete()
        {
            base.LoadComplete();
            beatmap.BindValueChanged(onBeatmapChanged);
        }

        private void onBeatmapChanged(ValueChangedEvent<WorkingBeatmap> working)
        {
            var metadata = beatmap.Value.Metadata;

            var metadata = working.NewValue.Metadata;

            title.Text = new LocalisedString((metadata.TitleUnicode, metadata.Title));
            artist.Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist));

            this.FadeIn(fade_duration, Easing.OutQuint).Delay(4000).Then().FadeOut(fade_duration, Easing.OutQuint);
        }
    }
}<commit_msg>Ensure only run once when not current screen<commit_after>﻿// Copyright (c) <NAME> <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
using osu.Game.Graphics;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Framework.Localisation;

namespace osu.Game.Screens.Menu
{
    public class SongTicker : Container
    {
        private const int fade_duration = 800;

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

        private readonly OsuSpriteText title, artist;

        public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;

        public SongTicker()
        {
            AutoSizeAxes = Axes.Both;
            Child = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction = FillDirection.Vertical,
                Spacing = new Vector2(0, 3),
                Children = new Drawable[]
                {
                    title = new OsuSpriteText
                    {
                        Anchor = Anchor.TopRight,
                        Origin = Anchor.TopRight,
                        Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light, italics: true)
                    },
                    artist = new OsuSpriteText
                    {
                        Anchor = Anchor.TopRight,
                        Origin = Anchor.TopRight,
                        Font = OsuFont.GetFont(size: 16)
                    }
                }
            };
        }

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

            beatmap.BindValueChanged(_ => Scheduler.AddOnce(show), true);
        }

        private void show()
        {
            var metadata = beatmap.Value.Metadata;

            title.Text = new LocalisedString((metadata.TitleUnicode, metadata.Title));
            artist.Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist));

            this.FadeInFromZero(fade_duration)
                .Delay(4000)
                .Then().FadeOut(fade_duration);
        }
    }
}
{'fraction_non_alphanumeric': 0.08275261324041812, 'fraction_numerical': 0.006097560975609756, 'mean_word_length': 1.6487889273356402, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '4105507', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1177, 'n_words': 275}