// System using System; // Unity using UnityEngine; namespace GUPS.AntiCheat.Protected.Prefs { /// /// Provides an class for accessing protected string player preferences via properties, offering a more structured approach than /// interacting directly with the static ProtectedPlayerPrefs class. Also allows to easily assign the protected player preferences /// in the unity inspector. /// [Serializable] public class ProtectedStringPref : IProtectedPref { /// /// Gets the unique key associated with the player preference. /// [SerializeField] [Tooltip("The unique key associated with the player preference.")] private string key; /// /// Gets the unique key associated with the player preference. /// public String Key => this.Key; /// /// The default value if the player preference is not set. /// [SerializeField] [Tooltip("The default value if the player preference is not set.")] private String defaultValue; /// /// Gets or sets the value of the player preference. /// public String Value { get { return ProtectedPlayerPrefs.GetString(key, this.defaultValue); } set { ProtectedPlayerPrefs.SetString(key, value); } } } }