Exemplo n.º 1
0
        public void OnShow()
        {
            var tbFilter   = Table.GetClientConfig(1211);
            var filterStr  = tbFilter.Value.Split('|');
            var filterList = new List <int>();

            for (int i = 0; i < filterStr.Length; i++)
            {
                filterList.Add(filterStr[i].ToInt());
            }
            var _level       = PlayerDataManager.Instance.GetLevel();
            var tbStrongData = Table.GetStrongData(_level);

            if (tbStrongData == null)
            {
                return;
            }

            DataModel.SuggestForce = tbStrongData.SujectForce;
            var _nowForce = PlayerDataManager.Instance.PlayerDataModel.Attributes.FightValue;
            var _barValue = (float)_nowForce / DataModel.SuggestForce;

            _barValue          = ((_barValue < 0.3f ? 0.3f : _barValue) > 1 ? 1 : _barValue);
            DataModel.BarValue = _barValue;
            var _count      = tbStrongData.TypeId.Length;
            var _param1List = new List <int> {
                -1, -1, -1
            };
            var _param2List = new List <int> {
                -1, -1, -1
            };
            var _lists     = new List <StrongItemDataModel>();
            var _sortCount = 0;

            for (var i = 0; i < _count; i++)
            {
                if (i == (int)eStrongType.Count - 1)
                {
                    break;
                }
                var _strongItem = new StrongItemDataModel();
                var typeId      = tbStrongData.TypeId[i];
                if (filterList.Contains(typeId))
                {
                    continue;
                }
                var _tbStrongType = Table.GetStrongType(typeId);
                if (_tbStrongType == null)
                {
                    continue;
                }

                if (_tbStrongType.Sort == -1)
                {
                    continue;
                }
                _param1List[0] = tbStrongData.Param[i, 0];
                _param1List[1] = tbStrongData.Param[i, 2];
                _param1List[2] = tbStrongData.Param[i, 4];
                _param2List[0] = tbStrongData.Param[i, 1];
                _param2List[1] = tbStrongData.Param[i, 3];
                _param2List[2] = tbStrongData.Param[i, 5];
                var _varList = GainCount((eStrongType)tbStrongData.TypeId[i], _param2List);
                var _state   = 3;
                for (var j = 0; j < 3; j++)
                {
                    if (_param1List[j] > _varList[j])
                    {
                        _state = j;
                        break;
                    }
                }
                _strongItem.State = _state;
                _strongItem.Id    = _tbStrongType.Id;
                if (IdToSort.ContainsKey(_tbStrongType.Id))
                {
                    _strongItem.FirstSort = IdToSort[_tbStrongType.Id];
                }
                _strongItem.Sort = _tbStrongType.Sort;
                if (!GameSetting.Instance.IgnoreButtonCondition)
                {
                    if (_tbStrongType.ConditionId == -1)
                    {
                        _strongItem.IsOpen = 1;
                    }
                    else
                    {
                        _strongItem.IsOpen = PlayerDataManager.Instance.CheckCondition(_tbStrongType.ConditionId) == 0 ? 1 : 0;
                    }
                }
                else
                {
                    _strongItem.IsOpen = 1;
                }

                if (_strongItem.IsOpen == 0)
                {
                    var _tbCondition = Table.GetConditionTable(_tbStrongType.ConditionId);
                    _strongItem.OpenStr = GameUtils.GetDictionaryText(_tbCondition.FlagTrueDict);
                }

                //if (tbStrongType.Param[1] == -1)
                //{
                if (_state == 0)
                {
                    _strongItem.NowStateStr  = string.Format(_tbStrongType.ShowStr, _varList[_state]);
                    _strongItem.WillStateStr = string.Format(_tbStrongType.ShowStr, _param1List[_state]);
                }
                else if (_state >= 2)
                {
                    _strongItem.NowStateStr  = string.Format(_tbStrongType.ShowStr, _varList[2]);
                    _strongItem.WillStateStr = string.Format(_tbStrongType.ShowStr, _param1List[2]);
                }
                else
                {
                    _strongItem.NowStateStr  = string.Format(_tbStrongType.ShowStr, _varList[_state]);
                    _strongItem.WillStateStr = string.Format(_tbStrongType.ShowStr, _param1List[_state + 1]);
                }
                //}
                //else
                //{
                //    if (state > 2)
                //    {
                //        strongItem.NowStateStr = string.Format(tbStrongType.ShowStr, varList[2], param2List[2]);
                //        strongItem.WillStateStr = string.Format(tbStrongType.ShowStr, param1List[1], param2List[1]);
                //    }
                //    else
                //    {
                //        strongItem.NowStateStr = string.Format(tbStrongType.ShowStr, varList[state], param2List[state]);
                //        strongItem.WillStateStr = string.Format(tbStrongType.ShowStr, param1List[1], param2List[1]);
                //    }

                //}
                _lists.Add(_strongItem);
            }

            if (FirstRun)
            {
                FirstShowRank(_lists);
                var _mCount = _lists.Count;
                for (var i = 0; i < _mCount; i++)
                {
                    IdToSort.Add(_lists[i].Id, i);
                }
                FirstRun = false;
            }
            else
            {
                ShowNotFirstRank(_lists);
            }
            DataModel.Lists = new ObservableCollection <StrongItemDataModel>(_lists);

            EventDispatcher.Instance.DispatchEvent(new UIEvent_StrongSetGridLookIndex(0, SelectIndex));
        }
