diff --git a/Assets/ResWork/Table/table_album.cs b/Assets/ResWork/Table/table_album.cs index 4ba09de..dc41ef3 100644 --- a/Assets/ResWork/Table/table_album.cs +++ b/Assets/ResWork/Table/table_album.cs @@ -2,11 +2,14 @@ using GUPS.AntiCheat.Protected; using Newtonsoft.Json; using System.Collections.Generic; +public enum eCollectionMethod { Default, Normal, Gacha, FullCollection, Mission } + public class albumtabledata : ShowAlbumBase { public int n_Index; ProtectedInt32 _GirlID; public int n_GirlID { get { return _GirlID; } set { _GirlID = value; _GirlID.Obfuscate(); } } ProtectedInt32 _Price; public int n_Price { get { return _Price; } set { _Price = value; _Price.Obfuscate(); } } + public eCollectionMethod e_CollectionMethod; } public class table_album : table_base @@ -37,4 +40,30 @@ public class table_album : table_base public List Get_DataList() { return tableDatas; } public List Get_DataList(int girl) { return dic_datas[girl]; } + public List Get_AlbumDataList(int girl) + { + return Get_DataList(girl).FindAll(f => f.e_CollectionMethod == eCollectionMethod.Normal); + } + public albumtabledata Get_SpecialAlbum(int girl, eCollectionMethod method) + { + return Get_DataList(girl).Find(f => f.e_CollectionMethod == method); + } + public albumtabledata Get_PreData_orNull(albumtabledata data) + { + for (int i = 0; i < tableDatas.Count; i++) + { + if (tableDatas[i].n_Index == data.n_Index) + { + for (int j = 0; j < 5; j++) + { + var pre = i - 1; + if (pre < 0) return null; + var temp = tableDatas[pre]; + if (temp.e_CollectionMethod == eCollectionMethod.Normal) + return temp; + } + } + } + return null; + } } \ No newline at end of file diff --git a/Assets/Scripts/Addressable.meta b/Assets/Scripts/Addressable.meta new file mode 100644 index 0000000..4208125 --- /dev/null +++ b/Assets/Scripts/Addressable.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a6d64bda2d998014688bb74631dc4fc7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Addressable/AddrHandleBase.cs b/Assets/Scripts/Addressable/AddrHandleBase.cs new file mode 100644 index 0000000..e8cbc3e --- /dev/null +++ b/Assets/Scripts/Addressable/AddrHandleBase.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.ResourceManagement.AsyncOperations; +using UnityEngine.UI; + +public class AddrHandleBase : MonoBehaviour +{ + protected Dictionary m_Handle = new Dictionary(); + + protected void Load_Obj(string path, Action> loadfinish = null) + { + ReleaseHandle(path); + + AddrResourceMgr.Ins.LoadObject(path, handle => + { + m_Handle[path] = handle; + loadfinish?.Invoke(handle); + }); + } + + protected void Load_Image(Image image, string path, Action loadfinish = null) + { + image.enabled = false; + ReleaseHandle(path); + + AddrResourceMgr.Ins.LoadObject(path, handle => + { + m_Handle[path] = handle; + image.enabled = true; + image.sprite = handle.Result; + loadfinish?.Invoke(); + }); + } + + protected void Load_SpriteRenderer(SpriteRenderer image, string path, Action loadfinish = null) + { + image.enabled = false; + ReleaseHandle(path); + + AddrResourceMgr.Ins.LoadObject(path, handle => + { + m_Handle[path] = handle; + image.enabled = true; + image.sprite = handle.Result; + loadfinish?.Invoke(); + }); + } + + protected void Load_SpriteRenderer(SpriteRenderer[] images, string path, Action loadfinish = null) + { + for (int i = 0; i < images.Length; i++) + images[i].enabled = false; + + ReleaseHandle(path); + + AddrResourceMgr.Ins.LoadObject(path, handle => + { + m_Handle[path] = handle; + for (int i = 0; i < images.Length; i++) + { + images[i].enabled = true; + images[i].sprite = handle.Result; + } + loadfinish?.Invoke(); + }); + } + + /// + /// 특정 path의 핸들만 해제 + /// + private void ReleaseHandle(string path) + { + if (m_Handle.TryGetValue(path, out var handle)) + { + AddrResourceMgr.Ins.Relese(handle); + m_Handle.Remove(path); + } + } + + protected virtual void OnDestroy() + { + foreach (var handle in m_Handle.Values) + AddrResourceMgr.Ins.Relese(handle); + + m_Handle.Clear(); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Addressable/AddrHandleBase.cs.meta b/Assets/Scripts/Addressable/AddrHandleBase.cs.meta new file mode 100644 index 0000000..1898da9 --- /dev/null +++ b/Assets/Scripts/Addressable/AddrHandleBase.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 293301756224388478096683be489194 \ No newline at end of file diff --git a/Assets/Scripts/AttachToGameObject/SaveMgr.cs b/Assets/Scripts/AttachToGameObject/SaveMgr.cs index 7825e3d..c30955a 100644 --- a/Assets/Scripts/AttachToGameObject/SaveMgr.cs +++ b/Assets/Scripts/AttachToGameObject/SaveMgr.cs @@ -33,23 +33,8 @@ public class SaveMgr : MonoBehaviourSingletonTemplate m_SaveData = CryptoUtil.Load("SaveData"); if (m_SaveData == null) { - m_SaveData = new SaveData - { - bSound = true, - bBgm = true, - - Attendance = 0, - MoneyChatCoin = 0, - MoneyGacha = 100, - MoneyHeart = 0, - MoneyLucky = table_GlobalValue.Ins.Get_Int("LuckyPoint"), - SelectGirlID = 1, - LastDoY = 0, - AttendanceDoY = 0, - MiniGameHP = table_GlobalValue.Ins.Get_Int("MiniGame_TotalEnterMoney") - }; - - Open_Album(table_album.Ins.Get_DataList()[0]); + m_SaveData = new SaveData(); + Open_Album(table_album.Ins.Get_SpecialAlbum(1, eCollectionMethod.Default)); } } @@ -232,10 +217,10 @@ public class SaveMgr : MonoBehaviourSingletonTemplate public void Open_Album(albumtabledata data) { - if (!m_SaveData.dic_ablumopen.ContainsKey(data.n_GirlID)) - m_SaveData.dic_ablumopen.Add(data.n_GirlID, new List()); - if (m_SaveData.dic_ablumopen[data.n_GirlID].Find(f => f.ID == data.n_Index) == null) - m_SaveData.dic_ablumopen[data.n_GirlID].Add(new AlbumSaveData { ID = data.n_Index }); + if (!m_SaveData.dic_albumOpen.ContainsKey(data.n_GirlID)) + m_SaveData.dic_albumOpen.Add(data.n_GirlID, new List()); + if (m_SaveData.dic_albumOpen[data.n_GirlID].Find(f => f.ID == data.n_Index) == null) + m_SaveData.dic_albumOpen[data.n_GirlID].Add(new AlbumSaveData { ID = data.n_Index }); } public int Get_SelectGirlID() { return m_SaveData.SelectGirlID; } public void Set_SelectGirlID(int id) @@ -251,19 +236,43 @@ public class SaveMgr : MonoBehaviourSingletonTemplate var pregirl = id - 1; if (pregirl > 0) { - var lst = table_album.Ins.Get_DataList(pregirl); - return lst.Count == Get_ImageCount(pregirl) && Get_ImageCount(id) > 0; + var lst = table_album.Ins.Get_AlbumDataList(pregirl); + return lst.Count == Get_NormalImageCount(pregirl) && Get_NormalImageCount(id) > 0; } return true; } public bool IsOpenAlbum(albumtabledata data) { - return m_SaveData.dic_ablumopen.ContainsKey(data.n_GirlID) && - m_SaveData.dic_ablumopen[data.n_GirlID].Find(f => f.ID == data.n_Index) != null; + return m_SaveData.dic_albumOpen.ContainsKey(data.n_GirlID) && + m_SaveData.dic_albumOpen[data.n_GirlID].Find(f => f.ID == data.n_Index) != null; } - public int Get_ImageCount(int girlid) + public int Get_NormalImageCount(int girlid) { - return m_SaveData.dic_ablumopen.ContainsKey(girlid) ? m_SaveData.dic_ablumopen[girlid].Count : 0; + if (!m_SaveData.dic_albumOpen.TryGetValue(girlid, out var openedList)) + return 0; + + var albumList = table_album.Ins.Get_AlbumDataList(girlid); + + // 오픈된 ID를 HashSet으로 변환 + HashSet openedIDs = new HashSet(); + for (int i = 0; i < openedList.Count; i++) + openedIDs.Add(openedList[i].ID); + + int count = 0; + for (int i = 0; i < albumList.Count; i++) + { + if (openedIDs.Contains(albumList[i].n_Index)) + ++count; + } + + return count; + } + public int Get_AllImageCount(int girlid) + { + if (!m_SaveData.dic_albumOpen.TryGetValue(girlid, out var openedList)) + return 0; + + return m_SaveData.dic_albumOpen[girlid].Count; } public void Set_ShopReward(shoptabledata data) @@ -438,9 +447,37 @@ public class SaveMgr : MonoBehaviourSingletonTemplate ProtectedBool _BuyShopDisableOne1; public bool BuyShopDisableOne1 { get { return _BuyShopDisableOne1; } set { _BuyShopDisableOne1 = value; _BuyShopDisableOne1.Obfuscate(); } } ProtectedBool _BuyShopDisableOne2; public bool BuyShopDisableOne2 { get { return _BuyShopDisableOne2; } set { _BuyShopDisableOne2 = value; _BuyShopDisableOne2.Obfuscate(); } } - public Dictionary> dic_ablumopen = new Dictionary>(); + public Dictionary> dic_albumOpen = new Dictionary>(); public List list_ShopLimit = new List(); public List list_ChatSaveData = new List(); + + public SaveData() + { + bSound = true; + bBgm = true; + + LastDoY = 0; + WeekOfYear = 0; + SelectGirlID = 1; + AttendanceDoY = 0; + Attendance = 0; + + MoneyHeart = 0; + MoneyChatCoin = 0; + MoneyGacha = 100; + MoneyLucky = table_GlobalValue.Ins.Get_Int("LuckyPoint"); + MiniGameHP = table_GlobalValue.Ins.Get_Int("MiniGame_TotalEnterMoney"); + BonusGameRefill = 0; + + NoAD = false; + InfinityMiniGame = false; + LuckyGameCharge = false; + BuyShopWeekly = false; + BuyShopOne1 = false; + BuyShopOne2 = false; + BuyShopDisableOne1 = false; + BuyShopDisableOne2 = false; + } } public class ShopADSaveData diff --git a/Assets/Scripts/UI/AlbumCard.cs b/Assets/Scripts/UI/AlbumCard.cs index a85dc2b..f30dc24 100644 --- a/Assets/Scripts/UI/AlbumCard.cs +++ b/Assets/Scripts/UI/AlbumCard.cs @@ -1,6 +1,5 @@ using TMPro; using UnityEngine; -using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.UI; public class AlbumCard : CardBase @@ -10,30 +9,21 @@ public class AlbumCard : CardBase public GameObject[] gos; // 0 열기 버튼, 1 잠금 버튼 albumtabledata m_Data; - AsyncOperationHandle m_Handle; public override void Set(T _base, int iLoop = -1, int idata = -1) { base.Set(_base, iLoop, idata); m_Data = _base as albumtabledata; - Set_UI(); - - i_girl.enabled = false; - AddrResourceMgr.Ins.Relese(m_Handle); - AddrResourceMgr.Ins.LoadObject(m_Data.s_Image, handle => - { - m_Handle = handle; - i_girl.enabled = true; - i_girl.sprite = handle.Result; - }); + Load_Image(i_girl, m_Data.s_Image); } public override void Set_UI() { - gos[0].SetActive(!SaveMgr.Ins.IsOpenAlbum(m_Data)); + var preData = table_album.Ins.Get_PreData_orNull(m_Data); + gos[0].SetActive(SaveMgr.Ins.IsObtainGirl(m_Data.n_GirlID) &&!SaveMgr.Ins.IsOpenAlbum(m_Data) && + (preData == null || SaveMgr.Ins.IsOpenAlbum(preData))); t_price.text = m_Data.n_Price.ToString(); - //if (i_girl.enabled) i_girl.material = IsObtain() ? null : mat_blur; gos[1].SetActive(!IsObtain()); } diff --git a/Assets/Scripts/UI/AlbumUI.cs b/Assets/Scripts/UI/AlbumUI.cs index 1e22725..816c70a 100644 --- a/Assets/Scripts/UI/AlbumUI.cs +++ b/Assets/Scripts/UI/AlbumUI.cs @@ -25,7 +25,7 @@ public class AlbumUI : uScrollViewMgr if (girlid > 0) curGirl = girlid; - Set_ScrollView(table_album.Ins.Get_DataList(curGirl)); + Set_ScrollView(table_album.Ins.Get_AlbumDataList(curGirl)); texts[0].text = table_girl.Ins.Get_Data(curGirl).s_Name; Set_UI(); diff --git a/Assets/Scripts/UI/ProfileCard.cs b/Assets/Scripts/UI/ProfileCard.cs index 96fd26a..d723455 100644 --- a/Assets/Scripts/UI/ProfileCard.cs +++ b/Assets/Scripts/UI/ProfileCard.cs @@ -29,7 +29,7 @@ public class ProfileCard : MonoBehaviour void Set_UI() { - var count = SaveMgr.Ins.Get_ImageCount(m_Data.n_GirlID); + var count = SaveMgr.Ins.Get_AllImageCount(m_Data.n_GirlID); var maxcount = table_album.Ins.Get_DataList(m_Data.n_GirlID).Count; texts[0].text = m_Data.s_Name; texts[1].text = $"{count}/{maxcount}"; @@ -53,8 +53,8 @@ public class ProfileCard : MonoBehaviour var pregirl = m_Data.n_GirlID - 1; if (pregirl > 0) { - var lst = table_album.Ins.Get_DataList(pregirl); - return (lst.Count == SaveMgr.Ins.Get_ImageCount(pregirl) && SaveMgr.Ins.Get_ImageCount(m_Data.n_GirlID) == 0); + var lst = table_album.Ins.Get_AlbumDataList(pregirl); + return lst.Count == SaveMgr.Ins.Get_NormalImageCount(pregirl) && SaveMgr.Ins.Get_NormalImageCount(m_Data.n_GirlID) == 0; } return false; } @@ -90,9 +90,6 @@ public class ProfileCard : MonoBehaviour { if (CanOpen()) { // 열 수 있음 - SaveMgr.Ins.Open_Album(table_album.Ins.Get_DataList()[0]); // 최초 한 장 공짜 지급 - SaveMgr.Ins.Save(); - Set_UI(); } else diff --git a/Assets/Scripts/Util/CardBase.cs b/Assets/Scripts/Util/CardBase.cs index 55a02a5..b29534d 100644 --- a/Assets/Scripts/Util/CardBase.cs +++ b/Assets/Scripts/Util/CardBase.cs @@ -2,7 +2,7 @@ using UnityEngine; public enum eUICardType { None, UI, NoTouch, } -public class CardBase : MonoBehaviour +public class CardBase : AddrHandleBase { public virtual void Set() { Set_Active(); } public virtual void Set(int _val) { Set_Active(); } diff --git a/Assets/nightward.txt b/Assets/nightward.txt new file mode 100644 index 0000000..ee434dd --- /dev/null +++ b/Assets/nightward.txt @@ -0,0 +1,11 @@ +Default : ⺻ ٹ (1 ijʹ ̰, 2 ijͺʹ ij ٹ ϰ + κ񿡼 "ij " ⺻ ̹ +Mission : ǹ 3ȸ ޼ ȹ / Ǵ +FullCollection : ٹ ȹ / Ǵ +Gacha : í 9 ߻ / Ǵ +Normal : ŷ Ǵ Ű ʽ ȹ + +ΰ ٹ ̹ ϴ. +1. ΰ ⺻ : Album ̺ e_CollectionMethod Default ̹ +2. ΰ ǹ : Album ̺ e_CollectionMethod Mission ̹ +3. ΰ ( ̹ ϰ ) : Album ̺ e_CollectionMethod FullCollection ̹ \ No newline at end of file diff --git a/Assets/nightward.txt.meta b/Assets/nightward.txt.meta new file mode 100644 index 0000000..f6ec77b --- /dev/null +++ b/Assets/nightward.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6186d96b8cf20474b85418c37574128c +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: