feat: multi synced player scores
All checks were successful
Linux arm64 / Build (push) Successful in 31s
All checks were successful
Linux arm64 / Build (push) Successful in 31s
This commit is contained in:
@@ -4,6 +4,7 @@ import gui.SudokuRenderer;
|
||||
import imgui.ImGui;
|
||||
import network.client.Client;
|
||||
import network.server.Server;
|
||||
import sudoku.structure.Cell;
|
||||
|
||||
public class MultiPlayerDokuView extends BaseView{
|
||||
|
||||
@@ -16,9 +17,14 @@ public class MultiPlayerDokuView extends BaseView{
|
||||
this.client = client;
|
||||
this.server = server;
|
||||
this.sudokuRenderer = new SudokuRenderer(this.client.getGame().getDoku());
|
||||
this.sudokuRenderer.onCellChange.connect(this::onCellChange);
|
||||
this.client.onDisconnect.connect(this::onDisconnect);
|
||||
}
|
||||
|
||||
private void onCellChange(Cell cell) {
|
||||
this.client.sendCellChange(cell);
|
||||
}
|
||||
|
||||
public void onDisconnect() {
|
||||
if (server == null) {
|
||||
closeMenu();
|
||||
|
||||
@@ -37,8 +37,8 @@ public class MultiPlayerView extends BaseView {
|
||||
this.stateMachine.popState();
|
||||
}
|
||||
|
||||
private void onSelected() {
|
||||
this.doku = this.selector.getDoku();
|
||||
private void onSelected(MultiDoku doku) {
|
||||
this.doku = doku;
|
||||
}
|
||||
|
||||
public void renderGameStatus() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package gui.menu;
|
||||
|
||||
import gui.SudokuSelector;
|
||||
import imgui.ImGui;
|
||||
import sudoku.structure.MultiDoku;
|
||||
|
||||
public class SoloMenu extends BaseView {
|
||||
|
||||
@@ -13,8 +14,8 @@ public class SoloMenu extends BaseView {
|
||||
this.sudokuSelector.onSelect.connect(this::pushSudokuState);
|
||||
}
|
||||
|
||||
private void pushSudokuState() {
|
||||
this.stateMachine.pushState(new SudokuView(stateMachine, this.sudokuSelector.getDoku()));
|
||||
private void pushSudokuState(MultiDoku doku) {
|
||||
this.stateMachine.pushState(new SudokuView(stateMachine, doku));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user