mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-13 10:38:46 +08:00
[haxe] Use Reflect.hasField rather than hasOwnProperty that is present on all platforms
This commit is contained in:
parent
d384397ad0
commit
430cccb03f
@ -497,7 +497,7 @@ class SkeletonJson {
|
||||
mesh.sequence = sequence;
|
||||
|
||||
if (Reflect.field(map, "parent") != null) {
|
||||
var inheritTimelines:Bool = map.hasOwnProperty("timelines") ? cast(Reflect.field(map, "timelines"), Bool) : true;
|
||||
var inheritTimelines:Bool = Reflect.hasField(map, "timelines") ? cast(Reflect.field(map, "timelines"), Bool) : true;
|
||||
linkedMeshes.push(new LinkedMesh(mesh, Reflect.field(map, "skin"), slotIndex, Reflect.field(map, "parent"), inheritTimelines));
|
||||
return mesh;
|
||||
}
|
||||
@ -523,8 +523,8 @@ class SkeletonJson {
|
||||
var path:PathAttachment = attachmentLoader.newPathAttachment(skin, name);
|
||||
if (path == null)
|
||||
return null;
|
||||
path.closed = map.hasOwnProperty("closed") ? cast(Reflect.field(map, "closed"), Bool) : false;
|
||||
path.constantSpeed = map.hasOwnProperty("constantSpeed") ? cast(Reflect.field(map, "constantSpeed"), Bool) : true;
|
||||
path.closed = Reflect.hasField(map, "closed") ? cast(Reflect.field(map, "closed"), Bool) : false;
|
||||
path.constantSpeed = Reflect.hasField(map, "constantSpeed") ? cast(Reflect.field(map, "constantSpeed"), Bool) : true;
|
||||
var vertexCount:Int = Std.parseInt(Reflect.field(map, "vertexCount"));
|
||||
readVertices(map, path, vertexCount << 1);
|
||||
var lengths:Array<Float> = new Array<Float>();
|
||||
@ -1320,7 +1320,7 @@ class SkeletonJson {
|
||||
}
|
||||
|
||||
static private function getValue(map:Dynamic, name:String, defaultValue:Dynamic):Dynamic {
|
||||
if (map.hasOwnProperty(name))
|
||||
if (Reflect.hasField(map, name))
|
||||
return Reflect.field(map, name);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user