refactor: Update Unity to 2022.3.62

This commit is contained in:
2025-06-21 01:22:02 +08:00
parent d71bf7d4a5
commit 283783954f
112 changed files with 778 additions and 907 deletions

View File

@@ -18,7 +18,7 @@ namespace Cryville.Crtr {
}
public abstract class ChartEvent {
public BeatTime? time;
[JsonIgnore]
public float BeatPosition {
get {
@@ -27,7 +27,7 @@ namespace Cryville.Crtr {
}
public BeatTime? endtime;
[JsonIgnore]
public float EndBeatPosition {
get {
@@ -35,10 +35,10 @@ namespace Cryville.Crtr {
return (float)endtime.Value.Decimal + BeatOffset;
}
}
[JsonIgnore]
public float BeatOffset;
[JsonIgnore]
public abstract int Priority { get; }
@@ -66,8 +66,7 @@ namespace Cryville.Crtr {
[JsonIgnore]
public ReleaseEvent ReleaseEvent {
get {
if (relev == null) relev = new ReleaseEvent(this);
return relev;
return relev ??= new ReleaseEvent(this);
}
}
@@ -96,15 +95,15 @@ namespace Cryville.Crtr {
SubmitPropOp("endtime", new PropOp.BeatTime(v => endtime = v));
}
}
public class ReleaseEvent : ChartEvent {
public readonly ChartEvent Original;
public ReleaseEvent(ChartEvent orig) {
Original = orig;
time = orig.endtime;
}
public override int Priority {
get {
return Original.Priority + 1;
@@ -112,7 +111,7 @@ namespace Cryville.Crtr {
}
}
public abstract class EventContainer : ChartEvent {
public List<Chart.Motion> motions = new List<Chart.Motion>();
public List<Chart.Motion> motions = new();
[JsonIgnore]
public Clip Clip { get; private set; }
@@ -120,7 +119,7 @@ namespace Cryville.Crtr {
public EventContainer() {
SubmitPropOp("clip", new PropOp.Clip(v => Clip = v));
}
[JsonIgnore]
public virtual IEnumerable<ChartEvent> Events {
get {
@@ -128,12 +127,10 @@ namespace Cryville.Crtr {
}
}
public virtual EventList GetEventsOfType(string type) {
switch (type) {
case "motions": return new EventList<Chart.Motion>(motions);
default: throw new ArgumentException(string.Format("Unknown event type \"{0}\"", type));
}
}
public virtual EventList GetEventsOfType(string type) => type switch {
"motions" => new EventList<Chart.Motion>(motions),
_ => throw new ArgumentException(string.Format("Unknown event type \"{0}\"", type)),
};
}
public abstract class EventList : ChartEvent {
public IList<ChartEvent> Events { get; private set; }
@@ -178,8 +175,8 @@ namespace Cryville.Crtr {
public string ruleset;
public List<Group> groups = new List<Group>();
public List<Group> groups = new();
public override IEnumerable<ChartEvent> Events {
get {
return base.Events
@@ -189,33 +186,29 @@ namespace Cryville.Crtr {
}
}
public override EventList GetEventsOfType(string type) {
switch (type) {
case "groups": return new EventList<Group>(groups);
default: return base.GetEventsOfType(type);
}
}
public override EventList GetEventsOfType(string type) => type switch {
"groups" => new EventList<Group>(groups),
_ => base.GetEventsOfType(type),
};
public override int Priority { get { return 10; } }
public class Group : EventContainer {
public List<Track> tracks = new List<Track>();
public List<Note> notes = new List<Note>();
public List<Track> tracks = new();
public List<Note> notes = new();
public override IEnumerable<ChartEvent> Events {
get {
return base.Events
return base.Events
.Concat(notes.Cast<ChartEvent>()
.Concat(tracks.Cast<ChartEvent>()
));
}
}
public override EventList GetEventsOfType(string type) {
switch (type) {
case "tracks": return new EventList<Track>(tracks);
case "notes": return new EventList<Note>(notes);
default: return base.GetEventsOfType(type);
}
}
public override EventList GetEventsOfType(string type) => type switch {
"tracks" => new EventList<Track>(tracks),
"notes" => new EventList<Note>(notes),
_ => base.GetEventsOfType(type),
};
public override int Priority { get { return 12; } }
}
@@ -228,8 +221,8 @@ namespace Cryville.Crtr {
string m_motion;
[JsonRequired]
public string motion {
get { return m_motion == null ? ToString() : m_motion; }
set { LoadFromString(value); }
get => m_motion ?? ToString();
set => LoadFromString(value);
}
#pragma warning restore IDE1006
private void LoadFromString(string s) {
@@ -264,12 +257,11 @@ namespace Cryville.Crtr {
[JsonIgnore]
public Identifier Name {
get {
if (name == default(Identifier)) throw new InvalidOperationException("Motion name not set");
if (name == default) throw new InvalidOperationException("Motion name not set");
return name;
}
private set {
MotionRegistry reg;
if (!ChartPlayer.motionRegistry.TryGetValue(value, out reg))
if (!ChartPlayer.motionRegistry.TryGetValue(value, out MotionRegistry reg))
throw new ArgumentException("Invalid motion name");
Node = new MotionNode { Value = reg.InitValue };
name = value;
@@ -293,7 +285,7 @@ namespace Cryville.Crtr {
SubmitPropOp("name", new PropOp.Identifier(v => {
var n = new Identifier(v);
if (name == n) { }
else if (name == default(Identifier)) Name = n;
else if (name == default) Name = n;
else throw new RulesetViolationException(string.Format(
"Motion name not matched, expected {0}, got {1}", n, Name
));
@@ -306,7 +298,7 @@ namespace Cryville.Crtr {
}
public class Note : EventContainer {
public List<Judge> judges = new List<Judge>();
public List<Judge> judges = new();
public override IEnumerable<ChartEvent> Events {
get {
return base.Events
@@ -315,12 +307,10 @@ namespace Cryville.Crtr {
}
}
public override EventList GetEventsOfType(string type) {
switch (type) {
case "judges": return new EventList<Judge>(judges);
default: return base.GetEventsOfType(type);
}
}
public override EventList GetEventsOfType(string type) => type switch {
"judges" => new EventList<Judge>(judges),
_ => base.GetEventsOfType(type),
};
public override int Priority { get { return 20; } }
}
@@ -345,7 +335,7 @@ namespace Cryville.Crtr {
// TODO [Obsolete]
public List<Signature> sigs; // Signatures
// TODO [Obsolete]
// TODO [Obsolete]
public class Signature : ChartEvent {
public float? tempo;