mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-14 01:39:40 +07:00
EventHub removal - Removed 'MultiplayerGameAdded' event
This commit is contained in:
@ -18,7 +18,6 @@ import com.unciv.utils.Concurrency
|
|||||||
import com.unciv.utils.Dispatcher
|
import com.unciv.utils.Dispatcher
|
||||||
import com.unciv.utils.debug
|
import com.unciv.utils.debug
|
||||||
import com.unciv.utils.launchOnThreadPool
|
import com.unciv.utils.launchOnThreadPool
|
||||||
import com.unciv.utils.withGLContext
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.coroutineScope
|
import kotlinx.coroutines.coroutineScope
|
||||||
@ -42,7 +41,7 @@ private val FILE_UPDATE_THROTTLE_PERIOD = Duration.ofSeconds(60)
|
|||||||
/**
|
/**
|
||||||
* Provides multiplayer functionality to the rest of the game.
|
* Provides multiplayer functionality to the rest of the game.
|
||||||
*
|
*
|
||||||
* See the file of [com.unciv.logic.multiplayer.MultiplayerGameAdded] for all available [EventBus] events.
|
* See the file of [com.unciv.logic.multiplayer.HasMultiplayerGameName] for all available [EventBus] events.
|
||||||
*/
|
*/
|
||||||
class OnlineMultiplayer {
|
class OnlineMultiplayer {
|
||||||
private val files = UncivGame.Current.files
|
private val files = UncivGame.Current.files
|
||||||
@ -129,8 +128,6 @@ class OnlineMultiplayer {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires [MultiplayerGameAdded]
|
|
||||||
*
|
|
||||||
* @throws FileStorageRateLimitReached if the file storage backend can't handle any additional actions for a time
|
* @throws FileStorageRateLimitReached if the file storage backend can't handle any additional actions for a time
|
||||||
*/
|
*/
|
||||||
suspend fun createGame(newGame: GameInfo) {
|
suspend fun createGame(newGame: GameInfo) {
|
||||||
@ -139,8 +136,6 @@ class OnlineMultiplayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires [MultiplayerGameAdded]
|
|
||||||
*
|
|
||||||
* @param gameName if this is null or blank, will use the gameId as the game name
|
* @param gameName if this is null or blank, will use the gameId as the game name
|
||||||
* @return the final name the game was added under
|
* @return the final name the game was added under
|
||||||
* @throws FileStorageRateLimitReached if the file storage backend can't handle any additional actions for a time
|
* @throws FileStorageRateLimitReached if the file storage backend can't handle any additional actions for a time
|
||||||
@ -167,13 +162,10 @@ class OnlineMultiplayer {
|
|||||||
return addGame(fileHandle, preview)
|
return addGame(fileHandle, preview)
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun addGame(fileHandle: FileHandle, preview: GameInfoPreview? = null) {
|
private fun addGame(fileHandle: FileHandle, preview: GameInfoPreview? = null) {
|
||||||
debug("Adding game %s", fileHandle.name())
|
debug("Adding game %s", fileHandle.name())
|
||||||
val game = OnlineMultiplayerGame(fileHandle, preview, if (preview != null) Instant.now() else null)
|
val game = OnlineMultiplayerGame(fileHandle, preview, if (preview != null) Instant.now() else null)
|
||||||
savedGames[fileHandle] = game
|
savedGames[fileHandle] = game
|
||||||
withGLContext {
|
|
||||||
EventBus.send(MultiplayerGameAdded(game.name))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getGameByName(name: String): OnlineMultiplayerGame? {
|
fun getGameByName(name: String): OnlineMultiplayerGame? {
|
||||||
|
@ -12,12 +12,6 @@ interface MultiplayerGameUpdateSucceeded : Event, HasMultiplayerGameName {
|
|||||||
val preview: GameInfoPreview
|
val preview: GameInfoPreview
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets sent when a game was added.
|
|
||||||
*/
|
|
||||||
class MultiplayerGameAdded(
|
|
||||||
override val name: String
|
|
||||||
) : Event, HasMultiplayerGameName
|
|
||||||
/**
|
/**
|
||||||
* Gets sent when a game successfully updated
|
* Gets sent when a game successfully updated
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user