public override TouchControllersState HandlerFindTouch(TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { Touch[] touchOne = touches.touchOne; Touch[] touchTwo = touches.touchTwo; Touch[] touchTree = touches.touchTree; if (stateT == TouchControllersState.TCS_None) { if (touchOne != null && touchTwo == null) { /* * Начало Драга: * Случай 1: (1 B)(1 S) + S(>0.3C) */ if ((touchOne[1].phase == TouchPhase.Began || touchOne[0].phase == TouchPhase.Stationary) && checkingRay(touchOne[0].position)) { stateT = TouchControllersState.TCS_Start; return(stateT); } } } else if (stateT == TouchControllersState.TCS_Start) { stateT = TouchControllersState.TCS_Action; return(stateT); } else if (stateT == TouchControllersState.TCS_Action) { /* * Драг * Случай 1: (1 M) * Конец Драга: * Случай 1: (1 E) */ if ((touchOne == null || touchTwo != null || touchOne[0].phase == TouchPhase.Ended)) { touchOneStateTime = 0; stateT = TouchControllersState.TCS_End; return(stateT); } } else if (stateT == TouchControllersState.TCS_End) { stateT = TouchControllersState.TCS_None; return(stateT); } return(stateT); }
public override void HandlerActionTouch(TouchControllersState state, TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { Touch[] touchOne = touches.touchOne; Touch[] touchTwo = touches.touchTwo; Touch[] touchTree = touches.touchTree; Vector3 point1 = Vector3.zero; Vector3 point1Delta = Vector3.zero; if (touchOne != null) { point1 = touchOne[0].position; point1Delta = touchOne[0].deltaPosition; } DragEvent(stateT, point1, point1Delta, touchOneStateTime); }
public virtual void BreakTouch(TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { }
public override void BreakTouch(TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { if (stateT == TouchControllersState.TCS_End) { return; } Touch[] touchOne = touches.touchOne; Touch[] touchTwo = touches.touchTwo; Touch[] touchTree = touches.touchTree; Vector3 point1 = Vector3.zero; Vector3 point1Delta = Vector3.zero; if (touchOne != null) { point1 = touchOne[0].position; point1Delta = touchOne[0].deltaPosition; } DragModel dragModel = new DragModel() { stateT = stateT, EventTime = touchOneStateTime, point1 = point1, point1Delta = point1Delta }; if (stateT == TouchControllersState.TCS_Start) { MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Drag, dragModel); dragModel.stateT = TouchControllersState.TCS_Action; MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Drag, dragModel); dragModel.stateT = TouchControllersState.TCS_End; MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Drag, dragModel); } else if (stateT == TouchControllersState.TCS_Action) { MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Drag, dragModel); dragModel.stateT = TouchControllersState.TCS_End; MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Drag, dragModel); } }
public virtual TouchControllersState HandlerFindTouch(TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { return(TouchControllersState.TCS_None); }
public virtual void HandlerActionTouch(TouchControllersState state, TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { }
public override TouchControllersState HandlerFindTouch(TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { Touch[] touchOne = touches.touchOne; Touch[] touchTwo = touches.touchTwo; Touch[] touchTree = touches.touchTree; #if UNITY_EDITOR mouseScrollWheelOld = mouseScrollWheel; mouseScrollWheel += Input.GetAxis("Mouse ScrollWheel"); #endif if (stateT == TouchControllersState.TCS_None) { #if UNITY_EDITOR if (Input.GetMouseButton(1) && !MouseButtonState) { MouseButtonState = true; mouseScrollWheel = 0.0f; Start_editorMousposition = Input.mousePosition; stateT = TouchControllersState.TCS_Start; return(stateT); } #endif if (touchTwo != null && touchOne != null) { /* * Начало зума: * Случай 1: (1 M)+(2 M) * Случай 2: (1 M)+(2 S) * Случай 3: (1 S)+(2 S) * Случай 4: (1 S)+(2 M) */ if ((touchOne[0].phase == TouchPhase.Moved && touchTwo[0].phase == TouchPhase.Moved) || (touchOne[0].phase == TouchPhase.Moved && touchTwo[0].phase == TouchPhase.Stationary) || (touchOne[0].phase == TouchPhase.Stationary && touchTwo[0].phase == TouchPhase.Stationary) || (touchOne[0].phase == TouchPhase.Stationary && touchTwo[0].phase == TouchPhase.Moved)) { stateT = TouchControllersState.TCS_Start; return(stateT); } } } else if (stateT == TouchControllersState.TCS_Start) { stateT = TouchControllersState.TCS_Action; return(stateT); } else if (stateT == TouchControllersState.TCS_Action) { #if UNITY_EDITOR if (!Input.GetMouseButton(1) && MouseButtonState) { MouseButtonState = false; stateT = TouchControllersState.TCS_End; return(stateT); } #endif /* * Зум * Случай 1: (1 M)+(2 M) * Случай 2: (1 M)+(2 S) * Случай 3: (1 S)+(2 M) */ /* * Конец зума: * Случай 1: (1 M)+(2 E) * Случай 2: (1 S)+(2 E) * Случай 3: (1 E)+(2 S) * Случай 4: (1 E)+(2 M) */ if (touchTwo == null || touchOne == null || ((touchOne[0].phase == TouchPhase.Moved && touchTwo[0].phase == TouchPhase.Ended) || (touchOne[0].phase == TouchPhase.Stationary && touchTwo[0].phase == TouchPhase.Ended) || (touchOne[0].phase == TouchPhase.Ended && touchTwo[0].phase == TouchPhase.Stationary) || (touchOne[0].phase == TouchPhase.Ended && touchTwo[0].phase == TouchPhase.Moved) || (touchOne[0].phase == TouchPhase.Ended && touchTwo[0].phase == TouchPhase.Ended))) { stateT = TouchControllersState.TCS_End; return(stateT); } } else if (stateT == TouchControllersState.TCS_End) { #if UNITY_EDITOR MouseButtonState = false; #endif stateT = TouchControllersState.TCS_None; return(stateT); } return(stateT); }
public override TouchControllersState HandlerFindTouch(TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { Touch[] touchOne = touches.touchOne; Touch[] touchTwo = touches.touchTwo; Touch[] touchTree = touches.touchTree; if (stateT == TouchControllersState.TCS_None) { if (touchOne != null) { /* * Начало свайпа: * Случай 1: (1 B)(1 S)(1 M) * Случай 2: (1 B)(1 M) */ if ((/*touchOne[2].phase == TouchPhase.Began&&*/ touchOne[1].phase == TouchPhase.Stationary && touchOne[0].phase == TouchPhase.Moved) || (/*touchOne[2].phase == TouchPhase.Began &&*/ touchOne[0].phase == TouchPhase.Moved)) { stateT = TouchControllersState.TCS_Start; return(stateT); } } } else if (stateT == TouchControllersState.TCS_Start) { stateT = TouchControllersState.TCS_Action; return(stateT); } else if (stateT == TouchControllersState.TCS_Action) { /* * Свайп * Случай 1: (1 M) * Случай 2: (1 S) * Конец свайпа: * Случай 1: (1 M)(1 E) * Случай 1: (1 S)(1 E) */ if (touchOne == null || touchTwo != null || (touchOne[1].phase == TouchPhase.Stationary && touchOne[0].phase == TouchPhase.Ended) || (touchOne[1].phase == TouchPhase.Moved && touchOne[0].phase == TouchPhase.Ended)) { stateT = TouchControllersState.TCS_End; return(stateT); } } else if (stateT == TouchControllersState.TCS_End) { stateT = TouchControllersState.TCS_None; return(stateT); } return(stateT); }
public override void BreakTouch(TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { if (stateT == TouchControllersState.TCS_End) { return; } Touch[] touchOne = touches.touchOne; Touch[] touchTwo = touches.touchTwo; Touch[] touchTree = touches.touchTree; Vector3 point1 = Vector3.zero; Vector3 point2 = Vector3.zero; Vector3 point1Delta = Vector3.zero; Vector3 point2Delta = Vector3.zero; if (touchOne != null) { point1 = touchOne[0].position; point1Delta = touchOne[0].deltaPosition; } if (touchTwo != null) { point2 = touchTwo[0].position; point2Delta = touchTwo[0].deltaPosition; } ZoomModel zoom = new ZoomModel { point1 = point1, point1Delta = point1Delta, point2 = point2, point2Delta = point2Delta, stateT = stateT }; if (stateT == TouchControllersState.TCS_Start) { MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Zoom, zoom); zoom.stateT = TouchControllersState.TCS_Action; MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Zoom, zoom); zoom.stateT = TouchControllersState.TCS_End; MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Zoom, zoom); } else if (stateT == TouchControllersState.TCS_Action) { MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Zoom, zoom); zoom.stateT = TouchControllersState.TCS_End; MainContextView.DispatchStrangeEvent(EventGlobal.E_TouchAndMouseGestures_Zoom, zoom); } }
public override void HandlerActionTouch(TouchControllersState state, TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { Touch[] touchOne = touches.touchOne; Touch[] touchTwo = touches.touchTwo; Touch[] touchTree = touches.touchTree; Vector3 point1 = Vector3.zero; Vector3 point2 = Vector3.zero; Vector3 point1Delta = Vector3.zero; Vector3 point2Delta = Vector3.zero; if (touchOne != null) { point1 = touchOne[0].position; point1Delta = touchOne[0].deltaPosition; } if (touchTwo != null) { point2 = touchTwo[0].position; point2Delta = touchTwo[0].deltaPosition; } #if UNITY_EDITOR if (MouseButtonState) { point1 = Start_editorMousposition; point2 = Input.mousePosition + new Vector3(100.0f * -mouseScrollWheel, 100.0f * -mouseScrollWheel, 100.0f * -mouseScrollWheel); point1Delta = new Vector3(100.0f * (mouseScrollWheelOld - mouseScrollWheel), 100.0f * (mouseScrollWheelOld - mouseScrollWheel), 100.0f * (mouseScrollWheelOld - mouseScrollWheel)); point2Delta = new Vector3(100.0f * (mouseScrollWheelOld - mouseScrollWheel), 100.0f * (mouseScrollWheelOld - mouseScrollWheel), 100.0f * (mouseScrollWheelOld - mouseScrollWheel)); } #endif ZoomEvent(stateT, point1, point2, point1Delta, point2Delta); }
public override TouchControllersState HandlerFindTouch(TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { Touch[] touchOne = touches.touchOne; Touch[] touchTwo = touches.touchTwo; Touch[] touchTree = touches.touchTree; if (touchOne != null) { if (touchOne[0].phase == TouchPhase.Stationary) { return(TouchControllersState.TCS_Action); } } return(TouchControllersState.TCS_None); }
public override void HandlerActionTouch(TouchControllersState state, TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { Touch[] touchOne = touches.touchOne; Touch[] touchTwo = touches.touchTwo; Touch[] touchTree = touches.touchTree; Vector3 point1 = Vector3.zero; int tapCount = 0; if (touchOne != null) { point1 = touchOne[0].position; tapCount = touchOne[0].tapCount; TapEvent(state, point1, tapCount, checkingRay(point1)); } }
public override TouchControllersState HandlerFindTouch(TouchGroup touches, float touchOneStateMoveTime = 0.0f, float touchOneStateTime = 0.0f, CheckingRayIntoObject checkingRay = null) { Touch[] touchOne = touches.touchOne; Touch[] touchTwo = touches.touchTwo; Touch[] touchTree = touches.touchTree; if (touchOne != null) { if ((touchOne[2].phase == TouchPhase.Began && touchOne[1].phase == TouchPhase.Stationary && touchOne[0].phase == TouchPhase.Ended) || (touchOne[1].phase == TouchPhase.Began && touchOne[0].phase == TouchPhase.Ended) || (touchOne[2].phase == TouchPhase.Began && touchOne[1].phase == TouchPhase.Moved && touchOne[0].phase == TouchPhase.Ended && touchOneStateMoveTime < 0.15f)) { touchOneStateMoveTime = 10.0f; return(TouchControllersState.TCS_Action); } } return(TouchControllersState.TCS_None); }