attachAll method
Implementation
void attachAll(Skeleton skeleton, Skin? oldSkin) {
int slotIndex = 0;
for (int i = 0; i < skeleton.slots.length; i++) {
final Slot slot = skeleton.slots[i];
final Attachment? slotAttachment = slot.getAttachment();
if (slotAttachment != null && slotIndex < oldSkin!.attachments.length) {
final Map<String, Attachment> map =
oldSkin.attachments[slotIndex] ?? <String, Attachment>{};
for (String key in map.keys) {
final Attachment? skinAttachment = map[key];
if (slotAttachment == skinAttachment) {
final Attachment? attachment = getAttachment(slotIndex, key);
if (attachment != null) slot.setAttachment(attachment);
break;
}
}
}
slotIndex++;
}
}