33 lines
557 B
C#
33 lines
557 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace BitStrap
|
|
{
|
|
[Serializable]
|
|
public class PlayerPrefBool : PlayerPrefProperty<bool>
|
|
{
|
|
private bool defaultValue;
|
|
|
|
public PlayerPrefBool(string key)
|
|
: base(key)
|
|
{
|
|
}
|
|
|
|
public PlayerPrefBool(string key, bool defaultValue)
|
|
: base(key)
|
|
{
|
|
this.defaultValue = defaultValue;
|
|
}
|
|
|
|
protected override bool OnRetrieveValue()
|
|
{
|
|
return PlayerPrefs.GetInt(key, defaultValue ? 1 : 0) != 0;
|
|
}
|
|
|
|
protected override void OnSaveValue(bool value)
|
|
{
|
|
PlayerPrefs.SetInt(key, value ? 1 : 0);
|
|
}
|
|
}
|
|
}
|