mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-16 18:59:15 +07:00
Solved Application Not Responding errors when saving large games
This commit is contained in:
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
|
||||
<module>
|
||||
<source path="com/unciv/game" />
|
||||
</module>
|
@ -12,6 +12,7 @@ import com.unciv.ui.pickerscreens.PickerScreen
|
||||
import com.unciv.ui.utils.enable
|
||||
import com.unciv.ui.utils.onClick
|
||||
import com.unciv.ui.utils.toLabel
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
|
||||
class SaveGameScreen : PickerScreen() {
|
||||
@ -55,8 +56,11 @@ class SaveGameScreen : PickerScreen() {
|
||||
|
||||
rightSideButton.setText("Save game".tr())
|
||||
rightSideButton.onClick {
|
||||
GameSaver().saveGame(UncivGame.Current.gameInfo, textField.text)
|
||||
UncivGame.Current.setWorldScreen()
|
||||
rightSideButton.setText("Saving...".tr())
|
||||
thread{
|
||||
GameSaver().saveGame(UncivGame.Current.gameInfo, textField.text)
|
||||
UncivGame.Current.setWorldScreen()
|
||||
}
|
||||
}
|
||||
rightSideButton.enable()
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener
|
||||
import com.badlogic.gdx.utils.viewport.ExtendViewport
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.models.gamebasics.tr
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
open class CameraStageBaseScreen : Screen {
|
||||
|
||||
@ -128,7 +129,7 @@ fun Actor.center(parent:Stage){ centerX(parent); centerY(parent)}
|
||||
fun Actor.onClickEvent(sound: String = "click", function: (event: InputEvent?, x: Float, y: Float) -> Unit) {
|
||||
this.addListener(object : ClickListener() {
|
||||
override fun clicked(event: InputEvent?, x: Float, y: Float) {
|
||||
if (sound != "") Sounds.play(sound)
|
||||
if (sound != "") thread{Sounds.play(sound)}
|
||||
function(event, x, y)
|
||||
}
|
||||
})
|
||||
|
Reference in New Issue
Block a user