54 lines
1.8 KiB
C#
54 lines
1.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Script.Utils
|
|
{
|
|
public class PlayerPrefsUtils
|
|
{
|
|
private const string BXSdk_PREFIX = "Sdk_";
|
|
public static float GetPlayerPrefsFloat(string _key, float _dValue = 0.0f)
|
|
{
|
|
float value = PlayerPrefs.GetFloat(string.Format("{0}{1}", BXSdk_PREFIX, _key), _dValue);
|
|
return value;
|
|
}
|
|
|
|
public static void SavePlayerPrefsFloat(string _key, float _nValue)
|
|
{
|
|
PlayerPrefs.SetFloat(string.Format("{0}{1}", BXSdk_PREFIX, _key), _nValue);
|
|
PlayerPrefs.Save();
|
|
}
|
|
|
|
public static int GetPlayerPrefsInt(string _key, int _dValue = 0)
|
|
{
|
|
int value = PlayerPrefs.GetInt(string.Format("{0}{1}", BXSdk_PREFIX, _key), _dValue);
|
|
return value;
|
|
}
|
|
|
|
public static void SavePlayerPrefsInt(string _key, int _nValue)
|
|
{
|
|
PlayerPrefs.SetInt(string.Format("{0}{1}", BXSdk_PREFIX, _key), _nValue);
|
|
PlayerPrefs.Save();
|
|
}
|
|
|
|
public static string GetPlayerPrefsString(string _key, string _dValue = "")
|
|
{
|
|
string value = PlayerPrefs.GetString(string.Format("{0}{1}", BXSdk_PREFIX, _key), _dValue);
|
|
return value;
|
|
}
|
|
|
|
public static void SavePlayerPrefsString(string _key, string _nValue)
|
|
{
|
|
PlayerPrefs.SetString(string.Format("{0}{1}", BXSdk_PREFIX, _key), _nValue);
|
|
PlayerPrefs.Save();
|
|
}
|
|
|
|
public static bool IfFirstCheckPlayerPrefs(string _key)
|
|
{
|
|
var isFirstClick = PlayerPrefs.GetInt(_key, 0) == 0;
|
|
PlayerPrefs.SetInt(_key, 1);
|
|
PlayerPrefs.Save();
|
|
return isFirstClick;
|
|
}
|
|
}
|
|
} |