Skip to content

Commit 0bfeb37

Browse files
committed
✨ (sudoku): add highlight same value
1 parent 485f4d3 commit 0bfeb37

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

internal/layout/high-light.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func (gameLayout *GameLayout) drawHighLightCell(screen *ebiten.Image, row, col i
1717
if row == cursorRow && col == cursorCol {
1818
return
1919
}
20+
2021
// highLight relative row, col
2122
if row == cursorRow || col == cursorCol {
2223
gameLayout.drawHighLightCover(screen, row, col)
@@ -36,6 +37,17 @@ func (gameLayout *GameLayout) drawHighLightCell(screen *ebiten.Image, row, col i
3637
}
3738
}
3839
}
40+
// hightLight Same Value
41+
cursorCell := board.Cells[cursorRow][cursorCol]
42+
targetCell := board.Cells[row][col]
43+
// 空值則跳過
44+
if cursorCell.Type == game.Empty || targetCell.Type == game.Empty {
45+
return
46+
}
47+
48+
if cursorCell.Value == targetCell.Value {
49+
gameLayout.drawHighLightCover(screen, row, col)
50+
}
3951
}
4052

4153
func (gameLayout *GameLayout) drawHighLightCover(screen *ebiten.Image, row, col int) {

0 commit comments

Comments
 (0)