Exemple #1
0
    public virtual void OnSCPointerDrag(InputDevicePartBase part, SCPointEventData eventData)
    {
        //eventData.hitAnchorPointer.transform.position = eventData.currentHitPoint;
        //GetSocller(eventData.currentHitPoint);

        if (eventData.target != null)
        {
            eventData.hitAnchorPointer.transform.position = eventData.currentHitPoint;
            GetSocller(eventData.currentHitPoint);
        }
        else if (eventData.target == null)
        {
            eventData.hitAnchorPointer.transform.position = eventData.hitPointer.transform.position;
            GetSocller(eventData.hitPointer.transform.position);
        }
    }
Exemple #2
0
    public override void OnHandlerDrag(PointerEventData eventData)
    {
        SCPointEventData scPointEventData = eventData as SCPointEventData;

        if (scPointEventData == null)
        {
            return;
        }

        if (currentGrabPoint == Vector3.zero)
        {
            initialGrabPoint = currentGrabPoint = scPointEventData.Position3D;
        }
        currentGrabPoint = scPointEventData.Position3D;

        float initialDist = Vector3.Dot(initialGrabPoint - oppositeCorner, diagonalDir);
        float currentDist = Vector3.Dot(currentGrabPoint - oppositeCorner, diagonalDir);
        float scaleFactor = 1 + (currentDist - initialDist) / initialDist;

        Vector3 newScale = initialScaleOnGrabStart;// * scaleFactor;

        FaceHandle facePointHandle = currentHandle as FaceHandle;

        Vector3 axisScaleFactor = Vector3.one;

        if (facePointHandle.axis == BoundingBox.AxisType.X || facePointHandle.axis == BoundingBox.AxisType.NX)
        {
            axisScaleFactor = new Vector3(scaleFactor, 1, 1);
        }
        else if (facePointHandle.axis == BoundingBox.AxisType.Y || facePointHandle.axis == BoundingBox.AxisType.NY)
        {
            axisScaleFactor = new Vector3(1, scaleFactor, 1);
        }
        else if (facePointHandle.axis == BoundingBox.AxisType.Z || facePointHandle.axis == BoundingBox.AxisType.NZ)
        {
            axisScaleFactor = new Vector3(1, 1, scaleFactor);
        }
        newScale = Vector3.Scale(initialScaleOnGrabStart, axisScaleFactor);

        boundingBox.transform.localScale = newScale;

        float distance = Vector3.Distance(initialPositionOnGrabStart, oppositeCorner);
        float coef     = (facePointHandle.axis == BoundingBox.AxisType.X || facePointHandle.axis == BoundingBox.AxisType.Y || facePointHandle.axis == BoundingBox.AxisType.Z)
            ? -1 : 1;

        boundingBox.transform.position = initialPositionOnGrabStart + coef * (boundingBox.transform.rotation * (Vector3.one - axisScaleFactor) * distance);
    }
Exemple #3
0
    public void OnPointerUp(PointerEventData eventData)
    {
        SCPointEventData scPointEventData = eventData as SCPointEventData;

        if (scPointEventData == null)
        {
            return;
        }

        if (activation == BoundingBoxActivationType.ActivateOnStart)
        {
            SetVisibility(true);
        }
        else
        {
            SetVisibility(true);
        }
    }
Exemple #4
0
    public virtual void OnSCPointerUp(InputDevicePartBase part, SCPointEventData eventData)
    {
        changeDownPart(part.name, false);

        if (isDownChoose())
        {
            return;
        }

        Rigidbody rb = this.GetComponent <Rigidbody>();

        if (rb != null)
        {
            rb.isKinematic = initRib;
        }
        ShowBoxEdit();
        lr.enabled = false;
        //     InputDeviceEventBase.anyKeyUpDelegate -= onUp;
        isMove = false;
    }
