Sfoglia il codice sorgente

增加两个帧同步组件,用来处理帧同步消息

tanghai 8 anni fa
parent
commit
66e13b4062
35 ha cambiato i file con 584 aggiunte e 79 eliminazioni
  1. 30 15
      Client-Server.sln
  2. 5 0
      Server/Model/Base/Message/AActorMessage.cs
  3. 0 5
      Server/Model/Base/Message/AMessage.cs
  4. 12 0
      Server/Model/Base/Message/IEntityActorHandler.cs
  5. 51 0
      Server/Model/Component/ServerFrameComponent.cs
  6. 24 0
      Server/Model/Message/AMHandler.cs
  7. 7 2
      Server/Model/Server.Model.csproj
  8. 9 0
      Unity/Assets/Scripts/Base/Math.meta
  9. 12 0
      Unity/Assets/Scripts/Base/Math/AcosLookupTable.cs.meta
  10. 12 0
      Unity/Assets/Scripts/Base/Math/Atan2LookupTable.cs.meta
  11. 12 0
      Unity/Assets/Scripts/Base/Math/IntMath.cs.meta
  12. 12 0
      Unity/Assets/Scripts/Base/Math/SinCosLookupTable.cs.meta
  13. 12 0
      Unity/Assets/Scripts/Base/Math/VFactor.cs.meta
  14. 12 0
      Unity/Assets/Scripts/Base/Math/VInt.cs.meta
  15. 12 0
      Unity/Assets/Scripts/Base/Math/VInt2.cs.meta
  16. 12 0
      Unity/Assets/Scripts/Base/Math/VInt3.cs.meta
  17. 12 0
      Unity/Assets/Scripts/Base/Math/VLine.cs.meta
  18. 12 0
      Unity/Assets/Scripts/Base/Math/VRect.cs.meta
  19. 5 0
      Unity/Assets/Scripts/Base/Message/AActorMessage.cs
  20. 3 3
      Unity/Assets/Scripts/Base/Message/AMHandler.cs
  21. 0 5
      Unity/Assets/Scripts/Base/Message/AMessage.cs
  22. 9 1
      Unity/Assets/Scripts/Base/Message/ClientDispatcher.cs
  23. 1 1
      Unity/Assets/Scripts/Base/Message/IMHandler.cs
  24. 2 2
      Unity/Assets/Scripts/Base/Message/MessageInfo.cs
  25. 56 0
      Unity/Assets/Scripts/Component/ClientFrameComponent.cs
  26. 12 0
      Unity/Assets/Scripts/Component/ClientFrameComponent.cs.meta
  27. 2 2
      Unity/Assets/Scripts/Component/MessageDispatherComponent.cs
  28. 2 0
      Unity/Assets/Scripts/Entity/Message/Opcode.cs
  29. 19 0
      Unity/Assets/Scripts/Entity/Message/OuterMessage.cs
  30. 1 1
      Unity/Assets/Scripts/Handler/Actor_TestHandler.cs
  31. 161 0
      Unity/Unity.Editor.Plugins.csproj
  32. 8 4
      Unity/Unity.Editor.csproj
  33. 4 4
      Unity/Unity.Plugins.csproj
  34. 8 10
      Unity/Unity.csproj
  35. 33 24
      Unity/Unity.sln

+ 30 - 15
Client-Server.sln

@@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Plugins", "Unity\Unit
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Unity\Unity.csproj", "{CF118143-7E37-744F-BE45-3F55345FEC40}"
 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.Hotfix", "Unity\Hotfix\Unity.Hotfix.csproj", "{40533600-4E69-4F7D-A924-E1A3B4127255}"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{914C77C9-212A-4DD0-8D9A-074620E77FAA}"
@@ -27,6 +25,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ThirdParty", "ThirdParty",
 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}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -61,18 +63,6 @@ Global
 		{CF118143-7E37-744F-BE45-3F55345FEC40}.Release|x64.Build.0 = Release|Any CPU
 		{CF118143-7E37-744F-BE45-3F55345FEC40}.Release|x86.ActiveCfg = Release|Any CPU
 		{CF118143-7E37-744F-BE45-3F55345FEC40}.Release|x86.Build.0 = Release|Any CPU
