Beispiel #1
0
        private void RefresDisplayName()
        {
            var strName = GameUtils.AttributeName(AttributeData.Type);

            NameLabel.text = strName;
            RefresDisplayValue();
        }
Beispiel #2
0
        private void RefresDisplay()
        {
            var strName  = GameUtils.AttributeName(AttributeData.Type);
            var strValue = GameUtils.AttributeValue(AttributeData.Type, AttributeData.Value);

            if (AttributeData.ValueEx != 0)
            {
                strValue = strValue + "-" + GameUtils.AttributeValue(AttributeData.Type, AttributeData.ValueEx);
            }
            strName       += strValue;
            TextLabel.text = strName;
        }
Beispiel #3
0
        private void RefresDisplay()
        {
            var strName  = GameUtils.AttributeName(AttributeId);
            var strValue = GameUtils.AttributeValue(AttributeId, AttributeValue);
            var str      = strName + ":" + strValue;

            if (AttributeValueEx != -1)
            {
                var strValueEx = GameUtils.AttributeValue(AttributeId, AttributeValueEx);
                str = str + "-" + strValueEx;
            }
            Lable.text = str;
        }
Beispiel #4
0
        private void RefresDisplay()
        {
            var strName = GameUtils.AttributeName(AttributeData.Type);

            NameLabel.text = strName;
            var strValue = GameUtils.AttributeValue(AttributeData.Type, AttributeData.Value);

            if (AttributeData.ValueEx > 0)
            {
                var strValueEx = GameUtils.AttributeValue(AttributeData.Type, AttributeData.ValueEx);
                strValue = strValue + "-" + strValueEx;
            }
            ValueLabel.text = strValue;
        }
        private void RefreshAttribute()
        {
            var type  = BaseData.Type;
            var value = BaseData.Value;
            var name  = GameUtils.AttributeName(type);

            if (value > 0)
            {
                var str = GameUtils.GetDictionaryText(230025);
                var att = GameUtils.AttributeValue(type, value);
                str          = String.Format(str, name, att);
                str          = String.Format("[ADFF00]{0}[-]", str);
                NameLab.text = str;
            }
            else
            {
                var str = GameUtils.GetDictionaryText(230028);
                var att = GameUtils.AttributeValue(type, Mathf.Abs(value));
                str          = String.Format(str, name, att);
                str          = String.Format("[FC3737]{0}[-]", str);
                NameLab.text = str;
            }
        }
Beispiel #6
0
    public void RefreshData(UIInitArguments data)
    {
        var arg = data as WingInfogArguments;

        if (arg == null)
        {
            return;
        }
        var itemData = arg.ItemData;

        DataModel.ItemId = itemData.ItemId;
        var tbItem = Table.GetItemBase(itemData.ItemId);

        if (tbItem == null)
        {
            return;
        }
        var dicAttr = new Dictionary <int, int>();
        var attrs   = new List <AttributeBaseDataModel>();
        var tbWing  = Table.GetWingQuality(itemData.ItemId);

        //基础属性
        for (var i = 0; i != tbWing.AddPropID.Length; ++i)
        {
            var nAttrId = tbWing.AddPropID[i];
            if (nAttrId < 0)
            {
                break;
            }
            var nValue = tbWing.AddPropValue[i];
            if (nValue > 0 && nAttrId != -1)
            {
                dicAttr.modifyValue(nAttrId, nValue);
            }
        }
        //培养属性
        for (var i = 0; i != 5; ++i)
        {
            var tbWingTrain = Table.GetWingTrain(itemData.Exdata[1 + i * 2]);
            if (tbWingTrain == null)
            {
                continue;
            }
            for (var j = 0; j != tbWingTrain.AddPropID.Length; ++j)
            {
                var nAttrId = tbWingTrain.AddPropID[j];
                var nValue  = tbWingTrain.AddPropValue[j];
                if (nAttrId < 0 || nValue <= 0)
                {
                    break;
                }
                if (nValue > 0 && nAttrId != -1)
                {
                    if (nAttrId == 105)
                    {
                        if (dicAttr.ContainsKey(5))
                        {
                            dicAttr.modifyValue(5, nValue);
                        }
                        if (dicAttr.ContainsKey(6))
                        {
                            dicAttr.modifyValue(6, nValue);
                        }
                        if (dicAttr.ContainsKey(7))
                        {
                            dicAttr.modifyValue(7, nValue);
                        }
                        if (dicAttr.ContainsKey(8))
                        {
                            dicAttr.modifyValue(8, nValue);
                        }
                    }
                    else
                    {
                        dicAttr.modifyValue(nAttrId, nValue);
                    }
                }
            }
        }
        DataModel.FightPoint = PlayerDataManager.Instance.GetAttrFightPoint(dicAttr, arg.CharLevel);
        {
            // foreach(var i in dicAttr)
            var __enumerator1 = (dicAttr).GetEnumerator();
            while (__enumerator1.MoveNext())
            {
                var i = __enumerator1.Current;
                {
                    var attr = new AttributeBaseDataModel();
                    attr.Type  = i.Key;
                    attr.Value = i.Value;
                    attr.Value = FixAttributeValue(i.Key, attr.Value);
                    attrs.Add(attr);
                }
            }
        }
        //{0}:+{1}
        var strDic230025 = GameUtils.GetDictionaryText(230025);
        //{0}:{1}-{2}
        var strDic230033 = GameUtils.GetDictionaryText(230033);

        for (var i = 0; i < attrs.Count; i++)
        {
            var attr      = attrs[i];
            var attrType  = attr.Type;
            var attrName  = GameUtils.AttributeName(attrType);
            var attrValue = GameUtils.AttributeValue(attrType, attr.Value);
            var str       = "";
            if (attr.ValueEx == 0)
            {
                str = string.Format(strDic230025, attrName, attrValue);
            }
            else
            {
                var attrValueEx = GameUtils.AttributeValue(attrType, attr.ValueEx);
                str = string.Format(strDic230033, attrName, attrValue, attrValueEx);
            }
            DataModel.AttrStr[i] = str;
        }
        for (var i = attrs.Count; i < 15; i++)
        {
            DataModel.AttrStr[i] = "";
        }


        var role = tbItem.OccupationLimit;

        if (role != -1)
        {
            var tbCharacter = Table.GetCharacterBase(role);
            var roleType    = PlayerDataManager.Instance.GetRoleId();
            if (tbCharacter != null)
            {
                if (roleType != role)
                {
                    DataModel.ProfessionColor = MColor.red;
                }
                else
                {
                    DataModel.ProfessionColor = MColor.green;
                }
                DataModel.ProfessionLimit = tbCharacter.Name;
            }
        }
        else
        {
            DataModel.ProfessionLimit = GameUtils.GetDictionaryText(220700);
            DataModel.ProfessionColor = MColor.green;
        }

        var tbEquip = Table.GetEquipBase(tbItem.Exdata[0]);

        if (tbEquip == null)
        {
            return;
        }

        var strDic = GameUtils.GetDictionaryText(230004);

        DataModel.PhaseDesc = string.Format(strDic, GameUtils.NumEntoCh(tbEquip.Ladder));
    }
