mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[Unity] Update basic json validity check.
This commit is contained in:
parent
e5b36f4180
commit
0b00800e39
@ -711,21 +711,26 @@ namespace Spine.Unity.Editor {
|
|||||||
try {
|
try {
|
||||||
obj = Json.Deserialize(new StringReader(asset.text));
|
obj = Json.Deserialize(new StringReader(asset.text));
|
||||||
} catch (System.Exception) {
|
} catch (System.Exception) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
Debug.LogError("Is not valid JSON");
|
Debug.LogError("Is not valid JSON");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<string, object> root = (Dictionary<string, object>)obj;
|
var root = obj as Dictionary<string, object>;
|
||||||
|
if (root == null) {
|
||||||
|
Debug.LogError("Parser returned an incorrect type.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!root.ContainsKey("skeleton"))
|
if (!root.ContainsKey("skeleton"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Dictionary<string, object> skeletonInfo = (Dictionary<string, object>)root["skeleton"];
|
// var skeletonInfo = (Dictionary<string, object>)root["skeleton"];
|
||||||
|
// string spineVersion = (string)skeletonInfo["spine"];
|
||||||
string spineVersion = (string)skeletonInfo["spine"];
|
// TODO: Warn users of old version incompatibility.
|
||||||
//TODO: reject old versions
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user