Quellcode durchsuchen

删掉了enet,有了kcp就不需要enet了

tanghai vor 8 Jahren
Ursprung
Commit
270f097ebf
40 geänderte Dateien mit 10 neuen und 1355 gelöschten Zeilen
  1. 0 15
      Client-Server.sln
  2. 3 3
      Doc/运行指南.md
  3. 0 10
      Server/Base/Server.Base.csproj
  4. 0 9
      Unity/Assets/Plugins/Android.meta
  5. 0 34
      Unity/Assets/Plugins/Android/armeabi-v7a.meta
  6. BIN
      Unity/Assets/Plugins/Android/armeabi-v7a/libenet.so
  7. 0 25
      Unity/Assets/Plugins/Android/armeabi-v7a/libenet.so.meta
  8. 0 7
      Unity/Assets/Plugins/iOS.meta
  9. BIN
      Unity/Assets/Plugins/iOS/libENet.a
  10. 0 24
      Unity/Assets/Plugins/iOS/libENet.a.meta
  11. 0 9
      Unity/Assets/Plugins/x86.meta
  12. BIN
      Unity/Assets/Plugins/x86/ENet.dll
  13. 0 76
      Unity/Assets/Plugins/x86/ENet.dll.meta
  14. 0 9
      Unity/Assets/Plugins/x86_64.meta
  15. BIN
      Unity/Assets/Plugins/x86_64/ENet.dll
  16. 0 76
      Unity/Assets/Plugins/x86_64/ENet.dll.meta
  17. 0 1
      Unity/Assets/Scripts/Base/Network/AService.cs
  18. 0 9
      Unity/Assets/Scripts/Base/Network/UNet.meta
  19. 0 33
      Unity/Assets/Scripts/Base/Network/UNet/Library.cs
  20. 0 12
      Unity/Assets/Scripts/Base/Network/UNet/Library.cs.meta
  21. 0 109
      Unity/Assets/Scripts/Base/Network/UNet/NativeMethods.cs
  22. 0 12
      Unity/Assets/Scripts/Base/Network/UNet/NativeMethods.cs.meta
  23. 0 76
      Unity/Assets/Scripts/Base/Network/UNet/NativeStructs.cs
  24. 0 12
      Unity/Assets/Scripts/Base/Network/UNet/NativeStructs.cs.meta
  25. 0 27
      Unity/Assets/Scripts/Base/Network/UNet/UAddress.cs
  26. 0 12
      Unity/Assets/Scripts/Base/Network/UNet/UAddress.cs.meta
  27. 0 103
      Unity/Assets/Scripts/Base/Network/UNet/UChannel.cs
  28. 0 12
      Unity/Assets/Scripts/Base/Network/UNet/UChannel.cs.meta
  29. 0 72
      Unity/Assets/Scripts/Base/Network/UNet/UPacket.cs
  30. 0 12
      Unity/Assets/Scripts/Base/Network/UNet/UPacket.cs.meta
  31. 0 183
      Unity/Assets/Scripts/Base/Network/UNet/UPoller.cs
  32. 0 12
      Unity/Assets/Scripts/Base/Network/UNet/UPoller.cs.meta
  33. 0 90
      Unity/Assets/Scripts/Base/Network/UNet/UService.cs
  34. 0 12
      Unity/Assets/Scripts/Base/Network/UNet/UService.cs.meta
  35. 0 174
      Unity/Assets/Scripts/Base/Network/UNet/USocket.cs
  36. 0 12
      Unity/Assets/Scripts/Base/Network/UNet/USocket.cs.meta
  37. 0 41
      Unity/Assets/Scripts/Base/Network/UNet/USocketManager.cs
  38. 0 12
      Unity/Assets/Scripts/Base/Network/UNet/USocketManager.cs.meta
  39. 0 6
      Unity/Assets/Scripts/Component/NetworkComponent.cs
  40. 7 14
      Unity/Unity.csproj

+ 0 - 15
Client-Server.sln

@@ -15,8 +15,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{46008B
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ThirdParty", "ThirdParty", "{78640FA0-9F11-412D-A639-61F03D02407A}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENet", "Server\ThirdParty\ENet\ENet.vcxproj", "{C9992B7C-313E-4C9F-A954-640D01EDFB58}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor", "Unity\Unity.Editor.csproj", "{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor.Plugins", "Unity\Unity.Editor.Plugins.csproj", "{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}"
@@ -83,18 +81,6 @@ Global
 		{40533600-4E69-4F7D-A924-E1A3B4127255}.Release|x64.Build.0 = Release|Any CPU
 		{40533600-4E69-4F7D-A924-E1A3B4127255}.Release|x86.ActiveCfg = Release|Any CPU
 		{40533600-4E69-4F7D-A924-E1A3B4127255}.Release|x86.Build.0 = Release|Any CPU
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Any CPU.ActiveCfg = Debug|x64
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Any CPU.Build.0 = Debug|x64
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|x64.ActiveCfg = Debug|x64
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|x64.Build.0 = Debug|x64
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|x86.ActiveCfg = Debug|Win32
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|x86.Build.0 = Debug|Win32
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Any CPU.ActiveCfg = Release|x64
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Any CPU.Build.0 = Release|x64
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|x64.ActiveCfg = Release|x64
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|x64.Build.0 = Release|x64
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|x86.ActiveCfg = Release|Win32
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|x86.Build.0 = Release|Win32
 		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -212,7 +198,6 @@ Global
 		{CF118143-7E37-744F-BE45-3F55345FEC40} = {914C77C9-212A-4DD0-8D9A-074620E77FAA}
 		{40533600-4E69-4F7D-A924-E1A3B4127255} = {914C77C9-212A-4DD0-8D9A-074620E77FAA}
 		{78640FA0-9F11-412D-A639-61F03D02407A} = {46008B91-6EC0-448B-8D1A-D8C6D2EEBEF4}
-		{C9992B7C-313E-4C9F-A954-640D01EDFB58} = {78640FA0-9F11-412D-A639-61F03D02407A}
 		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93} = {914C77C9-212A-4DD0-8D9A-074620E77FAA}
 		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C} = {914C77C9-212A-4DD0-8D9A-074620E77FAA}
 		{69F1AA11-D05A-4843-B0DD-56B5E2E212A8} = {46008B91-6EC0-448B-8D1A-D8C6D2EEBEF4}

