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 = (
|
const handlePlayerStartKeyboardBindingChange = (
|
||||||
action: PlayerStartMovementAction,
|
action: PlayerStartInputAction,
|
||||||
nextCode: PlayerStartKeyboardBindingCode
|
nextCode: PlayerStartKeyboardBindingCode
|
||||||
) => {
|
) => {
|
||||||
const nextBindings = createPlayerStartInputBindings({
|
const nextBindings = createPlayerStartInputBindings({
|
||||||
@@ -4209,7 +4209,7 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePlayerStartGamepadBindingChange = (
|
const handlePlayerStartMovementGamepadBindingChange = (
|
||||||
action: PlayerStartMovementAction,
|
action: PlayerStartMovementAction,
|
||||||
nextBinding: PlayerStartGamepadBinding
|
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 = (
|
const handlePlayerStartGamepadCameraLookBindingChange = (
|
||||||
nextBinding: PlayerStartGamepadCameraLookBinding
|
nextBinding: PlayerStartGamepadCameraLookBinding
|
||||||
) => {
|
) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user