앨범 획득 조건 등
This commit is contained in:
parent
599f0bb725
commit
2b6589eaf9
|
|
@ -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<albumtabledata> Get_DataList() { return tableDatas; }
|
||||
public List<albumtabledata> Get_DataList(int girl) { return dic_datas[girl]; }
|
||||
public List<albumtabledata> 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a6d64bda2d998014688bb74631dc4fc7
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -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<string, AsyncOperationHandle> m_Handle = new Dictionary<string, AsyncOperationHandle>();
|
||||
|
||||
protected void Load_Obj<T>(string path, Action<AsyncOperationHandle<T>> loadfinish = null)
|
||||
{
|
||||
ReleaseHandle(path);
|
||||
|
||||
AddrResourceMgr.Ins.LoadObject<T>(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<Sprite>(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<Sprite>(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<Sprite>(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();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 특정 path의 핸들만 해제
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 293301756224388478096683be489194
|
||||
|
|
@ -33,23 +33,8 @@ public class SaveMgr : MonoBehaviourSingletonTemplate<SaveMgr>
|
|||
m_SaveData = CryptoUtil.Load<SaveData>("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<SaveMgr>
|
|||
|
||||
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<AlbumSaveData>());
|
||||
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<AlbumSaveData>());
|
||||
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<SaveMgr>
|
|||
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<int> openedIDs = new HashSet<int>();
|
||||
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<SaveMgr>
|
|||
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<int, List<AlbumSaveData>> dic_ablumopen = new Dictionary<int, List<AlbumSaveData>>();
|
||||
public Dictionary<int, List<AlbumSaveData>> dic_albumOpen = new Dictionary<int, List<AlbumSaveData>>();
|
||||
public List<ShopADSaveData> list_ShopLimit = new List<ShopADSaveData>();
|
||||
public List<ChatSaveData> list_ChatSaveData = new List<ChatSaveData>();
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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>(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<Sprite>(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());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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(); }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
Default : 기본 앨범 (1번 캐릭터는 열린 상태이고, 2번 캐릭터부터는 이전 캐릭터의 스페셜 앨범을 제외하고
|
||||
모두 열린 상태의 게임 로비에서 "캐릭터 열기" 를 할 때 기본 제공될 이미지
|
||||
Mission : 피버 3회 달성 시 획득 / 또는 설정 된 가격으로 즉시 개방 가능
|
||||
FullCollection : 스페셜을 제외한 모든 앨범 획득 시 개방 / 또는 설정 된 가격으로 즉시 개방 가능
|
||||
Gacha : 가챠 등급9 발생 시 개방 / 또는 설정 된 가격으로 즉시 개방 가능
|
||||
Normal : 구매로 열기 또는 럭키 보너스를 통해 획득 가능
|
||||
|
||||
인게임 앨범 이미지 컨셉은 다음과 같습니다.
|
||||
1. 인게임 기본 배경 : Album 테이블의 e_CollectionMethod가 Default 인 이미지
|
||||
2. 인게임 피버모드 배경 : Album 테이블의 e_CollectionMethod가 Mission 인 이미지
|
||||
3. 인게임 섹시 배경(시작할 때 섹시 이미지로 변경하고 진입한 경우) : Album 테이블의 e_CollectionMethod가 FullCollection 인 이미지
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6186d96b8cf20474b85418c37574128c
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue