public static IgniteWindow SetRightBottomPos(this IgniteWindow window)
        {
            window.StartCoroutine(IgniteGUIUtility.DelayedAction(() =>
            {
                window.RectTransform.SetAnchoredPosition(Screen.safeArea.size.x - window.RectTransform.sizeDelta.x, window.RectTransform.sizeDelta.y - Screen.safeArea.size.y);
            }));

            return(window);
        }
        public static IgniteWindow SetLeftTopPos(this IgniteWindow window)
        {
            window.StartCoroutine(IgniteGUIUtility.DelayedAction(() =>
            {
                window.RectTransform.SetAnchoredPosition(0f, 0f);
            }));

            return(window);
        }
        public static IgniteWindow SetWindowRight(this IgniteWindow rightWindow, IgniteWindow baseWindow)
        {
            rightWindow.StartCoroutine(IgniteGUIUtility.DelayedAction(() =>
            {
                rightWindow.RectTransform.SetAnchoredLeftPosition(baseWindow.RectTransform.AnchoredRight());
                rightWindow.RectTransform.SetAnchoredTopPosition(baseWindow.RectTransform.AnchoredTop());
            }));

            return(rightWindow);
        }
        public static IgniteWindow SetWindowTop(this IgniteWindow topWindow, IgniteWindow baseWindow)
        {
            topWindow.StartCoroutine(IgniteGUIUtility.DelayedAction(() =>
            {
                topWindow.RectTransform.SetAnchoredBottomPosition(baseWindow.RectTransform.AnchoredTop());
                topWindow.RectTransform.SetAnchoredLeftPosition(baseWindow.RectTransform.AnchoredLeft());
            }));

            return(topWindow);
        }
        public static IgniteWindow SetCenterPos(this IgniteWindow window)
        {
            window.StartCoroutine(IgniteGUIUtility.DelayedAction(() =>
            {
                var pos = new Vector2(Screen.safeArea.size.x * 0.5f, -Screen.safeArea.size.y * 0.5f);
                pos    -= new Vector2(window.RectTransform.sizeDelta.x * 0.5f, window.RectTransform.sizeDelta.x * -0.5f);
                window.RectTransform.anchoredPosition = pos;
            }));

            return(window);
        }
Пример #6
0
        public IgniteWindow Fit()
        {
            ContentFit();

            var headerHeight = header.gameObject.activeSelf ? IgniteGUISettings.ElementHeight : 0f;
            var height       = Mathf.Min(Content.sizeDelta.y + headerHeight, Screen.height);

            RectTransform.SetSizeDelta(y: height);
            scrollRect.SetSizeDelta(y: height);

            var layouts = Content.GetComponentsInChildren <LayoutGroup>();

            foreach (var i in layouts)
            {
                var layoutGroupRectTransform = i.GetComponent <RectTransform>();

                i.StartCoroutine(IgniteGUIUtility.DelayedAction(() =>
                {
                    LayoutRebuilder.MarkLayoutForRebuild(layoutGroupRectTransform);
                }));
            }

            return(this);
        }