74 lines
2.1 KiB
C#
74 lines
2.1 KiB
C#
using GUPS.AntiCheat.Protected;
|
|
using Newtonsoft.Json;
|
|
using System.Collections;
|
|
using TigerForge;
|
|
using UnityEngine;
|
|
|
|
public class SaveMgr : MonoBehaviourSingletonTemplate<SaveMgr>
|
|
{
|
|
EasyFileSave _EasyFile;
|
|
EasyFileSave m_EasyFile
|
|
{
|
|
get
|
|
{
|
|
if (_EasyFile == null)
|
|
{
|
|
_EasyFile = new EasyFileSave();
|
|
m_EasyFile.Load("shegotwet");
|
|
}
|
|
return _EasyFile;
|
|
}
|
|
}
|
|
|
|
public SaveData m_SaveData;
|
|
|
|
IEnumerator Start()
|
|
{
|
|
Load();
|
|
yield return new WaitForSeconds(1f);
|
|
}
|
|
|
|
public void Load()
|
|
{
|
|
m_SaveData = (SaveData)m_EasyFile.GetDeserialized("SaveData", typeof(SaveData));
|
|
if (m_SaveData == null)
|
|
{
|
|
m_SaveData = new SaveData
|
|
{
|
|
Attendance = 0,
|
|
ChatCoin = 0,
|
|
Coin = 0,
|
|
GirlSelectIndex = 0,
|
|
LastDoY = 0
|
|
};
|
|
}
|
|
}
|
|
|
|
public string Get_SaveDataJson() { return JsonConvert.SerializeObject(m_SaveData); }
|
|
public void Save()
|
|
{
|
|
if (m_SaveData != null)
|
|
{
|
|
m_EasyFile.AddSerialized("SaveData", m_SaveData);
|
|
m_EasyFile.Save("shegotwet");
|
|
}
|
|
}
|
|
|
|
public void Add_Coint(int add = 1)
|
|
{
|
|
m_SaveData.Coin += add;
|
|
Save();
|
|
}
|
|
public int Get_Coin() { return m_SaveData.Coin; }
|
|
}
|
|
|
|
public class SaveData
|
|
{
|
|
ProtectedInt32 _LastDoY; public int LastDoY { get { return _LastDoY; } set { _LastDoY = value; _LastDoY.Obfuscate(); } }
|
|
ProtectedInt32 _GirlSelectIndex; public int GirlSelectIndex { get { return _GirlSelectIndex; } set { _GirlSelectIndex = value; _GirlSelectIndex.Obfuscate(); } }
|
|
ProtectedInt32 _Attendance; public int Attendance { get { return _Attendance; } set { _Attendance = value; _Attendance.Obfuscate(); } }
|
|
|
|
ProtectedInt32 _Coin; public int Coin { get { return _Coin; } set { _Coin = value; _Coin.Obfuscate(); } }
|
|
|
|
ProtectedInt32 _ChatCoin; public int ChatCoin { get { return _ChatCoin; } set { _ChatCoin = value; _ChatCoin.Obfuscate(); } }
|
|
} |