public void RefreshSelect(int selectIndex, ComposeMenuDataModel clickMenu)
 {
     SetSelectIndex(selectIndex, clickMenu);
     {
         // foreach(var menuData in DataModel.MenuDatas)
         var enumerator4 = (DataModel.MenuDatas).GetEnumerator();
         while (enumerator4.MoveNext())
         {
             var menuData = enumerator4.Current;
             {
                 if (menuData.Type == 1)
                 {
                     if (menuData.TableId == selectIndex)
                     {
                         menuData.IsOpen = 1;
                     }
                     else
                     {
                         menuData.IsOpen = 0;
                     }
                 }
             }
         }
     }
 }
 private void UpgradeSelect(int selectIndex, ComposeMenuDataModel clickMenu)
 {
     SettingsChooseIndex(selectIndex, clickMenu);
     {
         // foreach(var menuData in DataModel.MenuDatas)
         var _enumerator4 = (DataModel.MenuDatas).GetEnumerator();
         while (_enumerator4.MoveNext())
         {
             var _menuData = _enumerator4.Current;
             {
                 if (_menuData.Type == 1)
                 {
                     if (_menuData.TableId == selectIndex)
                     {
                         _menuData.IsOpen = 1;
                     }
                     else
                     {
                         _menuData.IsOpen = 0;
                     }
                 }
             }
         }
     }
 }
    public void SetSelectIndex(int index, ComposeMenuDataModel clickMenu)
    {
        DataModel.PermitLevel = clickMenu.PermitLevel;
        //if (DataModel.PermitLevel != -1)
        //{
        //    DataModel.PermitLevel ++;
        //}
        DataModel.SelectIndex = index;
        if (index == -1)
        {
            return;
        }
        var tbCompose = Table.GetItemCompose(DataModel.SelectIndex);
        var count     = 0;

        for (var i = 0; i < tbCompose.NeedId.Count; i++)
        {
            if (tbCompose.NeedId[i] != -1)
            {
                count++;
            }
        }
        DataModel.ConsumeCount = count;
    }
        private void SettingsChooseIndex(int index, ComposeMenuDataModel clickMenu)
        {
            DataModel.PermitLevel = clickMenu.PermitLevel;
            //if (DataModel.PermitLevel != -1)
            //{
            //    DataModel.PermitLevel ++;
            //}
            DataModel.SelectIndex = index;
            if (index == -1)
            {
                return;
            }
            var _tbCompose = Table.GetItemCompose(DataModel.SelectIndex);
            var _count     = 0;

            for (var i = 0; i < _tbCompose.NeedId.Count; i++)
            {
                if (_tbCompose.NeedId[i] != -1)
                {
                    _count++;
                }
            }
            DataModel.ConsumeCount = _count;
        }
    //private Dictionary<int, int> mLimitCounts = new Dictionary<int, int>();
    //private Dictionary<int,List<int>> mAllLimit = new Dictionary<int, List<int>>();
    public void RefreshSelectReset()
    {
        DataModel.MenuDatas.Clear();


        var list   = new List <ComposeMenuDataModel>();
        var roleId = PlayerDataManager.Instance.GetRoleId();

        {
            // foreach(var b in DataModel.MenuState)
            var __enumerator3 = (DataModel.MenuState).GetEnumerator();
            while (__enumerator3.MoveNext())
            {
                var b = __enumerator3.Current;
                {
                    var menu = new ComposeMenuDataModel();
                    menu.Type    = 0;
                    menu.TableId = b.Key;
                    var type = (eComposeType)b.Key;

                    //                     if (type != eComposeType.Ticket && DataModel.NeedBack == false)
                    //                     {
                    // //NPC的合成服务 去掉技能书的合成页
                    //                         continue;
                    //                     }

                    switch (type)
                    {
                    case eComposeType.Ticket:
                    {
                        //门票
                        menu.TypeName = GameUtils.GetDictionaryText(540);
                    }
                    break;

                    case eComposeType.Rune:
                    {
                        //属性符文
                        menu.TypeName = GameUtils.GetDictionaryText(541);
                    }
                    break;

                    case eComposeType.SkillBook:
                    {
                        //技能书
                        menu.TypeName = GameUtils.GetDictionaryText(542);
                    }
                    break;

                    case eComposeType.SkillPiece:
                    {
                        //技能残章
                        menu.TypeName = GameUtils.GetDictionaryText(543);
                        //menu.TypeName = "技能残章";
                    }
                    break;

                    case eComposeType.MayaShenQi:
                    {
                        menu.TypeName = GameUtils.GetDictionaryText(100002114);
                    }
                    break;
                    }
                    list.Add(menu);

                    //                     int count = -1;
                    //                     if (!mLimitCounts.TryGetValue(b.Key, out count))
                    //                     {
                    //                         count = -1;
                    //                     }
                    var level = PlayerDataManager.Instance.GetRes((int)eResourcesType.LevelRes);
                    if (b.Value)
                    {
                        menu.IsOpen = 1;
                        var index = 0;
                        List <ItemComposeRecord> itemList = null;
                        if (mComposeTable.TryGetValue(menu.TableId, out itemList))
                        {
                            {
                                var __list6      = itemList;
                                var __listCount6 = __list6.Count;
                                var select       = -1;
                                ComposeMenuDataModel subMenuRef = null;
                                for (var __i6 = 0; __i6 < __listCount6; ++__i6)
                                {
                                    var record = __list6[__i6];
                                    {
                                        var lv = -1;
                                        if (level < record.ComposeOpenLevel)
                                        {
                                            lv = record.ComposeOpenLevel;
                                        }
                                        else
                                        {
                                            lv = -1;
                                        }
                                        if (!BitFlag.GetLow(record.SortByCareer, roleId))
                                        {
                                            continue;
                                        }
                                        var subMenu = new ComposeMenuDataModel();
                                        subMenu.PermitLevel = lv;
                                        if ((DataModel.ShowId == -1 && index == 0) || DataModel.ShowId == record.Id)
                                        {
                                            select = record.Id;
                                            SetSelectIndex(record.Id, subMenu);
                                            subMenu.IsOpen = 1;
                                        }
                                        else
                                        {
                                            subMenu.IsOpen = 0;
                                            if (subMenuRef == null)
                                            {
                                                subMenuRef = subMenu;
                                            }
                                        }
                                        index++;
                                        subMenu.Type    = 1;
                                        subMenu.TableId = record.Id;
                                        subMenu.ItemId  = Table.GetItemCompose(record.Id).ComposeView;
                                        list.Add(subMenu);
                                    }
                                }

                                if (select == -1 && subMenuRef != null)
                                {
                                    SetSelectIndex(subMenuRef.TableId, subMenuRef);
                                    subMenuRef.IsOpen = 1;
                                }
                            }
                        }
                    }
                }
            }
        }
        DataModel.MenuDatas = new ObservableCollection <ComposeMenuDataModel>(list);
    }
        private void ShowTabContent()
        {
            DataModel.MenuDatas.Clear();


            var _list   = new List <ComposeMenuDataModel>();
            var _roleId = PlayerDataManager.Instance.GetRoleId();

            {
                var _enumerator3 = (DataModel.MenuState).GetEnumerator();
                while (_enumerator3.MoveNext())
                {
                    var _b = _enumerator3.Current;
                    {
                        var _menu = new ComposeMenuDataModel();
                        _menu.Type    = 0;
                        _menu.TableId = _b.Key;
                        var _type = (eComposeType)_b.Key;
                        switch (_type)
                        {
                        case eComposeType.Ticket:
                        {
                            _menu.TypeName = GameUtils.GetDictionaryText(540);
                        }
                        break;

                        case eComposeType.Rune:
                        {
                            _menu.TypeName = GameUtils.GetDictionaryText(541);
                        }
                        break;

                        case eComposeType.SkillBook:
                        {
                            _menu.TypeName = GameUtils.GetDictionaryText(542);
                        }
                        break;

                        case eComposeType.SkillPiece:
                        {
                            _menu.TypeName = GameUtils.GetDictionaryText(543);
                        }
                        break;

                        case eComposeType.MayaShenQi:
                        {
                            _menu.TypeName = GameUtils.GetDictionaryText(100002114);
                        }
                        break;

                        case eComposeType.MountSkill:
                        {
                            _menu.TypeName = GameUtils.GetDictionaryText(539);
                        }
                        break;
                        }
                        //_list.Add(_menu);

                        var _level = PlayerDataManager.Instance.GetRes((int)eResourcesType.LevelRes);
                        if (_b.Value)
                        {
                            _menu.IsOpen = 1;
                            var _index = 0;
                            List <ItemComposeRecord> _itemList = null;
                            if (m_dicComposeTable.TryGetValue(_menu.TableId, out _itemList))
                            {
                                {
                                    var _list6      = _itemList;
                                    var _listCount6 = _list6.Count;
                                    var select      = -1;
                                    ComposeMenuDataModel _subMenuRef = null;
                                    for (var _i6 = 0; _i6 < _listCount6; ++_i6)
                                    {
                                        var _record = _list6[_i6];
                                        {
                                            var _lv = -1;
                                            if (_level < _record.ComposeOpenLevel)
                                            {
                                                _lv = _record.ComposeOpenLevel;
                                            }
                                            else
                                            {
                                                _lv = -1;
                                            }
                                            if (!BitFlag.GetLow(_record.SortByCareer, _roleId))
                                            {
                                                continue;
                                            }
                                            var _subMenu = new ComposeMenuDataModel();
                                            _subMenu.PermitLevel = _lv;
                                            if ((DataModel.ShowId == -1 && _index == 0) || DataModel.ShowId == _record.Id)
                                            {
                                                select = _record.Id;
                                                SettingsChooseIndex(_record.Id, _subMenu);
                                                _subMenu.IsOpen = 1;
                                            }
                                            else
                                            {
                                                _subMenu.IsOpen = 0;
                                                if (_subMenuRef == null)
                                                {
                                                    _subMenuRef = _subMenu;
                                                }
                                            }
                                            _index++;
                                            _subMenu.Type    = 1;
                                            _subMenu.TableId = _record.Id;
                                            _subMenu.ItemId  = Table.GetItemCompose(_record.Id).ComposeView;
                                            _list.Add(_subMenu);
                                        }
                                    }

                                    if (select == -1 && _subMenuRef != null)
                                    {
                                        SettingsChooseIndex(_subMenuRef.TableId, _subMenuRef);
                                        _subMenuRef.IsOpen = 1;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            DataModel.MenuDatas = new ObservableCollection <ComposeMenuDataModel>(_list);
        }