Beispiel #1
0
        public virtual void ExchangeDealingItemsAndGold()
        {
            if (DealingCharacter == null)
            {
                return;
            }
            List <DealingCharacterItem> tempDealingItems = new List <DealingCharacterItem>(DealingItems);

            for (int i = nonEquipItems.Count - 1; i >= 0; --i)
            {
                CharacterItem nonEquipItem = nonEquipItems[i];
                for (int j = tempDealingItems.Count - 1; j >= 0; --j)
                {
                    DealingCharacterItem dealingItem = tempDealingItems[j];
                    if (dealingItem.nonEquipIndex == i && nonEquipItem.amount >= dealingItem.characterItem.amount)
                    {
                        if (DealingCharacter.IncreaseItems(dealingItem.characterItem))
                        {
                            // Reduce item amount when able to increase item to co character
                            nonEquipItem.amount -= dealingItem.characterItem.amount;
                            if (nonEquipItem.amount == 0)
                            {
                                nonEquipItems.RemoveAt(i);
                            }
                            else
                            {
                                nonEquipItems[i] = nonEquipItem;
                            }
                        }
                        tempDealingItems.RemoveAt(j);
                        break;
                    }
                }
            }
            this.FillEmptySlots();
            Gold -= DealingGold;
            DealingCharacter.Gold += DealingGold;
        }