mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-10 07:16:54 +07:00
Fix Unit rename popup offering up the icon's virtual codepoint (#10620)
* Fix Unit rename popup offering up the icon's virtual codepoint * Fix City rename popup offering up the icon's virtual codepoint
This commit is contained in:
parent
58e5139f35
commit
4be14d77f4
@ -10,7 +10,7 @@ class CityRenamePopup(val screen: BaseScreen, val city: City, val actionOnClose:
|
||||
AskTextPopup(
|
||||
screen,
|
||||
label = "Please enter a new name for your city",
|
||||
defaultText = city.name.tr(),
|
||||
defaultText = city.name.tr(hideIcons = true),
|
||||
validate = { it != "" },
|
||||
actionOnOk = { text ->
|
||||
city.name = text
|
||||
@ -20,4 +20,3 @@ class CityRenamePopup(val screen: BaseScreen, val city: City, val actionOnClose:
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,10 @@ package com.unciv.ui.screens.pickerscreens
|
||||
|
||||
import com.unciv.logic.map.mapunit.MapUnit
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.components.extensions.surroundWithCircle
|
||||
import com.unciv.ui.images.ImageGetter
|
||||
import com.unciv.ui.popups.AskTextPopup
|
||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||
import com.unciv.ui.components.extensions.surroundWithCircle
|
||||
|
||||
class UnitRenamePopup(val screen: BaseScreen, val unit: MapUnit, val actionOnClose: ()->Unit) {
|
||||
init {
|
||||
@ -13,7 +13,7 @@ class UnitRenamePopup(val screen: BaseScreen, val unit: MapUnit, val actionOnClo
|
||||
screen,
|
||||
label = "Choose name for [${unit.baseUnit.name}]",
|
||||
icon = ImageGetter.getUnitIcon(unit.name).surroundWithCircle(80f),
|
||||
defaultText = unit.instanceName ?: unit.baseUnit.name.tr(),
|
||||
defaultText = unit.instanceName ?: unit.baseUnit.name.tr(hideIcons = true),
|
||||
validate = { it != unit.name },
|
||||
actionOnOk = { userInput ->
|
||||
//If the user inputs an empty string, clear the unit instanceName so the base name is used
|
||||
|
Loading…
Reference in New Issue
Block a user