Esempio n. 1
0
        void showGameObject(int i, int level)
        {
            GUILayout.BeginHorizontal(GUILayout.Height(height_gameobject));
            if (gameObjsSelected[i] == null)
            {
                GUI.enabled = false;
                GUILayout.Toggle(true, "", GUILayout.Width(width_toggle));
            }
            else
            {
                gameObjsSelected[i] = GUILayout.Toggle((bool)gameObjsSelected[i], "", GUILayout.Width(width_toggle));
            }
            // indent
            GUILayout.Space(width_indent * level);

            if (gameObjsFoldout[i] != null)
            {
                GUI.enabled = true;
                // foldout
                GUILayout.BeginVertical();
                GUILayout.Space(height_label_offset - 1f);
                if (GUILayout.Button("", "label", GUILayout.Width(15f)))
                {
                    gameObjsFoldout[i] = !gameObjsFoldout[i];
                }
                GUI.DrawTexture(GUILayoutUtility.GetLastRect(), ((bool)gameObjsFoldout[i] ? GUI.skin.GetStyle("GroupElementFoldout").normal.background : GUI.skin.GetStyle("GroupElementFoldout").active.background));
                GUILayout.EndVertical();
                // toggle children
                //if(gameObjsSelected[i] != null) {
                if (gameObjsSelected[i] == null)
                {
                    GUI.enabled = false;
                }
                GUILayout.BeginVertical();
                GUILayout.Space(height_label_offset + 1f);
                if (GUILayout.Button("", GUILayout.Width(13f), GUILayout.Height(15f)))
                {
                    if (gameObjsSelected[i] != null)
                    {
                        gameObjsSelected[i] = !gameObjsSelected[i];
                        setAllChildrenSelection((bool)gameObjsSelected[i], i, gameObjsDepth[i]);
                    }
                }
                Rect rectSelectAllTexture = GUILayoutUtility.GetLastRect();
                GUILayout.EndVertical();

                rectSelectAllTexture.x     += 3f;
                rectSelectAllTexture.y     += 4f;
                rectSelectAllTexture.width  = 7f;
                rectSelectAllTexture.height = 8f;
                if (!GUI.enabled)
                {
                    GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, 0.25f);
                }
                GUI.DrawTexture(rectSelectAllTexture, TimelineWindow.getSkinTextureStyleState("select_all").background);
                GUI.color = Color.white;
                //}
            }
            else
            {
                GUILayout.Space(15f);
            }

            GUILayout.BeginVertical();
            GUILayout.Space(height_label_offset);
            if (gameObjsFoldout[i] != null)
            {
                GUILayout.Label(gameObjs[i].name);
            }
            else
            {
                GUILayout.Label(new GUIContent(gameObjs[i].name, EditorGUIUtility.ObjectContent(null, typeof(GameObject)).image), GUILayout.Height(19f));
            }
            GUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            if (!GUI.enabled)
            {
                GUI.enabled = true;
            }
            GUILayout.EndHorizontal();
        }