Small changes
This commit is contained in:
parent
47ee21afc2
commit
c35c050f93
4 changed files with 13 additions and 15 deletions
|
@ -7,7 +7,12 @@ import dev.lucasnlm.antimine.common.level.database.converters.SaveStatusConverte
|
||||||
enum class SaveStatus(
|
enum class SaveStatus(
|
||||||
val code: Int
|
val code: Int
|
||||||
) {
|
) {
|
||||||
|
// Not finished game.
|
||||||
ON_GOING(0),
|
ON_GOING(0),
|
||||||
|
|
||||||
|
// Finished game with victory.
|
||||||
VICTORY(1),
|
VICTORY(1),
|
||||||
|
|
||||||
|
// Finished game with game over.
|
||||||
DEFEAT(2)
|
DEFEAT(2)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package dev.lucasnlm.antimine.common.level.logic
|
||||||
import dev.lucasnlm.antimine.common.level.models.Area
|
import dev.lucasnlm.antimine.common.level.models.Area
|
||||||
import kotlin.math.absoluteValue
|
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 {
|
fun List<Area>.filterNeighborsOf(area: Area) = this.filter {
|
||||||
((it.posX - area.posX).absoluteValue <= 1 && (it.posY - area.posY).absoluteValue <= 1)
|
((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)
|
((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))
|
||||||
|
|
|
@ -7,16 +7,18 @@ import dev.lucasnlm.antimine.core.analytics.models.Analytics
|
||||||
class DebugAnalyticsManager : IAnalyticsManager {
|
class DebugAnalyticsManager : IAnalyticsManager {
|
||||||
override fun setup(context: Context, properties: Map<String, String>) {
|
override fun setup(context: Context, properties: Map<String, String>) {
|
||||||
if (properties.isNotEmpty()) {
|
if (properties.isNotEmpty()) {
|
||||||
Log.d(TAG, "Setup Analytics using $properties")
|
Log.i(TAG, "Setup Analytics using $properties")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun sentEvent(event: Analytics) {
|
override fun sentEvent(event: Analytics) {
|
||||||
if (event.extra.isNotEmpty()) {
|
val message = if (event.extra.isNotEmpty()) {
|
||||||
Log.d(TAG, "Sent event: '${event.name}' with ${event.extra}")
|
"Sent event: '${event.name}' with ${event.extra}"
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "Sent event: '${event.name}'")
|
"Sent event: '${event.name}'"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.i(TAG, message)
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -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
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in a new issue