diff --git a/core/src/com/unciv/ui/worldscreen/Minimap.kt b/core/src/com/unciv/ui/worldscreen/Minimap.kt index fc9fa950e9..91decc8328 100644 --- a/core/src/com/unciv/ui/worldscreen/Minimap.kt +++ b/core/src/com/unciv/ui/worldscreen/Minimap.kt @@ -96,11 +96,11 @@ class Minimap(val mapHolder: WorldMapHolder) : Table(){ } } -class MinimapHolder(mapHolder: WorldMapHolder): Table(){ +class MinimapHolder(mapHolder: WorldMapHolder): Table() { val minimap = Minimap(mapHolder) val worldScreen = mapHolder.worldScreen - init{ + init { add(getToggleIcons()).align(Align.bottom) add(getWrappedMinimap()) pack() @@ -108,57 +108,59 @@ class MinimapHolder(mapHolder: WorldMapHolder): Table(){ private fun getWrappedMinimap(): Table { val internalMinimapWrapper = Table() -// // Temporarily disabled until we can make them work nicely together -// val sizePercent = worldScreen.game.settings.minimapSize -// val sizeWinX = worldScreen.stage.width * sizePercent / 100 -// val sizeWinY = worldScreen.stage.height * sizePercent / 100 -// val isSquare = worldScreen.game.settings.minimapSquare -// val sizeX = if (isSquare) sqrt(sizeWinX * sizeWinY) else sizeWinX -// val sizeY = if (isSquare) sizeX else sizeWinY - internalMinimapWrapper.add(minimap) //.size(sizeX,sizeY) - minimap + internalMinimapWrapper.add(minimap) - internalMinimapWrapper.background=ImageGetter.getBackground(Color.GRAY) + internalMinimapWrapper.background = ImageGetter.getBackground(Color.GRAY) internalMinimapWrapper.pack() val externalMinimapWrapper = Table() externalMinimapWrapper.add(internalMinimapWrapper).pad(5f) - externalMinimapWrapper.background=ImageGetter.getBackground(Color.WHITE) + externalMinimapWrapper.background = ImageGetter.getBackground(Color.WHITE) externalMinimapWrapper.pack() return externalMinimapWrapper } - private fun getToggleIcons():Table{ - val toggleIconTable=Table() + private fun getToggleIcons(): Table { + val toggleIconTable = Table() val settings = UncivGame.Current.settings + val yieldImage = ImageGetter.getStatIcon("Food").surroundWithCircle(40f) + yieldImage.circle.color = Color.BLACK + yieldImage.actor.color.a = if (settings.showTileYields) 1f else 0.5f + yieldImage.onClick { + settings.showTileYields = !settings.showTileYields + yieldImage.actor.color.a = if (settings.showTileYields) 1f else 0.5f + worldScreen.shouldUpdate = true + } + toggleIconTable.add(yieldImage).row() + val populationImage = ImageGetter.getStatIcon("Population").surroundWithCircle(40f) populationImage.circle.color = Color.BLACK - populationImage.actor.color.a = if(settings.showWorkedTiles) 1f else 0.5f + populationImage.actor.color.a = if (settings.showWorkedTiles) 1f else 0.5f populationImage.onClick { settings.showWorkedTiles = !settings.showWorkedTiles - populationImage.actor.color.a = if(settings.showWorkedTiles) 1f else 0.5f - worldScreen.shouldUpdate=true + populationImage.actor.color.a = if (settings.showWorkedTiles) 1f else 0.5f + worldScreen.shouldUpdate = true } toggleIconTable.add(populationImage).row() val resourceImage = ImageGetter.getImage("ResourceIcons/Cattle") .surroundWithCircle(30f).apply { circle.color = Color.GREEN } - .surroundWithCircle(40f,false).apply { circle.color = Color.BLACK } + .surroundWithCircle(40f, false).apply { circle.color = Color.BLACK } - resourceImage.actor.color.a = if(settings.showResourcesAndImprovements) 1f else 0.5f + resourceImage.actor.color.a = if (settings.showResourcesAndImprovements) 1f else 0.5f resourceImage.onClick { settings.showResourcesAndImprovements = !settings.showResourcesAndImprovements - resourceImage.actor.color.a = if(settings.showResourcesAndImprovements) 1f else 0.5f - worldScreen.shouldUpdate=true + resourceImage.actor.color.a = if (settings.showResourcesAndImprovements) 1f else 0.5f + worldScreen.shouldUpdate = true } toggleIconTable.add(resourceImage) toggleIconTable.pack() return toggleIconTable } - fun update(civInfo:CivilizationInfo){ + fun update(civInfo: CivilizationInfo) { isVisible = UncivGame.Current.settings.showMinimap minimap.update(civInfo) } @@ -168,4 +170,4 @@ class MinimapHolder(mapHolder: WorldMapHolder): Table(){ override fun draw(batch: Batch?, parentAlpha: Float) { super.draw(batch, parentAlpha) } -} +} \ No newline at end of file