출석부 완료

This commit is contained in:
Ino 2025-09-10 10:24:53 +09:00
parent 8f381766b3
commit 4a185fe594
4 changed files with 49 additions and 13 deletions

View File

@ -57,6 +57,7 @@ public class InternetTime : MonoBehaviour
}
StartCoroutine(Co_1Sec());
DataCheckMgr.Ins.Set();
}
}
}

View File

@ -54,23 +54,55 @@ public class SaveMgr : MonoBehaviourSingletonTemplate<SaveMgr>
}
}
public void Add_Coint(int add = 1)
{
m_SaveData.Coin += add;
Save();
}
public int Get_DoY() { return m_SaveData.LastDoY; }
public void Add_Coin(int add = 1) { m_SaveData.Coin += add; }
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()
{
m_SaveData.LastDoY = InternetTime.Ins.Time.DayOfYear;
if (m_SaveData.Attendance >= 7)
m_SaveData.Attendance = 0;
Save();
}
public void Add_AttendanceDay() { ++m_SaveData.Attendance; }
public int Get_AttendanceDay() { return m_SaveData.Attendance; }
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();
}
}
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 _AttendanceDoY; public int AttendanceDoY { get { return _AttendanceDoY; } set { _AttendanceDoY = value; _AttendanceDoY.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(); } }
ProtectedInt32 _GachaCoin; public int GachaCoin { get { return _GachaCoin; } set { _GachaCoin = value; _GachaCoin.Obfuscate(); } }
}

View File

@ -8,6 +8,10 @@ public class AttandanceUI : uScrollViewMgr
public void OnClick_Get()
{
if (SaveMgr.Ins.CanGet_Attandance())
{
SaveMgr.Ins.Get_AttandanceReward();
Set();
}
}
}

View File

@ -1,8 +1,7 @@
using System.Collections;
using UnityEngine;
using System;
using Random = UnityEngine.Random;
using System.Collections;
using System.Globalization;
using UnityEngine;
#if UNITY_ANDROID
//using Google.Play.Review;
@ -45,14 +44,14 @@ public class DataCheckMgr : MyCoroutine
IEnumerator Co_1Sec()
{
//var sdata = ServerInfo.Ins.m_ServerData;
bool checkinit = false;
while (true)
{
// 게임 접속 중에 다음날이 됐을 때
//if (!checkinit && sdata.Get_Common(eCommon.DOY_Day) != ServerInfo.ServerTime.DayOfYear)
// checkinit = true;
if (!checkinit && SaveMgr.Ins.Get_DoY() != InternetTime.Ins.Time.DayOfYear)
SaveMgr.Ins.DailyCheck();
//if (checkinit && !callinit)
//{
// callinit = true;