update num beats on difficulty select (fixes #224)

This commit is contained in:
Kevin Ngo
2018-12-09 03:59:12 -08:00
parent 2ff64b26f2
commit bc61eec235

View File

@@ -334,7 +334,7 @@ AFRAME.registerState({
state.menuSelectedChallenge.difficulty = state.menuDifficulties[0];
state.menuSelectedChallenge.image = utils.getS3FileUrl(id, 'image.jpg');
state.menuSelectedChallenge.songInfoText = `By ${truncate(challenge.author, 12)} ${challenge.genre && challenge.genre !== 'Uncategorized' ? '/ ' + challenge.genre : ''}\n${challenge.downloads} Downloads\nUpvotes: ${challenge.upvotes} / Downvotes: ${challenge.downvotes}\n${formatSongLength(challenge.songDuration)} / ${challenge.numBeats[state.menuSelectedChallenge.difficulty]} beats`;
updateMenuSongInfo(state, challenge);
computeMenuSelectedChallengeIndex(state);
state.isSearching = false;
@@ -350,6 +350,7 @@ AFRAME.registerState({
menudifficultyselect: (state, difficulty) => {
state.menuSelectedChallenge.difficulty = difficulty;
clearLeaderboard(state);
updateMenuSongInfo(state, state.menuSelectedChallenge);
},
minehit: state => {
@@ -623,3 +624,7 @@ function clearLeaderboard (state) {
state.leaderboardScores = '';
state.leaderboardFetched = false;
}
function updateMenuSongInfo (state, challenge) {
state.menuSelectedChallenge.songInfoText = `By ${truncate(challenge.author, 12)} ${challenge.genre && challenge.genre !== 'Uncategorized' ? '/ ' + challenge.genre : ''}\n${challenge.downloads} Downloads\nUpvotes: ${challenge.upvotes} / Downvotes: ${challenge.downvotes}\n${formatSongLength(challenge.songDuration)} / ${challenge.numBeats[state.menuSelectedChallenge.difficulty]} beats`;
}