Example #1
0
    public void OnConfirmDetailTypeButtonPressed()
    {
        switch (selectedType)
        {
        case DetailType.Name:
            addNameWindow.UnHideObject();
            lastMover = addNameWindow;
            break;

        case DetailType.Phone:
            addPhoneWindow.UnHideObject();
            lastMover = addPhoneWindow;
            break;

        case DetailType.Email:
            addEmailWindow.UnHideObject();
            lastMover = addEmailWindow;
            break;

        case DetailType.Link:
            addLinkWindow.UnHideObject();
            lastMover = addLinkWindow;
            break;

        case DetailType.Description:
            addDescriptionWindow.UnHideObject();
            lastMover = addDescriptionWindow;
            break;
        }
    }
Example #2
0
    public void createMovingText(GameObject prefab, Vector3 position, int value, TextType type, bool worldSpace, float speed = 1f, float direction = 90f)
    {
        Text    t     = createTextFromValue(prefab, position, value, type, worldSpace);
        UIMover mover = t.GetComponent <UIMover>();

        position += mover.offset;
        mover.move(position, direction, speed, worldSpace);
    }
    public void Move(Type type)
    {
        if (Equipment.IsUIMoving() || Upgrades.IsUIMoving() || Settings.IsUIMoving())
        {
            return;
        }

        UIMover target;

        switch (type)
        {
        case Type.Equipment:
            target = Equipment;
            break;

        case Type.Upgrades:
            target = Upgrades;
            break;

        case Type.Settings:
            target = Settings;
            break;

        default:
            throw new InvalidEnumArgumentException();
        }

        if (_isElementInside)
        {
            if (target == _elementInside)
            {
                _isElementInside = false;
            }
            else
            {
                _elementInside.MoveUI();
                _elementInside = target;
            }
        }
        else
        {
            _elementInside   = target;
            _isElementInside = true;
        }

        target.MoveUI();
    }
Example #4
0
    public void Move(bool show)
    {
        MoverParams moverParams;

        if (show)
        {
            moverParams = new MoverParams {
                startRect   = startRect,
                endRect     = endRect,
                changeScale = true
            };
        }
        else
        {
            moverParams = new MoverParams {
                startRect   = endRect,
                endRect     = startRect,
                changeScale = true
            };
        }

        //print($"Start: {moverParams.startRect.position}, {moverParams.startRect.size}. End: {moverParams.endRect.position}, {moverParams.endRect.size}");
        UIMover.Move(layoutParent, moverParams);
    }
Example #5
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Q))
        {
            panel_CardSet = Instantiate(prefab_CardSet, FindObjectOfType <Canvas>().transform);

            CreateTestObject();
            panel_CardSet.InitPos(poses);

            Rect cardEndPos = new Rect {
                position = panel_CardSet.inventoryLayoutGroup.GetFirstItemPos(),
                size     = panel_CardSet.inventoryLayoutGroup.GetActualSize()
            };

            //移动Card
            UIMover.Move(card, new MoverParams {
                startRect   = cardStartPos,
                endRect     = cardEndPos,
                changeScale = true,
                movement    = movement_Show
            }, () => {
                //隐藏Card
                card.gameObject.SetActive(false);
            });

            card.GetComponent <CanvasGroup>().DOFade(0, .5f);

            //移动CardSet
            panel_CardSet.Move(true);
            panel_CardSet.GetComponent <CanvasGroup>().DOFade(1, .5f);
        }

        if (Input.GetKeyDown(KeyCode.W))
        {
            //移动CardSet
            panel_CardSet.Move(false);
            panel_CardSet.GetComponent <CanvasGroup>().DOFade(0, .5f).OnComplete(() => {
                Destroy(panel_CardSet.gameObject);
            });

            //移动Card
            card.gameObject.SetActive(true);

            UIMover.Move(card, new MoverParams {
                startRect = new Rect {
                    position = card.position,
                    size     = card.rect.size * card.localScale
                },
                endRect     = cardStartPos,
                changeScale = true,
                movement    = movement_Hide
            }, () => {
            });

            card.GetComponent <CanvasGroup>().DOFade(1, .5f);
        }

        if (Input.GetKeyDown("a"))
        {
            RectTransform target = panel_CardSet.inventoryLayoutGroup.transform.GetChild(2).GetComponent <RectTransform>();
            target.GetComponent <Canvas>().sortingOrder = 1;

            lastRect = new Rect {
                position = target.position,
                size     = target.rect.size * target.localScale,
            };

            UIMover.Move(target, new MoverParams {
                endRect = new Rect {
                    position = poses[0].position,
                    size     = poses[0].sizeDelta
                },
                changeScale = true
            });
        }
        if (Input.GetKeyDown("s"))
        {
            RectTransform target = panel_CardSet.inventoryLayoutGroup.transform.GetChild(2).GetComponent <RectTransform>();

            UIMover.Move(target, new MoverParams {
                endRect     = lastRect,
                changeScale = true
            }, () => {
                target.GetComponent <Canvas>().sortingOrder = 0;
            });
        }
    }