Exemple #5
0
    public override void OnHandlerPointerDown(PointerEventData eventData)
    {
        SCPointEventData scPointEventData = eventData as SCPointEventData;

        if (scPointEventData == null)
        {
            return;
        }

        currentGrabPoint           = initialGrabPoint = Vector3.zero;
        initialScaleOnGrabStart    = boundingBox.transform.localScale;
        initialPositionOnGrabStart = boundingBox.transform.position;

        oppositeCorner = boundingBox.BoundingBoxContainer.transform.TransformPoint(-scPointEventData.pointerCurrentRaycast.gameObject.transform.localPosition);
        diagonalDir    = (scPointEventData.pointerCurrentRaycast.gameObject.transform.position - oppositeCorner).normalized;

        AudioSystem.getInstance.PlayAudioOneShot(boundingBox.gameObject, boundingBox.ScaleStartAudio);
        boundingBox.ScaleStarted?.Invoke();
        boundingBox.SetHighLight(scPointEventData.pointerCurrentRaycast.gameObject.transform, true);
    }
Exemple #6
0
    public override void OneDevicePartInit(Dictionary <InputDevicePartType, SCPointEventData> eventDataDic, Transform targetTransform, MoveLogic moveLogic, RotateLogic rotateLogic, ScaleLogic scaleLogic)
    {
        base.OneDevicePartInit(eventDataDic, targetTransform, moveLogic, rotateLogic, scaleLogic);
        startRotation        = targetTransform.rotation;
        onHandPointEventData = eventDataDic.Values.ToArray()[0];

        InputDeviceHandPart inputDeviceHandPart = onHandPointEventData.inputDevicePartBase as InputDeviceHandPart;
        ModelHand           modelHand           = inputDeviceHandPart.inputDeviceHandPartUI.modelHand;

        oneHandJointFour    = modelHand.ActiveHandModel.GetJointTransform(FINGER.forefinger, JOINT.Four).transform;
        localRotationInHand = Quaternion.Inverse(oneHandJointFour.rotation) * startRotation;

        handDetector = inputDeviceHandPart.detectorBase as HandDetector;

        oneHandPose.position = onHandPointEventData.Position3D;
        oneHandPose.rotation = startRotation;
        oneHandGrabPosition  = onHandPointEventData.Position3D;

        moveLogic.Setup(oneHandPose, oneHandGrabPosition, targetTransform, targetTransform.localScale);
    }
Exemple #7
0
    public void OnPointerExit(PointerEventData eventData)
    {
        SCPointEventData scPointEventData = eventData as SCPointEventData;

        if (scPointEventData == null)
        {
            return;
        }

        if (scPointEventData.DownPressGameObject == null)
        {
            if (activation == BoundingBoxActivationType.ActivateOnStart)
            {
                SetVisibility(true);
            }
            else
            {
                SetVisibility(false);
            }
        }
    }
Exemple #8
0
    public virtual void OnSCPointerDown(InputDevicePartBase part, SCPointEventData eventData)
    {
        try
        {
            changeDownPart(part.name, true);
            //dragInitLocalPosition = InputSystem.InputDeviceCurrent.inputDeviceUIBase.model.transform.InverseTransformPoint(transform.position);
            //doTweeningPos = InputSystem.InputDeviceCurrent.inputDeviceUIBase.model.transform.TransformPoint(dragInitLocalPosition);
            Rigidbody rb = this.GetComponent <Rigidbody>();
            if (rb != null)
            {
                initRib        = rb.isKinematic;
                rb.isKinematic = true;
            }
            switch (editType)
            {
            case EditTypeEnum.ALLEDIT:
                lr.enabled = true;
                //  boxDisplay.SetActive(true);
                break;

            case EditTypeEnum.DEFECT:
                //   boxDisplay.SetActive(false);
                break;

            case EditTypeEnum.NORMAL:
                lr.enabled = true;
                //   boxDisplay.SetActive(true); ;
                break;
            }
            // ApplyMaterialToAllRenderers(boxDisplay, boxClickMaterial);
            HideBoxEdit();
            isMove = true;
            //     InputDeviceEventBase.anyKeyUpDelegate += onUp;
        }
        catch (Exception e)
        {
            Debug.Log(e);
        }
    }
