fix: 상점에서 포션을 구매했지만 데이터가 갱신되지 않는 오류 수정
This commit is contained in:
		@@ -88,6 +88,21 @@ namespace TON
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void AddPotion(string type, int amount)
 | 
			
		||||
        {
 | 
			
		||||
            switch (type)
 | 
			
		||||
            {
 | 
			
		||||
                case "HP":
 | 
			
		||||
                    userItem.hpPotion += amount;
 | 
			
		||||
                    itemDataManager.UpdateHpData(userItem.hpPotion);
 | 
			
		||||
                    break;
 | 
			
		||||
                case "MP":
 | 
			
		||||
                    userItem.mpPotion += amount;
 | 
			
		||||
                    itemDataManager.UpdateMpData(userItem.mpPotion);
 | 
			
		||||
                    break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void AddGold(int amount)
 | 
			
		||||
        {
 | 
			
		||||
            goldAmount += amount;
 | 
			
		||||
 
 | 
			
		||||
@@ -6,16 +6,16 @@ namespace TON
 | 
			
		||||
    {
 | 
			
		||||
        [SerializeField] private GameObject HeartPopUp;
 | 
			
		||||
        [SerializeField] private GameObject PositionPopUp;
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        [SerializeField] private int hpPotionPrice1 = 200; // HP 포션 가격
 | 
			
		||||
        [SerializeField] private int hpPotionPrice5 = 1000; // HP 포션 가격
 | 
			
		||||
        [SerializeField] private int hpPotionPrice20 = 3600; // HP 포션 가격
 | 
			
		||||
        [SerializeField] private int mpPotionPrice1 = 400; // MP 포션 가격
 | 
			
		||||
        [SerializeField] private int mpPotionPrice5 = 2000; // MP 포션 가격
 | 
			
		||||
        [SerializeField] private int mpPotionPrice20 = 7600; // MP 포션 가격
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        private PlayerDataManager playerDataManager;
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        void Start()
 | 
			
		||||
        {
 | 
			
		||||
            // 싱글톤으로 PlayerDataManager 접근
 | 
			
		||||
@@ -26,12 +26,12 @@ namespace TON
 | 
			
		||||
                Debug.LogError("PlayerDataManager가 초기화되지 않았습니다.");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        public void OnClickLobbyButton()
 | 
			
		||||
        {
 | 
			
		||||
            Main.Singleton.ChangeScene(SceneType.Lobby);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        // 포션 구매 메서드
 | 
			
		||||
        private void BuyPotion(int price, string potionType, int quantity)
 | 
			
		||||
        {
 | 
			
		||||
@@ -43,19 +43,19 @@ namespace TON
 | 
			
		||||
                    {
 | 
			
		||||
                        if (potionType == "hp")
 | 
			
		||||
                        {
 | 
			
		||||
                            playerDataManager.userItem.hpPotion += quantity;
 | 
			
		||||
                            playerDataManager.AddPotion("HP", quantity);
 | 
			
		||||
                        }
 | 
			
		||||
                        else if (potionType == "mp")
 | 
			
		||||
                        {
 | 
			
		||||
                            playerDataManager.userItem.mpPotion += quantity;
 | 
			
		||||
                            playerDataManager.AddPotion("MP", quantity);
 | 
			
		||||
                        }
 | 
			
		||||
                        
 | 
			
		||||
 | 
			
		||||
                        UIManager.Singleton.UpdateCashData();
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        // HP 포션 구매 버튼 클릭 시 호출
 | 
			
		||||
        public void OnClickBuyHpPotion1Button()
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user