예제 #1
0
    public void AcceptPurchase()
    {
        if (purchaseNum <= 0)
        {
            AlertPopup.RefreshToAlert("구매할 개수 가 유효하지 않습니다.");
            AlertPopup.OpenPopup(1.0f);
            return;
        }
        int finalPrice = shopItemInfo.Price * purchaseNum;

        if (finalPrice > PlayerStat.Instance.GetStat("Gold"))
        {
            AlertPopup.RefreshToAlert("소지금이 부족합니다!");
            AlertPopup.OpenPopup(1.0f);
            return;
        }
        InteractPanel.BuyCurrentItem(purchaseNum);
        gameObject.SetActive(false);
    }
    public void CompleteQuest()
    {
        PlayerQuest.Instance.CompleteQuest(npcCode, currnetData);
        StringBuilder builder = new StringBuilder();

        builder.AppendLine($"[<color=orange>{currnetData.QuestName}</color>]");
        builder.AppendLine("퀘스트를 완료하였습니다!");
        AlertPopup.RefreshToAlert(builder.ToString());
        AlertPopup.OpenPopup(1.5f);

        QuestPanel.RefreshPanel();
    }
예제 #3
0
    public void AcceptSell()
    {
        if (sellNum <= 0)
        {
            AlertPopup.RefreshToAlert("<color=red>판매할 개수 가 유효하지 않습니다.</color>");
            AlertPopup.OpenPopup(1.0f);
            return;
        }
        if (PlayerInventory.Instance.GetItem(itemData.ItemCode).ItemCount < sellNum)
        {
            AlertPopup.RefreshToAlert("<color=red>아이템 소지개수보다 판매 개수가 더 많습니다.</color>");
            AlertPopup.OpenPopup(1.0f);
            return;
        }
        PlayerInventory.Instance.RemoveItemFromInventory(itemData.ItemCode, sellNum);
        PlayerStat.Instance.AddGold(itemData.SellPrice * sellNum);
        PlayerQuest.Instance.UpdateQuestSellItem();
        gameObject.SetActive(false);

        Inventory_ItemTable.RefreshInventoryPanel();
        QuickSlot_Panel.Refresh();
        AlertPopup.RefreshToAlert("판매가 완료되었습니다!");
        AlertPopup.OpenPopup(1.0f);
    }
예제 #4
0
    public void BuyCurrentItem(int count)
    {
        int finalPrice = currentShopItemInfo.Price * count;

        if (finalPrice <= PlayerStat.Instance.GetStat("Gold"))
        {
            AlertPopup.RefreshToBuyItem(currentItemData.Name, count.ToString(), currentShopItemInfo.Price.ToString());
            AlertPopup.OpenPopup(2.0f);
            PlayerInventory.Instance.AddItemToInventory(new InventoryItem(currentItemData, count));
            PlayerStat.Instance.RemoveGold(finalPrice);
            RefreshPanel();
        }
        else
        {
            AlertPopup.RefreshToAlert("소지금이 부족합니다!");
            AlertPopup.OpenPopup(1.0f);
        }
    }