Transform AddNewBubbleSlot(AnimationPlayer.BubbleType type)
    {
        GameObject go;

        if (type == AnimationPlayer.BubbleType.BitmapFont)
        {
            go = NGUITools.AddChild(gameObject, _bubblePrefab);
        }
        else
        {
            go = NGUITools.AddChild(gameObject, _dynamicFontPrefab);
        }

        return(go.transform);
    }
    // Find the first unused bubble slot.
    public Transform FindFirstUnusedSlot(AnimationPlayer.BubbleType type)
    {
        foreach (Transform t in transform)
        {
            if (!t.gameObject.activeSelf)
            {
                AnimationPlayer player = t.gameObject.GetComponent <AnimationPlayer>();

                if (player.BubblePrefabType == type)
                {
                    return(t);
                }
            }
        }

        // Initialise a new slot.
        return(AddNewBubbleSlot(type));
    }