UnityEditor.AvatarControl.DrawBodyParts C# (CSharp) Method

DrawBodyParts() public static method

public static DrawBodyParts ( Rect rect, int shownBodyView, BodyPartFeedback bodyPartCallback ) : void
rect UnityEngine.Rect
shownBodyView int
bodyPartCallback BodyPartFeedback
return void
        public static void DrawBodyParts(Rect rect, int shownBodyView, BodyPartFeedback bodyPartCallback)
        {
            GUI.color = new Color(0.2f, 0.2f, 0.2f, 1f);
            if (styles.Silhouettes[shownBodyView] != null)
            {
                GUI.DrawTexture(rect, styles.Silhouettes[shownBodyView].image);
            }
            for (int i = 1; i < 9; i++)
            {
                DrawBodyPart(shownBodyView, i, rect, bodyPartCallback((BodyPart) i));
            }
        }

Usage Example

示例#1
0
        public static int ShowBoneMapping(int shownBodyView, AvatarControl.BodyPartFeedback bodyPartCallback, AvatarSetupTool.BoneWrapper[] bones, SerializedObject serializedObject, AvatarMappingEditor editor)
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.FlexibleSpace();
            if (AvatarControl.styles.Silhouettes[shownBodyView].image)
            {
                Rect rect = GUILayoutUtility.GetRect(AvatarControl.styles.Silhouettes[shownBodyView], GUIStyle.none, new GUILayoutOption[]
                {
                    GUILayout.MaxWidth((float)AvatarControl.styles.Silhouettes[shownBodyView].image.width)
                });
                AvatarControl.DrawBodyParts(rect, shownBodyView, bodyPartCallback);
                for (int i = 0; i < bones.Length; i++)
                {
                    AvatarControl.DrawBone(shownBodyView, i, rect, bones[i], serializedObject, editor);
                }
            }
            else
            {
                GUILayout.Label("texture missing,\nfix me!", new GUILayoutOption[0]);
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            Rect lastRect = GUILayoutUtility.GetLastRect();

            string[] array = new string[]
            {
                "Body",
                "Head",
                "Left Hand",
                "Right Hand"
            };
            lastRect.x     += 5f;
            lastRect.width  = 70f;
            lastRect.yMin   = lastRect.yMax - 69f;
            lastRect.height = 16f;
            for (int j = 0; j < array.Length; j++)
            {
                if (GUI.Toggle(lastRect, shownBodyView == j, array[j], EditorStyles.miniButton))
                {
                    shownBodyView = j;
                }
                lastRect.y += 16f;
            }
            return(shownBodyView);
        }