Пример #1
0
 private void GetTopAndBottomButtons()//sets rows on top and bottom
 {
     _bottomIndex   = _buttonTable.ElementAt(0).Key;
     _bottomButtons = _buttonTable[_bottomIndex][0];
     _topIndex      = _buttonTable.ElementAt(_buttonTable.Count - 1).Key;
     _topButtons    = _buttonTable[_topIndex][0];
 }
Пример #2
0
        private PooledButton PlaceButton(int i, int j, BuildingMenuPool pool)//returns a button
        {
            PooledButton pooledButton = pool.Get();

            pooledButton.gameObject.SetActive(true);
            RectTransform rectTransform;

            (rectTransform = pooledButton.GetComponent <RectTransform>()).SetParent(_contentHolderRect);
            rectTransform.sizeDelta        = new Vector2(_buttonSize, _buttonSize);
            rectTransform.localScale       = Vector3.one;
            rectTransform.anchoredPosition =
                new Vector2(
                    j * (_buttonSize + _spacing) + _spacing / 2 + _buttonSize / 2,
                    i * (_buttonSize + _spacing)
                    );

            pooledButton.MyPool = pool;
            return(pooledButton);
        }