mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-26 15:49:14 +07:00
Suggestion: Collapsible tutorial tasks (#8591)
* Collapsible tutorial tasks * Fix
This commit is contained in:
@ -66,6 +66,8 @@ class UncivGame(parameters: UncivGameParameters) : Game() {
|
|||||||
lateinit var onlineMultiplayer: OnlineMultiplayer
|
lateinit var onlineMultiplayer: OnlineMultiplayer
|
||||||
lateinit var files: UncivFiles
|
lateinit var files: UncivFiles
|
||||||
|
|
||||||
|
var isTutorialTaskCollapsed = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This exists so that when debugging we can see the entire map.
|
* This exists so that when debugging we can see the entire map.
|
||||||
* Remember to turn this to false before commit and upload!
|
* Remember to turn this to false before commit and upload!
|
||||||
|
@ -114,6 +114,7 @@ class GameSettings {
|
|||||||
|
|
||||||
fun addCompletedTutorialTask(tutorialTask: String): Boolean {
|
fun addCompletedTutorialTask(tutorialTask: String): Boolean {
|
||||||
if (!tutorialTasksCompleted.add(tutorialTask)) return false
|
if (!tutorialTasksCompleted.add(tutorialTask)) return false
|
||||||
|
UncivGame.Current.isTutorialTaskCollapsed = false
|
||||||
save()
|
save()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import com.unciv.models.ruleset.tile.ResourceType
|
|||||||
import com.unciv.models.ruleset.unique.UniqueType
|
import com.unciv.models.ruleset.unique.UniqueType
|
||||||
import com.unciv.ui.cityscreen.CityScreen
|
import com.unciv.ui.cityscreen.CityScreen
|
||||||
import com.unciv.ui.civilopedia.CivilopediaScreen
|
import com.unciv.ui.civilopedia.CivilopediaScreen
|
||||||
|
import com.unciv.ui.images.ImageGetter
|
||||||
import com.unciv.ui.overviewscreen.EmpireOverviewScreen
|
import com.unciv.ui.overviewscreen.EmpireOverviewScreen
|
||||||
import com.unciv.ui.pickerscreens.DiplomaticVotePickerScreen
|
import com.unciv.ui.pickerscreens.DiplomaticVotePickerScreen
|
||||||
import com.unciv.ui.pickerscreens.DiplomaticVoteResultScreen
|
import com.unciv.ui.pickerscreens.DiplomaticVoteResultScreen
|
||||||
@ -391,18 +392,7 @@ class WorldScreen(
|
|||||||
|
|
||||||
updateSelectedCiv()
|
updateSelectedCiv()
|
||||||
|
|
||||||
tutorialTaskTable.clear()
|
displayTutorialTaskOnUpdate()
|
||||||
val tutorialTask = getCurrentTutorialTask()
|
|
||||||
if (tutorialTask == "" || !game.settings.showTutorials || viewingCiv.isDefeated()) {
|
|
||||||
tutorialTaskTable.isVisible = false
|
|
||||||
} else {
|
|
||||||
tutorialTaskTable.isVisible = true
|
|
||||||
tutorialTaskTable.add(tutorialTask.toLabel()
|
|
||||||
.apply { setAlignment(Align.center) }).pad(10f)
|
|
||||||
tutorialTaskTable.pack()
|
|
||||||
tutorialTaskTable.centerX(stage)
|
|
||||||
tutorialTaskTable.y = topBar.y - tutorialTaskTable.height
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fogOfWar) minimapWrapper.update(selectedCiv)
|
if (fogOfWar) minimapWrapper.update(selectedCiv)
|
||||||
else minimapWrapper.update(viewingCiv)
|
else minimapWrapper.update(viewingCiv)
|
||||||
@ -548,6 +538,30 @@ class WorldScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun displayTutorialTaskOnUpdate() {
|
||||||
|
tutorialTaskTable.clear()
|
||||||
|
val tutorialTask = getCurrentTutorialTask()
|
||||||
|
if (tutorialTask == "" || !game.settings.showTutorials || viewingCiv.isDefeated()) {
|
||||||
|
tutorialTaskTable.isVisible = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
tutorialTaskTable.isVisible = true
|
||||||
|
if (!UncivGame.Current.isTutorialTaskCollapsed) {
|
||||||
|
tutorialTaskTable.add(tutorialTask.toLabel()
|
||||||
|
.apply { setAlignment(Align.center) }).pad(10f)
|
||||||
|
} else {
|
||||||
|
tutorialTaskTable.add(ImageGetter.getImage("CityStateIcons/Cultured").apply { setSize(30f,30f) }).pad(5f)
|
||||||
|
}
|
||||||
|
tutorialTaskTable.pack()
|
||||||
|
tutorialTaskTable.centerX(stage)
|
||||||
|
tutorialTaskTable.y = topBar.y - tutorialTaskTable.height
|
||||||
|
tutorialTaskTable.onClick() {
|
||||||
|
UncivGame.Current.isTutorialTaskCollapsed = !UncivGame.Current.isTutorialTaskCollapsed
|
||||||
|
displayTutorialTaskOnUpdate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun updateSelectedCiv() {
|
private fun updateSelectedCiv() {
|
||||||
when {
|
when {
|
||||||
bottomUnitTable.selectedUnit != null -> selectedCiv = bottomUnitTable.selectedUnit!!.civ
|
bottomUnitTable.selectedUnit != null -> selectedCiv = bottomUnitTable.selectedUnit!!.civ
|
||||||
|
Reference in New Issue
Block a user