protected virtual void ProcessDrag(PlayerPointerEventData pointerEvent) { if (!pointerEvent.IsPointerMoving() || pointerEvent.pointerDrag == null) { return; } if (pointerEvent.sourceType == PointerEventType.Mouse && GetMouseInputSource(pointerEvent.playerId, pointerEvent.inputSourceIndex).locked) { return; } if (!pointerEvent.dragging && ShouldStartDrag(pointerEvent.pressPosition, pointerEvent.position, eventSystem.pixelDragThreshold, pointerEvent.useDragThreshold)) { ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.beginDragHandler); pointerEvent.dragging = true; } // Drag notification if (pointerEvent.dragging) { // Before doing drag we should cancel any pointer down state // And clear selection! if (pointerEvent.pointerPress != pointerEvent.pointerDrag) { ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler); pointerEvent.eligibleForClick = false; pointerEvent.pointerPress = null; pointerEvent.rawPointerPress = null; } ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.dragHandler); } }
// Token: 0x06002D44 RID: 11588 RVA: 0x0013AB70 File Offset: 0x00138D70 protected virtual void ProcessDrag(PlayerPointerEventData pointerEvent) { if (!pointerEvent.IsPointerMoving() || pointerEvent.pointerDrag == null) { return; } if (pointerEvent.sourceType == PointerEventType.Mouse && this.GetMouseInputSource(pointerEvent.playerId, pointerEvent.inputSourceIndex).locked) { return; } if (!pointerEvent.dragging && RewiredPointerInputModule.ShouldStartDrag(pointerEvent.pressPosition, pointerEvent.position, (float)base.eventSystem.pixelDragThreshold, pointerEvent.useDragThreshold)) { ExecuteEvents.Execute <IBeginDragHandler>(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.beginDragHandler); pointerEvent.dragging = true; } if (pointerEvent.dragging) { if (pointerEvent.pointerPress != pointerEvent.pointerDrag) { ExecuteEvents.Execute <IPointerUpHandler>(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler); pointerEvent.eligibleForClick = false; pointerEvent.pointerPress = null; pointerEvent.rawPointerPress = null; } ExecuteEvents.Execute <IDragHandler>(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.dragHandler); } }
protected virtual void ProcessMove(PlayerPointerEventData pointerEvent) { GameObject gameObject1; if (pointerEvent.sourceType == PointerEventType.Mouse) { GameObject gameObject2; if (this.GetMouseInputSource(pointerEvent.playerId, pointerEvent.inputSourceIndex).get_locked()) { gameObject2 = (GameObject)null; } else { RaycastResult pointerCurrentRaycast = pointerEvent.get_pointerCurrentRaycast(); gameObject2 = ((RaycastResult) ref pointerCurrentRaycast).get_gameObject(); } gameObject1 = gameObject2; } else { if (pointerEvent.sourceType != PointerEventType.Touch) { throw new NotImplementedException(); } RaycastResult pointerCurrentRaycast = pointerEvent.get_pointerCurrentRaycast(); gameObject1 = ((RaycastResult) ref pointerCurrentRaycast).get_gameObject(); } this.HandlePointerExitAndEnter((PointerEventData)pointerEvent, gameObject1); }
protected virtual void ProcessMove(PlayerPointerEventData pointerEvent) { GameObject targetGO; if (pointerEvent.sourceType == PointerEventType.Mouse) { IMouseInputSource source = GetMouseInputSource(pointerEvent.playerId, pointerEvent.inputSourceIndex); if (source != null) { targetGO = !source.enabled || source.locked ? null : pointerEvent.pointerCurrentRaycast.gameObject; } else { targetGO = null; } } else if (pointerEvent.sourceType == PointerEventType.Touch) { targetGO = pointerEvent.pointerCurrentRaycast.gameObject; } else { throw new NotImplementedException(); } HandlePointerExitAndEnter(pointerEvent, targetGO); }
// Token: 0x06002D3E RID: 11582 RVA: 0x0013A764 File Offset: 0x00138964 protected void RemovePointerData(PlayerPointerEventData data) { Dictionary <int, PlayerPointerEventData>[] array; if (this.m_PlayerPointerData.TryGetValue(data.playerId, out array) && data.inputSourceIndex < array.Length) { array[data.inputSourceIndex].Remove(data.pointerId); } }
protected void RemovePointerData(PlayerPointerEventData data) { Dictionary <int, PlayerPointerEventData>[] dictionaryArray; if (!this.m_PlayerPointerData.TryGetValue(data.playerId, out dictionaryArray) || (uint)data.inputSourceIndex >= (uint)dictionaryArray.Length) { return; } dictionaryArray[data.inputSourceIndex].Remove(data.get_pointerId()); }
public void SetButtonState( int button, PointerEventData.FramePressState stateForMouseButton, PlayerPointerEventData data) { RewiredPointerInputModule.ButtonState buttonState = this.GetButtonState(button); buttonState.eventData.buttonState = stateForMouseButton; buttonState.eventData.buttonData = data; }
protected void RemovePointerData(PlayerPointerEventData data) { Dictionary <int, PlayerPointerEventData>[] pointerDataByIndex; if (m_PlayerPointerData.TryGetValue(data.playerId, out pointerDataByIndex)) { if ((uint)data.inputSourceIndex < (uint)pointerDataByIndex.Length) { pointerDataByIndex[data.inputSourceIndex].Remove(data.pointerId); } } }
private PlayerPointerEventData CreatePointerEventData( int playerId, int pointerIndex, int pointerTypeId, PointerEventType pointerEventType) { PlayerPointerEventData pointerEventData1 = new PlayerPointerEventData(this.get_eventSystem()); pointerEventData1.playerId = playerId; pointerEventData1.inputSourceIndex = pointerIndex; pointerEventData1.set_pointerId(pointerTypeId); pointerEventData1.sourceType = pointerEventType; PlayerPointerEventData pointerEventData2 = pointerEventData1; switch (pointerEventType) { case PointerEventType.Mouse: pointerEventData2.mouseSource = this.GetMouseInputSource(playerId, pointerIndex); break; case PointerEventType.Touch: pointerEventData2.touchSource = this.GetTouchInputSource(playerId, pointerIndex); break; } switch (pointerTypeId) { case -3: pointerEventData2.buttonIndex = 2; break; case -2: pointerEventData2.buttonIndex = 1; break; case -1: pointerEventData2.buttonIndex = 0; break; default: if (pointerTypeId >= -2147483520 && pointerTypeId <= -2147483392) { pointerEventData2.buttonIndex = pointerTypeId - -2147483520; break; } break; } return(pointerEventData2); }
// Token: 0x06002D43 RID: 11587 RVA: 0x0013AB04 File Offset: 0x00138D04 protected virtual void ProcessMove(PlayerPointerEventData pointerEvent) { GameObject newEnterTarget; if (pointerEvent.sourceType == PointerEventType.Mouse) { newEnterTarget = (this.GetMouseInputSource(pointerEvent.playerId, pointerEvent.inputSourceIndex).locked ? null : pointerEvent.pointerCurrentRaycast.gameObject); } else { if (pointerEvent.sourceType != PointerEventType.Touch) { throw new NotImplementedException(); } newEnterTarget = pointerEvent.pointerCurrentRaycast.gameObject; } base.HandlePointerExitAndEnter(pointerEvent, newEnterTarget); }
protected bool GetPointerData( int playerId, int pointerIndex, int pointerTypeId, out PlayerPointerEventData data, bool create, PointerEventType pointerEventType) { Dictionary <int, PlayerPointerEventData>[] dictionaryArray1; if (!this.m_PlayerPointerData.TryGetValue(playerId, out dictionaryArray1)) { dictionaryArray1 = new Dictionary <int, PlayerPointerEventData> [pointerIndex + 1]; for (int index = 0; index < dictionaryArray1.Length; ++index) { dictionaryArray1[index] = new Dictionary <int, PlayerPointerEventData>(); } this.m_PlayerPointerData.Add(playerId, dictionaryArray1); } if (pointerIndex >= dictionaryArray1.Length) { Dictionary <int, PlayerPointerEventData>[] dictionaryArray2 = new Dictionary <int, PlayerPointerEventData> [pointerIndex + 1]; for (int index = 0; index < dictionaryArray1.Length; ++index) { dictionaryArray2[index] = dictionaryArray1[index]; } dictionaryArray2[pointerIndex] = new Dictionary <int, PlayerPointerEventData>(); dictionaryArray1 = dictionaryArray2; this.m_PlayerPointerData[playerId] = dictionaryArray1; } Dictionary <int, PlayerPointerEventData> dictionary = dictionaryArray1[pointerIndex]; if (!dictionary.TryGetValue(pointerTypeId, out data) && create) { data = this.CreatePointerEventData(playerId, pointerIndex, pointerTypeId, pointerEventType); dictionary.Add(pointerTypeId, data); return(true); } data.mouseSource = pointerEventType != PointerEventType.Mouse ? (IMouseInputSource)null : this.GetMouseInputSource(playerId, pointerIndex); data.touchSource = pointerEventType != PointerEventType.Touch ? (ITouchInputSource)null : this.GetTouchInputSource(playerId, pointerIndex); return(false); }
private PlayerPointerEventData CreatePointerEventData(int playerId, int pointerIndex, int pointerTypeId, PointerEventType pointerEventType) { PlayerPointerEventData data = new PlayerPointerEventData(eventSystem) { playerId = playerId, inputSourceIndex = pointerIndex, pointerId = pointerTypeId, sourceType = pointerEventType }; if (pointerEventType == PointerEventType.Mouse) { data.mouseSource = GetMouseInputSource(playerId, pointerIndex); // this can change in the future but it will be updated on Get } else if (pointerEventType == PointerEventType.Touch) { data.touchSource = GetTouchInputSource(playerId, pointerIndex); // this can change in the future but it will be updated on Get } // Get the button index from the pointerTypeId if (pointerTypeId == kMouseLeftId) { data.buttonIndex = 0; } else if (pointerTypeId == kMouseRightId) { data.buttonIndex = 1; } else if (pointerTypeId == kMouseMiddleId) { data.buttonIndex = 2; } else { // encoded custom buttons if (pointerTypeId >= customButtonsStartingId && pointerTypeId <= customButtonsLastId) { data.buttonIndex = pointerTypeId - customButtonsStartingId; } } return(data); }
protected virtual void ProcessDrag(PlayerPointerEventData pointerEvent) { if (!pointerEvent.IsPointerMoving() || Object.op_Equality((Object)pointerEvent.get_pointerDrag(), (Object)null) || pointerEvent.sourceType == PointerEventType.Mouse && this.GetMouseInputSource(pointerEvent.playerId, pointerEvent.inputSourceIndex).get_locked()) { return; } if (!pointerEvent.get_dragging() && RewiredPointerInputModule.ShouldStartDrag(pointerEvent.get_pressPosition(), pointerEvent.get_position(), (float)this.get_eventSystem().get_pixelDragThreshold(), pointerEvent.get_useDragThreshold())) { ExecuteEvents.Execute <IBeginDragHandler>(pointerEvent.get_pointerDrag(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_beginDragHandler()); pointerEvent.set_dragging(true); } if (!pointerEvent.get_dragging()) { return; } if (Object.op_Inequality((Object)pointerEvent.get_pointerPress(), (Object)pointerEvent.get_pointerDrag())) { ExecuteEvents.Execute <IPointerUpHandler>(pointerEvent.get_pointerPress(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_pointerUpHandler()); pointerEvent.set_eligibleForClick(false); pointerEvent.set_pointerPress((GameObject)null); pointerEvent.set_rawPointerPress((GameObject)null); } ExecuteEvents.Execute <IDragHandler>(pointerEvent.get_pointerDrag(), (BaseEventData)pointerEvent, (ExecuteEvents.EventFunction <M0>)ExecuteEvents.get_dragHandler()); }
// Token: 0x06002D3D RID: 11581 RVA: 0x0013A6C0 File Offset: 0x001388C0 private PlayerPointerEventData CreatePointerEventData(int playerId, int pointerIndex, int pointerTypeId, PointerEventType pointerEventType) { PlayerPointerEventData playerPointerEventData = new PlayerPointerEventData(base.eventSystem) { playerId = playerId, inputSourceIndex = pointerIndex, pointerId = pointerTypeId, sourceType = pointerEventType }; if (pointerEventType == PointerEventType.Mouse) { playerPointerEventData.mouseSource = this.GetMouseInputSource(playerId, pointerIndex); } else if (pointerEventType == PointerEventType.Touch) { playerPointerEventData.touchSource = this.GetTouchInputSource(playerId, pointerIndex); } if (pointerTypeId == -1) { playerPointerEventData.buttonIndex = 0; } else if (pointerTypeId == -2) { playerPointerEventData.buttonIndex = 1; } else if (pointerTypeId == -3) { playerPointerEventData.buttonIndex = 2; } else if (pointerTypeId >= -2147483520 && pointerTypeId <= -2147483392) { playerPointerEventData.buttonIndex = pointerTypeId - -2147483520; } return(playerPointerEventData); }
// Token: 0x06002D3C RID: 11580 RVA: 0x0013A5D8 File Offset: 0x001387D8 protected bool GetPointerData(int playerId, int pointerIndex, int pointerTypeId, out PlayerPointerEventData data, bool create, PointerEventType pointerEventType) { Dictionary <int, PlayerPointerEventData>[] array; if (!this.m_PlayerPointerData.TryGetValue(playerId, out array)) { array = new Dictionary <int, PlayerPointerEventData> [pointerIndex + 1]; for (int i = 0; i < array.Length; i++) { array[i] = new Dictionary <int, PlayerPointerEventData>(); } this.m_PlayerPointerData.Add(playerId, array); } if (pointerIndex >= array.Length) { Dictionary <int, PlayerPointerEventData>[] array2 = new Dictionary <int, PlayerPointerEventData> [pointerIndex + 1]; for (int j = 0; j < array.Length; j++) { array2[j] = array[j]; } array2[pointerIndex] = new Dictionary <int, PlayerPointerEventData>(); array = array2; this.m_PlayerPointerData[playerId] = array; } Dictionary <int, PlayerPointerEventData> dictionary = array[pointerIndex]; if (!dictionary.TryGetValue(pointerTypeId, out data) && create) { data = this.CreatePointerEventData(playerId, pointerIndex, pointerTypeId, pointerEventType); dictionary.Add(pointerTypeId, data); return(true); } data.mouseSource = ((pointerEventType == PointerEventType.Mouse) ? this.GetMouseInputSource(playerId, pointerIndex) : null); data.touchSource = ((pointerEventType == PointerEventType.Touch) ? this.GetTouchInputSource(playerId, pointerIndex) : null); return(false); }
protected bool GetPointerData(int playerId, int pointerIndex, int pointerTypeId, out PlayerPointerEventData data, bool create, PointerEventType pointerEventType) { // Get or create the by Player dictionary Dictionary <int, PlayerPointerEventData>[] pointerDataByIndex; if (!m_PlayerPointerData.TryGetValue(playerId, out pointerDataByIndex)) { pointerDataByIndex = new Dictionary <int, PlayerPointerEventData> [pointerIndex + 1]; for (int i = 0; i < pointerDataByIndex.Length; i++) { pointerDataByIndex[i] = new Dictionary <int, PlayerPointerEventData>(); } m_PlayerPointerData.Add(playerId, pointerDataByIndex); } // Expand array if necessary if (pointerIndex >= pointerDataByIndex.Length) // array is not large enough, expand it { Dictionary <int, PlayerPointerEventData>[] newArray = new Dictionary <int, PlayerPointerEventData> [pointerIndex + 1]; for (int i = 0; i < pointerDataByIndex.Length; i++) { newArray[i] = pointerDataByIndex[i]; } newArray[pointerIndex] = new Dictionary <int, PlayerPointerEventData>(); pointerDataByIndex = newArray; m_PlayerPointerData[playerId] = pointerDataByIndex; } // Get or create the pointer event data Dictionary <int, PlayerPointerEventData> byMouseIndexDict = pointerDataByIndex[pointerIndex]; if (!byMouseIndexDict.TryGetValue(pointerTypeId, out data)) { if (!create) { return(false); } data = CreatePointerEventData(playerId, pointerIndex, pointerTypeId, pointerEventType); // create the event data byMouseIndexDict.Add(pointerTypeId, data); return(true); } // Update the input sources data.mouseSource = pointerEventType == PointerEventType.Mouse ? GetMouseInputSource(playerId, pointerIndex) : null; data.touchSource = pointerEventType == PointerEventType.Touch ? GetTouchInputSource(playerId, pointerIndex) : null; return(false); }
public void SetButtonState(int button, PointerEventData.FramePressState stateForMouseButton, PlayerPointerEventData data) { var toModify = GetButtonState(button); toModify.eventData.buttonState = stateForMouseButton; toModify.eventData.buttonData = data; }