mirror of
https://github.com/osukey/osukey.git
synced 2025-07-10 21:00:00 +09:00
Add a dummy beatmap provider for use in BeatmapInfoWedge
This commit is contained in:
37
osu.Game/Beatmaps/DummyWorkingBeatmap.cs
Normal file
37
osu.Game/Beatmaps/DummyWorkingBeatmap.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps
|
||||||
|
{
|
||||||
|
internal class DummyWorkingBeatmap : WorkingBeatmap
|
||||||
|
{
|
||||||
|
public DummyWorkingBeatmap()
|
||||||
|
: base(new BeatmapInfo
|
||||||
|
{
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Artist = "please load a beatmap!",
|
||||||
|
Title = "no beatmaps available!",
|
||||||
|
Author = "no one",
|
||||||
|
},
|
||||||
|
Difficulty = new BeatmapDifficulty(),
|
||||||
|
})
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Beatmap GetBeatmap() => new Beatmap
|
||||||
|
{
|
||||||
|
HitObjects = new List<HitObject>(),
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override Texture GetBackground() => null;
|
||||||
|
|
||||||
|
protected override Track GetTrack() => null;
|
||||||
|
}
|
||||||
|
}
|
@ -45,6 +45,14 @@ namespace osu.Game.Screens.Select
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
State = Visibility.Visible;
|
||||||
|
AlwaysPresent = true;
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool HideOnEscape => false;
|
protected override bool HideOnEscape => false;
|
||||||
|
|
||||||
protected override bool BlockPassThroughMouse => false;
|
protected override bool BlockPassThroughMouse => false;
|
||||||
@ -63,17 +71,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public void UpdateBeatmap(WorkingBeatmap beatmap)
|
public void UpdateBeatmap(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
if (beatmap?.BeatmapInfo == null)
|
if (beatmap == null)
|
||||||
{
|
beatmap = new DummyWorkingBeatmap();
|
||||||
State = Visibility.Hidden;
|
|
||||||
beatmapInfoContainer?.FadeOut(250);
|
|
||||||
beatmapInfoContainer?.Expire();
|
|
||||||
beatmapInfoContainer = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
State = Visibility.Visible;
|
|
||||||
AlwaysPresent = true;
|
|
||||||
|
|
||||||
var lastContainer = beatmapInfoContainer;
|
var lastContainer = beatmapInfoContainer;
|
||||||
float newDepth = lastContainer?.Depth + 1 ?? 0;
|
float newDepth = lastContainer?.Depth + 1 ?? 0;
|
||||||
@ -124,7 +123,8 @@ namespace osu.Game.Screens.Select
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
//get statistics from the current ruleset.
|
//get statistics from the current ruleset.
|
||||||
labels.AddRange(beatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s)));
|
if (beatmapInfo.Ruleset != null)
|
||||||
|
labels.AddRange(beatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s)));
|
||||||
}
|
}
|
||||||
|
|
||||||
PixelSnapping = true;
|
PixelSnapping = true;
|
||||||
|
@ -76,6 +76,7 @@
|
|||||||
<Compile Include="Audio\SampleInfoList.cs" />
|
<Compile Include="Audio\SampleInfoList.cs" />
|
||||||
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
||||||
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
||||||
|
<Compile Include="Beatmaps\DummyWorkingBeatmap.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuClickableContainer.cs" />
|
<Compile Include="Graphics\Containers\OsuClickableContainer.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuFocusedOverlayContainer.cs" />
|
<Compile Include="Graphics\Containers\OsuFocusedOverlayContainer.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuScrollContainer.cs" />
|
<Compile Include="Graphics\Containers\OsuScrollContainer.cs" />
|
||||||
@ -538,4 +539,4 @@
|
|||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
Reference in New Issue
Block a user