处理DotNet网络层对WebGL导出的兼容

处理DotNet网络层对WebGL导出的兼容
This commit is contained in:
ALEXTANG
2023-08-17 14:06:09 +08:00
parent 7c74e10857
commit 0661c59877
13 changed files with 37 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ namespace TEngine.Core.Network
{
None = 0,
KCP = 1,
TCP = 2
TCP = 2,
WebSocket = 3,
}
}

View File

@@ -2,7 +2,9 @@ using System;
using System.Collections.Generic;
using System.Net;
using System.Net.NetworkInformation;
#if !UNITY_WEBGL
using System.Net.Sockets;
#endif
using System.Runtime.InteropServices;
// ReSharper disable InconsistentNaming
@@ -49,6 +51,7 @@ namespace TEngine.Core
return $"{self.Address}:{self.Port}";
}
#if !UNITY_WEBGL
public static void SetSioUdpConnReset(Socket socket)
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -70,5 +73,6 @@ namespace TEngine.Core
socket.IOControl(SIO_UDP_CONNRESET, new[] {Convert.ToByte(false)}, null);
}
#endif
}
}

View File

@@ -1,3 +1,4 @@
#if !UNITY_WEBGL
using System.Net.Sockets;
namespace TEngine.Core.Network
@@ -49,3 +50,4 @@ namespace TEngine.Core.Network
}
}
}
#endif

View File

@@ -14,6 +14,7 @@ namespace TEngine.Core.Network
{
switch (networkProtocolType)
{
#if !UNITY_WEBGL
case NetworkProtocolType.KCP:
{
Network = new KCPClientNetwork(Scene, networkTarget);
@@ -24,6 +25,7 @@ namespace TEngine.Core.Network
Network = new TCPClientNetwork(Scene, networkTarget);
return;
}
#endif
default:
{
throw new NotSupportedException($"Unsupported NetworkProtocolType:{networkProtocolType}");

View File

@@ -13,6 +13,7 @@ namespace TEngine.Core.Network
{
switch (networkProtocolType)
{
#if !UNITY_WEBGL
case NetworkProtocolType.KCP:
{
Network = new KCPServerNetwork(Scene, networkTarget, address);
@@ -25,6 +26,7 @@ namespace TEngine.Core.Network
// Log.Info($"NetworkProtocol:TCP IPEndPoint:{address}");
return;
}
#endif
default:
{
throw new NotSupportedException($"Unsupported NetworkProtocolType:{networkProtocolType}");

View File

@@ -1,3 +1,4 @@
#if !UNITY_WEBGL
using System;
using System.Buffers;
using System.Collections.Generic;
@@ -566,3 +567,4 @@ namespace TEngine.Core.Network
#endregion
}
}
#endif

View File

@@ -1,3 +1,4 @@
#if !UNITY_WEBGL
using System;
using System.Collections.Generic;
using System.IO;
@@ -460,3 +461,4 @@ namespace TEngine.Core.Network
#endregion
}
}
#endif

View File

@@ -1,3 +1,4 @@
#if !UNITY_WEBGL
using System;
using System.Buffers;
using System.IO;
@@ -233,3 +234,4 @@ namespace TEngine.Core.Network
#endregion
}
}
#endif

View File

@@ -1,3 +1,4 @@
#if !UNITY_WEBGL
using System;
using System.Collections.Generic;
using System.IO;
@@ -539,3 +540,4 @@ namespace TEngine.Core.Network
#endregion
}
}
#endif

View File

@@ -1,3 +1,4 @@
#if !UNITY_WEBGL
using System;
using System.Collections.Generic;
using System.IO;
@@ -236,3 +237,4 @@ namespace TEngine.Core.Network
#endregion
}
}
#endif

View File

@@ -1,3 +1,4 @@
#if !UNITY_WEBGL
using System;
using System.IO;
using System.Net.Sockets;
@@ -347,3 +348,4 @@ namespace TEngine.Core.Network
#endregion
}
}
#endif

View File

@@ -7,8 +7,6 @@ public partial class GameApp:Singleton<GameApp>
{
private static List<Assembly> _hotfixAssembly;
public Scene Scene { private set; get; }
/// <summary>
/// 热更域App主入口。
/// </summary>

View File

@@ -22,6 +22,11 @@ public partial class GameApp
}
/// <summary>
/// Entity框架根节点。
/// </summary>
public Scene Scene { private set; get; }
/// <summary>
/// 注册所有逻辑系统
/// </summary>