2019-01-24 08:43:03 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2021-04-17 15:47:13 +00:00
|
|
|
|
using System.IO;
|
2020-09-17 08:40:05 +00:00
|
|
|
|
using System.Threading;
|
2020-08-07 13:05:58 +00:00
|
|
|
|
using JetBrains.Annotations;
|
2019-05-31 05:51:12 +00:00
|
|
|
|
using osu.Framework.Audio;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Framework.Audio.Track;
|
2019-04-25 08:36:17 +00:00
|
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Framework.Graphics.Textures;
|
|
|
|
|
using osu.Game.Rulesets;
|
2018-05-15 08:38:04 +00:00
|
|
|
|
using osu.Game.Rulesets.Difficulty;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2018-04-19 13:04:12 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
using osu.Game.Rulesets.UI;
|
2021-05-21 17:21:00 +00:00
|
|
|
|
using osu.Game.Skinning;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps
|
|
|
|
|
{
|
|
|
|
|
public class DummyWorkingBeatmap : WorkingBeatmap
|
|
|
|
|
{
|
2019-05-31 05:51:12 +00:00
|
|
|
|
private readonly TextureStore textures;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2020-08-07 13:05:58 +00:00
|
|
|
|
public DummyWorkingBeatmap([NotNull] AudioManager audio, TextureStore textures)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
: base(new BeatmapInfo
|
|
|
|
|
{
|
|
|
|
|
Metadata = new BeatmapMetadata
|
|
|
|
|
{
|
|
|
|
|
Artist = "please load a beatmap!",
|
|
|
|
|
Title = "no beatmaps available!"
|
|
|
|
|
},
|
|
|
|
|
BeatmapSet = new BeatmapSetInfo(),
|
2019-03-08 09:17:50 +00:00
|
|
|
|
BaseDifficulty = new BeatmapDifficulty
|
|
|
|
|
{
|
|
|
|
|
DrainRate = 0,
|
|
|
|
|
CircleSize = 0,
|
|
|
|
|
OverallDifficulty = 0,
|
|
|
|
|
},
|
2018-04-13 09:19:50 +00:00
|
|
|
|
Ruleset = new DummyRulesetInfo()
|
2019-05-31 05:51:12 +00:00
|
|
|
|
}, audio)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
2019-05-31 05:51:12 +00:00
|
|
|
|
this.textures = textures;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-05-07 02:22:25 +00:00
|
|
|
|
protected override IBeatmap GetBeatmap() => new Beatmap();
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-05-31 05:51:12 +00:00
|
|
|
|
protected override Texture GetBackground() => textures?.Get(@"Backgrounds/bg4");
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2020-08-07 13:31:41 +00:00
|
|
|
|
protected override Track GetBeatmapTrack() => GetVirtualTrack();
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2021-08-15 16:38:01 +00:00
|
|
|
|
protected internal override ISkin GetSkin() => null;
|
2021-05-21 17:21:00 +00:00
|
|
|
|
|
2021-04-17 15:47:13 +00:00
|
|
|
|
public override Stream GetStream(string storagePath) => null;
|
|
|
|
|
|
2018-04-13 09:19:50 +00:00
|
|
|
|
private class DummyRulesetInfo : RulesetInfo
|
|
|
|
|
{
|
2019-12-18 05:49:09 +00:00
|
|
|
|
public override Ruleset CreateInstance() => new DummyRuleset();
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
private class DummyRuleset : Ruleset
|
|
|
|
|
{
|
2019-11-28 13:41:29 +00:00
|
|
|
|
public override IEnumerable<Mod> GetModsFor(ModType type) => Array.Empty<Mod>();
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-12-12 06:58:11 +00:00
|
|
|
|
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-19 13:04:12 +00:00
|
|
|
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new DummyBeatmapConverter { Beatmap = beatmap };
|
|
|
|
|
|
2019-02-21 04:12:37 +00:00
|
|
|
|
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => null;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
|
|
|
|
public override string Description => "dummy";
|
|
|
|
|
|
|
|
|
|
public override string ShortName => "dummy";
|
|
|
|
|
|
2018-04-19 13:04:12 +00:00
|
|
|
|
private class DummyBeatmapConverter : IBeatmapConverter
|
|
|
|
|
{
|
|
|
|
|
public event Action<HitObject, IEnumerable<HitObject>> ObjectConverted;
|
2019-04-25 08:36:17 +00:00
|
|
|
|
|
2018-04-19 13:04:12 +00:00
|
|
|
|
public IBeatmap Beatmap { get; set; }
|
2019-04-25 08:36:17 +00:00
|
|
|
|
|
2019-12-23 08:44:18 +00:00
|
|
|
|
public bool CanConvert() => true;
|
2019-04-25 08:36:17 +00:00
|
|
|
|
|
2020-09-17 09:37:48 +00:00
|
|
|
|
public IBeatmap Convert(CancellationToken cancellationToken = default)
|
2019-04-25 08:36:17 +00:00
|
|
|
|
{
|
|
|
|
|
foreach (var obj in Beatmap.HitObjects)
|
|
|
|
|
ObjectConverted?.Invoke(obj, obj.Yield());
|
|
|
|
|
|
|
|
|
|
return Beatmap;
|
|
|
|
|
}
|
2018-04-19 13:04:12 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|