mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 01:08:25 +07:00
Move LinuxX11SaverLoader to Desktop as should be
This commit is contained in:
@ -60,6 +60,7 @@ project(":desktop") {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
"implementation"(project(":core"))
|
"implementation"(project(":core"))
|
||||||
|
"implementation"("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
|
||||||
"implementation"("com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion")
|
"implementation"("com.badlogicgames.gdx:gdx-backend-lwjgl3:$gdxVersion")
|
||||||
"implementation"("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop")
|
"implementation"("com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop")
|
||||||
|
|
||||||
|
@ -394,11 +394,6 @@ class UncivFiles(
|
|||||||
* Platform dependent saver-loader to custom system locations
|
* Platform dependent saver-loader to custom system locations
|
||||||
*/
|
*/
|
||||||
var saverLoader: PlatformSaverLoader = PlatformSaverLoader.None
|
var saverLoader: PlatformSaverLoader = PlatformSaverLoader.None
|
||||||
get() {
|
|
||||||
if (field.javaClass.simpleName == "DesktopSaverLoader" && LinuxX11SaverLoader.isRequired())
|
|
||||||
field = LinuxX11SaverLoader()
|
|
||||||
return field
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Specialized function to access settings before Gdx is initialized.
|
/** Specialized function to access settings before Gdx is initialized.
|
||||||
*
|
*
|
||||||
|
@ -57,7 +57,7 @@ internal object DesktopLauncher {
|
|||||||
Fonts.fontImplementation = DesktopFont()
|
Fonts.fontImplementation = DesktopFont()
|
||||||
|
|
||||||
// Setup Desktop saver-loader
|
// Setup Desktop saver-loader
|
||||||
UncivFiles.saverLoader = DesktopSaverLoader()
|
UncivFiles.saverLoader = if (LinuxX11SaverLoader.isRequired()) LinuxX11SaverLoader() else DesktopSaverLoader()
|
||||||
UncivFiles.preferExternalStorage = false
|
UncivFiles.preferExternalStorage = false
|
||||||
|
|
||||||
// Solves a rendering problem in specific GPUs and drivers.
|
// Solves a rendering problem in specific GPUs and drivers.
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.unciv.logic.files
|
package com.unciv.app.desktop
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.unciv.UncivGame
|
import com.unciv.UncivGame
|
||||||
|
import com.unciv.logic.files.FileChooser
|
||||||
|
import com.unciv.logic.files.PlatformSaverLoader
|
||||||
import com.unciv.utils.Concurrency
|
import com.unciv.utils.Concurrency
|
||||||
import java.awt.GraphicsEnvironment
|
import java.awt.GraphicsEnvironment
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@ -24,8 +26,8 @@ class LinuxX11SaverLoader : PlatformSaverLoader {
|
|||||||
if (suggestedLocation.startsWith(File.separator)) Gdx.files.absolute(suggestedLocation)
|
if (suggestedLocation.startsWith(File.separator)) Gdx.files.absolute(suggestedLocation)
|
||||||
else if (Gdx.files.external(suggestedLocation).parent().exists()) Gdx.files.external(suggestedLocation)
|
else if (Gdx.files.external(suggestedLocation).parent().exists()) Gdx.files.external(suggestedLocation)
|
||||||
else UncivGame.Current.files.getLocalFile(suggestedLocation)
|
else UncivGame.Current.files.getLocalFile(suggestedLocation)
|
||||||
FileChooser.createSaveDialog(stage, "Save game", startLocation) {
|
|
||||||
success, file ->
|
FileChooser.createSaveDialog(stage, "Save game", startLocation) { success, file ->
|
||||||
if (!success)
|
if (!success)
|
||||||
onError(PlatformSaverLoader.Cancelled())
|
onError(PlatformSaverLoader.Cancelled())
|
||||||
else
|
else
|
Reference in New Issue
Block a user