Merge pull request #3 from lucasnlm/fix-assistant-bug
Fix assistant bug
This commit is contained in:
commit
48fed5a6a0
1 changed files with 7 additions and 7 deletions
|
@ -150,16 +150,13 @@ class GameViewModel(
|
|||
analyticsManager.sentEvent(Event.LongPressArea(index))
|
||||
} else {
|
||||
levelFacade.openNeighbors(index)
|
||||
refreshGameStatus()
|
||||
|
||||
analyticsManager.sentEvent(Event.LongPressMultipleArea(index))
|
||||
}
|
||||
|
||||
field.postValue(levelFacade.field.toList())
|
||||
|
||||
if (levelFacade.hasMines) {
|
||||
mineCount.postValue(levelFacade.remainingMines())
|
||||
}
|
||||
refreshGameStatus()
|
||||
}
|
||||
|
||||
fun onClickArea(index: Int) {
|
||||
|
@ -186,14 +183,11 @@ class GameViewModel(
|
|||
private fun refreshMineCount() = mineCount.postValue(levelFacade.remainingMines())
|
||||
|
||||
private fun refreshGameStatus() {
|
||||
refreshMineCount()
|
||||
|
||||
when {
|
||||
levelFacade.hasAnyMineExploded() -> {
|
||||
hapticFeedbackInteractor.explosionFeedback()
|
||||
eventObserver.postValue(GameEvent.GameOver)
|
||||
}
|
||||
levelFacade.checkVictory() -> eventObserver.postValue(GameEvent.Victory)
|
||||
else -> {
|
||||
if (preferencesRepository.useFlagAssistant()){
|
||||
levelFacade.runFlagAssistant()
|
||||
|
@ -201,6 +195,12 @@ class GameViewModel(
|
|||
eventObserver.postValue(GameEvent.Running)
|
||||
}
|
||||
}
|
||||
|
||||
refreshMineCount()
|
||||
|
||||
if (levelFacade.checkVictory()) {
|
||||
eventObserver.postValue(GameEvent.Victory)
|
||||
}
|
||||
}
|
||||
|
||||
fun runClock() {
|
||||
|
|
Loading…
Reference in a new issue