Code cleanup.
This commit is contained in:
@@ -115,73 +115,73 @@ namespace Cryville.Crtr.Extensions.Bestdori {
|
|||||||
i = n / d; n %= d;
|
i = n / d; n %= d;
|
||||||
return new BeatTime(i, n, d);
|
return new BeatTime(i, n, d);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE1006
|
#pragma warning disable IDE1006
|
||||||
[JsonConverter(typeof(BestdoriChartEventCreator))]
|
[JsonConverter(typeof(BestdoriChartEventCreator))]
|
||||||
abstract class BestdoriChartEvent {
|
abstract class BestdoriChartEvent {
|
||||||
public abstract string type { get; }
|
public abstract string type { get; }
|
||||||
public abstract double StartBeat { get; }
|
public abstract double StartBeat { get; }
|
||||||
public abstract class InstantEvent : BestdoriChartEvent {
|
public abstract class InstantEvent : BestdoriChartEvent {
|
||||||
public double beat;
|
public double beat;
|
||||||
public override double StartBeat { get { return beat; } }
|
public override double StartBeat { get { return beat; } }
|
||||||
|
}
|
||||||
|
public class BPM : InstantEvent {
|
||||||
|
public override string type { get { return "BPM"; } }
|
||||||
|
public double bpm;
|
||||||
|
}
|
||||||
|
public class System : InstantEvent {
|
||||||
|
public override string type { get { return "System"; } }
|
||||||
|
public string data;
|
||||||
|
}
|
||||||
|
public abstract class SingleBase : InstantEvent {
|
||||||
|
public double lane;
|
||||||
|
public bool skill;
|
||||||
|
public bool flick;
|
||||||
|
}
|
||||||
|
public class Single : SingleBase {
|
||||||
|
public override string type { get { return "Single"; } }
|
||||||
|
}
|
||||||
|
public class Directional : SingleBase {
|
||||||
|
public override string type { get { return "Directional"; } }
|
||||||
|
public string direction;
|
||||||
|
public int width;
|
||||||
|
}
|
||||||
|
public class Connection : SingleBase {
|
||||||
|
public override string type { get { return null; } }
|
||||||
|
public bool hidden;
|
||||||
|
}
|
||||||
|
public class Long : BestdoriChartEvent {
|
||||||
|
public override string type { get { return "Long"; } }
|
||||||
|
public List<Connection> connections;
|
||||||
|
public override double StartBeat { get { return connections[0].beat; } }
|
||||||
|
}
|
||||||
|
public class Slide : Long {
|
||||||
|
public override string type { get { return "Slide"; } }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public class BPM : InstantEvent {
|
|
||||||
public override string type { get { return "BPM"; } }
|
|
||||||
public double bpm;
|
|
||||||
}
|
|
||||||
public class System : InstantEvent {
|
|
||||||
public override string type { get { return "System"; } }
|
|
||||||
public string data;
|
|
||||||
}
|
|
||||||
public abstract class SingleBase : InstantEvent {
|
|
||||||
public double lane;
|
|
||||||
public bool skill;
|
|
||||||
public bool flick;
|
|
||||||
}
|
|
||||||
public class Single : SingleBase {
|
|
||||||
public override string type { get { return "Single"; } }
|
|
||||||
}
|
|
||||||
public class Directional : SingleBase {
|
|
||||||
public override string type { get { return "Directional"; } }
|
|
||||||
public string direction;
|
|
||||||
public int width;
|
|
||||||
}
|
|
||||||
public class Connection : SingleBase {
|
|
||||||
public override string type { get { return null; } }
|
|
||||||
public bool hidden;
|
|
||||||
}
|
|
||||||
public class Long : BestdoriChartEvent {
|
|
||||||
public override string type { get { return "Long"; } }
|
|
||||||
public List<Connection> connections;
|
|
||||||
public override double StartBeat { get { return connections[0].beat; } }
|
|
||||||
}
|
|
||||||
public class Slide : Long {
|
|
||||||
public override string type { get { return "Slide"; } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#pragma warning restore IDE1006
|
#pragma warning restore IDE1006
|
||||||
class BestdoriChartEventCreator : CustomCreationConverter<BestdoriChartEvent> {
|
class BestdoriChartEventCreator : CustomCreationConverter<BestdoriChartEvent> {
|
||||||
string _currentType;
|
string _currentType;
|
||||||
|
|
||||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) {
|
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) {
|
||||||
var obj = JObject.ReadFrom(reader);
|
var obj = JObject.ReadFrom(reader);
|
||||||
var type = obj["type"];
|
var type = obj["type"];
|
||||||
if (type == null) _currentType = null;
|
if (type == null) _currentType = null;
|
||||||
else _currentType = obj["type"].ToObject<string>();
|
else _currentType = obj["type"].ToObject<string>();
|
||||||
return base.ReadJson(obj.CreateReader(), objectType, existingValue, serializer);
|
return base.ReadJson(obj.CreateReader(), objectType, existingValue, serializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override BestdoriChartEvent Create(Type objectType) {
|
public override BestdoriChartEvent Create(Type objectType) {
|
||||||
switch (_currentType) {
|
switch (_currentType) {
|
||||||
case "BPM": return new BestdoriChartEvent.BPM();
|
case "BPM": return new BestdoriChartEvent.BPM();
|
||||||
case "System": return new BestdoriChartEvent.System();
|
case "System": return new BestdoriChartEvent.System();
|
||||||
case "Single": return new BestdoriChartEvent.Single();
|
case "Single": return new BestdoriChartEvent.Single();
|
||||||
case "Directional": return new BestdoriChartEvent.Directional();
|
case "Directional": return new BestdoriChartEvent.Directional();
|
||||||
case null: return new BestdoriChartEvent.Connection();
|
case null: return new BestdoriChartEvent.Connection();
|
||||||
case "Long": return new BestdoriChartEvent.Long();
|
case "Long": return new BestdoriChartEvent.Long();
|
||||||
case "Slide": return new BestdoriChartEvent.Slide();
|
case "Slide": return new BestdoriChartEvent.Slide();
|
||||||
default: throw new ArgumentException("Unknown event type: " + _currentType);
|
default: throw new ArgumentException("Unknown event type: " + _currentType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,70 +162,70 @@ namespace Cryville.Crtr.Extensions.Malody {
|
|||||||
float ConvertBeat(int[] beat) {
|
float ConvertBeat(int[] beat) {
|
||||||
return beat[0] + (float)beat[1] / beat[2];
|
return beat[0] + (float)beat[1] / beat[2];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE1006
|
#pragma warning disable IDE1006
|
||||||
struct MalodyChart {
|
struct MalodyChart {
|
||||||
public interface IEvent {
|
public interface IEvent {
|
||||||
int[] beat { get; set; }
|
int[] beat { get; set; }
|
||||||
int[] endbeat { get; set; }
|
int[] endbeat { get; set; }
|
||||||
int Priority { get; }
|
int Priority { get; }
|
||||||
}
|
}
|
||||||
public struct EndEvent : IEvent {
|
public struct EndEvent : IEvent {
|
||||||
public int[] beat { get; set; }
|
public int[] beat { get; set; }
|
||||||
public int[] endbeat { get; set; }
|
public int[] endbeat { get; set; }
|
||||||
public IEvent StartEvent { get; set; }
|
public IEvent StartEvent { get; set; }
|
||||||
public int Priority { get { return StartEvent.Priority - 1; } }
|
public int Priority { get { return StartEvent.Priority - 1; } }
|
||||||
}
|
|
||||||
|
|
||||||
public Meta meta;
|
|
||||||
public struct Meta {
|
|
||||||
public SongInfo song;
|
|
||||||
public struct SongInfo {
|
|
||||||
public string title;
|
|
||||||
public string artist;
|
|
||||||
public string titleorg;
|
|
||||||
public string artistorg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string background;
|
public Meta meta;
|
||||||
|
public struct Meta {
|
||||||
|
public SongInfo song;
|
||||||
|
public struct SongInfo {
|
||||||
|
public string title;
|
||||||
|
public string artist;
|
||||||
|
public string titleorg;
|
||||||
|
public string artistorg;
|
||||||
|
}
|
||||||
|
|
||||||
public string creator;
|
public string background;
|
||||||
public string version;
|
|
||||||
|
|
||||||
public int mode;
|
public string creator;
|
||||||
public ModeExt mode_ext;
|
public string version;
|
||||||
public struct ModeExt {
|
|
||||||
|
public int mode;
|
||||||
|
public ModeExt mode_ext;
|
||||||
|
public struct ModeExt {
|
||||||
|
public int column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Time> time;
|
||||||
|
public struct Time : IEvent {
|
||||||
|
public int[] beat { get; set; }
|
||||||
|
public int[] endbeat { get; set; }
|
||||||
|
public float bpm;
|
||||||
|
public int Priority { get { return -2; } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Effect> effect;
|
||||||
|
public struct Effect : IEvent {
|
||||||
|
public int[] beat { get; set; }
|
||||||
|
public int[] endbeat { get; set; }
|
||||||
|
public float? scroll;
|
||||||
|
public int Priority { get { return 0; } }
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Note> note;
|
||||||
|
public struct Note : IEvent {
|
||||||
|
public int[] beat { get; set; }
|
||||||
|
public int[] endbeat { get; set; }
|
||||||
public int column;
|
public int column;
|
||||||
|
public string sound;
|
||||||
|
public int offset;
|
||||||
|
public int type;
|
||||||
|
public int Priority { get { return 0; } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Time> time;
|
|
||||||
public struct Time : IEvent {
|
|
||||||
public int[] beat { get; set; }
|
|
||||||
public int[] endbeat { get; set; }
|
|
||||||
public float bpm;
|
|
||||||
public int Priority { get { return -2; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Effect> effect;
|
|
||||||
public struct Effect : IEvent {
|
|
||||||
public int[] beat { get; set; }
|
|
||||||
public int[] endbeat { get; set; }
|
|
||||||
public float? scroll;
|
|
||||||
public int Priority { get { return 0; } }
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Note> note;
|
|
||||||
public struct Note : IEvent {
|
|
||||||
public int[] beat { get; set; }
|
|
||||||
public int[] endbeat { get; set; }
|
|
||||||
public int column;
|
|
||||||
public string sound;
|
|
||||||
public int offset;
|
|
||||||
public int type;
|
|
||||||
public int Priority { get { return 0; } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#pragma warning restore IDE1006
|
#pragma warning restore IDE1006
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user