Revert close buttons + usability improvement (#2088)

* Revert changes to the Close buttons from PR #2069

* Better sensivity of diplomacy buttons
This commit is contained in:
JackRainy
2020-03-06 10:31:23 +02:00
committed by GitHub
parent 585ec2b723
commit e12f35660f
2 changed files with 8 additions and 6 deletions

View File

@ -1,8 +1,9 @@
package com.unciv.ui
package com.unciv.ui
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Actor
import com.badlogic.gdx.scenes.scene2d.Group
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.*
import com.badlogic.gdx.utils.Align
import com.unciv.UncivGame
@ -26,8 +27,7 @@ class EmpireOverviewScreen(private val viewingPlayer:CivilizationInfo) : CameraS
init {
onBackButtonClicked { UncivGame.Current.setWorldScreen() }
val closeButton = "×".toLabel(Color.BLACK, 30).apply { this.setAlignment(Align.center) }
.surroundWithCircle(50f).apply { circle.color = Color.RED.cpy().lerp(Color.BLACK, 0.1f) }
val closeButton = TextButton("Close".tr(), skin)
closeButton.onClick { UncivGame.Current.setWorldScreen() }
closeButton.y = stage.height - closeButton.height - 5
topTable.add(closeButton)
@ -383,6 +383,7 @@ class EmpireOverviewScreen(private val viewingPlayer:CivilizationInfo) : CameraS
val vector = HexMath.getVectorForAngle(2 * Math.PI.toFloat() *i / relevantCivs.size)
civGroup.center(group)
civGroup.moveBy(vector.x*freeWidth/2.5f, vector.y*freeHeight/2.5f)
civGroup.touchable = Touchable.enabled
civGroup.onClick {
onCivClicked(civLines, civ.civName)
}

View File

@ -5,7 +5,6 @@ import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
import com.badlogic.gdx.scenes.scene2d.ui.SplitPane
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
import com.badlogic.gdx.utils.Align
import com.unciv.Constants
import com.unciv.UncivGame
import com.unciv.logic.civilization.AlertType
@ -42,9 +41,11 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
stage.addActor(splitPane)
val closeButton = "×".toLabel(Color.BLACK,24).apply { this.setAlignment(Align.center) }
.surroundWithCircle(24f).apply { circle.color=Color.RED }
val closeButton = TextButton("Close".tr(), skin)
closeButton.onClick { UncivGame.Current.setWorldScreen() }
closeButton.label.setFontSize(24)
closeButton.labelCell.pad(10f)
closeButton.pack()
closeButton.y = stage.height - closeButton.height - 10
closeButton.x = 10f
stage.addActor(closeButton) // This must come after the split pane so it will be above, that the button will be clickable