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))
|
analyticsManager.sentEvent(Event.LongPressArea(index))
|
||||||
} else {
|
} else {
|
||||||
levelFacade.openNeighbors(index)
|
levelFacade.openNeighbors(index)
|
||||||
refreshGameStatus()
|
|
||||||
|
|
||||||
analyticsManager.sentEvent(Event.LongPressMultipleArea(index))
|
analyticsManager.sentEvent(Event.LongPressMultipleArea(index))
|
||||||
}
|
}
|
||||||
|
|
||||||
field.postValue(levelFacade.field.toList())
|
field.postValue(levelFacade.field.toList())
|
||||||
|
|
||||||
if (levelFacade.hasMines) {
|
refreshGameStatus()
|
||||||
mineCount.postValue(levelFacade.remainingMines())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onClickArea(index: Int) {
|
fun onClickArea(index: Int) {
|
||||||
|
@ -186,14 +183,11 @@ class GameViewModel(
|
||||||
private fun refreshMineCount() = mineCount.postValue(levelFacade.remainingMines())
|
private fun refreshMineCount() = mineCount.postValue(levelFacade.remainingMines())
|
||||||
|
|
||||||
private fun refreshGameStatus() {
|
private fun refreshGameStatus() {
|
||||||
refreshMineCount()
|
|
||||||
|
|
||||||
when {
|
when {
|
||||||
levelFacade.hasAnyMineExploded() -> {
|
levelFacade.hasAnyMineExploded() -> {
|
||||||
hapticFeedbackInteractor.explosionFeedback()
|
hapticFeedbackInteractor.explosionFeedback()
|
||||||
eventObserver.postValue(GameEvent.GameOver)
|
eventObserver.postValue(GameEvent.GameOver)
|
||||||
}
|
}
|
||||||
levelFacade.checkVictory() -> eventObserver.postValue(GameEvent.Victory)
|
|
||||||
else -> {
|
else -> {
|
||||||
if (preferencesRepository.useFlagAssistant()){
|
if (preferencesRepository.useFlagAssistant()){
|
||||||
levelFacade.runFlagAssistant()
|
levelFacade.runFlagAssistant()
|
||||||
|
@ -201,6 +195,12 @@ class GameViewModel(
|
||||||
eventObserver.postValue(GameEvent.Running)
|
eventObserver.postValue(GameEvent.Running)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshMineCount()
|
||||||
|
|
||||||
|
if (levelFacade.checkVictory()) {
|
||||||
|
eventObserver.postValue(GameEvent.Victory)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun runClock() {
|
fun runClock() {
|
||||||
|
|
Loading…
Reference in a new issue