+ 3 - 3
Doc/运行指南.md

@@ -1,7 +1,7 @@
 ##### 1.visual studio必须使用vs2017,其它版本不支持,VS2017需要勾选安装以下内容:
-.net 桌面开发   
-使用C++的桌面开发,VC++ 2017 v141工具集,对C++的xp支持  
-visual studio tools for unity, .netcore2.0
+a. .net 桌面开发  
+b. visual studio tools for unity  
+c. .netcore2.0  
 ##### 2. unity一定要安装 unity 2017.1.0p5到2017.1.2,其它版本不支持
 
 ##### 3. 启动unity2017, 菜单 File->open project->open 选中Egametang/Unity文件夹,点击选择文件夹按钮。

+ 0 - 10
Server/Base/Server.Base.csproj

@@ -47,16 +47,6 @@
     <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\TNet\PacketParser.cs" Link="Network\TNet\PacketParser.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\TNet\TChannel.cs" Link="Network\TNet\TChannel.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\TNet\TService.cs" Link="Network\TNet\TService.cs" />
-    <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\UNet\Library.cs" Link="Network\UNet\Library.cs" />
-    <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\UNet\NativeMethods.cs" Link="Network\UNet\NativeMethods.cs" />
-    <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\UNet\NativeStructs.cs" Link="Network\UNet\NativeStructs.cs" />
-    <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\UNet\UAddress.cs" Link="Network\UNet\UAddress.cs" />
-    <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\UNet\UChannel.cs" Link="Network\UNet\UChannel.cs" />
-    <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\UNet\UPacket.cs" Link="Network\UNet\UPacket.cs" />
-    <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\UNet\UPoller.cs" Link="Network\UNet\UPoller.cs" />
-    <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\UNet\UService.cs" Link="Network\UNet\UService.cs" />
-    <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\UNet\USocket.cs" Link="Network\UNet\USocket.cs" />
-    <Compile Include="..\..\Unity\Assets\Scripts\Base\Network\UNet\USocketManager.cs" Link="Network\UNet\USocketManager.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Base\QueueDictionary.cs" Link="QueueDictionary.cs" />
     <Compile Include="..\..\Unity\Assets\Scripts\Base\TryLocker.cs" Link="TryLocker.cs" />
   </ItemGroup>

+ 0 - 9
Unity/Assets/Plugins/Android.meta

@@ -1,9 +0,0 @@
-fileFormatVersion: 2
-guid: 25330bc13b034b94cb986aaf0e9a491f
-folderAsset: yes
-timeCreated: 1505269147
-licenseType: Free
-DefaultImporter:
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 34
Unity/Assets/Plugins/Android/armeabi-v7a.meta

@@ -1,34 +0,0 @@
-fileFormatVersion: 2
-guid: 8ed4f8da3fefb454286276e911f3a1be
-folderAsset: yes
-timeCreated: 1505269177
-licenseType: Free
-PluginImporter:
-  serializedVersion: 2
-  iconMap: {}
-  executionOrder: {}
-  isPreloaded: 0
-  isOverridable: 0
-  platformData:
-    data:
-      first:
-        Android: Android
-      second:
-        enabled: 1
-        settings: {}
-    data:
-      first:
-        Any: 
-      second:
-        enabled: 0
-        settings: {}
-    data:
-      first:
-        Editor: Editor
-      second:
-        enabled: 0
-        settings:
-          DefaultValueInitialized: true
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

BIN
Unity/Assets/Plugins/Android/armeabi-v7a/libenet.so


+ 0 - 25
Unity/Assets/Plugins/Android/armeabi-v7a/libenet.so.meta

@@ -1,25 +0,0 @@
-fileFormatVersion: 2
-guid: f348e42d420b0cf4bb775e1e179105f7
-timeCreated: 1490670825
-licenseType: Pro
-PluginImporter:
-  serializedVersion: 1
-  iconMap: {}
-  executionOrder: {}
-  isPreloaded: 0
-  isOverridable: 0
-  platformData:
-    Android:
-      enabled: 1
-      settings:
-        CPU: ARMv7
-    Any:
-      enabled: 0
-      settings: {}
-    Editor:
-      enabled: 0
-      settings:
-        DefaultValueInitialized: true
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 7
Unity/Assets/Plugins/iOS.meta

@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: 091987eeef9232240963d4755d7ea67e
-folderAsset: yes
-DefaultImporter:
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

BIN
Unity/Assets/Plugins/iOS/libENet.a


+ 0 - 24
Unity/Assets/Plugins/iOS/libENet.a.meta

@@ -1,24 +0,0 @@
-fileFormatVersion: 2
-guid: b45e030b68c365a47a02ac6d9b7e2061
-timeCreated: 1491907059
-licenseType: Pro
-PluginImporter:
-  serializedVersion: 1
-  iconMap: {}
-  executionOrder: {}
-  isPreloaded: 0
-  isOverridable: 0
-  platformData:
-    Any:
-      enabled: 0
-      settings: {}
-    Editor:
-      enabled: 0
-      settings:
-        DefaultValueInitialized: true
-    iOS:
-      enabled: 1
-      settings: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 9
Unity/Assets/Plugins/x86.meta

