Conversation
loevray
left a comment
There was a problem hiding this comment.
고생하셨습니다!
단어게임에서 효과음 처리 할수있는 방법은 단순히 이전 점수를 기록해두었다가 현재 점수와 비교하는 방법이 있을 것 같네요. 다만 서버측에서 처리해주시는게 베스트일 것 같습니다!!
추가로 yarn cache에 대해서 이야기 나눠봐야할 것 같아요
맥에서는 darwin, 윈도우에서는 win32, github actions같은경우 리눅스 사용중이라 esbuild, rollup같은 파일들 설치할때 모든 운영체제 버전 설치해야할 것 같아서요!
| const src = type === 'SCORE' ? soundEffect : countDown; | ||
| const sound = new Howl({ | ||
| src: [src], | ||
| }); | ||
| return sound; | ||
| }; |
There was a problem hiding this comment.
동적 import를 활용하면 조금이나마 최적화를 할 수 있을 것 같습니다
type SoundEffectType = 'SCORE' | 'COUNTDOWN' | 'SOMETHING...';
const soundFileMap: Record<SoundEffectType, () => Promise<string>> = {
SCORE: () => import('@/assets/audio/soundEffect.mp3').then(module => module.default),
COUNTDOWN: () => import('@/assets/audio/countDown.mp3').then(module => module.default),
SOMETHING...: () => import('@/assets/audio/something.mp3').then(module => module.default),
};
const playSoundEffect = async (soundType: SoundEffectType) => {
const soundFilePath = await soundFileMap[soundType]();
return new Howl({
src: [soundFilePath],
});
};혹시 위 코드에 문제점이 있거나 다른의견 있으시면 얼마든지 알려주세요!!
yarn.lock
Outdated
| "howler@npm:^2.2.4": | ||
| version: 2.2.4 | ||
| resolution: "howler@npm:2.2.4" | ||
| checksum: 10c0/74a295f56fd9b2abce122b27ed12c33fa195fb8a76832803e92d8e462a1eca803b55f44c14db052211d0cfab85c7c5249664c68d95bbbc16c775fac73866c6ef | ||
| languageName: node | ||
| linkType: hard | ||
|
|
There was a problem hiding this comment.
howler라는 라이브러리를 찾아보니 사운드 관련 라이브러리네요!
그냥 auido객체에 비해 어떤 장점이 있었나요?ㅎㅎ
There was a problem hiding this comment.
오디오 사용을 찾아보았을때 audio를 모르고 해당 라이브러리를 보아서 적용해본건데,
audio로도 구현가능한 것이었네요 ㅎㅎㅎ 불필요한 라이브러리 사용일 것 같아서 바꿨어요!
There was a problem hiding this comment.
yarn cache는 음,,
커밋에 올라간 파일들은 main rebase하고 install 하니까 와르르 생겼던 것으로 기억해요
ㅇㅅㅇ..
There was a problem hiding this comment.
yarnrc.yaml파일 내부 아래 옵션때문일거에요
supportedArchitectures:
{
os: ['current', 'linux'],
cpu: ['current', 'x64'],
libc: ['current', 'glibc', 'musl'],
}
``
왜 파일이 지워진지는 모르겠네요 ㅋㅋㅋ
다음에 제가 확인해볼게요
dlsxjzld
left a comment
There was a problem hiding this comment.
고생하셨습니다!! 👍
영현님이 리뷰를 잘 남겨주셔서 할 말이 별로 없었네요 ㅎㅎ
| const handleUpdateScore = useCallback(() => { | ||
| const newScore = currentScore + scorePerSubmit; | ||
| publishIngame('/info', { currentScore: newScore }); | ||
| const sound = playSoundEffect('SCORE'); |
There was a problem hiding this comment.
playSoundEffect에 'SCORE' 와 'COUNTDOWN'를 인자로 전달하고 있는데 이 값들을 하나의 상수 파일안에 선언하고 import해서 쓰면 어떨까요?! 🤔
📋 Issue Number
close #320
💻 구현 내용
📷 Screenshots
default.mov
🤔 고민사항
현재 단어 게임에선 정답이든 오답이든 submit이 일어났을 때 효과음이 재생됩니다. 방금 제출한 입력으로 점수를 얻었는지 못얻었는지 모르기 때문입니다..
-> 점수초리하는 로직 (서버 단)을 변경한다. 그렇지 않을거라면 어느 상황에 효과음을 내는게 좋을까요
효과음 제안 받습니다 ... plz,,,