Пример #1
0
 private void OnEnable()
 {
     WindowRatioMonitor.Instance.ScreenSizeChangedAction.AddListener(new UnityAction <Rect>((rect) =>
     {
         bool isLandscape = (rect.width > rect.height);
         LeftLayoutElement.DOFlexibleSize(new Vector2(isLandscape ? 7 : 0, LeftLayoutElement.flexibleHeight),
                                          0.5f, true);
         Scaler.matchWidthOrHeight = isLandscape ? 1.0f : 0.5f;
     }));
 }
Пример #2
0
        /// <summary>
        /// Creates and returns a Tween for the informed component.
        /// The Tween is configured based on the attribute values of this TweenData file.
        /// </summary>
        /// <param name="transform"></param>
        /// <returns></returns>
        public Tween GetTween(LayoutElement element)
        {
            switch (command)
            {
            case LayoutElementCommand.FlexibleSize:
                return(element.DOFlexibleSize(to, duration, snapping));

            case LayoutElementCommand.MinSize:
                return(element.DOMinSize(to, duration, snapping));

            case LayoutElementCommand.PreferredSize:
                return(element.DOPreferredSize(to, duration, snapping));

            default:
                return(null);
            }
        }
Пример #3
0
    public override Tween GetTween(UniTween.UniTweenTarget uniTweenTarget)
    {
        LayoutElement element = (LayoutElement)GetComponent(uniTweenTarget);

        switch (command)
        {
        case LayoutElementCommand.FlexibleSize:
            return(element.DOFlexibleSize(to, duration, snapping));

        case LayoutElementCommand.MinSize:
            return(element.DOMinSize(to, duration, snapping));

        case LayoutElementCommand.PreferredSize:
            return(element.DOPreferredSize(to, duration, snapping));

        default:
            return(null);
        }
    }