Ejemplo n.º 1
0
    public override IEnumerator OnTransitionIn()
    {
        AppStack.Clear();

        m_Nav.Enter();
        m_Header.Enter();
        return(base.OnTransitionIn());
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        Vector2 movePos;

        RectTransformUtility.ScreenPointToLocalPointInRectangle(
            parentCanvas.transform as RectTransform,
            Input.mousePosition, parentCanvas.worldCamera,
            out movePos);

        var currentPosition = parentCanvas.transform.TransformPoint(movePos);

        delta   = currentPosition - lastPos;
        lastPos = currentPosition;

        m_delta = delta;

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            AppStack.Invoke();
        }

        if (Input.GetMouseButtonDown(0))
        {
            isPressed     = true;
            firstPosition = parentCanvas.transform.TransformPoint(movePos);
        }

        if (Input.GetMouseButton(0))
        {
            if (OnTouch != null)
            {
                OnTouch.Invoke();
            }

            var secondPosition = parentCanvas.transform.TransformPoint(movePos);

            var movedDelta = firstPosition - secondPosition;

            if (Mathf.Abs(movedDelta.x) > minimumDrag)
            {
                //You've moved!
                isMovingHorizontally = true;
            }
        }

        if (Input.GetMouseButtonUp(0))
        {
            isPressed = false;

            if (OnTouchUp != null)
            {
                OnTouchUp.Invoke();
            }

            isMovingHorizontally = false;
        }
    }
Ejemplo n.º 3
0
 public override void Exit()
 {
     AppStack.Add(this);
     base.Exit();
 }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        Vector2 movePos;

        RectTransformUtility.ScreenPointToLocalPointInRectangle(
            parentCanvas.transform as RectTransform,
            Input.mousePosition, parentCanvas.worldCamera,
            out movePos);

        var currentPosition = parentCanvas.transform.TransformPoint(movePos);

        delta   = currentPosition - lastPos;
        lastPos = currentPosition;

        m_delta = delta;

        var backButtonTimeLapsed = Time.time - backButtonFirstTime;

        //Back button
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (AppStack.Count == 0)
            {
                //Reset
                if (backButtonTimeLapsed >= 0.5F)
                {
                    backButtonFirstTime = 0.0F;
                }
                else
                {
                    Application.Quit();
                }

                //First press
                if (backButtonFirstTime == 0.0F)
                {
                    backButtonFirstTime = Time.time;
                    AlertService.Instance.Show();
                }
            }
            else
            {
                AppStack.Invoke();
            }
        }


        if (Input.GetMouseButtonDown(0))
        {
            isPressed     = true;
            firstPosition = parentCanvas.transform.TransformPoint(movePos);
        }

        if (Input.GetMouseButton(0))
        {
            if (OnTouch != null)
            {
                OnTouch.Invoke();
            }

            var secondPosition = parentCanvas.transform.TransformPoint(movePos);

            var movedDelta = firstPosition - secondPosition;

            if (Mathf.Abs(movedDelta.x) > minimumDrag)
            {
                //You've moved!
                isMovingHorizontally = true;
            }
        }

        if (Input.GetMouseButtonUp(0))
        {
            isPressed = false;

            if (OnTouchUp != null)
            {
                OnTouchUp.Invoke();
            }

            isMovingHorizontally = false;
        }
    }