setOnUpdateVector2() public méthode

public setOnUpdateVector2 ( Action onUpdate ) : LTDescr
onUpdate Action
Résultat LTDescr
        public void StartAction()
        {
            rectTransform.anchoredPosition = initialAnchoredPosition;
            LTDescr ltDescr = LeanTween.value(gameObject, initialAnchoredPosition, Vector2.zero, time);

            ltDescr.tweenType = LeanTweenType.easeInOutSine;
            ltDescr.setDelay(delay);
            ltDescr.setOnUpdateVector2(OnUpdateAnchoredPosition);
        }
Exemple #2
0
        private void MoveTo(ChapterData chapterData, bool withTweenAnimation = false)
        {
            selectChapterScrollRect.StopMovement();
            _currentSelectChapterData = chapterData;

            CanvasScaler parentCanvasScaler = GetComponentInParent <CanvasScaler>();
            float        diffx   = 0;
            Vector2      destPos = Vector2.zero;

            if (parentCanvasScaler.matchWidthOrHeight <= 0)
            {
                diffx   = (960f - ChapterView.CHAPTER_BG_WIDTH) * 0.5f;
                destPos = -_currentSelectChapterData.chapterPosition + new Vector2(diffx, 0);
            }
            else if (parentCanvasScaler.matchWidthOrHeight >= 1)
            {
                diffx   = (((float)Screen.width / Screen.height) * 640 - ChapterView.CHAPTER_BG_WIDTH) * 0.5f;
                destPos = -_currentSelectChapterData.chapterPosition + new Vector2(diffx, 0);
            }

            if (withTweenAnimation)
            {
                LTDescr ltDescr = LeanTween.value(gameObject, selectChapterScrollRect.content.anchoredPosition, destPos, 0.25f);
                ltDescr.setOnUpdateVector2(OnUpdateMapPosition);
            }
            else
            {
                selectChapterScrollRect.content.anchoredPosition = destPos;
            }

            ChapterView chapterView = _chapterViewsDictionary.GetValue(chapterData.Id);

            chapterView.Show();
            _commonTopBarView.titleText.text = string.Format(Localization.Get("ui.select_chapter_view.title_template"), UIUtil.GetChineseNumberString(chapterData.Id), Localization.Get(chapterData.name));
            RefreshStarChests();
            RefreshPreviousAndNextChapterButtons();
        }