Example #1
0
        private void InitCorner(string actionText, CornerPoint cornerPoint, ActionType actionType, Action finishedCallback)
        {
            // corner point adjustments
            var rectTransform = this.transform as RectTransform;

            rectTransform.anchorMin        = cornerPoint.ToVector2();
            rectTransform.anchorMax        = cornerPoint.ToVector2();
            rectTransform.pivot            = cornerPoint.ToVector2();
            rectTransform.anchoredPosition = Vector2.zero;

            bool isLeft = cornerPoint.IsLeft();

            backdropImage_.transform.localScale = backdropImage_.transform.localScale.SetX(isLeft ? 1.0f : -1.0f);
            fillImage_.transform.localScale     = fillImage_.transform.localScale.SetX(isLeft ? 1.0f : -1.0f);

            if (screenDirectionTransition_ != null)
            {
                screenDirectionTransition_.SetInDirection(isLeft ? Direction.LEFT : Direction.RIGHT);
                screenDirectionTransition_.SetOutDirection(isLeft ? Direction.LEFT : Direction.RIGHT);
            }

            bool isBottom = cornerPoint.IsBottom();

            backdropImage_.transform.localScale = backdropImage_.transform.localScale.SetY(isBottom ? 1.0f : -1.0f);
            fillImage_.transform.localScale     = fillImage_.transform.localScale.SetY(isBottom ? 1.0f : -1.0f);

            mainLayoutGroup_.padding.left  = isLeft ? 0 : 30;
            mainLayoutGroup_.padding.right = isLeft ? 30 : 0;

            Init(actionText, actionType, finishedCallback);
        }