Ejemplo n.º 1
0
        private void ConstructSwipeObjects()
        {
            ActiveRectTransform = CurrentView.GetComponent <RectTransform>();
            swipedTransforms.ForEach(trs => {
                if (trs != ActiveRectTransform)
                {
                    cache.PushObject(trs.gameObject);
                }
            });

            swipedTransforms.Clear();
            swipedTransforms.Add(ActiveRectTransform);

            if (HasLeft(CurrentData))
            {
                GameObject    obj     = cache.PopObject();
                RectTransform leftTrs = obj.GetComponent <RectTransform>();
                SetupView(LeftData(CurrentData), leftTrs.GetComponent <TView>());
                leftTrs.anchoredPosition = new Vector2(ActiveRectTransform.anchoredPosition.x - ScreenSize,
                                                       ActiveRectTransform.anchoredPosition.y);
                swipedTransforms.Insert(0, leftTrs);
            }

            if (HasRight(CurrentData))
            {
                GameObject    obj      = cache.PopObject();
                RectTransform rightTrs = obj.GetComponent <RectTransform>();
                SetupView(RightData(CurrentData), rightTrs.GetComponent <TView>());
                rightTrs.anchoredPosition = new Vector2(ActiveRectTransform.anchoredPosition.x + ScreenSize,
                                                        ActiveRectTransform.anchoredPosition.y);
                swipedTransforms.Add(rightTrs);
            }

            TransitionAction?.Invoke();
        }