mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Make BeatmapInfo expose Ruleset instead of PlayMode.
This commit is contained in:
@ -6,7 +6,6 @@ using osu.Desktop.VisualTests.Platform;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Modes;
|
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
using osu.Game.Screens.Select.Filter;
|
using osu.Game.Screens.Select.Filter;
|
||||||
|
|
||||||
@ -72,7 +71,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
OnlineBeatmapID = 1234 + i,
|
OnlineBeatmapID = 1234 + i,
|
||||||
Mode = PlayMode.Osu,
|
Mode = 0,
|
||||||
Path = "normal.osu",
|
Path = "normal.osu",
|
||||||
Version = "Normal",
|
Version = "Normal",
|
||||||
Difficulty = new BeatmapDifficulty
|
Difficulty = new BeatmapDifficulty
|
||||||
@ -83,7 +82,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
OnlineBeatmapID = 1235 + i,
|
OnlineBeatmapID = 1235 + i,
|
||||||
Mode = PlayMode.Osu,
|
Mode = 0,
|
||||||
Path = "hard.osu",
|
Path = "hard.osu",
|
||||||
Version = "Hard",
|
Version = "Hard",
|
||||||
Difficulty = new BeatmapDifficulty
|
Difficulty = new BeatmapDifficulty
|
||||||
@ -94,7 +93,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
OnlineBeatmapID = 1236 + i,
|
OnlineBeatmapID = 1236 + i,
|
||||||
Mode = PlayMode.Osu,
|
Mode = 0,
|
||||||
Path = "insane.osu",
|
Path = "insane.osu",
|
||||||
Version = "Insane",
|
Version = "Insane",
|
||||||
Difficulty = new BeatmapDifficulty
|
Difficulty = new BeatmapDifficulty
|
||||||
|
@ -9,12 +9,12 @@ using osu.Game.Beatmaps;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Modes;
|
|
||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using osu.Game.Modes.Osu.Objects;
|
using osu.Game.Modes.Osu.Objects;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Desktop.VisualTests.Beatmaps;
|
using osu.Desktop.VisualTests.Beatmaps;
|
||||||
|
using osu.Game.Modes.Osu;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
@ -37,7 +37,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
WorkingBeatmap beatmap = null;
|
WorkingBeatmap beatmap = null;
|
||||||
|
|
||||||
var beatmapInfo = db.Query<BeatmapInfo>().FirstOrDefault(b => b.Mode == PlayMode.Osu);
|
var beatmapInfo = db.Query<BeatmapInfo>().FirstOrDefault(b => b.Ruleset is OsuRuleset);
|
||||||
if (beatmapInfo != null)
|
if (beatmapInfo != null)
|
||||||
beatmap = db.GetWorkingBeatmap(beatmapInfo);
|
beatmap = db.GetWorkingBeatmap(beatmapInfo);
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
|
|
||||||
Assert.IsTrue(set.Beatmaps.Count > 0);
|
Assert.IsTrue(set.Beatmaps.Count > 0);
|
||||||
|
|
||||||
var beatmap = osu.Dependencies.Get<BeatmapDatabase>().GetWorkingBeatmap(set.Beatmaps.First(b => b.Mode == PlayMode.Osu))?.Beatmap;
|
var beatmap = osu.Dependencies.Get<BeatmapDatabase>().GetWorkingBeatmap(set.Beatmaps.First(b => b.Ruleset is OsuRuleset))?.Beatmap;
|
||||||
|
|
||||||
Assert.IsTrue(beatmap?.HitObjects.Count > 0);
|
Assert.IsTrue(beatmap?.HitObjects.Count > 0);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
beatmap.BeatmapInfo.StackLeniency = float.Parse(val, NumberFormatInfo.InvariantInfo);
|
beatmap.BeatmapInfo.StackLeniency = float.Parse(val, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
case @"Mode":
|
case @"Mode":
|
||||||
beatmap.BeatmapInfo.Mode = (PlayMode)int.Parse(val);
|
beatmap.BeatmapInfo.Mode = int.Parse(val);
|
||||||
break;
|
break;
|
||||||
case @"LetterboxInBreaks":
|
case @"LetterboxInBreaks":
|
||||||
beatmap.BeatmapInfo.LetterboxInBreaks = int.Parse(val) == 1;
|
beatmap.BeatmapInfo.LetterboxInBreaks = int.Parse(val) == 1;
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public PlayMode? PreferredPlayMode;
|
public PlayMode? PreferredPlayMode;
|
||||||
|
|
||||||
public PlayMode PlayMode => Beatmap?.BeatmapInfo?.Mode > PlayMode.Osu ? Beatmap.BeatmapInfo.Mode : PreferredPlayMode ?? PlayMode.Osu;
|
public PlayMode PlayMode => Beatmap?.BeatmapInfo?.Mode > (int)PlayMode.Osu ? (PlayMode)Beatmap.BeatmapInfo.Mode : PreferredPlayMode ?? PlayMode.Osu;
|
||||||
|
|
||||||
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>();
|
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>();
|
||||||
|
|
||||||
|
@ -54,7 +54,10 @@ namespace osu.Game.Database
|
|||||||
public bool Countdown { get; set; }
|
public bool Countdown { get; set; }
|
||||||
public float StackLeniency { get; set; }
|
public float StackLeniency { get; set; }
|
||||||
public bool SpecialStyle { get; set; }
|
public bool SpecialStyle { get; set; }
|
||||||
public PlayMode Mode { get; set; }
|
|
||||||
|
public int Mode { get; set; }
|
||||||
|
public Ruleset Ruleset => RulesetCollection.GetRuleset(Mode);
|
||||||
|
|
||||||
public bool LetterboxInBreaks { get; set; }
|
public bool LetterboxInBreaks { get; set; }
|
||||||
public bool WidescreenStoryboard { get; set; }
|
public bool WidescreenStoryboard { get; set; }
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Screens.Play
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config)
|
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
if (Beatmap.Beatmap.BeatmapInfo?.Mode > PlayMode.Taiko)
|
if (Beatmap.Beatmap.BeatmapInfo?.Mode > (int)PlayMode.Taiko)
|
||||||
{
|
{
|
||||||
//we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor.
|
//we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor.
|
||||||
Exit();
|
Exit();
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
var set = g.BeatmapSet;
|
var set = g.BeatmapSet;
|
||||||
|
|
||||||
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.Mode == Mode);
|
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.Mode == (int)Mode);
|
||||||
|
|
||||||
bool match = hasCurrentMode;
|
bool match = hasCurrentMode;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user