-		{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
-		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Debug|x64.Build.0 = Debug|Any CPU
-		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Debug|x86.ActiveCfg = Debug|Any CPU
-		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Debug|x86.Build.0 = Debug|Any CPU
-		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|Any CPU.Build.0 = Release|Any CPU
-		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|x64.ActiveCfg = Release|Any CPU
-		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|x64.Build.0 = Release|Any CPU
-		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|x86.ActiveCfg = Release|Any CPU
-		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|x86.Build.0 = Release|Any CPU
 		{40533600-4E69-4F7D-A924-E1A3B4127255}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{40533600-4E69-4F7D-A924-E1A3B4127255}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{40533600-4E69-4F7D-A924-E1A3B4127255}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -143,6 +133,30 @@ Global
 		{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
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Debug|x64.Build.0 = Debug|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Debug|x86.Build.0 = Debug|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|Any CPU.Build.0 = Release|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|x64.ActiveCfg = Release|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|x64.Build.0 = Release|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|x86.ActiveCfg = Release|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|x86.Build.0 = Release|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Debug|x64.Build.0 = Debug|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Debug|x86.Build.0 = Debug|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Release|Any CPU.Build.0 = Release|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Release|x64.ActiveCfg = Release|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Release|x64.Build.0 = Release|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Release|x86.ActiveCfg = Release|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -150,7 +164,6 @@ Global
 	GlobalSection(NestedProjects) = preSolution
 		{D1FDB199-0FB7-099D-3771-C6A942E4E326} = {914C77C9-212A-4DD0-8D9A-074620E77FAA}
 		{CF118143-7E37-744F-BE45-3F55345FEC40} = {914C77C9-212A-4DD0-8D9A-074620E77FAA}
-		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93} = {914C77C9-212A-4DD0-8D9A-074620E77FAA}
 		{40533600-4E69-4F7D-A924-E1A3B4127255} = {914C77C9-212A-4DD0-8D9A-074620E77FAA}
 		{3F8DC04C-9E05-403F-B6A5-36293EB99937} = {46008B91-6EC0-448B-8D1A-D8C6D2EEBEF4}
 		{E5078EC6-2B0E-4711-BE8B-D99F69638316} = {46008B91-6EC0-448B-8D1A-D8C6D2EEBEF4}
@@ -158,6 +171,8 @@ Global
 		{820D3488-76B9-4EE8-872A-BE06C2350B20} = {46008B91-6EC0-448B-8D1A-D8C6D2EEBEF4}
 		{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}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {EABC01E3-3EB5-47EF-B46E-AAD8BB3585F1}

+ 5 - 0
Server/Model/Base/Message/AActorMessage.cs

@@ -18,4 +18,9 @@ namespace Model
 	public abstract class AActorResponse : AResponse
 	{
 	}
+
+	public abstract class AFrameMessage : AActorMessage
+	{
+		public long Id;
+	}
 }

+ 0 - 5
Server/Model/Base/Message/AMessage.cs

@@ -27,9 +27,4 @@ namespace Model
 		public int Error = 0;
 		public string Message = "";
 	}
-
-	public abstract class AFrameMessage: AMessage
-	{
-		public long Id;
-	}
 }

+ 12 - 0
Server/Model/Base/Message/IEntityActorHandler.cs

@@ -30,4 +30,16 @@ namespace Model
 			await Game.Scene.GetComponent<ActorMessageDispatherComponent>().Handle(session, entity, message);
 		}
 	}
+
+	public class MapUnitEntityActorHandler : IEntityActorHandler
+	{
+		public async Task Handle(Session session, Entity entity, ActorRequest message)
+		{
+			if (message.AMessage is AFrameMessage aFrameMessage)
+			{
+				Game.Scene.GetComponent<ServerFrameComponent>().Add(aFrameMessage);
+			}
+			await Game.Scene.GetComponent<ActorMessageDispatherComponent>().Handle(session, entity, message);
+		}
+	}
 }

+ 51 - 0
Server/Model/Component/ServerFrameComponent.cs

@@ -0,0 +1,51 @@
+namespace Model
+{
+	[ObjectEvent]
+	public class ServerFrameComponentEvent : ObjectEvent<ServerFrameComponent>, IAwake
+	{
+		public void Awake()
+		{
+			this.Get().Awake();
+		}
+	}
+	
+	public class ServerFrameComponent: Component
+	{
+		public int Frame;
+
+		public FrameMessage FrameMessage;
+		
+		public void Awake()
+		{
+			this.Frame = 0;
+			this.FrameMessage = new FrameMessage() {Frame = this.Frame};
+
+			this.UpdateFrameAsync();
+		}
+
+		public async void UpdateFrameAsync()
+		{
+			TimerComponent timerComponent = Game.Scene.GetComponent<TimerComponent>();
+
+			while (true)
+			{
+				if (this.Id == 0)
+				{
+					return;
+				}
+
+				await timerComponent.WaitAsync(30);
+				
+				//MessageHelper.Broadcast(this.FrameMessage);
+
+				++this.Frame;
+				this.FrameMessage = new FrameMessage() { Frame = this.Frame };
+			}
+		}
+
+		public void Add(AFrameMessage message)
+		{
+			this.FrameMessage.Messages.Add(message);
+		}
+	}
+}

