예제 #1
0
    /// <summary>
    /// 获取属性的显示
    /// </summary>
    public static string GetAttributeWithStrengthValue(List <AttributePair> attrList, EquipmentInfo info)
    {
        StringBuilder builder = new StringBuilder();
        string        atkStr  = ConfigMng.Instance.GetUItext(266);
        string        defStr  = ConfigMng.Instance.GetUItext(267);
        bool          haveAtk = false;
        bool          haveDef = false;

        for (int i = 0, max = attrList.Count; i < max; i++)
        {
            AttributePair attr = attrList[i];
            switch (attr.tag)
            {
            case ActorPropertyTag.ATKUP:
                atkStr  = atkStr.Replace("#1", attr.value.ToString());
                haveAtk = true;
                break;

            case ActorPropertyTag.ATKDOWN:
                atkStr  = atkStr.Replace("#0", attr.value.ToString());
                haveAtk = true;
                break;

            case ActorPropertyTag.DEFUP:
                defStr  = defStr.Replace("#1", attr.value.ToString());
                haveDef = true;
                break;

            case ActorPropertyTag.DEFDOWN:
                defStr  = defStr.Replace("#0", attr.value.ToString());
                haveDef = true;
                break;

            default:
                builder.Append(ConfigMng.Instance.GetAttributeTypeName(attr.tag));
                builder.Append(":").Append(attr.value);
                int upgradeVal = info.GetStrengthValueByTag(attr.tag);
                if (upgradeVal != 0)
                {
                    builder.Append("    [00ff00]+").Append(upgradeVal).Append("[-]");
                }
                if (i < max - 1 || haveAtk || haveDef)
                {
                    builder.Append("\n");
                }
                break;
            }
        }
        int atk = info.GetStrengthValueByTag(ActorPropertyTag.ATK);
        int def = info.GetStrengthValueByTag(ActorPropertyTag.DEF);

        if (haveAtk)
        {
            builder.Append(atkStr);
        }
        if (atk != 0)
        {
            builder.Append("    [00ff00]+").Append(atk).Append("[-]");
        }
        if (haveDef)
        {
            builder.Append(defStr);
        }
        if (def != 0)
        {
            builder.Append("    [00ff00]+").Append(def).Append("[-]");
        }
        return(builder.ToString());
    }