@@ -1,9 +0,0 @@
-fileFormatVersion: 2
-guid: 4dac1ed45a6fedc4589dc5e30f1b5f5f
-folderAsset: yes
-timeCreated: 1474958063
-licenseType: Pro
-DefaultImporter:
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

BIN
Unity/Assets/Plugins/x86/ENet.dll


+ 0 - 76
Unity/Assets/Plugins/x86/ENet.dll.meta

@@ -1,76 +0,0 @@
-fileFormatVersion: 2
-guid: 95bb46d4b0c5bd04189f360049de8e1a
-timeCreated: 1438069497
-licenseType: Pro
-PluginImporter:
-  serializedVersion: 1
-  iconMap: {}
-  executionOrder: {}
-  isPreloaded: 0
-  platformData:
-    Android:
-      enabled: 0
-      settings:
-        CPU: AnyCPU
-    Any:
-      enabled: 0
-      settings: {}
-    Editor:
-      enabled: 0
-      settings:
-        CPU: x86
-        DefaultValueInitialized: true
-        OS: Windows
-    Linux:
-      enabled: 1
-      settings:
-        CPU: x86
-    Linux64:
-      enabled: 1
-      settings:
-        CPU: None
-    LinuxUniversal:
-      enabled: 1
-      settings:
-        CPU: AnyCPU
-    OSXIntel:
-      enabled: 1
-      settings:
-        CPU: AnyCPU
-    OSXIntel64:
-      enabled: 1
-      settings:
-        CPU: None
-    OSXUniversal:
-      enabled: 1
-      settings:
-        CPU: AnyCPU
-    WP8:
-      enabled: 0
-      settings:
-        CPU: AnyCPU
-        DontProcess: False
-        PlaceholderPath: 
-    Win:
-      enabled: 1
-      settings:
-        CPU: AnyCPU
-    Win64:
-      enabled: 0
-      settings:
-        CPU: None
-    WindowsStoreApps:
-      enabled: 0
-      settings:
-        CPU: AnyCPU
-        DontProcess: False
-        PlaceholderPath: 
-        SDK: AnySDK
-    iOS:
-      enabled: 0
-      settings:
-        CompileFlags: 
-        FrameworkDependencies: 
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 9
Unity/Assets/Plugins/x86_64.meta

@@ -1,9 +0,0 @@
-fileFormatVersion: 2
-guid: b2c7db9f1d6ac024ea9fa5de2ccc387d
-folderAsset: yes
-timeCreated: 1474958063
-licenseType: Pro
-DefaultImporter:
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

BIN
Unity/Assets/Plugins/x86_64/ENet.dll


+ 0 - 76
Unity/Assets/Plugins/x86_64/ENet.dll.meta

@@ -1,76 +0,0 @@
-fileFormatVersion: 2
-guid: 53c831c29c846474d9b4366b376430a1
-timeCreated: 1434538659
-licenseType: Pro
-PluginImporter:
-  serializedVersion: 1
-  iconMap: {}
-  executionOrder: {}
-  isPreloaded: 0
-  platformData:
-    Android:
-      enabled: 0
-      settings:
-        CPU: AnyCPU
-    Any:
-      enabled: 0
-      settings: {}
-    Editor:
-      enabled: 1
-      settings:
-        CPU: x86_64
-        DefaultValueInitialized: true
-        OS: Windows
-    Linux:
-      enabled: 0
-      settings:
-        CPU: x86
-    Linux64:
-      enabled: 0
-      settings:
-        CPU: None
-    LinuxUniversal:
-      enabled: 0
-      settings:
-        CPU: None
-    OSXIntel:
-      enabled: 0
-      settings:
-        CPU: AnyCPU
-    OSXIntel64:
-      enabled: 0
-      settings:
-        CPU: None
-    OSXUniversal:
-      enabled: 0
-      settings:
-        CPU: None
-    WP8:
-      enabled: 0
-      settings:
-        CPU: AnyCPU
-        DontProcess: False
-        PlaceholderPath: 
-    Win:
-      enabled: 0
-      settings:
-        CPU: None
-    Win64:
-      enabled: 0
-      settings:
-        CPU: AnyCPU
-    WindowsStoreApps:
-      enabled: 0
-      settings:
-        CPU: AnyCPU
-        DontProcess: False
-        PlaceholderPath: 
-        SDK: AnySDK
-    iOS:
-      enabled: 0
-      settings:
-        CompileFlags: 
-        FrameworkDependencies: 
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 1
Unity/Assets/Scripts/Base/Network/AService.cs

@@ -7,7 +7,6 @@ namespace Model
 	public enum NetworkProtocol
 	{
 		TCP,
-		UDP,
 		KCP,
 	}
 

+ 0 - 9
Unity/Assets/Scripts/Base/Network/UNet.meta

@@ -1,9 +0,0 @@
-fileFormatVersion: 2
-guid: ade7fc5c4181e7649bddfadfc570c72f
-folderAsset: yes
-timeCreated: 1440989101
-licenseType: Pro
-DefaultImporter:
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 33
Unity/Assets/Scripts/Base/Network/UNet/Library.cs

@@ -1,33 +0,0 @@
-using System;
-
-namespace Model
-{
-	internal static class Library
-	{
-		public static void Initialize()
-		{
-			int ret = NativeMethods.enet_initialize();
-			if (ret < 0)
-			{
-				throw new Exception($"Initialization failed, ret: {ret}");
-			}
-		}
-
-		public static void Deinitialize()
-		{
-			NativeMethods.enet_deinitialize();
-		}
-
-		public static uint Time
-		{
-			get
-			{
-				return NativeMethods.enet_time_get();
-			}
-			set
-			{
-				NativeMethods.enet_time_set(value);
-			}
-		}
-	}
-}

