Exemplo n.º 1
0
 private void setItemImgLoad(UIListGridItemPanelBase item)
 {
     if (item.gameObject.activeSelf == true)
     {
         item.setPhotoLoad();
     }
 }
Exemplo n.º 2
0
    // 필요한 아이템을 리스트에 올려놓는다.. 이제 얘들을 돌려쓸거다...
    private void createItemPanel()
    {
//		if(endLineDummy == null)
//		{
//			endLineDummy = (new GameObject("endline")).AddComponent<UILabel>();
//			endLineDummy.fontSize = 1;
//			endLineDummy.text = ".";
//			endLineDummy.color = new Color(0,0,0,0.1f);
//			endLineDummy.transform.parent = transform;
//		}

//		if(direction == Direction.vertical)
//		{
//			endLineDummy.transform.localPosition = new Vector3(0, -(dataList.Count)*cellHeight, 0);
//		}
//		else
//		{
//			endLineDummy.transform.localPosition = new Vector3((dataList.Count)*cellWidth, 0, 0);
//		}


        for (int i = 0; i < totalItemNumber; ++i)
        {
            UIListGridItemPanelBase item = getItem();

            _v.x = 0; _v.y = 0; _v.z = 0;

            // 마지막 얘는 리스트 끝으로. 그래야 ngui panel 스크롤 영역이 정해진다.
            if (i == totalItemNumber - 1)
            {
                if (direction == Direction.vertical)
                {
                    _v.y = -(dataCount - 1) * cellHeight;
                }
                else
                {
                    _v.x = (dataCount - 1) * cellWidth;
                }
            }
            // 나머지는 그냥 순서대로...
            else
            {
                if (direction == Direction.vertical)
                {
                    _v.y = -i * cellHeight;
                }
                else
                {
                    _v.x = i * cellWidth;
                }
            }


            item.cachedTransform.localPosition = _v;
            itemList.Add(item);

            setItemData(item);
        }
    }
Exemplo n.º 3
0
    private void setItemData(UIListGridItemPanelBase item)
    {
        if (direction == Direction.vertical)
        {
            positionIndex = -(int)(item.cachedTransform.localPosition.y / cellHeight);
        }
        else
        {
            positionIndex = (int)(item.cachedTransform.localPosition.x / cellWidth);
        }

        if (item.gameObject.activeInHierarchy == true)
        {
#if UNITY_EDITOR
            item.name = positionIndex + "";
#endif
            if (dataCount > positionIndex && positionIndex >= 0 && item.index != positionIndex)
            {
                item.setIndex(positionIndex);
                item.setData(dataList[positionIndex]);
                setItemImgLoad(item);

#if UNITY_EDITOR
//				Debug.LogError("positionIndex : "  + positionIndex);
#endif

                if (callbackAfterDrawFinalItem != null && positionIndex >= dataCount - 1)
                {
                    if (_firstResetDraw == false)
                    {
                        callbackAfterDrawFinalItem(positionIndex);
                    }
                    else
                    {
                        _firstResetDraw = false;
                    }
                }
            }
        }
    }