示例#1
0
        public bool CheckBtnLegal()
        {
            if (m_operaType != GuidEnum.Guid_Click)
            {
                return(false);
            }

            if (eventpassType == EventPassType.None)
            {
                GameEvents.UI_Guid_Event.OnNextGuid.SafeInvoke();
                return(false);
            }
            else if (eventpassType == EventPassType.Scene_Event)
            {
                Gesture    gesture = new Gesture();
                GameObject obj     = gesture.GetCurrentPickedObject();
                if (obj != null)
                {
                    gesture.pickedObject = obj;
                }
                EngineCoreEvents.InputEvent.OnOneFingerTouchup.SafeInvoke(gesture);
                GameEvents.UI_Guid_Event.OnNextGuid.SafeInvoke();
                return(false);
            }
            //if (!m_hasEvent)
            //{
            //    GameEvents.UI_Guid_Event.OnNextGuid.SafeInvoke();
            //    return false;
            //}
            return(true);
        }
示例#2
0
    void On_TouchDown(Gesture gesture)
    {
        if (gesture.pickedObject!=null){

            if (!EasyTouch.GetAutoUpdatePickedObject()){
                label.text = "Picked object from event : " + gesture.pickedObject.name + " : " + gesture.position;
            }
            else{
                label.text = "Picked object from event : " + gesture.pickedObject.name + " : " + gesture.position;
            }
        }
        else{
            if (!EasyTouch.GetAutoUpdatePickedObject()){
                label.text = "Picked object from event :  none";
            }
            else{
                label.text = "Picked object from event : none";
            }
        }

        label2.text = "";
        if (!EasyTouch.GetAutoUpdatePickedObject()){
            GameObject tmp = gesture.GetCurrentPickedObject();
            if (tmp != null){
                label2.text = "Picked object from GetCurrentPickedObject : " + tmp.name ;
            }
            else{
                label2.text = "Picked object from GetCurrentPickedObject : none";
            }
        }
    }
示例#3
0
    private void On_Drag(Gesture gesture)
    {
        var currrent_obj = gesture.GetCurrentPickedObject();

        box_end = currrent_obj?.GetComponent <MapBox>();
        CreatAreaProp(box_end);
    }
示例#4
0
    private void On_DragStart(Gesture gesture)
    {
        var currrent_obj = gesture.GetCurrentPickedObject();

        if (currrent_obj != null)
        {
            box_start = currrent_obj?.GetComponent <MapBox>();
        }
    }
 private void OnMaskClick(Vector2 worldPos, bool inner)
 {
     if (inner)
     {
         gesture = new Gesture();
         GameObject obj = gesture.GetCurrentPickedObject();
         if (obj != null)
         {
             gesture.pickedObject = obj;
         }
         MessageHandler.RegisterMessageHandler(MessageDefine.SCSceneResumeResponse, OnResponse);
         CSSceneResumeRequest resumeReq = new CSSceneResumeRequest();
         resumeReq.PlayerId = GlobalInfo.MY_PLAYER_ID;
         GameEvents.NetWorkEvents.SendMsg.SafeInvoke(resumeReq);
     }
 }
 // Token: 0x06000174 RID: 372 RVA: 0x000085A4 File Offset: 0x000069A4
 private void On_TouchDown(Gesture gesture)
 {
     if (gesture.pickedObject != null)
     {
         if (!EasyTouch.GetAutoUpdatePickedObject())
         {
             this.label.text = string.Concat(new object[]
             {
                 "Picked object from event : ",
                 gesture.pickedObject.name,
                 " : ",
                 gesture.position
             });
         }
         else
         {
             this.label.text = string.Concat(new object[]
             {
                 "Picked object from event : ",
                 gesture.pickedObject.name,
                 " : ",
                 gesture.position
             });
         }
     }
     else if (!EasyTouch.GetAutoUpdatePickedObject())
     {
         this.label.text = "Picked object from event :  none";
     }
     else
     {
         this.label.text = "Picked object from event : none";
     }
     this.label2.text = string.Empty;
     if (!EasyTouch.GetAutoUpdatePickedObject())
     {
         GameObject currentPickedObject = gesture.GetCurrentPickedObject(false);
         if (currentPickedObject != null)
         {
             this.label2.text = "Picked object from GetCurrentPickedObject : " + currentPickedObject.name;
         }
         else
         {
             this.label2.text = "Picked object from GetCurrentPickedObject : none";
         }
     }
 }
        private void OnMaskClickEvent(Vector2 worldPos)
        {
            worldPos = this.m_maskRoot.InverseTransformPoint(worldPos);
            float dis = Vector2.Distance(worldPos, Vector3.right * m_centerPos.x + Vector3.up * m_centerPos.y);

            if (dis <= m_centerPos.z)
            {
                gesture = new Gesture();
                GameObject obj = gesture.GetCurrentPickedObject();
                if (obj == null)
                {
                    return;
                }
                gesture.pickedObject = obj;
                EngineCoreEvents.InputEvent.OnOneFingerTouchup.SafeInvoke(gesture);
                OnDestory();
            }
        }
        //private void OnMaskLongClick(bool click)
        //{
        //    if (click)
        //    {
        //        OnDestory();
        //    }
        //}

        public override void OnDestory(FuncState funcState = FuncState.Complete)
        {
            base.OnDestory(funcState);

            if (isScene == 1)
            {
                Gesture    gesture = new Gesture();
                GameObject obj     = gesture.GetCurrentPickedObject();
                if (obj != null)
                {
                    gesture.pickedObject = obj;
                }
                EngineCoreEvents.InputEvent.OnOneFingerTouchup.SafeInvoke(gesture);
            }
            //if (this.m_rotation >= 0f)
            //{
            //    GameEvents.UI_Guid_Event.OnRemoveEffect.SafeInvoke(20000, true);
            //}
            Debug.Log("end mask =======" + m_funcID);
            GameEvents.UI_Guid_Event.OnMaskClick -= OnMaskClick;
        }
