2025-09-09 00:14:19 +00:00
|
|
|
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();
|
2025-09-12 03:45:57 +00:00
|
|
|
while (!LobbyUI.Ins) yield return null;
|
|
|
|
|
LobbyUI.Ins.Set_Money();
|
2025-09-09 00:14:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Load()
|
|
|
|
|
{
|
|
|
|
|
m_SaveData = (SaveData)m_EasyFile.GetDeserialized("SaveData", typeof(SaveData));
|
|
|
|
|
if (m_SaveData == null)
|
|
|
|
|
{
|
|
|
|
|
m_SaveData = new SaveData
|
|
|
|
|
{
|
2025-09-11 06:10:39 +00:00
|
|
|
bSound = true,
|
|
|
|
|
bBgm = true,
|
|
|
|
|
|
2025-09-09 00:14:19 +00:00
|
|
|
Attendance = 0,
|
|
|
|
|
ChatCoin = 0,
|
|
|
|
|
Coin = 0,
|
2025-09-11 20:38:25 +00:00
|
|
|
GachaCoin = 0,
|
2025-09-09 00:14:19 +00:00
|
|
|
GirlSelectIndex = 0,
|
2025-09-11 20:38:25 +00:00
|
|
|
LastDoY = 0,
|
|
|
|
|
AttendanceDoY = 0,
|
|
|
|
|
GirlUnLockIndex = 1
|
2025-09-09 00:14:19 +00:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-11 06:10:39 +00:00
|
|
|
public void Set_Option(eOption option)
|
|
|
|
|
{
|
|
|
|
|
switch (option)
|
|
|
|
|
{
|
|
|
|
|
case eOption.Sound: m_SaveData.bSound = !m_SaveData.bSound; break;
|
|
|
|
|
case eOption.Bgm: m_SaveData.bBgm = !m_SaveData.bBgm; break;
|
|
|
|
|
}
|
|
|
|
|
Save();
|
|
|
|
|
}
|
|
|
|
|
public bool Get_Option(eOption option)
|
|
|
|
|
{
|
|
|
|
|
switch (option)
|
|
|
|
|
{
|
|
|
|
|
case eOption.Sound: return m_SaveData.bSound;
|
|
|
|
|
case eOption.Bgm: return m_SaveData.bBgm;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-10 01:24:53 +00:00
|
|
|
public int Get_DoY() { return m_SaveData.LastDoY; }
|
|
|
|
|
|
2025-09-12 03:45:57 +00:00
|
|
|
public void Add_ChatCoin(int add = 1) { m_SaveData.ChatCoin += add; LobbyUI.Ins.Set_Money(); }
|
|
|
|
|
public int Get_ChatCoin() { return m_SaveData.ChatCoin; }
|
|
|
|
|
|
|
|
|
|
public void Add_Coin(int add = 1) { m_SaveData.Coin += add; LobbyUI.Ins.Set_Money(); }
|
2025-09-10 01:24:53 +00:00
|
|
|
public int Get_Coin() { return m_SaveData.Coin; }
|
|
|
|
|
|
|
|
|
|
public void Add_MoneyGacha(int add) { m_SaveData.GachaCoin += add; }
|
|
|
|
|
public int Get_MoneyGacha() { return m_SaveData.GachaCoin; }
|
|
|
|
|
|
|
|
|
|
public void DailyCheck()
|
2025-09-09 00:14:19 +00:00
|
|
|
{
|
2025-09-10 01:24:53 +00:00
|
|
|
m_SaveData.LastDoY = InternetTime.Ins.Time.DayOfYear;
|
|
|
|
|
|
|
|
|
|
if (m_SaveData.Attendance >= 7)
|
|
|
|
|
m_SaveData.Attendance = 0;
|
|
|
|
|
|
2025-09-09 00:14:19 +00:00
|
|
|
Save();
|
|
|
|
|
}
|
2025-09-10 01:24:53 +00:00
|
|
|
public void Add_AttendanceDay() { ++m_SaveData.Attendance; }
|
2025-09-10 00:18:18 +00:00
|
|
|
public int Get_AttendanceDay() { return m_SaveData.Attendance; }
|
2025-09-10 01:24:53 +00:00
|
|
|
public bool CanGet_Attandance(int day) { return Get_AttendanceDay() < day && m_SaveData.AttendanceDoY != m_SaveData.LastDoY; }
|
|
|
|
|
public bool CanGet_Attandance()
|
|
|
|
|
{
|
|
|
|
|
var lst = table_attandance.Ins.Get_DataList();
|
|
|
|
|
for (int i = 0; i < lst.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (CanGet_Attandance(lst[i].n_Day))
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
public void Get_AttandanceReward()
|
|
|
|
|
{
|
|
|
|
|
Add_AttendanceDay();
|
|
|
|
|
var curDay = Get_AttendanceDay();
|
|
|
|
|
var data = table_attandance.Ins.Get_Data(curDay);
|
|
|
|
|
Add_MoneyGacha(data.n_GachaAmount);
|
|
|
|
|
m_SaveData.AttendanceDoY = InternetTime.Ins.Time.DayOfYear;
|
|
|
|
|
Save();
|
|
|
|
|
}
|
2025-09-11 20:34:40 +00:00
|
|
|
|
|
|
|
|
public int Get_UnLockIndex() { return m_SaveData.GirlUnLockIndex; }
|
2025-09-09 00:14:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class SaveData
|
|
|
|
|
{
|
2025-09-11 06:10:39 +00:00
|
|
|
public bool bSound, bBgm;
|
|
|
|
|
|
2025-09-09 00:14:19 +00:00
|
|
|
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(); } }
|
2025-09-11 20:34:40 +00:00
|
|
|
ProtectedInt32 _GirlUnLockIndex; public int GirlUnLockIndex { get { return _GirlUnLockIndex; } set { _GirlUnLockIndex = value; _GirlUnLockIndex.Obfuscate(); } }
|
2025-09-10 01:24:53 +00:00
|
|
|
ProtectedInt32 _AttendanceDoY; public int AttendanceDoY { get { return _AttendanceDoY; } set { _AttendanceDoY = value; _AttendanceDoY.Obfuscate(); } }
|
2025-09-09 00:14:19 +00:00
|
|
|
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(); } }
|
2025-09-10 01:24:53 +00:00
|
|
|
ProtectedInt32 _GachaCoin; public int GachaCoin { get { return _GachaCoin; } set { _GachaCoin = value; _GachaCoin.Obfuscate(); } }
|
2025-09-09 00:14:19 +00:00
|
|
|
}
|