| | |
| | | |
| | | public static string DisplayDamageNum(long num, int attackType) |
| | | { |
| | | // 服务器位数到客户端类型ID的映射 |
| | | Dictionary<int, int> serverToClientTypeMap = new Dictionary<int, int> |
| | | { |
| | | { 1, 2 }, // 普通伤血 |
| | | { 2, 4 }, // 恢复回血 |
| | | { 3, 8 }, // 反弹伤血 |
| | | { 4, 16 }, // 持续伤血 |
| | | { 5, 32 }, // 格挡 |
| | | { 7, 64 }, // 暴击伤害 |
| | | { 9, 128 }, // 闪避 |
| | | // 其它类型如需补充可继续添加 |
| | | }; |
| | | |
| | | int damageTypeValue = 0; |
| | | for (int i = 0; i < 32; i++) |
| | | { |
| | | int flag = 1 << i; |
| | | if ((attackType & flag) != 0) |
| | | { |
| | | // 只处理有映射的类型 |
| | | if (serverToClientTypeMap.TryGetValue(i + 1, out int clientTypeId)) |
| | | { |
| | | damageTypeValue += clientTypeId; |
| | | } |
| | | } |
| | | } |
| | | DamageType damageType = (DamageType)damageTypeValue; |
| | | |
| | | var config = DamageNumConfig.Get(damageTypeValue); |
| | | var config = DamageNumConfig.Get(attackType); |
| | | var basePowerStr = UIHelper.ReplaceLargeArtNum(num); |
| | | var result = string.Empty; |
| | | for (int i = 0; i < basePowerStr.Length; i++) |