ui基本完毕,修了一大把的bug

This commit is contained in:
FloatGaming
2026-07-13 02:28:39 +08:00
parent 1e20d73e90
commit fd22501f71
958 changed files with 378289 additions and 41038 deletions
@@ -94,6 +94,38 @@ public class playerMessagePrefab : MonoBehaviour
await TryGetAvatarSpriteAsync(steamId, normalizedAvatarUrl);
}
public static bool TryGetCachedAvatarSprite(string steamId, string avatarUrl, out Sprite sprite)
{
sprite = null;
string normalizedAvatarUrl = GameServer.Client.NetworkManager.NormalizeAvatarUrlForClient(avatarUrl);
if (!string.IsNullOrWhiteSpace(normalizedAvatarUrl)
&& AvatarCache.TryGetValue(normalizedAvatarUrl, out Sprite cachedByUrl)
&& cachedByUrl != null)
{
sprite = cachedByUrl;
return true;
}
if (!string.IsNullOrWhiteSpace(steamId)
&& AvatarCache.TryGetValue(steamId, out Sprite cachedBySteamId)
&& cachedBySteamId != null)
{
sprite = cachedBySteamId;
return true;
}
Sprite diskSprite = TryLoadAvatarSpriteFromDisk(steamId, normalizedAvatarUrl);
if (diskSprite != null)
{
CacheAvatarSpriteInMemory(steamId, normalizedAvatarUrl, diskSprite);
sprite = diskSprite;
return true;
}
return false;
}
private async Task RefreshAvatarAsync(string steamId, string avatarUrl)
{
const int maxAttempts = 20;