private void AnimateExpand() { _expandButton.DOLocalRotate(new Vector3(0f, 0f, ExpandedButtonRotation), ExpandAimDuration); _layoutElement.DOPreferredSize( new Vector2(0f, CollapsedItemHeight + _infoTextRect.rect.height + BottomTextPadding), ExpandAimDuration); }
public YieldInstruction Show() { Assert.IsNotNull(canvasGroup); Assert.IsNotNull(layoutElement); layoutElement.DOKill(); var size = layoutElement .DOPreferredSize(new Vector2(preferredWidth, layoutElement.preferredHeight), showDuration) .SetEase(Ease.InOutSine); canvasGroup.DOKill(); var fade = canvasGroup .DOFade(1.0f, showDuration) .SetEase(Ease.InOutSine); return(DOTween.Sequence() .Append(size) .AppendCallback(() => SetCanvasGroupEnabled(true)) .Append(fade) .WaitForCompletion()); }
public override void Select(bool selected) { if (selected != _selected) { _selected = selected; if (_expandTweener != null) { _expandTweener.Kill(); _expandTweener = null; } if (Layout) { if (selected) { _expandTweener = Layout .DOPreferredSize(ExpandSize, ExpandTime) .OnComplete(() => { if (FunctionGroup && !FunctionGroup.gameObject.activeSelf) { FunctionGroup.gameObject.SetActive(true); } }); } else { if (FunctionGroup && FunctionGroup.gameObject.activeSelf) { FunctionGroup.gameObject.SetActive(false); } _expandTweener = Layout .DOPreferredSize(NormalSize, ExpandTime); } } } }
/// <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); } }
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); } }
public override void Select(bool selected) { // 非选中的时候,什么都不做。 if (!selected) { return; } if (_expandTweener != null) { _expandTweener.Kill(); _expandTweener = null; } if (_indicatorTweener != null) { _indicatorTweener.Kill(); _indicatorTweener = null; } if (_expand) { _expand = false; SetExchangeState(_data, false); if (Layout) { _expandTweener = Layout .DOPreferredSize(new Vector2(Layout.preferredWidth, FoldHeight), ExpandTime); } if (ExtendIndicator) { if (!ExtendIndicator.gameObject.activeSelf) { ExtendIndicator.gameObject.SetActive(true); } _indicatorTweener = ExtendIndicator.rectTransform.DORotate(new Vector3(0, 0, 0), ExpandTime); } } else { _expand = true; SetExchangeState(_data, true); if (Layout) { _expandTweener = Layout.DOPreferredSize(new Vector2(Layout.preferredWidth, ExpandHeight), ExpandTime); } if (ExtendIndicator) { if (!ExtendIndicator.gameObject.activeSelf) { ExtendIndicator.gameObject.SetActive(true); } _indicatorTweener = ExtendIndicator.rectTransform.DORotate(new Vector3(0, 0, -90), ExpandTime); } } }