예제 #1
0
    public void ВыбратьСлот(BtnInvent btn)
    {
        switch (btn.type)
        {
        case ItemSlotsType.head:
            heroTown.ОткрытьЭквип();
            ЗаполнениеЭквип(btn.type);
            SelectedSlot = btn.gameObject;
            break;

        case ItemSlotsType.tors:
            heroTown.ОткрытьЭквип();
            ЗаполнениеЭквип(btn.type);
            SelectedSlot = btn.gameObject;
            break;

        case ItemSlotsType.pants:
            heroTown.ОткрытьЭквип();
            ЗаполнениеЭквип(btn.type);
            SelectedSlot = btn.gameObject;
            break;

        case ItemSlotsType.bots:
            heroTown.ОткрытьЭквип();
            ЗаполнениеЭквип(btn.type);
            SelectedSlot = btn.gameObject;
            break;

        case ItemSlotsType.weapon0:
            heroTown.ОткрытьЭквип();
            ЗаполнениеЭквип(btn.type);
            SelectedSlot = btn.gameObject;
            break;

        case ItemSlotsType.weapon1:
            heroTown.ОткрытьЭквип();
            ЗаполнениеЭквип(btn.type);
            SelectedSlot = btn.gameObject;
            break;

        case ItemSlotsType.amulet:
            heroTown.ОткрытьЭквип();
            ЗаполнениеЭквип(btn.type);
            SelectedSlot = btn.gameObject;
            break;

        case ItemSlotsType.ring:
            heroTown.ОткрытьЭквип();
            ЗаполнениеЭквип(btn.type);
            SelectedSlot = btn.gameObject;
            break;

        case ItemSlotsType.art:
            heroTown.ОткрытьЭквип();
            ЗаполнениеЭквип(btn.type);
            SelectedSlot = btn.gameObject;
            break;
        }
    }
예제 #2
0
    public void PasteItem(Transform cell)
    {
        BtnEcuip      btnEcuip   = cell.GetComponent <BtnEcuip>();
        Item          item       = btnEcuip.item;
        BtnInvent     btnInvent  = SelectedSlot.GetComponent <BtnInvent>();
        Image         slotImage  = SelectedSlot.GetComponent <Image>();
        ItemSlotsType type       = btnInvent.type;
        int           slotNumber = btnInvent.slotNumber;

        slotImage.sprite = item.img;
        if (btnInvent.item != null)
        {
            btnInvent.item.isUse = false;
        }
        btnInvent.item = item;
        item.isUse     = true;
        ЗаполнениеЭквип(type);
        Debug.Log(ItemText.GetName(item.nameId) + "\n" + ItemText.GetDescription(item.nameId));
        switch (type)
        {
        case ItemSlotsType.head:
            if (heroTown.isArena)
            {
                Hero.arenaHead = item;
            }
            else
            {
                Hero.head = item;
            }
            break;

        case ItemSlotsType.tors:
            if (heroTown.isArena)
            {
                Hero.arenaTors = item;
            }
            else
            {
                Hero.tors = item;
            }
            break;

        case ItemSlotsType.pants:
            if (heroTown.isArena)
            {
                Hero.arenaPants = item;
            }
            else
            {
                Hero.pants = item;
            }
            break;

        case ItemSlotsType.bots:
            if (heroTown.isArena)
            {
                Hero.arenaBots = item;
            }
            else
            {
                Hero.bots = item;
            }
            break;

        case ItemSlotsType.weapon0:
            if (heroTown.isArena)
            {
                Hero.arenaWeapon0 = item;
            }
            else
            {
                Hero.weapon0 = item;
            }
            break;

        case ItemSlotsType.weapon1:
            if (heroTown.isArena)
            {
                Hero.arenaWeapon1 = item;
            }
            else
            {
                Hero.weapon1 = item;
            }
            break;

        case ItemSlotsType.amulet:
            if (heroTown.isArena)
            {
                Hero.arenaAmulet = item;
            }
            else
            {
                Hero.amulet = item;
            }
            break;

        case ItemSlotsType.ring:
            if (heroTown.isArena)
            {
                if (slotNumber == 0)
                {
                    Hero.arenaRing0 = item;
                }
                else
                {
                    Hero.arenaRing1 = item;
                }
            }
            else
            {
                if (slotNumber == 0)
                {
                    Hero.ring0 = item;
                }
                else
                {
                    Hero.ring1 = item;
                }
            }
            break;

        case ItemSlotsType.art:
            if (heroTown.isArena)
            {
                Hero.arenaArt = item;
            }
            else
            {
                switch (slotNumber)
                {
                case 0:
                    Hero.art0 = item;
                    break;

                case 1:
                    Hero.art1 = item;
                    break;

                case 2:
                    Hero.art2 = item;
                    break;
                }
            }
            break;
        }
    }