Small changes

This commit is contained in:
Lucas Lima 2020-08-17 20:31:51 -03:00
parent 47ee21afc2
commit c35c050f93
No known key found for this signature in database
GPG key ID: 049CCC5A365B00D2
4 changed files with 13 additions and 15 deletions

View file

@ -7,7 +7,12 @@ import dev.lucasnlm.antimine.common.level.database.converters.SaveStatusConverte
enum class SaveStatus(
val code: Int
) {
// Not finished game.
ON_GOING(0),
// Finished game with victory.
VICTORY(1),
// Finished game with game over.
DEFEAT(2)
}

View file

@ -3,7 +3,7 @@ package dev.lucasnlm.antimine.common.level.logic
import dev.lucasnlm.antimine.common.level.models.Area
import kotlin.math.absoluteValue
fun List<Area>.firstArea(id: Int) = this.first { it.id == id }
fun List<Area>.withId(id: Int) = this.first { it.id == id }
fun List<Area>.filterNeighborsOf(area: Area) = this.filter {
((it.posX - area.posX).absoluteValue <= 1 && (it.posY - area.posY).absoluteValue <= 1)
@ -13,4 +13,4 @@ fun List<Area>.filterNotNeighborsOf(area: Area) = this.filter {
((it.posX - area.posX).absoluteValue > 1 || (it.posY - area.posY).absoluteValue > 1)
}
fun List<Area>.filterNotNeighborsOf(areaIndex: Int) = this.filterNotNeighborsOf(this.firstArea(areaIndex))
fun List<Area>.filterNotNeighborsOf(areaId: Int) = this.filterNotNeighborsOf(this.withId(areaId))

View file

@ -7,16 +7,18 @@ import dev.lucasnlm.antimine.core.analytics.models.Analytics
class DebugAnalyticsManager : IAnalyticsManager {
override fun setup(context: Context, properties: Map<String, String>) {
if (properties.isNotEmpty()) {
Log.d(TAG, "Setup Analytics using $properties")
Log.i(TAG, "Setup Analytics using $properties")
}
}
override fun sentEvent(event: Analytics) {
if (event.extra.isNotEmpty()) {
Log.d(TAG, "Sent event: '${event.name}' with ${event.extra}")
val message = if (event.extra.isNotEmpty()) {
"Sent event: '${event.name}' with ${event.extra}"
} else {
Log.d(TAG, "Sent event: '${event.name}'")
"Sent event: '${event.name}'"
}
Log.i(TAG, message)
}
companion object {

View file

@ -106,12 +106,3 @@ sealed class GameControl(
}
}
}
/**
* A data class used to make feedback or analytics to an user action.
*/
data class ActionFeedback(
val actionResponse: ActionResponse?,
val index: Int,
val multipleChanges: Boolean
)