Exemplo n.º 1
0
        void OnClick()
        {
            mainCamera         = MyMainCamera.current;
            mainCamera.enabled = true;
            mainCamera.Update();
            mainCamera.LateUpdate();
//	#if UNITY_EDITOR
//		mainCamera.ProcessMouse();
//		#else
//		mainCamera.ProcessTouches();
//#endif
            if (MyMainCamera.lastHit.collider != null)
            {
            }

            Utl.doCallback(onClickCallback);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create a plane on which we will be performing the dragging.
        /// </summary>

        void OnPress(bool pressed)
        {
            // Unity's physics seems to break when timescale is not quite zero. Raycasts start to fail completely.
            float ts = Time.timeScale;

            if (ts < 0.01f && ts != 0f)
            {
                return;
            }

            if (Input.touchCount > 1 && !main3DCamera.allowMultiTouch)
            {
                if (main3DCamera.enabled)
                {
                    main3DCamera.ProcessRelease();
                    main3DCamera.enabled = false;
                }
            }
            else
            {
                if (CLPanelManager.topPanel != null &&
                    canProcClickPanels[CLPanelManager.topPanel.name] != null)
                {
                    if (pressed && main3DCamera != null)
                    {//add by chenbin
                        main3DCamera.enabled = true;
                        main3DCamera.Update();
                        main3DCamera.LateUpdate();
                    }
                }
            }

            if (enabled && NGUITools.GetActive(gameObject) && target != null)
            {
                if (pressed)
                {
                    unDoInertance();
                    if (!mPressed)
                    {
                        scaleValue = _scaleValue;
                        inputPos   = UICamera.currentTouch.pos;
                        // Remove all momentum on press
                        mTouchID = UICamera.currentTouchID;
                        mPressed = true;
                        mStarted = false;
                        CancelMovement();

                        // Disable the spring movement
                        CancelSpring();
                    }
                }
                else if (mPressed && mTouchID == UICamera.currentTouchID)
                {
                    mPressed = false;
                    if (dragEffect != DragEffect.MomentumAndSpring)
                    {
                        CancelMovement();
                        unDoInertance();
                    }
                    if (dragProcType == 0)
                    {
                        if (limitDisplayView())
                        {
                            if (canMove)
                            {
                                doInertance();
                            }
                            else
                            {
                                unDoInertance();
                            }
                        }
                        else
                        {
                            unDoInertance();
                        }
                    }
                    else
                    {
                        unDoInertance();
                    }
                }
            }
            //===========================
            dragProcType = -1;
        }