private void OnLock() { bool bSendEvent = false; List <string> mappedKeys = new List <string>(_BoundInputValues.Keys); foreach (string mapKey in mappedKeys) { _PrevBoundInputValues[mapKey] = _BoundInputValues[mapKey]; _BoundInputValues[mapKey] = UInput.GetAxis(mapKey); bSendEvent = bSendEvent || (_PrevBoundInputValues[mapKey] != _BoundInputValues[mapKey]); } if (bSendEvent) { RetroEvents.Chapter("Input_" + BoundInputID.ToString()).Set(new AxisInputEvent(_BoundInputValues, Time.deltaTime, false, BoundInputID)); } }
protected override bool PollHeld(MouseButton inputBind) { bool bRet = UInput.GetMouseButton((int)inputBind); RetroEvents.Chapter("Input_" + BoundInputID.ToString()).Set(new KeyInputEvent(bRet, Time.deltaTime, false, BoundInputID)); return(bRet); }
protected override bool PollHeld(KeyCode inputBind) { bool bRet = UInput.GetKey(inputBind); RetroEvents.Chapter("Input_" + BoundInputID.ToString()).Set(new KeyInputEvent(bRet, Time.deltaTime, IsJoystick, BoundInputID)); return(bRet); }
private void OnNoLock() { List <string> mappedKeys = new List <string>(_BoundInputValues.Keys); foreach (string mapKey in mappedKeys) { _BoundInputValues[mapKey] = UInput.GetAxis(mapKey); } RetroEvents.Chapter("Input_" + BoundInputID.ToString()).Set(new AxisInputEvent(_BoundInputValues, Time.deltaTime, false, BoundInputID)); }
protected override bool PollPressed(MouseButton inputBind) { bool bRet = UInput.GetMouseButtonDown((int)inputBind); if (bRet) { RetroEvents.Chapter("Input_" + BoundInputID.ToString()).Set(new KeyInputEvent(true, Time.deltaTime, false, BoundInputID)); } return(bRet); }
protected override bool PollReleased(KeyCode inputBind) { bool bRet = UInput.GetKeyUp(inputBind); if (bRet) { RetroEvents.Chapter("Input_" + BoundInputID.ToString()).Set(new KeyInputEvent(false, Time.deltaTime, IsJoystick, BoundInputID)); } return(bRet); }
private void UnbindActionInternal <E>(T BindKey, IReader inputReader) where E : InputEvent { RetroEvents.Chapter("Input_" + BindKey.ToString()).Unsubscribe <E>(inputReader); }
public virtual void UnregisterInput() { if (FocusedJoystick == null || _bRegistered == false) { return; } input.UnregisterKey(JoystickID + "TopFace", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.TopFaceButton), BroadcastKeyState.PRESSED); input.UnregisterKey(JoystickID + "LeftFace", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.LeftFaceButton), BroadcastKeyState.PRESSED); input.UnregisterKey(JoystickID + "RightFace", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.RightFaceButton), BroadcastKeyState.PRESSED); input.UnregisterKey(JoystickID + "BottomFace", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.BottomFaceButton), BroadcastKeyState.PRESSED); input.UnregisterKey(JoystickID + "LeftBump", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.LeftShoulderButton), BroadcastKeyState.PRESSED); input.UnregisterKey(JoystickID + "RightBump", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.RightShoulderButton), BroadcastKeyState.PRESSED); input.UnregisterKey(JoystickID + "Start", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.StartButton), BroadcastKeyState.PRESSED); input.UnregisterKey(JoystickID + "Select", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.SelectButton), BroadcastKeyState.PRESSED); input.UnregisterKey(JoystickID + "Home", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.HomeButton), BroadcastKeyState.PRESSED); input.UnregisterKey(JoystickID + "LeftAnalogClick", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.LeftAnalogButton), BroadcastKeyState.PRESSED); input.UnregisterKey(JoystickID + "RightAnalogClick", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.RightAnalogButton), BroadcastKeyState.PRESSED); input.UnregisterKey(JoystickID + "TopFace", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.TopFaceButton), BroadcastKeyState.RELEASED); input.UnregisterKey(JoystickID + "LeftFace", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.LeftFaceButton), BroadcastKeyState.RELEASED); input.UnregisterKey(JoystickID + "RightFace", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.RightFaceButton), BroadcastKeyState.RELEASED); input.UnregisterKey(JoystickID + "BottomFace", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.BottomFaceButton), BroadcastKeyState.RELEASED); input.UnregisterKey(JoystickID + "LeftBump", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.LeftShoulderButton), BroadcastKeyState.RELEASED); input.UnregisterKey(JoystickID + "RightBump", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.RightShoulderButton), BroadcastKeyState.RELEASED); input.UnregisterKey(JoystickID + "Start", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.StartButton), BroadcastKeyState.RELEASED); input.UnregisterKey(JoystickID + "Select", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.SelectButton), BroadcastKeyState.RELEASED); input.UnregisterKey(JoystickID + "Home", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.HomeButton), BroadcastKeyState.RELEASED); input.UnregisterKey(JoystickID + "LeftAnalogClick", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.LeftAnalogButton), BroadcastKeyState.RELEASED); input.UnregisterKey(JoystickID + "RightAnalogClick", JoystickAssigner.JoystickKeycode(JoystickID, LayoutMap.RightAnalogButton), BroadcastKeyState.RELEASED); input.UnregisterAxis(JoystickID + "LeftAnalog", false, JoystickID + LayoutMap.LeftAnalogAxisX, JoystickID + LayoutMap.LeftAnalogAxisY); input.UnregisterAxis(JoystickID + "RightAnalog", false, JoystickID + LayoutMap.RightAnalogAxisX, JoystickID + LayoutMap.RightAnalogAxisY); input.UnregisterAxis(JoystickID + "DPad", false, JoystickID + LayoutMap.DirectionAxisX, JoystickID + LayoutMap.DirectionAxisY); input.UnregisterAxis(JoystickID + "LeftTrigger", false, JoystickID + LayoutMap.LeftTriggerAxis); input.UnregisterAxis(JoystickID + "RightTrigger", false, JoystickID + LayoutMap.RightTriggerAxis); // listen for the input events RetroEvents.Chapter("Input_" + JoystickID + "TopFace").Unsubscribe <KeyInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "LeftFace").Unsubscribe <KeyInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "RightFace").Unsubscribe <KeyInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "BottomFace").Unsubscribe <KeyInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "LeftBump").Unsubscribe <KeyInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "RightBump").Unsubscribe <KeyInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "Start").Unsubscribe <KeyInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "Select").Unsubscribe <KeyInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "Home").Unsubscribe <KeyInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "LeftAnalogClick").Unsubscribe <KeyInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "RightAnalogClick").Unsubscribe <KeyInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "LeftAnalog").Unsubscribe <AxisInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "RightAnalog").Unsubscribe <AxisInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "DPad").Unsubscribe <AxisInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "LeftTrigger").Unsubscribe <AxisInputEvent>(this); RetroEvents.Chapter("Input_" + JoystickID + "RightTrigger").Unsubscribe <AxisInputEvent>(this); // handle custom keys foreach (KeyValuePair <string, KeyBind> pair in LayoutMap.CustomKeyBind.D) { input.UnregisterKey(JoystickID + pair.Key, JoystickAssigner.JoystickKeycode(JoystickID, pair.Value.PlatformKeyID), BroadcastKeyState.HELD); RetroEvents.Chapter("Input_" + JoystickID + pair.Key).Unsubscribe <KeyInputEvent>(this); } // handle custom axis foreach (KeyValuePair <string, AxisBind> pair in LayoutMap.CustomAxisBind.D) { input.UnregisterAxis(JoystickID + pair.Key, false, JoystickID + pair.Value.PlatformAxisID); RetroEvents.Chapter("Input_" + JoystickID + pair.Key).Unsubscribe <AxisInputEvent>(this); } _bRegistered = false; }