Fix error on setting anim.name to null.

This commit is contained in:
2023-03-01 00:35:19 +08:00
parent c7e7bd8a77
commit f567a2b78e

View File

@@ -11,17 +11,24 @@ namespace Cryville.Crtr.Components {
SkinContext _skinContext; SkinContext _skinContext;
AnimationSpan _anim; AnimationSpan _anim;
int _name;
public int Name { public int Name {
set { set {
if (value == 0) return; if (_name == value) return;
var id = new Identifier(value); _name = value;
AnimationSpan anim; if (value == 0) {
if (!ChartPlayer.pskin.animations.TryGetValue(id, out anim)) {
Logger.Log("main", 4, "Skin", "Animation {0} not found", id.Name);
_anim = null; _anim = null;
return;
} }
_anim = anim; else {
var id = new Identifier(value);
AnimationSpan anim;
if (!ChartPlayer.pskin.animations.TryGetValue(id, out anim)) {
Logger.Log("main", 4, "Skin", "Animation {0} not found", id.Name);
_anim = null;
return;
}
_anim = anim;
}
} }
} }
public float Duration { get; private set; } public float Duration { get; private set; }