mirror of
https://github.com/Skysamara/android-kotlin-fundamentals-apps.git
synced 2025-12-06 06:16:03 +00:00
FiX: Score is not updated for the last word
Issue link: https://github.com/google-developer-training/android-kotlin-fundamentals-apps/pull/19
This commit is contained in:
parent
b3ed6a4ecf
commit
0510d8a860
@ -94,15 +94,11 @@ class GameViewModel : ViewModel() {
|
||||
|
||||
/** Methods for updating the UI **/
|
||||
fun onSkip() {
|
||||
if (!wordList.isEmpty()) {
|
||||
_score.value = (_score.value)?.minus(1)
|
||||
}
|
||||
_score.value = (_score.value)?.minus(1)
|
||||
nextWord()
|
||||
}
|
||||
fun onCorrect() {
|
||||
if (!wordList.isEmpty()) {
|
||||
_score.value = (_score.value)?.plus(1)
|
||||
}
|
||||
_score.value = (_score.value)?.plus(1)
|
||||
nextWord()
|
||||
}
|
||||
|
||||
|
||||
@ -94,15 +94,11 @@ class GameViewModel : ViewModel() {
|
||||
|
||||
/** Methods for updating the UI **/
|
||||
fun onSkip() {
|
||||
if (!wordList.isEmpty()) {
|
||||
_score.value = (_score.value)?.minus(1)
|
||||
}
|
||||
_score.value = (_score.value)?.minus(1)
|
||||
nextWord()
|
||||
}
|
||||
fun onCorrect() {
|
||||
if (!wordList.isEmpty()) {
|
||||
_score.value = (_score.value)?.plus(1)
|
||||
}
|
||||
_score.value = (_score.value)?.plus(1)
|
||||
nextWord()
|
||||
}
|
||||
|
||||
|
||||
@ -138,15 +138,11 @@ class GameViewModel : ViewModel() {
|
||||
|
||||
/** Methods for updating the UI **/
|
||||
fun onSkip() {
|
||||
if (!wordList.isEmpty()) {
|
||||
_score.value = (_score.value)?.minus(1)
|
||||
}
|
||||
_score.value = (_score.value)?.minus(1)
|
||||
nextWord()
|
||||
}
|
||||
fun onCorrect() {
|
||||
if (!wordList.isEmpty()) {
|
||||
_score.value = (_score.value)?.plus(1)
|
||||
}
|
||||
_score.value = (_score.value)?.plus(1)
|
||||
nextWord()
|
||||
}
|
||||
|
||||
|
||||
@ -80,15 +80,11 @@ class GameViewModel : ViewModel() {
|
||||
|
||||
/** Methods for updating the UI **/
|
||||
fun onSkip() {
|
||||
if (!wordList.isEmpty()) {
|
||||
score--
|
||||
}
|
||||
score--
|
||||
nextWord()
|
||||
}
|
||||
fun onCorrect() {
|
||||
if (!wordList.isEmpty()) {
|
||||
score++
|
||||
}
|
||||
score++
|
||||
nextWord()
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user