Solved Application Not Responding errors when saving large games

This commit is contained in:
Yair Morgenstern
2019-12-12 20:27:46 +02:00
parent f8b822eeb3
commit acf91b4e12
5 changed files with 10 additions and 27 deletions

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app" applicationId "com.unciv.app"
minSdkVersion 14 minSdkVersion 14
targetSdkVersion 29 targetSdkVersion 29
versionCode 340 versionCode 341
versionName "3.3.7-patch1" versionName "3.3.8"
archivesBaseName = "Unciv" archivesBaseName = "Unciv"
} }

View File

@ -1,17 +0,0 @@
{
"addons": [
],
"buildpacks": [
],
"description": "",
"env": {
},
"formation": {
},
"name": "UnCiv",
"scripts": {
},
"stack": "heroku-18"
}

View File

@ -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>

View File

@ -12,6 +12,7 @@ import com.unciv.ui.pickerscreens.PickerScreen
import com.unciv.ui.utils.enable import com.unciv.ui.utils.enable
import com.unciv.ui.utils.onClick import com.unciv.ui.utils.onClick
import com.unciv.ui.utils.toLabel import com.unciv.ui.utils.toLabel
import kotlin.concurrent.thread
class SaveGameScreen : PickerScreen() { class SaveGameScreen : PickerScreen() {
@ -55,9 +56,12 @@ class SaveGameScreen : PickerScreen() {
rightSideButton.setText("Save game".tr()) rightSideButton.setText("Save game".tr())
rightSideButton.onClick { rightSideButton.onClick {
rightSideButton.setText("Saving...".tr())
thread{
GameSaver().saveGame(UncivGame.Current.gameInfo, textField.text) GameSaver().saveGame(UncivGame.Current.gameInfo, textField.text)
UncivGame.Current.setWorldScreen() UncivGame.Current.setWorldScreen()
} }
}
rightSideButton.enable() rightSideButton.enable()
} }

View File

@ -13,6 +13,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener
import com.badlogic.gdx.utils.viewport.ExtendViewport import com.badlogic.gdx.utils.viewport.ExtendViewport
import com.unciv.UncivGame import com.unciv.UncivGame
import com.unciv.models.gamebasics.tr import com.unciv.models.gamebasics.tr
import kotlin.concurrent.thread
open class CameraStageBaseScreen : Screen { 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) { fun Actor.onClickEvent(sound: String = "click", function: (event: InputEvent?, x: Float, y: Float) -> Unit) {
this.addListener(object : ClickListener() { this.addListener(object : ClickListener() {
override fun clicked(event: InputEvent?, x: Float, y: Float) { override fun clicked(event: InputEvent?, x: Float, y: Float) {
if (sound != "") Sounds.play(sound) if (sound != "") thread{Sounds.play(sound)}
function(event, x, y) function(event, x, y)
} }
}) })