+ 24 - 0
Server/Model/Message/AMHandler.cs

@@ -0,0 +1,24 @@
+using System;
+
+namespace Model
+{
+	public abstract class AMHandler<Message> : IMHandler where Message : AMessage
+	{
+		protected abstract void Run(Session session, Message message);
+
+		public void Handle(Session session, AMessage msg)
+		{
+			Message message = msg as Message;
+			if (message == null)
+			{
+				Log.Error($"消息类型转换错误: {msg.GetType().Name} to {typeof(Message).Name}");
+			}
+			this.Run(session, message);
+		}
+
+		public Type GetMessageType()
+		{
+			return typeof(Message);
+		}
+	}
+}

+ 7 - 2
Server/Model/Server.Model.csproj

@@ -52,8 +52,8 @@
     <Reference Include="System.Numerics" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="..\..\Unity\Assets\Scripts\Base\Message\AMHandler.cs">
-      <Link>Message\AMHandler.cs</Link>
+    <Compile Include="..\..\Unity\Assets\Scripts\Base\DoubleMap.cs">
+      <Link>Entity\DoubleMap.cs</Link>
     </Compile>
     <Compile Include="..\..\Unity\Assets\Scripts\Base\Message\AppType.cs">
       <Link>Message\AppType.cs</Link>
@@ -67,6 +67,9 @@
     <Compile Include="..\..\Unity\Assets\Scripts\Base\Message\JsondotnetPacker.cs">
       <Link>Message\JsondotnetPacker.cs</Link>
     </Compile>
+    <Compile Include="..\..\Unity\Assets\Scripts\Base\Message\MessageInfo.cs">
+      <Link>Base\Message\MessageInfo.cs</Link>
+    </Compile>
     <Compile Include="..\..\Unity\Assets\Scripts\Base\Message\MongoPacker.cs">
       <Link>Message\MongoPacker.cs</Link>
     </Compile>
@@ -137,6 +140,7 @@
       <Link>Helper\MongoHelper.cs</Link>
     </Compile>
     <Compile Include="Component\ActorProxyComponent.cs" />
+    <Compile Include="Component\ServerFrameComponent.cs" />
     <Compile Include="Component\PlayerComponent.cs" />
     <Compile Include="Component\Unit\UnitGateComponent.cs" />
     <Compile Include="Entity\Player.cs" />
@@ -215,6 +219,7 @@
     <Compile Include="Base\Object\ComponentDB.cs" />
     <Compile Include="Base\Object\EntityType.cs" />
     <Compile Include="Base\Object\ObjectEvents.cs" />
+    <Compile Include="Message\AMHandler.cs" />
     <Compile Include="Other\OneThreadSynchronizationContext.cs" />
     <Compile Include="Other\Options.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />

+ 9 - 0
Unity/Assets/Scripts/Base/Math.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 860c9f12eec5da845bcd9534b5843154
+folderAsset: yes
+timeCreated: 1506063881
+licenseType: Free
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 12 - 0
Unity/Assets/Scripts/Base/Math/AcosLookupTable.cs.meta

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

+ 12 - 0
Unity/Assets/Scripts/Base/Math/Atan2LookupTable.cs.meta

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

+ 12 - 0
Unity/Assets/Scripts/Base/Math/IntMath.cs.meta

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

+ 12 - 0
Unity/Assets/Scripts/Base/Math/SinCosLookupTable.cs.meta

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

+ 12 - 0
Unity/Assets/Scripts/Base/Math/VFactor.cs.meta

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

+ 12 - 0
Unity/Assets/Scripts/Base/Math/VInt.cs.meta

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

+ 12 - 0
Unity/Assets/Scripts/Base/Math/VInt2.cs.meta

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

+ 12 - 0
Unity/Assets/Scripts/Base/Math/VInt3.cs.meta

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

+ 12 - 0
Unity/Assets/Scripts/Base/Math/VLine.cs.meta

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

+ 12 - 0
Unity/Assets/Scripts/Base/Math/VRect.cs.meta

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

+ 5 - 0
Unity/Assets/Scripts/Base/Message/AActorMessage.cs

@@ -11,4 +11,9 @@
 	public abstract class AActorResponse : AResponse
 	{
 	}
+
+	public abstract class AFrameMessage : AActorMessage
+	{
+		public long Id;
+	}
 }

+ 3 - 3
Unity/Assets/Scripts/Base/Message/AMHandler.cs

