public void SetSkin(Skin newSkin) { if (newSkin != null) { if (this.skin != null) { newSkin.AttachAll(this, this.skin); } else { ExposedList <Slot> exposedList = this.slots; int i = 0; int count = exposedList.Count; while (i < count) { Slot slot = exposedList.Items[i]; string attachmentName = slot.data.attachmentName; if (attachmentName != null) { Attachment attachment = newSkin.GetAttachment(i, attachmentName); if (attachment != null) { slot.Attachment = attachment; } } i++; } } } this.skin = newSkin; }
/// <summary>Sets the skin used to look up attachments not found in the {@link SkeletonData#getDefaultSkin() default skin}. Attachments /// from the new skin are attached if the corresponding attachment from the old skin was attached. If there was no old skin, each slot's /// setup mode attachment is attached from the new skin.</summary> /// <param name="newSkin">May be null.</param> public void SetSkin(Skin newSkin) { if (skin == null) { List <Slot> slots = this.slots; for (int i = 0, n = slots.Count; i < n; i++) { Slot slot = slots[i]; String name = slot.data.attachmentName; if (name != null) { Attachment attachment = newSkin.GetAttachment(i, name); if (attachment != null) { slot.Attachment = attachment; } } } } else if (newSkin != null) // { newSkin.AttachAll(this, skin); } skin = newSkin; }
/// <summary> /// <para>Sets the skin used to look up attachments before looking in the <see cref="SkeletonData.DefaultSkin"/>. If the /// skin is changed, <see cref="UpdateCache()"/> is called. /// </para> /// <para>Attachments from the new skin are attached if the corresponding attachment from the old skin was attached. /// If there was no old skin, each slot's setup mode attachment is attached from the new skin. /// </para> /// <para>After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling /// <see cref="Skeleton.SetSlotsToSetupPose()"/>. /// Also, often <see cref="AnimationState.Apply(Skeleton)"/> is called before the next time the /// skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin.</para> /// </summary> /// <param name="newSkin">May be null.</param> public void SetSkin(Skin newSkin) { if (newSkin == skin) { return; } if (newSkin != null) { if (skin != null) { newSkin.AttachAll(this, skin); } else { Slot[] slots = this.slots.Items; for (int i = 0, n = this.slots.Count; i < n; i++) { Slot slot = slots[i]; string name = slot.data.attachmentName; if (name != null) { Attachment attachment = newSkin.GetAttachment(i, name); if (attachment != null) { slot.Attachment = attachment; } } } } } skin = newSkin; UpdateCache(); }
/** Sets the skin used to look up attachments not found in the {@link SkeletonData#getDefaultSkin() default skin}. Attachments * from the new skin are attached if the corresponding attachment from the old skin was attached. * @param newSkin May be null. */ public void SetSkin(Skin newSkin) { if (skin != null && newSkin != null) { newSkin.AttachAll(this, skin); } skin = newSkin; }
/// <summary>Sets the skin used to look up attachments before looking in the {@link SkeletonData#getDefaultSkin() default /// skin}. Attachmentsfrom the new skin are attached if the corresponding attachment from the old skin was attached. If /// there was no old skin, each slot's setup mode attachment is attached from the new skin.</summary> /// <param name="newSkin">May be null.</param> public void SetSkin (Skin newSkin) { if (newSkin != null) { if (skin != null) newSkin.AttachAll(this, skin); else { ExposedList<Slot> slots = this.slots; for (int i = 0, n = slots.Count; i < n; i++) { Slot slot = slots.Items[i]; String name = slot.data.attachmentName; if (name != null) { Attachment attachment = newSkin.GetAttachment(i, name); if (attachment != null) slot.Attachment = attachment; } } } } skin = newSkin; }
/// <summary>Sets the skin used to look up attachments not found in the {@link SkeletonData#getDefaultSkin() default skin}. Attachments /// from the new skin are attached if the corresponding attachment from the old skin was attached.</summary> /// <param name="newSkin">May be null.</param> public void SetSkin(Skin newSkin) { if (skin != null && newSkin != null) newSkin.AttachAll(this, skin); skin = newSkin; }
/** Sets the skin used to look up attachments not found in the {@link SkeletonData#getDefaultSkin() default skin}. Attachments * from the new skin are attached if the corresponding attachment from the old skin was attached. * @param newSkin May be null. */ public void SetSkin (Skin newSkin) { if (Skin != null && newSkin != null) newSkin.AttachAll(this, Skin); Skin = newSkin; }