예제 #1
0
        private void OnRoomCommandReceived(RoomPacket roomPacket)
        {
            Debug.Log($"Room Command: {roomPacket.RoomCommand} Received");
            switch (roomPacket.RoomCommand)
            {
            case RoomCommand.CREATE_ROOM:
                _runtimeManager.CreateRoom(roomPacket.RoomId);
                _runtimeManager.DisplayRoom();
                break;

            case RoomCommand.CREATE_ROOM_CONFIRMATION:
                break;

            case RoomCommand.JOIN_ROOM:
                JoinRoomRequest(roomPacket.RoomId);
                break;

            case RoomCommand.JOIN_ROOM_CONFIRM:
                _runtimeManager.CreateRoom(roomPacket.RoomId);
                _runtimeManager.DisplayRoom();
                break;

            case RoomCommand.ROOM_UPDATE:
                _runtimeManager.FetchRoom(roomPacket.RoomName, roomPacket.RoomId, roomPacket.PlayersInRoomStruct.PlayersArray);
                break;

            case RoomCommand.LOAD_GAME_SCENE:
                _runtimeManager.LoadGameScene(roomPacket.RoomName, roomPacket.RoomId, roomPacket.PlayersInRoomStruct.PlayersArray);
                break;

            case RoomCommand.LOAD_GAME_SCENE_CONFIRM:
                break;

            default:
                Debug.LogError($"UNHANDLED COMMAND: {roomPacket.RoomCommand}");
                break;
            }
        }