mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-21 23:23:51 +01:00
IPVGO: uncheck the 'show prior move' feature when a new game is started (#1728)
This commit is contained in:
parent
810cfc8b21
commit
ecc2d92edb
@ -54,6 +54,13 @@ export function GoGameboardWrapper({ showInstructions }: GoGameboardWrapperProps
|
||||
const waitingOnAI = boardState.previousPlayer === GoColor.black && boardState.ai !== GoOpponent.none;
|
||||
const score = getScore(boardState);
|
||||
|
||||
// Disable showing prior move if there are no prior moves (if a new game is started while looking at a prior move)
|
||||
useEffect(() => {
|
||||
if (boardState.previousBoards.length === 0) {
|
||||
setShowPriorMove(false);
|
||||
}
|
||||
}, [boardState.previousBoards.length]);
|
||||
|
||||
// Do not implement useCallback for this function without ensuring GoGameboard still rerenders for every move
|
||||
// Currently this function changing is what triggers a GoGameboard rerender, which is needed
|
||||
async function clickHandler(x: number, y: number) {
|
||||
@ -139,6 +146,7 @@ export function GoGameboardWrapper({ showInstructions }: GoGameboardWrapperProps
|
||||
function resetState(newBoardSize = boardSize, newOpponent = Go.currentGame.ai) {
|
||||
setScoreOpen(false);
|
||||
setSearchOpen(false);
|
||||
setShowPriorMove(false);
|
||||
if (boardState.previousPlayer !== null && boardState.previousBoards.length) {
|
||||
resetWinstreak(boardState.ai, false);
|
||||
}
|
||||
@ -159,9 +167,8 @@ export function GoGameboardWrapper({ showInstructions }: GoGameboardWrapperProps
|
||||
}
|
||||
|
||||
function showPreviousMove(newValue: boolean) {
|
||||
if (boardState.previousBoards.length) {
|
||||
setShowPriorMove(newValue);
|
||||
}
|
||||
// Only show prior move if there is previous moves to show
|
||||
setShowPriorMove(!!boardState.previousBoards.length && newValue);
|
||||
}
|
||||
|
||||
function setTraditional(newValue: boolean) {
|
||||
|
Loading…
Reference in New Issue
Block a user