Fixed modded images not loading properly

This commit is contained in:
Yair Morgenstern 2020-09-25 13:50:02 +03:00
parent 98a79f8fb4
commit 009c59b77c
3 changed files with 6 additions and 6 deletions

View File

@ -118,9 +118,9 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
fun loadGame(gameInfo: GameInfo) {
this.gameInfo = gameInfo
ImageGetter.ruleset = gameInfo.ruleSet
ImageGetter.reload()
Gdx.input.inputProcessor = null // Since we will set the world screen when we're ready,
// This is to avoid ANRs when loading.
//ImageGetter.refreshAtlas()
worldScreen = WorldScreen(gameInfo.getPlayerToViewAs())
setWorldScreen()
}

View File

@ -174,7 +174,7 @@ class GameOptionsTable(val previousScreen: IPreviousScreen, val updatePlayerPick
ruleset.modOptions = newRuleset.modOptions
ImageGetter.ruleset = ruleset
ImageGetter.setTextureRegionDrawables()
ImageGetter.reload()
}
fun Table.addModCheckboxes() {

View File

@ -36,17 +36,17 @@ object ImageGetter {
val textureRegionDrawables = HashMap<String,TextureRegionDrawable>()
init{
setTextureRegionDrawables()
reload()
}
fun setNewRuleset(ruleset: Ruleset) {
if (this.ruleset == ruleset) return
this.ruleset = ruleset
setTextureRegionDrawables()
reload()
}
fun setTextureRegionDrawables(){
/** Required every time the ruleset changes, in order to load mod-specific images */
fun reload(){
textureRegionDrawables.clear()
// These are the drawables from the base game
for(region in atlas.regions){