Exemplo n.º 2
0
    public void OnShow()
    {
        var level        = PlayerDataManager.Instance.GetLevel();
        var tbStrongData = Table.GetStrongData(level);

        if (tbStrongData == null)
        {
            return;
        }

        DataModel.SuggestForce = tbStrongData.SujectForce;
        var nowForce = PlayerDataManager.Instance.PlayerDataModel.Attributes.FightValue;
        var barValue = (float)nowForce / DataModel.SuggestForce;

        barValue           = ((barValue < 0.3f ? 0.3f : barValue) > 1 ? 1 : barValue);
        DataModel.BarValue = barValue;
        var count      = tbStrongData.TypeId.Length;
        var param1List = new List <int> {
            -1, -1, -1
        };
        var param2List = new List <int> {
            -1, -1, -1
        };
        var lists     = new List <StrongItemDataModel>();
        var sortCount = 0;

        for (var i = 0; i < count; i++)
        {
            if (i == (int)eStrongType.Count - 1)
            {
                break;
            }
            var strongItem   = new StrongItemDataModel();
            var tbStrongType = Table.GetStrongType(tbStrongData.TypeId[i]);
            if (tbStrongType.Sort == -1)
            {
                continue;
            }
            param1List[0] = tbStrongData.Param[i, 0];
            param1List[1] = tbStrongData.Param[i, 2];
            param1List[2] = tbStrongData.Param[i, 4];
            param2List[0] = tbStrongData.Param[i, 1];
            param2List[1] = tbStrongData.Param[i, 3];
            param2List[2] = tbStrongData.Param[i, 5];
            var varList = GetCount((eStrongType)tbStrongData.TypeId[i], param2List);
            var state   = 3;
            for (var j = 0; j < 3; j++)
            {
                if (param1List[j] > varList[j])
                {
                    state = j;
                    break;
                }
            }
            strongItem.State = state;
            strongItem.Id    = tbStrongType.Id;
            if (IdToSort.ContainsKey(tbStrongType.Id))
            {
                strongItem.FirstSort = IdToSort[tbStrongType.Id];
            }
            strongItem.Sort = tbStrongType.Sort;
            if (!GameSetting.Instance.IgnoreButtonCondition)
            {
                if (tbStrongType.ConditionId == -1)
                {
                    strongItem.IsOpen = 1;
                }
                else
                {
                    strongItem.IsOpen = PlayerDataManager.Instance.CheckCondition(tbStrongType.ConditionId) == 0 ? 1 : 0;
                }
            }
            else
            {
                strongItem.IsOpen = 1;
            }

            if (strongItem.IsOpen == 0)
            {
                var tbCondition = Table.GetConditionTable(tbStrongType.ConditionId);
                strongItem.OpenStr = GameUtils.GetDictionaryText(tbCondition.FlagTrueDict);
            }

            //if (tbStrongType.Param[1] == -1)
            //{
            if (state == 0)
            {
                strongItem.NowStateStr  = string.Format(tbStrongType.ShowStr, varList[state]);
                strongItem.WillStateStr = string.Format(tbStrongType.ShowStr, param1List[state]);
            }
            else if (state >= 2)
            {
                strongItem.NowStateStr  = string.Format(tbStrongType.ShowStr, varList[2]);
                strongItem.WillStateStr = string.Format(tbStrongType.ShowStr, param1List[2]);
            }
            else
            {
                strongItem.NowStateStr  = string.Format(tbStrongType.ShowStr, varList[state]);
                strongItem.WillStateStr = string.Format(tbStrongType.ShowStr, param1List[state + 1]);
            }
            //}
            //else
            //{
            //    if (state > 2)
            //    {
            //        strongItem.NowStateStr = string.Format(tbStrongType.ShowStr, varList[2], param2List[2]);
            //        strongItem.WillStateStr = string.Format(tbStrongType.ShowStr, param1List[1], param2List[1]);
            //    }
            //    else
            //    {
            //        strongItem.NowStateStr = string.Format(tbStrongType.ShowStr, varList[state], param2List[state]);
            //        strongItem.WillStateStr = string.Format(tbStrongType.ShowStr, param1List[1], param2List[1]);
            //    }

            //}
            lists.Add(strongItem);
        }

        if (FirstRun)
        {
            FirstShowSort(lists);
            var mCount = lists.Count;
            for (var i = 0; i < mCount; i++)
            {
                IdToSort.Add(lists[i].Id, i);
            }
            FirstRun = false;
        }
        else
        {
            ShowNotFirstSort(lists);
        }
        DataModel.Lists = new ObservableCollection <StrongItemDataModel>(lists);

        EventDispatcher.Instance.DispatchEvent(new UIEvent_StrongSetGridLookIndex(0, SelectIndex));
    }