示例#1
0
    public virtual void OnRotate(ETouch.Gesture gesture)
    {
        if (_curModel == null || _modelCamera == null)
        {
            return;
        }

        GameObject go = EventSystem.current.currentSelectedGameObject;

        if (go != gameObject)
        {
            return;
        }

        float offset = gesture.deltaPosition.x;

        _currentRotate -= offset;

        Ray        ray = _modelCamera.ScreenPointToRay(gesture.position);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            _goObject.transform.Rotate(Vector3.up, -offset);
            //_goObject.transform.localRotation = Quaternion.Euler(new Vector3(-15, _currentRotate, 0));
        }
    }
示例#2
0
    private void On_Drag(ETouch.Gesture gesture)
    {
        // 调整地图位置
        if (_mapBg == null)
        {
            return;
        }

        GameObject go = EventSystem.current.currentSelectedGameObject;

        //Debug.Log(go);

        if (go != null)
        {
            if (!InChild(go.transform))
            {
                return;
            }
        }

        Vector3 pos = _mapBg.transform.localPosition;

        pos.x += gesture.deltaPosition.x;
        pos.y += gesture.deltaPosition.y;
        _mapBg.transform.localPosition = pos;
        CheckBound();
    }
示例#3
0
    void On_Pinch(ETouch.Gesture gesture)
    {
        if (IsTouchUI())
        {
            return;
        }

        _rtsCamera.Distance -= gesture.deltaPinch * _zoomSpeed * Time.deltaTime;
    }
示例#4
0
    void On_Swipe(ETouch.Gesture gesture)
    {
        if (IsTouchUI())
        {
            return;
        }

        _rtsCamera.AddToPosition(-gesture.deltaPosition.x * _moveSpeed * Time.deltaTime, 0, -gesture.deltaPosition.y * _moveSpeed * Time.deltaTime);
    }
示例#5
0
    private void On_Pinch(ETouch.Gesture gesture)
    {
        // 进行缩放
        if (!_isWorldMap)
        {
            Game.Instance.CityScaleFactor += gesture.deltaPinch / 1000;
            _mapBg.transform.localScale    = Vector3.one * Game.Instance.CityScaleFactor;
        }
        else
        {
            Game.Instance.WorldScaleFactor += gesture.deltaPinch / 1000;
            _mapBg.transform.localScale     = Vector3.one * Game.Instance.WorldScaleFactor;
        }

        CheckBound();
    }
示例#6
0
    void On_SimpleTap(ETouch.Gesture gesture)
    {
        if (_touchUI || UIUtil.IsTouchUI())
        {
            return;
        }

        if (Camera.main == null)
        {
            return;
        }
        Ray        ray = Camera.main.ScreenPointToRay(gesture.position);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            CityBuilding building = hit.collider.GetComponent <CityBuilding>();
            if (building != null)
            {
                building.OnClick();
            }
        }
    }
示例#7
0
 void On_TouchDown(ETouch.Gesture gesture)
 {
     _touchUI = UIUtil.IsTouchUI();
 }