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 **/
|
/** Methods for updating the UI **/
|
||||||
fun onSkip() {
|
fun onSkip() {
|
||||||
if (!wordList.isEmpty()) {
|
_score.value = (_score.value)?.minus(1)
|
||||||
_score.value = (_score.value)?.minus(1)
|
|
||||||
}
|
|
||||||
nextWord()
|
nextWord()
|
||||||
}
|
}
|
||||||
fun onCorrect() {
|
fun onCorrect() {
|
||||||
if (!wordList.isEmpty()) {
|
_score.value = (_score.value)?.plus(1)
|
||||||
_score.value = (_score.value)?.plus(1)
|
|
||||||
}
|
|
||||||
nextWord()
|
nextWord()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -94,15 +94,11 @@ class GameViewModel : ViewModel() {
|
|||||||
|
|
||||||
/** Methods for updating the UI **/
|
/** Methods for updating the UI **/
|
||||||
fun onSkip() {
|
fun onSkip() {
|
||||||
if (!wordList.isEmpty()) {
|
_score.value = (_score.value)?.minus(1)
|
||||||
_score.value = (_score.value)?.minus(1)
|
|
||||||
}
|
|
||||||
nextWord()
|
nextWord()
|
||||||
}
|
}
|
||||||
fun onCorrect() {
|
fun onCorrect() {
|
||||||
if (!wordList.isEmpty()) {
|
_score.value = (_score.value)?.plus(1)
|
||||||
_score.value = (_score.value)?.plus(1)
|
|
||||||
}
|
|
||||||
nextWord()
|
nextWord()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -138,15 +138,11 @@ class GameViewModel : ViewModel() {
|
|||||||
|
|
||||||
/** Methods for updating the UI **/
|
/** Methods for updating the UI **/
|
||||||
fun onSkip() {
|
fun onSkip() {
|
||||||
if (!wordList.isEmpty()) {
|
_score.value = (_score.value)?.minus(1)
|
||||||
_score.value = (_score.value)?.minus(1)
|
|
||||||
}
|
|
||||||
nextWord()
|
nextWord()
|
||||||
}
|
}
|
||||||
fun onCorrect() {
|
fun onCorrect() {
|
||||||
if (!wordList.isEmpty()) {
|
_score.value = (_score.value)?.plus(1)
|
||||||
_score.value = (_score.value)?.plus(1)
|
|
||||||
}
|
|
||||||
nextWord()
|
nextWord()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -80,15 +80,11 @@ class GameViewModel : ViewModel() {
|
|||||||
|
|
||||||
/** Methods for updating the UI **/
|
/** Methods for updating the UI **/
|
||||||
fun onSkip() {
|
fun onSkip() {
|
||||||
if (!wordList.isEmpty()) {
|
score--
|
||||||
score--
|
|
||||||
}
|
|
||||||
nextWord()
|
nextWord()
|
||||||
}
|
}
|
||||||
fun onCorrect() {
|
fun onCorrect() {
|
||||||
if (!wordList.isEmpty()) {
|
score++
|
||||||
score++
|
|
||||||
}
|
|
||||||
nextWord()
|
nextWord()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user