104 lines
2.3 KiB
C#
104 lines
2.3 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace BF
|
|
{
|
|
/// <summary>
|
|
/// 本地存储
|
|
/// 按照格式写Key
|
|
/// </summary>
|
|
public class LocalData
|
|
{
|
|
private const string DEVICE_QUALITY_CACHE = "DEVICE_QUALITY_CACHE";
|
|
private const string PROTO_PATH = "PROTO_PATH";
|
|
private const string CURRCANVAS_PATH = "CURRCANVAS_PATH";
|
|
|
|
|
|
#region Interface
|
|
|
|
public static void SetString(string key, string value)
|
|
{
|
|
PlayerPrefs.SetString(key, value);
|
|
}
|
|
|
|
public static string GetString(string key)
|
|
{
|
|
return PlayerPrefs.GetString(key);
|
|
}
|
|
|
|
public static string GetString(string key, string defaultValue)
|
|
{
|
|
return PlayerPrefs.GetString(key, defaultValue);
|
|
}
|
|
|
|
public static void SetInt(string key, int value)
|
|
{
|
|
PlayerPrefs.SetInt(key, value);
|
|
}
|
|
|
|
public static int GetInt(string key)
|
|
{
|
|
return PlayerPrefs.GetInt(key);
|
|
}
|
|
|
|
public static void SetFloat(string key, float value)
|
|
{
|
|
PlayerPrefs.SetFloat(key, value);
|
|
}
|
|
|
|
public static float GetFloat(string key)
|
|
{
|
|
return PlayerPrefs.GetFloat(key);
|
|
}
|
|
|
|
public static bool HasKey(string key)
|
|
{
|
|
return PlayerPrefs.HasKey(key);
|
|
}
|
|
|
|
public static void DelKey(string key)
|
|
{
|
|
PlayerPrefs.DeleteKey(key);
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region Implement
|
|
|
|
public static void SetDeviceQualityCache(string value)
|
|
{
|
|
SetString(DEVICE_QUALITY_CACHE, value);
|
|
}
|
|
|
|
public static string GetDeviceQualityCache()
|
|
{
|
|
return GetString(DEVICE_QUALITY_CACHE);
|
|
}
|
|
|
|
public static void SetProtoPath(string value)
|
|
{
|
|
SetString(PROTO_PATH, value);
|
|
}
|
|
|
|
public static string GetProtoPath()
|
|
{
|
|
return GetString(PROTO_PATH, "");
|
|
}
|
|
|
|
public static void SetCurrentCanvasName(string value)
|
|
{
|
|
SetString(CURRCANVAS_PATH, value);
|
|
}
|
|
|
|
public static string GetCurrentCanvasName()
|
|
{
|
|
return GetString(CURRCANVAS_PATH, "");
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
} |