예제 #1
0
    //옵션 정렬 방식이다
    private void AddButtons()
    {
        //등급이 높은 것을 정렬
        LIST_OPTION.Sort(delegate(CGameMainWeaponOption A, CGameMainWeaponOption B)
        {
            if (A.nIndex < B.nIndex)
            {
                return(1);
            }
            else if (A.nIndex > B.nIndex)
            {
                return(-1);
            }
            else
            {
                return(0);
            }
        });

        for (int i = 0; i < LIST_OPTION.Count; i++)
        {
            CGameMainWeaponOption item = LIST_OPTION [i];

            GameObject newButton = optionPanelPool.GetObject();
            newButton.transform.SetParent(contentPanel, false);
            newButton.transform.localScale = Vector3.one;

            OptionItem sampleButton = newButton.GetComponent <OptionItem> ();
            sampleButton.SetInit();
            sampleButton.Setup(item, this);
        }
    }