This commit is contained in:
2026-03-09 09:25:01 +08:00
parent 3dd5a9bf4e
commit e39164fed4
113 changed files with 5154 additions and 3828 deletions
@@ -1,6 +1,8 @@
using Model.Entity.BaseModel;
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
namespace Assets.MyGame.Scripts.Net.WebResponses.ChineseChess
{
@@ -42,7 +44,7 @@ namespace Assets.MyGame.Scripts.Net.WebResponses.ChineseChess
/// <summary>
/// 游戏房间
/// </summary>
public class ChessGameRoom : MongoBaseEntity
public class ChessGameRoom
{
/// <summary>
/// 用户列表
@@ -88,6 +90,44 @@ namespace Assets.MyGame.Scripts.Net.WebResponses.ChineseChess
/// </summary>
public class RedisGameUser
{
//下载头像 失败最多重试5次
public IEnumerator DownTexture2d(System.Action<Texture2D> action)
{
string url = userAvatar;
int downCount = 5;
Texture2D avatarTexture2D = new Texture2D(100, 100);
//if (avatarTexture2D == null)
for (int i = 0; i < downCount; i++)
{
using (UnityWebRequest www = UnityWebRequestTexture.GetTexture(url))
{
yield return www.SendWebRequest();
if (www.result == UnityWebRequest.Result.ConnectionError ||
www.result == UnityWebRequest.Result.ProtocolError)
{
Debug.LogError("下载失败: " + www.error);
downCount++;
if (downCount == 5)
{
action.Invoke(new Texture2D(100, 100));
yield break;
}
}
else
{
avatarTexture2D = DownloadHandlerTexture.GetContent(www);
break;
}
}
}
action.Invoke(avatarTexture2D);
}
/// <summary>
/// 链接Id