상점 작업 중...

This commit is contained in:
Ino 2025-08-31 16:14:15 +09:00
parent a65416f8ca
commit a5779d6fea
6 changed files with 112 additions and 19 deletions

View File

@ -26,6 +26,7 @@ namespace ES3Types
writer.WriteProperty("GameSpeed", instance.GameSpeed, ES3Type_float.Instance);
writer.WriteProperty("ProductAdWatchedNumber", instance.ProductAdWatchedNumber, ES3Type_int.Instance);
writer.WriteProperty("FreeHeartCount", instance.FreeHeartCount, ES3Type_int.Instance);
writer.WriteProperty("FreeKeyCount", instance.FreeKeyCount, ES3Type_int.Instance);
writer.WriteProperty("InterstitialADCount", instance.InterstitialADCount, ES3Type_int.Instance);
writer.WriteProperty("ImageOpenStates_Left", instance.ImageOpenStates_Left, ES3Type_boolArray.Instance);
writer.WriteProperty("ImageOpenStates_Right", instance.ImageOpenStates_Right, ES3Type_boolArray.Instance);
@ -73,6 +74,9 @@ namespace ES3Types
case "FreeHeartCount":
instance.FreeHeartCount = reader.Read<System.Int32>(ES3Type_int.Instance);
break;
case "FreeKeyCount":
instance.FreeKeyCount = reader.Read<System.Int32>(ES3Type_int.Instance);
break;
case "InterstitialADCount":
instance.InterstitialADCount = reader.Read<System.Int32>(ES3Type_int.Instance);
break;

View File

@ -57650,6 +57650,14 @@ MonoBehaviour:
- {fileID: 21300000, guid: 5943d49aa8260fd42a04c79f281dc835, type: 3}
- {fileID: 21300000, guid: bc2c17814857bcc4a82dfc5e8fa0f68a, type: 3}
- {fileID: 21300000, guid: ba7c63d392b1fa6449ea4e65bf25bcab, type: 3}
- {fileID: 21300000, guid: 3b1d08b7f515e5d46a05a7ff32ed1295, type: 3}
- {fileID: 21300000, guid: 0fc3518d5197ef14690a45dffc304c89, type: 3}
- {fileID: 21300000, guid: d3f914466e69bed47a1a54ce86a59b37, type: 3}
- {fileID: 21300000, guid: 7e24360e4a2cee240a33e711b9340c73, type: 3}
- {fileID: 21300000, guid: 749965a82d7a8cf468f77c2e31d94551, type: 3}
- {fileID: 21300000, guid: f36045787352db44494d1b5e4362f551, type: 3}
- {fileID: 21300000, guid: 0ec030ab67537f549941e69c78e57ea0, type: 3}
- {fileID: 21300000, guid: e857d8fc6d6313141973d87d1b17fd7d, type: 3}
--- !u!114 &833499343
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -26,7 +26,7 @@ public class AccountManager : MonoBehaviour
public long Key;
public long BuyKeyCount;
public bool IsRemoveADS;
public int FreeHeartCount;
public int FreeHeartCount, FreeKeyCount;
public long BuyShopAccumulatedMoney;
}
@ -575,6 +575,7 @@ public class AccountManager : MonoBehaviour
uploadData.BuyKeyCount = GameManager.DB.BuyKeyCount;
uploadData.Level = GameManager.DB.NormalGameLevel;
uploadData.FreeHeartCount = GameManager.DB.FreeHeartCount;
uploadData.FreeKeyCount = GameManager.DB.FreeKeyCount;
uploadData.IsRemoveADS = GameManager.DB.IsRemoveADS;
uploadData.BuyShopAccumulatedMoney = GameManager.DB.BuyShopAccumulatedMoney;

View File

