-
Notifications
You must be signed in to change notification settings - Fork 9
/
Preferences.cs
37 lines (27 loc) · 926 Bytes
/
Preferences.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using UnityEngine;
namespace Claws
{
internal static class Preferences
{
const string IsEnabledPreference = @"Claws.Plugin.IsEnabled";
public const float Length = 0.3f;
public static bool IsEnabled { get; internal set; }
public static void Store()
{
Plugin.Log.Info("Storing plugin preferences...");
PlayerPrefs.SetInt(IsEnabledPreference, IsEnabled ? 1 : 0);
PlayerPrefs.Save();
Plugin.Log.Info("Stored!");
}
public static void Restore()
{
Plugin.Log.Info("Loading plugin preferences...");
IsEnabled = PlayerPrefs.GetInt(IsEnabledPreference, 0) != 0;
var pluginState = Plugin.IsEnabled ? "enabled" : "disabled";
Plugin.Log.Info($"Loaded! Plugin is {pluginState}.");
}
public static void Invalidate()
{
}
}
}