+ 0 - 12
Unity/Assets/Scripts/Base/Network/UNet/Library.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 3d5dfbf30769f024da1a91ea2a6fc26b
-timeCreated: 1503986857
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 109
Unity/Assets/Scripts/Base/Network/UNet/NativeMethods.cs

@@ -1,109 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace Model
-{
-	public static class NativeMethods
-	{
-#if UNITY_IOS && !UNITY_EDITOR
-		private const string LIB = "__Internal";
-#else
-		private const string LIB = "ENet";
-#endif
-
-		public const int ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255;
-		public const int ENET_PROTOCOL_MAXIMUM_PEER_ID = 0xfff;
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern int enet_address_set_host(ref ENetAddress address, string hostName);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern int enet_address_get_host(ref ENetAddress address, StringBuilder hostName, uint nameLength);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern int enet_address_get_host_ip(ref ENetAddress address, StringBuilder hostIp, uint ipLength);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_deinitialize();
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern int enet_initialize();
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern IntPtr enet_host_create(
-				ref ENetAddress address, uint peerLimit, uint channelLimit, uint incomingBandwidth, uint outgoingBandwidth);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern IntPtr enet_host_create(IntPtr address, uint peerLimit, uint channelLimit, uint incomingBandwidth, uint outgoingBandwidth);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_host_destroy(IntPtr host);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern IntPtr enet_host_connect(IntPtr host, ref ENetAddress address, uint channelCount, uint data);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_host_broadcast(IntPtr host, byte channelID, IntPtr packet);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_host_compress(IntPtr host, IntPtr compressor);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern int enet_host_compress_with_range_coder(IntPtr host);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_host_channel_limit(IntPtr host, uint channelLimit);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_host_bandwidth_limit(IntPtr host, uint incomingBandwidth, uint outgoingBandwidth);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_host_flush(IntPtr host);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern int enet_host_check_events(IntPtr host, ref ENetEvent ev);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern int enet_host_service(IntPtr host, IntPtr ev, uint timeout);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern uint enet_time_get();
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_time_set(uint newTimeBase);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern IntPtr enet_packet_create(byte[] data, uint dataLength, PacketFlags flags);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_packet_destroy(IntPtr packet);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern int enet_packet_resize(IntPtr packet, uint dataLength);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_peer_throttle_configure(IntPtr peer, uint interval, uint acceleration, uint deceleration);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern int enet_peer_send(IntPtr peer, byte channelID, IntPtr packet);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern IntPtr enet_peer_receive(IntPtr peer, out byte channelID);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_peer_reset(IntPtr peer);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_peer_ping(IntPtr peer);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_peer_disconnect_now(IntPtr peer, uint data);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_peer_disconnect(IntPtr peer, uint data);
-
-		[DllImport(LIB, CallingConvention = CallingConvention.Cdecl)]
-		internal static extern void enet_peer_disconnect_later(IntPtr peer, uint data);
-	}
-}

+ 0 - 12
Unity/Assets/Scripts/Base/Network/UNet/NativeMethods.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 35389856785ea104698c98410fef22d6
-timeCreated: 1503986857
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 76
Unity/Assets/Scripts/Base/Network/UNet/NativeStructs.cs

@@ -1,76 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-namespace Model
-{
-	internal enum EventType
-	{
-		None = 0,
-		Connect = 1,
-		Disconnect = 2,
-		Receive = 3
-	}
-
-	internal enum PeerState
-	{
-		Uninitialized = -1,
-		Disconnected = 0,
-		Connecting = 1,
-		AcknowledgingConnect = 2,
-		ConnectionPending = 3,
-		ConnectionSucceeded = 4,
-		Connected = 5,
-		DisconnectLater = 6,
-		Disconnecting = 7,
-		AcknowledgingDisconnect = 8,
-		Zombie = 9
-	}
-
-	[StructLayout(LayoutKind.Sequential)]
-	internal struct ENetAddress
-	{
-		public uint Host;
-		public ushort Port;
-	}
-
-	// ENetEvent
-	[StructLayout(LayoutKind.Sequential)]
-	internal struct ENetEvent
-	{
-		public EventType Type;
-		public IntPtr Peer;
-		public byte ChannelID;
-		public uint Data;
-		public IntPtr Packet;
-	}
-
-	[StructLayout(LayoutKind.Sequential)]
-	internal class ENetListNode
-	{
-		public IntPtr Next;
-		public IntPtr Previous;
-	}
-
-	[StructLayout(LayoutKind.Sequential)]
-	internal struct ENetPacket
-	{
-		public IntPtr ReferenceCount; // size_t
-		public uint Flags;
-		public IntPtr Data;
-		public IntPtr DataLength; // size_t
-	}
-
-	[StructLayout(LayoutKind.Sequential)]
-	internal struct ENetPeer
-	{
-		public ENetListNode DispatchList;
-		public IntPtr Host;
-		public ushort OutgoingPeerID;
-		public ushort IncomingPeerID;
-		public uint ConnectID;
-		public byte OutgoingSessionID;
-		public byte IncomingSessionID;
-		public ENetAddress Address;
-		public IntPtr Data;
-	}
-}

+ 0 - 12
Unity/Assets/Scripts/Base/Network/UNet/NativeStructs.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 0c22827e08133ae47aaba041ccbd7b66
-timeCreated: 1503986857
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 27
Unity/Assets/Scripts/Base/Network/UNet/UAddress.cs

@@ -1,27 +0,0 @@
-using System;
-using System.Net;
-
-namespace Model
-{
-	internal struct UAddress
-	{
-		private readonly uint ip;
-		private readonly ushort port;
-
-		public UAddress(string host, int port)
-		{
-			IPAddress address = IPAddress.Parse(host);
-			this.ip = BitConverter.ToUInt32(address.GetAddressBytes(), 0);
-			this.port = (ushort) port;
-		}
-
-		public ENetAddress Struct
-		{
-			get
-			{
-				ENetAddress address = new ENetAddress { Host = this.ip, Port = this.port };
-				return address;
-			}
-		}
-	}
-}

