Hinzufügen der Game Logik: Hinzufügen von Spieler-Management, Socket.IO-Integration und UI-Updates

This commit is contained in:
2025-04-01 16:16:26 +02:00
parent 5a2eaf74ca
commit 2c9a14db9a
10 changed files with 64 additions and 9 deletions

View File

@@ -9,7 +9,8 @@
<link rel="icon" type="image/png" href="../assets/Logo.png">
</head>
<body>
<h1 id="pc"></h1>
<h1 id="rd"></h1>
</body>
<script src="https://cdn.socket.io/4.7.2/socket.io.min.js"></script>

View File

@@ -4,8 +4,19 @@ class ServerConnectionManager {
this.socket = io(`${window.location.protocol}//${window.location.hostname}:${window.location.port}`);
this.basicSetup();
this.socket.on("waitForStart", (data) => {this.waitForStart(data)});
this.socket.on("randomTest", (data) => {this.randomTest(data)});
}
waitForStart(data) {
document.getElementById("pc").innerText = data;
}
randomTest(data) {
document.getElementById("rd").innerText = data;
}
basicSetup() {
this.socket.emit("hereForGame");