Beispiel #7
0
        public void RefreshData(UIInitArguments data)
        {
            var _args = data as ElfInfoArguments;

            if (_args.DataModel == null)
            {
                if (_args.ItemId == -1)
                {
                    return;
                }

                var _item = new ElfItemDataModel();
                GameUtils.BuildShowElfExData(_item, _args.ItemId);
                _item.ItemId = _args.ItemId;

                DataModel.ItemData = _item;
            }
            else
            {
                DataModel.ItemData = _args.DataModel;
            }

            var _strDic230025 = GameUtils.GetDictionaryText(230025);
            var _strDic230033 = GameUtils.GetDictionaryText(230033);

            DataModel.ShowBtn = _args.ShowButton;
            var _fightAttr = new Dictionary <int, int>();
            var _tbItem    = Table.GetItemBase(DataModel.ItemData.ItemId);
            var _tbElf     = Table.GetElf(_tbItem.Exdata[0]);
            var _level     = DataModel.ItemData.Exdata.Level;

            for (var i = 0; i < 6; i++)
            {
                var _id    = _tbElf.ElfInitProp[i];
                var _value = _tbElf.ElfProp[i];
                DataModel.BaseAttr[i].Reset();
                if (_id != -1)
                {
                    var _valuelevel = _tbElf.GrowAddValue[i];
                    _value += _valuelevel * (_level - 1);

                    GameUtils.SetAttributeBase(DataModel.BaseAttr, i, _id, _value);
                    //value = GameUtils.EquipAttrValueRef(id, value);
                    _fightAttr.modifyValue(_id, _value);
                }
                else
                {
                    DataModel.BaseAttr[i].Reset();
                }
            }

            for (var i = 0; i < 6; i++)
            {
                var _attr     = DataModel.BaseAttr[i];
                var _attrType = _attr.Type;
                if (_attrType != -1)
                {
                    var _str       = "";
                    var _attrName  = GameUtils.AttributeName(_attrType);
                    var _attrValue = GameUtils.AttributeValue(_attrType, _attr.Value);

                    if (_attr.ValueEx == 0)
                    {
                        _str = string.Format(_strDic230025, _attrName, _attrValue);
                    }
                    else
                    {
                        var _attrValueEx = GameUtils.AttributeValue(_attrType, _attr.ValueEx);
                        _str = string.Format(_strDic230033, _attrName, _attrValue, _attrValueEx);
                    }
                    DataModel.BaseAttrStr[i] = _str;
                }
                else
                {
                    DataModel.BaseAttrStr[i] = "";
                }
            }


            var starLevel = DataModel.ItemData.Exdata.StarLevel;
            var tbElf     = _tbElf;

            for (var i = 0; i < tbElf.StarAttrId.Length; i++)
            {
                if (tbElf.StarAttrId[i] != -1)
                {
                    var id    = tbElf.StarAttrId[i];
                    var value = tbElf.StarAttrValue[i];
                    if (i < starLevel)
                    {
                        GameUtils.SetAttributeBase(DataModel.InnateAttr, i, id, value);
                        _fightAttr.modifyValue(id, value);
                        DataModel.InnateExtra[i]      = GameUtils.GetDictionaryText(100002140);
                        DataModel.InnateExtraColor[i] = "ADFF00";
                    }
                    else
                    {
                        GameUtils.SetAttributeBase(DataModel.InnateAttr, i, id, value);
                        DataModel.InnateExtra[i]      = GameUtils.GetDictionaryText(100002135 + i);;
                        DataModel.InnateExtraColor[i] = "888888";
                    }
                }
                else
                {
                    DataModel.InnateAttr[i].Reset();
                }
            }
            var tbItemBase = Table.GetItemBase(DataModel.ItemData.ItemId);

            if (null != tbItemBase)
            {
                DataModel.FightPoint = tbItemBase.Exdata[3];
            }
            DataModel.HaveBuff = false;
            for (var i = 0; i < DataModel.ElfBuffList.Count; ++i)
            {
                var buffId = DataModel.ItemData.Exdata[(int)ElfExdataDefine.BuffId1 + i * 2];
                DataModel.ElfBuffList[i].BuffId    = buffId;
                DataModel.ElfBuffList[i].BuffLevel = DataModel.ItemData.Exdata[(int)ElfExdataDefine.BuffLevel1 + i * 2];
                if (buffId > 0)
                {
                    DataModel.HaveBuff = true;
                }
            }

            if (DataModel.ItemData.Exdata.Level > PlayerDataManager.Instance.GetLevel())
            {
                DataModel.ItemData.Exdata.Level = 1;
            }

            var _tbLevel = Table.GetLevelData(DataModel.ItemData.Exdata.Level);

            DataModel.SellCount = _tbElf.ResolveCoef[0] * _tbLevel.ElfResolveValue / 100 + _tbElf.ResolveCoef[1];

            var _elfController = UIManager.Instance.GetController(UIConfig.ElfUI);

            for (var i = 0; i < DataModel.SingleGroups.Count; i++)
            {
                var _groupId = _tbElf.BelongGroup[i];
                var _info    = DataModel.SingleGroups[i];
                if (_groupId != -1)
                {
                    var _tbElfGroup = Table.GetElfGroup(_groupId);
                    var _param      = new object[]
                    {
                        _info,
                        _tbElfGroup,
                        DataModel.ItemData.Index,
                        true
                    };
                    _elfController.CallFromOtherClass("SetGroupAttr", _param);
                }
                else
                {
                    _info.Reset();
                }
            }
        }
    public void RefreshData(UIInitArguments data)
    {
        var args = data as EquipInfoArguments;

        if (args == null)
        {
            return;
        }

        var type = args.Type;

        if (mIsInit)
        {
            InitStr();
        }
        var itemId = args.ItemId;
        //int itemId = 304001;
        var tbItem = Table.GetItemBase(itemId);

        if (tbItem == null)
        {
            return;
        }
        DataModel.BuffId = -1;
        var equipId = tbItem.Exdata[0];
        var tbEquip = Table.GetEquipBase(equipId);

        if (tbEquip != null)
        {
            DataModel.BuffLevel = tbEquip.AddBuffSkillLevel;

            if (tbEquip.BuffGroupId >= 0)
            {
                var tbBuffGroup = Table.GetBuffGroup(tbEquip.BuffGroupId);
                if (tbBuffGroup != null && tbBuffGroup.BuffID.Count == 1)
                {
                    DataModel.BuffId = tbBuffGroup.BuffID[0];
                }
                else
                {
                    DataModel.BuffId = 8999;
                }
            }
        }

        if (tbEquip.FIghtNumDesc == -1)
        {
            DataModel.FightNum = "?????";
        }
        else
        {
            DataModel.FightNum = tbEquip.FIghtNumDesc.ToString();
        }

        if (tbEquip == null)
        {
            return;
        }
        DataModel.ItemId        = itemId;
        DataModel.EquipId       = equipId;
        DataModel.EnchanceLevel = 0;
        DataModel.CanUseLevel   = PlayerDataManager.Instance.GetLevel() < tbItem.UseLevel ? 1 : 0;
        //职业符合不?
        if (tbEquip.Occupation != -1)
        {
            DataModel.CanRole = PlayerDataManager.Instance.GetRoleId() == tbEquip.Occupation ? 0 : 1;
        }
        var strDic = GameUtils.GetDictionaryText(230004);

        DataModel.PhaseDesc = string.Format(strDic, GameUtils.NumEntoCh(tbEquip.Ladder));

        strDic = GameUtils.GetDictionaryText(230006);

        for (var i = 0; i != 2; ++i)
        {
            var attrId = tbEquip.NeedAttrId[i];
            if (attrId != -1)
            {
                var attrValue     = tbEquip.NeedAttrValue[i];
                var selfAttrValue = PlayerDataManager.Instance.GetAttribute(attrId);
                var needStr       = string.Format(strDic, GameUtils.AttributeName(attrId), selfAttrValue, attrValue);

                if (selfAttrValue < attrValue)
                {
                    DataModel.NeedAttr[i] = string.Format("[FF0000]{0}[-]", needStr);
                }
                else
                {
                    DataModel.NeedAttr[i] = string.Format("[00FF00]{0}[-]", needStr);
                }
            }
            else
            {
                DataModel.NeedAttr[i] = "";
            }
        }

        var enchanceLevel = DataModel.EnchanceLevel;

        for (var i = 0; i < 4; i++)
        {
            var nAttrId = tbEquip.BaseAttr[i];
            if (nAttrId != -1)
            {
                var baseValue   = tbEquip.BaseValue[i];
                var changeValue = 0;
                if (enchanceLevel > 0)
                {
                    changeValue = GameUtils.GetBaseAttr(tbEquip, enchanceLevel, i, nAttrId) - baseValue;
                }
                GameUtils.SetAttribute(DataModel.BaseAttr, i, nAttrId, baseValue, changeValue);
            }
            else
            {
                DataModel.BaseAttr[i].Reset();
            }
        }
        for (var i = 0; i < 4; i++)
        {
            var attrData = DataModel.BaseAttr[i];
            var nAttrId  = attrData.Type;
            if (nAttrId != -1)
            {
                var attrName  = GameUtils.AttributeName(nAttrId);
                var attrValue = GameUtils.AttributeValue(nAttrId, attrData.Value);

                if (attrData.ValueEx != 0)
                {
                    if (attrData.Change != 0 || attrData.ChangeEx != 0)
                    {
                        var attrValueEx  = GameUtils.AttributeValue(nAttrId, attrData.ValueEx);
                        var attrChange   = GameUtils.AttributeValue(nAttrId, attrData.Change);
                        var attrChangeEx = GameUtils.AttributeValue(nAttrId, attrData.ChangeEx);
                        //rDic = "{0}+:{1}[00ff00](+{2})[-]-{3}[00ff00](+{4})[-]";
                        strDic = StrDic230034;
                        DataModel.BaseAttrStr[i] = string.Format(strDic, attrName, attrValue, attrChange, attrValueEx,
                                                                 attrChangeEx);
                    }
                    else
                    {
                        var attrValueEx = GameUtils.AttributeValue(nAttrId, attrData.ValueEx);
                        //strDic = "{0}+:{1}-{2}";
                        strDic = StrDic230033;
                        DataModel.BaseAttrStr[i] = string.Format(strDic, attrName, attrValue, attrValueEx);
                    }
                }
                else
                {
                    if (attrData.Change != 0 || attrData.ChangeEx != 0)
                    {
                        var attrChange = GameUtils.AttributeValue(nAttrId, attrData.Change);
                        //strDic = "{0}+:{1}[00ff00](+{2})[-]";
                        strDic = StrDic230032;
                        DataModel.BaseAttrStr[i] = string.Format(strDic, attrName, attrValue, attrChange);
                    }
                    else
                    {
                        //strDic = "{0}+:{1}";
                        strDic = StrDic230025;
                        DataModel.BaseAttrStr[i] = string.Format(strDic, attrName, attrValue);
                    }
                }
            }
            else
            {
                DataModel.BaseAttrStr[i] = "";
            }
        }

        strDic = StrDic230025;
        //strDic = "{0}+:{1}";
        for (var i = 0; i != 2; ++i)
        {
            var nAttrId = tbEquip.BaseFixedAttrId[i];
            if (nAttrId != -1)
            {
                var attrName  = GameUtils.AttributeName(nAttrId);
                var attrValue = GameUtils.AttributeValue(nAttrId, tbEquip.BaseFixedAttrValue[i]);
                DataModel.AddAttrStr[i] = string.Format(strDic, attrName, attrValue);
            }
            else
            {
                DataModel.AddAttrStr[i] = "";
            }
        }

        //灵魂、卓越、字符串显示
        DataModel.StrExcellent = "";
        DataModel.StrSoul      = "";
        var min     = 0;
        var minbool = false;
        var max     = 0;

        if (type == 1)
        {
            //取决于材料
            DataModel.StrAppend = GameUtils.GetDictionaryText(300836);
        }
        else
        {
            //随机数值
            if (tbEquip.JingLianDescId == -1)
            {
                DataModel.StrAppend = GameUtils.GetDictionaryText(300837);
            }
            else
            {
                DataModel.StrAppend = tbEquip.JingLianDescId.ToString();
            }
        }


        if (type == 1)
        {
            //取决于材料装备
            DataModel.StrExcellent = GameUtils.GetDictionaryText(300838);
        }
        else
        {
            if (tbEquip.ExcellentAttrCount != -1)
            {
                var tbEquipRalate = Table.GetEquipRelate(tbEquip.ExcellentAttrCount);
                if (tbEquipRalate == null)
                {
                    return;
                }
                for (var i = 0; i < tbEquipRalate.AttrCount.Length; i++)
                {
                    if (tbEquipRalate.AttrCount[i] > 0)
                    {
                        max = i;
                        if (!minbool)
                        {
                            minbool = true;
                            min     = i;
                        }
                    }
                }
                if (min != 0)
                {
                    if (tbEquip.ZhuoYueDescId == -1)
                    {
                        if (min == max)
                        {
                            DataModel.StrExcellent = min + GameUtils.GetDictionaryText(300839); //"条随机属性";
                        }
                        else
                        {
                            DataModel.StrExcellent = string.Format("{0}-{1}" + GameUtils.GetDictionaryText(300839), min, max);
                        }
                        DataModel.ExcellentHeight = 16;
                    }
                    else
                    {
                        DataModel.StrExcellent = GameUtils.GetDictionaryText(tbEquip.ZhuoYueDescId); //"条随机属性";
                        string[] subts = DataModel.StrExcellent.Split('\n');
                        DataModel.ExcellentHeight = (subts.Length) * 16;
                    }
                }
            }
        }


        if (type == 1)
        {
            DataModel.StrSoul = GameUtils.GetDictionaryText(300840);
        }
        else
        {
            if (tbEquip.RandomAttrCount != -1)
            {
                var tbEquipRalate = Table.GetEquipRelate(tbEquip.RandomAttrCount);
                if (tbEquipRalate == null)
                {
                    return;
                }
                min     = 0;
                minbool = false;
                max     = 0;
                for (var i = 0; i < tbEquipRalate.AttrCount.Length; i++)
                {
                    if (tbEquipRalate.AttrCount[i] > 0)
                    {
                        max = i;
                        if (!minbool)
                        {
                            minbool = true;
                            min     = i;
                        }
                    }
                }
                if (min != 0)
                {
                    if (tbEquip.LingHunDescId == -1)
                    {
                        if (min == max)
                        {
                            DataModel.StrSoul = min + GameUtils.GetDictionaryText(300839); //"条随机属性";
                        }
                        else
                        {
                            DataModel.StrSoul = string.Format("{0}-{1}" + GameUtils.GetDictionaryText(300839), min, max);
                        }
                        DataModel.SouleHeight = 16;
                    }
                    else
                    {
                        DataModel.StrSoul = GameUtils.GetDictionaryText(tbEquip.LingHunDescId); //"条随机属性";
                        string[] subts = DataModel.StrExcellent.Split('\n');
                        DataModel.SouleHeight = (subts.Length) * 16;
                    }
                }
            }
        }


        //套装相关
        for (var i = 0; i < 10; i++)
        {
            DataModel.TieCount[i] = 0;
        }
        DataModel.TieId = tbEquip.TieId;
        var nNowTieCount = 0;

        for (var i = 0; i != 4; ++i)
        {
            DataModel.TieAttrCount[i] = 0;
        }

        if (tbEquip.TieId == -1)
        {
            return;
        }
        var tbTie = Table.GetEquipTie(tbEquip.TieId);

        if (tbTie == null)
        {
            return;
        }

        PlayerDataManager.Instance.ForeachEquip(item =>
        {
            var ItemId = item.ItemId;
            if (ItemId == -1)
            {
                return;
            }
            var tbTieItem = Table.GetItemBase(ItemId);
            if (tbTieItem == null)
            {
                return;
            }
            var tbTieEquip = Table.GetEquipBase(tbTieItem.Exdata[0]);
            if (tbTieEquip == null)
            {
                return;
            }
            if (tbEquip.TieId == tbTieEquip.TieId)
            {
                DataModel.TieCount[tbTieEquip.TieIndex] = 1;
                nNowTieCount++;
            }
        });

        DataModel.TieNowCount = nNowTieCount;
        for (var i = 0; i != 4; ++i)
        {
            if (nNowTieCount >= tbTie.NeedCount[i])
            {
                DataModel.TieAttrCount[i] = 1;
            }
        }
    }
