상점 서버 데이터 등
This commit is contained in:
parent
cadf04fa02
commit
647ada8dc2
|
|
@ -89,5 +89,6 @@ messageinfo 엄청 느린 버그
|
|||
- 인앱 결제
|
||||
- 상품 ui 등...
|
||||
- 상점 서버 데이터
|
||||
|
||||
-- 초기화
|
||||
-- 총 구매 횟수, 이번 구매 횟수, 남은 광고 시간
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
|
@ -88,7 +88,7 @@ public partial class ServerData
|
|||
/// </summary>
|
||||
public Dictionary<string, List<ObscuredInt>> Gacha = new Dictionary<string, List<ObscuredInt>>();
|
||||
/// <summary>
|
||||
/// { 상품ID, 0 광고 쿨타임, 1 총 구매횟수, 2 일일 구매, 3 주간 구매, 4 월간 구매 }
|
||||
/// { 상품ID, 0 총 구매횟수, 1 이번 구매횟수, 2 광고 남은 시간 }
|
||||
/// </summary>
|
||||
public Dictionary<string, List<ObscuredInt>> Shop = new Dictionary<string, List<ObscuredInt>>();
|
||||
|
||||
|
|
@ -1244,6 +1244,145 @@ public partial class ServerData
|
|||
return false;
|
||||
}
|
||||
#endregion
|
||||
#region 상점
|
||||
// 0 총 구매횟수, 1 이번 구매횟수, 2 광고 남은 시간
|
||||
void Init_Shop()
|
||||
{
|
||||
var lst_day = table_shopitemlist.Ins.Get_DataList_Day();
|
||||
for (int i = 0; i < lst_day.Count; i++)
|
||||
{
|
||||
var key = Get_Key(lst_day[i].n_ShopItemID);
|
||||
if (Shop.ContainsKey(key))
|
||||
{
|
||||
Shop[key][1] = 0;
|
||||
Shop[key][1].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
void Init_ShopWeek()
|
||||
{
|
||||
var lst_week = table_shopitemlist.Ins.Get_DataList_Week();
|
||||
for (int i = 0; i < lst_week.Count; i++)
|
||||
{
|
||||
var key = Get_Key(lst_week[i].n_ShopItemID);
|
||||
if (Shop.ContainsKey(key))
|
||||
{
|
||||
Shop[key][1] = 0;
|
||||
Shop[key][1].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
void Init_ShopMonth()
|
||||
{
|
||||
var lst_month = table_shopitemlist.Ins.Get_DataList_Month();
|
||||
for (int i = 0; i < lst_month.Count; i++)
|
||||
{
|
||||
var key = Get_Key(lst_month[i].n_ShopItemID);
|
||||
if (Shop.ContainsKey(key))
|
||||
{
|
||||
Shop[key][1] = 0;
|
||||
Shop[key][1].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
public int Get_ShopBuyCount(int _id)
|
||||
{
|
||||
var key = Get_Key(_id);
|
||||
return Shop.ContainsKey(key) ? Shop[key][1] : 0;
|
||||
}
|
||||
public void Add_ShopBuyCount(int _id)
|
||||
{
|
||||
var key = Get_Key(_id);
|
||||
if (!Shop.ContainsKey(key)) Shop.Add(key, new List<ObscuredInt> { 0, 0, 0 });
|
||||
++Shop[key][0]; Shop[key][0].RandomizeCryptoKey();
|
||||
++Shop[key][1]; Shop[key][1].RandomizeCryptoKey();
|
||||
}
|
||||
|
||||
public bool CanShow_ShopAD(int _id)
|
||||
{
|
||||
var data = table_shop.Ins.Get_Data(_id);
|
||||
//if (data.PriceType == ePriceType.AD)
|
||||
//{
|
||||
// var shopdata = Shop[_id.ToString()];
|
||||
// return shopdata[2] < data.BuyLimit_Day && shopdata[0] <= 0;
|
||||
//}
|
||||
return false;
|
||||
}
|
||||
public bool CanShow_ShopAD(eShopTab _tab)
|
||||
{
|
||||
var lst = table_shop.Ins.Get_DataList(_tab);
|
||||
for (int i = 0; i < lst.Count; i++)
|
||||
{
|
||||
var canshow = CanShow_ShopAD(lst[i].ID);
|
||||
if (canshow) return canshow;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool CanShow_ShopAD()
|
||||
{
|
||||
var lst = table_shop.Ins.Get_AD_DataList();
|
||||
for (int i = 0; i < lst.Count; i++)
|
||||
{
|
||||
var canshow = CanShow_ShopAD(lst[i].ID);
|
||||
if (canshow) return canshow;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public int Get_ShopADTime(int _id) { return Shop[_id.ToString()][0]; }
|
||||
public void Add_ShopADTime(int _id, int _sec = 1)
|
||||
{
|
||||
var shopdata = Shop[_id.ToString()];
|
||||
shopdata[0] += _sec;
|
||||
shopdata[0].RandomizeCryptoKey();
|
||||
}
|
||||
public void Sub_ShopADTime(int _id, int _sec = 1)
|
||||
{
|
||||
int index = 0;
|
||||
if (_id == -1)
|
||||
{
|
||||
foreach (var item in Shop)
|
||||
{
|
||||
Shop[item.Key][index] -= _sec;
|
||||
if (Shop[item.Key][index] < 0) Shop[item.Key][index] = 0;
|
||||
Shop[item.Key][index].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var shopdata = Shop[_id.ToString()];
|
||||
shopdata[index] -= _sec;
|
||||
if (shopdata[index] < 0) shopdata[index] = 0;
|
||||
shopdata[index].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
|
||||
public string Can_BuyShopItem(ShopTableData _std)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_std.BuyCondition))
|
||||
{
|
||||
if (ServerInfo.Ins.m_SC_ServerStatus.ContentsLock == 1)
|
||||
{
|
||||
switch (_std.BuyCondition)
|
||||
{
|
||||
case "Chapter14Clear":
|
||||
//if (Get_Common(eCommon.MaxMapID) < 15)
|
||||
// return "14챕터 클리어\n필요";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (!ServerInfo.Ins.m_ServerData.Check_ItemAmount(_std.ObtainCheckItem, 1, _std.ObtainCheckItemID, false))
|
||||
//{
|
||||
// if (_std.BuyLimit > 0) return Get_ShopBuyCount(_std.ID, 1) < _std.BuyLimit ? "" : "구매 완료";
|
||||
// else if (_std.BuyLimit_Day > 0) return Get_ShopBuyCount(_std.ID, 2) < _std.BuyLimit_Day ? "" : "구매 완료";
|
||||
// else if (_std.BuyLimit_Week > 0) return Get_ShopBuyCount(_std.ID, 3) < _std.BuyLimit_Week ? "" : "구매 완료";
|
||||
// else if (_std.BuyLimit_Month > 0) return Get_ShopBuyCount(_std.ID, 4) < _std.BuyLimit_Month ? "" : "구매 완료";
|
||||
// return null;
|
||||
//}
|
||||
return "구매 완료";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Common
|
||||
public void Init_Daily()
|
||||
|
|
@ -1551,130 +1690,6 @@ public partial class ServerData
|
|||
data.ID.RandomizeCryptoKey();
|
||||
}
|
||||
#endregion
|
||||
#region 상점
|
||||
// 0 광고 쿨타임, 1 총 구매횟수, 2 일일 구매, 3 주간 구매, 4 월간 구매
|
||||
void Init_Shop()
|
||||
{
|
||||
foreach (var item in Shop)
|
||||
{
|
||||
Shop[item.Key][0] = Shop[item.Key][2] = 0;
|
||||
Shop[item.Key][0].RandomizeCryptoKey();
|
||||
Shop[item.Key][2].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
void Init_ShopWeek()
|
||||
{
|
||||
foreach (var item in Shop)
|
||||
{
|
||||
Shop[item.Key][3] = 0;
|
||||
Shop[item.Key][3].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
void Init_ShopMonth()
|
||||
{
|
||||
foreach (var item in Shop)
|
||||
{
|
||||
Shop[item.Key][4] = 0;
|
||||
Shop[item.Key][4].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
public bool CanShow_ShopAD(int _id)
|
||||
{
|
||||
var data = table_shop.Ins.Get_Data(_id);
|
||||
//if (data.PriceType == ePriceType.AD)
|
||||
//{
|
||||
// var shopdata = Shop[_id.ToString()];
|
||||
// return shopdata[2] < data.BuyLimit_Day && shopdata[0] <= 0;
|
||||
//}
|
||||
return false;
|
||||
}
|
||||
public bool CanShow_ShopAD(eShopTab _tab)
|
||||
{
|
||||
var lst = table_shop.Ins.Get_DataList(_tab);
|
||||
for (int i = 0; i < lst.Count; i++)
|
||||
{
|
||||
var canshow = CanShow_ShopAD(lst[i].ID);
|
||||
if (canshow) return canshow;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool CanShow_ShopAD()
|
||||
{
|
||||
var lst = table_shop.Ins.Get_AD_DataList();
|
||||
for (int i = 0; i < lst.Count; i++)
|
||||
{
|
||||
var canshow = CanShow_ShopAD(lst[i].ID);
|
||||
if (canshow) return canshow;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public int Get_ShopADTime(int _id) { return Shop[_id.ToString()][0]; }
|
||||
public void Add_ShopADTime(int _id, int _sec = 1)
|
||||
{
|
||||
var shopdata = Shop[_id.ToString()];
|
||||
shopdata[0] += _sec;
|
||||
shopdata[0].RandomizeCryptoKey();
|
||||
}
|
||||
public void Sub_ShopADTime(int _id, int _sec = 1)
|
||||
{
|
||||
int index = 0;
|
||||
if (_id == -1)
|
||||
{
|
||||
foreach (var item in Shop)
|
||||
{
|
||||
Shop[item.Key][index] -= _sec;
|
||||
if (Shop[item.Key][index] < 0) Shop[item.Key][index] = 0;
|
||||
Shop[item.Key][index].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var shopdata = Shop[_id.ToString()];
|
||||
shopdata[index] -= _sec;
|
||||
if (shopdata[index] < 0) shopdata[index] = 0;
|
||||
shopdata[index].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
public void Add_ShopBuyCount(int _id, params int[] index)
|
||||
{
|
||||
var shopdata = Shop[_id.ToString()];
|
||||
for (int i = 0; i < index.Length; i++)
|
||||
{
|
||||
++shopdata[index[i]];
|
||||
shopdata[index[i]].RandomizeCryptoKey();
|
||||
}
|
||||
}
|
||||
public int Get_ShopBuyCount(int _id, byte _limitType)
|
||||
{
|
||||
return Shop[_id.ToString()][_limitType];
|
||||
}
|
||||
public string Can_BuyShopItem(ShopTableData _std)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_std.BuyCondition))
|
||||
{
|
||||
if (ServerInfo.Ins.m_SC_ServerStatus.ContentsLock == 1)
|
||||
{
|
||||
switch (_std.BuyCondition)
|
||||
{
|
||||
case "Chapter14Clear":
|
||||
//if (Get_Common(eCommon.MaxMapID) < 15)
|
||||
// return "14챕터 클리어\n필요";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (!ServerInfo.Ins.m_ServerData.Check_ItemAmount(_std.ObtainCheckItem, 1, _std.ObtainCheckItemID, false))
|
||||
//{
|
||||
// if (_std.BuyLimit > 0) return Get_ShopBuyCount(_std.ID, 1) < _std.BuyLimit ? "" : "구매 완료";
|
||||
// else if (_std.BuyLimit_Day > 0) return Get_ShopBuyCount(_std.ID, 2) < _std.BuyLimit_Day ? "" : "구매 완료";
|
||||
// else if (_std.BuyLimit_Week > 0) return Get_ShopBuyCount(_std.ID, 3) < _std.BuyLimit_Week ? "" : "구매 완료";
|
||||
// else if (_std.BuyLimit_Month > 0) return Get_ShopBuyCount(_std.ID, 4) < _std.BuyLimit_Month ? "" : "구매 완료";
|
||||
// return null;
|
||||
//}
|
||||
return "구매 완료";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 마녀의 솥
|
||||
public int Get_PotionRemainTime(int _id) { return Potion[_id.ToString()][1]; }
|
||||
|
|
|
|||
|
|
@ -105,6 +105,10 @@ public class table_shopitemlist : table_missionbase
|
|||
public static table_shopitemlist Ins;
|
||||
List<ShopItemListTableData> tableDatas;
|
||||
Dictionary<(int, int), List<ShopItemListTableData>> dic_shop = new Dictionary<(int, int), List<ShopItemListTableData>>();
|
||||
List<ShopItemListTableData> list_ad = new List<ShopItemListTableData>();
|
||||
List<ShopItemListTableData> list_day = new List<ShopItemListTableData>();
|
||||
List<ShopItemListTableData> list_week = new List<ShopItemListTableData>();
|
||||
List<ShopItemListTableData> list_month = new List<ShopItemListTableData>();
|
||||
List<TabUIData> MainTabDatas = new List<TabUIData>();
|
||||
Dictionary<int, List<TabUIData>> SubTabDatas = new Dictionary<int, List<TabUIData>>();
|
||||
|
||||
|
|
@ -138,6 +142,11 @@ public class table_shopitemlist : table_missionbase
|
|||
subtab = temp.n_ShopSubTab;
|
||||
SubTabDatas[maintab].Add(new TabUIData { m_Index = subtab, n_btnName = temp.n_SubTabName });
|
||||
}
|
||||
|
||||
if (temp.n_PriceItemID == -1) list_ad.Add(temp); // 광고
|
||||
if (temp.BuyLimit_Day > 0) list_day.Add(temp); // 일일
|
||||
if (temp.BuyLimit_Week > 0) list_week.Add(temp); // 주간
|
||||
if (temp.BuyLimit_Month > 0) list_month.Add(temp); // 월간
|
||||
}
|
||||
|
||||
// 정렬
|
||||
|
|
@ -151,6 +160,10 @@ public class table_shopitemlist : table_missionbase
|
|||
public ShopItemListTableData Get_Data(int maintab, int subtab = 0) { return dic_shop[(maintab, subtab)][0]; }
|
||||
public List<ShopItemListTableData> Get_DataList() { return tableDatas; }
|
||||
public List<ShopItemListTableData> Get_DataList(int maintab, int subtab) { return dic_shop[(maintab, subtab)]; }
|
||||
public List<ShopItemListTableData> Get_DataList_AD() { return list_ad; }
|
||||
public List<ShopItemListTableData> Get_DataList_Day() { return list_day; }
|
||||
public List<ShopItemListTableData> Get_DataList_Week() { return list_week; }
|
||||
public List<ShopItemListTableData> Get_DataList_Month() { return list_month; }
|
||||
|
||||
public List<TabUIData> Get_MainTabDatas() { return MainTabDatas; }
|
||||
public List<TabUIData> Get_SubTabDatas(int index) { return SubTabDatas[index]; }
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@ public class table_shop : MonoBehaviour
|
|||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
var data = Get_Data(_inappid);
|
||||
sdata.Add_ShopBuyCount(data.ID, 1, 2, 3, 4); // 현금 결제 후 구매 횟수 추가 (총, 일간, 주간, 월간 모두 올려도 상관없음)
|
||||
sdata.Add_Common(eCommon.InAppBuyCount);
|
||||
switch (data.Item)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,34 +17,58 @@ public class ShopCard : CardBase
|
|||
|
||||
texts[0].text = m_Data.Get_Name();
|
||||
texts[1].text = Get_LimitText();
|
||||
texts[2].text = m_Data.n_PriceItemID == -1 ? $"₩{m_Data.n_Price:N0}" : m_Data.n_Price.ToString();
|
||||
texts[2].text = Get_PriceText();
|
||||
|
||||
texts[3].text = DSUtil.Format(390, m_Data.n_FirstBonus);
|
||||
|
||||
images[0].sprite = m_Data.Get_Icon();
|
||||
images[1].enabled = m_Data.n_PriceItemID != -1;
|
||||
images[1].enabled = m_Data.n_PriceItemID > 0;
|
||||
if (images[1].enabled) images[1].sprite = UIAtlasMgr.Ins.Get_Sprite(m_Data.n_PriceItemID);
|
||||
|
||||
gos[0].SetActive(m_Data.n_FirstBonus > 0);
|
||||
gos[1].SetActive(isSoldOut()); // 품절 여부
|
||||
}
|
||||
|
||||
string Get_PriceText()
|
||||
{
|
||||
switch (m_Data.n_PriceItemID)
|
||||
{
|
||||
case -2: // 현금
|
||||
return $"₩{m_Data.n_Price:N0}";
|
||||
case -1: // 광고
|
||||
return table_localtext.Ins.Get_Text(395);
|
||||
default:
|
||||
return m_Data.n_Price.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
string Get_LimitText()
|
||||
{ // TODO 정인호 : 현재 구매 횟수 필요
|
||||
if (m_Data.BuyLimit > 0) return DSUtil.Format(391, 0, m_Data.BuyLimit);
|
||||
if (m_Data.BuyLimit_Day > 0) return DSUtil.Format(392, 0, m_Data.BuyLimit_Day);
|
||||
if (m_Data.BuyLimit_Week > 0) return DSUtil.Format(393, 0, m_Data.BuyLimit_Week);
|
||||
if (m_Data.BuyLimit_Month > 0) return DSUtil.Format(394, 0, m_Data.BuyLimit_Month);
|
||||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
var buycount = sdata.Get_ShopBuyCount(m_Data.n_ShopItemID);
|
||||
if (m_Data.BuyLimit > 0) return DSUtil.Format(391, buycount, m_Data.BuyLimit);
|
||||
if (m_Data.BuyLimit_Day > 0) return DSUtil.Format(392, buycount, m_Data.BuyLimit_Day);
|
||||
if (m_Data.BuyLimit_Week > 0) return DSUtil.Format(393, buycount, m_Data.BuyLimit_Week);
|
||||
if (m_Data.BuyLimit_Month > 0) return DSUtil.Format(394, buycount, m_Data.BuyLimit_Month);
|
||||
return "";
|
||||
}
|
||||
|
||||
bool isSoldOut()
|
||||
{ // TODO 정인호 : 상품 품절 여부
|
||||
{
|
||||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
var buycount = sdata.Get_ShopBuyCount(m_Data.n_ShopItemID);
|
||||
if (m_Data.BuyLimit > 0) return buycount >= m_Data.BuyLimit;
|
||||
if (m_Data.BuyLimit_Day > 0) return buycount >= m_Data.BuyLimit_Day;
|
||||
if (m_Data.BuyLimit_Week > 0) return buycount >= m_Data.BuyLimit_Week;
|
||||
if (m_Data.BuyLimit_Month > 0) return buycount >= m_Data.BuyLimit_Month;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnClick_Buy()
|
||||
{
|
||||
if (!isSoldOut())
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -77,23 +77,15 @@ public class ShopCardBase : CardBase
|
|||
var sdata = ServerInfo.Ins.m_ServerData;
|
||||
if (m_ShopTableData.BuyLimit > 0)
|
||||
{
|
||||
labels[3].text = DSUtil.Format("[687c94]구매 제한[-]\n({0}/{1})", sdata.Get_ShopBuyCount(m_ShopTableData.ID, 1), m_ShopTableData.BuyLimit);
|
||||
gos[3].SetActive(sdata.Get_ShopBuyCount(m_ShopTableData.ID, 1) >= m_ShopTableData.BuyLimit);
|
||||
}
|
||||
else if (m_ShopTableData.BuyLimit_Day > 0)
|
||||
{
|
||||
labels[3].text = DSUtil.Format("[687c94]일일 구매[-]\n({0}/{1})", sdata.Get_ShopBuyCount(m_ShopTableData.ID, 2), m_ShopTableData.BuyLimit_Day);
|
||||
gos[3].SetActive(sdata.Get_ShopBuyCount(m_ShopTableData.ID, 2) >= m_ShopTableData.BuyLimit_Day);
|
||||
}
|
||||
else if (m_ShopTableData.BuyLimit_Week > 0)
|
||||
{
|
||||
labels[3].text = DSUtil.Format("[687c94]주간 구매[-]\n({0}/{1})", sdata.Get_ShopBuyCount(m_ShopTableData.ID, 3), m_ShopTableData.BuyLimit_Week);
|
||||
gos[3].SetActive(sdata.Get_ShopBuyCount(m_ShopTableData.ID, 3) >= m_ShopTableData.BuyLimit_Week);
|
||||
}
|
||||
else if (m_ShopTableData.BuyLimit_Month > 0)
|
||||
{
|
||||
labels[3].text = DSUtil.Format("[687c94]월간 구매[-]\n({0}/{1})", sdata.Get_ShopBuyCount(m_ShopTableData.ID, 4), m_ShopTableData.BuyLimit_Month);
|
||||
gos[3].SetActive(sdata.Get_ShopBuyCount(m_ShopTableData.ID, 4) >= m_ShopTableData.BuyLimit_Month);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -236,10 +228,6 @@ public class ShopCardBase : CardBase
|
|||
|
||||
void Add_BuyCount()
|
||||
{
|
||||
if (m_ShopTableData.BuyLimit_Day > 0) ServerInfo.Ins.m_ServerData.Add_ShopBuyCount(m_ShopTableData.ID, 1, 2);
|
||||
else if (m_ShopTableData.BuyLimit_Week > 0) ServerInfo.Ins.m_ServerData.Add_ShopBuyCount(m_ShopTableData.ID, 1, 3);
|
||||
else if (m_ShopTableData.BuyLimit_Month > 0) ServerInfo.Ins.m_ServerData.Add_ShopBuyCount(m_ShopTableData.ID, 1, 4);
|
||||
else ServerInfo.Ins.m_ServerData.Add_ShopBuyCount(m_ShopTableData.ID, 1);
|
||||
}
|
||||
|
||||
eItem Get_PriceItem()
|
||||
|
|
|
|||
Loading…
Reference in New Issue