Refactor player start logic: Update default state values and simplify keyboard binding handlers
This commit is contained in:
@@ -2762,11 +2762,11 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
const [
|
const [
|
||||||
playerStartAllowLookInputTargetSwitchDraft,
|
playerStartAllowLookInputTargetSwitchDraft,
|
||||||
setPlayerStartAllowLookInputTargetSwitchDraft
|
setPlayerStartAllowLookInputTargetSwitchDraft
|
||||||
] = useState(DEFAULT_PLAYER_START_ALLOW_LOOK_INPUT_TARGET_SWITCH);
|
] = useState(DEFAULT_PLAYER_START_ALLOW_LOOK_INPUT_TARGET_SWITCH_VALUE);
|
||||||
const [
|
const [
|
||||||
playerStartTargetButtonCyclesActiveTargetDraft,
|
playerStartTargetButtonCyclesActiveTargetDraft,
|
||||||
setPlayerStartTargetButtonCyclesActiveTargetDraft
|
setPlayerStartTargetButtonCyclesActiveTargetDraft
|
||||||
] = useState(DEFAULT_PLAYER_START_TARGET_BUTTON_CYCLES_ACTIVE_TARGET);
|
] = useState(DEFAULT_PLAYER_START_TARGET_BUTTON_CYCLES_ACTIVE_TARGET_VALUE);
|
||||||
const [
|
const [
|
||||||
playerStartMovementTemplateDraft,
|
playerStartMovementTemplateDraft,
|
||||||
setPlayerStartMovementTemplateDraft
|
setPlayerStartMovementTemplateDraft
|
||||||
@@ -3717,10 +3717,10 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
String(DEFAULT_PLAYER_START_INTERACTION_ANGLE_DEGREES)
|
String(DEFAULT_PLAYER_START_INTERACTION_ANGLE_DEGREES)
|
||||||
);
|
);
|
||||||
setPlayerStartAllowLookInputTargetSwitchDraft(
|
setPlayerStartAllowLookInputTargetSwitchDraft(
|
||||||
DEFAULT_PLAYER_START_ALLOW_LOOK_INPUT_TARGET_SWITCH
|
DEFAULT_PLAYER_START_ALLOW_LOOK_INPUT_TARGET_SWITCH_VALUE
|
||||||
);
|
);
|
||||||
setPlayerStartTargetButtonCyclesActiveTargetDraft(
|
setPlayerStartTargetButtonCyclesActiveTargetDraft(
|
||||||
DEFAULT_PLAYER_START_TARGET_BUTTON_CYCLES_ACTIVE_TARGET
|
DEFAULT_PLAYER_START_TARGET_BUTTON_CYCLES_ACTIVE_TARGET_VALUE
|
||||||
);
|
);
|
||||||
setPlayerStartMovementTemplateDraft(createPlayerStartMovementTemplate());
|
setPlayerStartMovementTemplateDraft(createPlayerStartMovementTemplate());
|
||||||
setPlayerStartMovementTemplateNumberDraft(
|
setPlayerStartMovementTemplateNumberDraft(
|
||||||
@@ -21786,12 +21786,9 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
type="button"
|
type="button"
|
||||||
data-testid={`player-start-keyboard-binding-${action}`}
|
data-testid={`player-start-keyboard-binding-${action}`}
|
||||||
className="toolbar__button"
|
className="toolbar__button"
|
||||||
onClick={() => {
|
onClick={() =>
|
||||||
setPlayerStartKeyboardCaptureAction(action);
|
beginPlayerStartKeyboardCapture(action)
|
||||||
setStatusMessage(
|
}
|
||||||
`Press any key or mouse button for ${getPlayerStartInputActionLabel(action)}. Press Escape to cancel.`
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{playerStartKeyboardCaptureAction === action
|
{playerStartKeyboardCaptureAction === action
|
||||||
? "Press Any Key..."
|
? "Press Any Key..."
|
||||||
@@ -21848,12 +21845,9 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
type="button"
|
type="button"
|
||||||
data-testid={`player-start-keyboard-binding-${action}`}
|
data-testid={`player-start-keyboard-binding-${action}`}
|
||||||
className="toolbar__button"
|
className="toolbar__button"
|
||||||
onClick={() => {
|
onClick={() =>
|
||||||
setPlayerStartKeyboardCaptureAction(action);
|
beginPlayerStartKeyboardCapture(action)
|
||||||
setStatusMessage(
|
}
|
||||||
`Press any key or mouse button for ${getPlayerStartInputActionLabel(action)}. Press Escape to cancel.`
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{playerStartKeyboardCaptureAction === action
|
{playerStartKeyboardCaptureAction === action
|
||||||
? "Press Any Key..."
|
? "Press Any Key..."
|
||||||
@@ -21910,12 +21904,9 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
type="button"
|
type="button"
|
||||||
data-testid={`player-start-keyboard-binding-${action}`}
|
data-testid={`player-start-keyboard-binding-${action}`}
|
||||||
className="toolbar__button"
|
className="toolbar__button"
|
||||||
onClick={() => {
|
onClick={() =>
|
||||||
setPlayerStartKeyboardCaptureAction(action);
|
beginPlayerStartKeyboardCapture(action)
|
||||||
setStatusMessage(
|
}
|
||||||
`Press any key or mouse button for ${getPlayerStartInputActionLabel(action)}. Press Escape to cancel.`
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{playerStartKeyboardCaptureAction === action
|
{playerStartKeyboardCaptureAction === action
|
||||||
? "Press Any Key..."
|
? "Press Any Key..."
|
||||||
|
|||||||
Reference in New Issue
Block a user