Пример #1
0
        private void GetEvoResourceList(out List <EvoItem> list, out Dictionary <int, EvoItem> dict)
        {
            list = new List <EvoItem>();
            dict = new Dictionary <int, EvoItem>();
            this._materialEnough = true;
            foreach (StorageDataItemBase base2 in this._itemNeedList)
            {
                int     iD     = base2.ID;
                int     number = base2.number;
                EvoItem item   = new EvoItem();
                List <StorageDataItemBase> list2 = Singleton <StorageModule> .Instance.TryGetStorageDataItemByMetaId(iD, number);

                if (list2.Count > 0)
                {
                    list2.Sort(new Comparison <StorageDataItemBase>(StorageDataItemBase.CompareToLevelAsc));
                    item.item        = list2[0].Clone();
                    item.enough      = true;
                    item.item.number = number;
                }
                else
                {
                    item.item = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(iD, 1);

                    item.enough          = false;
                    item.item.number     = number;
                    this._materialEnough = false;
                }
                list.Add(item);
                if (!dict.ContainsKey(iD))
                {
                    dict.Add(iD, item);
                }
            }
        }
Пример #2
0
        private void GetEvoResourceList(out List <EvoItem> list, out Dictionary <int, EvoItem> dict)
        {
            list = new List <EvoItem>();
            dict = new Dictionary <int, EvoItem>();
            HashSet <int> set = new HashSet <int>();

            foreach (KeyValuePair <int, int> pair in this.storageItem.GetEvoMaterial())
            {
                int     key    = pair.Key;
                int     number = pair.Value;
                EvoItem item   = new EvoItem();
                List <StorageDataItemBase> list2 = Singleton <StorageModule> .Instance.TryGetStorageDataItemByMetaId(key, number);

                if (list2.Count > 0)
                {
                    list2.Sort(new Comparison <StorageDataItemBase>(StorageDataItemBase.CompareToLevelAsc));
                    item.item = list2[0].Clone();
                    if (item.item is WeaponDataItem)
                    {
                        bool flag = false;
                        foreach (StorageDataItemBase base2 in list2)
                        {
                            if ((((base2.uid != this.storageItem.uid) && (Singleton <AvatarModule> .Instance.TryGetAvatarByID(base2.avatarID) == null)) && !base2.isProtected) && !set.Contains(base2.uid))
                            {
                                flag      = true;
                                item.item = base2.Clone();
                                set.Add(base2.uid);
                                break;
                            }
                        }
                        item.enough = flag;
                        if (!flag)
                        {
                            item.item = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(key, 1);
                        }
                        item.item.number = 1;
                    }
                    else
                    {
                        item.enough      = true;
                        item.item.number = number;
                    }
                }
                else
                {
                    item.item = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(key, 1);

                    item.enough      = false;
                    item.item.number = number;
                }
                list.Add(item);
                if (!dict.ContainsKey(key))
                {
                    dict.Add(key, item);
                }
            }
        }