public static Show ( UnityEditor.SerializedProperty bodyMask, int count ) : void | ||
bodyMask | UnityEditor.SerializedProperty | |
count | int | |
return | void |
public static void Show(SerializedProperty bodyMask, int count)
{
if (styles.UnityDude.image != null)
{
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MaxWidth((float) styles.UnityDude.image.width) };
Rect position = GUILayoutUtility.GetRect(styles.UnityDude, GUIStyle.none, options);
position.x += (GUIView.current.position.width - position.width) / 2f;
Color color = GUI.color;
GUI.color = (bodyMask.GetArrayElementAtIndex(0).intValue != 1) ? Color.red : Color.green;
if (styles.BodyPart[0].image != null)
{
GUI.DrawTexture(position, styles.BodyPart[0].image);
}
GUI.color = new Color(0.2f, 0.2f, 0.2f, 1f);
GUI.DrawTexture(position, styles.UnityDude.image);
for (int i = 1; i < count; i++)
{
GUI.color = (bodyMask.GetArrayElementAtIndex(i).intValue != 1) ? Color.red : Color.green;
if (styles.BodyPart[i].image != null)
{
GUI.DrawTexture(position, styles.BodyPart[i].image);
}
}
GUI.color = color;
DoPicking(position, bodyMask, count);
}
}
public void OnBodyInspectorGUI() { if (this.m_ShowBodyMask) { bool changed = GUI.changed; this.m_BodyMaskFoldout = EditorGUILayout.Foldout(this.m_BodyMaskFoldout, AvatarMaskInspector.styles.BodyMask); GUI.changed = changed; if (this.m_BodyMaskFoldout) { AvatarMask avatarMask = this.target as AvatarMask; for (int i = 0; i < avatarMask.humanoidBodyPartCount; i++) { this.m_BodyPartToggle[i] = avatarMask.GetHumanoidBodyPartActive(i); } this.m_BodyPartToggle = BodyMaskEditor.Show(this.m_BodyPartToggle, avatarMask.humanoidBodyPartCount); bool flag = false; for (int j = 0; j < avatarMask.humanoidBodyPartCount; j++) { flag |= (avatarMask.GetHumanoidBodyPartActive(j) != this.m_BodyPartToggle[j]); } if (flag) { Undo.RegisterCompleteObjectUndo(avatarMask, "Body Mask Edit"); for (int k = 0; k < avatarMask.humanoidBodyPartCount; k++) { avatarMask.SetHumanoidBodyPartActive(k, this.m_BodyPartToggle[k]); } EditorUtility.SetDirty(avatarMask); } } } }