-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename BinaryPrefs to BinaryStorage (#34)
- Loading branch information
Showing
68 changed files
with
133 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
using System.IO; | ||
using UnityEngine; | ||
|
||
namespace Appegy.BinaryStorage.Example | ||
namespace Appegy.Storage.Example | ||
{ | ||
public class GameManager : MonoBehaviour | ||
{ | ||
private BinaryPrefs _prefs; | ||
private BinaryStorage _storage; | ||
|
||
private void Awake() | ||
{ | ||
Debug.Log("Game started"); | ||
_prefs = BinaryPrefs | ||
_storage = BinaryStorage | ||
.Construct(Path.Combine(Application.persistentDataPath, "PlayerPrefs.bin")) | ||
.AddPrimitiveTypes() | ||
.SupportListsOf<int>() | ||
.SupportListsOf<string>() | ||
.EnableAutoSaveOnChange() | ||
.Build(); | ||
|
||
_prefs.GetListOf<int>("ints"); | ||
_prefs.Remove("ints"); | ||
_storage.GetListOf<int>("ints"); | ||
_storage.Remove("ints"); | ||
|
||
using (_prefs.MultipleChangeScope()) | ||
using (_storage.MultipleChangeScope()) | ||
{ | ||
var value = _prefs.Get<int>("int_val", 0); | ||
_prefs.Set("int_val", value + 1); | ||
var value = _storage.Get<int>("int_val", 0); | ||
_storage.Set("int_val", value + 1); | ||
|
||
using (_prefs.MultipleChangeScope()) | ||
using (_storage.MultipleChangeScope()) | ||
{ | ||
value = _prefs.Get<int>("int_val", 0); | ||
_prefs.Set("int_val", value + 1); | ||
value = _storage.Get<int>("int_val", 0); | ||
_storage.Set("int_val", value + 1); | ||
|
||
using (_prefs.MultipleChangeScope()) | ||
using (_storage.MultipleChangeScope()) | ||
{ | ||
value = _prefs.Get<int>("int_val", 0); | ||
_prefs.Set("int_val", value + 1); | ||
value = _storage.Get<int>("int_val", 0); | ||
_storage.Set("int_val", value + 1); | ||
} | ||
} | ||
} | ||
} | ||
|
||
private void OnGUI() | ||
{ | ||
var value = _prefs.Get<int>("int_val", 0); | ||
var value = _storage.Get<int>("int_val", 0); | ||
if (GUILayout.Button($"INT={value}")) | ||
{ | ||
_prefs.Set("int_val", value + 1); | ||
_storage.Set("int_val", value + 1); | ||
} | ||
} | ||
|
||
private void OnDestroy() | ||
{ | ||
_prefs?.Dispose(); | ||
_prefs = null; | ||
_storage?.Dispose(); | ||
_storage = null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
using System; | ||
|
||
namespace Appegy.BinaryStorage | ||
namespace Appegy.Storage | ||
{ | ||
internal abstract class Record | ||
{ | ||
|
Oops, something went wrong.