diff --git a/Client/Assets/Script/xmain/Module/Player/PlayerAvatarCatalog.cs b/Client/Assets/Script/xmain/Module/Player/PlayerAvatarCatalog.cs new file mode 100644 index 00000000..37dce293 --- /dev/null +++ b/Client/Assets/Script/xmain/Module/Player/PlayerAvatarCatalog.cs @@ -0,0 +1,22 @@ +using System.Globalization; + +namespace XGame +{ + public static class PlayerAvatarCatalog + { + public const int Count = 54; + public const int DefaultAvatarId = 1; + private const string AssetRoot = "Assets/Game/Art/UI/Texture/Icon/GamerPic/GamerPic_"; + + public static int NormalizeId(int avatarId) + { + return avatarId >= DefaultAvatarId && avatarId <= Count ? avatarId : DefaultAvatarId; + } + + public static string GetAssetPath(int avatarId) + { + int normalizedId = NormalizeId(avatarId); + return AssetRoot + normalizedId.ToString("00", CultureInfo.InvariantCulture) + ".png"; + } + } +}