Beispiel #1
0
        /// <summary>
        /// 更新竖直角度移动
        /// </summary>
        private void UpdateVerticalAngle()
        {
            if (GameSceneManager.instance.CanCtrlCam() == false)
            {
                return;
            }
            if (TouchConst.TouchIng())
            {
                return;
            }
            float axis = 0f;

#if UNITY_EDITOR
            axis = Input.GetAxis("Mouse ScrollWheel");
#elif UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_WP_8_1 || UNITY_BLACKBERRY
            if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
            {
                Vector2 delta = Input.GetTouch(0).deltaPosition;
                axis = delta.x;
            }
#endif
            mVerticalAngle += axis * mScrollFactor * 2;
            if (mVerticalAngle < mMinVerticalAngle)
            {
                mVerticalAngle = mMinVerticalAngle;
            }
            else if (mVerticalAngle > mMaxVerticalAngle)
            {
                mVerticalAngle = mMaxVerticalAngle;
            }
        }
Beispiel #2
0
        private static void Update()
        {
            RaycastHit hit;

            if (TouchConst.TouchBegin())
            {
                TouchConst.times = DateTime.Now;
                mRay             = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (IsAllow(out hit))
                {
                    mClickName = hit.collider.name;
                }
            }
            if (TouchConst.TouchEnd())
            {
                if (IsAllow(out hit))
                {
                    if (hit.collider.name.Contains(mClickName))
                    {
                        mClickName = string.Empty;
                        Debug.Log(hit.point);
                    }
                }
            }
            else if (TouchConst.TouchIng())
            {
            }
            else if (Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Moved)
            {
            }
        }
Beispiel #3
0
        private void OnUpate()
        {
            if (!mLArea)
            {
                return;
            }
            if (!mAreaBg)
            {
                return;
            }
            if (!mCircle)
            {
                return;
            }
            Vector2 inputPos = TouchConst.TouchPosition();

            if (!mIsClickArea && TouchConst.TouchBegin())
            {
                if (inputPos.x >= 0 && inputPos.x < Offset.x * 2 && inputPos.y > 0 && inputPos.y < Offset.y * 2)
                {
                    mIsClickArea = true;
                }
            }
            if (!mIsClickArea)
            {
                return;
            }
            if (TouchConst.TouchIng())
            {
                KeyboardControl.IsRestrict = true;
                if (!mLArea.gameObject.activeSelf)
                {
                    mLArea.gameObject.SetActive(true);
                }
                UpdateAreaBgPos(inputPos);
                UpdateCirclePos(inputPos);
                //UnitMgr.Instance.SetPlayerMove(true);
                //if (mPlayer != null)
                //    RemoteControl.Instance.ExecuteMove(mPlayer.CTemp.id);
            }
            else if (TouchConst.TouchEnd())
            {
                //if(mPlayer != null)
                //    RemoteControl.Instance.UndoMove(mPlayer.CTemp.id);
                //UnitMgr.Instance.SetPlayerMove(false);
                mIsFixedPos  = false;
                mIsClickArea = false;
                if (mLArea.gameObject.activeSelf)
                {
                    mLArea.gameObject.SetActive(false);
                }
                KeyboardControl.IsRestrict = false;
            }
        }
Beispiel #4
0
        private void OnUpate()
        {
            if (!mLArea)
            {
                return;
            }
            if (!mAreaBg)
            {
                return;
            }
            if (!mCircle)
            {
                return;
            }
            Vector2 inputPos = TouchConst.TouchPosition();

            if (!mIsClickArea && TouchConst.TouchBegin())
            {
                if (inputPos.x >= 0 && inputPos.x < Offset.x * 2 && inputPos.y > 0 && inputPos.y < Offset.y * 2)
                {
                    mIsClickArea = true;
                }
            }
            if (!mIsClickArea)
            {
                return;
            }
            if (TouchConst.TouchIng())
            {
                if (!mLArea.gameObject.activeSelf)
                {
                    mLArea.gameObject.SetActive(true);
                }
                UpdateAreaBgPos(inputPos);
                UpdateCirclePos(inputPos);
            }
            else
            {
                mIsFixedPos  = false;
                mIsClickArea = false;
                if (mLArea.gameObject.activeSelf)
                {
                    mLArea.gameObject.SetActive(false);
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// 更新水平角度移动
        /// </summary>
        private void UpdateHorizontalAngle()
        {
            if (TouchConst.TouchIng())
            {
                return;
            }
            float axis = 0f;

#if UNITY_EDITOR
            if (Input.GetMouseButton(1))
            {
                axis = Input.GetAxis("Mouse X");
            }
#elif UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_WP_8_1 || UNITY_BLACKBERRY
            if (Input.touchCount > 1 && Input.GetTouch(1).phase == TouchPhase.Moved)
            {
                Vector2 delta = Input.GetTouch(0).deltaPosition;
                axis = delta.x;
            }
#endif
            mHorizontalAngle += axis * mRotateFactor;
        }