@ -31,7 +31,7 @@ namespace CodeJay
/// <summary>Number of Watched Ad In Store(Ad Heart Product).</summary>
public int ProductAdWatchedNumber;
public int FreeHeartCount;
public int FreeHeartCount, FreeKeyCount;
public int InterstitialADCount;
public bool[] ImageOpenStates_Left, ImageOpenStates_Right;
@ -55,6 +55,7 @@ namespace CodeJay
this.GameSpeed = 0.5f;
this.ProductAdWatchedNumber = Constants.ADS_REWARD_COUNT;
this.FreeHeartCount = Constants.FREE_HEART_DAY;
FreeKeyCount = Constants.FREE_HEART_DAY;
this.InterstitialADCount = Constants.INTERSTITIAL_AD_CYCLE;
this.NormalGameLevel = 1;
this.NormalGame_GetGold = 0;
@ -89,6 +90,7 @@ namespace CodeJay
this.GameSpeed = data.GameSpeed;
this.ProductAdWatchedNumber = data.ProductAdWatchedNumber;
this.FreeHeartCount = data.FreeHeartCount;
FreeKeyCount = data.FreeKeyCount;
this.InterstitialADCount = data.InterstitialADCount;
this.NormalGameLevel = data.NormalGameLevel;
this.NormalGame_GetGold = data.NormalGame_GetGold;
@ -227,12 +229,13 @@ public partial class DBManager : MonoBehaviour
public float GameSpeed { get => saveData.GameSpeed; set => saveData.GameSpeed = value; }
public int ProductAdWatchedNumber { get => saveData.ProductAdWatchedNumber; }
public int FreeHeartCount { get => saveData.FreeHeartCount; }
public int FreeKeyCount { get => saveData.FreeKeyCount; }
public int NormalGameLevel { get => saveData.NormalGameLevel; }
public int InterstitialADCount { get => saveData.InterstitialADCount; }
public bool IsRemoveADS { get => saveData.IsRemoveADS; }
public long BuyShopAccumulatedMoney { get => saveData.BuyShopAccumulatedMoney; }
public UnityAction OnResetFreeHeartCountEvent;
public UnityAction OnResetFreeHeartCountEvent, OnResetFreeKeyCountEvent;
public UnityAction OnResetADSRewardActionCountEvent;
#endregion
@ -244,7 +247,7 @@ public partial class DBManager : MonoBehaviour
this.LoadDatas();
}
#if UNITY_EDITOR
private void Update()
{
if (Input.GetKeyDown(KeyCode.U))
@ -279,7 +282,12 @@ public partial class DBManager : MonoBehaviour
str += "\n<><6E><EFBFBD> : " + saveData.Gold.ToString();
Debug.Log(str);
}
else if (Input.GetKeyDown(KeyCode.T))
{
saveData.FreeKeyCount = 1;
}
}
#endif
private void OnDestroy()
{
@ -779,6 +787,28 @@ public partial class DBManager : MonoBehaviour
return 0;
}
public void ResetFreeKeyCount()
{
if (saveData != null)
{
saveData.FreeKeyCount = Constants.FREE_HEART_DAY;
OnResetFreeKeyCountEvent?.Invoke();
}
}
public int MinFreeKeyCount(int min)
{
if (saveData != null)
{
saveData.FreeKeyCount -= min;
SaveDatas();
return saveData.FreeKeyCount;
}
return 0;
}
public int MinInterstitialADCount(int min)
{
if (saveData != null)

View File

@ -164,6 +164,35 @@ public class ProductSlot : CardBase
PurchaseButton.GetComponent<Image>().color = c;
}
}
else if (data.productID == "key_free")
{
GameManager.DB.OnResetFreeKeyCountEvent += OnResetFreeHeartCountEvent;
SaleGO.SetActive(false);
AdButton.SetActive(false);
PriceTMP.transform.parent.gameObject.SetActive(true);
PriceTMP.text = "무료";
if (GameManager.DB.FreeKeyCount <= 0)
{
if (PurchaseButton != null)
{
Color c = PurchaseButton.GetComponent<Image>().color;
c.a = 0.5f;
PurchaseButton.GetComponent<Image>().color = c;
}
}
else
{
if (PurchaseButton != null)
{
Color c = PurchaseButton.GetComponent<Image>().color;
c.a = 1.0f;
PurchaseButton.GetComponent<Image>().color = c;
}
}
}
else if (data.productID == "heart_60")
{
SaleGO.SetActive(true);
@ -260,6 +289,26 @@ public class ProductSlot : CardBase
GameManager.UI.ShowNStackPopup(EPopupType.NotVaildFreeHeartPopup);
}
}
else if (_data.productID == "key_free")
{
if (GameManager.DB.FreeKeyCount > 0)
{
GameManager.DB.AddKey(1, this.name);
GameManager.DB.MinFreeKeyCount(1);
if (GameManager.DB.FreeKeyCount <= 0 && PurchaseButton != null)
{
Color c = PurchaseButton.GetComponent<Image>().color;
c.a = 0.5f;
PurchaseButton.GetComponent<Image>().color = c;
}
}
else
{
// 무료 하트 횟수가 없다는 팝업 or 가만히 두기
//GameManager.UI.ShowNStackPopup(EPopupType.NotVaildFreeHeartPopup);
}
}
else if (_data.productID == "heart_ads")
{
// 광고 출력

View File

@ -27,7 +27,7 @@ public class StorePanel : MonoBehaviour
[SerializeField] private RectTransform content;
[SerializeField] private List<ProductSlot> _lstSlots;
/// <summary>
/// 0 하트, 1 키, 2 냥, 3 광고 제거
/// 0 하트, 1 키, 2 냥, 3 광고 제거, 4 무료 캐시, 5 캐시200, 6 캐시1500, 7 캐시3000, 8 무료 하트, 9 하트20, 10 하트45, 11 하트75
/// </summary>
[SerializeField] private List<Sprite> sprites;
private int BuyOneKey = 6;
@ -48,17 +48,17 @@ public class StorePanel : MonoBehaviour
if (list_item.Count == 0)
{
list_item.Add(new ProductData("ads_remove", EProductType.IAP, "강제 광고 제거", "강제 노출 광고 제거", 5500, sprites[3], EProductReward.Delete_Ad, 1));
list_item.Add(new ProductData("heart_free", EProductType.Gold, "일일 하트 I", "무료 하트", 0, sprites[0], EProductReward.Heart, 1));
list_item.Add(new ProductData("heart_ads", EProductType.ADS, "일일 하트 II", "광고 후 무료 하트", 0, sprites[0], EProductReward.Heart, 1));
list_item.Add(new ProductData("key_free", EProductType.Gold, "일일 캐시 I", "무료 캐시", 0, sprites[1], EProductReward.Key, 1));
list_item.Add(new ProductData("heart_free", EProductType.Gold, "일일 하트 I", "무료 하트", 0, sprites[8], EProductReward.Heart, 1));
list_item.Add(new ProductData("heart_ads", EProductType.ADS, "일일 하트 II", "광고 후 무료 하트", 0, sprites[8], EProductReward.Heart, 1));
list_item.Add(new ProductData("key_free", EProductType.Gold, "일일 캐시 I", "무료 캐시", 0, sprites[4], EProductReward.Key, 1));
list_item.Add(new ProductData("key_cash", EProductType.Gold, "하트 1개", "보석으로 하트 획득", 200, sprites[0], EProductReward.Key, 1));
list_item.Add(new ProductData("heart_free", EProductType.Gold, "일일 하트 I", "무료 하트", 0, sprites[0], EProductReward.Heart, 1));
list_item.Add(new ProductData("heart_ads", EProductType.ADS, "일일 하트 II", "광고 후 무료 하트", 0, sprites[0], EProductReward.Heart, 1));
list_item.Add(new ProductData("key_free", EProductType.Gold, "일일 캐시 I", "무료 캐시", 0, sprites[1], EProductReward.Key, 1));
list_item.Add(new ProductData("key_cash", EProductType.Gold, "하트 1개", "보석으로 하트 획득", 200, sprites[0], EProductReward.Key, 1));
list_item.Add(new ProductData("key_free", EProductType.Gold, "일일 캐시 I", "무료 캐시", 0, sprites[1], EProductReward.Key, 1));
list_item.Add(new ProductData("key_cash", EProductType.Gold, "하트 1개", "보석으로 하트 획득", 200, sprites[0], EProductReward.Key, 1));
list_item.Add(new ProductData("cash_200", EProductType.IAP, "캐시 200", "", 1000, sprites[5], EProductReward.Key, 200));
list_item.Add(new ProductData("cash_1500", EProductType.IAP, "캐시 1500", "", 6450, sprites[6], EProductReward.Key, 1500));
list_item.Add(new ProductData("cash_3300", EProductType.IAP, "캐시 3300", "", 11000, sprites[7], EProductReward.Key, 3300));
list_item.Add(new ProductData("heart_20", EProductType.IAP, "하트 20개", "", 11000, sprites[9], EProductReward.Heart, 20));
list_item.Add(new ProductData("heart_45", EProductType.IAP, "하트 45개", "", 22000, sprites[10], EProductReward.Heart, 45));
list_item.Add(new ProductData("heart_75", EProductType.IAP, "하트 75개", "", 33000, sprites[11], EProductReward.Heart, 75));
}
return;
@ -120,17 +120,18 @@ public class StorePanel : MonoBehaviour
{
if (this.gameObject.activeInHierarchy == false)
this.gameObject.SetActive(true);
content.anchoredPosition = Vector2.zero;
content.anchoredPosition = new Vector2(content.anchoredPosition.x, 944f);
}
private void MoveToStore_Key()
{
// Height * 6, Spacing * 5
content.anchoredPosition = Vector2.up * ((300 * 6) + (20 * 5));
//content.anchoredPosition = Vector2.up * ((300 * 6) + (20 * 5));
content.anchoredPosition = new Vector2(content.anchoredPosition.x, 944f);
}
private void OnSynchronizeKey()
{
_lstSlots[BuyOneKey].SetData(new CodeJay.Classes.ProductData("10", EProductType.Gold, "열쇠 1 개", "", 100000 + (250000 * (int)GameManager.DB.BuyKeyCount), sprites[1], EProductReward.Key, 1));
//_lstSlots[BuyOneKey].SetData(new CodeJay.Classes.ProductData("10", EProductType.Gold, "열쇠 1 개", "", 100000 + (250000 * (int)GameManager.DB.BuyKeyCount), sprites[1], EProductReward.Key, 1));
}
}