Пример #1
0
    public void BtnBuyIntheUI()
    {
        GameManager.Instance.g_Money -= int_TotalMoney_Buy;

        for (int i = 0; i < slots.Count; i++)
        {
            Shop_Slot slot = slots[i].GetComponent <Shop_Slot>();
            slot.thisItem.itemCount += slot.int_itemqty;
            slot.int_itemqty         = 0;
        }

        // Reset
        int_TotalMoney_Buy = 0;
    }
Пример #2
0
    public void MakeStoreSellSlots()
    {
        if (PlayerInventory)
        {
            for (int i = 0; i < PlayerInventory.myInventory.Count; i++)
            {
                if (PlayerInventory.myInventory[i].itemCount > 0)
                {
                    // 1000: General
                    if (WhichStore == 1000)
                    {
                        Debug.Log(WhichStore);
                        if (PlayerInventory.myInventory[i].itemType == Item.ItemType.Use)
                        {
                            GameObject temp    = Instantiate(blankStoreSellSlot, SellListParent);
                            Shop_Slot  newSlot = temp.GetComponent <Shop_Slot>();

                            if (newSlot)
                            {
                                newSlot.Sell_Setup(PlayerInventory.myInventory[i]);
                            }
                        }
                    }
                    // 1001: Armor
                    else if (WhichStore == 1001)
                    {
                        Debug.Log(WhichStore);
                        if (PlayerInventory.myInventory[i].itemType == Item.ItemType.Equip)
                        {
                            GameObject temp    = Instantiate(blankStoreSellSlot, SellListParent);
                            Shop_Slot  newSlot = temp.GetComponent <Shop_Slot>();

                            if (newSlot)
                            {
                                newSlot.Sell_Setup(PlayerInventory.myInventory[i]);
                            }
                        }
                    }
                }
            }
        }
    }
Пример #3
0
    public void MakeStoreBuySlots()
    {
        // 1000: General
        if (WhichStore == 1000)
        {
            for (int i = 0; i < DB_Use_itemList.db_itemList.Count; i++)
            {
                if (DB_Use_itemList.db_itemList[i].itemType == Item.ItemType.Use)
                {
                    GameObject StoreBuytemp    = Instantiate(blankStoreBuySlot, BuyListParent);
                    Shop_Slot  newStoreBuySlot = StoreBuytemp.GetComponent <Shop_Slot>();
                    slots.Add(StoreBuytemp);

                    if (newStoreBuySlot)
                    {
                        newStoreBuySlot.BuySlot_Setup(DB_Use_itemList.db_itemList[i], this);
                    }
                }
            }
        }

        // 1001: Armor
        else if (WhichStore == 1001)
        {
            for (int i = 0; i < DB_Equip_itemList.db_itemList.Count; i++)
            {
                if (DB_Equip_itemList.db_itemList[i].itemType == Item.ItemType.Equip)
                {
                    GameObject StoreBuytemp    = Instantiate(blankStoreBuySlot, BuyListParent);
                    Shop_Slot  newStoreBuySlot = StoreBuytemp.GetComponent <Shop_Slot>();

                    if (newStoreBuySlot)
                    {
                        newStoreBuySlot.BuySlot_Setup(DB_Equip_itemList.db_itemList[i], this);
                    }
                }
            }
        }
    }
Пример #4
0
    public void BtnSellIntheUI()
    {
        GameManager.Instance.g_Money += int_TotalMoney_Sell;

        // thisitem count - qty
        for (int i = 0; i < slots.Count; i++)
        {
            Shop_Slot slot = slots[i].GetComponent <Shop_Slot>();
            slot.thisItem.itemCount  = slot.Get_current_ownqty();
            slot.thisItem.itemCount -= slot.int_itemqty;
            slot.int_itemqty         = 0;

            if (slot.thisItem.itemCount <= 0)
            {
                slots.RemoveAt(i);
                ClearInventorySlots();
                MakeStoreSellSlots();
            }
        }

        // Reset
        int_TotalMoney_Sell = 0;
    }