feat: multi synced player scores
All checks were successful
Linux arm64 / Build (push) Successful in 31s

This commit is contained in:
2025-01-30 22:16:29 +01:00
parent bcded60fbe
commit 25c2270a37
19 changed files with 264 additions and 22 deletions

View File

@@ -7,7 +7,11 @@ import java.util.Random;
import common.Signal;
import game.Game;
import game.Player;
import network.protocol.packets.ChangeCellPacket;
import network.protocol.packets.LoginPacket;
import sudoku.structure.Cell;
import sudoku.structure.MultiDoku;
import sudoku.structure.Sudoku;
public class Client {
private final ClientConnexion clientConnection;
@@ -54,4 +58,16 @@ public class Client {
stop();
}
public void sendCellChange(Cell cell) {
MultiDoku doku = getGame().getDoku();
for (int sudokuIndex = 0; sudokuIndex < doku.getNbSubGrids(); sudokuIndex++) {
Sudoku sudoku = doku.getSubGrid(sudokuIndex);
int cellIndex = sudoku.getCells().indexOf(cell);
if (cellIndex != -1) {
this.clientConnection.sendPacket(new ChangeCellPacket(sudokuIndex, cellIndex, cell.getSymbolIndex()));
return;
}
}
}
}