Esempio n. 1
0
    public override void UpdateSlotList()
    {
        base.UpdateSlotList();
        base.UpdateEmptySlot(false);

        saleAction.GetComponent <RectTransform>().SetAsLastSibling();

        shop.CreateBatchItem();
    }
Esempio n. 2
0
    /// <summary>
    /// 상점에서 아이템을 구매합니다.
    /// </summary>
    public void Buy()
    {
        int index = enterShop.FindItemIndex(wantItemList[buyIndex].item.id, wantItemList[buyIndex].lowGold);

        //아이템이 존재하는지 체크
        if (index > -1)
        {
            Item item = enterShop.FindItem(index);
            if (CheckGold(-item.saleGold))
            {
                //구매 성공
                print("buy item : " + item.name + " | " + gameObject.name);
                //인벤에 아이템 등록
                inventory.Add(new Item(item));

                PlayDataManager.instance.AddGold(item.saleGold);
                AddGold(-item.saleGold);

                //슬롯에 아이템 삭제
                enterShop.RemoveSlot(index);

                Want(buyIndex);
                Say(3);

                //리스트 업데이트
                enterShop.CreateBatchItem();
                UIInGame.instance.UpdateSalePannel();
                UIInGame.instance.UpdateInventory();
            }
            else
            {
                //구매 실패
                Say(2);
            }
        }

        buyIndex = -1;
        ChangeState(NpcState.Move);
    }