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

using System;
using System.Linq;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Scoring;
using osu.Game.Users;
using osuTK;

namespace osu.Game.Screens.Play
{
    public class InGameScoreContainer : FillFlowContainer<InGameScoreItem>
    {
        /// <summary>
        /// Called once an item's score has changed.
        /// Useful for doing calculations on what score to show or hide next. (scrolling system)
        /// </summary>
        public event Action OnScoreChange;

        /// <summary>
        /// Whether to declare a new position for un-positioned players.
        /// Must be disabled for online leaderboards with top 50 scores only.
        /// </summary>
        public bool DeclareNewPosition = true;

        public InGameScoreContainer()
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes = Axes.Y;
            Direction = FillDirection.Vertical;
            Spacing = new Vector2(2.5f);
            LayoutDuration = 500;
            LayoutEasing = Easing.OutQuint;
        }

        public void AddRealTimePlayer(BindableDouble currentScore, User user = null)
        {
            if (currentScore == null)
                return;

            var scoreItem = addScore(currentScore.Value, user);
            currentScore.ValueChanged += s => scoreItem.TotalScore = s.NewValue;
        }

        public void AddScore(ScoreInfo score, int? position = null)
        {
            if (score != null)
                addScore(score.TotalScore, score.User, position);
        }

        private int maxPosition => this.Where(i => i.ScorePosition.HasValue).Max(i => i.ScorePosition) ?? 0;
<commit_msg>Add xmldocs and return score items.<commit_after>// Copyright (c) <NAME> <<EMAIL>>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Linq;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Scoring;
using osu.Game.Users;
using osuTK;

namespace osu.Game.Screens.Play
{
    public class InGameScoreContainer : FillFlowContainer<InGameScoreItem>
    {
        /// <summary>
        /// Called once an item's score has changed.
        /// Useful for doing calculations on what score to show or hide next. (scrolling system)
        /// </summary>
        public event Action OnScoreChange;

        /// <summary>
        /// Whether to declare a new position for un-positioned players.
        /// Must be disabled for online leaderboards with top 50 scores only.
        /// </summary>
        public bool DeclareNewPosition = true;

        public InGameScoreContainer()
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes = Axes.Y;
            Direction = FillDirection.Vertical;
            Spacing = new Vector2(2.5f);
            LayoutDuration = 500;
            LayoutEasing = Easing.OutQuint;
        }

        /// <summary>
        /// Adds a real-time player score item whose score is updated via a <see cref="BindableDouble"/>.
        /// </summary>
        /// <param name="currentScore">The bindable current score of the player.</param>
        /// <param name="user">The player user.</param>
        /// <returns>Returns the drawable score item of that player.</returns>
        public InGameScoreItem AddRealTimePlayer(BindableDouble currentScore, User user = null)
        {
            if (currentScore == null)
                return null;

            var scoreItem = addScore(currentScore.Value, user);
            currentScore.ValueChanged += s => scoreItem.TotalScore = s.NewValue;

            return scoreItem;
        }

        /// <summary>
        /// Adds a score item based off a <see cref="ScoreInfo"/> with an initial position.
        /// </summary>
        /// <param name="score">The score info to use for this item.</param>
        /// <param name="position">The initial position of this item.</param>
        /// <returns>Returns the drawable score item of that player.</returns>
        public InGameScoreItem AddScore(ScoreInfo score, int? position = null) => score != null ? addScore(score.TotalScore, score.User, position) : null;

        private int maxPosition => this.Where(i => i.ScorePosition.HasValue).Max(i => i.ScorePosition) ?? 0;

{'fraction_non_alphanumeric': 0.10236386661038413, 'fraction_numerical': 0.003799071338117349, 'mean_word_length': 2.339675828047921, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '5891326', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1263, 'n_words': 402}