1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +08:00

Make BeatmapInfo expose Ruleset instead of PlayMode.

This commit is contained in:
smoogipooo 2017-04-15 05:01:36 +09:00
parent 59bfc7abad
commit a89af273be
8 changed files with 14 additions and 12 deletions

View File

@ -6,7 +6,6 @@ using osu.Desktop.VisualTests.Platform;
using osu.Framework.Testing;
using osu.Framework.MathUtils;
using osu.Game.Database;
using osu.Game.Modes;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
@ -72,7 +71,7 @@ namespace osu.Desktop.VisualTests.Tests
new BeatmapInfo
{
OnlineBeatmapID = 1234 + i,
Mode = PlayMode.Osu,
Mode = 0,
Path = "normal.osu",
Version = "Normal",
Difficulty = new BeatmapDifficulty
@ -83,7 +82,7 @@ namespace osu.Desktop.VisualTests.Tests
new BeatmapInfo
{
OnlineBeatmapID = 1235 + i,
Mode = PlayMode.Osu,
Mode = 0,
Path = "hard.osu",
Version = "Hard",
Difficulty = new BeatmapDifficulty
@ -94,7 +93,7 @@ namespace osu.Desktop.VisualTests.Tests
new BeatmapInfo
{
OnlineBeatmapID = 1236 + i,
Mode = PlayMode.Osu,
Mode = 0,
Path = "insane.osu",
Version = "Insane",
Difficulty = new BeatmapDifficulty

View File

@ -9,12 +9,12 @@ using osu.Game.Beatmaps;
using OpenTK;
using osu.Framework.Graphics.Sprites;
using osu.Game.Database;
using osu.Game.Modes;
using osu.Game.Modes.Objects;
using osu.Game.Modes.Osu.Objects;
using osu.Game.Screens.Play;
using OpenTK.Graphics;
using osu.Desktop.VisualTests.Beatmaps;
using osu.Game.Modes.Osu;
namespace osu.Desktop.VisualTests.Tests
{
@ -37,7 +37,7 @@ namespace osu.Desktop.VisualTests.Tests
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)
beatmap = db.GetWorkingBeatmap(beatmapInfo);

View File

@ -166,7 +166,7 @@ namespace osu.Game.Tests.Beatmaps.IO
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);
}

View File

@ -84,7 +84,7 @@ namespace osu.Game.Beatmaps.Formats
beatmap.BeatmapInfo.StackLeniency = float.Parse(val, NumberFormatInfo.InvariantInfo);
break;
case @"Mode":
beatmap.BeatmapInfo.Mode = (PlayMode)int.Parse(val);
beatmap.BeatmapInfo.Mode = int.Parse(val);
break;
case @"LetterboxInBreaks":
beatmap.BeatmapInfo.LetterboxInBreaks = int.Parse(val) == 1;

View File

@ -24,7 +24,7 @@ namespace osu.Game.Beatmaps
/// </summary>
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>>();

View File

@ -54,7 +54,10 @@ namespace osu.Game.Database
public bool Countdown { get; set; }
public float StackLeniency { 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 WidescreenStoryboard { get; set; }

View File

@ -63,7 +63,7 @@ namespace osu.Game.Screens.Play
[BackgroundDependencyLoader]
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.
Exit();

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select
{
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;