+ 0 - 12
Unity/Assets/Scripts/Base/Network/UNet/UAddress.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 25434e9690978f34eb6554089e5df159
-timeCreated: 1503986857
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 103
Unity/Assets/Scripts/Base/Network/UNet/UChannel.cs

@@ -1,103 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Net.Sockets;
-using System.Threading.Tasks;
-
-namespace Model
-{
-	internal class UChannel: AChannel
-	{
-		private readonly USocket socket;
-
-		private TaskCompletionSource<Packet> recvTcs;
-		
-		/// <summary>
-		/// connect
-		/// </summary>
-		public UChannel(USocket socket, IPEndPoint ipEndPoint, UService service): base(service, ChannelType.Connect)
-		{
-			this.socket = socket;
-			this.service = service;
-			this.RemoteAddress = ipEndPoint;
-			this.socket.ConnectAsync(ipEndPoint);
-			this.socket.Received += this.OnRecv;
-			this.socket.Disconnect += () => { this.OnError(this, SocketError.SocketError); };
-		}
-
-		/// <summary>
-		/// accept
-		/// </summary>
-		public UChannel(USocket socket, UService service) : base(service, ChannelType.Accept)
-		{
-			this.socket = socket;
-			this.service = service;
-			this.RemoteAddress = socket.RemoteAddress;
-			this.socket.Received += this.OnRecv;
-			this.socket.Disconnect += () => { this.OnError(this, SocketError.SocketError); };
-		}
-
-		public override void Dispose()
-		{
-			if (this.Id == 0)
-			{
-				return;
-			}
-			base.Dispose();
-			this.socket.Dispose();
-		}
-
-		public override void Send(byte[] buffer)
-		{
-			if (this.Id == 0)
-			{
-				throw new Exception("UChannel已经被Dispose, 不能发送消息");
-			}
-			this.socket.SendAsync(buffer);
-		}
-
-		public override void Send(List<byte[]> buffers)
-		{
-			if (this.Id == 0)
-			{
-				throw new Exception("UChannel已经被Dispose, 不能发送消息");
-			}
-			int size = buffers.Select(b => b.Length).Sum();
-			var buffer = new byte[size];
-			int index = 0;
-			foreach (byte[] bytes in buffers)
-			{
-				Array.Copy(bytes, 0, buffer, index, bytes.Length);
-				index += bytes.Length;
-			}
-			this.socket.SendAsync(buffer);
-		}
-
-		public override Task<Packet> Recv()
-		{
-			if (this.Id == 0)
-			{
-				throw new Exception("UChannel已经被Dispose, 不能接收消息");
-			}
-			
-			var recvQueue = this.socket.RecvQueue;
-			if (recvQueue.Count > 0)
-			{
-				byte[] recvByte = recvQueue.Dequeue();
-				return Task.FromResult(new Packet(recvByte));
-			}
-
-			recvTcs = new TaskCompletionSource<Packet>();
-			return recvTcs.Task;
-		}
-
-		private void OnRecv()
-		{
-			var tcs = this.recvTcs;
-			this.recvTcs = null;
-			byte[] recvByte = this.socket.RecvQueue.Dequeue();
-			tcs?.SetResult(new Packet(recvByte));
-		}
-	}
-}

+ 0 - 12
Unity/Assets/Scripts/Base/Network/UNet/UChannel.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: dc32f8527e761f74ba132eab17660a4a
-timeCreated: 1503986858
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 72
Unity/Assets/Scripts/Base/Network/UNet/UPacket.cs

@@ -1,72 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-namespace Model
-{
-	internal sealed class UPacket: IDisposable
-	{
-		public UPacket(IntPtr packet)
-		{
-			this.PacketPtr = packet;
-		}
-
-		public UPacket(byte[] data, PacketFlags flags = PacketFlags.None)
-		{
-			if (data == null)
-			{
-				throw new ArgumentNullException(nameof(data));
-			}
-			this.PacketPtr = NativeMethods.enet_packet_create(data, (uint) data.Length, flags);
-			if (this.PacketPtr == IntPtr.Zero)
-			{
-				throw new Exception("Packet creation call failed");
-			}
-		}
-
-		~UPacket()
-		{
-			this.Dispose(false);
-		}
-
-		public void Dispose()
-		{
-			this.Dispose(true);
-		}
-
-		private void Dispose(bool disposing)
-		{
-			if (this.PacketPtr == IntPtr.Zero)
-			{
-				return;
-			}
-
-			NativeMethods.enet_packet_destroy(this.PacketPtr);
-			this.PacketPtr = IntPtr.Zero;
-		}
-
-		private ENetPacket Struct
-		{
-			get
-			{
-				return (ENetPacket) Marshal.PtrToStructure(this.PacketPtr, typeof (ENetPacket));
-			}
-			set
-			{
-				Marshal.StructureToPtr(value, this.PacketPtr, false);
-			}
-		}
-
-		public IntPtr PacketPtr { get; set; }
-
-		public byte[] Bytes
-		{
-			get
-			{
-				ENetPacket enetPacket = this.Struct;
-				var bytes = new byte[(long) enetPacket.DataLength];
-				Marshal.Copy(enetPacket.Data, bytes, 0, (int) enetPacket.DataLength);
-				return bytes;
-			}
-		}
-	}
-}

+ 0 - 12
Unity/Assets/Scripts/Base/Network/UNet/UPacket.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 9ce921dae0159cb44a2f23fb52a7b69c
-timeCreated: 1503986857
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 183
Unity/Assets/Scripts/Base/Network/UNet/UPoller.cs

