Usage of ExtendedPreferences
This commit is contained in:
@@ -1,21 +1,15 @@
|
||||
package io.anuke.mindustry.desktop;
|
||||
|
||||
import com.badlogic.gdx.ApplicationListener;
|
||||
import com.badlogic.gdx.Files.FileType;
|
||||
import com.badlogic.gdx.Preferences;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
|
||||
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3FileHandle;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import io.anuke.kryonet.KryoClient;
|
||||
import io.anuke.kryonet.KryoServer;
|
||||
import io.anuke.mindustry.Mindustry;
|
||||
import io.anuke.mindustry.core.Platform;
|
||||
import io.anuke.mindustry.net.Net;
|
||||
import io.anuke.ucore.io.BinaryPreferences;
|
||||
import io.anuke.ucore.util.OS;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class DesktopLauncher extends Lwjgl3Application{
|
||||
ObjectMap<String, Preferences> prefmap;
|
||||
@@ -41,21 +35,4 @@ public class DesktopLauncher extends Lwjgl3Application{
|
||||
CrashHandler.handle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Preferences getPreferences(String name){
|
||||
String prefsDirectory = OS.getAppDataDirectoryString("Mindustry");
|
||||
|
||||
if(prefmap == null){
|
||||
prefmap = new ObjectMap<>();
|
||||
}
|
||||
|
||||
if(prefmap.containsKey(name)){
|
||||
return prefmap.get(name);
|
||||
}else{
|
||||
Preferences prefs = new BinaryPreferences(new Lwjgl3FileHandle(new File(prefsDirectory, name), FileType.Absolute));
|
||||
prefmap.put(name, prefs);
|
||||
return prefs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user