This commit is contained in:
Yair Morgenstern 2021-01-28 16:21:25 +02:00
parent f11647d5fc
commit bcab751f7c
18 changed files with 27 additions and 28 deletions

View File

@ -80,7 +80,7 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
val mChannel = NotificationChannel(NOTIFICATION_CHANNEL_ID_INFO, name, importance)
mChannel.description = descriptionText
mChannel.setShowBadge(true)
mChannel.setLockscreenVisibility(NotificationCompat.VISIBILITY_PUBLIC)
mChannel.lockscreenVisibility = NotificationCompat.VISIBILITY_PUBLIC
val notificationManager = appContext.getSystemService(AndroidApplication.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(mChannel)
@ -100,7 +100,7 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
val importance = NotificationManager.IMPORTANCE_MIN
val mChannel = NotificationChannel(NOTIFICATION_CHANNEL_ID_SERVICE, name, importance)
mChannel.setShowBadge(false)
mChannel.setLockscreenVisibility(NotificationCompat.VISIBILITY_PUBLIC)
mChannel.lockscreenVisibility = NotificationCompat.VISIBILITY_PUBLIC
mChannel.description = descriptionText
val notificationManager = appContext.getSystemService(AndroidApplication.NOTIFICATION_SERVICE) as NotificationManager

View File

@ -412,7 +412,7 @@ object NextTurnAutomation {
modifierMap["Far away cities"] = -10
val landPathBFS = BFS(ourCity.getCenterTile()) {
val owner = it.getOwner();
val owner = it.getOwner()
it.isLand && !it.isImpassible()
&& (owner == otherCiv || owner == null || civInfo.canEnterTiles(owner))
}

View File

@ -119,7 +119,7 @@ object Perlin {
private fun lerp(t: Double, a: Double, b: Double) = a + t * (b - a)
private fun grad3(hash: Int, x: Double, y: Double, z: Double): Double {
val h = hash and 15;
val h = hash and 15
return x * grad3[h][0] + y * grad3[h][1] + z * grad3[h][2]
}
}

View File

@ -110,7 +110,7 @@ class Simulation(val newGameInfo: GameInfo,
var outString = ""
for (civ in civilizations) {
outString += "\n$civ:\n"
val wins = winRate[civ]!!.value!! * 100 / max(steps.size, 1)
val wins = winRate[civ]!!.value * 100 / max(steps.size, 1)
outString += "$wins% total win rate \n"
for (victory in VictoryType.values()) {
val winsVictory = winRateByVictory[civ]!![victory]!!.value * 100 / max(winRate[civ]!!.value, 1)

View File

@ -11,5 +11,4 @@ import java.util.HashMap
* @property values: The translations
* @see Translations
*/
class TranslationEntry(val entry: String) : HashMap<String, String>() {
}
class TranslationEntry(val entry: String) : HashMap<String, String>()

View File

@ -145,7 +145,7 @@ class CivilopediaScreen(ruleset: Ruleset) : CameraStageBaseScreen() {
stage.addActor(splitPane)
description.setWrap(true)
description.wrap = true
val entrySelectScroll = ScrollPane(entrySelectTable)
entrySelectScroll.setupOverscroll(5f, 1f, 200f)

View File

@ -34,7 +34,7 @@ class LanguageTable(val language:String, val percentComplete: Int):Table(){
}
class LanguagePickerScreen(): PickerScreen(){
class LanguagePickerScreen : PickerScreen(){
var chosenLanguage = "English"
private val languageTables = ArrayList<LanguageTable>()
@ -53,11 +53,11 @@ class LanguagePickerScreen(): PickerScreen(){
| instructions are in the Github readme! (Menu > Community > Github)
""".trimMargin()
topTable.add(translationDisclaimer.toLabel()).pad(10f).row()
val tableLanguages = Table();
tableLanguages.defaults().uniformX();
tableLanguages.defaults().pad(10.0f);
tableLanguages.defaults().fillX();
topTable.add(tableLanguages).row();
val tableLanguages = Table()
tableLanguages.defaults().uniformX()
tableLanguages.defaults().pad(10.0f)
tableLanguages.defaults().fillX()
topTable.add(tableLanguages).row()
val languageCompletionPercentage = UncivGame.Current.translations
.percentCompleteOfLanguages

View File

@ -70,7 +70,7 @@ class ConstructionInfoTable(val city: CityInfo): Table() {
}
val descriptionLabel = description.toLabel()
descriptionLabel.setWrap(true)
descriptionLabel.wrap = true
selectedConstructionTable.add(descriptionLabel).colspan(2).width(stage.width / 4)
}

View File

@ -70,7 +70,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
val sliderLabel = "{Brush Size} $brushSize".toLabel()
slider.onChange {
brushSize = slider.getValue().toInt()
brushSize = slider.value.toInt()
sliderLabel.setText("{Brush Size} $brushSize".tr())
}
@ -276,7 +276,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
val nationImage = ImageGetter.getNationIndicator(nation, 40f)
nationsTable.add(nationImage).row()
nationImage.onClick {
currentNation = nation;
currentNation = nation
currentPlayer = getPlayerIndexString(player)
setUnitTileAction()
}
@ -289,7 +289,7 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
val nationImage = ImageGetter.getNationIndicator(nation, 40f)
nationsTable.add(nationImage).row()
nationImage.onClick {
currentNation = nation;
currentNation = nation
currentPlayer = ""
setUnitTileAction()
}

View File

@ -43,14 +43,14 @@ class NationTable(val nation: Nation, width: Float, minHeight: Float, ruleset: R
val leaderDisplayLabel = titleText.toLabel(nation.getInnerColor(), 24)
val leaderDisplayNameMaxWidth = internalWidth - 80 // for the nation indicator
if (leaderDisplayLabel.width > leaderDisplayNameMaxWidth) { // for instance Polish has really long [x] of [y] translations
leaderDisplayLabel.setWrap(true)
leaderDisplayLabel.wrap = true
titleTable.add(leaderDisplayLabel).width(leaderDisplayNameMaxWidth)
} else titleTable.add(leaderDisplayLabel)
innerTable.add(titleTable).row()
if (ruleset != null) {
val nationUniqueLabel = nation.getUniqueString(ruleset).toLabel(nation.getInnerColor())
nationUniqueLabel.setWrap(true)
nationUniqueLabel.wrap = true
innerTable.add(nationUniqueLabel).width(internalWidth)
}

View File

@ -241,7 +241,7 @@ class PlayerPickerTable(val previousScreen: IPreviousScreen, var gameParameters:
nationDetailsTable.clear()
val nationUniqueLabel = nation.getUniqueString(ruleset).toLabel(nation.getInnerColor())
nationUniqueLabel.setWrap(true)
nationUniqueLabel.wrap = true
nationDetailsTable.add(NationTable(nation, civBlocksWidth, height, ruleset))
nationDetailsTable.onClick {
if (previousScreen is GameParametersScreen)

View File

@ -23,7 +23,7 @@ open class PickerScreen : CameraStageBaseScreen() {
bottomTable.add(closeButton).pad(10f)
descriptionLabel = "".toLabel()
descriptionLabel.setWrap(true)
descriptionLabel.wrap = true
val labelScroll = ScrollPane(descriptionLabel)
bottomTable.add(labelScroll).pad(5f).fill().expand()

View File

@ -69,7 +69,7 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
if (civ.isCityState() && civ.questManager.haveQuestsFor(viewingCiv)) {
val questIcon = ImageGetter.getImage("OtherIcons/Quest").surroundWithCircle(size = 30f, color = Color.GOLDENROD)
civIndicator.addActor(questIcon)
questIcon.setX(floor(civIndicator.width - questIcon.width))
questIcon.x = floor(civIndicator.width - questIcon.width)
}
leftSideTable.add(civIndicator).row()

View File

@ -20,7 +20,7 @@ class TutorialController(screen: CameraStageBaseScreen) {
}
fun removeTutorial(tutorialName: String) {
Tutorial.valueOf(tutorialName)?.let { removeTutorial(it) }
Tutorial.valueOf(tutorialName).let { removeTutorial(it) }
}
fun removeTutorial(tutorial: Tutorial) {
isTutorialShowing = false

View File

@ -57,7 +57,7 @@ open class Popup(val screen: CameraStageBaseScreen): Table(CameraStageBaseScreen
fun addGoodSizedLabel(text: String, size:Int=18): Cell<Label> {
val label = text.toLabel(fontSize = size)
label.setWrap(true)
label.wrap = true
label.setAlignment(Align.center)
return add(label).width(screen.stage.width / 2)
}

View File

@ -41,7 +41,7 @@ class OptionsPopup(val previousScreen:CameraStageBaseScreen) : Popup(previousScr
scrollPane.setScrollingDisabled(true, false)
add(scrollPane).maxHeight(screen.stage.height * 0.6f).row()
addCloseButton() {
addCloseButton {
if(previousScreen is WorldScreen)
previousScreen.enableNextTurnButtonAfterOptions()
}

View File

@ -125,7 +125,7 @@ tasks.register<Zip>("zipLinuxFilesForJar") {
tasks.register("packr") {
for(platform in PackrConfig.Platform.values())
finalizedBy("packr${platform.toString()}")
finalizedBy("packr$platform")
}

View File

@ -34,7 +34,7 @@ import static org.mockito.Mockito.mock;
public class GdxTestRunner extends BlockJUnit4ClassRunner implements ApplicationListener {
private Map<FrameworkMethod, RunNotifier> invokeInRender = new HashMap<FrameworkMethod, RunNotifier>();
private final Map<FrameworkMethod, RunNotifier> invokeInRender = new HashMap<FrameworkMethod, RunNotifier>();
public GdxTestRunner(Class<?> klass) throws InitializationError {
super(klass);