示例#1
0
        /// <summary>
        /// 饰品传奇属性描述
        /// </summary>
        /// <param name="equip"></param>
        /// <returns></returns>
        public static string GetDecorateLegendAttrStr(GoodsDecorate decorate)
        {
            if (decorate == null && decorate.LegendAttrs == null)
            {
                return(string.Empty);
            }

            List <KeyValuePair <string, uint> > strColorPairs = new List <KeyValuePair <string, uint> >();

            strColorPairs.Clear();
            foreach (var kv in decorate.LegendAttrs)
            {
                uint   color = 0;
                string des   = EquipHelper.GetSubAttrDes(kv.Id, kv.Values, " +", out color);
                KeyValuePair <string, uint> strColorPair = new KeyValuePair <string, uint>(des, color);
                strColorPairs.Add(strColorPair);
            }

            string str = string.Empty;

            strColorPairs.Sort((a, b) =>
            {
                if (a.Value > b.Value)
                {
                    return(-1);
                }
                else if (a.Value < b.Value)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });

            foreach (KeyValuePair <string, uint> strColorPair in strColorPairs)
            {
                str += strColorPair.Key + "\n";
            }

            if (str.Length > 0)
            {
                str = str.Substring(0, str.Length - 1);
            }

            return(str);
        }
示例#2
0
        /// <summary>
        /// 获取EquipAttributers结构属性描述字符串
        /// </summary>
        public static string GetEquipAttributesString(EquipAttributes attrs)
        {
            List <KeyValuePair <string, uint> > strColorPairs = new List <KeyValuePair <string, uint> >();

            strColorPairs.Clear();

            foreach (var kv in attrs)
            {
                uint   color = 0;
                string des   = EquipHelper.GetSubAttrDes(kv.Id, kv.Values, " +", out color);
                KeyValuePair <string, uint> strColorPair = new KeyValuePair <string, uint>(des, color);
                strColorPairs.Add(strColorPair);
            }

            string str = string.Empty;

            strColorPairs.Sort((a, b) =>
            {
                if (a.Value > b.Value)
                {
                    return(-1);
                }
                else if (a.Value < b.Value)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            });

            foreach (KeyValuePair <string, uint> strColorPair in strColorPairs)
            {
                str += strColorPair.Key + "\n";
            }

            if (str.Length > 0)
            {
                str = str.Substring(0, str.Length - 1);
            }

            return(str);
        }