示例#1
0
    public void ShowRoleInfo(RoleBase role, RoleInfoType type = RoleInfoType.Pre)
    {
        if (role == null)
        {
            return;
        }

        int level             = role.GetLevel();
        var attributeData     = DataClass.ConfigAttributeManager.Instance().allDatas;
        var roleAttributeData = DataClass.ConfigRoleManager.Instance().allDatas[role.GetRoleId()].attributes[level - 1];
        var attributeSb       = new System.Text.StringBuilder();

        if (type == RoleInfoType.Pre)
        {
            for (int i = 0; i < 7; i++)
            {
                float nowValue = role.attributes[i];   //当前属性
                int   orValue  = roleAttributeData[i]; //原属性

                if (nowValue > orValue)
                {
                    attributeSb.Append($"{attributeData[i].name}:<color=yellow>{nowValue.ToString()}</color>  ");
                }
                else
                {
                    attributeSb.Append($"{attributeData[i].name}:{nowValue.ToString()}  ");
                }
            }
        }
        else
        {
            for (int i = 0; i < 5; i++)
            {
                float nowValue = role.attributes[i];   //当前属性
                int   orValue  = roleAttributeData[i]; //原属性

                if (nowValue > orValue)
                {
                    attributeSb.Append($"{attributeData[i].name}:<color=yellow>{nowValue.ToString()}</color>  ");
                }
                else
                {
                    attributeSb.Append($"{attributeData[i].name}:{nowValue.ToString()}  ");
                }
            }

            attributeSb.Append($"{attributeData[5].name}:{role.attributes[7].ToString()}/{role.attributes[5].ToString()} {attributeData[6].name}:{role.attributes[8].ToString()}/{role.attributes[6].ToString()}");
        }


        string cooperName   = DataClass.ConfigCooperationManager.Instance().allDatas[role.GetCooperId()].name;
        string proName      = DataClass.ConfigProfessionManager.Instance().allDatas[role.GetProId()].name;
        string equipContent = $"{role.GetEquip(0)?.desc}\n{role.GetEquip(1)?.desc}";

        string content = $"<size=50><color={ConstConfig.levelColor[role.cost]}>{role.name}</color></size>\n<color={ConstConfig.typeColor}>等级:{level.ToString()}【{cooperName}】 【{proName}】</color>\n\n{attributeSb.ToString()} {role.ShowMissCirtInfo()}\n<color={ConstConfig.skillColor}>{role.skill?.GetDesc()}</color>\n{equipContent}";

        ShowInfo(content);
    }