Exemple #9
0
    public void OnSCBothHandPointerDrag(InputDevicePartBase part1, SCPointEventData part1EventData, InputDevicePartBase part2, SCPointEventData part2EventData)
    {
        if (isBoth)
        {
            float disRot = SvrManager.Instance.head.InverseTransformPoint(part1.inputDeviceUIBase.model.lineIndicate.StartPoint.position).z - SvrManager.Instance.head.InverseTransformPoint(part2.inputDeviceUIBase.model.lineIndicate.StartPoint.position).z;

            float dis = SvrManager.Instance.head.InverseTransformPoint(part1.inputDeviceUIBase.model.lineIndicate.StartPoint.position).x - SvrManager.Instance.head.InverseTransformPoint(part2.inputDeviceUIBase.model.lineIndicate.StartPoint.position).x;

            float aaa = Mathf.Abs(disRot - initDisRot);
            float bbb = Mathf.Abs(dis - initDis);
            if (aaa < bbb && bbb > 0.01f)
            {
                float perValue = dis / initDis;
                if ((scale3 * perValue).x > (Tscale3 / 5).x && (scale3 * perValue).x < (Tscale3 * 5).x)
                {
                    this.transform.localScale = scale3 * (perValue);
                    this.lr.widthMultiplier   = this.LineSize * (perValue);
                    for (int i = 0; i < this.veces.Length; i++)
                    {
                        this.scaleGameList[i].transform.localScale = this.sScale * (perValue);
                    }
                    for (int i = 0; i < 12; i++)
                    {
                        this.eulerGameList[i].transform.localScale = this.rScale * (perValue);
                    }
                }
                initDisRot = SvrManager.Instance.head.InverseTransformPoint(part1.inputDeviceUIBase.model.lineIndicate.StartPoint.position).z - SvrManager.Instance.head.InverseTransformPoint(part2.inputDeviceUIBase.model.lineIndicate.StartPoint.position).z;
            }
            else if (Mathf.Abs(disRot - initDisRot) * 200 > 5)
            {
                initDis = SvrManager.Instance.head.InverseTransformPoint(part1.inputDeviceUIBase.model.lineIndicate.StartPoint.position).x - SvrManager.Instance.head.InverseTransformPoint(part2.inputDeviceUIBase.model.lineIndicate.StartPoint.position).x;

                this.transform.eulerAngles = new Vector3(initBothRot.x, initBothRot.y + (disRot - initDisRot) * 200, initBothRot.z);
                this.changeLine();
            }
        }
    }
 public override void OnSCPointerDown(InputDevicePartBase part, SCPointEventData eventData)
 {
     base.OnSCPointerDown(part, eventData);
     initValue = perValue;
 }
Exemple #11
0
 public void OnSCPointerEnter(InputDevicePartBase part, SCPointEventData eventData)
 {
     changeEnterPart(part.name, true);
     ShowBoxEdit();
 }
Exemple #12
0
 public static void OnPokeUpdated(GameObject obj, TouchPointer touchPointer, SCPointEventData sCPointEventData = null)
 {
     ExecuteEvents.Execute <IPokeUpdatedHandler>(obj, null, (x, y) => x.OnPokeUpdated(touchPointer, sCPointEventData));
 }
Exemple #13
0
 public static void OnHandCatchDrag(GameObject obj, InputDeviceHandPart inputDeviceHandPart, SCPointEventData sCPointEventData = null)
 {
     ExecuteEvents.Execute <IHandCatchDragHandler>(obj, null, (x, y) => x.OnHandCatchDrag(inputDeviceHandPart, sCPointEventData));
 }
