Beispiel #1
0
    public void Setting()
    {
        itemList      = JsonMng.Ins.playerSkillDataTable.ToList();
        itemSize      = itemExam.GetComponent <RectTransform>().rect;
        scrolViewSize = scrollView.GetComponent <RectTransform>().rect;
        //스크롤뷰의 크기를 기준으로 화면에 보여줄 content의 갯수를 지정
        horCount  = (int)Mathf.Floor(scrolViewSize.width / (itemSize.width + leftPadding));
        verCount  = (int)Mathf.Floor(scrolViewSize.height / (itemSize.height + upPadding));
        showCount = horCount * verCount;
        //스크롤뷰 전체 크기 설정
        GetComponent <RectTransform>().sizeDelta = new Vector2(0, (itemSize.height + upPadding) * Mathf.CeilToInt(((float)itemList.Count / (float)horCount)));
        float c = 0;

        if (horCount != 0)
        {
            c = leftPadding + itemSize.width;
        }
        changePos = new Vector3(c, itemSize.height + upPadding, 0);
        GetComponent <RectTransform>().localPosition = new Vector3(0, 0, 0);

        //화면의 크기가 전체 아이템의 크기보다 크면 기본 스크롤 사용
        if (showCount >= itemList.Count)
        {
            SetBasicScroll(itemList.Count);
        }
        else
        {
            SetInfinityScroll(itemList.Count);
        }
        itemExam.gameObject.SetActive(false);
        SetItemList();
    }