UnityEditor.AvatarControl.DrawBone C# (CSharp) Method

DrawBone() protected static method

protected static DrawBone ( int shownBodyView, int i, Rect rect, AvatarSetupTool bone, SerializedObject serializedObject, UnityEditor.AvatarMappingEditor editor ) : void
shownBodyView int
i int
rect UnityEngine.Rect
bone AvatarSetupTool
serializedObject SerializedObject
editor UnityEditor.AvatarMappingEditor
return void
        protected static void DrawBone(int shownBodyView, int i, Rect rect, AvatarSetupTool.BoneWrapper bone, SerializedObject serializedObject, AvatarMappingEditor editor)
        {
            if (s_BonePositions[shownBodyView, i] != Vector2.zero)
            {
                Vector2 vector = s_BonePositions[shownBodyView, i];
                vector.y *= -1f;
                vector.Scale(new Vector2(rect.width * 0.5f, rect.height * 0.5f));
                vector = rect.center + vector;
                int num = 0x13;
                Rect rect2 = new Rect(vector.x - (num * 0.5f), vector.y - (num * 0.5f), (float) num, (float) num);
                bone.BoneDotGUI(rect2, i, true, true, serializedObject, editor);
            }
        }

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);
        }