Fix chart importing.

This commit is contained in:
2023-05-07 13:40:15 +08:00
parent d030c48b4d
commit fa9303c0a1
2 changed files with 11 additions and 4 deletions

View File

@@ -218,17 +218,23 @@ namespace Cryville.Crtr {
public class Motion : ChartEvent {
#pragma warning disable IDE1006
string m_motion;
[JsonRequired]
public string motion {
get { return ToString(); }
get { return m_motion == null ? ToString() : m_motion; }
set { LoadFromString(value); }
}
#pragma warning restore IDE1006
private void LoadFromString(string s) {
if (Node != null)
throw new InvalidOperationException("The motion property can only be set at initialization");
ChartCompatibilityHandler.MotionStringParser.Parse(s, out name, out Node);
SubmitPropSrc("value", new VectorSrc(() => Node.Value));
if (ChartPlayer.motionRegistry == null) {
m_motion = s;
}
else {
ChartCompatibilityHandler.MotionStringParser.Parse(s, out name, out Node);
SubmitPropSrc("value", new VectorSrc(() => Node.Value));
}
}
public override string ToString() {

View File

@@ -60,7 +60,7 @@ namespace Cryville.Crtr {
static float startOffset = 0;
public static float sv = 16f;
public static Dictionary<Identifier, MotionRegistry> motionRegistry = new Dictionary<Identifier, MotionRegistry>();
public static Dictionary<Identifier, MotionRegistry> motionRegistry;
public static PdtEvaluator etor;
#endregion
@@ -533,6 +533,7 @@ namespace Cryville.Crtr {
effectManager.Dispose();
effectManager = null;
etor = null;
motionRegistry = null;
Logger.Log("main", 1, "Game", "Stopped");
}
catch (Exception ex) {