Exemple #1
0
        public static bool UseDropItem(ItemConsumerConfig itemConfig)
        {
            if (itemConfig.DropId > 0)
            {
                var itemList  = DropBook.GetDropItemList(itemConfig.DropId);
                var countList = new List <int>();
                foreach (var itemId in itemList)
                {
                    var isEquip = ConfigIdManager.IsEquip(itemId);
                    if (isEquip)
                    {
                        UserProfile.InfoEquip.AddEquip(itemId, 60);
                    }
                    else
                    {
                        UserProfile.InfoBag.AddItem(itemId, 1);
                    }
                    countList.Add(1);
                }
                var form = new ItemPackageForm();
                ((ItemPackageForm)form).SetItem(itemList.ToArray(), countList.ToArray());
                PanelManager.DealPanel(form);
            }

            return(true);
        }
Exemple #2
0
        private static bool UseGift(int id)
        {
            var        items     = ConfigData.GetItemGiftConfig(id).Items;
            List <int> itemList  = new List <int>();
            List <int> countList = new List <int>();

            for (int i = 0; i < items.Count; i++)
            {
                var item = items[i];
                UserProfile.InfoBag.AddItem(item.Id, item.Value);
                itemList.Add(item.Id);
                countList.Add(item.Value);
            }
            var form = new ItemPackageForm();

            ((ItemPackageForm)form).SetItem(itemList.ToArray(), countList.ToArray());
            PanelManager.DealPanel(form);
            return(true);
        }