Skip to content

Commit 77d00f3

Browse files
committed
Translation files now take a huge amount of time to load, moved their loading into a thread and put up a "loading screen" beforehand
1 parent 83ad3c6 commit 77d00f3

File tree

15 files changed

+201
-294
lines changed

15 files changed

+201
-294
lines changed
1013 Bytes
Loading
978 Bytes
Loading
551 Bytes
Loading

android/assets/game.atlas

Lines changed: 135 additions & 114 deletions
Large diffs are not rendered by default.

android/assets/game2.png

3.81 KB
Loading

android/assets/jsons/translationsByLanguage/Italian.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,9 +583,7 @@ Map uploaded successfully! = Mappa caricata con successo
583583

584584
Options = Opzioni
585585
Display options = Opzioni grafiche
586-
# Requires translation!
587586
Gameplay options = Opzioni di gioco
588-
# Requires translation!
589587
Other options = Altre opzioni
590588
Turns between autosaves = Turni tra autosalvataggi
591589
Sound effects volume = Volume effetti

android/assets/jsons/translationsByLanguage/Russian.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ Neuschwanstein = Замок Нойшванштайн
238238
239239
Military Academy = Военная академия
240240
241-
242241
Brandenburg Gate = Бранденбургские врата
243242
Free Great General appears near the Capital = Свободный Великий генерал появился рядом с Столицей!
244243
'Pale Death beats equally at the poor man's gate and at the palaces of kings.' - Horace = 'Смерть одинаково трепещет как над бедняцкой хижиной, так и над дворцами королей' - Гораций

android/assets/jsons/translationsByLanguage/Spanish.properties

Lines changed: 13 additions & 143 deletions
Large diffs are not rendered by default.

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ android {
2121
applicationId "com.unciv.app"
2222
minSdkVersion 14
2323
targetSdkVersion 29
24-
versionCode 345
25-
versionName "3.4.0-patch1"
24+
versionCode 347
25+
versionName "3.4.0-patch3"
2626

2727
archivesBaseName = "Unciv"
2828
}

core/src/com/unciv/UncivGame.kt

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import com.badlogic.gdx.Game
55
import com.badlogic.gdx.Gdx
66
import com.badlogic.gdx.Input
77
import com.badlogic.gdx.audio.Music
8+
import com.badlogic.gdx.scenes.scene2d.actions.Actions
9+
import com.badlogic.gdx.utils.Align
810
import com.unciv.logic.GameInfo
911
import com.unciv.logic.GameSaver
1012
import com.unciv.logic.GameStarter
@@ -15,6 +17,7 @@ import com.unciv.models.ruleset.Ruleset
1517
import com.unciv.ui.LanguagePickerScreen
1618
import com.unciv.ui.utils.CameraStageBaseScreen
1719
import com.unciv.ui.utils.ImageGetter
20+
import com.unciv.ui.utils.center
1821
import com.unciv.ui.worldscreen.WorldScreen
1922
import java.util.*
2023
import kotlin.concurrent.thread
@@ -40,33 +43,38 @@ class UncivGame(val version: String) : Game() {
4043
lateinit var ruleset:Ruleset
4144

4245
override fun create() {
46+
Gdx.input.setCatchKey(Input.Keys.BACK, true)
47+
if (Gdx.app.type != Application.ApplicationType.Desktop)
48+
viewEntireMapForDebug = false
49+
Current = this
50+
51+
4352
// If this takes too long players, especially with older phones, get ANR problems.
4453
// Whatever needs graphics needs to be done on the main thread,
4554
// So it's basically a long set of deferred actions.
4655
// We probably could make this better by moving stuff that we can to another thread but ehhhhhhh
47-
48-
Current = this
49-
Gdx.app.postRunnable {
56+
settings = GameSaver().getGeneralSettings() // needed for the screen
57+
screen=LoadingScreen()
58+
thread {
5059
ruleset = Ruleset(true)
5160

52-
if (Gdx.app.type != Application.ApplicationType.Desktop)
53-
viewEntireMapForDebug = false
54-
Gdx.input.setCatchKey(Input.Keys.BACK, true)
55-
settings = GameSaver().getGeneralSettings()
5661
if (settings.userId == "") { // assign permanent user id
5762
settings.userId = UUID.randomUUID().toString()
5863
settings.save()
5964
}
60-
if (GameSaver().getSave("Autosave").exists()) {
61-
try {
62-
loadGame("Autosave")
63-
} catch (ex: Exception) { // silent fail if we can't read the autosave
64-
startNewGame()
65-
}
66-
} else setScreen(LanguagePickerScreen())
67-
68-
thread { startMusic() }
69-
isInitialized = true
65+
Gdx.app.postRunnable {
66+
CameraStageBaseScreen.resetFonts()
67+
if (GameSaver().getSave("Autosave").exists()) {
68+
try {
69+
loadGame("Autosave")
70+
} catch (ex: Exception) { // silent fail if we can't read the autosave
71+
startNewGame()
72+
}
73+
} else setScreen(LanguagePickerScreen())
74+
75+
thread { startMusic() }
76+
isInitialized = true
77+
}
7078
}
7179
}
7280

@@ -112,7 +120,7 @@ class UncivGame(val version: String) : Game() {
112120
super.resume()
113121
ImageGetter.refreshAltas()
114122

115-
// This is to solve a rare problem that I still on't understand its cause -
123+
// This is to solve a rare problem that I still don't understand its cause -
116124
// Sometimes, resume() is called and the gameInfo doesn't have any civilizations.
117125
// My guess is that resume() was called but create() wasn't, or perhaps was aborted too early,
118126
// and the original (and empty) initial GameInfo remained.
@@ -136,4 +144,17 @@ class UncivGame(val version: String) : Game() {
136144
companion object {
137145
lateinit var Current: UncivGame
138146
}
147+
}
148+
149+
class LoadingScreen:CameraStageBaseScreen(){
150+
init{
151+
val happinessImage = ImageGetter.getImage("StatIcons/Happiness")
152+
happinessImage.center(stage)
153+
happinessImage.setOrigin(Align.center)
154+
happinessImage.addAction(Actions.sequence(
155+
Actions.delay(1f),
156+
Actions.rotateBy(360f,0.5f)))
157+
stage.addActor(happinessImage)
158+
}
159+
139160
}

0 commit comments

Comments
 (0)