コード例 #1
0
    private void OnClickSure(GameObject go)
    {
        bool       flag = false;
        List <int> list = new List <int>();

        using (Dictionary <int, bool> .Enumerator enumerator = this.selectEquipStepDic.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                KeyValuePair <int, bool> current = enumerator.get_Current();
                if (current.get_Value())
                {
                    list.Add(current.get_Key());
                }
            }
        }
        List <int> list2 = new List <int>();

        using (Dictionary <int, bool> .Enumerator enumerator2 = this.selectIndexDic.GetEnumerator())
        {
            while (enumerator2.MoveNext())
            {
                KeyValuePair <int, bool> current2 = enumerator2.get_Current();
                if (current2.get_Value())
                {
                    list2.Add(current2.get_Key());
                }
            }
        }
        List <Goods> equimentGoods = BackpackManager.Instance.EquimentGoods;
        List <Goods> list3         = new List <Goods>();

        for (int i = 0; i < equimentGoods.get_Count(); i++)
        {
            for (int j = 0; j < list.get_Count(); j++)
            {
                if (DataReader <zZhuangBeiPeiZhiBiao> .Contains(equimentGoods.get_Item(i).GetItemId()))
                {
                    zZhuangBeiPeiZhiBiao zZhuangBeiPeiZhiBiao = DataReader <zZhuangBeiPeiZhiBiao> .Get(equimentGoods.get_Item(i).GetItemId());

                    if (zZhuangBeiPeiZhiBiao.step == list.get_Item(j))
                    {
                        list3.Add(equimentGoods.get_Item(i));
                    }
                }
            }
        }
        Dictionary <int, List <long> > dictionary = new Dictionary <int, List <long> >();

        for (int k = 0; k < list3.get_Count(); k++)
        {
            EquipSimpleInfo      equipSimpleInfoByEquipID = EquipGlobal.GetEquipSimpleInfoByEquipID(list3.get_Item(k).GetLongId());
            zZhuangBeiPeiZhiBiao equipCfgDataByEquipID    = EquipGlobal.GetEquipCfgDataByEquipID(list3.get_Item(k).GetLongId());
            for (int l = 0; l < list2.get_Count(); l++)
            {
                if (list3.get_Item(k).GetItem().color == list2.get_Item(l) && (this.isAllowDecSuit || (!this.isAllowDecSuit && equipSimpleInfoByEquipID != null && equipSimpleInfoByEquipID.suitId <= 0)))
                {
                    if ((equipCfgDataByEquipID.step > 3 || list2.get_Item(l) > 3) && !flag)
                    {
                        flag = true;
                    }
                    if (equipCfgDataByEquipID != null && dictionary.ContainsKey(equipCfgDataByEquipID.position))
                    {
                        List <long> list4 = dictionary.get_Item(equipCfgDataByEquipID.position);
                        list4.Add(list3.get_Item(k).GetLongId());
                    }
                    else if (equipCfgDataByEquipID != null && !dictionary.ContainsKey(equipCfgDataByEquipID.position))
                    {
                        List <long> list5 = new List <long>();
                        list5.Add(list3.get_Item(k).GetLongId());
                        dictionary.Add(equipCfgDataByEquipID.position, list5);
                    }
                }
            }
        }
        List <DecomposeEquipInfo> decomposeList = new List <DecomposeEquipInfo>();

        using (Dictionary <int, List <long> > .Enumerator enumerator3 = dictionary.GetEnumerator())
        {
            while (enumerator3.MoveNext())
            {
                KeyValuePair <int, List <long> > current3 = enumerator3.get_Current();
                DecomposeEquipInfo decomposeEquipInfo     = new DecomposeEquipInfo();
                decomposeEquipInfo.position = current3.get_Key();
                decomposeEquipInfo.equipIds.Clear();
                decomposeEquipInfo.equipIds.AddRange(current3.get_Value());
                decomposeList.Add(decomposeEquipInfo);
            }
        }
        if (flag)
        {
            DialogBoxUIViewModel.Instance.ShowAsOKCancel("分解装备", "该装备属于贵重装备,是否确认分解", null, delegate
            {
                EquipmentManager.Instance.SendDecomposeEquipReq(decomposeList);
                this.Show(false);
            }, "取 消", "确 定", "button_orange_1", "button_yellow_1", null, true, true);
        }
        else
        {
            EquipmentManager.Instance.SendDecomposeEquipReq(decomposeList);
            this.Show(false);
        }
    }