瀏覽代碼

[libgdx] Convenience method to add all attachment from one skin to another.

NathanSweet 8 年之前
父節點
當前提交
a0b7bb6c44
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skin.java

+ 6 - 0
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skin.java

@@ -64,6 +64,12 @@ public class Skin {
 		attachments.put(key, attachment);
 	}
 
+	/** Adds all attachments from the specified skin to this skin. */
+	public void addAttachments (Skin skin) {
+		for (Entry<Key, Attachment> entry : skin.attachments.entries())
+			addAttachment(entry.key.slotIndex, entry.key.name, entry.value);
+	}
+
 	/** Returns the attachment for the specified slot index and name, or null. */
 	public Attachment getAttachment (int slotIndex, String name) {
 		if (slotIndex < 0) throw new IllegalArgumentException("slotIndex must be >= 0.");