ball 项目提交

This commit is contained in:
2026-04-20 12:06:34 +08:00
parent 4331ebba60
commit 99145facbd
6052 changed files with 576445 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
using UnityEngine;
namespace BallKingdomCrush
{
public static class PlayerPrefsKit
{
public static void WriteInt(string key, int data)
{
PlayerPrefs.SetInt(key, data);
}
public static void WriteBool(string key, bool data)
{
PlayerPrefs.SetInt(key, data ? PrefsConst.IntTrue : PrefsConst.IntFalse);
}
public static void WriteString(string key, string data)
{
PlayerPrefs.SetString(key, data);
}
public static void WriteObject(string key, object data)
{
string dataStr = SerializeUtil.ToJson(data);
PlayerPrefs.SetString(key, dataStr);
}
public static bool ReadBool(string key, bool defalutValue = PrefsConst.BoolDefault)
{
if (!HasKey(key))
{
return defalutValue;
}
bool data = PlayerPrefs.GetInt(key) == PrefsConst.IntTrue ? true : false;
return data;
}
public static string ReadString(string key)
{
string data = PlayerPrefs.GetString(key, string.Empty);
return data;
}
public static bool HasKey(string key)
{
return PlayerPrefs.HasKey(key);
}
}
}