Renamed DifficultyPreset to Difficulty only
This commit is contained in:
parent
63e6750b0f
commit
5bd72333dd
12 changed files with 61 additions and 61 deletions
|
@ -246,10 +246,10 @@ class GameActivity : DaggerAppCompatActivity() {
|
||||||
var handled = true
|
var handled = true
|
||||||
|
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.standard -> changeDifficulty(DifficultyPreset.Standard)
|
R.id.standard -> changeDifficulty(Difficulty.Standard)
|
||||||
R.id.beginner -> changeDifficulty(DifficultyPreset.Beginner)
|
R.id.beginner -> changeDifficulty(Difficulty.Beginner)
|
||||||
R.id.intermediate -> changeDifficulty(DifficultyPreset.Intermediate)
|
R.id.intermediate -> changeDifficulty(Difficulty.Intermediate)
|
||||||
R.id.expert -> changeDifficulty(DifficultyPreset.Expert)
|
R.id.expert -> changeDifficulty(Difficulty.Expert)
|
||||||
R.id.custom -> showCustomLevelDialog()
|
R.id.custom -> showCustomLevelDialog()
|
||||||
R.id.about -> showAbout()
|
R.id.about -> showAbout()
|
||||||
R.id.settings -> showSettings()
|
R.id.settings -> showSettings()
|
||||||
|
@ -286,14 +286,14 @@ class GameActivity : DaggerAppCompatActivity() {
|
||||||
preferencesRepository.putInt(PREFERENCE_USE_COUNT, current + 1)
|
preferencesRepository.putInt(PREFERENCE_USE_COUNT, current + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onChangeDifficulty(difficulty: DifficultyPreset) {
|
private fun onChangeDifficulty(difficulty: Difficulty) {
|
||||||
navigationView.menu.apply {
|
navigationView.menu.apply {
|
||||||
arrayOf(
|
arrayOf(
|
||||||
DifficultyPreset.Standard to findItem(R.id.standard),
|
Difficulty.Standard to findItem(R.id.standard),
|
||||||
DifficultyPreset.Beginner to findItem(R.id.beginner),
|
Difficulty.Beginner to findItem(R.id.beginner),
|
||||||
DifficultyPreset.Intermediate to findItem(R.id.intermediate),
|
Difficulty.Intermediate to findItem(R.id.intermediate),
|
||||||
DifficultyPreset.Expert to findItem(R.id.expert),
|
Difficulty.Expert to findItem(R.id.expert),
|
||||||
DifficultyPreset.Custom to findItem(R.id.custom)
|
Difficulty.Custom to findItem(R.id.custom)
|
||||||
).map {
|
).map {
|
||||||
it.second to (if (it.first == difficulty) R.drawable.checked else R.drawable.unchecked)
|
it.second to (if (it.first == difficulty) R.drawable.checked else R.drawable.unchecked)
|
||||||
}.forEach { (menuItem, icon) ->
|
}.forEach { (menuItem, icon) ->
|
||||||
|
@ -407,7 +407,7 @@ class GameActivity : DaggerAppCompatActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun changeDifficulty(newDifficulty: DifficultyPreset) {
|
private fun changeDifficulty(newDifficulty: Difficulty) {
|
||||||
if (status == Status.PreGame) {
|
if (status == Status.PreGame) {
|
||||||
GlobalScope.launch {
|
GlobalScope.launch {
|
||||||
viewModel.startNewGame(newDifficulty)
|
viewModel.startNewGame(newDifficulty)
|
||||||
|
|
|
@ -250,7 +250,7 @@ class TvGameActivity : DaggerAppCompatActivity() {
|
||||||
}, null, DateUtils.SECOND_IN_MILLIS)
|
}, null, DateUtils.SECOND_IN_MILLIS)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun changeDifficulty(newDifficulty: DifficultyPreset) {
|
private fun changeDifficulty(newDifficulty: Difficulty) {
|
||||||
if (status == Status.PreGame) {
|
if (status == Status.PreGame) {
|
||||||
GlobalScope.launch {
|
GlobalScope.launch {
|
||||||
viewModel.startNewGame(newDifficulty)
|
viewModel.startNewGame(newDifficulty)
|
||||||
|
|
|
@ -8,7 +8,7 @@ import androidx.lifecycle.ViewModelProviders
|
||||||
|
|
||||||
import dagger.android.support.DaggerAppCompatDialogFragment
|
import dagger.android.support.DaggerAppCompatDialogFragment
|
||||||
import dev.lucasnlm.antimine.R
|
import dev.lucasnlm.antimine.R
|
||||||
import dev.lucasnlm.antimine.common.level.models.DifficultyPreset
|
import dev.lucasnlm.antimine.common.level.models.Difficulty
|
||||||
import dev.lucasnlm.antimine.common.level.models.Minefield
|
import dev.lucasnlm.antimine.common.level.models.Minefield
|
||||||
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
|
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
|
||||||
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModelFactory
|
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModelFactory
|
||||||
|
@ -80,7 +80,7 @@ class CustomLevelDialogFragment : DaggerAppCompatDialogFragment() {
|
||||||
)
|
)
|
||||||
|
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
GlobalScope.launch(Dispatchers.IO) {
|
||||||
viewModel.startNewGame(DifficultyPreset.Custom)
|
viewModel.startNewGame(Difficulty.Custom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.create()
|
}.create()
|
||||||
|
|
|
@ -11,7 +11,7 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import dev.lucasnlm.antimine.common.R
|
import dev.lucasnlm.antimine.common.R
|
||||||
import dev.lucasnlm.antimine.common.level.view.UnlockedHorizontalScrollView
|
import dev.lucasnlm.antimine.common.level.view.UnlockedHorizontalScrollView
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
import dev.lucasnlm.antimine.common.level.models.DifficultyPreset
|
import dev.lucasnlm.antimine.common.level.models.Difficulty
|
||||||
import dev.lucasnlm.antimine.common.level.models.Event
|
import dev.lucasnlm.antimine.common.level.models.Event
|
||||||
import dev.lucasnlm.antimine.common.level.view.AreaAdapter
|
import dev.lucasnlm.antimine.common.level.view.AreaAdapter
|
||||||
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
|
import dev.lucasnlm.antimine.common.level.viewmodel.GameViewModel
|
||||||
|
@ -110,16 +110,16 @@ open class LevelFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleNewGameDeeplink(): DifficultyPreset? {
|
private fun handleNewGameDeeplink(): Difficulty? {
|
||||||
var result: DifficultyPreset? = null
|
var result: Difficulty? = null
|
||||||
|
|
||||||
activity?.intent?.data?.let { uri ->
|
activity?.intent?.data?.let { uri ->
|
||||||
if (uri.scheme == DEFAULT_SCHEME) {
|
if (uri.scheme == DEFAULT_SCHEME) {
|
||||||
result = when (uri.schemeSpecificPart.removePrefix("//new-game/")) {
|
result = when (uri.schemeSpecificPart.removePrefix("//new-game/")) {
|
||||||
"beginner" -> DifficultyPreset.Beginner
|
"beginner" -> Difficulty.Beginner
|
||||||
"intermediate" -> DifficultyPreset.Intermediate
|
"intermediate" -> Difficulty.Intermediate
|
||||||
"expert" -> DifficultyPreset.Expert
|
"expert" -> Difficulty.Expert
|
||||||
"standard" -> DifficultyPreset.Standard
|
"standard" -> Difficulty.Standard
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
package dev.lucasnlm.antimine.common.level
|
package dev.lucasnlm.antimine.common.level
|
||||||
|
|
||||||
import dev.lucasnlm.antimine.common.level.models.DifficultyPreset
|
import dev.lucasnlm.antimine.common.level.models.Difficulty
|
||||||
import dev.lucasnlm.antimine.common.level.models.Minefield
|
import dev.lucasnlm.antimine.common.level.models.Minefield
|
||||||
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
|
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
|
||||||
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository
|
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository
|
||||||
|
|
||||||
object GameModeFactory {
|
object GameModeFactory {
|
||||||
fun fromDifficultyPreset(
|
fun fromDifficultyPreset(
|
||||||
difficulty: DifficultyPreset,
|
difficulty: Difficulty,
|
||||||
dimensionRepository: IDimensionRepository,
|
dimensionRepository: IDimensionRepository,
|
||||||
preferencesRepository: IPreferencesRepository
|
preferencesRepository: IPreferencesRepository
|
||||||
): Minefield =
|
): Minefield =
|
||||||
when (difficulty) {
|
when (difficulty) {
|
||||||
DifficultyPreset.Standard -> calculateStandardMode(dimensionRepository)
|
Difficulty.Standard -> calculateStandardMode(dimensionRepository)
|
||||||
DifficultyPreset.Beginner -> Minefield(
|
Difficulty.Beginner -> Minefield(
|
||||||
9,
|
9,
|
||||||
9,
|
9,
|
||||||
10
|
10
|
||||||
)
|
)
|
||||||
DifficultyPreset.Intermediate -> Minefield(
|
Difficulty.Intermediate -> Minefield(
|
||||||
16,
|
16,
|
||||||
16,
|
16,
|
||||||
40
|
40
|
||||||
)
|
)
|
||||||
DifficultyPreset.Expert -> Minefield(
|
Difficulty.Expert -> Minefield(
|
||||||
24,
|
24,
|
||||||
24,
|
24,
|
||||||
99
|
99
|
||||||
)
|
)
|
||||||
DifficultyPreset.Custom -> preferencesRepository.customGameMode()
|
Difficulty.Custom -> preferencesRepository.customGameMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun calculateStandardMode(
|
private fun calculateStandardMode(
|
||||||
|
|
|
@ -248,7 +248,7 @@ class LevelFacade {
|
||||||
(it.posX == this.posX + x) && (it.posY == this.posY + y)
|
(it.posX == this.posX + x) && (it.posY == this.posY + y)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getSaveState(duration: Long, difficulty: DifficultyPreset): Save {
|
fun getSaveState(duration: Long, difficulty: Difficulty): Save {
|
||||||
val saveStatus: SaveStatus = when {
|
val saveStatus: SaveStatus = when {
|
||||||
checkVictory() -> SaveStatus.VICTORY
|
checkVictory() -> SaveStatus.VICTORY
|
||||||
hasAnyMineExploded() -> SaveStatus.DEFEAT
|
hasAnyMineExploded() -> SaveStatus.DEFEAT
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
package dev.lucasnlm.antimine.common.level.database.converters
|
package dev.lucasnlm.antimine.common.level.database.converters
|
||||||
|
|
||||||
import androidx.room.TypeConverter
|
import androidx.room.TypeConverter
|
||||||
import dev.lucasnlm.antimine.common.level.models.DifficultyPreset
|
import dev.lucasnlm.antimine.common.level.models.Difficulty
|
||||||
|
|
||||||
class DifficultyConverter {
|
class DifficultyConverter {
|
||||||
|
|
||||||
@TypeConverter
|
@TypeConverter
|
||||||
fun toDifficulty(difficulty: Int): DifficultyPreset =
|
fun toDifficulty(difficulty: Int): Difficulty =
|
||||||
when (difficulty) {
|
when (difficulty) {
|
||||||
0 -> DifficultyPreset.Standard
|
0 -> Difficulty.Standard
|
||||||
1 -> DifficultyPreset.Beginner
|
1 -> Difficulty.Beginner
|
||||||
2 -> DifficultyPreset.Intermediate
|
2 -> Difficulty.Intermediate
|
||||||
3 -> DifficultyPreset.Expert
|
3 -> Difficulty.Expert
|
||||||
else -> throw IllegalArgumentException("Could not recognize Difficulty")
|
else -> throw IllegalArgumentException("Could not recognize Difficulty")
|
||||||
}
|
}
|
||||||
|
|
||||||
@TypeConverter
|
@TypeConverter
|
||||||
fun toInteger(difficulty: DifficultyPreset): Int = difficulty.ordinal
|
fun toInteger(difficulty: Difficulty): Int = difficulty.ordinal
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import androidx.room.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
import androidx.room.TypeConverters
|
import androidx.room.TypeConverters
|
||||||
import dev.lucasnlm.antimine.common.level.models.Area
|
import dev.lucasnlm.antimine.common.level.models.Area
|
||||||
import dev.lucasnlm.antimine.common.level.models.DifficultyPreset
|
import dev.lucasnlm.antimine.common.level.models.Difficulty
|
||||||
import dev.lucasnlm.antimine.common.level.models.Minefield
|
import dev.lucasnlm.antimine.common.level.models.Minefield
|
||||||
import dev.lucasnlm.antimine.common.level.database.converters.FieldConverter
|
import dev.lucasnlm.antimine.common.level.database.converters.FieldConverter
|
||||||
import dev.lucasnlm.antimine.common.level.database.converters.SaveStatusConverter
|
import dev.lucasnlm.antimine.common.level.database.converters.SaveStatusConverter
|
||||||
|
@ -28,7 +28,7 @@ data class Save(
|
||||||
val minefield: Minefield,
|
val minefield: Minefield,
|
||||||
|
|
||||||
@ColumnInfo(name = "difficulty")
|
@ColumnInfo(name = "difficulty")
|
||||||
val difficulty: DifficultyPreset,
|
val difficulty: Difficulty,
|
||||||
|
|
||||||
@TypeConverters(SaveStatusConverter::class)
|
@TypeConverters(SaveStatusConverter::class)
|
||||||
@ColumnInfo(name = "status")
|
@ColumnInfo(name = "status")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package dev.lucasnlm.antimine.common.level.models
|
package dev.lucasnlm.antimine.common.level.models
|
||||||
|
|
||||||
enum class DifficultyPreset(
|
enum class Difficulty(
|
||||||
val text: String
|
val text: String
|
||||||
) {
|
) {
|
||||||
Standard("STANDARD"),
|
Standard("STANDARD"),
|
|
@ -6,7 +6,7 @@ import androidx.lifecycle.ViewModel
|
||||||
import dev.lucasnlm.antimine.common.level.GameModeFactory
|
import dev.lucasnlm.antimine.common.level.GameModeFactory
|
||||||
import dev.lucasnlm.antimine.common.level.LevelFacade
|
import dev.lucasnlm.antimine.common.level.LevelFacade
|
||||||
import dev.lucasnlm.antimine.common.level.models.Area
|
import dev.lucasnlm.antimine.common.level.models.Area
|
||||||
import dev.lucasnlm.antimine.common.level.models.DifficultyPreset
|
import dev.lucasnlm.antimine.common.level.models.Difficulty
|
||||||
import dev.lucasnlm.antimine.common.level.models.Event
|
import dev.lucasnlm.antimine.common.level.models.Event
|
||||||
import dev.lucasnlm.antimine.common.level.models.Minefield
|
import dev.lucasnlm.antimine.common.level.models.Minefield
|
||||||
import dev.lucasnlm.antimine.common.level.database.models.Save
|
import dev.lucasnlm.antimine.common.level.database.models.Save
|
||||||
|
@ -33,35 +33,35 @@ class GameViewModel(
|
||||||
private val clock: Clock
|
private val clock: Clock
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
private lateinit var levelFacade: LevelFacade
|
private lateinit var levelFacade: LevelFacade
|
||||||
private var currentDifficulty: DifficultyPreset = DifficultyPreset.Standard
|
private var currentDifficulty: Difficulty = Difficulty.Standard
|
||||||
private var initialized = false
|
private var initialized = false
|
||||||
|
|
||||||
val field = MutableLiveData<List<Area>>()
|
val field = MutableLiveData<List<Area>>()
|
||||||
val fieldRefresh = MutableLiveData<Int>()
|
val fieldRefresh = MutableLiveData<Int>()
|
||||||
val elapsedTimeSeconds = MutableLiveData<Long>()
|
val elapsedTimeSeconds = MutableLiveData<Long>()
|
||||||
val mineCount = MutableLiveData<Int>()
|
val mineCount = MutableLiveData<Int>()
|
||||||
val difficulty = MutableLiveData<DifficultyPreset>()
|
val difficulty = MutableLiveData<Difficulty>()
|
||||||
val levelSetup = MutableLiveData<Minefield>()
|
val levelSetup = MutableLiveData<Minefield>()
|
||||||
|
|
||||||
private fun startNewGame(gameId: Int, difficultyPreset: DifficultyPreset): Minefield {
|
private fun startNewGame(gameId: Int, difficulty: Difficulty): Minefield {
|
||||||
clock.reset()
|
clock.reset()
|
||||||
elapsedTimeSeconds.postValue(0L)
|
elapsedTimeSeconds.postValue(0L)
|
||||||
currentDifficulty = difficultyPreset
|
currentDifficulty = difficulty
|
||||||
|
|
||||||
val setup = GameModeFactory.fromDifficultyPreset(
|
val setup = GameModeFactory.fromDifficultyPreset(
|
||||||
difficultyPreset, dimensionRepository, preferencesRepository
|
difficulty, dimensionRepository, preferencesRepository
|
||||||
)
|
)
|
||||||
|
|
||||||
levelFacade = LevelFacade(gameId, setup)
|
levelFacade = LevelFacade(gameId, setup)
|
||||||
|
|
||||||
mineCount.postValue(setup.mines)
|
mineCount.postValue(setup.mines)
|
||||||
difficulty.postValue(difficultyPreset)
|
this.difficulty.postValue(difficulty)
|
||||||
levelSetup.postValue(setup)
|
levelSetup.postValue(setup)
|
||||||
field.postValue(levelFacade.field.toList())
|
field.postValue(levelFacade.field.toList())
|
||||||
|
|
||||||
eventObserver.postValue(Event.StartNewGame)
|
eventObserver.postValue(Event.StartNewGame)
|
||||||
|
|
||||||
analyticsManager.sentEvent(Analytics.NewGame(setup, difficultyPreset, levelFacade.seed, useAccessibilityMode()))
|
analyticsManager.sentEvent(Analytics.NewGame(setup, difficulty, levelFacade.seed, useAccessibilityMode()))
|
||||||
|
|
||||||
return setup
|
return setup
|
||||||
}
|
}
|
||||||
|
@ -88,13 +88,13 @@ class GameViewModel(
|
||||||
return setup
|
return setup
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun startNewGame(difficultyPreset: DifficultyPreset = currentDifficulty): Minefield =
|
suspend fun startNewGame(difficulty: Difficulty = currentDifficulty): Minefield =
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val newGameId = savesRepository.getNewSaveId()
|
val newGameId = savesRepository.getNewSaveId()
|
||||||
startNewGame(newGameId, difficultyPreset)
|
startNewGame(newGameId, difficulty)
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun onCreate(newGame: DifficultyPreset? = null): Minefield = withContext(Dispatchers.IO) {
|
suspend fun onCreate(newGame: Difficulty? = null): Minefield = withContext(Dispatchers.IO) {
|
||||||
val lastGame = if (newGame == null) savesRepository.fetchCurrentSave() else null
|
val lastGame = if (newGame == null) savesRepository.fetchCurrentSave() else null
|
||||||
|
|
||||||
if (lastGame != null) {
|
if (lastGame != null) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package dev.lucasnlm.antimine.core.analytics.models
|
package dev.lucasnlm.antimine.core.analytics.models
|
||||||
|
|
||||||
import dev.lucasnlm.antimine.common.level.models.DifficultyPreset
|
import dev.lucasnlm.antimine.common.level.models.Difficulty
|
||||||
import dev.lucasnlm.antimine.common.level.models.Score
|
import dev.lucasnlm.antimine.common.level.models.Score
|
||||||
import dev.lucasnlm.antimine.common.level.models.Minefield
|
import dev.lucasnlm.antimine.common.level.models.Minefield
|
||||||
|
|
||||||
|
@ -10,10 +10,10 @@ sealed class Analytics(
|
||||||
) {
|
) {
|
||||||
class Open : Analytics("Open game")
|
class Open : Analytics("Open game")
|
||||||
|
|
||||||
class NewGame(minefield: Minefield, difficultyPreset: DifficultyPreset, seed: Long, useAccessibilityMode: Boolean) :
|
class NewGame(minefield: Minefield, difficulty: Difficulty, seed: Long, useAccessibilityMode: Boolean) :
|
||||||
Analytics("New Game", mapOf(
|
Analytics("New Game", mapOf(
|
||||||
"Seed" to seed.toString(),
|
"Seed" to seed.toString(),
|
||||||
"Difficulty Preset" to difficultyPreset.text,
|
"Difficulty Preset" to difficulty.text,
|
||||||
"Width" to minefield.width.toString(),
|
"Width" to minefield.width.toString(),
|
||||||
"Height" to minefield.height.toString(),
|
"Height" to minefield.height.toString(),
|
||||||
"Mines" to minefield.mines.toString(),
|
"Mines" to minefield.mines.toString(),
|
||||||
|
@ -44,11 +44,11 @@ sealed class Analytics(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
class Victory(time: Long, score: Score, difficultyPreset: DifficultyPreset) : Analytics(
|
class Victory(time: Long, score: Score, difficulty: Difficulty) : Analytics(
|
||||||
"Victory",
|
"Victory",
|
||||||
mapOf(
|
mapOf(
|
||||||
"Time" to time.toString(),
|
"Time" to time.toString(),
|
||||||
"Difficulty" to difficultyPreset.text,
|
"Difficulty" to difficulty.text,
|
||||||
"Right Mines" to score.rightMines.toString(),
|
"Right Mines" to score.rightMines.toString(),
|
||||||
"Total Mines" to score.totalMines.toString(),
|
"Total Mines" to score.totalMines.toString(),
|
||||||
"Total Area" to score.totalArea.toString()
|
"Total Area" to score.totalArea.toString()
|
||||||
|
|
|
@ -3,7 +3,7 @@ package dev.lucasnlm.antimine.common.level
|
||||||
import android.util.DisplayMetrics
|
import android.util.DisplayMetrics
|
||||||
import com.nhaarman.mockitokotlin2.doReturn
|
import com.nhaarman.mockitokotlin2.doReturn
|
||||||
import com.nhaarman.mockitokotlin2.mock
|
import com.nhaarman.mockitokotlin2.mock
|
||||||
import dev.lucasnlm.antimine.common.level.models.DifficultyPreset
|
import dev.lucasnlm.antimine.common.level.models.Difficulty
|
||||||
import dev.lucasnlm.antimine.common.level.models.Minefield
|
import dev.lucasnlm.antimine.common.level.models.Minefield
|
||||||
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
|
import dev.lucasnlm.antimine.common.level.repository.IDimensionRepository
|
||||||
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository
|
import dev.lucasnlm.antimine.core.preferences.IPreferencesRepository
|
||||||
|
@ -17,7 +17,7 @@ class MinefieldFactoryTest {
|
||||||
@Test
|
@Test
|
||||||
fun testFromDifficultyPresetBeginner() {
|
fun testFromDifficultyPresetBeginner() {
|
||||||
GameModeFactory.fromDifficultyPreset(
|
GameModeFactory.fromDifficultyPreset(
|
||||||
DifficultyPreset.Beginner, dimensionRepository, preferencesRepository
|
Difficulty.Beginner, dimensionRepository, preferencesRepository
|
||||||
).run {
|
).run {
|
||||||
assertEquals(9, width)
|
assertEquals(9, width)
|
||||||
assertEquals(9, height)
|
assertEquals(9, height)
|
||||||
|
@ -28,7 +28,7 @@ class MinefieldFactoryTest {
|
||||||
@Test
|
@Test
|
||||||
fun testFromDifficultyPresetIntermediate() {
|
fun testFromDifficultyPresetIntermediate() {
|
||||||
GameModeFactory.fromDifficultyPreset(
|
GameModeFactory.fromDifficultyPreset(
|
||||||
DifficultyPreset.Intermediate, dimensionRepository, preferencesRepository
|
Difficulty.Intermediate, dimensionRepository, preferencesRepository
|
||||||
).run {
|
).run {
|
||||||
assertEquals(16, width)
|
assertEquals(16, width)
|
||||||
assertEquals(16, height)
|
assertEquals(16, height)
|
||||||
|
@ -39,7 +39,7 @@ class MinefieldFactoryTest {
|
||||||
@Test
|
@Test
|
||||||
fun testFromDifficultyPresetExpert() {
|
fun testFromDifficultyPresetExpert() {
|
||||||
GameModeFactory.fromDifficultyPreset(
|
GameModeFactory.fromDifficultyPreset(
|
||||||
DifficultyPreset.Expert, dimensionRepository, preferencesRepository
|
Difficulty.Expert, dimensionRepository, preferencesRepository
|
||||||
).run {
|
).run {
|
||||||
assertEquals(24, width)
|
assertEquals(24, width)
|
||||||
assertEquals(24, height)
|
assertEquals(24, height)
|
||||||
|
@ -58,7 +58,7 @@ class MinefieldFactoryTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
GameModeFactory.fromDifficultyPreset(
|
GameModeFactory.fromDifficultyPreset(
|
||||||
DifficultyPreset.Custom,
|
Difficulty.Custom,
|
||||||
mock(),
|
mock(),
|
||||||
preferencesRepository
|
preferencesRepository
|
||||||
).run {
|
).run {
|
||||||
|
@ -80,7 +80,7 @@ class MinefieldFactoryTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
GameModeFactory.fromDifficultyPreset(
|
GameModeFactory.fromDifficultyPreset(
|
||||||
DifficultyPreset.Standard,
|
Difficulty.Standard,
|
||||||
dimensionRepository,
|
dimensionRepository,
|
||||||
preferencesRepository
|
preferencesRepository
|
||||||
).run {
|
).run {
|
||||||
|
|
Loading…
Reference in a new issue