mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 15:43:49 +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 waitingOnAI = boardState.previousPlayer === GoColor.black && boardState.ai !== GoOpponent.none;
|
||||||
const score = getScore(boardState);
|
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
|
// 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
|
// Currently this function changing is what triggers a GoGameboard rerender, which is needed
|
||||||
async function clickHandler(x: number, y: number) {
|
async function clickHandler(x: number, y: number) {
|
||||||
@ -139,6 +146,7 @@ export function GoGameboardWrapper({ showInstructions }: GoGameboardWrapperProps
|
|||||||
function resetState(newBoardSize = boardSize, newOpponent = Go.currentGame.ai) {
|
function resetState(newBoardSize = boardSize, newOpponent = Go.currentGame.ai) {
|
||||||
setScoreOpen(false);
|
setScoreOpen(false);
|
||||||
setSearchOpen(false);
|
setSearchOpen(false);
|
||||||
|
setShowPriorMove(false);
|
||||||
if (boardState.previousPlayer !== null && boardState.previousBoards.length) {
|
if (boardState.previousPlayer !== null && boardState.previousBoards.length) {
|
||||||
resetWinstreak(boardState.ai, false);
|
resetWinstreak(boardState.ai, false);
|
||||||
}
|
}
|
||||||
@ -159,9 +167,8 @@ export function GoGameboardWrapper({ showInstructions }: GoGameboardWrapperProps
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showPreviousMove(newValue: boolean) {
|
function showPreviousMove(newValue: boolean) {
|
||||||
if (boardState.previousBoards.length) {
|
// Only show prior move if there is previous moves to show
|
||||||
setShowPriorMove(newValue);
|
setShowPriorMove(!!boardState.previousBoards.length && newValue);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTraditional(newValue: boolean) {
|
function setTraditional(newValue: boolean) {
|
||||||
|
Loading…
Reference in New Issue
Block a user