| | 1 | | using UnityEngine; |
| | 2 | |
|
| | 3 | | namespace DCL.Helpers |
| | 4 | | { |
| | 5 | | public class PlayerPrefsProviderDefault : IPlayerPrefsProvider |
| | 6 | | { |
| | 7 | | public void Save() |
| | 8 | | { |
| 3 | 9 | | PlayerPrefs.Save(); |
| 3 | 10 | | } |
| | 11 | |
|
| | 12 | | public bool HasKey(string key) => |
| 1092 | 13 | | PlayerPrefs.HasKey(key); |
| | 14 | |
|
| | 15 | | public int GetInt(string key) => |
| 0 | 16 | | PlayerPrefs.GetInt(key); |
| | 17 | |
|
| | 18 | | public int GetInt(string key, int defaultValue) => |
| 365 | 19 | | PlayerPrefs.GetInt(key, defaultValue); |
| | 20 | |
|
| | 21 | | public void SetInt(string key, int value) |
| | 22 | | { |
| 3 | 23 | | PlayerPrefs.SetInt(key, value); |
| 3 | 24 | | } |
| | 25 | |
|
| | 26 | | public bool GetBool(string key, bool defaultValue) => |
| 4004 | 27 | | PlayerPrefs.GetInt(key, defaultValue ? 1 : 0) == 1; |
| | 28 | |
|
| | 29 | | public void SetBool(string key, bool value) |
| | 30 | | { |
| 33 | 31 | | PlayerPrefs.SetInt(key, value ? 1 : 0); |
| 33 | 32 | | } |
| | 33 | |
|
| | 34 | | public string GetString(string key, string defaultValue) => |
| 3276 | 35 | | PlayerPrefs.GetString(key, string.IsNullOrEmpty(defaultValue) ? "" : defaultValue); |
| | 36 | |
|
| | 37 | | public void SetString(string key, string value) |
| | 38 | | { |
| 27 | 39 | | PlayerPrefs.SetString(key, value); |
| 27 | 40 | | } |
| | 41 | |
|
| | 42 | | public float GetFloat(string key, float defaultValue) => |
| 6552 | 43 | | PlayerPrefs.GetFloat(key, defaultValue); |
| | 44 | |
|
| | 45 | | public void SetFloat(string key, float value) |
| | 46 | | { |
| 54 | 47 | | PlayerPrefs.SetFloat(key, value); |
| 54 | 48 | | } |
| | 49 | | } |
| | 50 | | } |