mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 07:17:50 +07:00
Removed exitEvent from the UncivGameParameters, since Gdx.app.exit() does the same thing :)
This commit is contained in:
@ -33,7 +33,6 @@ class AndroidLauncher : AndroidApplication() {
|
||||
val androidParameters = UncivGameParameters(
|
||||
version = BuildConfig.VERSION_NAME,
|
||||
crashReportSender = CrashReportSenderAndroid(this),
|
||||
exitEvent = this::finish,
|
||||
fontImplementation = NativeFontAndroid(ORIGINAL_FONT_SIZE.toInt()),
|
||||
customSaveLocationHelper = customSaveLocationHelper
|
||||
)
|
||||
|
@ -27,7 +27,6 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
||||
|
||||
val version = parameters.version
|
||||
private val crashReportSender = parameters.crashReportSender
|
||||
val exitEvent = parameters.exitEvent
|
||||
val cancelDiscordEvent = parameters.cancelDiscordEvent
|
||||
val fontImplementation = parameters.fontImplementation
|
||||
val consoleMode = parameters.consoleMode
|
||||
|
@ -6,8 +6,7 @@ import com.unciv.ui.utils.NativeFontImplementation
|
||||
|
||||
class UncivGameParameters(val version: String,
|
||||
val crashReportSender: CrashReportSender? = null,
|
||||
val exitEvent: (()->Unit)? = null,
|
||||
val cancelDiscordEvent: (()->Unit)? = null,
|
||||
val cancelDiscordEvent: (() -> Unit)? = null,
|
||||
val fontImplementation: NativeFontImplementation? = null,
|
||||
val consoleMode: Boolean = false,
|
||||
val customSaveLocationHelper: CustomSaveLocationHelper? = null) {
|
||||
|
@ -689,15 +689,10 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
return
|
||||
}
|
||||
|
||||
// don't show a dialog, if it can't exit the game
|
||||
if (game.exitEvent == null) {
|
||||
return
|
||||
}
|
||||
|
||||
val promptWindow = Popup(this)
|
||||
promptWindow.addGoodSizedLabel("Do you want to exit the game?".tr())
|
||||
promptWindow.row()
|
||||
promptWindow.addButton("Yes") { game.exitEvent?.invoke() }
|
||||
promptWindow.addButton("Yes") { Gdx.app.exit() }
|
||||
promptWindow.addButton("No") {
|
||||
promptWindow.close()
|
||||
}
|
||||
|
@ -12,12 +12,7 @@ import com.unciv.models.metadata.GameSpeed
|
||||
import com.unciv.models.metadata.Player
|
||||
import com.unciv.models.ruleset.RulesetCache
|
||||
import com.unciv.models.simulation.Simulation
|
||||
import com.unciv.models.simulation.SimulationStep
|
||||
import com.unciv.models.simulation.formatDuration
|
||||
import com.unciv.ui.newgamescreen.GameSetupInfo
|
||||
import java.time.Duration
|
||||
import kotlin.concurrent.thread
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
internal object ConsoleLauncher {
|
||||
@JvmStatic
|
||||
@ -27,7 +22,6 @@ internal object ConsoleLauncher {
|
||||
val consoleParameters = UncivGameParameters(
|
||||
version,
|
||||
null,
|
||||
{ exitProcess(0) },
|
||||
null,
|
||||
null,
|
||||
true
|
||||
|
@ -25,7 +25,6 @@ import io.ktor.server.netty.Netty
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import kotlin.concurrent.timer
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
internal object DesktopLauncher {
|
||||
private var discordTimer: Timer? = null
|
||||
@ -48,7 +47,6 @@ internal object DesktopLauncher {
|
||||
|
||||
val desktopParameters = UncivGameParameters(
|
||||
versionFromJar,
|
||||
exitEvent = { exitProcess(0) },
|
||||
cancelDiscordEvent = { discordTimer?.cancel() },
|
||||
fontImplementation = NativeFontDesktop(ORIGINAL_FONT_SIZE.toInt()),
|
||||
customSaveLocationHelper = CustomSaveLocationHelperDesktop()
|
||||
|
@ -10,7 +10,6 @@ import com.unciv.models.ruleset.RulesetCache
|
||||
import com.unciv.models.ruleset.unit.BaseUnit
|
||||
import com.unciv.models.stats.Stat
|
||||
import com.unciv.models.stats.Stats
|
||||
import com.unciv.models.translations.tr
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
@ -40,7 +39,7 @@ class BasicTests {
|
||||
|
||||
@Test
|
||||
fun gameIsNotRunWithDebugModes() {
|
||||
val params = UncivGameParameters("", null, null)
|
||||
val params = UncivGameParameters("", null)
|
||||
val game = UncivGame(params)
|
||||
Assert.assertTrue("This test will only pass if the game is not run with debug modes",
|
||||
!game.superchargedForDebug
|
||||
|
Reference in New Issue
Block a user