mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 22:34:53 +08:00
[ts] Updated builds.
This commit is contained in:
parent
576c1da32f
commit
75ffb7b098
27
spine-ts/build/spine-all.d.ts
vendored
27
spine-ts/build/spine-all.d.ts
vendored
@ -771,12 +771,26 @@ declare module spine {
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class SkinEntry {
|
||||
slotIndex: number;
|
||||
name: string;
|
||||
attachment: Attachment;
|
||||
constructor(slotIndex: number, name: string, attachment: Attachment);
|
||||
}
|
||||
class Skin {
|
||||
name: string;
|
||||
attachments: Map<Attachment>[];
|
||||
bones: BoneData[];
|
||||
constraints: SlotData[];
|
||||
constructor(name: string);
|
||||
addAttachment(slotIndex: number, name: string, attachment: Attachment): void;
|
||||
setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
|
||||
addSkin(skin: Skin): void;
|
||||
copySkin(skin: Skin): void;
|
||||
getAttachment(slotIndex: number, name: string): Attachment;
|
||||
removeAttachment(slotIndex: number, name: string): void;
|
||||
getAttachments(): Array<SkinEntry>;
|
||||
getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
|
||||
clear(): void;
|
||||
attachAll(skeleton: Skeleton, oldSkin: Skin): void;
|
||||
}
|
||||
}
|
||||
@ -1081,6 +1095,7 @@ declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
abstract copy(): Attachment;
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
private static nextID;
|
||||
@ -1091,6 +1106,7 @@ declare module spine {
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
copyTo(attachment: VertexAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1117,6 +1133,7 @@ declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1124,6 +1141,7 @@ declare module spine {
|
||||
endSlot: SlotData;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1134,7 +1152,10 @@ declare module spine {
|
||||
uvs: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
width: number;
|
||||
height: number;
|
||||
hullLength: number;
|
||||
edges: Array<number>;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
@ -1143,6 +1164,7 @@ declare module spine {
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1152,6 +1174,7 @@ declare module spine {
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1163,6 +1186,7 @@ declare module spine {
|
||||
constructor(name: string);
|
||||
computeWorldPosition(bone: Bone, point: Vector2): Vector2;
|
||||
computeWorldRotation(bone: Bone): number;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1225,6 +1249,7 @@ declare module spine {
|
||||
updateOffset(): void;
|
||||
setRegion(region: TextureRegion): void;
|
||||
computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
|
||||
@ -4675,7 +4675,7 @@ var spine;
|
||||
for (var entryName in slotMap) {
|
||||
var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData);
|
||||
if (attachment != null)
|
||||
skin.addAttachment(slotIndex, entryName, attachment);
|
||||
skin.setAttachment(slotIndex, entryName, attachment);
|
||||
}
|
||||
}
|
||||
skeletonData.skins.push(skin);
|
||||
@ -4762,6 +4762,8 @@ var spine;
|
||||
var color = this.getValue(map, "color", null);
|
||||
if (color != null)
|
||||
mesh.color.setFromString(color);
|
||||
mesh.width = this.getValue(map, "width", 0) * scale;
|
||||
mesh.height = this.getValue(map, "height", 0) * scale;
|
||||
var parent_4 = this.getValue(map, "parent", null);
|
||||
if (parent_4 != null) {
|
||||
mesh.inheritDeform = this.getValue(map, "deform", true);
|
||||
@ -4773,6 +4775,7 @@ var spine;
|
||||
mesh.triangles = map.triangles;
|
||||
mesh.regionUVs = uvs;
|
||||
mesh.updateUVs();
|
||||
mesh.edges = this.getValue(map, "edges", null);
|
||||
mesh.hullLength = this.getValue(map, "hull", 0) * 2;
|
||||
return mesh;
|
||||
}
|
||||
@ -5241,14 +5244,25 @@ var spine;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var SkinEntry = (function () {
|
||||
function SkinEntry(slotIndex, name, attachment) {
|
||||
this.slotIndex = slotIndex;
|
||||
this.name = name;
|
||||
this.attachment = attachment;
|
||||
}
|
||||
return SkinEntry;
|
||||
}());
|
||||
spine.SkinEntry = SkinEntry;
|
||||
var Skin = (function () {
|
||||
function Skin(name) {
|
||||
this.attachments = new Array();
|
||||
this.bones = Array();
|
||||
this.constraints = new Array();
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
Skin.prototype.addAttachment = function (slotIndex, name, attachment) {
|
||||
Skin.prototype.setAttachment = function (slotIndex, name, attachment) {
|
||||
if (attachment == null)
|
||||
throw new Error("attachment cannot be null.");
|
||||
var attachments = this.attachments;
|
||||
@ -5258,10 +5272,118 @@ var spine;
|
||||
attachments[slotIndex] = {};
|
||||
attachments[slotIndex][name] = attachment;
|
||||
};
|
||||
Skin.prototype.addSkin = function (skin) {
|
||||
for (var i = 0; i < skin.bones.length; i++) {
|
||||
var bone = skin.bones[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.bones.length; j++) {
|
||||
if (this.bones[j] == bone) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.bones.push(bone);
|
||||
}
|
||||
for (var i = 0; i < skin.constraints.length; i++) {
|
||||
var constraint = skin.constraints[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.constraints.length; j++) {
|
||||
if (this.constraints[j] == constraint) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.constraints.push(constraint);
|
||||
}
|
||||
var attachments = skin.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment = attachments[i];
|
||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||
}
|
||||
};
|
||||
Skin.prototype.copySkin = function (skin) {
|
||||
for (var i = 0; i < skin.bones.length; i++) {
|
||||
var bone = skin.bones[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.bones.length; j++) {
|
||||
if (this.bones[j] == bone) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.bones.push(bone);
|
||||
}
|
||||
for (var i = 0; i < skin.constraints.length; i++) {
|
||||
var constraint = skin.constraints[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.constraints.length; j++) {
|
||||
if (this.constraints[j] == constraint) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.constraints.push(constraint);
|
||||
}
|
||||
var attachments = skin.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment = attachments[i];
|
||||
attachment.attachment = attachment.attachment.copy();
|
||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||
}
|
||||
attachments = this.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment_1 = attachments[i];
|
||||
if (attachment_1.attachment instanceof spine.MeshAttachment) {
|
||||
var mesh = attachment_1.attachment;
|
||||
if (mesh.getParentMesh()) {
|
||||
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
|
||||
mesh.updateUVs();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Skin.prototype.getAttachment = function (slotIndex, name) {
|
||||
var dictionary = this.attachments[slotIndex];
|
||||
return dictionary ? dictionary[name] : null;
|
||||
};
|
||||
Skin.prototype.removeAttachment = function (slotIndex, name) {
|
||||
var dictionary = this.attachments[slotIndex];
|
||||
if (dictionary)
|
||||
dictionary[name] = null;
|
||||
};
|
||||
Skin.prototype.getAttachments = function () {
|
||||
var entries = new Array();
|
||||
for (var i = 0; i < this.attachments.length; i++) {
|
||||
var slotAttachments = this.attachments[i];
|
||||
if (slotAttachments) {
|
||||
for (var name_2 in slotAttachments) {
|
||||
var attachment = slotAttachments[name_2];
|
||||
if (attachment)
|
||||
entries.push(new SkinEntry(i, name_2, attachment));
|
||||
}
|
||||
}
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
Skin.prototype.getAttachmentsForSlot = function (slotIndex, attachments) {
|
||||
var slotAttachments = this.attachments[slotIndex];
|
||||
if (slotAttachments) {
|
||||
for (var name_3 in slotAttachments) {
|
||||
var attachment = slotAttachments[name_3];
|
||||
if (attachment)
|
||||
attachments.push(new SkinEntry(slotIndex, name_3, attachment));
|
||||
}
|
||||
}
|
||||
};
|
||||
Skin.prototype.clear = function () {
|
||||
this.attachments.length = 0;
|
||||
this.bones.length = 0;
|
||||
this.constraints.length = 0;
|
||||
};
|
||||
Skin.prototype.attachAll = function (skeleton, oldSkin) {
|
||||
var slotIndex = 0;
|
||||
for (var i = 0; i < skeleton.slots.length; i++) {
|
||||
@ -6533,6 +6655,21 @@ var spine;
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
VertexAttachment.prototype.copyTo = function (attachment) {
|
||||
if (this.bones != null) {
|
||||
attachment.bones = new Array(this.bones.length);
|
||||
spine.Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);
|
||||
}
|
||||
else
|
||||
attachment.bones = null;
|
||||
if (this.vertices != null) {
|
||||
attachment.vertices = spine.Utils.newFloatArray(this.vertices.length);
|
||||
spine.Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
|
||||
}
|
||||
else
|
||||
attachment.vertices = null;
|
||||
attachment.worldVerticesLength = this.worldVerticesLength;
|
||||
};
|
||||
VertexAttachment.nextID = 0;
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
@ -6559,6 +6696,12 @@ var spine;
|
||||
_this.color = new spine.Color(1, 1, 1, 1);
|
||||
return _this;
|
||||
}
|
||||
BoundingBoxAttachment.prototype.copy = function () {
|
||||
var copy = new BoundingBoxAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
@ -6572,6 +6715,13 @@ var spine;
|
||||
_this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1);
|
||||
return _this;
|
||||
}
|
||||
ClippingAttachment.prototype.copy = function () {
|
||||
var copy = new ClippingAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.endSlot = this.endSlot;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return ClippingAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.ClippingAttachment = ClippingAttachment;
|
||||
@ -6665,6 +6815,34 @@ var spine;
|
||||
this.worldVerticesLength = parentMesh.worldVerticesLength;
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.copy = function () {
|
||||
var copy = new MeshAttachment(name);
|
||||
copy.region = this.region;
|
||||
copy.path = this.path;
|
||||
if (this.parentMesh == null) {
|
||||
this.copyTo(copy);
|
||||
copy.regionUVs = new Array(this.regionUVs.length);
|
||||
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
||||
copy.uvs = new Array(this.uvs.length);
|
||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
||||
copy.triangles = new Array(this.triangles.length);
|
||||
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
|
||||
copy.color.setFromColor(this.color);
|
||||
copy.hullLength = this.hullLength;
|
||||
copy.inheritDeform = this.inheritDeform;
|
||||
if (this.edges != null) {
|
||||
copy.edges = new Array(this.edges.length);
|
||||
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
||||
}
|
||||
copy.width = this.width;
|
||||
copy.height = this.height;
|
||||
}
|
||||
else {
|
||||
copy.setParentMesh(this.parentMesh);
|
||||
copy.updateUVs();
|
||||
}
|
||||
return copy;
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
@ -6680,6 +6858,16 @@ var spine;
|
||||
_this.color = new spine.Color(1, 1, 1, 1);
|
||||
return _this;
|
||||
}
|
||||
PathAttachment.prototype.copy = function () {
|
||||
var copy = new PathAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.lengths = new Array(this.lengths.length);
|
||||
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
|
||||
copy.closed = closed;
|
||||
copy.constantSpeed = this.constantSpeed;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
@ -6704,6 +6892,14 @@ var spine;
|
||||
var y = cos * bone.c + sin * bone.d;
|
||||
return Math.atan2(y, x) * spine.MathUtils.radDeg;
|
||||
};
|
||||
PointAttachment.prototype.copy = function () {
|
||||
var copy = new PointAttachment(name);
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.rotation = this.rotation;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return PointAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PointAttachment = PointAttachment;
|
||||
@ -6804,6 +7000,23 @@ var spine;
|
||||
worldVertices[offset] = offsetX * a + offsetY * b + x;
|
||||
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
||||
};
|
||||
RegionAttachment.prototype.copy = function () {
|
||||
var copy = new RegionAttachment(name);
|
||||
copy.region = this.region;
|
||||
copy.rendererObject = this.rendererObject;
|
||||
copy.path = this.path;
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.scaleX = this.scaleX;
|
||||
copy.scaleY = this.scaleY;
|
||||
copy.rotation = this.rotation;
|
||||
copy.width = this.width;
|
||||
copy.height = this.height;
|
||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
|
||||
spine.Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
|
||||
File diff suppressed because one or more lines are too long
27
spine-ts/build/spine-canvas.d.ts
vendored
27
spine-ts/build/spine-canvas.d.ts
vendored
@ -771,12 +771,26 @@ declare module spine {
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class SkinEntry {
|
||||
slotIndex: number;
|
||||
name: string;
|
||||
attachment: Attachment;
|
||||
constructor(slotIndex: number, name: string, attachment: Attachment);
|
||||
}
|
||||
class Skin {
|
||||
name: string;
|
||||
attachments: Map<Attachment>[];
|
||||
bones: BoneData[];
|
||||
constraints: SlotData[];
|
||||
constructor(name: string);
|
||||
addAttachment(slotIndex: number, name: string, attachment: Attachment): void;
|
||||
setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
|
||||
addSkin(skin: Skin): void;
|
||||
copySkin(skin: Skin): void;
|
||||
getAttachment(slotIndex: number, name: string): Attachment;
|
||||
removeAttachment(slotIndex: number, name: string): void;
|
||||
getAttachments(): Array<SkinEntry>;
|
||||
getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
|
||||
clear(): void;
|
||||
attachAll(skeleton: Skeleton, oldSkin: Skin): void;
|
||||
}
|
||||
}
|
||||
@ -1081,6 +1095,7 @@ declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
abstract copy(): Attachment;
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
private static nextID;
|
||||
@ -1091,6 +1106,7 @@ declare module spine {
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
copyTo(attachment: VertexAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1117,6 +1133,7 @@ declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1124,6 +1141,7 @@ declare module spine {
|
||||
endSlot: SlotData;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1134,7 +1152,10 @@ declare module spine {
|
||||
uvs: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
width: number;
|
||||
height: number;
|
||||
hullLength: number;
|
||||
edges: Array<number>;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
@ -1143,6 +1164,7 @@ declare module spine {
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1152,6 +1174,7 @@ declare module spine {
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1163,6 +1186,7 @@ declare module spine {
|
||||
constructor(name: string);
|
||||
computeWorldPosition(bone: Bone, point: Vector2): Vector2;
|
||||
computeWorldRotation(bone: Bone): number;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1225,6 +1249,7 @@ declare module spine {
|
||||
updateOffset(): void;
|
||||
setRegion(region: TextureRegion): void;
|
||||
computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
|
||||
@ -4675,7 +4675,7 @@ var spine;
|
||||
for (var entryName in slotMap) {
|
||||
var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData);
|
||||
if (attachment != null)
|
||||
skin.addAttachment(slotIndex, entryName, attachment);
|
||||
skin.setAttachment(slotIndex, entryName, attachment);
|
||||
}
|
||||
}
|
||||
skeletonData.skins.push(skin);
|
||||
@ -4762,6 +4762,8 @@ var spine;
|
||||
var color = this.getValue(map, "color", null);
|
||||
if (color != null)
|
||||
mesh.color.setFromString(color);
|
||||
mesh.width = this.getValue(map, "width", 0) * scale;
|
||||
mesh.height = this.getValue(map, "height", 0) * scale;
|
||||
var parent_4 = this.getValue(map, "parent", null);
|
||||
if (parent_4 != null) {
|
||||
mesh.inheritDeform = this.getValue(map, "deform", true);
|
||||
@ -4773,6 +4775,7 @@ var spine;
|
||||
mesh.triangles = map.triangles;
|
||||
mesh.regionUVs = uvs;
|
||||
mesh.updateUVs();
|
||||
mesh.edges = this.getValue(map, "edges", null);
|
||||
mesh.hullLength = this.getValue(map, "hull", 0) * 2;
|
||||
return mesh;
|
||||
}
|
||||
@ -5241,14 +5244,25 @@ var spine;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var SkinEntry = (function () {
|
||||
function SkinEntry(slotIndex, name, attachment) {
|
||||
this.slotIndex = slotIndex;
|
||||
this.name = name;
|
||||
this.attachment = attachment;
|
||||
}
|
||||
return SkinEntry;
|
||||
}());
|
||||
spine.SkinEntry = SkinEntry;
|
||||
var Skin = (function () {
|
||||
function Skin(name) {
|
||||
this.attachments = new Array();
|
||||
this.bones = Array();
|
||||
this.constraints = new Array();
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
Skin.prototype.addAttachment = function (slotIndex, name, attachment) {
|
||||
Skin.prototype.setAttachment = function (slotIndex, name, attachment) {
|
||||
if (attachment == null)
|
||||
throw new Error("attachment cannot be null.");
|
||||
var attachments = this.attachments;
|
||||
@ -5258,10 +5272,118 @@ var spine;
|
||||
attachments[slotIndex] = {};
|
||||
attachments[slotIndex][name] = attachment;
|
||||
};
|
||||
Skin.prototype.addSkin = function (skin) {
|
||||
for (var i = 0; i < skin.bones.length; i++) {
|
||||
var bone = skin.bones[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.bones.length; j++) {
|
||||
if (this.bones[j] == bone) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.bones.push(bone);
|
||||
}
|
||||
for (var i = 0; i < skin.constraints.length; i++) {
|
||||
var constraint = skin.constraints[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.constraints.length; j++) {
|
||||
if (this.constraints[j] == constraint) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.constraints.push(constraint);
|
||||
}
|
||||
var attachments = skin.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment = attachments[i];
|
||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||
}
|
||||
};
|
||||
Skin.prototype.copySkin = function (skin) {
|
||||
for (var i = 0; i < skin.bones.length; i++) {
|
||||
var bone = skin.bones[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.bones.length; j++) {
|
||||
if (this.bones[j] == bone) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.bones.push(bone);
|
||||
}
|
||||
for (var i = 0; i < skin.constraints.length; i++) {
|
||||
var constraint = skin.constraints[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.constraints.length; j++) {
|
||||
if (this.constraints[j] == constraint) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.constraints.push(constraint);
|
||||
}
|
||||
var attachments = skin.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment = attachments[i];
|
||||
attachment.attachment = attachment.attachment.copy();
|
||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||
}
|
||||
attachments = this.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment_1 = attachments[i];
|
||||
if (attachment_1.attachment instanceof spine.MeshAttachment) {
|
||||
var mesh = attachment_1.attachment;
|
||||
if (mesh.getParentMesh()) {
|
||||
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
|
||||
mesh.updateUVs();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Skin.prototype.getAttachment = function (slotIndex, name) {
|
||||
var dictionary = this.attachments[slotIndex];
|
||||
return dictionary ? dictionary[name] : null;
|
||||
};
|
||||
Skin.prototype.removeAttachment = function (slotIndex, name) {
|
||||
var dictionary = this.attachments[slotIndex];
|
||||
if (dictionary)
|
||||
dictionary[name] = null;
|
||||
};
|
||||
Skin.prototype.getAttachments = function () {
|
||||
var entries = new Array();
|
||||
for (var i = 0; i < this.attachments.length; i++) {
|
||||
var slotAttachments = this.attachments[i];
|
||||
if (slotAttachments) {
|
||||
for (var name_2 in slotAttachments) {
|
||||
var attachment = slotAttachments[name_2];
|
||||
if (attachment)
|
||||
entries.push(new SkinEntry(i, name_2, attachment));
|
||||
}
|
||||
}
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
Skin.prototype.getAttachmentsForSlot = function (slotIndex, attachments) {
|
||||
var slotAttachments = this.attachments[slotIndex];
|
||||
if (slotAttachments) {
|
||||
for (var name_3 in slotAttachments) {
|
||||
var attachment = slotAttachments[name_3];
|
||||
if (attachment)
|
||||
attachments.push(new SkinEntry(slotIndex, name_3, attachment));
|
||||
}
|
||||
}
|
||||
};
|
||||
Skin.prototype.clear = function () {
|
||||
this.attachments.length = 0;
|
||||
this.bones.length = 0;
|
||||
this.constraints.length = 0;
|
||||
};
|
||||
Skin.prototype.attachAll = function (skeleton, oldSkin) {
|
||||
var slotIndex = 0;
|
||||
for (var i = 0; i < skeleton.slots.length; i++) {
|
||||
@ -6533,6 +6655,21 @@ var spine;
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
VertexAttachment.prototype.copyTo = function (attachment) {
|
||||
if (this.bones != null) {
|
||||
attachment.bones = new Array(this.bones.length);
|
||||
spine.Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);
|
||||
}
|
||||
else
|
||||
attachment.bones = null;
|
||||
if (this.vertices != null) {
|
||||
attachment.vertices = spine.Utils.newFloatArray(this.vertices.length);
|
||||
spine.Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
|
||||
}
|
||||
else
|
||||
attachment.vertices = null;
|
||||
attachment.worldVerticesLength = this.worldVerticesLength;
|
||||
};
|
||||
VertexAttachment.nextID = 0;
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
@ -6559,6 +6696,12 @@ var spine;
|
||||
_this.color = new spine.Color(1, 1, 1, 1);
|
||||
return _this;
|
||||
}
|
||||
BoundingBoxAttachment.prototype.copy = function () {
|
||||
var copy = new BoundingBoxAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
@ -6572,6 +6715,13 @@ var spine;
|
||||
_this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1);
|
||||
return _this;
|
||||
}
|
||||
ClippingAttachment.prototype.copy = function () {
|
||||
var copy = new ClippingAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.endSlot = this.endSlot;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return ClippingAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.ClippingAttachment = ClippingAttachment;
|
||||
@ -6665,6 +6815,34 @@ var spine;
|
||||
this.worldVerticesLength = parentMesh.worldVerticesLength;
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.copy = function () {
|
||||
var copy = new MeshAttachment(name);
|
||||
copy.region = this.region;
|
||||
copy.path = this.path;
|
||||
if (this.parentMesh == null) {
|
||||
this.copyTo(copy);
|
||||
copy.regionUVs = new Array(this.regionUVs.length);
|
||||
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
||||
copy.uvs = new Array(this.uvs.length);
|
||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
||||
copy.triangles = new Array(this.triangles.length);
|
||||
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
|
||||
copy.color.setFromColor(this.color);
|
||||
copy.hullLength = this.hullLength;
|
||||
copy.inheritDeform = this.inheritDeform;
|
||||
if (this.edges != null) {
|
||||
copy.edges = new Array(this.edges.length);
|
||||
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
||||
}
|
||||
copy.width = this.width;
|
||||
copy.height = this.height;
|
||||
}
|
||||
else {
|
||||
copy.setParentMesh(this.parentMesh);
|
||||
copy.updateUVs();
|
||||
}
|
||||
return copy;
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
@ -6680,6 +6858,16 @@ var spine;
|
||||
_this.color = new spine.Color(1, 1, 1, 1);
|
||||
return _this;
|
||||
}
|
||||
PathAttachment.prototype.copy = function () {
|
||||
var copy = new PathAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.lengths = new Array(this.lengths.length);
|
||||
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
|
||||
copy.closed = closed;
|
||||
copy.constantSpeed = this.constantSpeed;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
@ -6704,6 +6892,14 @@ var spine;
|
||||
var y = cos * bone.c + sin * bone.d;
|
||||
return Math.atan2(y, x) * spine.MathUtils.radDeg;
|
||||
};
|
||||
PointAttachment.prototype.copy = function () {
|
||||
var copy = new PointAttachment(name);
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.rotation = this.rotation;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return PointAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PointAttachment = PointAttachment;
|
||||
@ -6804,6 +7000,23 @@ var spine;
|
||||
worldVertices[offset] = offsetX * a + offsetY * b + x;
|
||||
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
||||
};
|
||||
RegionAttachment.prototype.copy = function () {
|
||||
var copy = new RegionAttachment(name);
|
||||
copy.region = this.region;
|
||||
copy.rendererObject = this.rendererObject;
|
||||
copy.path = this.path;
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.scaleX = this.scaleX;
|
||||
copy.scaleY = this.scaleY;
|
||||
copy.rotation = this.rotation;
|
||||
copy.width = this.width;
|
||||
copy.height = this.height;
|
||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
|
||||
spine.Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
|
||||
File diff suppressed because one or more lines are too long
27
spine-ts/build/spine-core.d.ts
vendored
27
spine-ts/build/spine-core.d.ts
vendored
@ -771,12 +771,26 @@ declare module spine {
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class SkinEntry {
|
||||
slotIndex: number;
|
||||
name: string;
|
||||
attachment: Attachment;
|
||||
constructor(slotIndex: number, name: string, attachment: Attachment);
|
||||
}
|
||||
class Skin {
|
||||
name: string;
|
||||
attachments: Map<Attachment>[];
|
||||
bones: BoneData[];
|
||||
constraints: SlotData[];
|
||||
constructor(name: string);
|
||||
addAttachment(slotIndex: number, name: string, attachment: Attachment): void;
|
||||
setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
|
||||
addSkin(skin: Skin): void;
|
||||
copySkin(skin: Skin): void;
|
||||
getAttachment(slotIndex: number, name: string): Attachment;
|
||||
removeAttachment(slotIndex: number, name: string): void;
|
||||
getAttachments(): Array<SkinEntry>;
|
||||
getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
|
||||
clear(): void;
|
||||
attachAll(skeleton: Skeleton, oldSkin: Skin): void;
|
||||
}
|
||||
}
|
||||
@ -1081,6 +1095,7 @@ declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
abstract copy(): Attachment;
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
private static nextID;
|
||||
@ -1091,6 +1106,7 @@ declare module spine {
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
copyTo(attachment: VertexAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1117,6 +1133,7 @@ declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1124,6 +1141,7 @@ declare module spine {
|
||||
endSlot: SlotData;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1134,7 +1152,10 @@ declare module spine {
|
||||
uvs: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
width: number;
|
||||
height: number;
|
||||
hullLength: number;
|
||||
edges: Array<number>;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
@ -1143,6 +1164,7 @@ declare module spine {
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1152,6 +1174,7 @@ declare module spine {
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1163,6 +1186,7 @@ declare module spine {
|
||||
constructor(name: string);
|
||||
computeWorldPosition(bone: Bone, point: Vector2): Vector2;
|
||||
computeWorldRotation(bone: Bone): number;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1225,6 +1249,7 @@ declare module spine {
|
||||
updateOffset(): void;
|
||||
setRegion(region: TextureRegion): void;
|
||||
computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
|
||||
@ -4675,7 +4675,7 @@ var spine;
|
||||
for (var entryName in slotMap) {
|
||||
var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData);
|
||||
if (attachment != null)
|
||||
skin.addAttachment(slotIndex, entryName, attachment);
|
||||
skin.setAttachment(slotIndex, entryName, attachment);
|
||||
}
|
||||
}
|
||||
skeletonData.skins.push(skin);
|
||||
@ -4762,6 +4762,8 @@ var spine;
|
||||
var color = this.getValue(map, "color", null);
|
||||
if (color != null)
|
||||
mesh.color.setFromString(color);
|
||||
mesh.width = this.getValue(map, "width", 0) * scale;
|
||||
mesh.height = this.getValue(map, "height", 0) * scale;
|
||||
var parent_4 = this.getValue(map, "parent", null);
|
||||
if (parent_4 != null) {
|
||||
mesh.inheritDeform = this.getValue(map, "deform", true);
|
||||
@ -4773,6 +4775,7 @@ var spine;
|
||||
mesh.triangles = map.triangles;
|
||||
mesh.regionUVs = uvs;
|
||||
mesh.updateUVs();
|
||||
mesh.edges = this.getValue(map, "edges", null);
|
||||
mesh.hullLength = this.getValue(map, "hull", 0) * 2;
|
||||
return mesh;
|
||||
}
|
||||
@ -5241,14 +5244,25 @@ var spine;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var SkinEntry = (function () {
|
||||
function SkinEntry(slotIndex, name, attachment) {
|
||||
this.slotIndex = slotIndex;
|
||||
this.name = name;
|
||||
this.attachment = attachment;
|
||||
}
|
||||
return SkinEntry;
|
||||
}());
|
||||
spine.SkinEntry = SkinEntry;
|
||||
var Skin = (function () {
|
||||
function Skin(name) {
|
||||
this.attachments = new Array();
|
||||
this.bones = Array();
|
||||
this.constraints = new Array();
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
Skin.prototype.addAttachment = function (slotIndex, name, attachment) {
|
||||
Skin.prototype.setAttachment = function (slotIndex, name, attachment) {
|
||||
if (attachment == null)
|
||||
throw new Error("attachment cannot be null.");
|
||||
var attachments = this.attachments;
|
||||
@ -5258,10 +5272,118 @@ var spine;
|
||||
attachments[slotIndex] = {};
|
||||
attachments[slotIndex][name] = attachment;
|
||||
};
|
||||
Skin.prototype.addSkin = function (skin) {
|
||||
for (var i = 0; i < skin.bones.length; i++) {
|
||||
var bone = skin.bones[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.bones.length; j++) {
|
||||
if (this.bones[j] == bone) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.bones.push(bone);
|
||||
}
|
||||
for (var i = 0; i < skin.constraints.length; i++) {
|
||||
var constraint = skin.constraints[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.constraints.length; j++) {
|
||||
if (this.constraints[j] == constraint) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.constraints.push(constraint);
|
||||
}
|
||||
var attachments = skin.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment = attachments[i];
|
||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||
}
|
||||
};
|
||||
Skin.prototype.copySkin = function (skin) {
|
||||
for (var i = 0; i < skin.bones.length; i++) {
|
||||
var bone = skin.bones[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.bones.length; j++) {
|
||||
if (this.bones[j] == bone) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.bones.push(bone);
|
||||
}
|
||||
for (var i = 0; i < skin.constraints.length; i++) {
|
||||
var constraint = skin.constraints[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.constraints.length; j++) {
|
||||
if (this.constraints[j] == constraint) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.constraints.push(constraint);
|
||||
}
|
||||
var attachments = skin.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment = attachments[i];
|
||||
attachment.attachment = attachment.attachment.copy();
|
||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||
}
|
||||
attachments = this.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment_1 = attachments[i];
|
||||
if (attachment_1.attachment instanceof spine.MeshAttachment) {
|
||||
var mesh = attachment_1.attachment;
|
||||
if (mesh.getParentMesh()) {
|
||||
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
|
||||
mesh.updateUVs();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Skin.prototype.getAttachment = function (slotIndex, name) {
|
||||
var dictionary = this.attachments[slotIndex];
|
||||
return dictionary ? dictionary[name] : null;
|
||||
};
|
||||
Skin.prototype.removeAttachment = function (slotIndex, name) {
|
||||
var dictionary = this.attachments[slotIndex];
|
||||
if (dictionary)
|
||||
dictionary[name] = null;
|
||||
};
|
||||
Skin.prototype.getAttachments = function () {
|
||||
var entries = new Array();
|
||||
for (var i = 0; i < this.attachments.length; i++) {
|
||||
var slotAttachments = this.attachments[i];
|
||||
if (slotAttachments) {
|
||||
for (var name_2 in slotAttachments) {
|
||||
var attachment = slotAttachments[name_2];
|
||||
if (attachment)
|
||||
entries.push(new SkinEntry(i, name_2, attachment));
|
||||
}
|
||||
}
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
Skin.prototype.getAttachmentsForSlot = function (slotIndex, attachments) {
|
||||
var slotAttachments = this.attachments[slotIndex];
|
||||
if (slotAttachments) {
|
||||
for (var name_3 in slotAttachments) {
|
||||
var attachment = slotAttachments[name_3];
|
||||
if (attachment)
|
||||
attachments.push(new SkinEntry(slotIndex, name_3, attachment));
|
||||
}
|
||||
}
|
||||
};
|
||||
Skin.prototype.clear = function () {
|
||||
this.attachments.length = 0;
|
||||
this.bones.length = 0;
|
||||
this.constraints.length = 0;
|
||||
};
|
||||
Skin.prototype.attachAll = function (skeleton, oldSkin) {
|
||||
var slotIndex = 0;
|
||||
for (var i = 0; i < skeleton.slots.length; i++) {
|
||||
@ -6533,6 +6655,21 @@ var spine;
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
VertexAttachment.prototype.copyTo = function (attachment) {
|
||||
if (this.bones != null) {
|
||||
attachment.bones = new Array(this.bones.length);
|
||||
spine.Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);
|
||||
}
|
||||
else
|
||||
attachment.bones = null;
|
||||
if (this.vertices != null) {
|
||||
attachment.vertices = spine.Utils.newFloatArray(this.vertices.length);
|
||||
spine.Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
|
||||
}
|
||||
else
|
||||
attachment.vertices = null;
|
||||
attachment.worldVerticesLength = this.worldVerticesLength;
|
||||
};
|
||||
VertexAttachment.nextID = 0;
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
@ -6559,6 +6696,12 @@ var spine;
|
||||
_this.color = new spine.Color(1, 1, 1, 1);
|
||||
return _this;
|
||||
}
|
||||
BoundingBoxAttachment.prototype.copy = function () {
|
||||
var copy = new BoundingBoxAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
@ -6572,6 +6715,13 @@ var spine;
|
||||
_this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1);
|
||||
return _this;
|
||||
}
|
||||
ClippingAttachment.prototype.copy = function () {
|
||||
var copy = new ClippingAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.endSlot = this.endSlot;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return ClippingAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.ClippingAttachment = ClippingAttachment;
|
||||
@ -6665,6 +6815,34 @@ var spine;
|
||||
this.worldVerticesLength = parentMesh.worldVerticesLength;
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.copy = function () {
|
||||
var copy = new MeshAttachment(name);
|
||||
copy.region = this.region;
|
||||
copy.path = this.path;
|
||||
if (this.parentMesh == null) {
|
||||
this.copyTo(copy);
|
||||
copy.regionUVs = new Array(this.regionUVs.length);
|
||||
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
||||
copy.uvs = new Array(this.uvs.length);
|
||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
||||
copy.triangles = new Array(this.triangles.length);
|
||||
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
|
||||
copy.color.setFromColor(this.color);
|
||||
copy.hullLength = this.hullLength;
|
||||
copy.inheritDeform = this.inheritDeform;
|
||||
if (this.edges != null) {
|
||||
copy.edges = new Array(this.edges.length);
|
||||
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
||||
}
|
||||
copy.width = this.width;
|
||||
copy.height = this.height;
|
||||
}
|
||||
else {
|
||||
copy.setParentMesh(this.parentMesh);
|
||||
copy.updateUVs();
|
||||
}
|
||||
return copy;
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
@ -6680,6 +6858,16 @@ var spine;
|
||||
_this.color = new spine.Color(1, 1, 1, 1);
|
||||
return _this;
|
||||
}
|
||||
PathAttachment.prototype.copy = function () {
|
||||
var copy = new PathAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.lengths = new Array(this.lengths.length);
|
||||
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
|
||||
copy.closed = closed;
|
||||
copy.constantSpeed = this.constantSpeed;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
@ -6704,6 +6892,14 @@ var spine;
|
||||
var y = cos * bone.c + sin * bone.d;
|
||||
return Math.atan2(y, x) * spine.MathUtils.radDeg;
|
||||
};
|
||||
PointAttachment.prototype.copy = function () {
|
||||
var copy = new PointAttachment(name);
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.rotation = this.rotation;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return PointAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PointAttachment = PointAttachment;
|
||||
@ -6804,6 +7000,23 @@ var spine;
|
||||
worldVertices[offset] = offsetX * a + offsetY * b + x;
|
||||
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
||||
};
|
||||
RegionAttachment.prototype.copy = function () {
|
||||
var copy = new RegionAttachment(name);
|
||||
copy.region = this.region;
|
||||
copy.rendererObject = this.rendererObject;
|
||||
copy.path = this.path;
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.scaleX = this.scaleX;
|
||||
copy.scaleY = this.scaleY;
|
||||
copy.rotation = this.rotation;
|
||||
copy.width = this.width;
|
||||
copy.height = this.height;
|
||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
|
||||
spine.Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
|
||||
File diff suppressed because one or more lines are too long
27
spine-ts/build/spine-player.d.ts
vendored
27
spine-ts/build/spine-player.d.ts
vendored
@ -771,12 +771,26 @@ declare module spine {
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class SkinEntry {
|
||||
slotIndex: number;
|
||||
name: string;
|
||||
attachment: Attachment;
|
||||
constructor(slotIndex: number, name: string, attachment: Attachment);
|
||||
}
|
||||
class Skin {
|
||||
name: string;
|
||||
attachments: Map<Attachment>[];
|
||||
bones: BoneData[];
|
||||
constraints: SlotData[];
|
||||
constructor(name: string);
|
||||
addAttachment(slotIndex: number, name: string, attachment: Attachment): void;
|
||||
setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
|
||||
addSkin(skin: Skin): void;
|
||||
copySkin(skin: Skin): void;
|
||||
getAttachment(slotIndex: number, name: string): Attachment;
|
||||
removeAttachment(slotIndex: number, name: string): void;
|
||||
getAttachments(): Array<SkinEntry>;
|
||||
getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
|
||||
clear(): void;
|
||||
attachAll(skeleton: Skeleton, oldSkin: Skin): void;
|
||||
}
|
||||
}
|
||||
@ -1081,6 +1095,7 @@ declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
abstract copy(): Attachment;
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
private static nextID;
|
||||
@ -1091,6 +1106,7 @@ declare module spine {
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
copyTo(attachment: VertexAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1117,6 +1133,7 @@ declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1124,6 +1141,7 @@ declare module spine {
|
||||
endSlot: SlotData;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1134,7 +1152,10 @@ declare module spine {
|
||||
uvs: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
width: number;
|
||||
height: number;
|
||||
hullLength: number;
|
||||
edges: Array<number>;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
@ -1143,6 +1164,7 @@ declare module spine {
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1152,6 +1174,7 @@ declare module spine {
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1163,6 +1186,7 @@ declare module spine {
|
||||
constructor(name: string);
|
||||
computeWorldPosition(bone: Bone, point: Vector2): Vector2;
|
||||
computeWorldRotation(bone: Bone): number;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1225,6 +1249,7 @@ declare module spine {
|
||||
updateOffset(): void;
|
||||
setRegion(region: TextureRegion): void;
|
||||
computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
|
||||
@ -4675,7 +4675,7 @@ var spine;
|
||||
for (var entryName in slotMap) {
|
||||
var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData);
|
||||
if (attachment != null)
|
||||
skin.addAttachment(slotIndex, entryName, attachment);
|
||||
skin.setAttachment(slotIndex, entryName, attachment);
|
||||
}
|
||||
}
|
||||
skeletonData.skins.push(skin);
|
||||
@ -4762,6 +4762,8 @@ var spine;
|
||||
var color = this.getValue(map, "color", null);
|
||||
if (color != null)
|
||||
mesh.color.setFromString(color);
|
||||
mesh.width = this.getValue(map, "width", 0) * scale;
|
||||
mesh.height = this.getValue(map, "height", 0) * scale;
|
||||
var parent_4 = this.getValue(map, "parent", null);
|
||||
if (parent_4 != null) {
|
||||
mesh.inheritDeform = this.getValue(map, "deform", true);
|
||||
@ -4773,6 +4775,7 @@ var spine;
|
||||
mesh.triangles = map.triangles;
|
||||
mesh.regionUVs = uvs;
|
||||
mesh.updateUVs();
|
||||
mesh.edges = this.getValue(map, "edges", null);
|
||||
mesh.hullLength = this.getValue(map, "hull", 0) * 2;
|
||||
return mesh;
|
||||
}
|
||||
@ -5241,14 +5244,25 @@ var spine;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var SkinEntry = (function () {
|
||||
function SkinEntry(slotIndex, name, attachment) {
|
||||
this.slotIndex = slotIndex;
|
||||
this.name = name;
|
||||
this.attachment = attachment;
|
||||
}
|
||||
return SkinEntry;
|
||||
}());
|
||||
spine.SkinEntry = SkinEntry;
|
||||
var Skin = (function () {
|
||||
function Skin(name) {
|
||||
this.attachments = new Array();
|
||||
this.bones = Array();
|
||||
this.constraints = new Array();
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
Skin.prototype.addAttachment = function (slotIndex, name, attachment) {
|
||||
Skin.prototype.setAttachment = function (slotIndex, name, attachment) {
|
||||
if (attachment == null)
|
||||
throw new Error("attachment cannot be null.");
|
||||
var attachments = this.attachments;
|
||||
@ -5258,10 +5272,118 @@ var spine;
|
||||
attachments[slotIndex] = {};
|
||||
attachments[slotIndex][name] = attachment;
|
||||
};
|
||||
Skin.prototype.addSkin = function (skin) {
|
||||
for (var i = 0; i < skin.bones.length; i++) {
|
||||
var bone = skin.bones[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.bones.length; j++) {
|
||||
if (this.bones[j] == bone) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.bones.push(bone);
|
||||
}
|
||||
for (var i = 0; i < skin.constraints.length; i++) {
|
||||
var constraint = skin.constraints[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.constraints.length; j++) {
|
||||
if (this.constraints[j] == constraint) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.constraints.push(constraint);
|
||||
}
|
||||
var attachments = skin.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment = attachments[i];
|
||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||
}
|
||||
};
|
||||
Skin.prototype.copySkin = function (skin) {
|
||||
for (var i = 0; i < skin.bones.length; i++) {
|
||||
var bone = skin.bones[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.bones.length; j++) {
|
||||
if (this.bones[j] == bone) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.bones.push(bone);
|
||||
}
|
||||
for (var i = 0; i < skin.constraints.length; i++) {
|
||||
var constraint = skin.constraints[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.constraints.length; j++) {
|
||||
if (this.constraints[j] == constraint) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.constraints.push(constraint);
|
||||
}
|
||||
var attachments = skin.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment = attachments[i];
|
||||
attachment.attachment = attachment.attachment.copy();
|
||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||
}
|
||||
attachments = this.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment_1 = attachments[i];
|
||||
if (attachment_1.attachment instanceof spine.MeshAttachment) {
|
||||
var mesh = attachment_1.attachment;
|
||||
if (mesh.getParentMesh()) {
|
||||
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
|
||||
mesh.updateUVs();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Skin.prototype.getAttachment = function (slotIndex, name) {
|
||||
var dictionary = this.attachments[slotIndex];
|
||||
return dictionary ? dictionary[name] : null;
|
||||
};
|
||||
Skin.prototype.removeAttachment = function (slotIndex, name) {
|
||||
var dictionary = this.attachments[slotIndex];
|
||||
if (dictionary)
|
||||
dictionary[name] = null;
|
||||
};
|
||||
Skin.prototype.getAttachments = function () {
|
||||
var entries = new Array();
|
||||
for (var i = 0; i < this.attachments.length; i++) {
|
||||
var slotAttachments = this.attachments[i];
|
||||
if (slotAttachments) {
|
||||
for (var name_2 in slotAttachments) {
|
||||
var attachment = slotAttachments[name_2];
|
||||
if (attachment)
|
||||
entries.push(new SkinEntry(i, name_2, attachment));
|
||||
}
|
||||
}
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
Skin.prototype.getAttachmentsForSlot = function (slotIndex, attachments) {
|
||||
var slotAttachments = this.attachments[slotIndex];
|
||||
if (slotAttachments) {
|
||||
for (var name_3 in slotAttachments) {
|
||||
var attachment = slotAttachments[name_3];
|
||||
if (attachment)
|
||||
attachments.push(new SkinEntry(slotIndex, name_3, attachment));
|
||||
}
|
||||
}
|
||||
};
|
||||
Skin.prototype.clear = function () {
|
||||
this.attachments.length = 0;
|
||||
this.bones.length = 0;
|
||||
this.constraints.length = 0;
|
||||
};
|
||||
Skin.prototype.attachAll = function (skeleton, oldSkin) {
|
||||
var slotIndex = 0;
|
||||
for (var i = 0; i < skeleton.slots.length; i++) {
|
||||
@ -6533,6 +6655,21 @@ var spine;
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
VertexAttachment.prototype.copyTo = function (attachment) {
|
||||
if (this.bones != null) {
|
||||
attachment.bones = new Array(this.bones.length);
|
||||
spine.Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);
|
||||
}
|
||||
else
|
||||
attachment.bones = null;
|
||||
if (this.vertices != null) {
|
||||
attachment.vertices = spine.Utils.newFloatArray(this.vertices.length);
|
||||
spine.Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
|
||||
}
|
||||
else
|
||||
attachment.vertices = null;
|
||||
attachment.worldVerticesLength = this.worldVerticesLength;
|
||||
};
|
||||
VertexAttachment.nextID = 0;
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
@ -6559,6 +6696,12 @@ var spine;
|
||||
_this.color = new spine.Color(1, 1, 1, 1);
|
||||
return _this;
|
||||
}
|
||||
BoundingBoxAttachment.prototype.copy = function () {
|
||||
var copy = new BoundingBoxAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
@ -6572,6 +6715,13 @@ var spine;
|
||||
_this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1);
|
||||
return _this;
|
||||
}
|
||||
ClippingAttachment.prototype.copy = function () {
|
||||
var copy = new ClippingAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.endSlot = this.endSlot;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return ClippingAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.ClippingAttachment = ClippingAttachment;
|
||||
@ -6665,6 +6815,34 @@ var spine;
|
||||
this.worldVerticesLength = parentMesh.worldVerticesLength;
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.copy = function () {
|
||||
var copy = new MeshAttachment(name);
|
||||
copy.region = this.region;
|
||||
copy.path = this.path;
|
||||
if (this.parentMesh == null) {
|
||||
this.copyTo(copy);
|
||||
copy.regionUVs = new Array(this.regionUVs.length);
|
||||
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
||||
copy.uvs = new Array(this.uvs.length);
|
||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
||||
copy.triangles = new Array(this.triangles.length);
|
||||
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
|
||||
copy.color.setFromColor(this.color);
|
||||
copy.hullLength = this.hullLength;
|
||||
copy.inheritDeform = this.inheritDeform;
|
||||
if (this.edges != null) {
|
||||
copy.edges = new Array(this.edges.length);
|
||||
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
||||
}
|
||||
copy.width = this.width;
|
||||
copy.height = this.height;
|
||||
}
|
||||
else {
|
||||
copy.setParentMesh(this.parentMesh);
|
||||
copy.updateUVs();
|
||||
}
|
||||
return copy;
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
@ -6680,6 +6858,16 @@ var spine;
|
||||
_this.color = new spine.Color(1, 1, 1, 1);
|
||||
return _this;
|
||||
}
|
||||
PathAttachment.prototype.copy = function () {
|
||||
var copy = new PathAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.lengths = new Array(this.lengths.length);
|
||||
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
|
||||
copy.closed = closed;
|
||||
copy.constantSpeed = this.constantSpeed;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
@ -6704,6 +6892,14 @@ var spine;
|
||||
var y = cos * bone.c + sin * bone.d;
|
||||
return Math.atan2(y, x) * spine.MathUtils.radDeg;
|
||||
};
|
||||
PointAttachment.prototype.copy = function () {
|
||||
var copy = new PointAttachment(name);
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.rotation = this.rotation;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return PointAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PointAttachment = PointAttachment;
|
||||
@ -6804,6 +7000,23 @@ var spine;
|
||||
worldVertices[offset] = offsetX * a + offsetY * b + x;
|
||||
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
||||
};
|
||||
RegionAttachment.prototype.copy = function () {
|
||||
var copy = new RegionAttachment(name);
|
||||
copy.region = this.region;
|
||||
copy.rendererObject = this.rendererObject;
|
||||
copy.path = this.path;
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.scaleX = this.scaleX;
|
||||
copy.scaleY = this.scaleY;
|
||||
copy.rotation = this.rotation;
|
||||
copy.width = this.width;
|
||||
copy.height = this.height;
|
||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
|
||||
spine.Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
|
||||
File diff suppressed because one or more lines are too long
27
spine-ts/build/spine-threejs.d.ts
vendored
27
spine-ts/build/spine-threejs.d.ts
vendored
@ -771,12 +771,26 @@ declare module spine {
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
class SkinEntry {
|
||||
slotIndex: number;
|
||||
name: string;
|
||||
attachment: Attachment;
|
||||
constructor(slotIndex: number, name: string, attachment: Attachment);
|
||||
}
|
||||
class Skin {
|
||||
name: string;
|
||||
attachments: Map<Attachment>[];
|
||||
bones: BoneData[];
|
||||
constraints: SlotData[];
|
||||
constructor(name: string);
|
||||
addAttachment(slotIndex: number, name: string, attachment: Attachment): void;
|
||||
setAttachment(slotIndex: number, name: string, attachment: Attachment): void;
|
||||
addSkin(skin: Skin): void;
|
||||
copySkin(skin: Skin): void;
|
||||
getAttachment(slotIndex: number, name: string): Attachment;
|
||||
removeAttachment(slotIndex: number, name: string): void;
|
||||
getAttachments(): Array<SkinEntry>;
|
||||
getAttachmentsForSlot(slotIndex: number, attachments: Array<SkinEntry>): void;
|
||||
clear(): void;
|
||||
attachAll(skeleton: Skeleton, oldSkin: Skin): void;
|
||||
}
|
||||
}
|
||||
@ -1081,6 +1095,7 @@ declare module spine {
|
||||
abstract class Attachment {
|
||||
name: string;
|
||||
constructor(name: string);
|
||||
abstract copy(): Attachment;
|
||||
}
|
||||
abstract class VertexAttachment extends Attachment {
|
||||
private static nextID;
|
||||
@ -1091,6 +1106,7 @@ declare module spine {
|
||||
constructor(name: string);
|
||||
computeWorldVertices(slot: Slot, start: number, count: number, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
copyTo(attachment: VertexAttachment): void;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1117,6 +1133,7 @@ declare module spine {
|
||||
class BoundingBoxAttachment extends VertexAttachment {
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1124,6 +1141,7 @@ declare module spine {
|
||||
endSlot: SlotData;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1134,7 +1152,10 @@ declare module spine {
|
||||
uvs: ArrayLike<number>;
|
||||
triangles: Array<number>;
|
||||
color: Color;
|
||||
width: number;
|
||||
height: number;
|
||||
hullLength: number;
|
||||
edges: Array<number>;
|
||||
private parentMesh;
|
||||
inheritDeform: boolean;
|
||||
tempColor: Color;
|
||||
@ -1143,6 +1164,7 @@ declare module spine {
|
||||
applyDeform(sourceAttachment: VertexAttachment): boolean;
|
||||
getParentMesh(): MeshAttachment;
|
||||
setParentMesh(parentMesh: MeshAttachment): void;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1152,6 +1174,7 @@ declare module spine {
|
||||
constantSpeed: boolean;
|
||||
color: Color;
|
||||
constructor(name: string);
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1163,6 +1186,7 @@ declare module spine {
|
||||
constructor(name: string);
|
||||
computeWorldPosition(bone: Bone, point: Vector2): Vector2;
|
||||
computeWorldRotation(bone: Bone): number;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
@ -1225,6 +1249,7 @@ declare module spine {
|
||||
updateOffset(): void;
|
||||
setRegion(region: TextureRegion): void;
|
||||
computeWorldVertices(bone: Bone, worldVertices: ArrayLike<number>, offset: number, stride: number): void;
|
||||
copy(): Attachment;
|
||||
}
|
||||
}
|
||||
declare module spine {
|
||||
|
||||
@ -4675,7 +4675,7 @@ var spine;
|
||||
for (var entryName in slotMap) {
|
||||
var attachment = this.readAttachment(slotMap[entryName], skin, slotIndex, entryName, skeletonData);
|
||||
if (attachment != null)
|
||||
skin.addAttachment(slotIndex, entryName, attachment);
|
||||
skin.setAttachment(slotIndex, entryName, attachment);
|
||||
}
|
||||
}
|
||||
skeletonData.skins.push(skin);
|
||||
@ -4762,6 +4762,8 @@ var spine;
|
||||
var color = this.getValue(map, "color", null);
|
||||
if (color != null)
|
||||
mesh.color.setFromString(color);
|
||||
mesh.width = this.getValue(map, "width", 0) * scale;
|
||||
mesh.height = this.getValue(map, "height", 0) * scale;
|
||||
var parent_4 = this.getValue(map, "parent", null);
|
||||
if (parent_4 != null) {
|
||||
mesh.inheritDeform = this.getValue(map, "deform", true);
|
||||
@ -4773,6 +4775,7 @@ var spine;
|
||||
mesh.triangles = map.triangles;
|
||||
mesh.regionUVs = uvs;
|
||||
mesh.updateUVs();
|
||||
mesh.edges = this.getValue(map, "edges", null);
|
||||
mesh.hullLength = this.getValue(map, "hull", 0) * 2;
|
||||
return mesh;
|
||||
}
|
||||
@ -5241,14 +5244,25 @@ var spine;
|
||||
})(spine || (spine = {}));
|
||||
var spine;
|
||||
(function (spine) {
|
||||
var SkinEntry = (function () {
|
||||
function SkinEntry(slotIndex, name, attachment) {
|
||||
this.slotIndex = slotIndex;
|
||||
this.name = name;
|
||||
this.attachment = attachment;
|
||||
}
|
||||
return SkinEntry;
|
||||
}());
|
||||
spine.SkinEntry = SkinEntry;
|
||||
var Skin = (function () {
|
||||
function Skin(name) {
|
||||
this.attachments = new Array();
|
||||
this.bones = Array();
|
||||
this.constraints = new Array();
|
||||
if (name == null)
|
||||
throw new Error("name cannot be null.");
|
||||
this.name = name;
|
||||
}
|
||||
Skin.prototype.addAttachment = function (slotIndex, name, attachment) {
|
||||
Skin.prototype.setAttachment = function (slotIndex, name, attachment) {
|
||||
if (attachment == null)
|
||||
throw new Error("attachment cannot be null.");
|
||||
var attachments = this.attachments;
|
||||
@ -5258,10 +5272,118 @@ var spine;
|
||||
attachments[slotIndex] = {};
|
||||
attachments[slotIndex][name] = attachment;
|
||||
};
|
||||
Skin.prototype.addSkin = function (skin) {
|
||||
for (var i = 0; i < skin.bones.length; i++) {
|
||||
var bone = skin.bones[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.bones.length; j++) {
|
||||
if (this.bones[j] == bone) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.bones.push(bone);
|
||||
}
|
||||
for (var i = 0; i < skin.constraints.length; i++) {
|
||||
var constraint = skin.constraints[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.constraints.length; j++) {
|
||||
if (this.constraints[j] == constraint) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.constraints.push(constraint);
|
||||
}
|
||||
var attachments = skin.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment = attachments[i];
|
||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||
}
|
||||
};
|
||||
Skin.prototype.copySkin = function (skin) {
|
||||
for (var i = 0; i < skin.bones.length; i++) {
|
||||
var bone = skin.bones[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.bones.length; j++) {
|
||||
if (this.bones[j] == bone) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.bones.push(bone);
|
||||
}
|
||||
for (var i = 0; i < skin.constraints.length; i++) {
|
||||
var constraint = skin.constraints[i];
|
||||
var contained = false;
|
||||
for (var j = 0; j < this.constraints.length; j++) {
|
||||
if (this.constraints[j] == constraint) {
|
||||
contained = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contained)
|
||||
this.constraints.push(constraint);
|
||||
}
|
||||
var attachments = skin.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment = attachments[i];
|
||||
attachment.attachment = attachment.attachment.copy();
|
||||
this.setAttachment(attachment.slotIndex, attachment.name, attachment.attachment);
|
||||
}
|
||||
attachments = this.getAttachments();
|
||||
for (var i = 0; i < attachments.length; i++) {
|
||||
var attachment_1 = attachments[i];
|
||||
if (attachment_1.attachment instanceof spine.MeshAttachment) {
|
||||
var mesh = attachment_1.attachment;
|
||||
if (mesh.getParentMesh()) {
|
||||
mesh.setParentMesh(this.getAttachment(attachment_1.slotIndex, mesh.getParentMesh().name));
|
||||
mesh.updateUVs();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Skin.prototype.getAttachment = function (slotIndex, name) {
|
||||
var dictionary = this.attachments[slotIndex];
|
||||
return dictionary ? dictionary[name] : null;
|
||||
};
|
||||
Skin.prototype.removeAttachment = function (slotIndex, name) {
|
||||
var dictionary = this.attachments[slotIndex];
|
||||
if (dictionary)
|
||||
dictionary[name] = null;
|
||||
};
|
||||
Skin.prototype.getAttachments = function () {
|
||||
var entries = new Array();
|
||||
for (var i = 0; i < this.attachments.length; i++) {
|
||||
var slotAttachments = this.attachments[i];
|
||||
if (slotAttachments) {
|
||||
for (var name_2 in slotAttachments) {
|
||||
var attachment = slotAttachments[name_2];
|
||||
if (attachment)
|
||||
entries.push(new SkinEntry(i, name_2, attachment));
|
||||
}
|
||||
}
|
||||
}
|
||||
return entries;
|
||||
};
|
||||
Skin.prototype.getAttachmentsForSlot = function (slotIndex, attachments) {
|
||||
var slotAttachments = this.attachments[slotIndex];
|
||||
if (slotAttachments) {
|
||||
for (var name_3 in slotAttachments) {
|
||||
var attachment = slotAttachments[name_3];
|
||||
if (attachment)
|
||||
attachments.push(new SkinEntry(slotIndex, name_3, attachment));
|
||||
}
|
||||
}
|
||||
};
|
||||
Skin.prototype.clear = function () {
|
||||
this.attachments.length = 0;
|
||||
this.bones.length = 0;
|
||||
this.constraints.length = 0;
|
||||
};
|
||||
Skin.prototype.attachAll = function (skeleton, oldSkin) {
|
||||
var slotIndex = 0;
|
||||
for (var i = 0; i < skeleton.slots.length; i++) {
|
||||
@ -6533,6 +6655,21 @@ var spine;
|
||||
VertexAttachment.prototype.applyDeform = function (sourceAttachment) {
|
||||
return this == sourceAttachment;
|
||||
};
|
||||
VertexAttachment.prototype.copyTo = function (attachment) {
|
||||
if (this.bones != null) {
|
||||
attachment.bones = new Array(this.bones.length);
|
||||
spine.Utils.arrayCopy(this.bones, 0, attachment.bones, 0, this.bones.length);
|
||||
}
|
||||
else
|
||||
attachment.bones = null;
|
||||
if (this.vertices != null) {
|
||||
attachment.vertices = spine.Utils.newFloatArray(this.vertices.length);
|
||||
spine.Utils.arrayCopy(this.vertices, 0, attachment.vertices, 0, this.vertices.length);
|
||||
}
|
||||
else
|
||||
attachment.vertices = null;
|
||||
attachment.worldVerticesLength = this.worldVerticesLength;
|
||||
};
|
||||
VertexAttachment.nextID = 0;
|
||||
return VertexAttachment;
|
||||
}(Attachment));
|
||||
@ -6559,6 +6696,12 @@ var spine;
|
||||
_this.color = new spine.Color(1, 1, 1, 1);
|
||||
return _this;
|
||||
}
|
||||
BoundingBoxAttachment.prototype.copy = function () {
|
||||
var copy = new BoundingBoxAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return BoundingBoxAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.BoundingBoxAttachment = BoundingBoxAttachment;
|
||||
@ -6572,6 +6715,13 @@ var spine;
|
||||
_this.color = new spine.Color(0.2275, 0.2275, 0.8078, 1);
|
||||
return _this;
|
||||
}
|
||||
ClippingAttachment.prototype.copy = function () {
|
||||
var copy = new ClippingAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.endSlot = this.endSlot;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return ClippingAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.ClippingAttachment = ClippingAttachment;
|
||||
@ -6665,6 +6815,34 @@ var spine;
|
||||
this.worldVerticesLength = parentMesh.worldVerticesLength;
|
||||
}
|
||||
};
|
||||
MeshAttachment.prototype.copy = function () {
|
||||
var copy = new MeshAttachment(name);
|
||||
copy.region = this.region;
|
||||
copy.path = this.path;
|
||||
if (this.parentMesh == null) {
|
||||
this.copyTo(copy);
|
||||
copy.regionUVs = new Array(this.regionUVs.length);
|
||||
spine.Utils.arrayCopy(this.regionUVs, 0, copy.regionUVs, 0, this.regionUVs.length);
|
||||
copy.uvs = new Array(this.uvs.length);
|
||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, this.uvs.length);
|
||||
copy.triangles = new Array(this.triangles.length);
|
||||
spine.Utils.arrayCopy(this.triangles, 0, copy.triangles, 0, this.triangles.length);
|
||||
copy.color.setFromColor(this.color);
|
||||
copy.hullLength = this.hullLength;
|
||||
copy.inheritDeform = this.inheritDeform;
|
||||
if (this.edges != null) {
|
||||
copy.edges = new Array(this.edges.length);
|
||||
spine.Utils.arrayCopy(this.edges, 0, copy.edges, 0, this.edges.length);
|
||||
}
|
||||
copy.width = this.width;
|
||||
copy.height = this.height;
|
||||
}
|
||||
else {
|
||||
copy.setParentMesh(this.parentMesh);
|
||||
copy.updateUVs();
|
||||
}
|
||||
return copy;
|
||||
};
|
||||
return MeshAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.MeshAttachment = MeshAttachment;
|
||||
@ -6680,6 +6858,16 @@ var spine;
|
||||
_this.color = new spine.Color(1, 1, 1, 1);
|
||||
return _this;
|
||||
}
|
||||
PathAttachment.prototype.copy = function () {
|
||||
var copy = new PathAttachment(name);
|
||||
this.copyTo(copy);
|
||||
copy.lengths = new Array(this.lengths.length);
|
||||
spine.Utils.arrayCopy(this.lengths, 0, copy.lengths, 0, this.lengths.length);
|
||||
copy.closed = closed;
|
||||
copy.constantSpeed = this.constantSpeed;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return PathAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PathAttachment = PathAttachment;
|
||||
@ -6704,6 +6892,14 @@ var spine;
|
||||
var y = cos * bone.c + sin * bone.d;
|
||||
return Math.atan2(y, x) * spine.MathUtils.radDeg;
|
||||
};
|
||||
PointAttachment.prototype.copy = function () {
|
||||
var copy = new PointAttachment(name);
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.rotation = this.rotation;
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
return PointAttachment;
|
||||
}(spine.VertexAttachment));
|
||||
spine.PointAttachment = PointAttachment;
|
||||
@ -6804,6 +7000,23 @@ var spine;
|
||||
worldVertices[offset] = offsetX * a + offsetY * b + x;
|
||||
worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
|
||||
};
|
||||
RegionAttachment.prototype.copy = function () {
|
||||
var copy = new RegionAttachment(name);
|
||||
copy.region = this.region;
|
||||
copy.rendererObject = this.rendererObject;
|
||||
copy.path = this.path;
|
||||
copy.x = this.x;
|
||||
copy.y = this.y;
|
||||
copy.scaleX = this.scaleX;
|
||||
copy.scaleY = this.scaleY;
|
||||
copy.rotation = this.rotation;
|
||||
copy.width = this.width;
|
||||
copy.height = this.height;
|
||||
spine.Utils.arrayCopy(this.uvs, 0, copy.uvs, 0, 8);
|
||||
spine.Utils.arrayCopy(this.offset, 0, copy.offset, 0, 8);
|
||||
copy.color.setFromColor(this.color);
|
||||
return copy;
|
||||
};
|
||||
RegionAttachment.OX1 = 0;
|
||||
RegionAttachment.OY1 = 1;
|
||||
RegionAttachment.OX2 = 2;
|
||||
|
||||
File diff suppressed because one or more lines are too long
3192
spine-ts/build/spine-webgl.d.ts
vendored
3192
spine-ts/build/spine-webgl.d.ts
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user