Change map resource controls presentation (#9104)

This commit is contained in:
SomeTroglodyte 2023-04-04 09:52:42 +02:00 committed by GitHub
parent bc341a6fcb
commit 4c88fbb996
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -379,6 +379,7 @@ Sparse =
Abundant =
Strategic Balance =
Legendary Start =
This is used for painting resources, not in map generator steps: =
Advanced Settings =
RNG Seed =

View File

@ -5,6 +5,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.CheckBox
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.TextField
import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldFilter.DigitsOnlyFilter
import com.badlogic.gdx.utils.Align
import com.unciv.logic.map.MapGeneratedMainType
import com.unciv.logic.map.MapParameters
import com.unciv.logic.map.MapResources
@ -274,6 +275,10 @@ class MapParametersTable(
mapParameters.mapResources = resourceSelectBox.selected.value
}
if (forMapEditor) {
val comment = "This is used for painting resources, not in map generator steps:"
add(comment.toLabel(Color.GOLD, 14, Align.center).apply { wrap=true }).colspan(2).row()
}
add("{Resource Setting}:".toLabel()).left()
add(resourceSelectBox).fillX().row()
}
@ -362,7 +367,7 @@ class MapParametersTable(
return slider
}
fun addTextButton(text: String, shouldAddToTable: Boolean = false, action: ((Boolean) -> Unit),) {
fun addTextButton(text: String, shouldAddToTable: Boolean = false, action: ((Boolean) -> Unit)) {
val button = text.toTextButton()
button.onClick { action.invoke(true) }
if (shouldAddToTable)
@ -378,8 +383,10 @@ class MapParametersTable(
addSlider("Temperature shift", {mapParameters.temperatureShift}, -0.4f, 0.4f, 0.1f)
{ mapParameters.temperatureShift = it }
addSlider("Resource richness", {mapParameters.resourceRichness},0f, 0.5f)
{ mapParameters.resourceRichness = it }
if (forMapEditor) {
addSlider("Resource richness", { mapParameters.resourceRichness }, 0f, 0.5f)
{ mapParameters.resourceRichness = it }
}
addSlider("Vegetation richness", {mapParameters.vegetationRichness}, 0f, 1f)
{ mapParameters.vegetationRichness = it }