mirror of
https://github.com/Skysamara/android-kotlin-fundamentals-apps.git
synced 2025-12-06 06:16:03 +00:00
Merge pull request #20 from google-developer-training/developer
FiX: Score is not updated for the last word
This commit is contained in:
commit
3829e9adbe
@ -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