Skip to content

Shift + I to hide/show all user's buttons updates buttons for all users #20

@mkapal

Description

@mkapal

When a user presses Shift + I, all buttons are cleared from their screen. When they press Shift + I again, all buttons become visible again for that user.

The Shift + I state is tracked by a single state shouldClearAllButtons in the global InSimContextProvider:

const [shouldClearAllButtons, setShouldClearAllButtons] = useState(false);
const [isConnected, setIsConnected] = useState(false);
useEffect(() => {
const bfnListener = (packet: IS_BFN) => {
if (packet.SubT === ButtonFunction.BFN_USER_CLEAR) {
log('User cleared all buttons');
setShouldClearAllButtons(true);
return;
}
if (packet.SubT === ButtonFunction.BFN_REQUEST) {
log('User requested to show all buttons');
setShouldClearAllButtons(false);
return;
}
};
inSim.on(PacketType.ISP_BFN, bfnListener);
return () => {
inSim.off(PacketType.ISP_BFN, bfnListener);
};
}, []);

This means that if one player restores their buttons, not only their buttons are shown again, but everyone else's buttons get shown as well if they has been hidden before.

Proposal: Keep track of the UCIDs which have requested to clear all buttons and when buttons are requested to be shown again, only show buttons for that UCID.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions