From 4a185fe594482cf914bb7346c877d42ac6b8dd85 Mon Sep 17 00:00:00 2001 From: Ino Date: Wed, 10 Sep 2025 10:24:53 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B6=9C=EC=84=9D=EB=B6=80=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AttachToGameObject/InternetTime.cs | 1 + Assets/Scripts/AttachToGameObject/SaveMgr.cs | 44 ++++++++++++++++--- Assets/Scripts/UI/AttandanceUI.cs | 6 ++- Assets/Scripts/Util/DataCheckMgr.cs | 11 +++-- 4 files changed, 49 insertions(+), 13 deletions(-) diff --git a/Assets/Scripts/AttachToGameObject/InternetTime.cs b/Assets/Scripts/AttachToGameObject/InternetTime.cs index d37520b..fb4d70a 100644 --- a/Assets/Scripts/AttachToGameObject/InternetTime.cs +++ b/Assets/Scripts/AttachToGameObject/InternetTime.cs @@ -57,6 +57,7 @@ public class InternetTime : MonoBehaviour } StartCoroutine(Co_1Sec()); + DataCheckMgr.Ins.Set(); } } } \ No newline at end of file diff --git a/Assets/Scripts/AttachToGameObject/SaveMgr.cs b/Assets/Scripts/AttachToGameObject/SaveMgr.cs index 735b26e..a80cb4b 100644 --- a/Assets/Scripts/AttachToGameObject/SaveMgr.cs +++ b/Assets/Scripts/AttachToGameObject/SaveMgr.cs @@ -54,23 +54,55 @@ public class SaveMgr : MonoBehaviourSingletonTemplate } } - 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(); } } } \ No newline at end of file diff --git a/Assets/Scripts/UI/AttandanceUI.cs b/Assets/Scripts/UI/AttandanceUI.cs index 0c48c1f..89462f4 100644 --- a/Assets/Scripts/UI/AttandanceUI.cs +++ b/Assets/Scripts/UI/AttandanceUI.cs @@ -8,6 +8,10 @@ public class AttandanceUI : uScrollViewMgr public void OnClick_Get() { - + if (SaveMgr.Ins.CanGet_Attandance()) + { + SaveMgr.Ins.Get_AttandanceReward(); + Set(); + } } } \ No newline at end of file diff --git a/Assets/Scripts/Util/DataCheckMgr.cs b/Assets/Scripts/Util/DataCheckMgr.cs index 3896b30..3770462 100644 --- a/Assets/Scripts/Util/DataCheckMgr.cs +++ b/Assets/Scripts/Util/DataCheckMgr.cs @@ -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;