Files
UltimateFishing/Assets/Scripts/Assembly-CSharp/BitStrap/PlayerPrefBool.cs
2026-02-21 16:45:37 +08:00

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);
}
}
}