1
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -13,6 +13,6 @@ namespace Assets.MyGame.Scripts.Net.WebResponses
|
||||
public int maxPlayerCount;
|
||||
public int currentOnlinePlayerCount;
|
||||
public int robotCount;
|
||||
public int roomNumber;
|
||||
public int roomNumber;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
||||
[Serializable]
|
||||
public class RoomChangeResponse
|
||||
{
|
||||
public static int CreateSitPos=0;
|
||||
/// <summary>
|
||||
/// 房间唯一 ID
|
||||
/// </summary>
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Assets.MyGame.Scripts.Net.WebResponses
|
||||
/// <summary>
|
||||
/// 玩家金币
|
||||
/// </summary>
|
||||
public int gold;
|
||||
public long gold;
|
||||
|
||||
/// <summary>
|
||||
/// 玩家钻石
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
using Assets.MyGame.Scripts.Net.API.GameConfig_SubClass;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -6,20 +9,57 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.MyGame.Scripts.Net.WebResponses
|
||||
{
|
||||
[Serializable]
|
||||
public enum FrameDataType
|
||||
{
|
||||
none=0,
|
||||
rotateTurrect,
|
||||
fireBullet,
|
||||
createFish,
|
||||
changeAutoTarget
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 同步游戏数据
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SyncGameData
|
||||
{
|
||||
public string sitPos;
|
||||
public string name;
|
||||
public string messageID;
|
||||
public FrameData frameData;
|
||||
public int sitPos;
|
||||
public FrameDataType frameType;
|
||||
public Object frameData;
|
||||
|
||||
}
|
||||
[Serializable]
|
||||
public class FrameData
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
[Serializable]
|
||||
public class FrameData_Rotate : FrameData
|
||||
{
|
||||
public float angle;
|
||||
}
|
||||
[Serializable]
|
||||
public class FrameData_FireBullit : FrameData
|
||||
{
|
||||
public float angle;
|
||||
public long gold;
|
||||
public bool isSanShe;
|
||||
public bool isSuoDing;
|
||||
public bool auto;
|
||||
public bool twoRTruuect;
|
||||
public string monsterID;
|
||||
}
|
||||
[Serializable]
|
||||
public class FrameData_CreateFish : FrameData
|
||||
{
|
||||
public RoomFishDetailConfig fish;
|
||||
|
||||
}
|
||||
[Serializable]
|
||||
public class FrameData_ChangeAutoTarget : FrameData
|
||||
{
|
||||
public string targetGuid;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user