@@ -4,16 +4,16 @@ namespace Model
 {
 	public abstract class AMHandler<Message> : IMHandler where Message : AMessage
 	{
-		protected abstract void Run(Session session, Message message);
+		protected abstract void Run(Message message);
 
-		public void Handle(Session session, AMessage msg)
+		public void Handle(AMessage msg)
 		{
 			Message message = msg as Message;
 			if (message == null)
 			{
 				Log.Error($"消息类型转换错误: {msg.GetType().Name} to {typeof(Message).Name}");
 			}
-			this.Run(session, message);
+			this.Run(message);
 		}
 
 		public Type GetMessageType()

+ 0 - 5
Unity/Assets/Scripts/Base/Message/AMessage.cs

@@ -19,9 +19,4 @@
 		public int Error = 0;
 		public string Message = "";
 	}
-
-	public abstract class AFrameMessage : AMessage
-	{
-		public long Id;
-	}
 }

+ 9 - 1
Unity/Assets/Scripts/Base/Message/ClientDispatcher.cs

@@ -6,6 +6,14 @@ namespace Model
 	{
 		public void Dispatch(Session session, ushort opcode, int offset, byte[] messageBytes, AMessage message)
 		{
+			// 如果是帧同步消息,交给ClientFrameComponent处理
+			FrameMessage frameMessage = message as FrameMessage;
+			if (frameMessage != null)
+			{
+				Game.Scene.GetComponent<ClientFrameComponent>().Add(frameMessage);
+				return;
+			}
+
 			// 普通消息或者是Rpc请求消息
 			if (message is AMessage || message is ARequest)
 			{
@@ -16,7 +24,7 @@ namespace Model
 				}
 				else
 				{
-					Game.Scene.GetComponent<MessageDispatherComponent>().Handle(session, messageInfo);
+					Game.Scene.GetComponent<MessageDispatherComponent>().Handle(messageInfo);
 				}
 				return;
 			}

+ 1 - 1
Unity/Assets/Scripts/Base/Message/IMHandler.cs

@@ -4,7 +4,7 @@ namespace Model
 {
 	public interface IMHandler
 	{
-		void Handle(Session session, AMessage message);
+		void Handle(AMessage message);
 		Type GetMessageType();
 	}
 }

+ 2 - 2
Unity/Assets/Scripts/Base/Message/MessageInfo.cs

@@ -1,8 +1,8 @@
 namespace Model
 {
-	public class MessageInfo
+	public struct MessageInfo
 	{
-		public ushort Opcode { get; }
+		public ushort Opcode { get; set; }
 		public AMessage Message { get; set; }
 
 		public MessageInfo(ushort opcode, AMessage message)

+ 56 - 0
Unity/Assets/Scripts/Component/ClientFrameComponent.cs

@@ -0,0 +1,56 @@
+using System.Collections.Generic;
+
+namespace Model
+{
+    [ObjectEvent]
+    public class ClientFrameComponentEvent : ObjectEvent<ClientFrameComponent>, IUpdate
+    {
+        public void Update()
+        {
+            this.Get().Update();
+        }
+    }
+
+    public class ClientFrameComponent: Component
+    {
+        public int Frame;
+
+        public Queue<FrameMessage> Queue = new Queue<FrameMessage>();
+
+        public int count = 1;
+
+        public void Add(FrameMessage frameMessage)
+        {
+            this.Queue.Enqueue(frameMessage);
+        }
+
+        public void Update()
+        {
+            int queueCount = this.Queue.Count;
+            if (queueCount == 0)
+            {
+                return;
+            }
+            this.count = 1 + (queueCount + 3) / 5;
+            for (int i = 0; i < this.count; i++)
+            {
+                this.UpdateFrame();
+            }
+        }
+
+        private void UpdateFrame()
+        {
+            FrameMessage frameMessage = this.Queue.Dequeue();
+            this.Frame = frameMessage.Frame;
+
+            for (int i = 0; i < frameMessage.Messages.Count; ++i)
+            {
+	            AFrameMessage message = frameMessage.Messages[i];
+	            ushort opcode = Game.Scene.GetComponent<OpcodeTypeComponent>().GetOpcode(message.GetType());
+                Game.Scene.GetComponent<MessageDispatherComponent>().Handle(new MessageInfo() { Opcode= opcode, Message = message });
+            }
+
+            Game.Scene.GetComponent<CrossComponent>().Run(CrossIdType.FrameUpdate);
+        }
+    }
+}

+ 12 - 0
Unity/Assets/Scripts/Component/ClientFrameComponent.cs.meta

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

+ 2 - 2
Unity/Assets/Scripts/Component/MessageDispatherComponent.cs

@@ -52,7 +52,7 @@ namespace Model
 			}
 		}
 
-		public void Handle(Session session, MessageInfo messageInfo)
+		public void Handle(MessageInfo messageInfo)
 		{
 			List<IMHandler> actions;
 			if (!this.handlers.TryGetValue(messageInfo.Opcode, out actions))
@@ -65,7 +65,7 @@ namespace Model
 			{
 				try
 				{
-					ev.Handle(session, messageInfo.Message);
+					ev.Handle(messageInfo.Message);
 				}
 				catch (Exception e)
 				{

+ 2 - 0
Unity/Assets/Scripts/Entity/Message/Opcode.cs

@@ -2,6 +2,7 @@
 {
 	public static partial class Opcode
 	{
+		public const ushort FrameMessage = 1;
 		public const ushort C2R_Login = 1001;
 		public const ushort R2C_Login = 1002;
 		public const ushort R2C_ServerLog = 1003;
@@ -16,5 +17,6 @@
 		public const ushort Actor_TestResponse = 2003;
 		public const ushort Actor_TransferRequest = 2004;
 		public const ushort Actor_TransferResponse = 2005;
+		public const ushort Actor_ClickMap = 2006;
 	}
 }

+ 19 - 0
Unity/Assets/Scripts/Entity/Message/OuterMessage.cs

@@ -1,5 +1,6 @@
 // 服务器与客户端之间的消息 Opcode从1-9999
 
+using System.Collections.Generic;
 using MongoDB.Bson.Serialization;
 
 namespace Model
@@ -67,8 +68,26 @@ namespace Model
 	public class Actor_TransferResponse : AActorResponse
 	{
 	}
+	
+	
+	public struct FrameMessageInfo
+	{
+		public long Id;
+		public AMessage Message;
+	}
 
+	// 服务端发给客户端,每帧一条
+	[Message(Opcode.FrameMessage)]
+	public class FrameMessage : AMessage
+	{
+		public int Frame;
+		public List<AFrameMessage> Messages = new List<AFrameMessage>();
+	}
 
+	[Message(Opcode.Actor_ClickMap)]
+	public class Actor_ClickMap: AActorMessage
+	{
+	}
 
 	[Message(Opcode.C2M_Reload)]
 	public class C2M_Reload: ARequest

+ 1 - 1
Unity/Assets/Scripts/Handler/Actor_TestHandler.cs

@@ -3,7 +3,7 @@
 	[MessageHandler(Opcode.Actor_Test)]
 	public class Actor_TestHandler : AMHandler<Actor_Test>
 	{
-		protected override void Run(Session session, Actor_Test message)
+		protected override void Run(Actor_Test message)
 		{
 			Log.Debug(message.Info);
 		}

+ 161 - 0
Unity/Unity.Editor.Plugins.csproj

@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>10.0.20506</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AssemblyName>Assembly-CSharp-Editor-firstpass</AssemblyName>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
+    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+    <TargetFrameworkProfile></TargetFrameworkProfile>
+    <CompilerResponseFile></CompilerResponseFile>
+    <UnityProjectType>EditorPlugins:7</UnityProjectType>
+    <UnityBuildTarget>StandaloneWindows:5</UnityBuildTarget>
+    <UnityVersion>2017.1.0p5</UnityVersion>
+    <RootNamespace></RootNamespace>
+    <LangVersion>6</LangVersion>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>Temp\UnityVS_bin\Debug\</OutputPath>
+    <IntermediateOutputPath>Temp\UnityVS_obj\Debug\</IntermediateOutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <DefineConstants>DEBUG;TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_1_0;UNITY_2017_1;UNITY_2017;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;ENABLE_SPRITE_MASKING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_VIDEO;ENABLE_RMGUI;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_STYLE_SHEETS;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE;ENABLE_VSTU;NET45</DefineConstants>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>Temp\UnityVS_bin\Release\</OutputPath>
+    <IntermediateOutputPath>Temp\UnityVS_obj\Release\</IntermediateOutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <DefineConstants>TRACE;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_1_0;UNITY_2017_1;UNITY_2017;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_DUCK_TYPING;ENABLE_GENERICS;ENABLE_PVR_GI;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_RUNTIME_NAVMESH_BUILDING;ENABLE_SPRITERENDERER_FLIPPING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_RAKNET;ENABLE_DIRECTOR;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_HUB;ENABLE_CLOUD_PROJECT_ID;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_TIMELINE;ENABLE_EDITOR_METRICS;ENABLE_EDITOR_METRICS_CACHING;ENABLE_NATIVE_ARRAY;ENABLE_SPRITE_MASKING;INCLUDE_DYNAMIC_GI;INCLUDE_GI;ENABLE_MONO_BDWGC;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;INCLUDE_PUBNUB;ENABLE_PLAYMODE_TESTS_RUNNER;ENABLE_VIDEO;ENABLE_RMGUI;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_STYLE_SHEETS;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_SUBSTANCE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_UNITYWEBREQUEST;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_EVENT_QUEUE;ENABLE_CLUSTERINPUT;ENABLE_VR;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_4_6;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_NATIVE_ARRAY_CHECKS;UNITY_TEAM_LICENSE;ENABLE_VSTU;NET45</DefineConstants>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="mscorlib" />
+    <Reference Include="System" />
+    <Reference Include="System.XML" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="UnityEditor">
+      <HintPath>Library\UnityAssemblies\UnityEditor.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEngine">
+      <HintPath>Library\UnityAssemblies\UnityEngine.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.Advertisements">
+      <HintPath>Library\UnityAssemblies\UnityEditor.Advertisements.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEngine.UI">
+      <HintPath>Library\UnityAssemblies\UnityEngine.UI.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.UI">
+      <HintPath>Library\UnityAssemblies\UnityEditor.UI.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEngine.Networking">
+      <HintPath>Library\UnityAssemblies\UnityEngine.Networking.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.Networking">
+      <HintPath>Library\UnityAssemblies\UnityEditor.Networking.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.TestRunner">
+      <HintPath>Library\UnityAssemblies\UnityEditor.TestRunner.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEngine.TestRunner">
+      <HintPath>Library\UnityAssemblies\UnityEngine.TestRunner.dll</HintPath>
+    </Reference>
+    <Reference Include="nunit.framework">
+      <HintPath>Library\UnityAssemblies\nunit.framework.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEngine.Timeline">
+      <HintPath>Library\UnityAssemblies\UnityEngine.Timeline.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.Timeline">
+      <HintPath>Library\UnityAssemblies\UnityEditor.Timeline.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.TreeEditor">
+      <HintPath>Library\UnityAssemblies\UnityEditor.TreeEditor.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEngine.Analytics">
+      <HintPath>Library\UnityAssemblies\UnityEngine.Analytics.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.Analytics">
+      <HintPath>Library\UnityAssemblies\UnityEditor.Analytics.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.HoloLens">
+      <HintPath>Library\UnityAssemblies\UnityEditor.HoloLens.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEngine.HoloLens">
+      <HintPath>Library\UnityAssemblies\UnityEngine.HoloLens.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.Purchasing">
+      <HintPath>Library\UnityAssemblies\UnityEditor.Purchasing.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.VR">
+      <HintPath>Library\UnityAssemblies\UnityEditor.VR.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.Graphs">
+      <HintPath>Library\UnityAssemblies\UnityEditor.Graphs.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.Android.Extensions">
+      <HintPath>Library\UnityAssemblies\UnityEditor.Android.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="UnityEditor.WindowsStandalone.Extensions">
+      <HintPath>Library\UnityAssemblies\UnityEditor.WindowsStandalone.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="SyntaxTree.VisualStudio.Unity.Bridge">
+      <HintPath>Library\UnityAssemblies\SyntaxTree.VisualStudio.Unity.Bridge.dll</HintPath>
+    </Reference>
+    <Reference Include="Newtonsoft.Json">
+      <HintPath>Assets\JsonDotNet\Assemblies\Standalone\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="ICSharpCode.SharpZipLib">
+      <HintPath>Assets\Plugins\ICSharpCode.SharpZipLib.dll</HintPath>
+    </Reference>
+    <Reference Include="NPOI">
+      <HintPath>Assets\Plugins\npoi\NPOI.dll</HintPath>
+    </Reference>
+    <Reference Include="NPOI.OOXML">
+      <HintPath>Assets\Plugins\npoi\NPOI.OOXML.dll</HintPath>
+    </Reference>
+    <Reference Include="NPOI.OpenXml4Net">
+      <HintPath>Assets\Plugins\npoi\NPOI.OpenXml4Net.dll</HintPath>
+    </Reference>
+    <Reference Include="NPOI.OpenXmlFormats">
+      <HintPath>Assets\Plugins\npoi\NPOI.OpenXmlFormats.dll</HintPath>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="Unity.Plugins.csproj">
+      <Project>{D1FDB199-0FB7-099D-3771-C6A942E4E326}</Project>
+      <Name>Unity.Plugins</Name>
+    </ProjectReference>
+    <ProjectReference Include="Unity.csproj">
+      <Project>{CF118143-7E37-744F-BE45-3F55345FEC40}</Project>
+      <Name>Unity</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Assets\Plugins\Editor\JetBrains\Unity3DRider.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Assets\JsonDotNet\Assemblies\AOT\Newtonsoft.Json.XML" />
+    <None Include="Assets\JsonDotNet\Assemblies\Standalone\Newtonsoft.Json.XML" />
+    <None Include="Assets\JsonDotNet\Assemblies\Windows\Newtonsoft.Json.XML" />
+    <None Include="Assets\JsonDotNet\link.xml" />
+    <None Include="Assets\Res\Config\BuffConfig.txt" />
+    <None Include="Assets\Res\Config\UnitConfig.txt" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="GenerateTargetFrameworkMonikerAttribute" />
+</Project>

+ 8 - 4
Unity/Unity.Editor.csproj

@@ -11,7 +11,7 @@
     <FileAlignment>512</FileAlignment>
     <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
     <TargetFrameworkProfile></TargetFrameworkProfile>
     <CompilerResponseFile></CompilerResponseFile>
     <UnityProjectType>Editor:5</UnityProjectType>
@@ -43,7 +43,7 @@
   <ItemGroup>
     <Reference Include="mscorlib" />
     <Reference Include="System" />
-    <Reference Include="System.Xml" />
+    <Reference Include="System.XML" />
     <Reference Include="System.Core" />
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.Xml.Linq" />
@@ -75,7 +75,7 @@
       <HintPath>Library\UnityAssemblies\UnityEngine.TestRunner.dll</HintPath>
     </Reference>
     <Reference Include="nunit.framework">
-      <HintPath>C:\Apps\Unity\Editor\Data/Managed/nunit.framework.dll</HintPath>
+      <HintPath>Library\UnityAssemblies\nunit.framework.dll</HintPath>
     </Reference>
     <Reference Include="UnityEngine.Timeline">
       <HintPath>Library\UnityAssemblies\UnityEngine.Timeline.dll</HintPath>
@@ -144,6 +144,10 @@
       <Project>{CF118143-7E37-744F-BE45-3F55345FEC40}</Project>
       <Name>Unity</Name>
     </ProjectReference>
+    <ProjectReference Include="Unity.Editor.Plugins.csproj">
+      <Project>{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}</Project>
+      <Name>Unity.Editor.Plugins</Name>
+    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Assets\Editor\BehaviorTreeEditor\BehaviorNodeConfigExtension.cs" />
@@ -198,4 +202,4 @@
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="GenerateTargetFrameworkMonikerAttribute" />
-</Project>
+</Project>

+ 4 - 4
Unity/Unity.Plugins.csproj

@@ -11,7 +11,7 @@
     <FileAlignment>512</FileAlignment>
     <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
     <TargetFrameworkProfile></TargetFrameworkProfile>
     <CompilerResponseFile></CompilerResponseFile>
     <UnityProjectType>GamePlugins:3</UnityProjectType>
@@ -43,7 +43,7 @@
   <ItemGroup>
     <Reference Include="mscorlib" />
     <Reference Include="System" />
-    <Reference Include="System.Xml" />
+    <Reference Include="System.XML" />
     <Reference Include="System.Core" />
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.Xml.Linq" />
@@ -63,7 +63,7 @@
       <HintPath>Library\UnityAssemblies\UnityEngine.TestRunner.dll</HintPath>
     </Reference>
     <Reference Include="nunit.framework">
-      <HintPath>C:\Apps\Unity\Editor\Data/Managed/nunit.framework.dll</HintPath>
+      <HintPath>Library\UnityAssemblies\nunit.framework.dll</HintPath>
     </Reference>
     <Reference Include="UnityEngine.Timeline">
       <HintPath>Library\UnityAssemblies\UnityEngine.Timeline.dll</HintPath>
@@ -518,4 +518,4 @@
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="GenerateTargetFrameworkMonikerAttribute" />
-</Project>
+</Project>

+ 8 - 10
Unity/Unity.csproj

@@ -11,16 +11,13 @@
     <FileAlignment>512</FileAlignment>
     <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
-    <TargetFrameworkProfile>
-    </TargetFrameworkProfile>
-    <CompilerResponseFile>
-    </CompilerResponseFile>
+    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+    <TargetFrameworkProfile></TargetFrameworkProfile>
+    <CompilerResponseFile></CompilerResponseFile>
     <UnityProjectType>Game:1</UnityProjectType>
     <UnityBuildTarget>StandaloneWindows:5</UnityBuildTarget>
     <UnityVersion>2017.1.0p5</UnityVersion>
-    <RootNamespace>
-    </RootNamespace>
+    <RootNamespace></RootNamespace>
     <LangVersion>6</LangVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -46,7 +43,7 @@
   <ItemGroup>
     <Reference Include="mscorlib" />
     <Reference Include="System" />
-    <Reference Include="System.Xml" />
+    <Reference Include="System.XML" />
     <Reference Include="System.Core" />
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.Xml.Linq" />
@@ -66,7 +63,7 @@
       <HintPath>Library\UnityAssemblies\UnityEngine.TestRunner.dll</HintPath>
     </Reference>
     <Reference Include="nunit.framework">
-      <HintPath>C:\Apps\Unity\Editor\Data/Managed/nunit.framework.dll</HintPath>
+      <HintPath>Library\UnityAssemblies\nunit.framework.dll</HintPath>
     </Reference>
     <Reference Include="UnityEngine.Timeline">
       <HintPath>Library\UnityAssemblies\UnityEngine.Timeline.dll</HintPath>
@@ -514,6 +511,7 @@
     <Compile Include="Assets\Scripts\BehaviorTreeNode\True.cs" />
     <Compile Include="Assets\Scripts\BehaviorTreeNode\UIScale.cs" />
     <Compile Include="Assets\Scripts\Component\BehaviorTreeComponent.cs" />
+    <Compile Include="Assets\Scripts\Component\ClientFrameComponent.cs" />
     <Compile Include="Assets\Scripts\Component\Config\ClientConfig.cs" />
     <Compile Include="Assets\Scripts\Component\Config\DBConfig.cs" />
     <Compile Include="Assets\Scripts\Component\Config\HttpConfig.cs" />
@@ -568,4 +566,4 @@
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="GenerateTargetFrameworkMonikerAttribute" />
-</Project>
+</Project>

+ 33 - 24
Unity/Unity.sln

@@ -1,12 +1,17 @@
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-firstpass", "Assembly-CSharp-firstpass.csproj", "{2662B409-6332-1E56-D797-C9025C53BDD6}"
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26730.15
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Plugins", "Unity.Plugins.csproj", "{D1FDB199-0FB7-099D-3771-C6A942E4E326}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{CD8C9303-404B-FB8D-6B9B-21988D5CAC0A}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Unity.csproj", "{CF118143-7E37-744F-BE45-3F55345FEC40}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{6311E6C6-0A20-383B-320B-694068DE37A5}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor", "Unity.Editor.csproj", "{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor-firstpass", "Assembly-CSharp-Editor-firstpass.csproj", "{F534D6C4-3368-032B-289C-A943CC171719}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor.Plugins", "Unity.Editor.Plugins.csproj", "{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Hotfix", "Hotfix\Unity.Hotfix.csproj", "{40533600-4E69-4F7D-A924-E1A3B4127255}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -14,27 +19,31 @@ Global
 		Release|Any CPU = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{2662B409-6332-1E56-D797-C9025C53BDD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{2662B409-6332-1E56-D797-C9025C53BDD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{2662B409-6332-1E56-D797-C9025C53BDD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{2662B409-6332-1E56-D797-C9025C53BDD6}.Release|Any CPU.Build.0 = Release|Any CPU
-		{CD8C9303-404B-FB8D-6B9B-21988D5CAC0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{CD8C9303-404B-FB8D-6B9B-21988D5CAC0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{CD8C9303-404B-FB8D-6B9B-21988D5CAC0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{CD8C9303-404B-FB8D-6B9B-21988D5CAC0A}.Release|Any CPU.Build.0 = Release|Any CPU
-		{6311E6C6-0A20-383B-320B-694068DE37A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{6311E6C6-0A20-383B-320B-694068DE37A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{6311E6C6-0A20-383B-320B-694068DE37A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{6311E6C6-0A20-383B-320B-694068DE37A5}.Release|Any CPU.Build.0 = Release|Any CPU
-		{F534D6C4-3368-032B-289C-A943CC171719}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{F534D6C4-3368-032B-289C-A943CC171719}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{F534D6C4-3368-032B-289C-A943CC171719}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{F534D6C4-3368-032B-289C-A943CC171719}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D1FDB199-0FB7-099D-3771-C6A942E4E326}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D1FDB199-0FB7-099D-3771-C6A942E4E326}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D1FDB199-0FB7-099D-3771-C6A942E4E326}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D1FDB199-0FB7-099D-3771-C6A942E4E326}.Release|Any CPU.Build.0 = Release|Any CPU
+		{CF118143-7E37-744F-BE45-3F55345FEC40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{CF118143-7E37-744F-BE45-3F55345FEC40}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{CF118143-7E37-744F-BE45-3F55345FEC40}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{CF118143-7E37-744F-BE45-3F55345FEC40}.Release|Any CPU.Build.0 = Release|Any CPU
+		{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}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|Any CPU.Build.0 = Release|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Release|Any CPU.Build.0 = Release|Any CPU
+		{40533600-4E69-4F7D-A924-E1A3B4127255}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{40533600-4E69-4F7D-A924-E1A3B4127255}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{40533600-4E69-4F7D-A924-E1A3B4127255}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{40533600-4E69-4F7D-A924-E1A3B4127255}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
-	GlobalSection(MonoDevelopProperties) = preSolution
-		StartupItem = Assembly-CSharp.csproj
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {831A2AF4-3FBE-48B2-8E2B-F2D54966AE04}
 	EndGlobalSection
 EndGlobal