-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #478 from lucasnlm/new-build
Fix lint
- Loading branch information
Showing
17 changed files
with
226 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
common/src/main/java/dev/lucasnlm/antimine/common/level/logic/VisibleMineStream.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package dev.lucasnlm.antimine.common.level.logic | ||
|
||
import kotlinx.coroutines.flow.MutableSharedFlow | ||
import kotlinx.coroutines.flow.SharedFlow | ||
import kotlinx.coroutines.flow.asSharedFlow | ||
|
||
class VisibleMineStream { | ||
private val visibleMinesFlow = | ||
MutableSharedFlow<Set<Int>>( | ||
extraBufferCapacity = 1, | ||
) | ||
private val requestVisibleMinesFlow = | ||
MutableSharedFlow<Unit>( | ||
extraBufferCapacity = 1, | ||
) | ||
|
||
/** Returns a [SharedFlow] that emits the visible mines. */ | ||
fun observeVisibleMines() = visibleMinesFlow.asSharedFlow() | ||
|
||
/** Updates the visible mines. */ | ||
fun update(visibleMines: Set<Int>) { | ||
visibleMinesFlow.tryEmit(visibleMines) | ||
} | ||
|
||
/** Requests the visible mines. */ | ||
suspend fun requestVisibleMines() { | ||
requestVisibleMinesFlow.emit(Unit) | ||
} | ||
|
||
/** Returns a [SharedFlow] that emits when the visible mines are requested. */ | ||
fun observeRequestVisibleMines() = requestVisibleMinesFlow.asSharedFlow() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.