mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 23:37:31 +07:00
Simplified init resources on new game
This commit is contained in:
parent
a450ddbb2c
commit
3f1a385747
@ -226,16 +226,12 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
||||
|
||||
/** The new game info may have different mods or rulesets, which may use different resources that need to be loaded. */
|
||||
private suspend fun initializeResources(prevGameInfo: GameInfo?, newGameInfo: GameInfo) {
|
||||
if (prevGameInfo == null || prevGameInfo.ruleSet != newGameInfo.ruleSet) {
|
||||
if (prevGameInfo == null
|
||||
|| prevGameInfo.gameParameters.baseRuleset != newGameInfo.gameParameters.baseRuleset
|
||||
|| prevGameInfo.gameParameters.mods != newGameInfo.gameParameters.mods) {
|
||||
withGLContext {
|
||||
ImageGetter.setNewRuleset(newGameInfo.ruleSet)
|
||||
}
|
||||
}
|
||||
|
||||
if (prevGameInfo == null ||
|
||||
prevGameInfo.gameParameters.baseRuleset != newGameInfo.gameParameters.baseRuleset ||
|
||||
prevGameInfo.gameParameters.mods != newGameInfo.gameParameters.mods
|
||||
) {
|
||||
val fullModList = newGameInfo.gameParameters.getModsAndBaseRuleset()
|
||||
musicController.setModList(fullModList)
|
||||
}
|
||||
|
@ -36,11 +36,7 @@ import kotlin.math.sqrt
|
||||
object ImageGetter {
|
||||
private const val whiteDotLocation = "OtherIcons/whiteDot"
|
||||
|
||||
// When we used to load images directly from different files, without using a texture atlas,
|
||||
// The draw() phase of the main screen would take a really long time because the BatchRenderer would
|
||||
// always have to switch between like 170 different textures.
|
||||
// So, we now use TexturePacker in the DesktopLauncher class to pack all the different images into single images,
|
||||
// and the atlas is what tells us what was packed where.
|
||||
// We use texture atlases to minimize texture swapping - see https://yairm210.medium.com/the-libgdx-performance-guide-1d068a84e181
|
||||
lateinit var atlas: TextureAtlas
|
||||
private val atlases = HashMap<String, TextureAtlas>()
|
||||
var ruleset = Ruleset()
|
||||
|
Loading…
Reference in New Issue
Block a user