<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.Audio.Track;
using osu.Framework.Graphics.Textures;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI;

namespace osu.Game.Beatmaps
{
    public class DummyWorkingBeatmap : WorkingBeatmap
    {
        private readonly OsuGameBase game;

        public DummyWorkingBeatmap(OsuGameBase game = null)
            : base(new BeatmapInfo
            {
                Metadata = new BeatmapMetadata
                {
                    Artist = "please load a beatmap!",
                    Title = "no beatmaps available!"
                },
                BeatmapSet = new BeatmapSetInfo(),
                BaseDifficulty = new BeatmapDifficulty(),
                Ruleset = new DummyRulesetInfo()
            })
        {
            this.game = game;
        }

        protected override IBeatmap GetBeatmap() => new Beatmap();

        protected override Texture GetBackground() => game?.Textures.Get(@"Backgrounds/bg4");

        protected override Track GetTrack() => new TrackVirtual { Length = 1000 };

        private class DummyRulesetInfo : RulesetInfo
        {
            public override Ruleset CreateInstance() => new DummyRuleset(this);

            private class DummyRuleset : Ruleset
            {
                public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[] { };

                public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap)
                {
                    throw new NotImplementedException();
                }

                public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new DummyBeatmapConverter { Beatmap = beatmap };

                public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => null;

                public override string Description => "dummy";

                public override string ShortName => "dummy";

                public DummyRuleset(RulesetInfo rulesetInfo = null)
                    : base(rulesetInfo)
                {
                }

                private class DummyBeatmapConverter : IBeatmapConverter
                {
                    public event Action<HitObject, IEnumerable<HitObject>> ObjectConverted;
                    public IBeatmap Beatmap { get; set; }
                    public bool CanConvert => true;
                    public IBeatmap Convert() => Beatmap;
                }
            }
        }
    }
}
<commit_msg>Set DummyWorkingBeatmap difficulties to 0 for better fallback display<commit_after>﻿// Copyright (c) ppy <NAME> <<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.Audio.Track;
using osu.Framework.Graphics.Textures;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI;

namespace osu.Game.Beatmaps
{
    public class DummyWorkingBeatmap : WorkingBeatmap
    {
        private readonly OsuGameBase game;

        public DummyWorkingBeatmap(OsuGameBase game = null)
            : base(new BeatmapInfo
            {
                Metadata = new BeatmapMetadata
                {
                    Artist = "please load a beatmap!",
                    Title = "no beatmaps available!"
                },
                BeatmapSet = new BeatmapSetInfo(),
                BaseDifficulty = new BeatmapDifficulty
                {
                    DrainRate = 0,
                    CircleSize = 0,
                    OverallDifficulty = 0,
                },
                Ruleset = new DummyRulesetInfo()
            })
        {
            this.game = game;
        }

        protected override IBeatmap GetBeatmap() => new Beatmap();

        protected override Texture GetBackground() => game?.Textures.Get(@"Backgrounds/bg4");

        protected override Track GetTrack() => new TrackVirtual { Length = 1000 };

        private class DummyRulesetInfo : RulesetInfo
        {
            public override Ruleset CreateInstance() => new DummyRuleset(this);

            private class DummyRuleset : Ruleset
            {
                public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[] { };

                public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap)
                {
                    throw new NotImplementedException();
                }

                public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new DummyBeatmapConverter { Beatmap = beatmap };

                public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => null;

                public override string Description => "dummy";

                public override string ShortName => "dummy";

                public DummyRuleset(RulesetInfo rulesetInfo = null)
                    : base(rulesetInfo)
                {
                }

                private class DummyBeatmapConverter : IBeatmapConverter
                {
                    public event Action<HitObject, IEnumerable<HitObject>> ObjectConverted;
                    public IBeatmap Beatmap { get; set; }
                    public bool CanConvert => true;
                    public IBeatmap Convert() => Beatmap;
                }
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.07270829709514698, 'fraction_numerical': 0.002435206122803966, 'mean_word_length': 1.842313395946614, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 36, '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': '1547009', 'n_tokens_mistral': 1520, 'n_tokens_neox': 1369, 'n_words': 375}