using TyphoonUnitySDK;

#if !UNITY_EDITOR
/// <summary>
/// 适配PlayerPrefs到Oppo localStorage
/// </summary>
public static class PlayerPrefs
{
    public static void SetFloat(string key, float value)
    {
        OppoNative.Instance.PlayerPrefs_SetFloat(key, value);
    }

    public static void SetInt(string key, int value)
    {
        OppoNative.Instance.PlayerPrefs_SetInt(key, value);
    }

    public static void SetString(string key, string value)
    {
        OppoNative.Instance.PlayerPrefs_SetString(key, value);
    }

    public static float GetFloat(string key, float value = 0f)
    {
        return OppoNative.Instance.PlayerPrefs_GetFloat(key, value);
    }

    public static int GetInt(string key, int value = 0)
    {
        return OppoNative.Instance.PlayerPrefs_GetInt(key, value);
    }

    public static string GetString(string key, string value = "")
    {
        return OppoNative.Instance.PlayerPrefs_GetString(key, value);
    }

    public static void DeleteKey(string key)
    {
        OppoNative.Instance.PlayerPrefs_DeleteKey(key);
    }

    public static void DeleteAll()
    {
        OppoNative.Instance.PlayerPrefs_DeleteAll();
    }

    public static void Save()
    {
        OppoNative.Instance.PlayerPrefs_Save();
    }

    public static bool HasKey(string key)
    {
        return OppoNative.Instance.PlayerPrefs_HasKey(key);
    }
}
#endif