diff --git a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.ShopUI.prefab b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.ShopUI.prefab index 64d4d2f9..94df9a63 100644 --- a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.ShopUI.prefab +++ b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.ShopUI.prefab @@ -1161,7 +1161,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 697, y: 348.55} + m_AnchoredPosition: {x: 701, y: 300.13} m_SizeDelta: {x: 82.9076, y: 82.9076} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &2295341844210809407 @@ -1562,7 +1562,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 700, y: 351.26} + m_AnchoredPosition: {x: 705, y: 302.84} m_SizeDelta: {x: 83.4802, y: 83.4802} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7540376593940388836 @@ -1770,7 +1770,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 700, y: 351.26} + m_AnchoredPosition: {x: 702, y: 302.84} m_SizeDelta: {x: 83.4802, y: 83.4802} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &8058790877832022744 @@ -14445,7 +14445,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 700, y: 351.26} + m_AnchoredPosition: {x: 702, y: 302.84} m_SizeDelta: {x: 83.4802, y: 83.4802} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &2053842356100037995 @@ -15707,7 +15707,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 700, y: 351.26} + m_AnchoredPosition: {x: 702, y: 302.84} m_SizeDelta: {x: 83.4802, y: 83.4802} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1593487139608649043 @@ -16271,7 +16271,7 @@ GameObject: - component: {fileID: 2951673025772393905} - component: {fileID: 3705323438841518151} m_Layer: 5 - m_Name: BackButton (1) + m_Name: RouleetteButton m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -16293,7 +16293,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0.5} m_AnchorMax: {x: 0, y: 0.5} - m_AnchoredPosition: {x: 1835, y: 0} + m_AnchoredPosition: {x: 2000, y: 0} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7576472329908582260 @@ -17541,7 +17541,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 697, y: 348.55} + m_AnchoredPosition: {x: 701, y: 300.13} m_SizeDelta: {x: 82.9076, y: 82.9076} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &236073453869866574 @@ -27335,7 +27335,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 848, y: 390} + m_AnchoredPosition: {x: 853, y: 302.84} m_SizeDelta: {x: 83.4802, y: 83.4802} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &520302995855237017 diff --git a/Gameton-06/Assets/Gameton/Scripts/UI/ShopUI.cs b/Gameton-06/Assets/Gameton/Scripts/UI/ShopUI.cs index e5c0b7c8..04a6c2a6 100644 --- a/Gameton-06/Assets/Gameton/Scripts/UI/ShopUI.cs +++ b/Gameton-06/Assets/Gameton/Scripts/UI/ShopUI.cs @@ -72,38 +72,75 @@ namespace TON PositionPopUp.SetActive(false); } - // HP 포션 구매 버튼 클릭 시 호출 public void OnClickBuyHpPotion1Button() { - if ((playerDataManager.goldAmount) >= hpPotionPrice1) + if (playerDataManager.goldAmount >= hpPotionPrice1) { - // 골드 차감 및 HP 포션 증가 - playerDataManager.UseGold(hpPotionPrice1); - playerDataManager.userItem.hpPotion += 1; - - // Debug.Log($"HP 포션 구매 성공! 남은 골드: {playerDataManager.goldAmount}, HP 포션 수량: {playerDataManager.userItem.hpPotion}"); + playerDataManager.UseGold(hpPotionPrice1, (isSuccess) => + { + if (isSuccess) + { + playerDataManager.userItem.hpPotion += 1; + Debug.Log($"HP 포션 구매 성공! 남은 골드: {playerDataManager.goldAmount}, HP 포션 수량: {playerDataManager.userItem.hpPotion}"); + UIManager.Singleton.UpdateCashData(); + } + else + { + Debug.Log("골드가 부족하여 HP 포션 구매 실패!"); + } + }); } - } // HP 포션 구매 버튼 클릭 시 호출 + else + { + Debug.Log("골드가 부족합니다!"); + } + } + public void OnClickBuyHpPotion5Button() { - if ((playerDataManager.goldAmount) >= hpPotionPrice5) + if (playerDataManager.goldAmount >= hpPotionPrice5) { - // 골드 차감 및 HP 포션 증가 - playerDataManager.UseGold(hpPotionPrice5); - playerDataManager.userItem.hpPotion += 5; - - // Debug.Log($"HP 포션 구매 성공! 남은 골드: {playerDataManager.goldAmount}, HP 포션 수량: {playerDataManager.userItem.hpPotion}"); + playerDataManager.UseGold(hpPotionPrice5, (isSuccess) => + { + if (isSuccess) + { + playerDataManager.userItem.hpPotion += 5; + Debug.Log($"HP 포션 구매 성공! 남은 골드: {playerDataManager.goldAmount}, HP 포션 수량: {playerDataManager.userItem.hpPotion}"); + UIManager.Singleton.UpdateCashData(); + } + else + { + Debug.Log("골드가 부족하여 HP 포션 구매 실패!"); + } + }); } - } // HP 포션 구매 버튼 클릭 시 호출 + else + { + Debug.Log("골드가 부족합니다!"); + } + } + public void OnClickBuyHpPotion20Button() { - if ((playerDataManager.goldAmount) >= hpPotionPrice20) + if (playerDataManager.goldAmount >= hpPotionPrice20) { - // 골드 차감 및 HP 포션 증가 - playerDataManager.UseGold(hpPotionPrice20); - playerDataManager.userItem.hpPotion += 20; - - // Debug.Log($"HP 포션 구매 성공! 남은 골드: {playerDataManager.goldAmount}, HP 포션 수량: {playerDataManager.userItem.hpPotion}"); + playerDataManager.UseGold(hpPotionPrice20, (isSuccess) => + { + if (isSuccess) + { + playerDataManager.userItem.hpPotion += 20; + Debug.Log($"HP 포션 구매 성공! 남은 골드: {playerDataManager.goldAmount}, HP 포션 수량: {playerDataManager.userItem.hpPotion}"); + UIManager.Singleton.UpdateCashData(); + } + else + { + Debug.Log("골드가 부족하여 HP 포션 구매 실패!"); + } + }); + } + else + { + Debug.Log("골드가 부족합니다!"); } } @@ -112,33 +149,73 @@ namespace TON { if (playerDataManager.goldAmount >= mpPotionPrice1) { - // 골드 차감 및 MP 포션 증가 - playerDataManager.UseGold(mpPotionPrice1); - playerDataManager.userItem.mpPotion += 1; - - // Debug.Log($"MP 포션 구매 성공! 남은 골드: {playerDataManager.goldAmount}, MP 포션 수량: {playerDataManager.userItem.mpPotion}"); + playerDataManager.UseGold(mpPotionPrice1, (isSuccess) => + { + if (isSuccess) + { + playerDataManager.userItem.mpPotion += 1; + Debug.Log($"MP 포션 구매 성공! 남은 골드: {playerDataManager.goldAmount}, MP 포션 수량: {playerDataManager.userItem.mpPotion}"); + UIManager.Singleton.UpdateCashData(); + } + else + { + Debug.Log("골드가 부족하여 MP 포션 구매 실패!"); + } + }); } - } // MP 포션 구매 버튼 클릭 시 호출 + else + { + Debug.Log("골드가 부족합니다!"); + } + } + + // MP 포션 구매 버튼 클릭 시 호출 public void OnClickBuyMpPotion5Button() { if (playerDataManager.goldAmount >= mpPotionPrice5) { - // 골드 차감 및 MP 포션 증가 - playerDataManager.UseGold(mpPotionPrice5); - playerDataManager.userItem.mpPotion += 1; - - // Debug.Log($"MP 포션 구매 성공! 남은 골드: {playerDataManager.goldAmount}, MP 포션 수량: {playerDataManager.userItem.mpPotion}"); + playerDataManager.UseGold(mpPotionPrice5, (isSuccess) => + { + if (isSuccess) + { + playerDataManager.userItem.mpPotion += 5; + Debug.Log($"MP 포션 구매 성공! 남은 골드: {playerDataManager.goldAmount}, MP 포션 수량: {playerDataManager.userItem.mpPotion}"); + UIManager.Singleton.UpdateCashData(); + } + else + { + Debug.Log("골드가 부족하여 MP 포션 구매 실패!"); + } + }); } - } // MP 포션 구매 버튼 클릭 시 호출 + else + { + Debug.Log("골드가 부족합니다!"); + } + } + + // MP 포션 구매 버튼 클릭 시 호출 public void OnClickBuyMpPotion20Button() { if (playerDataManager.goldAmount >= mpPotionPrice20) { - // 골드 차감 및 MP 포션 증가 - playerDataManager.UseGold(mpPotionPrice20); - playerDataManager.userItem.mpPotion += 1; - - // Debug.Log($"MP 포션 구매 성공! 남은 골드: {playerDataManager.goldAmount}, MP 포션 수량: {playerDataManager.userItem.mpPotion}"); + playerDataManager.UseGold(mpPotionPrice20, (isSuccess) => + { + if (isSuccess) + { + playerDataManager.userItem.mpPotion += 20; + Debug.Log($"MP 포션 구매 성공! 남은 골드: {playerDataManager.goldAmount}, MP 포션 수량: {playerDataManager.userItem.mpPotion}"); + UIManager.Singleton.UpdateCashData(); + } + else + { + Debug.Log("골드가 부족하여 MP 포션 구매 실패!"); + } + }); + } + else + { + Debug.Log("골드가 부족합니다!"); } } }