| | 1 | | using UnityEngine; |
| | 2 | |
|
| | 3 | | namespace DCL.Helpers |
| | 4 | | { |
| | 5 | | public static class PlayerPrefsUtils |
| | 6 | | { |
| 0 | 7 | | public static int GetInt(string key) { return PlayerPrefs.GetInt(key); } |
| | 8 | |
|
| 124 | 9 | | public static int GetInt(string key, int defaultValue) { return PlayerPrefs.GetInt(key, defaultValue); } |
| | 10 | |
|
| | 11 | | public static void SetInt(string key, int value) |
| | 12 | | { |
| | 13 | | try |
| | 14 | | { |
| 18 | 15 | | PlayerPrefs.SetInt(key, value); |
| 18 | 16 | | } |
| 0 | 17 | | catch (PlayerPrefsException e) |
| | 18 | | { |
| 0 | 19 | | Debug.Log("There was an issue setting PlayerPrefs int!"); |
| 0 | 20 | | } |
| 18 | 21 | | } |
| | 22 | |
|
| 3 | 23 | | public static bool HasKey(string key) { return PlayerPrefs.HasKey(key); } |
| | 24 | |
|
| 10 | 25 | | public static string GetString(string key, string defaultValue = null) { return PlayerPrefs.GetString(key, strin |
| | 26 | |
|
| | 27 | | public static void SetString(string key, string value) |
| | 28 | | { |
| | 29 | | try |
| | 30 | | { |
| 20 | 31 | | PlayerPrefs.SetString(key, value); |
| 20 | 32 | | } |
| 0 | 33 | | catch (PlayerPrefsException e) |
| | 34 | | { |
| 0 | 35 | | Debug.Log("There was an issue setting PlayerPrefs string!"); |
| 0 | 36 | | } |
| 20 | 37 | | } |
| | 38 | |
|
| 72 | 39 | | public static void Save() { PlayerPrefs.Save(); } |
| | 40 | | } |
| | 41 | | } |