Beispiel #9
0
        private void EquipInFo(int itemId)
        {
            if (mIsInit)
            {
                InitStr();
            }

            var tbItem = Table.GetItemBase(itemId);

            if (tbItem == null)
            {
                return;
            }
            InfoDatamodel.BuffId = -1;
            var equipId = tbItem.Exdata[0];
            var tbEquip = Table.GetEquipBase(equipId);

            if (tbEquip != null)
            {
                InfoDatamodel.BuffLevel = tbEquip.AddBuffSkillLevel;

                if (tbEquip.BuffGroupId >= 0)
                {
                    var tbBuffGroup = Table.GetBuffGroup(tbEquip.BuffGroupId);
                    if (tbBuffGroup != null && tbBuffGroup.BuffID.Count == 1)
                    {
                        InfoDatamodel.BuffId = tbBuffGroup.BuffID[0];
                    }
                    else
                    {
                        InfoDatamodel.BuffId = 8999;
                    }
                }
            }

            if (tbEquip.FIghtNumDesc == -1)
            {
                InfoDatamodel.FightNum = "?????";
            }
            else
            {
                InfoDatamodel.FightNum = tbEquip.FIghtNumDesc.ToString();
            }

            if (tbEquip == null)
            {
                return;
            }
            InfoDatamodel.ItemId        = itemId;
            InfoDatamodel.EquipId       = equipId;
            InfoDatamodel.EnchanceLevel = 0;


            InfoDatamodel.CanUseLevel = PlayerDataManager.Instance.GetLevel() < tbItem.UseLevel ? 1 : 0;
            //职业符合不?
            if (tbEquip.Occupation != -1)
            {
                InfoDatamodel.CanRole = PlayerDataManager.Instance.GetRoleId() == tbEquip.Occupation ? 0 : 1;
            }
            var strDic = GameUtils.GetDictionaryText(230004);

            InfoDatamodel.PhaseDesc = string.Format(strDic, GameUtils.NumEntoCh(tbEquip.Ladder));

            strDic = GameUtils.GetDictionaryText(230006);

            for (var i = 0; i != 2; ++i)
            {
                var attrId = tbEquip.NeedAttrId[i];
                if (attrId != -1)
                {
                    var attrValue     = tbEquip.NeedAttrValue[i];
                    var selfAttrValue = PlayerDataManager.Instance.GetAttribute(attrId);
                    var needStr       = string.Format(strDic, GameUtils.AttributeName(attrId), selfAttrValue, attrValue);

                    if (selfAttrValue < attrValue)
                    {
                        InfoDatamodel.NeedAttr[i] = string.Format("[FF0000]{0}[-]", needStr);
                    }
                    else
                    {
                        InfoDatamodel.NeedAttr[i] = string.Format("[00FF00]{0}[-]", needStr);
                    }
                }
                else
                {
                    InfoDatamodel.NeedAttr[i] = "";
                }
            }

            var enchanceLevel = InfoDatamodel.EnchanceLevel;

            for (var i = 0; i < 4; i++)
            {
                var nAttrId = tbEquip.BaseAttr[i];
                if (nAttrId != -1)
                {
                    var baseValue   = tbEquip.BaseValue[i];
                    var changeValue = 0;
                    if (enchanceLevel > 0)
                    {
                        changeValue = GameUtils.GetBaseAttr(tbEquip, enchanceLevel, i, nAttrId) - baseValue;
                    }
                    GameUtils.SetAttribute(InfoDatamodel.BaseAttr, i, nAttrId, baseValue, changeValue);
                }
                else
                {
                    InfoDatamodel.BaseAttr[i].Reset();
                }
            }
            for (var i = 0; i < 4; i++)
            {
                var attrData = InfoDatamodel.BaseAttr[i];
                var nAttrId  = attrData.Type;
                if (nAttrId != -1)
                {
                    var attrName  = GameUtils.AttributeName(nAttrId);
                    var attrValue = GameUtils.AttributeValue(nAttrId, attrData.Value);

                    if (attrData.ValueEx != 0)
                    {
                        if (attrData.Change != 0 || attrData.ChangeEx != 0)
                        {
                            var attrValueEx  = GameUtils.AttributeValue(nAttrId, attrData.ValueEx);
                            var attrChange   = GameUtils.AttributeValue(nAttrId, attrData.Change);
                            var attrChangeEx = GameUtils.AttributeValue(nAttrId, attrData.ChangeEx);
                            //rDic = "{0}+:{1}[00ff00](+{2})[-]-{3}[00ff00](+{4})[-]";
                            strDic = StrDic230034;
                            InfoDatamodel.BaseAttrStr[i] = string.Format(strDic, attrName, attrValue, attrChange, attrValueEx,
                                                                         attrChangeEx);
                        }
                        else
                        {
                            var attrValueEx = GameUtils.AttributeValue(nAttrId, attrData.ValueEx);
                            //strDic = "{0}+:{1}-{2}";
                            strDic = StrDic230033;
                            InfoDatamodel.BaseAttrStr[i] = string.Format(strDic, attrName, attrValue, attrValueEx);
                        }
                    }
                    else
                    {
                        if (attrData.Change != 0 || attrData.ChangeEx != 0)
                        {
                            var attrChange = GameUtils.AttributeValue(nAttrId, attrData.Change);
                            //strDic = "{0}+:{1}[00ff00](+{2})[-]";
                            strDic = StrDic230032;
                            InfoDatamodel.BaseAttrStr[i] = string.Format(strDic, attrName, attrValue, attrChange);
                        }
                        else
                        {
                            //strDic = "{0}+:{1}";
                            strDic = StrDic230025;
                            InfoDatamodel.BaseAttrStr[i] = string.Format(strDic, attrName, attrValue);
                        }
                    }
                }
                else
                {
                    InfoDatamodel.BaseAttrStr[i] = "";
                }
            }

            strDic = StrDic230025;
            //strDic = "{0}+:{1}";
            for (var i = 0; i != 2; ++i)
            {
                var nAttrId = tbEquip.BaseFixedAttrId[i];
                if (nAttrId != -1)
                {
                    var attrName  = GameUtils.AttributeName(nAttrId);
                    var attrValue = GameUtils.AttributeValue(nAttrId, tbEquip.BaseFixedAttrValue[i]);
                    InfoDatamodel.AddAttrStr[i] = string.Format(strDic, attrName, attrValue);
                }
                else
                {
                    InfoDatamodel.AddAttrStr[i] = "";
                }
            }

            //灵魂、卓越、字符串显示
            InfoDatamodel.StrExcellent = "";
            InfoDatamodel.StrSoul      = "";
            var min     = 0;
            var minbool = false;
            var max     = 0;

            if (tbEquip.RandomAttrCount != -1)
            {
                var tbEquipRalate = Table.GetEquipRelate(tbEquip.RandomAttrCount);
                if (tbEquipRalate == null)
                {
                    return;
                }
                min     = 0;
                minbool = false;
                max     = 0;
                for (var i = 0; i < tbEquipRalate.AttrCount.Length; i++)
                {
                    if (tbEquipRalate.AttrCount[i] > 0)
                    {
                        max = i;
                        if (!minbool)
                        {
                            minbool = true;
                            min     = i;
                        }
                    }
                }
                if (min != 0)
                {
                    if (tbEquip.LingHunDescId == -1)
                    {
                        if (min == max)
                        {
                            InfoDatamodel.StrSoul = min + GameUtils.GetDictionaryText(300839); //"条随机属性";
                        }
                        else
                        {
                            InfoDatamodel.StrSoul = string.Format("{0}-{1}" + GameUtils.GetDictionaryText(300839), min, max);
                        }
                        InfoDatamodel.SouleHeight = 16;
                    }
                    else
                    {
                        //InfoDatamodel.StrSoul = GameUtils.GetDictionaryText(tbEquip.LingHunDescId); //"条随机属性";
                        //string[] subts = InfoDatamodel.StrExcellent.Split('\n');
                        //InfoDatamodel.SouleHeight = (subts.Length) * 16;

                        var      i     = 0;
                        var      str   = GameUtils.GetDictionaryText(tbEquip.LingHunDescId); //"条随机属性";
                        string[] subts = str.Split('\n');
                        foreach (var item in subts)
                        {
                            InfoDatamodel.MaYaAttr[i] = item;
                            i++;
                        }
                    }
                }
            }
        }
    public void RefreshItemDataModel()
    {
        var itemData = DataModel.ItemData;
        var tbItem   = Table.GetItemBase(itemData.ItemId);

        DataModel.EquipId = tbItem.Exdata[0];
        var tbEquip = Table.GetEquipBase(DataModel.EquipId);

        if (tbEquip == null)
        {
            return;
        }

        var strDic = GameUtils.GetDictionaryText(230004);

        DataModel.PhaseDesc = string.Format(strDic, GameUtils.NumEntoCh(tbEquip.Ladder));

        strDic = GameUtils.GetDictionaryText(230006);
        for (var i = 0; i != 2; ++i)
        {
            var attrId = tbEquip.NeedAttrId[i];
            if (attrId != -1)
            {
                var attrValue     = tbEquip.NeedAttrValue[i];
                var selfAttrValue = PlayerDataManager.Instance.GetAttribute(attrId);
                var needStr       = string.Format(strDic, GameUtils.AttributeName(attrId), selfAttrValue, attrValue);

                if (selfAttrValue < attrValue)
                {
                    DataModel.NeedAttr[i] = string.Format("[FC3737]{0}[-]", needStr);
                }
                else
                {
                    DataModel.NeedAttr[i] = string.Format("[ADFF00]{0}[-]", needStr);
                }
            }
            else
            {
                DataModel.NeedAttr[i] = "";
            }
        }

        var enchanceLevel = itemData.Exdata[0];

        for (var i = 0; i < 4; i++)
        {
            var nAttrId = tbEquip.BaseAttr[i];
            if (nAttrId != -1)
            {
                var baseValue   = tbEquip.BaseValue[i];
                var changeValue = 0;
                if (enchanceLevel > 0)
                {
                    changeValue = GameUtils.GetBaseAttr(tbEquip, enchanceLevel, i, nAttrId) - baseValue;
                }
                GameUtils.SetAttribute(DataModel.BaseAttr, i, nAttrId, baseValue, changeValue);
            }
            else
            {
                DataModel.BaseAttr[i].Reset();
            }
        }


        for (var i = 0; i < 4; i++)
        {
            var attrData = DataModel.BaseAttr[i];
            var nAttrId  = attrData.Type;
            if (nAttrId != -1)
            {
                var attrName  = GameUtils.AttributeName(nAttrId);
                var attrValue = GameUtils.AttributeValue(nAttrId, attrData.Value);

                if (attrData.ValueEx != 0)
                {
                    if (attrData.Change != 0 || attrData.ChangeEx != 0)
                    {
                        var attrValueEx  = GameUtils.AttributeValue(nAttrId, attrData.ValueEx);
                        var attrChange   = GameUtils.AttributeValue(nAttrId, attrData.Change);
                        var attrChangeEx = GameUtils.AttributeValue(nAttrId, attrData.ChangeEx);
                        strDic = StrDic230034;
                        DataModel.BaseAttrStr[i] = string.Format(strDic, attrName, attrValue, attrChange, attrValueEx,
                                                                 attrChangeEx);
                    }
                    else
                    {
                        var attrValueEx = GameUtils.AttributeValue(nAttrId, attrData.ValueEx);
                        strDic = StrDic230033;
                        DataModel.BaseAttrStr[i] = string.Format(strDic, attrName, attrValue, attrValueEx);
                    }
                }
                else
                {
                    if (attrData.Change != 0 || attrData.ChangeEx != 0)
                    {
                        var attrChange = GameUtils.AttributeValue(nAttrId, attrData.Change);
                        strDic = StrDic230032;
                        DataModel.BaseAttrStr[i] = string.Format(strDic, attrName, attrValue, attrChange);
                    }
                    else
                    {
                        strDic = StrDic230025;
                        DataModel.BaseAttrStr[i] = string.Format(strDic, attrName, attrValue);
                    }
                }
            }
            else
            {
                DataModel.BaseAttrStr[i] = "";
            }
        }


        strDic = StrDic230025;
        for (var i = 0; i != 2; ++i)
        {
            var nAttrId = tbEquip.BaseFixedAttrId[i];
            if (nAttrId != -1)
            {
                var attrName  = GameUtils.AttributeName(nAttrId);
                var attrValue = GameUtils.AttributeValue(nAttrId, tbEquip.BaseFixedAttrValue[i]);
                DataModel.AddAttrStr[i] = string.Format(strDic, attrName, attrValue);
            }
            else
            {
                DataModel.AddAttrStr[i] = "";
            }
        }

        strDic = StrDic230025;

        for (var i = 0; i < 4; i++)
        {
            var nAttrId    = tbEquip.ExcellentAttrId[i];
            var nAttrValue = itemData.Exdata[i + 2];
            if (nAttrId != -1 && nAttrValue != 0)
            {
                var attrName  = GameUtils.AttributeName(nAttrId);
                var attrValue = GameUtils.AttributeValue(nAttrId, nAttrValue);
                DataModel.ExcellentAttrStr[i] = string.Format(strDic, attrName, attrValue);
            }
            else
            {
                DataModel.ExcellentAttrStr[i] = "";
            }
        }

        for (var i = 0; i < 6; i++)
        {
            var nAttrId    = itemData.Exdata[i + 6];
            var nAttrValue = itemData.Exdata[i + 12];
            if (nAttrId != -1 && nAttrValue != 0)
            {
                var attrName  = GameUtils.AttributeName(nAttrId);
                var attrValue = GameUtils.AttributeValue(nAttrId, nAttrValue * 100);
                DataModel.SupperAttrStr[i] = string.Format(strDic, attrName, attrValue);
            }
            else
            {
                DataModel.SupperAttrStr[i] = "";
            }
        }
    }
