Refactor and add new gamepad action binding handling in App.tsx
This commit is contained in:
@@ -4190,7 +4190,7 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
||||
};
|
||||
|
||||
const handlePlayerStartKeyboardBindingChange = (
|
||||
action: PlayerStartMovementAction,
|
||||
action: PlayerStartInputAction,
|
||||
nextCode: PlayerStartKeyboardBindingCode
|
||||
) => {
|
||||
const nextBindings = createPlayerStartInputBindings({
|
||||
@@ -4209,7 +4209,7 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
||||
);
|
||||
};
|
||||
|
||||
const handlePlayerStartGamepadBindingChange = (
|
||||
const handlePlayerStartMovementGamepadBindingChange = (
|
||||
action: PlayerStartMovementAction,
|
||||
nextBinding: PlayerStartGamepadBinding
|
||||
) => {
|
||||
@@ -4229,6 +4229,26 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
||||
);
|
||||
};
|
||||
|
||||
const handlePlayerStartGamepadActionBindingChange = (
|
||||
action: PlayerStartLocomotionAction,
|
||||
nextBinding: PlayerStartGamepadActionBinding
|
||||
) => {
|
||||
const nextBindings = createPlayerStartInputBindings({
|
||||
keyboard: playerStartInputBindingsDraft.keyboard,
|
||||
gamepad: {
|
||||
...playerStartInputBindingsDraft.gamepad,
|
||||
[action]: nextBinding
|
||||
} as PlayerStartInputBindings["gamepad"]
|
||||
});
|
||||
|
||||
setPlayerStartInputBindingsDraft(nextBindings);
|
||||
scheduleDraftCommit(() =>
|
||||
applyPlayerStartChange({
|
||||
inputBindings: nextBindings
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
const handlePlayerStartGamepadCameraLookBindingChange = (
|
||||
nextBinding: PlayerStartGamepadCameraLookBinding
|
||||
) => {
|
||||
|
||||
Reference in New Issue
Block a user