repl
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m37s
All checks were successful
Create and publish a Docker image 🚀 / build-and-push-image (push) Successful in 1m37s
This commit is contained in:
@@ -30,13 +30,12 @@ export class GameSocket {
|
||||
this.socket.onmessage = (e) => {
|
||||
const msg = JSON.parse(e.data);
|
||||
|
||||
switch (msg.type) {
|
||||
case "init":
|
||||
this.playerId = msg.payload.id;
|
||||
break;
|
||||
case "input":
|
||||
this.onState?.(msg.payload);
|
||||
break;
|
||||
if (msg.type === "init") {
|
||||
this.playerId = msg.payload.id;
|
||||
}
|
||||
|
||||
if (msg.type === "input") {
|
||||
this.onState?.(msg.payload);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user