mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-11 00:08:58 +07:00
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:
@ -1,8 +1,9 @@
|
|||||||
package com.unciv.ui
|
package com.unciv.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor
|
import com.badlogic.gdx.scenes.scene2d.Actor
|
||||||
import com.badlogic.gdx.scenes.scene2d.Group
|
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.scenes.scene2d.ui.*
|
||||||
import com.badlogic.gdx.utils.Align
|
import com.badlogic.gdx.utils.Align
|
||||||
import com.unciv.UncivGame
|
import com.unciv.UncivGame
|
||||||
@ -26,8 +27,7 @@ class EmpireOverviewScreen(private val viewingPlayer:CivilizationInfo) : CameraS
|
|||||||
init {
|
init {
|
||||||
onBackButtonClicked { UncivGame.Current.setWorldScreen() }
|
onBackButtonClicked { UncivGame.Current.setWorldScreen() }
|
||||||
|
|
||||||
val closeButton = "×".toLabel(Color.BLACK, 30).apply { this.setAlignment(Align.center) }
|
val closeButton = TextButton("Close".tr(), skin)
|
||||||
.surroundWithCircle(50f).apply { circle.color = Color.RED.cpy().lerp(Color.BLACK, 0.1f) }
|
|
||||||
closeButton.onClick { UncivGame.Current.setWorldScreen() }
|
closeButton.onClick { UncivGame.Current.setWorldScreen() }
|
||||||
closeButton.y = stage.height - closeButton.height - 5
|
closeButton.y = stage.height - closeButton.height - 5
|
||||||
topTable.add(closeButton)
|
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)
|
val vector = HexMath.getVectorForAngle(2 * Math.PI.toFloat() *i / relevantCivs.size)
|
||||||
civGroup.center(group)
|
civGroup.center(group)
|
||||||
civGroup.moveBy(vector.x*freeWidth/2.5f, vector.y*freeHeight/2.5f)
|
civGroup.moveBy(vector.x*freeWidth/2.5f, vector.y*freeHeight/2.5f)
|
||||||
|
civGroup.touchable = Touchable.enabled
|
||||||
civGroup.onClick {
|
civGroup.onClick {
|
||||||
onCivClicked(civLines, civ.civName)
|
onCivClicked(civLines, civ.civName)
|
||||||
}
|
}
|
||||||
|
@ -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.SplitPane
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
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.badlogic.gdx.utils.Align
|
|
||||||
import com.unciv.Constants
|
import com.unciv.Constants
|
||||||
import com.unciv.UncivGame
|
import com.unciv.UncivGame
|
||||||
import com.unciv.logic.civilization.AlertType
|
import com.unciv.logic.civilization.AlertType
|
||||||
@ -42,9 +41,11 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() {
|
|||||||
stage.addActor(splitPane)
|
stage.addActor(splitPane)
|
||||||
|
|
||||||
|
|
||||||
val closeButton = "×".toLabel(Color.BLACK,24).apply { this.setAlignment(Align.center) }
|
val closeButton = TextButton("Close".tr(), skin)
|
||||||
.surroundWithCircle(24f).apply { circle.color=Color.RED }
|
|
||||||
closeButton.onClick { UncivGame.Current.setWorldScreen() }
|
closeButton.onClick { UncivGame.Current.setWorldScreen() }
|
||||||
|
closeButton.label.setFontSize(24)
|
||||||
|
closeButton.labelCell.pad(10f)
|
||||||
|
closeButton.pack()
|
||||||
closeButton.y = stage.height - closeButton.height - 10
|
closeButton.y = stage.height - closeButton.height - 10
|
||||||
closeButton.x = 10f
|
closeButton.x = 10f
|
||||||
stage.addActor(closeButton) // This must come after the split pane so it will be above, that the button will be clickable
|
stage.addActor(closeButton) // This must come after the split pane so it will be above, that the button will be clickable
|
||||||
|
Reference in New Issue
Block a user