yyl
2025-05-19 b118ece3db250a5a257b60713da92234d8d5a57a
Main/Utility/UIHelper.cs
@@ -287,8 +287,9 @@
            case PropertyType.AtkPercent:
            case PropertyType.CritHurtPercent:
            case PropertyType.DodgePercent:
                return (ulong)ModelCenter.Instance.GetModel<ReikiRootModel>().GetReikiPropertyValue((int)type);
                // return (ulong)ModelCenter.Instance.GetModel<ReikiRootModel>().GetReikiPropertyValue((int)type);
                // TODO YYL
                return 0ul;
            case PropertyType.SkillAddPerA:
                return (ulong)PlayerDatas.Instance.baseData.skillAddPerA;
            case PropertyType.SkillAddPerB:
@@ -539,59 +540,59 @@
    public static readonly Color s_GrayDanLV5 = new Color32(255, 0, 0, 255); //ff0000
    public static readonly Color s_GrayDanLV6 = new Color32(240, 0, 255, 255); //f000ff
    public static Color GetDanLVColor(int danLv, bool bright = false)
    {
        var crossDanLVConfig = CrossServerArenaConfig.Get(danLv);
        if (crossDanLVConfig != null)
        {
            switch (crossDanLVConfig.DanType)
            {
                case 0:
                    return bright ? s_BrightDanLV0 : s_GrayDanLV0;
                case 1:
                    return bright ? s_BrightDanLV1 : s_GrayDanLV1;
                case 2:
                    return bright ? s_BrightDanLV2 : s_GrayDanLV2;
                case 3:
                    return bright ? s_BrightDanLV3 : s_GrayDanLV3;
                case 4:
                    return bright ? s_BrightDanLV4 : s_GrayDanLV4;
                case 5:
                    return bright ? s_BrightDanLV5 : s_GrayDanLV5;
                case 6:
                    return bright ? s_BrightDanLV6 : s_GrayDanLV6;
            }
        }
        return Color.white;
    }
    // public static Color GetDanLVColor(int danLv, bool bright = false)
    // {
    //     var crossDanLVConfig = CrossServerArenaConfig.Get(danLv);
    //     if (crossDanLVConfig != null)
    //     {
    //         switch (crossDanLVConfig.DanType)
    //         {
    //             case 0:
    //                 return bright ? s_BrightDanLV0 : s_GrayDanLV0;
    //             case 1:
    //                 return bright ? s_BrightDanLV1 : s_GrayDanLV1;
    //             case 2:
    //                 return bright ? s_BrightDanLV2 : s_GrayDanLV2;
    //             case 3:
    //                 return bright ? s_BrightDanLV3 : s_GrayDanLV3;
    //             case 4:
    //                 return bright ? s_BrightDanLV4 : s_GrayDanLV4;
    //             case 5:
    //                 return bright ? s_BrightDanLV5 : s_GrayDanLV5;
    //             case 6:
    //                 return bright ? s_BrightDanLV6 : s_GrayDanLV6;
    //         }
    //     }
    //     return Color.white;
    // }
    public static string AppendDanLVNameColor(int danLv, bool bright = false)
    {
        var crossDanLVConfig = CrossServerArenaConfig.Get(danLv);
        if (crossDanLVConfig == null)
        {
            return string.Empty;
        }
        var name = crossDanLVConfig.Name;
        switch (crossDanLVConfig.DanType)
        {
            case 0:
                return StringUtility.Contact("<color=#", bright ? "666666" : "dddddd", ">", name, "</color>");
            case 1:
                return StringUtility.Contact("<color=#", bright ? "9460ff" : "7999ff", ">", name, "</color>");
            case 2:
                return StringUtility.Contact("<color=#", bright ? "0066ff" : "00c6ff", ">", name, "</color>");
            case 3:
                return StringUtility.Contact("<color=#", bright ? "00b337" : "66ff00", ">", name, "</color>");
            case 4:
                return StringUtility.Contact("<color=#", bright ? "ff6600" : "ff9000", ">", name, "</color>");
            case 5:
                return StringUtility.Contact("<color=#", bright ? "ff0000" : "ff0000", ">", name, "</color>");
            case 6:
                return StringUtility.Contact("<color=#", bright ? "ff00f6" : "f000ff", ">", name, "</color>");
        }
        return name;
    }
    // public static string AppendDanLVNameColor(int danLv, bool bright = false)
    // {
    //     var crossDanLVConfig = CrossServerArenaConfig.Get(danLv);
    //     if (crossDanLVConfig == null)
    //     {
    //         return string.Empty;
    //     }
    //     var name = crossDanLVConfig.Name;
    //     switch (crossDanLVConfig.DanType)
    //     {
    //         case 0:
    //             return StringUtility.Contact("<color=#", bright ? "666666" : "dddddd", ">", name, "</color>");
    //         case 1:
    //             return StringUtility.Contact("<color=#", bright ? "9460ff" : "7999ff", ">", name, "</color>");
    //         case 2:
    //             return StringUtility.Contact("<color=#", bright ? "0066ff" : "00c6ff", ">", name, "</color>");
    //         case 3:
    //             return StringUtility.Contact("<color=#", bright ? "00b337" : "66ff00", ">", name, "</color>");
    //         case 4:
    //             return StringUtility.Contact("<color=#", bright ? "ff6600" : "ff9000", ">", name, "</color>");
    //         case 5:
    //             return StringUtility.Contact("<color=#", bright ? "ff0000" : "ff0000", ">", name, "</color>");
    //         case 6:
    //             return StringUtility.Contact("<color=#", bright ? "ff00f6" : "f000ff", ">", name, "</color>");
    //     }
    //     return name;
    // }
    public static Color GetUIColor(int itemColor, bool bright = false)
    {
@@ -700,61 +701,61 @@
    }
    //needName 指境界0是否需要名称
    public static string GetRealmName(int realmLv, bool bright = false, bool needName = false)
    {
        if (realmLv <= 0 && !needName)
        {
            return string.Empty;
        }
        var config = RealmConfig.Get(realmLv);
        if (config == null)
        {
            return string.Empty;
        }
        return GetRealmColorByLv(realmLv, config.Name, bright);
    }
    // public static string GetRealmName(int realmLv, bool bright = false, bool needName = false)
    // {
    //     if (realmLv <= 0 && !needName)
    //     {
    //         return string.Empty;
    //     }
    //     var config = RealmConfig.Get(realmLv);
    //     if (config == null)
    //     {
    //         return string.Empty;
    //     }
    //     return GetRealmColorByLv(realmLv, config.Name, bright);
    // }
    //strFormat附加 境界名以外的文字
    //needName 指境界0是否需要名称
    public static string GetRealmNameEx(int realmLv, string strFormat, bool bright = false, bool needName = false)
    {
        if (realmLv <= 0 && !needName)
        {
            return string.Empty;
        }
        var config = RealmConfig.Get(realmLv);
        if (config == null)
        {
            return string.Empty;
        }
        return GetRealmColorByLv(realmLv, string.Format(strFormat, config.Name), bright);
    }
    // public static string GetRealmNameEx(int realmLv, string strFormat, bool bright = false, bool needName = false)
    // {
    //     if (realmLv <= 0 && !needName)
    //     {
    //         return string.Empty;
    //     }
    //     var config = RealmConfig.Get(realmLv);
    //     if (config == null)
    //     {
    //         return string.Empty;
    //     }
    //     return GetRealmColorByLv(realmLv, string.Format(strFormat, config.Name), bright);
    // }
    public static string GetRealmColorByLv(int realmLv, string msg, bool bright = false)
    {
        var config = RealmConfig.Get(realmLv);
        if (config == null)
        {
            return string.Empty;
        }
        switch (config.Quality)
        {
            case 1:
                return StringUtility.Contact("<color=#", bright ? "666666" : "dddddd", ">", msg, "</color>");
            case 2:
                return StringUtility.Contact("<color=#", bright ? "00b337" : "66ff00", ">", msg, "</color>");
            case 3:
                return StringUtility.Contact("<color=#", bright ? "0066ff" : "00c6ff", ">", msg, "</color>");
            case 4:
                return StringUtility.Contact("<color=#", bright ? "ff00f6" : "f000ff", ">", msg, "</color>");
            case 5:
                return StringUtility.Contact("<color=#", bright ? "ff6600" : "ff9000", ">", msg, "</color>");
            case 6:
                return StringUtility.Contact("<color=#", bright ? "ff0000" : "ff0000", ">", msg, "</color>");
            default:
                return msg;
        }
    }
    // public static string GetRealmColorByLv(int realmLv, string msg, bool bright = false)
    // {
    //     var config = RealmConfig.Get(realmLv);
    //     if (config == null)
    //     {
    //         return string.Empty;
    //     }
    //     switch (config.Quality)
    //     {
    //         case 1:
    //             return StringUtility.Contact("<color=#", bright ? "666666" : "dddddd", ">", msg, "</color>");
    //         case 2:
    //             return StringUtility.Contact("<color=#", bright ? "00b337" : "66ff00", ">", msg, "</color>");
    //         case 3:
    //             return StringUtility.Contact("<color=#", bright ? "0066ff" : "00c6ff", ">", msg, "</color>");
    //         case 4:
    //             return StringUtility.Contact("<color=#", bright ? "ff00f6" : "f000ff", ">", msg, "</color>");
    //         case 5:
    //             return StringUtility.Contact("<color=#", bright ? "ff6600" : "ff9000", ">", msg, "</color>");
    //         case 6:
    //             return StringUtility.Contact("<color=#", bright ? "ff0000" : "ff0000", ">", msg, "</color>");
    //         default:
    //             return msg;
    //     }
    // }
    public static string AppendColor(int itemColor, string msg, bool bright = false)
    {
@@ -781,20 +782,20 @@
        return msg;
    }
    public static int GetItemColor(int _id, Dictionary<int, List<int>> _dict = null)
    {
        int _itemColor = 0;
        var _itemCfg = ItemConfig.Get(_id);
        if (_itemCfg != null)
        {
            _itemColor = _itemCfg.ItemColor;
            if (_itemCfg.Type == 113 && _dict != null)
            {
                _itemColor = ItemLogicUtility.Instance.GetItemQuality(_itemCfg.ID, _dict);
            }
        }
        return _itemColor;
    }
    // public static int GetItemColor(int _id, Dictionary<int, List<int>> _dict = null)
    // {
    //     int _itemColor = 0;
    //     var _itemCfg = ItemConfig.Get(_id);
    //     if (_itemCfg != null)
    //     {
    //         _itemColor = _itemCfg.ItemColor;
    //         if (_itemCfg.Type == 113 && _dict != null)
    //         {
    //             _itemColor = ItemLogicUtility.Instance.GetItemQuality(_itemCfg.ID, _dict);
    //         }
    //     }
    //     return _itemColor;
    // }
    public static Color GetPropertyColor(int property)
    {
@@ -818,136 +819,136 @@
    #region 计算战斗力
    public static readonly string FightPowerFormula = "FightpowerFormula";
    public static int GetFightPower(Dictionary<int, int> _propertyDict)
    {
        Equation.Instance.Clear();
        if (_propertyDict == null || _propertyDict.Count == 0)
        {
            return 0;
        }
    // public static int GetFightPower(Dictionary<int, int> _propertyDict)
    // {
    //     Equation.Instance.Clear();
    //     if (_propertyDict == null || _propertyDict.Count == 0)
    //     {
    //         return 0;
    //     }
        foreach (var _key in _propertyDict.Keys)
        {
            PlayerPropertyConfig cfg = PlayerPropertyConfig.Get(_key);
            if (cfg != null)
            {
                if (_key == 7)
                {
                    Equation.Instance.AddKeyValue("MinAtk", _propertyDict[_key]);
                    Equation.Instance.AddKeyValue("MaxAtk", _propertyDict[_key]);
                }
                else if (_key == 24)
                {
                    Equation.Instance.AddKeyValue("PetMinAtk", _propertyDict[_key]);
                    Equation.Instance.AddKeyValue("PetMaxAtk", _propertyDict[_key]);
                }
                else
                {
                    ulong attrValue = (ulong)_propertyDict[_key];
                    var fightParm = GetFightPowerParmByAttrId(_key);
                    if (_key == 11)
                    {
                        var playerLv = PlayerDatas.Instance.baseData.LV;
                        var paramConfig = FightPowerParamConfig.Get(playerLv);
                        Equation.Instance.AddKeyValue("AtkSpeedParameter", paramConfig.AtkSpeedParameter);
                    }
                    else
                    {
                        if (fightParm != 0)
                        {
                            attrValue = attrValue * (ulong)fightParm;
                        }
                    }
                    Equation.Instance.AddKeyValue(cfg.Parameter, attrValue);
                }
            }
    //     foreach (var _key in _propertyDict.Keys)
    //     {
    //         PlayerPropertyConfig cfg = PlayerPropertyConfig.Get(_key);
    //         if (cfg != null)
    //         {
    //             if (_key == 7)
    //             {
    //                 Equation.Instance.AddKeyValue("MinAtk", _propertyDict[_key]);
    //                 Equation.Instance.AddKeyValue("MaxAtk", _propertyDict[_key]);
    //             }
    //             else if (_key == 24)
    //             {
    //                 Equation.Instance.AddKeyValue("PetMinAtk", _propertyDict[_key]);
    //                 Equation.Instance.AddKeyValue("PetMaxAtk", _propertyDict[_key]);
    //             }
    //             else
    //             {
    //                 ulong attrValue = (ulong)_propertyDict[_key];
    //                 var fightParm = GetFightPowerParmByAttrId(_key);
    //                 if (_key == 11)
    //                 {
    //                     var playerLv = PlayerDatas.Instance.baseData.LV;
    //                     var paramConfig = FightPowerParamConfig.Get(playerLv);
    //                     Equation.Instance.AddKeyValue("AtkSpeedParameter", paramConfig.AtkSpeedParameter);
    //                 }
    //                 else
    //                 {
    //                     if (fightParm != 0)
    //                     {
    //                         attrValue = attrValue * (ulong)fightParm;
    //                     }
    //                 }
    //                 Equation.Instance.AddKeyValue(cfg.Parameter, attrValue);
    //             }
    //         }
        }
        FuncConfigConfig funcCfg = FuncConfigConfig.Get(FightPowerFormula);
        return Equation.Instance.Eval<int>(funcCfg.Numerical1);
    }
    //     }
    //     FuncConfigConfig funcCfg = FuncConfigConfig.Get(FightPowerFormula);
    //     return Equation.Instance.Eval<int>(funcCfg.Numerical1);
    // }
    public static int GetFightPowerParmByAttrId(int attrId)
    {
        int playerLv = PlayerDatas.Instance.baseData.LV;
        FightPowerParamConfig paramConfig = FightPowerParamConfig.Get(playerLv);
        PlayerPropertyConfig cfg = PlayerPropertyConfig.Get(attrId);
        if (paramConfig == null || cfg == null) return 0;
    // public static int GetFightPowerParmByAttrId(int attrId)
    // {
    //     int playerLv = PlayerDatas.Instance.baseData.LV;
    //     FightPowerParamConfig paramConfig = FightPowerParamConfig.Get(playerLv);
    //     PlayerPropertyConfig cfg = PlayerPropertyConfig.Get(attrId);
    //     if (paramConfig == null || cfg == null) return 0;
        switch (cfg.Parameter)
        {
            case "Hit":
                return paramConfig.Hit;
            case "Miss":
                return paramConfig.Miss;
            case "IgnoreDefRate":
                return paramConfig.IgnoreDefRate;
            case "DamChanceDef":
                return paramConfig.DamChanceDef;
            case "FaintRate":
                return paramConfig.FaintRate;
            case "LuckyHitRateReduce":
                return paramConfig.LuckyHitRateReduce;
            case "SkillAtkRate":
                return paramConfig.SkillAtkRate;
            case "SkillAtkRateReduce":
                return paramConfig.SkillAtkRateReduce;
            case "DamagePerPVP":
                return paramConfig.DamagePerPVP;
            case "DamagePerPVPReduce":
                return paramConfig.DamagePerPVPReduce;
            case "DamBackPer":
                return paramConfig.DamBackPer;
            case "IgnoreDefRateReduce":
                return paramConfig.IgnoreDefRateReduce;
            case "FaintDefRate":
                return paramConfig.FaintDefRate;
            case "AtkSpeedParameter":
                return paramConfig.AtkSpeedParameter;
            case "JobAHurtAddPer":
                return paramConfig.JobAHurtAddPer;
            case "JobBHurtAddPer":
                return paramConfig.JobBHurtAddPer;
            case "JobCHurtAddPer":
                return paramConfig.JobCHurtAddPer;
            case "JobAAtkReducePer":
                return paramConfig.JobAAtkReducePer;
            case "JobBAtkReducePer":
                return paramConfig.JobBAtkReducePer;
            case "JobCAtkReducePer":
                return paramConfig.JobCAtkReducePer;
            case "SuperHitRate":
                return paramConfig.SuperHitRate;
            case "LuckyHitRate":
                return paramConfig.LuckyHitRate;
            case "SuperHitRateReduce":
                return paramConfig.SuperHitRateReduce;
            case "FinalHurtPer":
                return paramConfig.FinalHurtPer;
            case "FinalHurtReducePer":
                return paramConfig.FinalHurtReducePer;
            case "NPCHurtAddPer":
                return paramConfig.NPCHurtAddPer;
            case "NormalHurtPer":
                return paramConfig.NormalHurtPer;
            case "FabaoHurtPer":
                return paramConfig.FabaoHurtPer;
            case "AffairSpeedPer":
                return paramConfig.AffairSpeedPer;
            case "FamilyBossHurtPer":
                return paramConfig.FamilyBossHurtPer;
            case "FamilyWarHPPer":
                return paramConfig.FamilyWarHPPer;
            case "FamilyWarAtkPer":
                return paramConfig.FamilyWarAtkPer;
            case "FamilySitExpPer":
                return paramConfig.FamilySitExpPer;
            case "BossFinalHurtPer":
                return paramConfig.BossFinalHurtPer;
        }
    //     switch (cfg.Parameter)
    //     {
    //         case "Hit":
    //             return paramConfig.Hit;
    //         case "Miss":
    //             return paramConfig.Miss;
    //         case "IgnoreDefRate":
    //             return paramConfig.IgnoreDefRate;
    //         case "DamChanceDef":
    //             return paramConfig.DamChanceDef;
    //         case "FaintRate":
    //             return paramConfig.FaintRate;
    //         case "LuckyHitRateReduce":
    //             return paramConfig.LuckyHitRateReduce;
    //         case "SkillAtkRate":
    //             return paramConfig.SkillAtkRate;
    //         case "SkillAtkRateReduce":
    //             return paramConfig.SkillAtkRateReduce;
    //         case "DamagePerPVP":
    //             return paramConfig.DamagePerPVP;
    //         case "DamagePerPVPReduce":
    //             return paramConfig.DamagePerPVPReduce;
    //         case "DamBackPer":
    //             return paramConfig.DamBackPer;
    //         case "IgnoreDefRateReduce":
    //             return paramConfig.IgnoreDefRateReduce;
    //         case "FaintDefRate":
    //             return paramConfig.FaintDefRate;
    //         case "AtkSpeedParameter":
    //             return paramConfig.AtkSpeedParameter;
    //         case "JobAHurtAddPer":
    //             return paramConfig.JobAHurtAddPer;
    //         case "JobBHurtAddPer":
    //             return paramConfig.JobBHurtAddPer;
    //         case "JobCHurtAddPer":
    //             return paramConfig.JobCHurtAddPer;
    //         case "JobAAtkReducePer":
    //             return paramConfig.JobAAtkReducePer;
    //         case "JobBAtkReducePer":
    //             return paramConfig.JobBAtkReducePer;
    //         case "JobCAtkReducePer":
    //             return paramConfig.JobCAtkReducePer;
    //         case "SuperHitRate":
    //             return paramConfig.SuperHitRate;
    //         case "LuckyHitRate":
    //             return paramConfig.LuckyHitRate;
    //         case "SuperHitRateReduce":
    //             return paramConfig.SuperHitRateReduce;
    //         case "FinalHurtPer":
    //             return paramConfig.FinalHurtPer;
    //         case "FinalHurtReducePer":
    //             return paramConfig.FinalHurtReducePer;
    //         case "NPCHurtAddPer":
    //             return paramConfig.NPCHurtAddPer;
    //         case "NormalHurtPer":
    //             return paramConfig.NormalHurtPer;
    //         case "FabaoHurtPer":
    //             return paramConfig.FabaoHurtPer;
    //         case "AffairSpeedPer":
    //             return paramConfig.AffairSpeedPer;
    //         case "FamilyBossHurtPer":
    //             return paramConfig.FamilyBossHurtPer;
    //         case "FamilyWarHPPer":
    //             return paramConfig.FamilyWarHPPer;
    //         case "FamilyWarAtkPer":
    //             return paramConfig.FamilyWarAtkPer;
    //         case "FamilySitExpPer":
    //             return paramConfig.FamilySitExpPer;
    //         case "BossFinalHurtPer":
    //             return paramConfig.BossFinalHurtPer;
    //     }
        return 0;
    }
    //     return 0;
    // }
    #endregion
@@ -1245,25 +1246,25 @@
        return count;
    }
    public static string GetEquipSuitName(int itemId, bool bright = false)
    {
        if (ItemLogicUtility.Instance.IsSuitEquip(itemId))
        {
            var itemConfig = ItemConfig.Get(itemId);
            return AppendColor(TextColType.Green, EquipModel.GetSuitName(itemConfig.LV), bright);
        }
        return string.Empty;
    }
    // public static string GetEquipSuitName(int itemId, bool bright = false)
    // {
    //     if (ItemLogicUtility.Instance.IsSuitEquip(itemId))
    //     {
    //         var itemConfig = ItemConfig.Get(itemId);
    //         return AppendColor(TextColType.Green, EquipModel.GetSuitName(itemConfig.LV), bright);
    //     }
    //     return string.Empty;
    // }
    public static string GetItemName(int itmeId, bool bright = false)
    {
        var itemConfig = ItemConfig.Get(itmeId);
        if (itemConfig == null)
        {
            return string.Empty;
        }
        return StringUtility.Contact(GetEquipSuitName(itmeId, bright), itemConfig.ItemName);
    }
    // public static string GetItemName(int itmeId, bool bright = false)
    // {
    //     var itemConfig = ItemConfig.Get(itmeId);
    //     if (itemConfig == null)
    //     {
    //         return string.Empty;
    //     }
    //     return StringUtility.Contact(GetEquipSuitName(itmeId, bright), itemConfig.ItemName);
    // }
    public static string GetStar(int star)
    {