Exemple #14
0
 override public void OnSCPointerDrag(InputDevicePartBase part, SCPointEventData eventData)
 {
     if (!dc.isBoth && !dc.isMove && isDown)
     {
         float temp  = 0;
         float temp2 = 0;
         float temp3 = 0;
         // Vector3 poslocal = new Vector3(0, 0, 0);
         Vector3 poslocal = eventData.dragPosition;
         Vector3 xlv3     = GetNormal(dragInitLocalPosition, poslocal);
         temp  = xlv3.x;
         temp2 = xlv3.y;
         temp3 = xlv3.z;
         float xishu = 40;
         if (index == 4 || index == 8 || index == 9 || index == 11)
         {
             if (index == 9 || index == 11)
             {
                 temp = -temp;
             }
             if (index == 4 || index == 11)
             {
                 temp3 = -temp3;
             }
             dc.transform.localEulerAngles = new Vector3(0, (temp + temp3 + temp2) * xishu, 0);
             //  dc.transform.Rotate(xxjd - nowxz);
             //   Debug.Log("temp========>"+ index + nowxz);
         }
         else if (index == 2 || index == 6 || index == 0 || index == 7)
         {
             if (index == 7 || index == 6)
             {
                 temp = -temp;
             }
             if (index == 7 || index == 0)
             {
                 temp3 = -temp3;
             }
             if (index == 2 || index == 6)
             {
                 temp2 = -temp2;
             }
             dc.transform.localEulerAngles = new Vector3(0, 0, -(temp + temp3 - temp2) * xishu);
             Debug.Log(" 绕Z轴旋转Z" + index);
         }
         else
         {
             if (index == 5 || index == 10)
             {
                 temp3 = -temp3;
             }
             if (index == 5 || index == 3)
             {
                 temp2 = -temp2;
             }
             dc.transform.localEulerAngles = new Vector3((temp + temp3 + temp2) * xishu, 0, 0);
             Debug.Log(" 绕X轴旋转Y" + index + xlv3);
         }
         dc.changeLine();
         if (focusobj.childCount >= 4)
         {
             focusobj.GetChild(3).gameObject.SetActive(false);
         }
     }
     else
     {
         Debug.Log("关闭DOWN");
         isDown = false;
     }
 }
Exemple #15
0
 public virtual void OnSCPointerDown(InputDevicePartBase part, SCPointEventData eventData)
 {
     GetSocller(eventData.currentHitPoint);
     enterbox();
 }
Exemple #16
0
 override public void OnSCPointerUp(InputDevicePartBase part, SCPointEventData eventData)
 {
     onUp();
 }
Exemple #17
0
 public virtual void OnSCPointerUp(InputDevicePartBase part, SCPointEventData eventData)
 {
     exitbox();
 }
Exemple #18
0
 public override void OnSCPointerEnter(InputDevicePartBase part, SCPointEventData eventData)
 {
     part.inputDeviceUIBase.model.lineIndicate.focus.endOfPointWhenTarget.AutoClickAnimationStart(autoClickTime);
     coroutineAddKey = StartCoroutine(AddKey(part, eventData));
 }
 public override void OnFunctionKeyDown(InputDeviceHandShankPart part, SCPointEventData eventData)
 {
     base.OnFunctionKeyDown(part, eventData);
     GetComponent <MeshRenderer>().material.color = Color.blue;
 }
 public override void OnSCPointerDrag(InputDevicePartBase part, SCPointEventData eventData)
 {
     transform.position = eventData.dragSlowPosition;
 }
Exemple #21
0
    public void OnSCBothHandPointerDown(InputDevicePartBase part1, SCPointEventData part1EventData, InputDevicePartBase part2, SCPointEventData part2EventData)
    {
        switch (editType)
        {
        case EditTypeEnum.ALLEDIT:
            isBoth = true;
            changeLine();
            break;
        }
        switch (editType)
        {
        case EditTypeEnum.ALLEDIT:
            break;

        case EditTypeEnum.DEFECT:
            break;

        case EditTypeEnum.NORMAL:
            break;
        }

        initDis     = SvrManager.Instance.head.InverseTransformPoint(part1.inputDeviceUIBase.model.lineIndicate.StartPoint.position).x - SvrManager.Instance.head.InverseTransformPoint(part2.inputDeviceUIBase.model.lineIndicate.StartPoint.position).x;
        initDisRot  = SvrManager.Instance.head.InverseTransformPoint(part1.inputDeviceUIBase.model.lineIndicate.StartPoint.position).z - SvrManager.Instance.head.InverseTransformPoint(part2.inputDeviceUIBase.model.lineIndicate.StartPoint.position).z;
        scale3      = this.transform.localScale;
        this.sScale = this.scaleGameList[0].transform.localScale;
        this.rScale = this.eulerGameList[0].transform.localScale;
        initBothRot = this.transform.eulerAngles;
    }
 public override void OnSCPointerUp(InputDevicePartBase part, SCPointEventData eventData)
 {
     base.OnSCPointerUp(part, eventData);
     initv2 = mr.material.GetTextureOffset("_MainTex");
 }