@@ -1,183 +0,0 @@
-using System;
-using System.Threading.Tasks;
-
-namespace Model
-{
-	internal sealed class UPoller : IDisposable
-	{
-		static UPoller()
-		{
-			Library.Initialize();
-		}
-
-		public USocketManager USocketManager { get; }
-		private readonly EQueue<IntPtr> connQueue = new EQueue<IntPtr>();
-
-		private IntPtr host;
-		
-		private ENetEvent eNetEventCache;
-
-		private TaskCompletionSource<USocket> AcceptTcs { get; set; }
-
-		public UPoller(string hostName, ushort port)
-		{
-			try
-			{
-				this.USocketManager = new USocketManager();
-
-				UAddress address = new UAddress(hostName, port);
-				ENetAddress nativeAddress = address.Struct;
-				this.host = NativeMethods.enet_host_create(ref nativeAddress,
-						NativeMethods.ENET_PROTOCOL_MAXIMUM_PEER_ID, 0, 0, 0);
-
-				if (this.host == IntPtr.Zero)
-				{
-					throw new Exception("Host creation call failed.");
-				}
-
-				NativeMethods.enet_host_compress_with_range_coder(this.host);
-			}
-			catch (Exception e)
-			{
-				throw new Exception($"UPoll construct error, address: {hostName}:{port}", e);
-			}
-		}
-
-		public UPoller()
-		{
-			this.USocketManager = new USocketManager();
-
-			this.host = NativeMethods.enet_host_create(IntPtr.Zero, NativeMethods.ENET_PROTOCOL_MAXIMUM_PEER_ID, 0, 0, 0);
-
-			if (this.host == IntPtr.Zero)
-			{
-				throw new Exception("Host creation call failed.");
-			}
-
-			NativeMethods.enet_host_compress_with_range_coder(this.host);
-		}
-
-		public void Dispose()
-		{
-			if (this.host == IntPtr.Zero)
-			{
-				return;
-			}
-
-			NativeMethods.enet_host_destroy(this.host);
-
-			this.host = IntPtr.Zero;
-		}
-
-		public IntPtr Host
-		{
-			get
-			{
-				return this.host;
-			}
-		}
-
-		public void Flush()
-		{
-			NativeMethods.enet_host_flush(this.host);
-		}
-
-		public Task<USocket> AcceptAsync()
-		{
-			if (this.AcceptTcs != null)
-			{
-				throw new Exception("do not accept twice!");
-			}
-			
-			// 如果有请求连接缓存的包,从缓存中取
-			if (this.connQueue.Count > 0)
-			{
-				IntPtr ptr = this.connQueue.Dequeue();
-
-				USocket socket = new USocket(ptr, this);
-				this.USocketManager.Add(ptr, socket);
-				return Task.FromResult(socket);
-			}
-
-			this.AcceptTcs = new TaskCompletionSource<USocket>();
-			return this.AcceptTcs.Task;
-		}
-
-		private void OnAccepted(ENetEvent eEvent)
-		{
-			if (eEvent.Type == EventType.Disconnect)
-			{
-				this.AcceptTcs.TrySetException(new Exception("socket disconnected in accpet"));
-			}
-
-			USocket socket = new USocket(eEvent.Peer, this);
-			this.USocketManager.Add(socket.PeerPtr, socket);
-			socket.OnAccepted();
-
-			var tcs = this.AcceptTcs;
-			this.AcceptTcs = null;
-			tcs.SetResult(socket);
-		}
-
-		private int Service()
-		{
-			int ret = NativeMethods.enet_host_service(this.host, IntPtr.Zero, 0);
-			return ret;
-		}
-
-		public void Update()
-		{
-			if (this.Service() < 0)
-			{
-				return;
-			}
-
-			while (true)
-			{
-				if (NativeMethods.enet_host_check_events(this.host, ref this.eNetEventCache) <= 0)
-				{
-					return;
-				}
-
-				switch (this.eNetEventCache.Type)
-				{
-					case EventType.Connect:
-						{
-							// 这是一个connect peer
-							if (this.USocketManager.ContainsKey(this.eNetEventCache.Peer))
-							{
-								USocket uSocket = this.USocketManager[this.eNetEventCache.Peer];
-								uSocket.OnConnected();
-								break;
-							}
-
-							// 这是accept peer
-							if (this.AcceptTcs != null)
-							{
-								this.OnAccepted(this.eNetEventCache);
-								break;
-							}
-
-							// 如果server端没有acceptasync,则请求放入队列
-							this.connQueue.Enqueue(this.eNetEventCache.Peer);
-							break;
-						}
-					case EventType.Receive:
-						{
-							USocket uSocket = this.USocketManager[this.eNetEventCache.Peer];
-							uSocket.OnReceived(this.eNetEventCache);
-							break;
-						}
-					case EventType.Disconnect:
-						{
-							USocket uSocket = this.USocketManager[this.eNetEventCache.Peer];
-							this.USocketManager.Remove(uSocket.PeerPtr);
-							uSocket.PeerPtr = IntPtr.Zero;
-							uSocket.OnDisconnect(this.eNetEventCache);
-							break;
-						}
-				}
-			}
-		}
-	}
-}

+ 0 - 12
Unity/Assets/Scripts/Base/Network/UNet/UPoller.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 019e23efabdb4e24590c4735d5e78df4
-timeCreated: 1503986857
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 90
Unity/Assets/Scripts/Base/Network/UNet/UService.cs

