1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 11:12:54 +08:00

Extract the rest of legacy enums

This commit is contained in:
smoogipoo 2019-12-10 20:23:15 +09:00
parent 3c18872a16
commit c378e525da
8 changed files with 61 additions and 48 deletions

View File

@ -294,22 +294,22 @@ namespace osu.Game.Beatmaps.Formats
{
string[] split = line.Split(',');
if (!Enum.TryParse(split[0], out EventType type))
if (!Enum.TryParse(split[0], out LegacyEventType type))
throw new InvalidDataException($@"Unknown event type: {split[0]}");
switch (type)
{
case EventType.Background:
case LegacyEventType.Background:
string bgFilename = split[2].Trim('"');
beatmap.BeatmapInfo.Metadata.BackgroundFile = FileSafety.PathStandardise(bgFilename);
break;
case EventType.Video:
case LegacyEventType.Video:
string videoFilename = split[2].Trim('"');
beatmap.BeatmapInfo.Metadata.VideoFile = FileSafety.PathStandardise(videoFilename);
break;
case EventType.Break:
case LegacyEventType.Break:
double start = getOffsetTime(Parsing.ParseDouble(split[1]));
var breakEvent = new BreakPeriod

View File

@ -148,46 +148,9 @@ namespace osu.Game.Beatmaps.Formats
Fonts
}
internal enum LegacySampleBank
{
None = 0,
Normal = 1,
Soft = 2,
Drum = 3
}
internal enum EventType
{
Background = 0,
Video = 1,
Break = 2,
Colour = 3,
Sprite = 4,
Sample = 5,
Animation = 6
}
internal enum LegacyOrigins
{
TopLeft,
Centre,
CentreLeft,
TopRight,
BottomCentre,
TopCentre,
Custom,
CentreRight,
BottomLeft,
BottomRight
}
internal enum StoryLayer
{
Background = 0,
Fail = 1,
Pass = 2,
Foreground = 3
}
internal class LegacyDifficultyControlPoint : DifficultyControlPoint
{

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics;
using osu.Framework.IO.File;
using osu.Game.IO;
using osu.Game.Storyboards;
using osu.Game.Beatmaps.Legacy;
namespace osu.Game.Beatmaps.Formats
{
@ -83,12 +84,12 @@ namespace osu.Game.Beatmaps.Formats
{
storyboardSprite = null;
if (!Enum.TryParse(split[0], out EventType type))
if (!Enum.TryParse(split[0], out LegacyEventType type))
throw new InvalidDataException($@"Unknown event type: {split[0]}");
switch (type)
{
case EventType.Sprite:
case LegacyEventType.Sprite:
{
var layer = parseLayer(split[1]);
var origin = parseOrigin(split[2]);
@ -100,7 +101,7 @@ namespace osu.Game.Beatmaps.Formats
break;
}
case EventType.Animation:
case LegacyEventType.Animation:
{
var layer = parseLayer(split[1]);
var origin = parseOrigin(split[2]);
@ -115,7 +116,7 @@ namespace osu.Game.Beatmaps.Formats
break;
}
case EventType.Sample:
case LegacyEventType.Sample:
{
var time = double.Parse(split[1], CultureInfo.InvariantCulture);
var layer = parseLayer(split[2]);
@ -271,7 +272,7 @@ namespace osu.Game.Beatmaps.Formats
}
}
private string parseLayer(string value) => Enum.Parse(typeof(StoryLayer), value).ToString();
private string parseLayer(string value) => Enum.Parse(typeof(LegacyStoryLayer), value).ToString();
private Anchor parseOrigin(string value)
{

View File

@ -0,0 +1,13 @@
namespace osu.Game.Beatmaps.Legacy
{
internal enum LegacyEventType
{
Background = 0,
Video = 1,
Break = 2,
Colour = 3,
Sprite = 4,
Sample = 5,
Animation = 6
}
}

View File

@ -0,0 +1,16 @@
namespace osu.Game.Beatmaps.Legacy
{
internal enum LegacyOrigins
{
TopLeft,
Centre,
CentreLeft,
TopRight,
BottomCentre,
TopCentre,
Custom,
CentreRight,
BottomLeft,
BottomRight
}
}

View File

@ -0,0 +1,10 @@
namespace osu.Game.Beatmaps.Legacy
{
internal enum LegacySampleBank
{
None = 0,
Normal = 1,
Soft = 2,
Drum = 3
}
}

View File

@ -0,0 +1,10 @@
namespace osu.Game.Beatmaps.Legacy
{
internal enum LegacyStoryLayer
{
Background = 0,
Fail = 1,
Pass = 2,
Foreground = 3
}
}

View File

@ -232,8 +232,8 @@ namespace osu.Game.Rulesets.Objects.Legacy
string[] split = str.Split(':');
var bank = (LegacyBeatmapDecoder.LegacySampleBank)Parsing.ParseInt(split[0]);
var addbank = (LegacyBeatmapDecoder.LegacySampleBank)Parsing.ParseInt(split[1]);
var bank = (LegacySampleBank)Parsing.ParseInt(split[0]);
var addbank = (LegacySampleBank)Parsing.ParseInt(split[1]);
string stringBank = bank.ToString().ToLowerInvariant();
if (stringBank == @"none")