Exemplo n.º 1
0
        public void UpdatePosition()
        {
#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
            if (SecondaryDragAction != Rotate && IsProcessingSecondaryDragAction)
            {
                return;
            }
#else
            if (Input.GetMouseButton(1) || Input.GetMouseButtonUp(1) || Input.GetMouseButton(2) || Input.GetMouseButtonUp(2))
            {
                return;
            }
#endif
            if (PointerPositions.Count < 1 || PointerDragOffsets.Count < 1 || (IsOnline && !hasAuthority))
            {
                return;
            }

            Vector2 targetPosition = UnityExtensionMethods.CalculateMean(PointerPositions.Values.ToList());
            targetPosition = targetPosition + UnityExtensionMethods.CalculateMean(PointerDragOffsets.Values.ToList());
            if (ParentCardStack != null)
            {
                UpdateCardStackPosition(targetPosition);
            }
            else if (!IsStatic)
            {
                transform.position = targetPosition;
            }

            if (!IsStatic)
            {
                if (PlaceHolderCardStack != null)
                {
                    PlaceHolderCardStack.UpdateLayout(PlaceHolder, targetPosition);
                }

                if (IsOnline)
                {
                    CmdUpdatePosition(((RectTransform)transform).anchoredPosition);
                }
            }
        }