mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
处理DotNet网络层对WebGL导出的兼容
处理DotNet网络层对WebGL导出的兼容
This commit is contained in:
@@ -4,6 +4,7 @@ namespace TEngine.Core.Network
|
|||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
KCP = 1,
|
KCP = 1,
|
||||||
TCP = 2
|
TCP = 2,
|
||||||
|
WebSocket = 3,
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -2,7 +2,9 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
|
#if !UNITY_WEBGL
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
#endif
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
@@ -49,6 +51,7 @@ namespace TEngine.Core
|
|||||||
return $"{self.Address}:{self.Port}";
|
return $"{self.Address}:{self.Port}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !UNITY_WEBGL
|
||||||
public static void SetSioUdpConnReset(Socket socket)
|
public static void SetSioUdpConnReset(Socket socket)
|
||||||
{
|
{
|
||||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
@@ -70,5 +73,6 @@ namespace TEngine.Core
|
|||||||
|
|
||||||
socket.IOControl(SIO_UDP_CONNRESET, new[] {Convert.ToByte(false)}, null);
|
socket.IOControl(SIO_UDP_CONNRESET, new[] {Convert.ToByte(false)}, null);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,3 +1,4 @@
|
|||||||
|
#if !UNITY_WEBGL
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
|
||||||
namespace TEngine.Core.Network
|
namespace TEngine.Core.Network
|
||||||
@@ -48,4 +49,5 @@ namespace TEngine.Core.Network
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -13,7 +13,8 @@ namespace TEngine.Core.Network
|
|||||||
public void Initialize(NetworkProtocolType networkProtocolType, NetworkTarget networkTarget)
|
public void Initialize(NetworkProtocolType networkProtocolType, NetworkTarget networkTarget)
|
||||||
{
|
{
|
||||||
switch (networkProtocolType)
|
switch (networkProtocolType)
|
||||||
{
|
{
|
||||||
|
#if !UNITY_WEBGL
|
||||||
case NetworkProtocolType.KCP:
|
case NetworkProtocolType.KCP:
|
||||||
{
|
{
|
||||||
Network = new KCPClientNetwork(Scene, networkTarget);
|
Network = new KCPClientNetwork(Scene, networkTarget);
|
||||||
@@ -24,6 +25,7 @@ namespace TEngine.Core.Network
|
|||||||
Network = new TCPClientNetwork(Scene, networkTarget);
|
Network = new TCPClientNetwork(Scene, networkTarget);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
throw new NotSupportedException($"Unsupported NetworkProtocolType:{networkProtocolType}");
|
throw new NotSupportedException($"Unsupported NetworkProtocolType:{networkProtocolType}");
|
||||||
|
@@ -13,6 +13,7 @@ namespace TEngine.Core.Network
|
|||||||
{
|
{
|
||||||
switch (networkProtocolType)
|
switch (networkProtocolType)
|
||||||
{
|
{
|
||||||
|
#if !UNITY_WEBGL
|
||||||
case NetworkProtocolType.KCP:
|
case NetworkProtocolType.KCP:
|
||||||
{
|
{
|
||||||
Network = new KCPServerNetwork(Scene, networkTarget, address);
|
Network = new KCPServerNetwork(Scene, networkTarget, address);
|
||||||
@@ -25,6 +26,7 @@ namespace TEngine.Core.Network
|
|||||||
// Log.Info($"NetworkProtocol:TCP IPEndPoint:{address}");
|
// Log.Info($"NetworkProtocol:TCP IPEndPoint:{address}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
throw new NotSupportedException($"Unsupported NetworkProtocolType:{networkProtocolType}");
|
throw new NotSupportedException($"Unsupported NetworkProtocolType:{networkProtocolType}");
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
#if !UNITY_WEBGL
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -565,4 +566,5 @@ namespace TEngine.Core.Network
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -1,3 +1,4 @@
|
|||||||
|
#if !UNITY_WEBGL
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -459,4 +460,5 @@ namespace TEngine.Core.Network
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -1,3 +1,4 @@
|
|||||||
|
#if !UNITY_WEBGL
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -232,4 +233,5 @@ namespace TEngine.Core.Network
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -1,3 +1,4 @@
|
|||||||
|
#if !UNITY_WEBGL
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -538,4 +539,5 @@ namespace TEngine.Core.Network
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -1,3 +1,4 @@
|
|||||||
|
#if !UNITY_WEBGL
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -235,4 +236,5 @@ namespace TEngine.Core.Network
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -1,3 +1,4 @@
|
|||||||
|
#if !UNITY_WEBGL
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
@@ -346,4 +347,5 @@ namespace TEngine.Core.Network
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
@@ -7,8 +7,6 @@ public partial class GameApp:Singleton<GameApp>
|
|||||||
{
|
{
|
||||||
private static List<Assembly> _hotfixAssembly;
|
private static List<Assembly> _hotfixAssembly;
|
||||||
|
|
||||||
public Scene Scene { private set; get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 热更域App主入口。
|
/// 热更域App主入口。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -22,6 +22,11 @@ public partial class GameApp
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Entity框架根节点。
|
||||||
|
/// </summary>
|
||||||
|
public Scene Scene { private set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 注册所有逻辑系统
|
/// 注册所有逻辑系统
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Reference in New Issue
Block a user