//public void ValueChange () { // for (int i = 0; i < _StageController._Stage.Length; i++) { // _StageController._Stage [i].DefultSetting (); // } //} private void MoveRight() { if (pageNum < pageCount - 1) { scrollRect.DOKill(); pageNum++; contentPos.x += 0.3333f; scrollRect.DOHorizontalNormalizedPos(contentPos.x, 0.45f).SetEase(Ease.OutCubic); NaviCheck(); } }
void NextBoard() { switch (currentBoard) { case -1: currentBoard = 0; scrollMain.DOHorizontalNormalizedPos(0.5f, 0.5f).SetEase(Ease.OutBack); break; case 0: currentBoard = 1; scrollMain.DOHorizontalNormalizedPos(1f, 0.5f).SetEase(Ease.OutBack); break; } SetBoardTitle(); }
/// <summary> /// 滚动到指定位置 0~1 /// </summary> /// <param name="position">Position.</param> /// <param name="duration">Duration.</param> /// <param name="ease">Ease.</param> public void ScrollToPosition(float position, float duration = 0.4f, Ease ease = Ease.OutCubic) { OnInitializePotentialDrag(); position = Mathf.Max(0, Mathf.Min(position, 1)); if (duration > 0) { if (m_isVertical) { m_scrollTweener = m_scrollRect.DOVerticalNormalizedPos(position, duration).SetEase(ease); } else { m_scrollTweener = m_scrollRect.DOHorizontalNormalizedPos(position, duration).SetEase(ease); } } else { if (m_isVertical) { m_scrollRect.verticalNormalizedPosition = position; } else { m_scrollRect.horizontalNormalizedPosition = position; } } }
public void Initialise() { if (!scene) { scene = FindObjectOfType <AnturaSpaceScene>(); } const float duration = 0.3f; showShopPanelTween = DOTween.Sequence().SetAutoKill(false).Pause() .Append(purchasePanelBottom.DOAnchorPosY(-150, duration).From().SetEase(Ease.OutQuad)); // .Join(purchasePanelSide.DOAnchorPosX(1250, duration).From().SetEase(Ease.OutBack)); showDragPanelTween = DOTween.Sequence().SetAutoKill(false).Pause() .Append(dragPanel.DOAnchorPosY(-350, duration).From().SetEase(Ease.OutQuad)); showConfirmationPanelTween = confirmationPanel.DOAnchorPosY(-350, duration).From().SetEase(Ease.Linear).SetAutoKill(false).Pause(); showPurchasePanelAlwaysAvailableTween = purchasePanelAlwaysAvailableUI.DOAnchorPosX(200, duration) .From() .SetEase(Ease.OutBack) .SetAutoKill(false); scrollRect.horizontalNormalizedPosition = 0; scrollShowTween = scrollRect.DOHorizontalNormalizedPos(1, 0.6f).SetAutoKill(false).Pause().SetDelay(0.15f); scrollShowTween.ForceInit(); ShopDecorationsManager.I.OnContextChange += HandleContextChange; ShopDecorationsManager.I.OnPurchaseConfirmationRequested += HandlePurchaseConfirmationRequested; ShopDecorationsManager.I.OnDeleteConfirmationRequested += HandleDeleteConfirmationRequested; ShopPhotoManager.I.OnPhotoConfirmationRequested += HandlePhotoConfirmationRequested; }
public void pageTo(int index) { if (index >= 0 && index < posList.Count) { rect.DOHorizontalNormalizedPos(posList[index], 0.5f); SetPageIndex(index); } else { _autoIndex = -1; Debug.LogWarning("页码不存在"); } }
public void JumpTo(int cellIndex, float tweenTime = 0f, OnCenterCallback onStart = null, OnCenterCallback onEnd = null) { if (cellIndex < 0 || cellIndex >= CellNum) { return; } _curCellIndex = cellIndex; float endScrollPos = GetCellScrollPos(cellIndex); _scrollRect.DOKill(); if (tweenTime < 0.001f) { //Instant tween this.ScrollPosition = endScrollPos; if (onStart != null) { onStart(cellIndex); } if (onEnd != null) { onEnd(cellIndex); } } else { //use DOTween move scrollRect if (onStart != null) { onStart(cellIndex); } TweenCallback onTweenFinish = () => { if (onEnd != null) { onEnd(cellIndex); } }; if (_scrollRect.horizontal) { _scrollRect.DOHorizontalNormalizedPos(endScrollPos, tweenTime).OnComplete(onTweenFinish).SetEase(easeType); } else { _scrollRect.DOVerticalNormalizedPos(endScrollPos, tweenTime).OnComplete(onTweenFinish).SetEase(easeType); } } }
public void moveKatMenu(int dir) { moveByKat += (dir * katPos); if (moveByKat > 1f) { moveByKat = 1; } if (moveByKat < 0f) { moveByKat = 0; } katScroll.DOHorizontalNormalizedPos(moveByKat, 0.5f).OnUpdate(() => OnScrollChanged(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(ScrollRect scroll) { switch (command) { case ScrollRectCommand.NormalizedPos: return(scroll.DONormalizedPos(pos, duration, snapping)); case ScrollRectCommand.HorizontalNormalizedPos: return(scroll.DOHorizontalNormalizedPos(to, duration, snapping)); case ScrollRectCommand.VerticalPos: return(scroll.DOVerticalNormalizedPos(to, duration, snapping)); default: return(null); } }
public void moveGodMenu(int dir) { //godPos += dir; moveByGod += (dir * godPos); if (moveByGod > 1f) { moveByGod = 1; } if (moveByGod < 0f) { moveByGod = 0; } godineScroll.DOHorizontalNormalizedPos(moveByGod, 0.5f).OnUpdate(() => OnScrollChanged(1)); }
/// <summary> /// 切换分组 0-不切换 1上一组 2 下一组 /// </summary> void SwitchTeam(int id) { switch (id) { case 1: _currTeam--; ChangeAction?.Invoke(_currTeam); break; case 2: _currTeam++; ChangeAction?.Invoke(_currTeam); break; } currScrolRectValue = (_currTeam - 1) * TeamAreaSize; Scroll.DOHorizontalNormalizedPos(currScrolRectValue, ScrolRectMoveSpeed); }
public override Tween GetTween(UniTween.UniTweenTarget uniTweenTarget) { ScrollRect scroll = (ScrollRect)GetComponent(uniTweenTarget); switch (command) { case ScrollRectCommand.NormalizedPos: return(scroll.DONormalizedPos(pos, duration, snapping)); case ScrollRectCommand.HorizontalNormalizedPos: return(scroll.DOHorizontalNormalizedPos(to, duration, snapping)); case ScrollRectCommand.VerticalPos: return(scroll.DOVerticalNormalizedPos(to, duration, snapping)); default: return(null); } }
void SR_ToStart() { scrollRect.DOHorizontalNormalizedPos(0, animInterval); }
public void ScrollMove(float amountMove) { scrollRect.DOHorizontalNormalizedPos(scrollRect.horizontalNormalizedPosition + amountMove, 0.5f); }