private void __UpdateCount__() { Dictionary <int, Mem_slotitem> dictionary = null; for (int i = 0; i < _have_items.Count; i++) { ItemlistModel itemlistModel = _have_items[i]; Mst_item_shop mst_cabinet = _cabinet_relations[itemlistModel]; if (mst_cabinet == null || !mst_cabinet.IsChildReference() || mst_cabinet.Item2_type == 1) { itemlistModel.__SetOverrideCount__(0); } else if (mst_cabinet.Item2_type == 2) { if (dictionary == null) { dictionary = new Api_get_Member().Slotitem().data; } int value = dictionary.Count((KeyValuePair <int, Mem_slotitem> item) => item.Value.Slotitem_id == mst_cabinet.Item2_id); itemlistModel.__SetOverrideCount__(value); } else if (mst_cabinet.Item2_type == 3) { enumMaterialCategory item2_id = (enumMaterialCategory)mst_cabinet.Item2_id; int count = base.Material.GetCount(item2_id); itemlistModel.__SetOverrideCount__(count); } else { itemlistModel.__SetOverrideCount__(0); } } }
protected void _Init(bool all_item) { if (this._req_store == null) { this._req_store = new Api_req_store(); } Dictionary <int, Mst_payitem> storeList = this._req_store.GetStoreList(); this._items = new List <ItemStoreModel>(); if (this._mst_cabinets == null) { this._mst_cabinets = Mst_DataManager.Instance.GetMstCabinet(); } List <Mst_item_shop> list = this._mst_cabinets.get_Item(1); list = list.GetRange(0, list.get_Count()); if (all_item) { using (Dictionary <int, Mst_payitem> .ValueCollection.Enumerator enumerator = storeList.get_Values().GetEnumerator()) { while (enumerator.MoveNext()) { Mst_payitem current = enumerator.get_Current(); if (!(current.Name == string.Empty)) { ItemStoreModel itemStoreModel = new ItemStoreModel(current); this._items.Add(itemStoreModel); } } } this._items.Sort((ItemStoreModel a, ItemStoreModel b) => (a.MstId <= b.MstId) ? -1 : 1); } else { using (List <Mst_item_shop> .Enumerator enumerator2 = list.GetEnumerator()) { while (enumerator2.MoveNext()) { Mst_item_shop current2 = enumerator2.get_Current(); Mst_payitem mst_payitem; storeList.TryGetValue(current2.Item1_id, ref mst_payitem); if (mst_payitem == null) { this._items.Add(null); } else { ItemStoreModel itemStoreModel2 = new ItemStoreModel(mst_payitem); this._items.Add(itemStoreModel2); } } } } }
protected void _Init(bool all_item) { if (_descriptions == null) { _descriptions = Mst_DataManager.Instance.GetUseitemText(); } _have_items = new List <ItemlistModel>(); if (_mst_cabinet == null) { _mst_cabinet = Mst_DataManager.Instance.GetMstCabinet(); } List <Mst_item_shop> list = _mst_cabinet[3]; _cabinet_relations = new Dictionary <ItemlistModel, Mst_item_shop>(); Api_Result <Dictionary <int, Mem_useitem> > api_Result = new Api_get_Member().UseItem(); if (api_Result.state == Api_Result_State.Success) { Dictionary <int, Mst_useitem> mst_useitem = Mst_DataManager.Instance.Mst_useitem; Dictionary <int, Mem_useitem> dictionary = (api_Result.data != null) ? api_Result.data : new Dictionary <int, Mem_useitem>(); if (all_item) { foreach (Mst_useitem value7 in mst_useitem.Values) { if (!(value7.Name == string.Empty)) { Mem_useitem value = null; dictionary.TryGetValue(value7.Id, out value); _descriptions.TryGetValue(value7.Id, out string value2); ItemlistModel tmp = new ItemlistModel(value7, value, value2); _have_items.Add(tmp); Mst_item_shop value3 = list.Find((Mst_item_shop item) => item.Item1_id == tmp.MstId); _cabinet_relations.Add(tmp, value3); } } _have_items.Sort((ItemlistModel a, ItemlistModel b) => (a.MstId > b.MstId) ? 1 : (-1)); } else { foreach (Mst_item_shop item in list) { int key = (item.Item1_type == 1) ? item.Item1_id : 0; Mst_useitem value4 = null; mst_useitem.TryGetValue(key, out value4); Mem_useitem value5 = null; dictionary.TryGetValue(key, out value5); string value6 = string.Empty; if (value4 != null) { _descriptions.TryGetValue(value4.Id, out value6); } ItemlistModel itemlistModel = new ItemlistModel(value4, value5, value6); _have_items.Add(itemlistModel); _cabinet_relations.Add(itemlistModel, item); } } __UpdateCount__(); return; } throw new Exception("Logic Error"); }
protected void _Init(bool all_item) { if (this._descriptions == null) { this._descriptions = Mst_DataManager.Instance.GetUseitemText(); } this._have_items = new List <ItemlistModel>(); if (this._mst_cabinet == null) { this._mst_cabinet = Mst_DataManager.Instance.GetMstCabinet(); } List <Mst_item_shop> list = this._mst_cabinet.get_Item(3); this._cabinet_relations = new Dictionary <ItemlistModel, Mst_item_shop>(); Api_Result <Dictionary <int, Mem_useitem> > api_Result = new Api_get_Member().UseItem(); if (api_Result.state == Api_Result_State.Success) { Dictionary <int, Mst_useitem> mst_useitem = Mst_DataManager.Instance.Mst_useitem; Dictionary <int, Mem_useitem> dictionary = (api_Result.data != null) ? api_Result.data : new Dictionary <int, Mem_useitem>(); if (all_item) { using (Dictionary <int, Mst_useitem> .ValueCollection.Enumerator enumerator = mst_useitem.get_Values().GetEnumerator()) { while (enumerator.MoveNext()) { Mst_useitem current = enumerator.get_Current(); if (!(current.Name == string.Empty)) { Mem_useitem mem_data = null; dictionary.TryGetValue(current.Id, ref mem_data); string description; this._descriptions.TryGetValue(current.Id, ref description); ItemlistModel tmp = new ItemlistModel(current, mem_data, description); this._have_items.Add(tmp); Mst_item_shop mst_item_shop = list.Find((Mst_item_shop item) => item.Item1_id == tmp.MstId); this._cabinet_relations.Add(tmp, mst_item_shop); } } } this._have_items.Sort((ItemlistModel a, ItemlistModel b) => (a.MstId <= b.MstId) ? -1 : 1); } else { using (List <Mst_item_shop> .Enumerator enumerator2 = list.GetEnumerator()) { while (enumerator2.MoveNext()) { Mst_item_shop current2 = enumerator2.get_Current(); int num = (current2.Item1_type != 1) ? 0 : current2.Item1_id; Mst_useitem mst_useitem2 = null; mst_useitem.TryGetValue(num, ref mst_useitem2); Mem_useitem mem_data2 = null; dictionary.TryGetValue(num, ref mem_data2); string empty = string.Empty; if (mst_useitem2 != null) { this._descriptions.TryGetValue(mst_useitem2.Id, ref empty); } ItemlistModel itemlistModel = new ItemlistModel(mst_useitem2, mem_data2, empty); this._have_items.Add(itemlistModel); this._cabinet_relations.Add(itemlistModel, current2); } } } this.__UpdateCount__(); return; } throw new Exception("Logic Error"); }