Trade table options are now mousewheel-scrollable - the problem was there was a scrollpane within a scrollpane - #2824

This commit is contained in:
Yair Morgenstern 2020-09-20 22:20:33 +03:00
parent ef181a4f4c
commit fded66b523
2 changed files with 8 additions and 5 deletions

View file

@ -6,6 +6,7 @@ import com.unciv.Constants
import com.unciv.JsonParser import com.unciv.JsonParser
import com.unciv.UncivGame import com.unciv.UncivGame
import com.unciv.logic.GameInfo import com.unciv.logic.GameInfo
import com.unciv.logic.UncivShowableException
import com.unciv.logic.automation.NextTurnAutomation import com.unciv.logic.automation.NextTurnAutomation
import com.unciv.logic.city.CityInfo import com.unciv.logic.city.CityInfo
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
@ -245,7 +246,9 @@ class CivilizationInfo {
for (unit in gameInfo.ruleSet.units.values) for (unit in gameInfo.ruleSet.units.values)
if (unit.replaces == baseUnitName && unit.uniqueTo == civName) if (unit.replaces == baseUnitName && unit.uniqueTo == civName)
return unit return unit
return gameInfo.ruleSet.units[baseUnitName]!! val baseUnit = gameInfo.ruleSet.units[baseUnitName]
if (baseUnit == null) throw UncivShowableException("Unit $baseUnitName doesn't seem to exist!")
return baseUnit
} }
fun meetCivilization(otherCiv: CivilizationInfo) { fun meetCivilization(otherCiv: CivilizationInfo) {

View file

@ -32,7 +32,7 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
init { init {
onBackButtonClicked { UncivGame.Current.setWorldScreen() } onBackButtonClicked { UncivGame.Current.setWorldScreen() }
val splitPane = SplitPane(ScrollPane(leftSideTable), ScrollPane(rightSideTable), false, skin) val splitPane = SplitPane(ScrollPane(leftSideTable), rightSideTable, false, skin)
splitPane.splitAmount = 0.2f splitPane.splitAmount = 0.2f
updateLeftSideTable() updateLeftSideTable()
@ -73,10 +73,10 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
} }
} }
fun updateRightSide(otherCiv: CivilizationInfo){ fun updateRightSide(otherCiv: CivilizationInfo) {
rightSideTable.clear() rightSideTable.clear()
if(otherCiv.isCityState()) rightSideTable.add(getCityStateDiplomacyTable(otherCiv)) if (otherCiv.isCityState()) rightSideTable.add(getCityStateDiplomacyTable(otherCiv))
else rightSideTable.add(getMajorCivDiplomacyTable(otherCiv)) else rightSideTable.add(ScrollPane(getMajorCivDiplomacyTable(otherCiv))).height(stage.height)
} }
fun setTrade(civ: CivilizationInfo): TradeTable { fun setTrade(civ: CivilizationInfo): TradeTable {