mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
CI adjustments
- removing unnecessary `using`s - name Fields/Methods according to rules - removing unnecessary initializations
This commit is contained in:
@ -7,34 +7,20 @@ using System.Globalization;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Beatmaps.Legacy;
|
|
||||||
using osu.Game.Rulesets.Objects.Legacy;
|
using osu.Game.Rulesets.Objects.Legacy;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Storyboards;
|
|
||||||
using OpenTK;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.IO.File;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Formats
|
namespace osu.Game.Beatmaps.Formats
|
||||||
{
|
{
|
||||||
public class LegacyBeatmapDecoder : LegacyDecoder
|
public class LegacyBeatmapDecoder : LegacyDecoder
|
||||||
{
|
{
|
||||||
|
private bool hasCustomColours;
|
||||||
private ConvertHitObjectParser parser;
|
private ConvertHitObjectParser parser;
|
||||||
private bool hasCustomColours = false;
|
|
||||||
|
|
||||||
private LegacySampleBank defaultSampleBank;
|
private LegacySampleBank defaultSampleBank;
|
||||||
private int defaultSampleVolume = 100;
|
private int defaultSampleVolume = 100;
|
||||||
|
|
||||||
public LegacyBeatmapDecoder()
|
protected override void ProcessSection(Section section, string line)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public LegacyBeatmapDecoder(string header)
|
|
||||||
{
|
|
||||||
beatmapVersion = int.Parse(header.Substring(17));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void processSection(Section section, string line)
|
|
||||||
{
|
{
|
||||||
switch (section)
|
switch (section)
|
||||||
{
|
{
|
||||||
@ -72,20 +58,20 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
var pair = splitKeyVal(line, ':');
|
var pair = splitKeyVal(line, ':');
|
||||||
|
|
||||||
var metadata = beatmap.BeatmapInfo.Metadata;
|
var metadata = Beatmap.BeatmapInfo.Metadata;
|
||||||
switch (pair.Key)
|
switch (pair.Key)
|
||||||
{
|
{
|
||||||
case @"AudioFilename":
|
case @"AudioFilename":
|
||||||
metadata.AudioFile = pair.Value;
|
metadata.AudioFile = pair.Value;
|
||||||
break;
|
break;
|
||||||
case @"AudioLeadIn":
|
case @"AudioLeadIn":
|
||||||
beatmap.BeatmapInfo.AudioLeadIn = int.Parse(pair.Value);
|
Beatmap.BeatmapInfo.AudioLeadIn = int.Parse(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"PreviewTime":
|
case @"PreviewTime":
|
||||||
metadata.PreviewTime = int.Parse(pair.Value);
|
metadata.PreviewTime = int.Parse(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"Countdown":
|
case @"Countdown":
|
||||||
beatmap.BeatmapInfo.Countdown = int.Parse(pair.Value) == 1;
|
Beatmap.BeatmapInfo.Countdown = int.Parse(pair.Value) == 1;
|
||||||
break;
|
break;
|
||||||
case @"SampleSet":
|
case @"SampleSet":
|
||||||
defaultSampleBank = (LegacySampleBank)Enum.Parse(typeof(LegacySampleBank), pair.Value);
|
defaultSampleBank = (LegacySampleBank)Enum.Parse(typeof(LegacySampleBank), pair.Value);
|
||||||
@ -94,12 +80,12 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
defaultSampleVolume = int.Parse(pair.Value);
|
defaultSampleVolume = int.Parse(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"StackLeniency":
|
case @"StackLeniency":
|
||||||
beatmap.BeatmapInfo.StackLeniency = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
Beatmap.BeatmapInfo.StackLeniency = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
case @"Mode":
|
case @"Mode":
|
||||||
beatmap.BeatmapInfo.RulesetID = int.Parse(pair.Value);
|
Beatmap.BeatmapInfo.RulesetID = int.Parse(pair.Value);
|
||||||
|
|
||||||
switch (beatmap.BeatmapInfo.RulesetID)
|
switch (Beatmap.BeatmapInfo.RulesetID)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser();
|
parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser();
|
||||||
@ -116,13 +102,13 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case @"LetterboxInBreaks":
|
case @"LetterboxInBreaks":
|
||||||
beatmap.BeatmapInfo.LetterboxInBreaks = int.Parse(pair.Value) == 1;
|
Beatmap.BeatmapInfo.LetterboxInBreaks = int.Parse(pair.Value) == 1;
|
||||||
break;
|
break;
|
||||||
case @"SpecialStyle":
|
case @"SpecialStyle":
|
||||||
beatmap.BeatmapInfo.SpecialStyle = int.Parse(pair.Value) == 1;
|
Beatmap.BeatmapInfo.SpecialStyle = int.Parse(pair.Value) == 1;
|
||||||
break;
|
break;
|
||||||
case @"WidescreenStoryboard":
|
case @"WidescreenStoryboard":
|
||||||
beatmap.BeatmapInfo.WidescreenStoryboard = int.Parse(pair.Value) == 1;
|
Beatmap.BeatmapInfo.WidescreenStoryboard = int.Parse(pair.Value) == 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -134,19 +120,19 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
switch (pair.Key)
|
switch (pair.Key)
|
||||||
{
|
{
|
||||||
case @"Bookmarks":
|
case @"Bookmarks":
|
||||||
beatmap.BeatmapInfo.StoredBookmarks = pair.Value;
|
Beatmap.BeatmapInfo.StoredBookmarks = pair.Value;
|
||||||
break;
|
break;
|
||||||
case @"DistanceSpacing":
|
case @"DistanceSpacing":
|
||||||
beatmap.BeatmapInfo.DistanceSpacing = double.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
Beatmap.BeatmapInfo.DistanceSpacing = double.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
case @"BeatDivisor":
|
case @"BeatDivisor":
|
||||||
beatmap.BeatmapInfo.BeatDivisor = int.Parse(pair.Value);
|
Beatmap.BeatmapInfo.BeatDivisor = int.Parse(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"GridSize":
|
case @"GridSize":
|
||||||
beatmap.BeatmapInfo.GridSize = int.Parse(pair.Value);
|
Beatmap.BeatmapInfo.GridSize = int.Parse(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"TimelineZoom":
|
case @"TimelineZoom":
|
||||||
beatmap.BeatmapInfo.TimelineZoom = double.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
Beatmap.BeatmapInfo.TimelineZoom = double.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,7 +141,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
var pair = splitKeyVal(line, ':');
|
var pair = splitKeyVal(line, ':');
|
||||||
|
|
||||||
var metadata = beatmap.BeatmapInfo.Metadata;
|
var metadata = Beatmap.BeatmapInfo.Metadata;
|
||||||
switch (pair.Key)
|
switch (pair.Key)
|
||||||
{
|
{
|
||||||
case @"Title":
|
case @"Title":
|
||||||
@ -174,19 +160,19 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
metadata.AuthorString = pair.Value;
|
metadata.AuthorString = pair.Value;
|
||||||
break;
|
break;
|
||||||
case @"Version":
|
case @"Version":
|
||||||
beatmap.BeatmapInfo.Version = pair.Value;
|
Beatmap.BeatmapInfo.Version = pair.Value;
|
||||||
break;
|
break;
|
||||||
case @"Source":
|
case @"Source":
|
||||||
beatmap.BeatmapInfo.Metadata.Source = pair.Value;
|
Beatmap.BeatmapInfo.Metadata.Source = pair.Value;
|
||||||
break;
|
break;
|
||||||
case @"Tags":
|
case @"Tags":
|
||||||
beatmap.BeatmapInfo.Metadata.Tags = pair.Value;
|
Beatmap.BeatmapInfo.Metadata.Tags = pair.Value;
|
||||||
break;
|
break;
|
||||||
case @"BeatmapID":
|
case @"BeatmapID":
|
||||||
beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(pair.Value);
|
Beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"BeatmapSetID":
|
case @"BeatmapSetID":
|
||||||
beatmap.BeatmapInfo.OnlineBeatmapSetID = int.Parse(pair.Value);
|
Beatmap.BeatmapInfo.OnlineBeatmapSetID = int.Parse(pair.Value);
|
||||||
metadata.OnlineBeatmapSetID = int.Parse(pair.Value);
|
metadata.OnlineBeatmapSetID = int.Parse(pair.Value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -196,7 +182,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
var pair = splitKeyVal(line, ':');
|
var pair = splitKeyVal(line, ':');
|
||||||
|
|
||||||
var difficulty = beatmap.BeatmapInfo.BaseDifficulty;
|
var difficulty = Beatmap.BeatmapInfo.BaseDifficulty;
|
||||||
switch (pair.Key)
|
switch (pair.Key)
|
||||||
{
|
{
|
||||||
case @"HPDrainRate":
|
case @"HPDrainRate":
|
||||||
@ -222,7 +208,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
private void handleEvents(string line)
|
private void handleEvents(string line)
|
||||||
{
|
{
|
||||||
decodeVariables(ref line);
|
DecodeVariables(ref line);
|
||||||
|
|
||||||
string[] split = line.Split(',');
|
string[] split = line.Split(',');
|
||||||
|
|
||||||
@ -234,7 +220,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
case EventType.Background:
|
case EventType.Background:
|
||||||
string filename = split[2].Trim('"');
|
string filename = split[2].Trim('"');
|
||||||
beatmap.BeatmapInfo.Metadata.BackgroundFile = filename;
|
Beatmap.BeatmapInfo.Metadata.BackgroundFile = filename;
|
||||||
break;
|
break;
|
||||||
case EventType.Break:
|
case EventType.Break:
|
||||||
var breakEvent = new BreakPeriod
|
var breakEvent = new BreakPeriod
|
||||||
@ -246,7 +232,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
if (!breakEvent.HasEffect)
|
if (!breakEvent.HasEffect)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
beatmap.Breaks.Add(breakEvent);
|
Beatmap.Breaks.Add(breakEvent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,13 +278,13 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
if (stringSampleSet == @"none")
|
if (stringSampleSet == @"none")
|
||||||
stringSampleSet = @"normal";
|
stringSampleSet = @"normal";
|
||||||
|
|
||||||
DifficultyControlPoint difficultyPoint = beatmap.ControlPointInfo.DifficultyPointAt(time);
|
DifficultyControlPoint difficultyPoint = Beatmap.ControlPointInfo.DifficultyPointAt(time);
|
||||||
SoundControlPoint soundPoint = beatmap.ControlPointInfo.SoundPointAt(time);
|
SoundControlPoint soundPoint = Beatmap.ControlPointInfo.SoundPointAt(time);
|
||||||
EffectControlPoint effectPoint = beatmap.ControlPointInfo.EffectPointAt(time);
|
EffectControlPoint effectPoint = Beatmap.ControlPointInfo.EffectPointAt(time);
|
||||||
|
|
||||||
if (timingChange)
|
if (timingChange)
|
||||||
{
|
{
|
||||||
beatmap.ControlPointInfo.TimingPoints.Add(new TimingControlPoint
|
Beatmap.ControlPointInfo.TimingPoints.Add(new TimingControlPoint
|
||||||
{
|
{
|
||||||
Time = time,
|
Time = time,
|
||||||
BeatLength = beatLength,
|
BeatLength = beatLength,
|
||||||
@ -308,8 +294,8 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
if (speedMultiplier != difficultyPoint.SpeedMultiplier)
|
if (speedMultiplier != difficultyPoint.SpeedMultiplier)
|
||||||
{
|
{
|
||||||
beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == time);
|
Beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == time);
|
||||||
beatmap.ControlPointInfo.DifficultyPoints.Add(new DifficultyControlPoint
|
Beatmap.ControlPointInfo.DifficultyPoints.Add(new DifficultyControlPoint
|
||||||
{
|
{
|
||||||
Time = time,
|
Time = time,
|
||||||
SpeedMultiplier = speedMultiplier
|
SpeedMultiplier = speedMultiplier
|
||||||
@ -318,7 +304,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
if (stringSampleSet != soundPoint.SampleBank || sampleVolume != soundPoint.SampleVolume)
|
if (stringSampleSet != soundPoint.SampleBank || sampleVolume != soundPoint.SampleVolume)
|
||||||
{
|
{
|
||||||
beatmap.ControlPointInfo.SoundPoints.Add(new SoundControlPoint
|
Beatmap.ControlPointInfo.SoundPoints.Add(new SoundControlPoint
|
||||||
{
|
{
|
||||||
Time = time,
|
Time = time,
|
||||||
SampleBank = stringSampleSet,
|
SampleBank = stringSampleSet,
|
||||||
@ -328,7 +314,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
if (kiaiMode != effectPoint.KiaiMode || omitFirstBarSignature != effectPoint.OmitFirstBarLine)
|
if (kiaiMode != effectPoint.KiaiMode || omitFirstBarSignature != effectPoint.OmitFirstBarLine)
|
||||||
{
|
{
|
||||||
beatmap.ControlPointInfo.EffectPoints.Add(new EffectControlPoint
|
Beatmap.ControlPointInfo.EffectPoints.Add(new EffectControlPoint
|
||||||
{
|
{
|
||||||
Time = time,
|
Time = time,
|
||||||
KiaiMode = kiaiMode,
|
KiaiMode = kiaiMode,
|
||||||
@ -352,14 +338,14 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
if (!hasCustomColours)
|
if (!hasCustomColours)
|
||||||
{
|
{
|
||||||
beatmap.ComboColors.Clear();
|
Beatmap.ComboColors.Clear();
|
||||||
hasCustomColours = true;
|
hasCustomColours = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: the combo index specified in the beatmap is discarded
|
// Note: the combo index specified in the beatmap is discarded
|
||||||
if (pair.Key.StartsWith(@"Combo"))
|
if (pair.Key.StartsWith(@"Combo"))
|
||||||
{
|
{
|
||||||
beatmap.ComboColors.Add(new Color4
|
Beatmap.ComboColors.Add(new Color4
|
||||||
{
|
{
|
||||||
R = r / 255f,
|
R = r / 255f,
|
||||||
G = g / 255f,
|
G = g / 255f,
|
||||||
@ -378,13 +364,13 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
var obj = parser.Parse(line);
|
var obj = parser.Parse(line);
|
||||||
|
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
beatmap.HitObjects.Add(obj);
|
Beatmap.HitObjects.Add(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleVariables(string line)
|
private void handleVariables(string line)
|
||||||
{
|
{
|
||||||
var pair = splitKeyVal(line, '=');
|
var pair = splitKeyVal(line, '=');
|
||||||
variables[pair.Key] = pair.Value;
|
Variables[pair.Key] = pair.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyValuePair<string, string> splitKeyVal(string line, char separator)
|
private KeyValuePair<string, string> splitKeyVal(string line, char separator)
|
||||||
|
@ -4,15 +4,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using osu.Game.Beatmaps.Legacy;
|
using osu.Game.Beatmaps.Legacy;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Formats
|
namespace osu.Game.Beatmaps.Formats
|
||||||
{
|
{
|
||||||
public abstract class LegacyDecoder : BeatmapDecoder
|
public class LegacyDecoder : BeatmapDecoder
|
||||||
{
|
{
|
||||||
public static void Register()
|
public static void Register()
|
||||||
{
|
{
|
||||||
@ -31,11 +28,20 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
// TODO: differences between versions
|
// TODO: differences between versions
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Beatmap beatmap;
|
public LegacyDecoder()
|
||||||
protected Storyboard storyboard;
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected int beatmapVersion;
|
public LegacyDecoder(string header)
|
||||||
protected readonly Dictionary<string, string> variables = new Dictionary<string, string>();
|
{
|
||||||
|
BeatmapVersion = int.Parse(header.Substring(17));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Beatmap Beatmap;
|
||||||
|
protected Storyboard Storyboard;
|
||||||
|
|
||||||
|
protected int BeatmapVersion;
|
||||||
|
protected readonly Dictionary<string, string> Variables = new Dictionary<string, string>();
|
||||||
|
|
||||||
public override Beatmap DecodeBeatmap(StreamReader stream) => new LegacyBeatmap(base.DecodeBeatmap(stream));
|
public override Beatmap DecodeBeatmap(StreamReader stream) => new LegacyBeatmap(base.DecodeBeatmap(stream));
|
||||||
|
|
||||||
@ -48,13 +54,13 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
if (beatmap == null)
|
if (beatmap == null)
|
||||||
throw new ArgumentNullException(nameof(beatmap));
|
throw new ArgumentNullException(nameof(beatmap));
|
||||||
|
|
||||||
this.beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
this.beatmap.BeatmapInfo.BeatmapVersion = beatmapVersion;
|
Beatmap.BeatmapInfo.BeatmapVersion = BeatmapVersion;
|
||||||
|
|
||||||
ParseContent(stream);
|
ParseContent(stream);
|
||||||
|
|
||||||
foreach (var hitObject in this.beatmap.HitObjects)
|
foreach (var hitObject in Beatmap.HitObjects)
|
||||||
hitObject.ApplyDefaults(this.beatmap.ControlPointInfo, this.beatmap.BeatmapInfo.BaseDifficulty);
|
hitObject.ApplyDefaults(Beatmap.ControlPointInfo, Beatmap.BeatmapInfo.BaseDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ParseStoryboard(StreamReader stream, Storyboard storyboard)
|
protected override void ParseStoryboard(StreamReader stream, Storyboard storyboard)
|
||||||
@ -64,7 +70,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
if (storyboard == null)
|
if (storyboard == null)
|
||||||
throw new ArgumentNullException(nameof(storyboard));
|
throw new ArgumentNullException(nameof(storyboard));
|
||||||
|
|
||||||
this.storyboard = storyboard;
|
Storyboard = storyboard;
|
||||||
|
|
||||||
ParseContent(stream);
|
ParseContent(stream);
|
||||||
}
|
}
|
||||||
@ -84,7 +90,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
if (line.StartsWith(@"osu file format v"))
|
if (line.StartsWith(@"osu file format v"))
|
||||||
{
|
{
|
||||||
beatmap.BeatmapInfo.BeatmapVersion = int.Parse(line.Substring(17));
|
Beatmap.BeatmapInfo.BeatmapVersion = int.Parse(line.Substring(17));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,17 +101,20 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
processSection(section, line);
|
ProcessSection(section, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void processSection(Section section, string line);
|
protected virtual void ProcessSection(Section section, string line)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Decodes any beatmap variables present in a line into their real values.
|
/// Decodes any beatmap variables present in a line into their real values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="line">The line which may contains variables.</param>
|
/// <param name="line">The line which may contains variables.</param>
|
||||||
protected void decodeVariables(ref string line)
|
protected void DecodeVariables(ref string line)
|
||||||
{
|
{
|
||||||
while (line.IndexOf('$') >= 0)
|
while (line.IndexOf('$') >= 0)
|
||||||
{
|
{
|
||||||
@ -114,8 +123,8 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
for (int i = 0; i < split.Length; i++)
|
for (int i = 0; i < split.Length; i++)
|
||||||
{
|
{
|
||||||
var item = split[i];
|
var item = split[i];
|
||||||
if (item.StartsWith("$") && variables.ContainsKey(item))
|
if (item.StartsWith("$") && Variables.ContainsKey(item))
|
||||||
split[i] = variables[item];
|
split[i] = Variables[item];
|
||||||
}
|
}
|
||||||
|
|
||||||
line = string.Join(",", split);
|
line = string.Join(",", split);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -18,8 +17,8 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
public class LegacyStoryboardDecoder : LegacyDecoder
|
public class LegacyStoryboardDecoder : LegacyDecoder
|
||||||
{
|
{
|
||||||
private StoryboardSprite storyboardSprite = null;
|
private StoryboardSprite storyboardSprite;
|
||||||
private CommandTimelineGroup timelineGroup = null;
|
private CommandTimelineGroup timelineGroup;
|
||||||
|
|
||||||
public LegacyStoryboardDecoder()
|
public LegacyStoryboardDecoder()
|
||||||
{
|
{
|
||||||
@ -27,10 +26,10 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
public LegacyStoryboardDecoder(string header)
|
public LegacyStoryboardDecoder(string header)
|
||||||
{
|
{
|
||||||
beatmapVersion = int.Parse(header.Substring(17));
|
BeatmapVersion = int.Parse(header.Substring(17));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void processSection(Section section, string line)
|
protected override void ProcessSection(Section section, string line)
|
||||||
{
|
{
|
||||||
switch (section)
|
switch (section)
|
||||||
{
|
{
|
||||||
@ -49,7 +48,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
line = line.Substring(1);
|
line = line.Substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
decodeVariables(ref line);
|
DecodeVariables(ref line);
|
||||||
|
|
||||||
string[] split = line.Split(',');
|
string[] split = line.Split(',');
|
||||||
|
|
||||||
@ -71,7 +70,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
var x = float.Parse(split[4], NumberFormatInfo.InvariantInfo);
|
var x = float.Parse(split[4], NumberFormatInfo.InvariantInfo);
|
||||||
var y = float.Parse(split[5], NumberFormatInfo.InvariantInfo);
|
var y = float.Parse(split[5], NumberFormatInfo.InvariantInfo);
|
||||||
storyboardSprite = new StoryboardSprite(path, origin, new Vector2(x, y));
|
storyboardSprite = new StoryboardSprite(path, origin, new Vector2(x, y));
|
||||||
storyboard.GetLayer(layer).Add(storyboardSprite);
|
Storyboard.GetLayer(layer).Add(storyboardSprite);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EventType.Animation:
|
case EventType.Animation:
|
||||||
@ -85,7 +84,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
var frameDelay = double.Parse(split[7], NumberFormatInfo.InvariantInfo);
|
var frameDelay = double.Parse(split[7], NumberFormatInfo.InvariantInfo);
|
||||||
var loopType = split.Length > 8 ? (AnimationLoopType)Enum.Parse(typeof(AnimationLoopType), split[8]) : AnimationLoopType.LoopForever;
|
var loopType = split.Length > 8 ? (AnimationLoopType)Enum.Parse(typeof(AnimationLoopType), split[8]) : AnimationLoopType.LoopForever;
|
||||||
storyboardSprite = new StoryboardAnimation(path, origin, new Vector2(x, y), frameCount, frameDelay, loopType);
|
storyboardSprite = new StoryboardAnimation(path, origin, new Vector2(x, y), frameCount, frameDelay, loopType);
|
||||||
storyboard.GetLayer(layer).Add(storyboardSprite);
|
Storyboard.GetLayer(layer).Add(storyboardSprite);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EventType.Sample:
|
case EventType.Sample:
|
||||||
@ -94,7 +93,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
var layer = parseLayer(split[2]);
|
var layer = parseLayer(split[2]);
|
||||||
var path = cleanFilename(split[3]);
|
var path = cleanFilename(split[3]);
|
||||||
var volume = split.Length > 4 ? float.Parse(split[4], CultureInfo.InvariantCulture) : 100;
|
var volume = split.Length > 4 ? float.Parse(split[4], CultureInfo.InvariantCulture) : 100;
|
||||||
storyboard.GetLayer(layer).Add(new StoryboardSample(path, time, volume));
|
Storyboard.GetLayer(layer).Add(new StoryboardSample(path, time, volume));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -177,8 +177,8 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
|
|
||||||
string[] split = str.Split(':');
|
string[] split = str.Split(':');
|
||||||
|
|
||||||
var bank = (LegacyBeatmapDecoder.LegacySampleBank)Convert.ToInt32(split[0]);
|
var bank = (LegacyDecoder.LegacySampleBank)Convert.ToInt32(split[0]);
|
||||||
var addbank = (LegacyBeatmapDecoder.LegacySampleBank)Convert.ToInt32(split[1]);
|
var addbank = (LegacyDecoder.LegacySampleBank)Convert.ToInt32(split[1]);
|
||||||
|
|
||||||
// Let's not implement this for now, because this doesn't fit nicely into the bank structure
|
// Let's not implement this for now, because this doesn't fit nicely into the bank structure
|
||||||
//string sampleFile = split2.Length > 4 ? split2[4] : string.Empty;
|
//string sampleFile = split2.Length > 4 ? split2[4] : string.Empty;
|
||||||
|
Reference in New Issue
Block a user