@@ -1,90 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Threading.Tasks;
-
-namespace Model
-{
-	public sealed class UService: AService
-	{
-		private UPoller poller;
-
-		private readonly Dictionary<long, UChannel> idChannels = new Dictionary<long, UChannel>();
-
-		/// <summary>
-		/// 即可做client也可做server
-		/// </summary>
-		public UService(IPEndPoint ipEndPoint)
-		{
-			this.poller = new UPoller(ipEndPoint.Address.ToString(), (ushort)ipEndPoint.Port);
-		}
-
-		/// <summary>
-		/// 只能做client
-		/// </summary>
-		public UService()
-		{
-			this.poller = new UPoller();
-		}
-
-		public override void Dispose()
-		{
-			if (this.poller == null)
-			{
-				return;
-			}
-
-			foreach (long id in this.idChannels.Keys.ToArray())
-			{
-				UChannel channel = this.idChannels[id];
-				channel.Dispose();
-			}
-			
-			this.poller = null;
-		}
-		
-		public override async Task<AChannel> AcceptChannel()
-		{
-			USocket socket = await this.poller.AcceptAsync();
-			UChannel channel = new UChannel(socket, this);
-			this.idChannels[channel.Id] = channel;
-			return channel;
-		}
-
-		public override AChannel ConnectChannel(IPEndPoint ipEndPoint)
-		{
-			USocket newSocket = new USocket(this.poller);
-			UChannel channel = new UChannel(newSocket, ipEndPoint, this);
-			this.idChannels[channel.Id] = channel;
-			return channel;
-		}
-
-		public override AChannel GetChannel(long id)
-		{
-			UChannel channel = null;
-			this.idChannels.TryGetValue(id, out channel);
-			return channel;
-		}
-
-		public override void Remove(long id)
-		{
-			UChannel channel;
-			if (!this.idChannels.TryGetValue(id, out channel))
-			{
-				return;
-			}
-			if (channel == null)
-			{
-				return;
-			}
-			this.idChannels.Remove(id);
-			channel.Dispose();
-		}
-
-		public override void Update()
-		{
-			this.poller.Update();
-		}
-	}
-}

+ 0 - 12
Unity/Assets/Scripts/Base/Network/UNet/UService.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 467cbc524035d6644b5bd164eded38a4
-timeCreated: 1503986857
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 174
Unity/Assets/Scripts/Base/Network/UNet/USocket.cs

@@ -1,174 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Net;
-using System.Runtime.InteropServices;
-
-namespace Model
-{
-	internal class BufferInfo
-	{
-		public byte[] Buffer { get; set; }
-		public byte ChannelID { get; set; }
-		public PacketFlags Flags { get; set; }
-	}
-
-	internal sealed class USocket: IDisposable
-	{
-		private readonly UPoller poller;
-		public IntPtr PeerPtr { get; set; }
-		private readonly EQueue<byte[]> recvQueue = new EQueue<byte[]>();
-		private readonly EQueue<BufferInfo> sendQueue = new EQueue<BufferInfo>();
-		private bool isConnected;
-		private Action disconnect;
-		private Action received;
-		private IPEndPoint ipEndPoint;
-
-		public event Action Received
-		{
-			add
-			{
-				this.received += value;
-			}
-			remove
-			{
-				this.received -= value;
-			}
-		}
-
-		public event Action Disconnect
-		{
-			add
-			{
-				this.disconnect += value;
-			}
-			remove
-			{
-				this.disconnect -= value;
-			}
-		}
-
-		public USocket(IntPtr peerPtr, UPoller poller)
-		{
-			this.poller = poller;
-			this.PeerPtr = peerPtr;
-		}
-
-		public USocket(UPoller poller)
-		{
-			this.poller = poller;
-		}
-
-		public void Dispose()
-		{
-			if (this.PeerPtr == IntPtr.Zero)
-			{
-				return;
-			}
-
-			poller.USocketManager.Remove(this.PeerPtr);
-			NativeMethods.enet_peer_disconnect_now(this.PeerPtr, 0);
-			this.PeerPtr = IntPtr.Zero;
-		}
-
-		public IPEndPoint RemoteAddress
-		{
-			get
-			{
-				if (ipEndPoint != null)
-				{
-					return this.ipEndPoint;
-				}
-
-				ENetPeer peer = this.Struct;
-				this.ipEndPoint = new IPEndPoint(peer.Address.Host, peer.Address.Port);
-				return this.ipEndPoint;
-			}
-		}
-
-		private ENetPeer Struct
-		{
-			get
-			{
-				if (this.PeerPtr == IntPtr.Zero)
-				{
-					return new ENetPeer();
-				}
-				ENetPeer peer = (ENetPeer)Marshal.PtrToStructure(this.PeerPtr, typeof(ENetPeer));
-				return peer;
-			}
-			set
-			{
-				Marshal.StructureToPtr(value, this.PeerPtr, false);
-			}
-		}
-		
-		public EQueue<byte[]> RecvQueue
-		{
-			get
-			{
-				return recvQueue;
-			}
-		}
-
-		public void ConnectAsync(IPEndPoint ipEndPoint)
-		{
-			UAddress address = new UAddress(ipEndPoint.Address.ToString(), ipEndPoint.Port);
-			ENetAddress nativeAddress = address.Struct;
-
-			this.PeerPtr = NativeMethods.enet_host_connect(this.poller.Host, ref nativeAddress, 2, 0);
-			if (this.PeerPtr == IntPtr.Zero)
-			{
-				throw new Exception($"host connect call failed, {ipEndPoint}");
-			}
-			this.poller.USocketManager.Add(this.PeerPtr, this);
-		}
-
-		public void SendAsync(byte[] data, byte channelID = 0, PacketFlags flags = PacketFlags.Reliable)
-		{
-			if (this.PeerPtr == IntPtr.Zero)
-			{
-				throw new Exception($"USocket 已经被Dispose,不能发送数据!");
-			}
-			if (!isConnected)
-			{
-				sendQueue.Enqueue(new BufferInfo { Buffer = data, ChannelID = channelID, Flags = flags });
-				return;
-			}
-			UPacket packet = new UPacket(data, flags);
-			NativeMethods.enet_peer_send(this.PeerPtr, channelID, packet.PacketPtr);
-			// enet_peer_send函数会自动删除packet,设置为0,防止Dispose或者析构函数再次删除
-			packet.PacketPtr = IntPtr.Zero;
-		}
-
-		internal void OnConnected()
-		{
-			isConnected = true;
-			while (this.sendQueue.Count > 0)
-			{
-				BufferInfo info = this.sendQueue.Dequeue();
-				this.SendAsync(info.Buffer, info.ChannelID, info.Flags);
-			}
-		}
-
-		internal void OnAccepted()
-		{
-			isConnected = true;
-		}
-
-		internal void OnReceived(ENetEvent eNetEvent)
-		{
-			// 将包放到缓存队列
-			using (UPacket packet = new UPacket(eNetEvent.Packet))
-			{
-				byte[] bytes = packet.Bytes;
-				this.RecvQueue.Enqueue(bytes);
-			}
-			this.received();
-		}
-
-		internal void OnDisconnect(ENetEvent eNetEvent)
-		{
-			disconnect();
-		}
-	}
-}

