mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-05 21:11:35 +07:00
Fix Map Editor double map holders after ruleset change (#10047)
* Fix Map Editor double map holders after ruleset change * Fix buttons are vertical in AskFitMapToRulesetPopup * Sort imports over mapeditor package
This commit is contained in:
parent
5bccc4abf3
commit
855b2959a1
@ -292,10 +292,10 @@ open class Popup(
|
|||||||
return bottomTable.add(button)
|
return bottomTable.add(button)
|
||||||
}
|
}
|
||||||
fun addButton(text: String, key: Char, style: TextButtonStyle? = null, action: () -> Unit)
|
fun addButton(text: String, key: Char, style: TextButtonStyle? = null, action: () -> Unit)
|
||||||
= addButton(text, KeyCharAndCode(key), style, action).apply { row() }
|
= addButton(text, KeyCharAndCode(key), style, action)
|
||||||
@Suppress("unused") // Keep the offer to pass an Input.keys value
|
@Suppress("unused") // Keep the offer to pass an Input.keys value
|
||||||
fun addButton(text: String, key: Int, style: TextButtonStyle? = null, action: () -> Unit)
|
fun addButton(text: String, key: Int, style: TextButtonStyle? = null, action: () -> Unit)
|
||||||
= addButton(text, KeyCharAndCode(key), style, action).apply { row() }
|
= addButton(text, KeyCharAndCode(key), style, action)
|
||||||
fun addButton(text: String, binding: KeyboardBinding, style: TextButtonStyle? = null, action: () -> Unit): Cell<TextButton> {
|
fun addButton(text: String, binding: KeyboardBinding, style: TextButtonStyle? = null, action: () -> Unit): Cell<TextButton> {
|
||||||
val button = text.toTextButton(style)
|
val button = text.toTextButton(style)
|
||||||
button.onActivation(binding = binding) { action() }
|
button.onActivation(binding = binding) { action() }
|
||||||
|
@ -8,13 +8,13 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table
|
|||||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||||
import com.unciv.logic.files.MapSaver
|
import com.unciv.logic.files.MapSaver
|
||||||
import com.unciv.models.ruleset.RulesetCache
|
import com.unciv.models.ruleset.RulesetCache
|
||||||
import com.unciv.ui.images.ImageGetter
|
import com.unciv.ui.components.extensions.pad
|
||||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
import com.unciv.ui.components.extensions.toLabel
|
||||||
import com.unciv.ui.components.input.keyShortcuts
|
import com.unciv.ui.components.input.keyShortcuts
|
||||||
import com.unciv.ui.components.input.onClick
|
import com.unciv.ui.components.input.onClick
|
||||||
import com.unciv.ui.components.input.onDoubleClick
|
import com.unciv.ui.components.input.onDoubleClick
|
||||||
import com.unciv.ui.components.extensions.pad
|
import com.unciv.ui.images.ImageGetter
|
||||||
import com.unciv.ui.components.extensions.toLabel
|
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||||
|
|
||||||
class MapEditorFilesTable(
|
class MapEditorFilesTable(
|
||||||
initWidth: Float,
|
initWidth: Float,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.unciv.ui.screens.mapeditorscreen
|
package com.unciv.ui.screens.mapeditorscreen
|
||||||
|
|
||||||
import com.unciv.ui.components.input.KeyCharAndCode
|
|
||||||
import com.unciv.ui.components.TabbedPager
|
import com.unciv.ui.components.TabbedPager
|
||||||
|
import com.unciv.ui.components.input.KeyCharAndCode
|
||||||
import com.unciv.ui.images.ImageGetter
|
import com.unciv.ui.images.ImageGetter
|
||||||
import com.unciv.ui.screens.mapeditorscreen.tabs.MapEditorEditTab
|
import com.unciv.ui.screens.mapeditorscreen.tabs.MapEditorEditTab
|
||||||
import com.unciv.ui.screens.mapeditorscreen.tabs.MapEditorGenerateTab
|
import com.unciv.ui.screens.mapeditorscreen.tabs.MapEditorGenerateTab
|
||||||
|
@ -231,7 +231,6 @@ class MapEditorScreen(map: TileMap? = null): BaseScreen(), RecreateOnResize {
|
|||||||
tileMap.ruleset = newRuleset
|
tileMap.ruleset = newRuleset
|
||||||
ruleset = newRuleset
|
ruleset = newRuleset
|
||||||
}
|
}
|
||||||
mapHolder = newMapHolder()
|
|
||||||
modsTabNeedsRefresh = false
|
modsTabNeedsRefresh = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package com.unciv.ui.screens.mapeditorscreen
|
|||||||
|
|
||||||
import com.badlogic.gdx.Application
|
import com.badlogic.gdx.Application
|
||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.graphics.Color
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent
|
import com.badlogic.gdx.scenes.scene2d.InputEvent
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputListener
|
import com.badlogic.gdx.scenes.scene2d.InputListener
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage
|
import com.badlogic.gdx.scenes.scene2d.Stage
|
||||||
|
@ -13,23 +13,23 @@ import com.unciv.logic.map.mapgenerator.MapGenerator
|
|||||||
import com.unciv.models.ruleset.Ruleset
|
import com.unciv.models.ruleset.Ruleset
|
||||||
import com.unciv.models.ruleset.RulesetCache
|
import com.unciv.models.ruleset.RulesetCache
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.images.ImageGetter
|
|
||||||
import com.unciv.ui.screens.mapeditorscreen.MapEditorScreen
|
|
||||||
import com.unciv.ui.screens.mapeditorscreen.MapGeneratorSteps
|
|
||||||
import com.unciv.ui.screens.newgamescreen.MapParametersTable
|
|
||||||
import com.unciv.ui.popups.Popup
|
|
||||||
import com.unciv.ui.popups.ToastPopup
|
|
||||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
|
||||||
import com.unciv.ui.components.input.KeyCharAndCode
|
|
||||||
import com.unciv.ui.components.TabbedPager
|
import com.unciv.ui.components.TabbedPager
|
||||||
import com.unciv.ui.components.extensions.disable
|
import com.unciv.ui.components.extensions.disable
|
||||||
import com.unciv.ui.components.extensions.enable
|
import com.unciv.ui.components.extensions.enable
|
||||||
import com.unciv.ui.components.extensions.isEnabled
|
import com.unciv.ui.components.extensions.isEnabled
|
||||||
import com.unciv.ui.components.input.onChange
|
|
||||||
import com.unciv.ui.components.input.onClick
|
|
||||||
import com.unciv.ui.components.extensions.toCheckBox
|
import com.unciv.ui.components.extensions.toCheckBox
|
||||||
import com.unciv.ui.components.extensions.toLabel
|
import com.unciv.ui.components.extensions.toLabel
|
||||||
import com.unciv.ui.components.extensions.toTextButton
|
import com.unciv.ui.components.extensions.toTextButton
|
||||||
|
import com.unciv.ui.components.input.KeyCharAndCode
|
||||||
|
import com.unciv.ui.components.input.onChange
|
||||||
|
import com.unciv.ui.components.input.onClick
|
||||||
|
import com.unciv.ui.images.ImageGetter
|
||||||
|
import com.unciv.ui.popups.Popup
|
||||||
|
import com.unciv.ui.popups.ToastPopup
|
||||||
|
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||||
|
import com.unciv.ui.screens.mapeditorscreen.MapEditorScreen
|
||||||
|
import com.unciv.ui.screens.mapeditorscreen.MapGeneratorSteps
|
||||||
|
import com.unciv.ui.screens.newgamescreen.MapParametersTable
|
||||||
import com.unciv.utils.Concurrency
|
import com.unciv.utils.Concurrency
|
||||||
import com.unciv.utils.Log
|
import com.unciv.utils.Log
|
||||||
|
|
||||||
|
@ -5,24 +5,24 @@ import com.badlogic.gdx.files.FileHandle
|
|||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||||
import com.unciv.logic.MissingModsException
|
import com.unciv.logic.MissingModsException
|
||||||
import com.unciv.logic.files.MapSaver
|
|
||||||
import com.unciv.logic.UncivShowableException
|
import com.unciv.logic.UncivShowableException
|
||||||
|
import com.unciv.logic.files.MapSaver
|
||||||
import com.unciv.models.ruleset.RulesetCache
|
import com.unciv.models.ruleset.RulesetCache
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.screens.mapeditorscreen.MapEditorFilesTable
|
|
||||||
import com.unciv.ui.screens.mapeditorscreen.MapEditorScreen
|
|
||||||
import com.unciv.ui.popups.ConfirmPopup
|
|
||||||
import com.unciv.ui.popups.Popup
|
|
||||||
import com.unciv.ui.popups.ToastPopup
|
|
||||||
import com.unciv.ui.components.AutoScrollPane
|
import com.unciv.ui.components.AutoScrollPane
|
||||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
|
||||||
import com.unciv.ui.components.input.KeyCharAndCode
|
|
||||||
import com.unciv.ui.components.TabbedPager
|
import com.unciv.ui.components.TabbedPager
|
||||||
import com.unciv.ui.components.extensions.isEnabled
|
import com.unciv.ui.components.extensions.isEnabled
|
||||||
|
import com.unciv.ui.components.extensions.toTextButton
|
||||||
|
import com.unciv.ui.components.input.KeyCharAndCode
|
||||||
import com.unciv.ui.components.input.keyShortcuts
|
import com.unciv.ui.components.input.keyShortcuts
|
||||||
import com.unciv.ui.components.input.onActivation
|
import com.unciv.ui.components.input.onActivation
|
||||||
import com.unciv.ui.components.extensions.toTextButton
|
import com.unciv.ui.popups.ConfirmPopup
|
||||||
import com.unciv.ui.popups.LoadingPopup
|
import com.unciv.ui.popups.LoadingPopup
|
||||||
|
import com.unciv.ui.popups.Popup
|
||||||
|
import com.unciv.ui.popups.ToastPopup
|
||||||
|
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||||
|
import com.unciv.ui.screens.mapeditorscreen.MapEditorFilesTable
|
||||||
|
import com.unciv.ui.screens.mapeditorscreen.MapEditorScreen
|
||||||
import com.unciv.utils.Concurrency
|
import com.unciv.utils.Concurrency
|
||||||
import com.unciv.utils.Log
|
import com.unciv.utils.Log
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
@ -7,19 +7,19 @@ import com.badlogic.gdx.utils.Align
|
|||||||
import com.unciv.Constants
|
import com.unciv.Constants
|
||||||
import com.unciv.models.ruleset.Ruleset
|
import com.unciv.models.ruleset.Ruleset
|
||||||
import com.unciv.models.ruleset.RulesetCache
|
import com.unciv.models.ruleset.RulesetCache
|
||||||
|
import com.unciv.ui.components.TabbedPager
|
||||||
|
import com.unciv.ui.components.TranslatedSelectBox
|
||||||
|
import com.unciv.ui.components.UncivTooltip.Companion.addTooltip
|
||||||
|
import com.unciv.ui.components.extensions.isEnabled
|
||||||
|
import com.unciv.ui.components.extensions.toLabel
|
||||||
|
import com.unciv.ui.components.extensions.toTextButton
|
||||||
|
import com.unciv.ui.components.input.onChange
|
||||||
|
import com.unciv.ui.components.input.onClick
|
||||||
|
import com.unciv.ui.popups.Popup
|
||||||
|
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||||
import com.unciv.ui.screens.mapeditorscreen.MapEditorScreen
|
import com.unciv.ui.screens.mapeditorscreen.MapEditorScreen
|
||||||
import com.unciv.ui.screens.mapeditorscreen.TileInfoNormalizer
|
import com.unciv.ui.screens.mapeditorscreen.TileInfoNormalizer
|
||||||
import com.unciv.ui.screens.newgamescreen.ModCheckboxTable
|
import com.unciv.ui.screens.newgamescreen.ModCheckboxTable
|
||||||
import com.unciv.ui.components.TranslatedSelectBox
|
|
||||||
import com.unciv.ui.popups.Popup
|
|
||||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
|
||||||
import com.unciv.ui.components.TabbedPager
|
|
||||||
import com.unciv.ui.components.UncivTooltip.Companion.addTooltip
|
|
||||||
import com.unciv.ui.components.extensions.isEnabled
|
|
||||||
import com.unciv.ui.components.input.onChange
|
|
||||||
import com.unciv.ui.components.input.onClick
|
|
||||||
import com.unciv.ui.components.extensions.toLabel
|
|
||||||
import com.unciv.ui.components.extensions.toTextButton
|
|
||||||
|
|
||||||
class MapEditorModsTab(
|
class MapEditorModsTab(
|
||||||
private val editorScreen: MapEditorScreen
|
private val editorScreen: MapEditorScreen
|
||||||
|
@ -13,17 +13,17 @@ import com.unciv.logic.files.MapSaver
|
|||||||
import com.unciv.logic.map.MapShape
|
import com.unciv.logic.map.MapShape
|
||||||
import com.unciv.logic.map.MapSize
|
import com.unciv.logic.map.MapSize
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.components.input.KeyCharAndCode
|
|
||||||
import com.unciv.ui.components.TabbedPager
|
import com.unciv.ui.components.TabbedPager
|
||||||
import com.unciv.ui.components.UncivSlider
|
import com.unciv.ui.components.UncivSlider
|
||||||
import com.unciv.ui.components.extensions.addSeparator
|
import com.unciv.ui.components.extensions.addSeparator
|
||||||
import com.unciv.ui.components.extensions.isEnabled
|
import com.unciv.ui.components.extensions.isEnabled
|
||||||
import com.unciv.ui.components.input.keyShortcuts
|
|
||||||
import com.unciv.ui.components.input.onActivation
|
|
||||||
import com.unciv.ui.components.input.onClick
|
|
||||||
import com.unciv.ui.components.extensions.toCheckBox
|
import com.unciv.ui.components.extensions.toCheckBox
|
||||||
import com.unciv.ui.components.extensions.toLabel
|
import com.unciv.ui.components.extensions.toLabel
|
||||||
import com.unciv.ui.components.extensions.toTextButton
|
import com.unciv.ui.components.extensions.toTextButton
|
||||||
|
import com.unciv.ui.components.input.KeyCharAndCode
|
||||||
|
import com.unciv.ui.components.input.keyShortcuts
|
||||||
|
import com.unciv.ui.components.input.onActivation
|
||||||
|
import com.unciv.ui.components.input.onClick
|
||||||
import com.unciv.ui.popups.ToastPopup
|
import com.unciv.ui.popups.ToastPopup
|
||||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||||
import com.unciv.ui.screens.mapeditorscreen.MapEditorScreen
|
import com.unciv.ui.screens.mapeditorscreen.MapEditorScreen
|
||||||
|
@ -9,22 +9,22 @@ import com.unciv.logic.files.MapSaver
|
|||||||
import com.unciv.logic.map.MapGeneratedMainType
|
import com.unciv.logic.map.MapGeneratedMainType
|
||||||
import com.unciv.logic.map.TileMap
|
import com.unciv.logic.map.TileMap
|
||||||
import com.unciv.models.translations.tr
|
import com.unciv.models.translations.tr
|
||||||
import com.unciv.ui.screens.mapeditorscreen.MapEditorFilesTable
|
|
||||||
import com.unciv.ui.screens.mapeditorscreen.MapEditorScreen
|
|
||||||
import com.unciv.ui.popups.ConfirmPopup
|
|
||||||
import com.unciv.ui.popups.Popup
|
|
||||||
import com.unciv.ui.popups.ToastPopup
|
|
||||||
import com.unciv.ui.components.AutoScrollPane
|
import com.unciv.ui.components.AutoScrollPane
|
||||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
|
||||||
import com.unciv.ui.components.input.KeyCharAndCode
|
|
||||||
import com.unciv.ui.components.TabbedPager
|
import com.unciv.ui.components.TabbedPager
|
||||||
import com.unciv.ui.components.UncivTextField
|
import com.unciv.ui.components.UncivTextField
|
||||||
import com.unciv.ui.components.extensions.isEnabled
|
import com.unciv.ui.components.extensions.isEnabled
|
||||||
|
import com.unciv.ui.components.extensions.toTextButton
|
||||||
|
import com.unciv.ui.components.input.KeyCharAndCode
|
||||||
import com.unciv.ui.components.input.keyShortcuts
|
import com.unciv.ui.components.input.keyShortcuts
|
||||||
import com.unciv.ui.components.input.onActivation
|
import com.unciv.ui.components.input.onActivation
|
||||||
import com.unciv.ui.components.input.onChange
|
import com.unciv.ui.components.input.onChange
|
||||||
import com.unciv.ui.components.input.onClick
|
import com.unciv.ui.components.input.onClick
|
||||||
import com.unciv.ui.components.extensions.toTextButton
|
import com.unciv.ui.popups.ConfirmPopup
|
||||||
|
import com.unciv.ui.popups.Popup
|
||||||
|
import com.unciv.ui.popups.ToastPopup
|
||||||
|
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||||
|
import com.unciv.ui.screens.mapeditorscreen.MapEditorFilesTable
|
||||||
|
import com.unciv.ui.screens.mapeditorscreen.MapEditorScreen
|
||||||
import com.unciv.utils.Concurrency
|
import com.unciv.utils.Concurrency
|
||||||
import com.unciv.utils.Log
|
import com.unciv.utils.Log
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
@ -22,10 +22,10 @@ import com.unciv.ui.components.UncivSlider
|
|||||||
import com.unciv.ui.components.WrappableLabel
|
import com.unciv.ui.components.WrappableLabel
|
||||||
import com.unciv.ui.components.extensions.addSeparator
|
import com.unciv.ui.components.extensions.addSeparator
|
||||||
import com.unciv.ui.components.extensions.darken
|
import com.unciv.ui.components.extensions.darken
|
||||||
import com.unciv.ui.components.input.onClick
|
|
||||||
import com.unciv.ui.components.extensions.pad
|
import com.unciv.ui.components.extensions.pad
|
||||||
import com.unciv.ui.components.extensions.toLabel
|
import com.unciv.ui.components.extensions.toLabel
|
||||||
import com.unciv.ui.components.extensions.toTextButton
|
import com.unciv.ui.components.extensions.toTextButton
|
||||||
|
import com.unciv.ui.components.input.onClick
|
||||||
import com.unciv.ui.popups.ToastPopup
|
import com.unciv.ui.popups.ToastPopup
|
||||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||||
import com.unciv.ui.screens.civilopediascreen.CivilopediaScreen
|
import com.unciv.ui.screens.civilopediascreen.CivilopediaScreen
|
||||||
|
Loading…
Reference in New Issue
Block a user