mirror of
https://github.com/photonstorm/phaser
synced 2024-11-21 20:23:19 +00:00
Fixed setSkin method and added other helper methods
This commit is contained in:
parent
00661c4d5d
commit
7b96356cfc
1 changed files with 74 additions and 1 deletions
|
@ -234,6 +234,37 @@ var SpineGameObject = new Class({
|
|||
return output;
|
||||
},
|
||||
|
||||
getSkinList: function ()
|
||||
{
|
||||
var output = [];
|
||||
|
||||
var skeletonData = this.skeletonData;
|
||||
|
||||
if (skeletonData)
|
||||
{
|
||||
for (var i = 0; i < skeletonData.skins.length; i++)
|
||||
{
|
||||
output.push(skeletonData.skins[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
getSlotList: function ()
|
||||
{
|
||||
var output = [];
|
||||
|
||||
var skeleton = this.skeleton;
|
||||
|
||||
for (var i = 0; i < skeleton.slots.length; i++)
|
||||
{
|
||||
output.push(skeleton.slots[i].data.name);
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
getAnimationList: function ()
|
||||
{
|
||||
var output = [];
|
||||
|
@ -299,7 +330,13 @@ var SpineGameObject = new Class({
|
|||
|
||||
setSkinByName: function (skinName)
|
||||
{
|
||||
this.skeleton.setSkinByName(skinName);
|
||||
var skeleton = this.skeleton;
|
||||
|
||||
skeleton.setSkinByName(skinName);
|
||||
|
||||
skeleton.setSlotsToSetupPose();
|
||||
|
||||
this.state.apply(skeleton);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
@ -324,6 +361,42 @@ var SpineGameObject = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
getAttachment: function (slotIndex, attachmentName)
|
||||
{
|
||||
return this.skeleton.getAttachment(slotIndex, attachmentName);
|
||||
},
|
||||
|
||||
getAttachmentByName: function (slotName, attachmentName)
|
||||
{
|
||||
return this.skeleton.getAttachmentByName(slotName, attachmentName);
|
||||
},
|
||||
|
||||
setAttachment: function (slotName, attachmentName)
|
||||
{
|
||||
return this.skeleton.setAttachment(slotName, attachmentName);
|
||||
},
|
||||
|
||||
setToSetupPose: function ()
|
||||
{
|
||||
this.skeleton.setToSetupPose();
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
setSlotsToSetupPose: function ()
|
||||
{
|
||||
this.skeleton.setSlotsToSetupPose();
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
setBonesToSetupPose: function ()
|
||||
{
|
||||
this.skeleton.setBonesToSetupPose();
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
getRootBone: function ()
|
||||
{
|
||||
return this.skeleton.getRootBone();
|
||||
|
|
Loading…
Reference in a new issue