mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 15:27:50 +07:00
External links: Right-click and some housecleaning (#11155)
* Right-click external links to copy url * Add hint about right-clicking links to UI Tips tutorial * Add wiki link to about and centralize repo/wiki external link bases
This commit is contained in:
@ -481,7 +481,11 @@
|
||||
{"text":"Reveal known resources on world screen","header":5,"color":"#fa0"},
|
||||
{"text":"In the Resources overview, click on a resource icon to center the world screen on tiles already discovered and providing this resource."},
|
||||
{"text":"Alternatively, click on the \"Unimproved\" number to center the world screen only on owned tiles where the resource is not improved."},
|
||||
{"text":"If more than one tile is available, click repeatedly on the notification to cycle through all of them."}
|
||||
{"text":"If more than one tile is available, click repeatedly on the notification to cycle through all of them."},
|
||||
{},
|
||||
{"text":"External links","header":5,"color":"#fa0"},
|
||||
{"text":"External links support right-click or long press to copy the link to the clipboard instead of launching the browser."},
|
||||
{"text":"Example: The 'Open Github page' button on the Mod management screen."}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -1830,6 +1830,7 @@ Mods of mods =
|
||||
Mod info and options =
|
||||
Next page =
|
||||
Open Github page =
|
||||
Link copied to clipboard =
|
||||
Permanent audiovisual mod =
|
||||
Installed =
|
||||
Downloaded! =
|
||||
|
@ -106,4 +106,10 @@ object Constants {
|
||||
|
||||
const val defaultFontSize = 18
|
||||
const val headingFontSize = 24
|
||||
|
||||
/** URL to the root of the Unciv repository, including trailing slash */
|
||||
// Note: Should the project move, this covers external links, but not comments e.g. mentioning issues
|
||||
const val uncivRepoURL = "https://github.com/yairm210/Unciv/"
|
||||
/** URL to the wiki, including trailing slash */
|
||||
const val wikiURL = "https://yairm210.github.io/Unciv/"
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ internal class LanguageTable(val language:String, val percentComplete: Int) : Ta
|
||||
text = "Please note that translations are a community-based work in progress and are" +
|
||||
" INCOMPLETE! The percentage shown is how much of the language is translated in-game." +
|
||||
" If you want to help translating the game into your language, click here.",
|
||||
link = "https://yairm210.github.io/Unciv/Other/Translating/",
|
||||
link = "${Constants.wikiURL}Translating/",
|
||||
size = 15
|
||||
)
|
||||
add(MarkupRenderer.render(listOf(translationDisclaimer),expectedWidth)).pad(5f).row()
|
||||
|
@ -192,7 +192,7 @@ class CrashScreen(val exception: Throwable) : BaseScreen() {
|
||||
)
|
||||
.onClick {
|
||||
if (copied) {
|
||||
Gdx.net.openURI("https://github.com/yairm210/Unciv/issues")
|
||||
Gdx.net.openURI("${Constants.uncivRepoURL}issues")
|
||||
} else {
|
||||
ToastPopup(
|
||||
"Please copy the error report first.",
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.unciv.ui.popups.options
|
||||
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.unciv.Constants
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.ui.screens.civilopediascreen.FormattedLine
|
||||
import com.unciv.ui.screens.civilopediascreen.MarkupRenderer
|
||||
@ -10,9 +11,10 @@ fun aboutTab(): Table {
|
||||
val lines = sequence {
|
||||
yield(FormattedLine(extraImage = "banner", imageSize = 240f, centered = true))
|
||||
yield(FormattedLine())
|
||||
yield(FormattedLine("{Version}: ${UncivGame.VERSION.toNiceString()}", link = "https://github.com/yairm210/Unciv/blob/master/changelog.md#$versionAnchor"))
|
||||
yield(FormattedLine("See online Readme", link = "https://github.com/yairm210/Unciv/blob/master/README.md#unciv---foss-civ-v-for-androiddesktop"))
|
||||
yield(FormattedLine("Visit repository", link = "https://github.com/yairm210/Unciv"))
|
||||
yield(FormattedLine("{Version}: ${UncivGame.VERSION.toNiceString()}", link = "${Constants.uncivRepoURL}blob/master/changelog.md#$versionAnchor"))
|
||||
yield(FormattedLine("See online Readme", link = "${Constants.uncivRepoURL}blob/master/README.md#unciv---foss-civ-v-for-androiddesktop"))
|
||||
yield(FormattedLine("Visit repository", link = Constants.uncivRepoURL))
|
||||
yield(FormattedLine("Visit the wiki", link = Constants.wikiURL))
|
||||
}
|
||||
return MarkupRenderer.render(lines.asIterable()).pad(20f)
|
||||
}
|
||||
|
@ -3,9 +3,11 @@ package com.unciv.ui.screens.civilopediascreen
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.utils.Align
|
||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||
import com.unciv.ui.components.extensions.addSeparator
|
||||
import com.unciv.ui.components.input.onClick
|
||||
import com.unciv.ui.components.input.onRightClick
|
||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||
import com.unciv.ui.screens.civilopediascreen.MarkupRenderer.render
|
||||
|
||||
|
||||
/** Makes [renderer][render] available outside [ICivilopediaText] */
|
||||
@ -51,10 +53,14 @@ object MarkupRenderer {
|
||||
actor.onClick {
|
||||
linkAction(line.link)
|
||||
}
|
||||
else if (line.linkType == FormattedLine.LinkType.External)
|
||||
else if (line.linkType == FormattedLine.LinkType.External) {
|
||||
actor.onClick {
|
||||
Gdx.net.openURI(line.link)
|
||||
}
|
||||
actor.onRightClick {
|
||||
Gdx.app.clipboard.contents = line.link
|
||||
}
|
||||
}
|
||||
if (labelWidth == 0f)
|
||||
table.add(actor).align(line.align).row()
|
||||
else
|
||||
|
@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Image
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.unciv.logic.github.Github
|
||||
import com.unciv.logic.github.GithubAPI
|
||||
import com.unciv.models.metadata.BaseRuleset
|
||||
import com.unciv.models.ruleset.Ruleset
|
||||
@ -15,7 +16,8 @@ import com.unciv.ui.components.extensions.toCheckBox
|
||||
import com.unciv.ui.components.extensions.toLabel
|
||||
import com.unciv.ui.components.extensions.toTextButton
|
||||
import com.unciv.ui.components.input.onClick
|
||||
import com.unciv.logic.github.Github
|
||||
import com.unciv.ui.components.input.onRightClick
|
||||
import com.unciv.ui.popups.ToastPopup
|
||||
import com.unciv.utils.Concurrency
|
||||
import kotlin.math.max
|
||||
|
||||
@ -87,9 +89,15 @@ internal class ModInfoAndActionPane : Table() {
|
||||
|
||||
// offer link to open the repo itself in a browser
|
||||
if (repoUrl.isNotEmpty()) {
|
||||
add("Open Github page".toTextButton().onClick {
|
||||
val githubButton = "Open Github page".toTextButton()
|
||||
githubButton.onClick {
|
||||
Gdx.net.openURI(repoUrl)
|
||||
}).row()
|
||||
}
|
||||
githubButton.onRightClick {
|
||||
Gdx.app.clipboard.contents = repoUrl
|
||||
ToastPopup("Link copied to clipboard", stage)
|
||||
}
|
||||
add(githubButton).row()
|
||||
}
|
||||
|
||||
// display "updated" date
|
||||
|
@ -1,15 +1,16 @@
|
||||
package com.unciv.ui.screens.multiplayerscreens
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.unciv.Constants
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.logic.multiplayer.OnlineMultiplayer
|
||||
import com.unciv.logic.multiplayer.OnlineMultiplayerGame
|
||||
import com.unciv.models.translations.tr
|
||||
import com.unciv.ui.popups.Popup
|
||||
import com.unciv.ui.screens.savescreens.LoadGameScreen
|
||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||
import com.unciv.ui.components.extensions.formatShort
|
||||
import com.unciv.ui.components.extensions.toCheckBox
|
||||
import com.unciv.ui.popups.Popup
|
||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||
import com.unciv.ui.screens.savescreens.LoadGameScreen
|
||||
import com.unciv.utils.Concurrency
|
||||
import com.unciv.utils.launchOnGLThread
|
||||
import java.time.Duration
|
||||
@ -61,7 +62,7 @@ object MultiplayerHelpers {
|
||||
"Consider using a custom server instead."
|
||||
).colspan(2).row()
|
||||
dropboxWarning.addButton("Open Documentation") {
|
||||
Gdx.net.openURI("https://yairm210.github.io/Unciv/Other/Multiplayer/#hosting-a-multiplayer-server")
|
||||
Gdx.net.openURI("${Constants.wikiURL}Other/Multiplayer/#hosting-a-multiplayer-server")
|
||||
}.colspan(2).row()
|
||||
|
||||
val checkBox = "Don't show again".toCheckBox()
|
||||
|
Reference in New Issue
Block a user