// System
using System;
// Unity
using UnityEngine;
namespace GUPS.AntiCheat.Protected.Prefs
{
///
/// Provides an class for accessing protected int 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 ProtectedIntPref : 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 Int32 defaultValue;
///
/// Gets or sets the value of the player preference.
///
public Int32 Value
{
get
{
return ProtectedPlayerPrefs.GetInt(key, this.defaultValue);
}
set
{
ProtectedPlayerPrefs.SetInt(key, value);
}
}
}
}