simplify multiplier text, document some state props
This commit is contained in:
@@ -22,13 +22,13 @@ const DAMAGE_MAX = 10;
|
|||||||
AFRAME.registerState({
|
AFRAME.registerState({
|
||||||
initialState: {
|
initialState: {
|
||||||
activeHand: localStorage.getItem('hand') || 'right',
|
activeHand: localStorage.getItem('hand') || 'right',
|
||||||
challenge: {
|
challenge: { // Actively playing challenge.
|
||||||
author: '',
|
author: '',
|
||||||
difficulty: '',
|
difficulty: '',
|
||||||
id: AFRAME.utils.getUrlParameter('challenge'),
|
id: AFRAME.utils.getUrlParameter('challenge'), // Will be empty string if not playing.
|
||||||
image: '',
|
image: '',
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isBeatsPreloaded: false,
|
isBeatsPreloaded: false, // Whether we have passed the negative time.
|
||||||
songName: '',
|
songName: '',
|
||||||
songLength: 0,
|
songLength: 0,
|
||||||
songSubName: ''
|
songSubName: ''
|
||||||
@@ -42,9 +42,9 @@ AFRAME.registerState({
|
|||||||
isSongFetching: false, // Fetching stage.
|
isSongFetching: false, // Fetching stage.
|
||||||
isSongLoading: false, // Either fetching or decoding.
|
isSongLoading: false, // Either fetching or decoding.
|
||||||
isVictory: false, // Victory screen.
|
isVictory: false, // Victory screen.
|
||||||
menuActive: true,
|
menuActive: true, // Main menu active.
|
||||||
menuDifficulties: [],
|
menuDifficulties: [], // List of strings of available difficulties for selected.
|
||||||
menuSelectedChallenge: {
|
menuSelectedChallenge: { // Currently selected challenge in the main menu.
|
||||||
author: '',
|
author: '',
|
||||||
difficulty: '',
|
difficulty: '',
|
||||||
downloads: '',
|
downloads: '',
|
||||||
@@ -58,7 +58,6 @@ AFRAME.registerState({
|
|||||||
songName: '',
|
songName: '',
|
||||||
songSubName: ''
|
songSubName: ''
|
||||||
},
|
},
|
||||||
multiplierText: '1x',
|
|
||||||
score: {
|
score: {
|
||||||
accuracy: '',
|
accuracy: '',
|
||||||
beatsHit: 0,
|
beatsHit: 0,
|
||||||
@@ -67,7 +66,7 @@ AFRAME.registerState({
|
|||||||
maxCombo: 0,
|
maxCombo: 0,
|
||||||
maxComboText: 0,
|
maxComboText: 0,
|
||||||
multiplier: 1,
|
multiplier: 1,
|
||||||
rank: '',
|
rank: '', // Grade (S to F).
|
||||||
score: 0,
|
score: 0,
|
||||||
scoreText: 0
|
scoreText: 0
|
||||||
},
|
},
|
||||||
@@ -77,8 +76,8 @@ AFRAME.registerState({
|
|||||||
hasNext: false,
|
hasNext: false,
|
||||||
hasPrev: false,
|
hasPrev: false,
|
||||||
results: [],
|
results: [],
|
||||||
songNameTexts: '',
|
songNameTexts: '', // All names in search results merged together.
|
||||||
songSubNameTexts: ''
|
songSubNameTexts: '' // All sub names in search results merged together.
|
||||||
},
|
},
|
||||||
searchResultsPage: []
|
searchResultsPage: []
|
||||||
},
|
},
|
||||||
@@ -360,7 +359,8 @@ AFRAME.registerState({
|
|||||||
!state.menuActive && !state.isPaused && !state.isVictory && !state.isGameOver &&
|
!state.menuActive && !state.isPaused && !state.isVictory && !state.isGameOver &&
|
||||||
!state.challenge.isLoading && !state.isSongLoading;
|
!state.challenge.isLoading && !state.isSongLoading;
|
||||||
|
|
||||||
const anyMenuOpen = state.menuActive || state.isPaused || state.isVictory || state.isGameOver;
|
const anyMenuOpen = state.menuActive || state.isPaused || state.isVictory ||
|
||||||
|
state.isGameOver;
|
||||||
state.leftRaycasterActive = anyMenuOpen && state.activeHand === 'left' && state.inVR;
|
state.leftRaycasterActive = anyMenuOpen && state.activeHand === 'left' && state.inVR;
|
||||||
state.rightRaycasterActive = anyMenuOpen && state.activeHand === 'right' && state.inVR;
|
state.rightRaycasterActive = anyMenuOpen && state.activeHand === 'right' && state.inVR;
|
||||||
|
|
||||||
@@ -370,8 +370,6 @@ AFRAME.registerState({
|
|||||||
} else {
|
} else {
|
||||||
state.loadingText = '';
|
state.loadingText = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
state.multiplierText = `${state.score.multiplier}x`;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
<a-entity
|
<a-entity
|
||||||
id="multiplier"
|
id="multiplier"
|
||||||
mixin="scoreText"
|
mixin="scoreText"
|
||||||
bind__text="value: multiplierText"
|
bind__text="value: multiplierText + 'x'"
|
||||||
text="width: 1"
|
text="width: 1"
|
||||||
position="1.8 1.2 -4"
|
position="1.8 1.2 -4"
|
||||||
scale="5 5 5">
|
scale="5 5 5">
|
||||||
|
|||||||
Reference in New Issue
Block a user