Пример #1
0
        private void InitDualButtons()
        {
            GameObject buttonPref   = Resources.Load(cDualPrefab) as GameObject;
            int        buttonHeight = (int)buttonPref.GetComponent <LayoutElement>().minHeight;
            int        spacing      = (int)DragArea.transform.FindChild("ScrollArea").GetComponent <VerticalLayoutGroup>().spacing;

            buttonHeight += spacing;
            for (int i = 0; i < mCurrentSpells.Count; ++i)
            {
                GameObject button = GameObject.Instantiate(buttonPref) as GameObject;
                button.transform.SetParent(DragArea.transform.FindChild("ScrollArea"));
                ViewUtility.ChangeDualButtonText(button, mCurrentSpells[i].ToShortString());
                button.transform.FindChild("ButtonLeft").GetComponent <IntButtonHandler>().NotificationInt      = i;
                button.transform.FindChild("ButtonLeft").GetComponent <IntButtonHandler>().NotificationCatcher  = this;
                button.transform.FindChild("ButtonRight").GetComponent <IntButtonHandler>().NotificationInt     = i;
                button.transform.FindChild("ButtonRight").GetComponent <IntButtonHandler>().NotificationCatcher = this;
                mTotalHeight += buttonHeight;
                mButtonList.Add(button);
            }
            if (mViewHeight < mTotalHeight)
            {
                mTotalHeight -= spacing;
            }
            UpdateNow = true;
        }