示例#9
0
    private void On_TouchDown(Gesture gesture)
    {
        if (gesture.pickedObject != null)
        {
            if (!EasyTouch.GetAutoUpdatePickedObject())
            {
                label.text = "Picked object from event : " + gesture.pickedObject.name + " : " + gesture.position;
            }
            else
            {
                label.text = "Picked object from event : " + gesture.pickedObject.name + " : " + gesture.position;
            }
        }
        else
        {
            if (!EasyTouch.GetAutoUpdatePickedObject())
            {
                label.text = "Picked object from event :  none";
            }
            else
            {
                label.text = "Picked object from event : none";
            }
        }

        label2.text = "";
        if (!EasyTouch.GetAutoUpdatePickedObject())
        {
            GameObject tmp = gesture.GetCurrentPickedObject();
            if (tmp != null)
            {
                label2.text = "Picked object from GetCurrentPickedObject : " + tmp.name;
            }
            else
            {
                label2.text = "Picked object from GetCurrentPickedObject : none";
            }
        }
    }
示例#10
0
    void Update()
    {
        if (isAniamtion && director)
        {
            transform.localPosition = director.transform.position;
            Vector3 rot = new Vector3(0, director.transform.eulerAngles.y, 0);
            transform.rotation = Quaternion.Euler(rot);
            angleDistance      = rot;
            sCamera.transform.localRotation = Quaternion.Euler(0, 0, 0);
        }
        else if (sObj && isDoTweenOk)
        {
            if (sObj.camMode == CameraTargetScriptableObject.CameraMode.路径动画)
            {
                //路径帧数控制
                if (sObj.pathFrame > 2)
                {
                    pathAnimation = (sObj.pathCreator.path.length / sObj.pathFrame) * pathFrame;
                    pathFrame    += 1;
                }
                else
                {
                    pathAnimation += sObj.scrollZoomPanSpeed.y * Time.deltaTime;//路径速度控制
                }
                transform.position = sObj.pathCreator.path.GetPointAtDistance(pathAnimation, sObj.pathEndType);
                Quaternion rot = sObj.pathCreator.path.GetRotationAtDistance(pathAnimation, sObj.pathEndType) * Quaternion.Euler(0, 0, 90);
                angleDistance = sCamera.transform.eulerAngles;

                //路径注视
                if (sObj.pathLookAt)
                {
                    sCamera.transform.LookAt(sObj.lookTargetPosition);
                }
                else
                {
                    transform.eulerAngles = new Vector3(0, rot.eulerAngles.y, 0);
                }
            }


            if (sObj.camMode == CameraTargetScriptableObject.CameraMode.环视目标 ||
                sObj.camMode == CameraTargetScriptableObject.CameraMode.人视穿行 ||
                sObj.camMode == CameraTargetScriptableObject.CameraMode.自由飞行)
            {
                if (!Sun.Rise.IsPointerOverUIObject())
                {
                    //触摸事件
                    Gesture curGesture = EasyTouch.current;
                    if (curGesture != null)
                    {
                        if (!curGesture.pickedUIElement)
                        {
                            //单指
                            if (EasyTouch.GetTouchCount() == 1)
                            {
                                Cursor.visible      = false; //隐藏鼠标指针
                                addAngleDistance.y += curGesture.deltaPosition.x * sObj.scrollZoomPanSpeed.x * speedScale;
                                addAngleDistance.x -= curGesture.deltaPosition.y * sObj.scrollZoomPanSpeed.x * speedScale;

                                if (sObj.camMode == CameraTargetScriptableObject.CameraMode.人视穿行)
                                {
                                    if (EasyTouch.EvtType.On_TouchStart == curGesture.type)
                                    {
                                        //模拟双击事件  EasyTouch双击事件与window冲突
                                        bool doubleTap = false;
                                        if (Time.time < doubleTapTime + 0.3f)
                                        {
                                            doubleTap = true;
                                        }
                                        doubleTapTime = Time.time;
                                        if (doubleTap)
                                        {
                                            //人视穿行 双击自动前行
                                            if (curGesture.GetCurrentPickedObject() && sObj.arrowPrefab)
                                            {
                                                Ray        ray = Camera.main.ScreenPointToRay(curGesture.position);
                                                RaycastHit hit;
                                                if (Physics.Raycast(ray, out hit, Mathf.Infinity))
                                                {
                                                    if (hit.normal.y > 0.85f)//法线方向朝上
                                                    {
                                                        //生成箭头
                                                        GameObject arrow = Instantiate(sObj.arrowPrefab);
                                                        arrow.transform.position = hit.point;//碰撞位置

                                                        //arrow.transform.domo(new Vector3(), sObj.tweenTime).SetEase(Ease.Flash).SetLoops(-1);
                                                        arrow.transform.DORotate(new Vector3(0, 180f, 0), sObj.fovTweenLate.y).OnComplete((() =>
                                                        {
                                                            Destroy(arrow);
                                                        }));;

                                                        //Debug.Log(curGesture.GetCurrentPickedObject().name + "    坐标: " + hit.point);
                                                        Vector3 newPos = new Vector3(hit.point.x, hit.point.y + sCapsuleCollider.height, hit.point.z);
                                                        DOTween.Kill("ToCameraPosition");
                                                        DOTween.To(() => transform.position, x => transform.position = x, newPos, sObj.fovTweenLate.y).SetId("ToCameraPosition").SetEase(ease).SetAutoKill(true)
                                                        .OnComplete((() =>
                                                        {
                                                        }));
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                if (sObj.camMode == CameraTargetScriptableObject.CameraMode.自由飞行)
                                {
                                    transform.localPosition += sCamera.transform.forward * sObj.scrollZoomPanSpeed.y * speedScale;
                                }

                                if (sObj.camMode == CameraTargetScriptableObject.CameraMode.人视穿行)
                                {
                                    //前进 后退
                                    if (curGesture.position.y > Screen.height * 0.2f)
                                    {
                                        transform.localPosition += transform.forward * sObj.scrollZoomPanSpeed.y * speedScale;
                                    }
                                    else
                                    {
                                        transform.localPosition -= transform.forward * sObj.scrollZoomPanSpeed.y * speedScale;
                                    }
                                }
                            }
                            //双指
                            else if (EasyTouch.GetTouchCount() == 2)
                            {
                                if (EasyTouch.EvtType.On_TouchStart2Fingers == curGesture.type)
                                {
                                    addAngleDistance.z = 0;
                                }
                                //缩放
                                if (sObj.camMode == CameraTargetScriptableObject.CameraMode.环视目标)
                                {
                                    //if (EasyTouch.EvtType.On_Pinch == curGesture.type)
                                    //{
                                    //    if(curGesture.deltaPinch != 0)
                                    //        addAngleDistance.z -= (curGesture.deltaPinch > 0 ? 1f : -1f) * sObj.scrollZoomPanSpeed.y;
                                    //}
                                    if (curGesture.deltaPosition.y != 0)
                                    {
                                        addAngleDistance.z -= (curGesture.deltaPosition.y > 0 ? 0.2f : -0.2f) * sObj.scrollZoomPanSpeed.y;
                                    }
                                }
                                //划动转角度
                                if (sObj.camMode == CameraTargetScriptableObject.CameraMode.自由飞行 ||
                                    sObj.camMode == CameraTargetScriptableObject.CameraMode.人视穿行)
                                {
                                    addAngleDistance.y += curGesture.deltaPosition.x * sObj.scrollZoomPanSpeed.x * speedScale * 0.2f;
                                    addAngleDistance.x -= curGesture.deltaPosition.y * sObj.scrollZoomPanSpeed.x * speedScale * 0.2f;
                                }
                            }
                            //多指抓
                            else if (EasyTouch.GetTouchCount() > 2)
                            {
                                //缩放  平移
                                if (sObj.camMode == CameraTargetScriptableObject.CameraMode.环视目标)
                                {
                                    Vector3 p0  = transform.position;
                                    Vector3 p01 = p0 - transform.right * curGesture.deltaPosition.x * speedScale * sObj.scrollZoomPanSpeed.z * 0.5f;
                                    //Vector3 p03 = Vector3.zero;
                                    //if (Input.GetKey(KeyCode.LeftShift))
                                    //    p03 = p01 - transform.up * curGesture.deltaPosition.y * speedScale * sObj.scrollZoomPanSpeed.z * 0.5f;
                                    //else
                                    //    p03 = p01 - transform.forward * curGesture.deltaPosition.y * speedScale * sObj.scrollZoomPanSpeed.z * 0.5f;
                                    Vector3 p03 = p01 - transform.forward * curGesture.deltaPosition.y * speedScale * sObj.scrollZoomPanSpeed.z * 0.5f;
                                    lookTargetPosition += p03 - p0;
                                }
                            }

                            if (EasyTouch.EvtType.On_TouchUp == curGesture.type)
                            {
                                isTouchUp = true;
                            }
                            else
                            {
                                isTouchUp = false;
                            }
                        }
                    }
                    //pc上才有的事件
                    if (!Application.isMobilePlatform)
                    {
                        if (Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1))
                        {
                            Cursor.visible = true; //显示鼠标指针
                        }
                        //右键事件
                        if (Input.GetMouseButton(1))
                        {
                            if (sObj.camMode == CameraTargetScriptableObject.CameraMode.环视目标)//平移视点
                            {
                                Vector3 p0  = transform.position;
                                Vector3 p01 = p0 - transform.right * Input.GetAxis("Mouse X") * sObj.scrollZoomPanSpeed.z;
                                Vector3 p03 = p01 - transform.forward * Input.GetAxis("Mouse Y") * sObj.scrollZoomPanSpeed.z;
                                lookTargetPosition += p03 - p0;
                            }
                            else  //划动转角度
                            {
                                addAngleDistance.y += Input.GetAxis("Mouse X") * sObj.scrollZoomPanSpeed.x;
                                addAngleDistance.x -= Input.GetAxis("Mouse Y") * sObj.scrollZoomPanSpeed.x;
                            }
                        }

                        //滚轮事件
                        if (Input.GetAxis("Mouse ScrollWheel") != 0)
                        {
                            //限制鼠标移动到游戏窗口外
                            if (!new Rect(0, 0, Screen.width, Screen.height).Contains(Input.mousePosition))
                            {
                                return;
                            }
                            if (sObj.camMode == CameraTargetScriptableObject.CameraMode.环视目标)
                            {
                                addAngleDistance.z -= (Input.GetAxis("Mouse ScrollWheel") > 0 ? 0.5f : -0.5f) * sObj.scrollZoomPanSpeed.y;
                            }
                        }
                        //自由飞行模式-----------------------------------------------
                        if (sObj.camMode == CameraTargetScriptableObject.CameraMode.自由飞行)
                        {
                            if (Input.GetKey(KeyCode.A))
                            {
                                transform.localPosition -= transform.right * sObj.scrollZoomPanSpeed.y * speedScale;
                            }
                            if (Input.GetKey(KeyCode.D))
                            {
                                transform.localPosition += transform.right * sObj.scrollZoomPanSpeed.y * speedScale;
                            }
                            if (Input.GetKey(KeyCode.W))
                            {
                                transform.localPosition += sCamera.transform.forward * sObj.scrollZoomPanSpeed.y * speedScale;
                            }
                            if (Input.GetKey(KeyCode.S))
                            {
                                transform.localPosition -= sCamera.transform.forward * sObj.scrollZoomPanSpeed.y * speedScale;
                            }
                        }
                    }
                }

                RotateCamera();//让摄像机和角色 始终转向物品

                //环视目标模式-----------------------------------------------
                if (sObj.camMode == CameraTargetScriptableObject.CameraMode.环视目标)
                {
                    if (sObj.lookAutoPlay != 0)
                    {
                        angleDistance.y += sObj.lookAutoPlay;
                    }
                    transform.position = lookTargetPosition + Quaternion.Euler(angleDistance.x, angleDistance.y, 0) * new Vector3(0, 0, -angleDistance.z);
                }
            }
        }
    }
示例#11
0
 private void On_TouchUp(Gesture gesture)
 {
     print("On_TouchUp : pick obj is " + gesture.GetCurrentPickedObject());
 }