Beispiel #11
0
    public void RefreshData(UIInitArguments data)
    {
        var args = data as ElfInfoArguments;

        if (args.DataModel == null)
        {
            if (args.ItemId == -1)
            {
                return;
            }
            var item = new ElfItemDataModel();
            item.Exdata.InstallData(new List <int> {
                1
            });
            item.ItemId            = args.ItemId;
            DataModel.ItemData     = item;
            DataModel.IsShowSimple = 1;
        }
        else
        {
            DataModel.ItemData     = args.DataModel;
            DataModel.IsShowSimple = 0;
        }

        var strDic230025 = GameUtils.GetDictionaryText(230025);
        var strDic230033 = GameUtils.GetDictionaryText(230033);

        DataModel.ShowBtn = args.ShowButton;
        var fightAttr = new Dictionary <int, int>();
        var tbItem    = Table.GetItemBase(DataModel.ItemData.ItemId);
        var tbElf     = Table.GetElf(tbItem.Exdata[0]);
        var tbAttrRef = Table.GetAttrRef(tbElf.Id);
        var level     = DataModel.ItemData.Exdata.Level;

        for (var i = 0; i < 6; i++)
        {
            var id    = tbElf.ElfInitProp[i];
            var value = tbElf.ElfProp[i];
            DataModel.BaseAttr[i].Reset();
            if (id != -1)
            {
                var valuelevel = tbElf.GrowAddValue[i];
                value += valuelevel * (level - 1);

                GameUtils.SetAttributeBase(DataModel.BaseAttr, i, id, value);
                //value = GameUtils.EquipAttrValueRef(id, value);
                fightAttr.modifyValue(id, value);
            }
            else
            {
                DataModel.BaseAttr[i].Reset();
            }
        }

        for (var i = 0; i < 6; i++)
        {
            var attr     = DataModel.BaseAttr[i];
            var attrType = attr.Type;
            if (attrType != -1)
            {
                var str       = "";
                var attrName  = GameUtils.AttributeName(attrType);
                var attrValue = GameUtils.AttributeValue(attrType, attr.Value);

                if (attr.ValueEx == 0)
                {
                    str = string.Format(strDic230025, attrName, attrValue);
                }
                else
                {
                    var attrValueEx = GameUtils.AttributeValue(attrType, attr.ValueEx);
                    str = string.Format(strDic230033, attrName, attrValue, attrValueEx);
                }
                DataModel.BaseAttrStr[i] = str;
            }
            else
            {
                DataModel.BaseAttrStr[i] = "";
            }
        }

        if (DataModel.IsShowSimple != 1)
        {
            for (var i = 0; i < 6; i++)
            {
                var id    = DataModel.ItemData.Exdata[i + 2];
                var value = DataModel.ItemData.Exdata[i + 8];
                if (id != -1 && value > 0)
                {
                    GameUtils.SetAttributeBase(DataModel.InnateAttr, i, id, value);

                    //value = GameUtils.EquipAttrValueRef(id, value);
                    fightAttr.modifyValue(id, value);
                }
                else
                {
                    DataModel.InnateAttr[i].Reset();
                }
            }
            for (var i = 0; i < 6; i++)
            {
                var attr     = DataModel.InnateAttr[i];
                var attrType = attr.Type;
                if (attrType != -1)
                {
                    var str       = "";
                    var attrName  = GameUtils.AttributeName(attrType);
                    var attrValue = GameUtils.AttributeValue(attrType, attr.Value);

                    if (attr.ValueEx == 0)
                    {
                        str = string.Format(strDic230025, attrName, attrValue);
                    }
                    else
                    {
                        var attrValueEx = GameUtils.AttributeValue(attrType, attr.ValueEx);
                        str = string.Format(strDic230033, attrName, attrValue, attrValueEx);
                    }
                    DataModel.InnateAttrStr[i] = str;
                }
                else
                {
                    DataModel.InnateAttrStr[i] = "";
                }
            }
            DataModel.FightPoint = PlayerDataManager.Instance.GetElfAttrFightPoint(fightAttr, args.CharLevel, -2);
        }

        var tbLevel = Table.GetLevelData(DataModel.ItemData.Exdata.Level);

        DataModel.SellCount = tbElf.ResolveCoef[0] * tbLevel.ElfResolveValue / 100 + tbElf.ResolveCoef[1];

        var elfController = UIManager.Instance.GetController(UIConfig.ElfUI);

        for (var i = 0; i < DataModel.SingleGroups.Count; i++)
        {
            var groupId = tbElf.BelongGroup[i];
            var info    = DataModel.SingleGroups[i];
            if (groupId != -1)
            {
                var tbElfGroup = Table.GetElfGroup(groupId);
                var param      = new object[]
                {
                    info,
                    tbElfGroup,
                    DataModel.ItemData.Index,
                    true
                };
                elfController.CallFromOtherClass("SetGroupAttr", param);
            }
            else
            {
                info.Reset();
            }
        }
    }