Hinzufügen der Game Logik: Hinzufügen von Spieler-Management, Socket.IO-Integration und UI-Updates
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user