diff --git a/back/src/Model/GameRoom.ts b/back/src/Model/GameRoom.ts index d6a6c7c2..74284ab2 100644 --- a/back/src/Model/GameRoom.ts +++ b/back/src/Model/GameRoom.ts @@ -551,8 +551,6 @@ export class GameRoom { } public emitLockGroupMessage(user: User, lockGroupMessage: LockGroupMessage) { - console.log("D2 GAME ROOM EMIT LOCK GROUP MESSAGE"); - console.log(lockGroupMessage.getGroupid()); this.positionNotifier.emitLockGroupEvent(user, lockGroupMessage); } diff --git a/back/src/Model/PositionNotifier.ts b/back/src/Model/PositionNotifier.ts index ad7334f9..6e1fb195 100644 --- a/back/src/Model/PositionNotifier.ts +++ b/back/src/Model/PositionNotifier.ts @@ -143,8 +143,6 @@ export class PositionNotifier { public emitLockGroupEvent(user: User, lockGroupMessage: LockGroupMessage) { const zoneDesc = this.getZoneDescriptorFromCoordinates(user.getPosition().x, user.getPosition().y); const zone = this.getZone(zoneDesc.i, zoneDesc.j); - console.log("D3 emit from ZONE"); - console.log(lockGroupMessage.getGroupid()); zone.emitLockGroupEvent(lockGroupMessage); } diff --git a/back/src/Model/Zone.ts b/back/src/Model/Zone.ts index 35bb4660..4f49ff55 100644 --- a/back/src/Model/Zone.ts +++ b/back/src/Model/Zone.ts @@ -112,7 +112,6 @@ export class Zone { } public emitLockGroupEvent(lockGroupMessage: LockGroupMessage) { - console.log("D4 ZONE ON LOCK GROUP CALLBACK"); for (const listener of this.listeners) { this.onLockGroup(lockGroupMessage, listener); } diff --git a/back/src/RoomManager.ts b/back/src/RoomManager.ts index 6a091054..8a840c15 100644 --- a/back/src/RoomManager.ts +++ b/back/src/RoomManager.ts @@ -155,8 +155,6 @@ const roomManager: IRoomManagerServer = { user, setPlayerDetailsMessage as SetPlayerDetailsMessage ); - } else if (message.hasLockgroupmessage()) { - console.log("===== GOT LOCK GROUP MESSAGE FROM CLIENT ====="); } else { throw new Error("Unhandled message type"); } diff --git a/back/src/Services/SocketManager.ts b/back/src/Services/SocketManager.ts index aaa373fb..2bfe7cf2 100644 --- a/back/src/Services/SocketManager.ts +++ b/back/src/Services/SocketManager.ts @@ -70,7 +70,6 @@ function emitZoneMessage(subMessage: SubToPusherMessage, socket: ZoneSocket): vo // TODO: should we batch those every 100ms? const batchMessage = new BatchToPusherMessage(); batchMessage.addPayload(subMessage); - socket.write(batchMessage); } @@ -277,8 +276,9 @@ export class SocketManager { }, MINIMUM_DISTANCE, GROUP_RADIUS, - (thing: Movable, fromZone: Zone | null, listener: ZoneSocket) => - this.onZoneEnter(thing, fromZone, listener), + (thing: Movable, fromZone: Zone | null, listener: ZoneSocket) => { + this.onZoneEnter(thing, fromZone, listener); + }, (thing: Movable, position: PositionInterface, listener: ZoneSocket) => this.onClientMove(thing, position, listener), (thing: Movable, newZone: Zone | null, listener: ZoneSocket) => @@ -393,17 +393,12 @@ export class SocketManager { private onLockGroup(lockGroupMessage: LockGroupMessage, client: ZoneSocket) { const subMessage = new SubToPusherMessage(); subMessage.setLockgroupmessage(lockGroupMessage); - console.log("D5 SOCKET MANAGER ON LOCK GROUP"); - console.log(lockGroupMessage.getGroupid()); - console.log(lockGroupMessage.getLock()); - emitZoneMessage(subMessage, client); } private onPlayerDetailsUpdated(playerDetailsUpdatedMessage: PlayerDetailsUpdatedMessage, client: ZoneSocket) { const subMessage = new SubToPusherMessage(); subMessage.setPlayerdetailsupdatedmessage(playerDetailsUpdatedMessage); - emitZoneMessage(subMessage, client); } @@ -433,7 +428,6 @@ export class SocketManager { const subMessage = new SubToPusherMessage(); subMessage.setGroupleftzonemessage(groupDeleteMessage); - emitZoneMessage(subMessage, client); //user.emitInBatch(subMessage); } @@ -445,7 +439,6 @@ export class SocketManager { const subMessage = new SubToPusherMessage(); subMessage.setUserleftzonemessage(userLeftMessage); - emitZoneMessage(subMessage, client); } @@ -667,6 +660,7 @@ export class SocketManager { const groupUpdateMessage = new GroupUpdateZoneMessage(); groupUpdateMessage.setGroupid(thing.getId()); groupUpdateMessage.setPosition(ProtobufUtils.toPointMessage(thing.getPosition())); + groupUpdateMessage.setLocked(thing.isLocked()); const subMessage = new SubToPusherMessage(); subMessage.setGroupupdatezonemessage(groupUpdateMessage); @@ -905,7 +899,6 @@ export class SocketManager { } handleLockGroupMessage(room: GameRoom, user: User, message: LockGroupMessage) { - console.log("D1 HANDLE LOCK GROUP MESSAGE"); const group = user.group; if (!group) { return; diff --git a/front/src/Components/CameraControls.svelte b/front/src/Components/CameraControls.svelte index bfe1d9d0..7b189aff 100644 --- a/front/src/Components/CameraControls.svelte +++ b/front/src/Components/CameraControls.svelte @@ -10,12 +10,14 @@ import layoutPresentationImg from "./images/layout-presentation.svg"; import layoutChatImg from "./images/layout-chat.svg"; import followImg from "./images/follow.svg"; + import lockImg from "./images/lock.svg"; import { LayoutMode } from "../WebRtc/LayoutManager"; import { peerStore } from "../Stores/PeerStore"; import { onDestroy } from "svelte"; import { embedScreenLayout } from "../Stores/EmbedScreensStore"; import { followRoleStore, followStateStore, followUsersStore } from "../Stores/FollowStore"; import { gameManager } from "../Phaser/Game/GameManager"; + import { currentPlayerGroupIdStore, currentPlayerGroupLockStateStore } from "../Stores/CurrentPlayerGroupStore"; const gameScene = gameManager.getCurrentGameScene(); @@ -70,6 +72,15 @@ } } + function lockClick() { + console.log($currentPlayerGroupIdStore); + console.log($currentPlayerGroupLockStateStore); + if ($currentPlayerGroupIdStore === undefined) { + return; + } + gameScene.connection?.emitLockGroup($currentPlayerGroupIdStore, !$currentPlayerGroupLockStateStore); + } + let isSilent: boolean; const unsubscribeIsSilent = isSilentStore.subscribe((value) => { isSilent = value; @@ -95,6 +106,15 @@ +