Added Discord icon+link on main menu

This commit is contained in:
yairm210
2024-11-27 16:55:54 +02:00
parent 6524a5157a
commit a7f69adfbb
5 changed files with 246 additions and 231 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 KiB

After

Width:  |  Height:  |  Size: 561 KiB

View File

@ -526,7 +526,6 @@ class UnitMovement(val unit: MapUnit) {
/**
* Swaps this unit with the unit on the given tile
* Limited to neighboring tiles only
* Precondition: this unit can swap-move to the given tile, as determined by canUnitSwapTo
*/
fun swapMoveToTile(destination: Tile) {

View File

@ -1,5 +1,6 @@
package com.unciv.ui.screens.mainmenuscreen
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.actions.Actions
@ -27,6 +28,7 @@ import com.unciv.ui.audio.SoundPlayer
import com.unciv.ui.components.UncivTooltip.Companion.addTooltip
import com.unciv.ui.components.extensions.center
import com.unciv.ui.components.extensions.surroundWithCircle
import com.unciv.ui.components.extensions.surroundWithThinCircle
import com.unciv.ui.components.extensions.toLabel
import com.unciv.ui.components.input.KeyShortcutDispatcherVeto
import com.unciv.ui.components.input.KeyboardBinding
@ -193,18 +195,25 @@ class MainMenuScreen: BaseScreen(), RecreateOnResize {
game.popScreen()
}
val helpButton = "?".toLabel(fontSize = 48)
val civilopediaButton = "?".toLabel(fontSize = 48)
.apply { setAlignment(Align.center) }
.surroundWithCircle(60f, color = skinStrings.skinConfig.baseColor)
.apply { actor.y -= 2.5f } // compensate font baseline (empirical)
.surroundWithCircle(64f, resizeActor = false)
helpButton.touchable = Touchable.enabled
civilopediaButton.touchable = Touchable.enabled
// Passing the binding directly to onActivation gives you a size 26 tooltip...
helpButton.onActivation { openCivilopedia() }
helpButton.keyShortcuts.add(KeyboardBinding.Civilopedia)
helpButton.addTooltip(KeyboardBinding.Civilopedia, 30f)
helpButton.setPosition(30f, 30f)
stage.addActor(helpButton)
civilopediaButton.onActivation { openCivilopedia() }
civilopediaButton.keyShortcuts.add(KeyboardBinding.Civilopedia)
civilopediaButton.addTooltip(KeyboardBinding.Civilopedia, 30f)
civilopediaButton.setPosition(30f, 30f)
stage.addActor(civilopediaButton)
val discordButton = ImageGetter.getImage("OtherIcons/Discord")
.surroundWithCircle(60f, color = skinStrings.skinConfig.baseColor)
.surroundWithThinCircle(Color.WHITE)
.onActivation { Gdx.net.openURI("https://discord.gg/bjrB4Xw") }
discordButton.setPosition(stage.width-30f-discordButton.width, 30f)
stage.addActor(discordButton)
val versionLabel = "{Version} ${UncivGame.VERSION.text}".toLabel()