1
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Assets.MyGame.Scripts.Net;
|
||||
using Assets.MyGame.Scripts.Net;
|
||||
using Assets.MyGame.Scripts.Net.API;
|
||||
using Assets.MyGame.Scripts.Net.API.GameConfig_SubClass;
|
||||
using CameraShake;
|
||||
@@ -241,39 +241,52 @@ public class GameManager : MonoSingleton<GameManager>
|
||||
UIManager.Instance.ShowAsync(UIPanel.MainGamePanelDefault);
|
||||
break;
|
||||
case GameType.FLZY:
|
||||
if (action != null)
|
||||
WebSocketManager.Instance.Connect(SocketType.game, action);
|
||||
//UIManager.Instance.ShowAsync(UIPanel.MainGamePanelFLZY);
|
||||
ConnectGameSocket(action);
|
||||
break;
|
||||
case GameType.YYSC:
|
||||
if (action != null)
|
||||
{
|
||||
WebSocketManager.Instance.Connect(SocketType.game, action);
|
||||
}
|
||||
ConnectGameSocket(action);
|
||||
break;
|
||||
case GameType.ZGXQ:
|
||||
//UIManager.Instance.ShowAsync(UIPanel.MainGamePanelZGXQ);
|
||||
//UIManager.Instance.ShowAsync(UIPanel.MainGamePanelZGXQ);
|
||||
//这里设置触发棋盘的初始化
|
||||
|
||||
break;
|
||||
case GameType.XJMH:
|
||||
if (action != null)
|
||||
{
|
||||
WebSocketManager.Instance.Connect(SocketType.game, action);
|
||||
}
|
||||
else
|
||||
WebSocketManager.Instance.Connect(SocketType.game);
|
||||
ConnectGameSocket(action);
|
||||
break;
|
||||
case GameType.HHWK:
|
||||
//UIManager.Instance.ShowAsync(UIPanel.MainGamePanelDefault);
|
||||
if (action != null)
|
||||
WebSocketManager.Instance.Connect(SocketType.game, action);
|
||||
ConnectGameSocket(action);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过 /api/Room/Assign 获取房间专属 socket 地址后连接 game socket
|
||||
/// </summary>
|
||||
private void ConnectGameSocket(Action action)
|
||||
{
|
||||
string roomId = gameData.currRoomData?.roomId;
|
||||
if (string.IsNullOrEmpty(roomId))
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
Debug.LogWarning("[GameManager] currRoomData.roomId 为空,使用默认 game socket 地址");
|
||||
#endif
|
||||
WebSocketManager.Instance.Connect(SocketType.game, action);
|
||||
return;
|
||||
}
|
||||
APIRequestList.RoomAssign(roomId, url =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
WebSocketManager.Instance.Connect(SocketType.game, url, action);
|
||||
else
|
||||
WebSocketManager.Instance.Connect(SocketType.game, action);
|
||||
});
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
public Button btn_Skip;
|
||||
public VideoClip startVideoClip;
|
||||
|
||||
Reference in New Issue
Block a user