[增加]1. 增加强制设置为WebSocket 的宏定义配置

This commit is contained in:
Blank 2024-10-11 17:20:07 +08:00
parent 161426179a
commit b846ddb976
2 changed files with 20 additions and 1 deletions

View File

@ -17,6 +17,25 @@ namespace GameFrameX.Network.Editor
{
private const string EnableNetworkReceiveLogScriptingDefineSymbol = "ENABLE_GAMEFRAMEX_NETWORK_RECEIVE_LOG";
private const string EnableNetworkSendLogScriptingDefineSymbol = "ENABLE_GAMEFRAMEX_NETWORK_SEND_LOG";
private const string ForceEnableNetworkSendLogScriptingDefineSymbol = "FORCE_ENABLE_GAME_FRAME_X_WEB_SOCKET";
/// <summary>
/// 禁用网络强制为WebSocket脚本宏定义。
/// </summary>
[MenuItem("GameFrameX/Log Scripting Define Symbols/Disable Force WebSocket", false, 105)]
public static void DisableForceWebSocketNetwork()
{
ScriptingDefineSymbols.RemoveScriptingDefineSymbol(ForceEnableNetworkSendLogScriptingDefineSymbol);
}
/// <summary>
/// 开启网络强制为WebSocket脚本宏定义。
/// </summary>
[MenuItem("GameFrameX/Log Scripting Define Symbols/Enable Force WebSocket", false, 106)]
public static void EnableForceWebSocketNetwork()
{
ScriptingDefineSymbols.AddScriptingDefineSymbol(ForceEnableNetworkSendLogScriptingDefineSymbol);
}
/// <summary>
/// 禁用网络接收日志脚本宏定义。

View File

@ -195,7 +195,7 @@ namespace GameFrameX.Network.Runtime
{
throw new GameFrameworkException(Utility.Text.Format("Already exist network channel '{0}'.", channelName ?? string.Empty));
}
#if ENABLE_GAME_FRAME_X_WEB_SOCKET && UNITY_WEBGL
#if (ENABLE_GAME_FRAME_X_WEB_SOCKET && UNITY_WEBGL) || FORCE_ENABLE_GAME_FRAME_X_WEB_SOCKET
NetworkChannelBase networkChannel = new WebSocketNetworkChannel(channelName, networkChannelHelper);
#else
NetworkChannelBase networkChannel = new SystemTcpNetworkChannel(channelName, networkChannelHelper);