+ 0 - 12
Unity/Assets/Scripts/Base/Network/UNet/USocket.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 7611e7b646e2fa9448d445fded0c621a
-timeCreated: 1503986857
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 41
Unity/Assets/Scripts/Base/Network/UNet/USocketManager.cs

@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Model
-{
-	internal class USocketManager
-	{
-		private readonly Dictionary<IntPtr, USocket> sockets = new Dictionary<IntPtr, USocket>();
-
-		public void Add(IntPtr peerPtr, USocket uSocket)
-		{
-			this.sockets.Add(peerPtr, uSocket);
-		}
-
-		public void Remove(IntPtr peerPtr)
-		{
-			this.sockets.Remove(peerPtr);
-		}
-
-		public bool ContainsKey(IntPtr peerPtr)
-		{
-			if (this.sockets.ContainsKey(peerPtr))
-			{
-				return true;
-			}
-			return false;
-		}
-
-		public USocket this[IntPtr peerPtr]
-		{
-			get
-			{
-				if (!this.sockets.ContainsKey(peerPtr))
-				{
-					throw new KeyNotFoundException("No Peer Key");
-				}
-				return this.sockets[peerPtr];
-			}
-		}
-	}
-}

+ 0 - 12
Unity/Assets/Scripts/Base/Network/UNet/USocketManager.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 046affd300b9d2444974c08908b0eb88
-timeCreated: 1503986857
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 6
Unity/Assets/Scripts/Component/NetworkComponent.cs

@@ -25,9 +25,6 @@ namespace Model
 				case NetworkProtocol.TCP:
 					this.Service = new TService();
 					break;
-				case NetworkProtocol.UDP:
-					this.Service = new UService();
-					break;
 				case NetworkProtocol.KCP:
 					this.Service = new KService();
 					break;
@@ -45,9 +42,6 @@ namespace Model
 					case NetworkProtocol.TCP:
 						this.Service = new TService(ipEndPoint);
 						break;
-					case NetworkProtocol.UDP:
-						this.Service = new UService(ipEndPoint);
-						break;
 					case NetworkProtocol.KCP:
 						this.Service = new KService(ipEndPoint);
 						break;

+ 7 - 14
Unity/Unity.csproj

@@ -12,12 +12,15 @@
     <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
     <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
-    <TargetFrameworkProfile></TargetFrameworkProfile>
-    <CompilerResponseFile></CompilerResponseFile>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
+    <CompilerResponseFile>
+    </CompilerResponseFile>
     <UnityProjectType>Game:1</UnityProjectType>
     <UnityBuildTarget>iOS:9</UnityBuildTarget>
     <UnityVersion>2017.1.1p4</UnityVersion>
-    <RootNamespace></RootNamespace>
+    <RootNamespace>
+    </RootNamespace>
     <LangVersion>6</LangVersion>
   </PropertyGroup>
   <PropertyGroup>
@@ -233,16 +236,6 @@
     <Compile Include="Assets\Scripts\Base\Network\TNet\PacketParser.cs" />
     <Compile Include="Assets\Scripts\Base\Network\TNet\TChannel.cs" />
     <Compile Include="Assets\Scripts\Base\Network\TNet\TService.cs" />
-    <Compile Include="Assets\Scripts\Base\Network\UNet\Library.cs" />
-    <Compile Include="Assets\Scripts\Base\Network\UNet\NativeMethods.cs" />
-    <Compile Include="Assets\Scripts\Base\Network\UNet\NativeStructs.cs" />
-    <Compile Include="Assets\Scripts\Base\Network\UNet\UAddress.cs" />
-    <Compile Include="Assets\Scripts\Base\Network\UNet\UChannel.cs" />
-    <Compile Include="Assets\Scripts\Base\Network\UNet\UPacket.cs" />
-    <Compile Include="Assets\Scripts\Base\Network\UNet\UPoller.cs" />
-    <Compile Include="Assets\Scripts\Base\Network\UNet\UService.cs" />
-    <Compile Include="Assets\Scripts\Base\Network\UNet\USocket.cs" />
-    <Compile Include="Assets\Scripts\Base\Network\UNet\USocketManager.cs" />
     <Compile Include="Assets\Scripts\Base\Object\Component.cs" />
     <Compile Include="Assets\Scripts\Base\Object\ComponentAttribute.cs" />
     <Compile Include="Assets\Scripts\Base\Object\ComponentFactory.cs" />
@@ -584,4 +577,4 @@
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="GenerateTargetFrameworkMonikerAttribute" />
-</Project>
+</Project>