[csharp] Minor formatting and scope.

This commit is contained in:
pharan 2017-05-24 19:30:50 +08:00
parent a00c45f8e0
commit ba45ab5ef9

View File

@ -258,7 +258,7 @@ namespace Spine {
updateCache.Add(bone); updateCache.Add(bone);
} }
private void SortReset (ExposedList<Bone> bones) { private static void SortReset (ExposedList<Bone> bones) {
var bonesItems = bones.Items; var bonesItems = bones.Items;
for (int i = 0, n = bones.Count; i < n; i++) { for (int i = 0, n = bones.Count; i < n; i++) {
Bone bone = bonesItems[i]; Bone bone = bonesItems[i];
@ -309,21 +309,21 @@ namespace Spine {
var transformConstraintsItems = this.transformConstraints.Items; var transformConstraintsItems = this.transformConstraints.Items;
for (int i = 0, n = transformConstraints.Count; i < n; i++) { for (int i = 0, n = transformConstraints.Count; i < n; i++) {
TransformConstraint constraint = transformConstraintsItems[i]; TransformConstraint constraint = transformConstraintsItems[i];
TransformConstraintData data = constraint.data; TransformConstraintData constraintData = constraint.data;
constraint.rotateMix = data.rotateMix; constraint.rotateMix = constraintData.rotateMix;
constraint.translateMix = data.translateMix; constraint.translateMix = constraintData.translateMix;
constraint.scaleMix = data.scaleMix; constraint.scaleMix = constraintData.scaleMix;
constraint.shearMix = data.shearMix; constraint.shearMix = constraintData.shearMix;
} }
var pathConstraintItems = this.pathConstraints.Items; var pathConstraintItems = this.pathConstraints.Items;
for (int i = 0, n = pathConstraints.Count; i < n; i++) { for (int i = 0, n = pathConstraints.Count; i < n; i++) {
PathConstraint constraint = pathConstraintItems[i]; PathConstraint constraint = pathConstraintItems[i];
PathConstraintData data = constraint.data; PathConstraintData constraintData = constraint.data;
constraint.position = data.position; constraint.position = constraintData.position;
constraint.spacing = data.spacing; constraint.spacing = constraintData.spacing;
constraint.rotateMix = data.rotateMix; constraint.rotateMix = constraintData.rotateMix;
constraint.translateMix = data.translateMix; constraint.translateMix = constraintData.translateMix;
} }
} }
@ -384,9 +384,9 @@ namespace Spine {
/// <summary>Sets a skin by name (see SetSkin).</summary> /// <summary>Sets a skin by name (see SetSkin).</summary>
public void SetSkin (string skinName) { public void SetSkin (string skinName) {
Skin skin = data.FindSkin(skinName); Skin foundSkin = data.FindSkin(skinName);
if (skin == null) throw new ArgumentException("Skin not found: " + skinName, "skinName"); if (foundSkin == null) throw new ArgumentException("Skin not found: " + skinName, "skinName");
SetSkin(skin); SetSkin(foundSkin);
} }
/// <summary>Sets the skin used to look up attachments before looking in the {@link SkeletonData#getDefaultSkin() default /// <summary>Sets the skin used to look up attachments before looking in the {@link SkeletonData#getDefaultSkin() default
@ -424,8 +424,7 @@ namespace Spine {
Attachment attachment = skin.GetAttachment(slotIndex, attachmentName); Attachment attachment = skin.GetAttachment(slotIndex, attachmentName);
if (attachment != null) return attachment; if (attachment != null) return attachment;
} }
if (data.defaultSkin != null) return data.defaultSkin.GetAttachment(slotIndex, attachmentName); return data.defaultSkin != null ? data.defaultSkin.GetAttachment(slotIndex, attachmentName) : null;
return null;
} }
/// <param name="attachmentName">May be null.</param> /// <param name="attachmentName">May be null.</param>