コード例 #1
0
        public static T[] GenerateUIFixedSize <T>(T prefab, Transform parent, int amount, UILayout layout, float sizePerElement) where T : Component
        {
            var GOS     = new T[amount].InitEXT(() => GameObject.Instantiate(prefab, parent));
            var rectTFs = GOS.Map((x) => x.GetComponent <RectTransform>());

            if (layout == UILayout.Vertical)
            {
                UIPositioner.PositionPixelwiseVertically(parent, rectTFs, sizePerElement);
            }
            else if (layout == UILayout.Horizontal)
            {
                UIPositioner.PositionHorizontally(parent, rectTFs);
            }
            return(GOS);
        }
コード例 #2
0
        public static GameObject[] GenerateUI(GameObject prefab, Transform parent, int amount, UILayout layout)
        {
            var GOS     = new GameObject[amount].InitEXT(() => GameObject.Instantiate(prefab, parent));
            var rectTFs = GOS.Map((x) => x.GetComponent <RectTransform>());

            if (layout == UILayout.Vertical)
            {
                UIPositioner.PositionVertically(parent, rectTFs);
            }
            else if (layout == UILayout.Horizontal)
            {
                UIPositioner.PositionHorizontally(parent, rectTFs);
            }
            return(GOS);
        }