2019-01-24 16:43:03 +08: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 17:19:50 +08:00
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2017-07-19 17:02:11 +08:00
|
|
|
|
using System;
|
2017-07-18 15:51:34 +08:00
|
|
|
|
using System.Collections.Generic;
|
2021-04-17 23:47:13 +08:00
|
|
|
|
using System.IO;
|
2020-09-17 16:40:05 +08:00
|
|
|
|
using System.Threading;
|
2020-08-07 21:05:58 +08:00
|
|
|
|
using JetBrains.Annotations;
|
2019-05-31 13:51:12 +08:00
|
|
|
|
using osu.Framework.Audio;
|
2017-07-18 15:51:34 +08:00
|
|
|
|
using osu.Framework.Audio.Track;
|
2019-04-25 16:36:17 +08:00
|
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
2017-07-18 15:51:34 +08:00
|
|
|
|
using osu.Framework.Graphics.Textures;
|
2017-07-19 08:59:47 +08:00
|
|
|
|
using osu.Game.Rulesets;
|
2018-05-15 16:38:04 +08:00
|
|
|
|
using osu.Game.Rulesets.Difficulty;
|
2017-07-19 08:59:47 +08:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2018-04-19 21:04:12 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2017-07-19 08:59:47 +08:00
|
|
|
|
using osu.Game.Rulesets.UI;
|
2021-05-22 01:21:00 +08:00
|
|
|
|
using osu.Game.Skinning;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-07-18 15:51:34 +08:00
|
|
|
|
namespace osu.Game.Beatmaps
|
|
|
|
|
{
|
2017-11-21 10:49:42 +08:00
|
|
|
|
public class DummyWorkingBeatmap : WorkingBeatmap
|
2017-07-18 15:51:34 +08:00
|
|
|
|
{
|
2019-05-31 13:51:12 +08:00
|
|
|
|
private readonly TextureStore textures;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-08-07 21:05:58 +08:00
|
|
|
|
public DummyWorkingBeatmap([NotNull] AudioManager audio, TextureStore textures)
|
2017-07-18 15:51:34 +08:00
|
|
|
|
: base(new BeatmapInfo
|
|
|
|
|
{
|
|
|
|
|
Metadata = new BeatmapMetadata
|
|
|
|
|
{
|
|
|
|
|
Artist = "please load a beatmap!",
|
2017-12-22 19:33:52 +08:00
|
|
|
|
Title = "no beatmaps available!"
|
2017-07-18 15:51:34 +08:00
|
|
|
|
},
|
2017-07-18 16:44:45 +08:00
|
|
|
|
BeatmapSet = new BeatmapSetInfo(),
|
2022-01-18 21:57:39 +08:00
|
|
|
|
Difficulty = new BeatmapDifficulty
|
2019-03-08 17:17:50 +08:00
|
|
|
|
{
|
|
|
|
|
DrainRate = 0,
|
|
|
|
|
CircleSize = 0,
|
|
|
|
|
OverallDifficulty = 0,
|
|
|
|
|
},
|
2021-11-22 15:39:17 +08:00
|
|
|
|
Ruleset = new DummyRuleset().RulesetInfo
|
2019-05-31 13:51:12 +08:00
|
|
|
|
}, audio)
|
2017-07-18 15:51:34 +08:00
|
|
|
|
{
|
2019-05-31 13:51:12 +08:00
|
|
|
|
this.textures = textures;
|
2022-07-28 16:58:13 +08:00
|
|
|
|
|
|
|
|
|
// We are guaranteed to have a virtual track.
|
|
|
|
|
// To ease usability, ensure the track is available from point of construction.
|
|
|
|
|
LoadTrack();
|
2017-07-18 15:51:34 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-05-07 10:22:25 +08:00
|
|
|
|
protected override IBeatmap GetBeatmap() => new Beatmap();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2023-06-08 15:17:44 +08:00
|
|
|
|
public override Texture GetBackground() => textures?.Get(@"Backgrounds/bg4");
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2020-08-07 21:31:41 +08:00
|
|
|
|
protected override Track GetBeatmapTrack() => GetVirtualTrack();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-08-16 00:38:01 +08:00
|
|
|
|
protected internal override ISkin GetSkin() => null;
|
2021-05-22 01:21:00 +08:00
|
|
|
|
|
2021-04-17 23:47:13 +08:00
|
|
|
|
public override Stream GetStream(string storagePath) => null;
|
|
|
|
|
|
2021-11-22 15:39:17 +08:00
|
|
|
|
private class DummyRuleset : Ruleset
|
2017-07-19 08:59:47 +08:00
|
|
|
|
{
|
2021-11-22 15:39:17 +08:00
|
|
|
|
public override IEnumerable<Mod> GetModsFor(ModType type) => Array.Empty<Mod>();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-11-22 15:39:17 +08:00
|
|
|
|
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
2017-07-19 08:59:47 +08:00
|
|
|
|
{
|
2021-11-22 15:39:17 +08:00
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-11-22 15:39:17 +08:00
|
|
|
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new DummyBeatmapConverter { Beatmap = beatmap };
|
2018-04-19 21:04:12 +08:00
|
|
|
|
|
2021-11-22 15:39:17 +08:00
|
|
|
|
public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => null;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-11-22 15:39:17 +08:00
|
|
|
|
public override string Description => "dummy";
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-11-22 15:39:17 +08:00
|
|
|
|
public override string ShortName => "dummy";
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-11-22 15:39:17 +08:00
|
|
|
|
private class DummyBeatmapConverter : IBeatmapConverter
|
|
|
|
|
{
|
|
|
|
|
public event Action<HitObject, IEnumerable<HitObject>> ObjectConverted;
|
2019-04-25 16:36:17 +08:00
|
|
|
|
|
2021-11-22 15:39:17 +08:00
|
|
|
|
public IBeatmap Beatmap { get; set; }
|
2019-04-25 16:36:17 +08:00
|
|
|
|
|
2021-11-22 15:39:17 +08:00
|
|
|
|
public bool CanConvert() => true;
|
2019-04-25 16:36:17 +08:00
|
|
|
|
|
2021-11-22 15:39:17 +08:00
|
|
|
|
public IBeatmap Convert(CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
|
foreach (var obj in Beatmap.HitObjects)
|
|
|
|
|
ObjectConverted?.Invoke(obj, obj.Yield());
|
2019-04-25 16:36:17 +08:00
|
|
|
|
|
2021-11-22 15:39:17 +08:00
|
|
|
|
return Beatmap;
|
2018-04-19 21:04:12 +08:00
|
|
|
|
}
|
2017-07-19 08:59:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-07-18 15:51:34 +08:00
|
|
|
|
}
|
|
|
|
|
}
|