public static void Show(SerializedProperty bodyMask, int count) { if (!(bool)((Object)BodyMaskEditor.styles.UnityDude.image)) { return; } Rect rect = GUILayoutUtility.GetRect(BodyMaskEditor.styles.UnityDude, GUIStyle.none, new GUILayoutOption[1] { GUILayout.MaxWidth((float)BodyMaskEditor.styles.UnityDude.image.width) }); rect.x += (float)(((double)GUIView.current.position.width - (double)rect.width) / 2.0); Color color = GUI.color; GUI.color = bodyMask.GetArrayElementAtIndex(0).intValue != 1 ? Color.red : Color.green; if ((bool)((Object)BodyMaskEditor.styles.BodyPart[0].image)) { GUI.DrawTexture(rect, BodyMaskEditor.styles.BodyPart[0].image); } GUI.color = new Color(0.2f, 0.2f, 0.2f, 1f); GUI.DrawTexture(rect, BodyMaskEditor.styles.UnityDude.image); for (int index = 1; index < count; ++index) { GUI.color = bodyMask.GetArrayElementAtIndex(index).intValue != 1 ? Color.red : Color.green; if ((bool)((Object)BodyMaskEditor.styles.BodyPart[index].image)) { GUI.DrawTexture(rect, BodyMaskEditor.styles.BodyPart[index].image); } } GUI.color = color; BodyMaskEditor.DoPicking(rect, bodyMask, count); }
public static void Show(SerializedProperty bodyMask, int count) { if (BodyMaskEditor.styles.UnityDude.image) { Rect rect = GUILayoutUtility.GetRect(BodyMaskEditor.styles.UnityDude, GUIStyle.none, new GUILayoutOption[] { GUILayout.MaxWidth((float)BodyMaskEditor.styles.UnityDude.image.width) }); rect.x += (GUIView.current.position.width - rect.width) / 2f; Color color = GUI.color; GUI.color = ((bodyMask.GetArrayElementAtIndex(0).intValue != 1) ? Color.red : Color.green); if (BodyMaskEditor.styles.BodyPart[0].image) { GUI.DrawTexture(rect, BodyMaskEditor.styles.BodyPart[0].image); } GUI.color = new Color(0.2f, 0.2f, 0.2f, 1f); GUI.DrawTexture(rect, BodyMaskEditor.styles.UnityDude.image); for (int i = 1; i < count; i++) { GUI.color = ((bodyMask.GetArrayElementAtIndex(i).intValue != 1) ? Color.red : Color.green); if (BodyMaskEditor.styles.BodyPart[i].image) { GUI.DrawTexture(rect, BodyMaskEditor.styles.BodyPart[i].image); } } GUI.color = color; BodyMaskEditor.DoPicking(rect, 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); } } } }
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) { BodyMaskEditor.Show(this.m_BodyMask, 13); } } }
public void OnBodyInspectorGUI() { if (m_ShowBodyMask) { // Don't make toggling foldout cause GUI.changed to be true (shouldn't cause undoable action etc.) bool wasChanged = GUI.changed; m_BodyMaskFoldout = EditorGUILayout.Foldout(m_BodyMaskFoldout, Styles.BodyMask, true); GUI.changed = wasChanged; if (m_BodyMaskFoldout) { BodyMaskEditor.Show(m_BodyMask, (int)AvatarMaskBodyPart.LastBodyPart); } } }
public static bool[] Show(bool[] bodyPartToggle, int count) { if (BodyMaskEditor.styles.UnityDude.image) { Rect rect = GUILayoutUtility.GetRect(BodyMaskEditor.styles.UnityDude, GUIStyle.none, new GUILayoutOption[] { GUILayout.MaxWidth((float)BodyMaskEditor.styles.UnityDude.image.width) }); rect.x += ((float)Screen.width - rect.width) / 2f; Color color = GUI.color; if (bodyPartToggle[0]) { GUI.color = Color.green; } else { GUI.color = Color.red; } if (BodyMaskEditor.styles.BodyPart[0].image) { GUI.DrawTexture(rect, BodyMaskEditor.styles.BodyPart[0].image); } GUI.color = new Color(0.2f, 0.2f, 0.2f, 1f); GUI.DrawTexture(rect, BodyMaskEditor.styles.UnityDude.image); for (int i = 1; i < count; i++) { if (bodyPartToggle[i]) { GUI.color = Color.green; } else { GUI.color = Color.red; } if (BodyMaskEditor.styles.BodyPart[i].image) { GUI.DrawTexture(rect, BodyMaskEditor.styles.BodyPart[i].image); } } GUI.color = color; BodyMaskEditor.DoPicking(rect, bodyPartToggle, count); } return(bodyPartToggle); }