Exemple #23
0
 public void OnSCBothHandPointerUp(InputDevicePartBase part1, SCPointEventData part1EventData, InputDevicePartBase part2, SCPointEventData part2EventData)
 {
     isBoth = false;
     this.parentGame.transform.eulerAngles = this.transform.eulerAngles;
     isMove = false;
     // this.changeLine();
 }
 public override void OnSCPointerDrag(InputDevicePartBase part, SCPointEventData eventData)
 {
     base.OnSCPointerDrag(part, eventData);
 }
Exemple #25
0
 override public void OnSCPointerDown(InputDevicePartBase part, SCPointEventData eventData)
 {
     onDown();
     dragInitLocalPosition = eventData.dragPosition;
     //Debug.Log("xlv3Down===========》" + dragInitLocalPosition);
 }
Exemple #26
0
 override public void OnSCPointerEnter(InputDevicePartBase part, SCPointEventData eventData)
 {
     isOpen = true;
 }
Exemple #27
0
    override public void OnSCPointerDrag(InputDevicePartBase part, SCPointEventData eventData)
    {
        if (!dc.isBoth && !dc.isMove && isDown)
        {
            float   temp     = 0;
            float   temp2    = 0;
            float   temp3    = 0;
            Vector3 poslocal = eventData.dragPosition;
            Vector3 xlv3     = GetNormal(dragInitLocalPosition, poslocal);
            //Debug.Log("xlv3===========》"+xlv3);
            //  xlv3 = new Vector3(xlv3.x, xlv3.y, 0);
            // xlv3 = dc.testRot2.transform.InverseTransformPoint(xlv3);
            temp  = xlv3.x;
            temp2 = xlv3.y;
            temp3 = xlv3.z;
            float xishu = 0.7f;
            switch (index)
            {
            case 0:
                perValue = (1 + (temp + temp2 + temp3) * xishu);
                break;

            case 1:
                perValue = (1 + (temp + temp2 - temp3) * xishu);
                break;

            case 2:
                perValue = (1 + (-temp + temp2 + temp3) * xishu);
                break;

            case 3:
                perValue = (1 + (-temp + temp2 - temp3) * xishu);
                break;

            case 4:
                perValue = (1 + (temp - temp2 - temp3) * xishu);
                break;

            case 5:
                perValue = (1 + (temp - temp2 - temp3) * xishu);
                break;

            case 6:
                perValue = (1 + (-temp - temp2 + temp3) * xishu);
                break;

            case 7:
                perValue = (1 + (-temp - temp2 - temp3) * xishu);
                break;
            }
            if ((dc.scale3 * perValue).x > (dc.Tscale3 / 5).x && (dc.scale3 * perValue).x < (dc.Tscale3 * 5).x)
            {
                dc.transform.localScale = dc.scale3 * (perValue);
                dc.lr.widthMultiplier   = dc.LineSize * (perValue);
                if (dc.transform != dc.editGame.transform.parent)
                {
                    for (int i = 0; i < dc.veces.Length; i++)
                    {
                        dc.scaleGameList[i].transform.localScale = dc.sScale * (perValue);
                    }
                    for (int i = 0; i < 12; i++)
                    {
                        dc.eulerGameList[i].transform.localScale = dc.rScale * (perValue);
                    }
                }
            }
            dc.changeLine();
        }
        else
        {
            dc.isFangda = false;
        }
    }
Exemple #28
0
 override public void OnSCPointerDown(InputDevicePartBase part, SCPointEventData eventData)
 {
     dragInitLocalPosition = eventData.dragPosition;
     Debug.Log("Down=======>" + dragInitLocalPosition.x.ToString() + dragInitLocalPosition.y.ToString() + dragInitLocalPosition.z.ToString());
     onDown();
 }