Bug 15: Refactor, improve and finish the Local Storage (Preferences) implementation of Storage api
This commit is contained in:
parent
57a17492c3
commit
bf2cf7c046
@ -28,21 +28,21 @@ import com.pixelgamelibrary.api.storage.map.MapStorage;
|
||||
*
|
||||
* @author robertvokac
|
||||
*/
|
||||
public class WebGLStorage extends MapStorage {
|
||||
public class PreferencesStorage extends MapStorage {
|
||||
|
||||
public Platform getPlatform() {
|
||||
return Platform.WEB;
|
||||
}
|
||||
|
||||
public WebGLStorage() {
|
||||
public PreferencesStorage() {
|
||||
this("pixel.libgdx.webGL.Local-Storage");
|
||||
}
|
||||
|
||||
public WebGLStorage(String preferencesName) {
|
||||
public PreferencesStorage(String preferencesName) {
|
||||
this(Gdx.app.getPreferences(preferencesName));
|
||||
}
|
||||
|
||||
public WebGLStorage(Preferences preferences) {
|
||||
public PreferencesStorage(Preferences preferences) {
|
||||
super(new SimpleLocalStorageMap(preferences));
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ public class StorageFactory {
|
||||
public static Storage getStorage() {
|
||||
final Platform platform = Pixel.app().getPlatform();
|
||||
if (storage == null) {
|
||||
storage = new MemoryStorage();
|
||||
}
|
||||
storage = new PreferencesStorage();
|
||||
}//todo fixme
|
||||
if (storage == null) {
|
||||
|
||||
if (platform.isDesktop()) {
|
||||
@ -50,7 +50,7 @@ public class StorageFactory {
|
||||
storage = new AndroidStorage();
|
||||
}
|
||||
if (platform.isWeb()) {
|
||||
storage = new WebGLStorage();
|
||||
storage = new PreferencesStorage();
|
||||
}
|
||||
}
|
||||
if (storage == null) {
|
||||
|
Reference in New Issue
Block a user