mooore stuff
Some checks failed
Linux arm64 / Build (push) Failing after 5m5s

This commit is contained in:
2025-01-26 13:46:23 +01:00
parent caf7011f08
commit e51cc23459
20 changed files with 395 additions and 65 deletions

View File

@@ -1,53 +1,28 @@
package gui.menu;
import java.io.IOException;
import java.net.UnknownHostException;
import imgui.ImGui;
import network.client.Client;
import network.server.Server;
public class MultiPlayerView extends BaseView {
private final Client client;
private Client client;
private Server server;
/**
* Client
*
* @param stateMachine
* @param address
* @param port
* @throws IOException
* @throws UnknownHostException
*/
public MultiPlayerView(StateMachine stateMachine, String address, short port)
throws UnknownHostException, IOException {
public MultiPlayerView(StateMachine stateMachine, Client client) {
super(stateMachine);
this.client = new Client(address, port);
}
/**
* Server
*
* @param stateMachine
* @param port
* @throws IOException
*/
public MultiPlayerView(StateMachine stateMachine, short port) throws IOException {
super(stateMachine);
this.server = new Server(port);
this.client = new Client("localhost", port);
this.client = client;
this.client.onDisconnect.connect(this::onDisconnect);
}
@Override
public void onKill() {
if (this.server != null) {
this.server.stop();
}
if (this.client != null) {
this.client.stop();
}
public void closeMenu() {
this.client.forceDisconnect();
super.closeMenu();
}
public void onDisconnect() {
// System.out.println("ohohohohohohoho");
this.stateMachine.popState();
this.client.onDisconnect.clear();
}
@Override