diff --git a/frontend/src/hooks/useHandleSocket.ts b/frontend/src/hooks/useHandleSocket.ts index 665467fc..1e0a5e87 100644 --- a/frontend/src/hooks/useHandleSocket.ts +++ b/frontend/src/hooks/useHandleSocket.ts @@ -6,12 +6,10 @@ import { joinChatRoomState, leaveChatRoomState, newChatRoomState, - newGamePingMessageState, newMessageState, updateChatRoomState, joinGameRoomState, newGameRoomState, - updateGameRoomState, leaveGameRoomState, } from 'store'; import { useSetSocketHandler } from './useSetSocketHandler'; @@ -56,9 +54,6 @@ export function useHandleSocket() { const updateChatRoom = useRecoilValue(updateChatRoomState); const resetUpdateChatRoom = useResetRecoilState(updateChatRoomState); - /* Pong Test */ - const [newGamePingMessage, setNewGamePingMessage] = useRecoilState(newGamePingMessageState); - /* Game Room */ const newGameRoom = useRecoilValue(newGameRoomState); const resetNewGameRoom = useResetRecoilState(newGameRoomState); @@ -66,8 +61,6 @@ export function useHandleSocket() { const resetJoinGameRoom = useResetRecoilState(joinGameRoomState); const leaveGameRoom = useRecoilValue(leaveGameRoomState); const resetLeaveGameRoom = useResetRecoilState(leaveGameRoomState); - const updateGameRoom = useRecoilValue(updateGameRoomState); - const resetUpdateGameRoom = useResetRecoilState(updateGameRoomState); const { connectHandler, @@ -77,8 +70,6 @@ export function useHandleSocket() { getAllChatRoomHandler, joinChatRoomHandler, // Game - gamePongHandler, - getAllGameRoomHandler, joinGameRoomHandler, } = useSetSocketHandler(); @@ -151,26 +142,7 @@ export function useHandleSocket() { resetJoinGameRoom(); }, [joinGameRoom]); - useEffect(() => { - if (updateGameRoom.id.length === 0) return; - if (sockets.gameSocket === null) return; - - sockets.gameSocket.emit('update_room', updateGameRoom); - resetUpdateGameRoom(); - }, [updateGameRoom]); - /* ----------------- Game ----------------- */ - useEffect(() => { - if (newMessage.length === 0) return; - if (sockets.gameSocket === null) return; - - sockets.gameSocket.emit('ping', { - message: newMessage, - }); - - setNewGamePingMessage(''); - }, [newGamePingMessage]); - useEffect(() => { if (!sockets.chatSocket) { sockets.chatSocket = createSocket('chat', { @@ -188,9 +160,6 @@ export function useHandleSocket() { exceptionHandler, disconnectHandler, }); - sockets.gameSocket.on('pong', gamePongHandler); - - sockets.gameSocket.on('update_game_room', getAllGameRoomHandler); sockets.gameSocket.on('join_room', joinGameRoomHandler); } }, []); diff --git a/frontend/src/pages/GamePage/MainScene.tsx b/frontend/src/pages/GamePage/MainScene.tsx index f03d100d..70b9ef89 100644 --- a/frontend/src/pages/GamePage/MainScene.tsx +++ b/frontend/src/pages/GamePage/MainScene.tsx @@ -80,8 +80,6 @@ export class MainScene extends Phaser.Scene { if (this.paddleLeft && this.paddleRight && this.key) { if (this.key.up.isDown) { this.paddleRight.y -= 10; - // this.pingHandler('PONG PONG'); - sockets.gameSocket.emit('ping', { message: 'pONG POGN' }); } else if (this.key.down.isDown) this.paddleRight.y += 10; if (this.key.shift.isDown) this.paddleLeft.y -= 10; else if (this.key.space.isDown) this.paddleLeft.y += 10; diff --git a/frontend/src/store/index.ts b/frontend/src/store/index.ts index bc002fd5..6146b7a0 100644 --- a/frontend/src/store/index.ts +++ b/frontend/src/store/index.ts @@ -11,5 +11,4 @@ export { currentGamePongState } from './currentGamePongState'; export { gameRoomListState } from './gameRoomListState'; export { joinGameRoomState } from './joinGameRoomState'; export { newGameRoomState } from './newGameRoomState'; -export { updateGameRoomState } from './updateGameRoomState'; export { leaveGameRoomState } from './leaveGameRoomState'; diff --git a/frontend/src/store/updateGameRoomState.ts b/frontend/src/store/updateGameRoomState.ts deleted file mode 100644 index 2418f4d2..00000000 --- a/frontend/src/store/updateGameRoomState.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { atom } from 'recoil'; - -import { UpdateGameRoomType } from 'types/game'; - -export const updateGameRoomState = atom({ - key: 'updateGameRoomState', - default: { id: '' }, -});