예제 #1
0
        public void Use()
        {
            if (slot != null)
            {
                if (SelectWidget == Widget.Shop)
                {
                    // 아이템을 구매하고 각각 다른 인벤토리에 저장할경우 inventory.InvenTabList[0].name 를 수정해서 사용한다
                    if (slot.Item is Consum)
                    {
                        slot.Item = ItemData.ConsumItemClone(slot.Item.Name);
                    }
                    else if (slot.Item is Equipment)
                    {
                        slot.Item = ItemData.EquipmentItemClone(slot.Item.Name);
                    }
                    else if (slot.Item is CommonItem)
                    {
                        slot.Item = ItemData.CommonItemClone(slot.Item.Name);
                    }
                    ShopHelper.Buy(ref InventoryManager.money, slot.Item, TabManager.GetTab(inventory.InvenTabList[0].name), () => Debug.Log("돈이 부족합니다"), () => Debug.Log("탭이 꽉찼습니다"));
                    InventoryManager.MoneyRefresh();
                    SlotManager.RefreshAll();

                    Cancel();
                }
                else
                {
                    slot.itemHandler.Use(slot, slot.Item);
                    SlotManager.RefreshAll();
                    Cancel();
                }
            }
        }
예제 #2
0
        private void MakeShop()
        {
            InventoryTab ShopFirstTab  = TabManager.GetTab("ShopFirstTab");
            InventoryTab ShopSecondTab = TabManager.GetTab("ShopSecondTab");


            ShopFirstTab.Add(ItemData.ConsumItemClone(0));
            ShopFirstTab.Add(ItemData.ConsumItemClone(1));

            ShopSecondTab.Add(ItemData.EquipmentItemClone(0));
            ShopSecondTab.Add(ItemData.EquipmentItemClone(1));
            ShopSecondTab.Add(ItemData.EquipmentItemClone(2));
            ShopSecondTab.Add(ItemData.CommonItemClone(0));
            ShopSecondTab.Add(ItemData.CommonItemClone(1));


            InventoryTab InvenFirstTab = TabManager.GetTab("InvenFirstTab");

            InvenFirstTab.Add(ItemData.ConsumItemClone(0), 19);
            InvenFirstTab.Add(ItemData.EquipmentItemClone(0), 13);

            InventoryTab QuickFirstTab = TabManager.GetTab("QuickFirstTab");

            QuickFirstTab.Add(ItemData.EquipmentItemClone(0), 0);
            QuickFirstTab.Add(ItemData.ConsumItemClone(0), 5);
        }
예제 #3
0
        // 클릭해서 탭 변경하기
        public void TabChangeWithClick(GameObject tabObject)
        {
            List <GameObject> TabList = new List <GameObject>();


            // 변경된 탭으로 아이템창 변경
            // 클릭한탭이 인벤토리 일 때
            if (InvenTabList.Contains(tabObject))
            {
                TabList = InvenTabList;
                invenSlotManager.Refresh(TabManager.GetTab(tabObject.name));
            }
            // 클릭한탭이 상점탭 일 때
            else if (ShopTabList.Contains(tabObject))
            {
                TabList = ShopTabList;
                shopSlotManager.Refresh(TabManager.GetTab(tabObject.name));
            }
            else if (QuickTabList.Contains(tabObject))
            {
                TabList = QuickTabList;
                quickSlotManager.Refresh(TabManager.GetTab(tabObject.name));
            }
            else
            {
                Debug.Log("탭 리스트에 추가 되어있지 않는 탭입니다. 탭 리스트에 추가하세요");
                return;
            }


            // Quick Widget처럼 바꿀 탭이 없고 1개뿐일경우 예외
            if (TabList.Count > 1)
            {
                //클릭시 색깔 바꾸기
                for (int i = 0; i < TabList.Count; i++)
                {
                    if (tabObject != TabList[i].gameObject)
                    {
                        TabList[i].GetComponent <Button>().interactable = true;
                        TabList[i].GetComponent <Image>().color         = new Color32(240, 240, 240, 255);
                    }
                    else
                    {
                        TabList[i].GetComponent <Button>().interactable = false;
                        TabList[i].GetComponent <Image>().color         = new Color32(255, 255, 255, 255);
                    }
                }
            }
        }