tanghai 9 жил өмнө
parent
commit
f11b40f8b1

+ 2 - 0
README

@@ -1,5 +1,7 @@
 ET框架:一个Unity客户端和分布式游戏服务器框架
 
+无缝大世界功能正在开发
+
 01.客户端服务端共用代码
 02.服务器使用组件设计,一切皆是组件
 03.单APP设计,各种服务器都是一个同样的App,在启动时根据命令行的AppType,不同的服务器挂载不同的逻辑组件,挂载不同的消息handler,挂载不同的配置

+ 1 - 1
Server/App/Program.cs

@@ -58,7 +58,7 @@ namespace App
 						break;
 					case AppType.Benchmark:
 						Game.Scene.AddComponent<NetOuterComponent>();
-						Game.Scene.AddComponent<BenchmakComponent, string>(clientConfig.Address);
+						Game.Scene.AddComponent<BenchmarkComponent, string>(clientConfig.Address);
 						break;
 					default:
 						throw new Exception($"命令行参数没有设置正确的AppType: {startConfig.AppType}");

+ 15 - 7
Server/Controller/Message/G2G_LockReleaseRequestHandler.cs

@@ -10,16 +10,24 @@ namespace Controller
 		protected override void Run(Session session, G2G_LockReleaseRequest message, Action<G2G_LockReleaseResponse> reply)
 		{
 			G2G_LockReleaseResponse g2GLockReleaseResponse = new G2G_LockReleaseResponse();
-			
-			Unit unit = Game.Scene.GetComponent<UnitComponent>().Get(message.Id);
-			if (unit == null)
+
+			try
 			{
-				g2GLockReleaseResponse.Error = ErrorCode.ERR_NotFoundUnit;
+				Unit unit = Game.Scene.GetComponent<UnitComponent>().Get(message.Id);
+				if (unit == null)
+				{
+					g2GLockReleaseResponse.Error = ErrorCode.ERR_NotFoundUnit;
+					reply(g2GLockReleaseResponse);
+					return;
+				}
+
+				unit.GetComponent<MasterComponent>().Release(message.Address);
 				reply(g2GLockReleaseResponse);
 			}
-
-			unit.GetComponent<MasterComponent>().Release(message.Address);
-			reply(g2GLockReleaseResponse);
+			catch (Exception e)
+			{
+				ReplyError(g2GLockReleaseResponse, e, reply);
+			}
 		}
 	}
 }

+ 0 - 1
Server/Controller/Message/R2G_GetLoginKeyHandler.cs

@@ -1,5 +1,4 @@
 using System;
-using System.Threading.Tasks;
 using Base;
 using Model;
 

+ 1 - 1
Server/Model/Component/Unit/LockComponent.cs

@@ -23,7 +23,7 @@ namespace Model
 		private int lockCount;
 		private readonly Queue<TaskCompletionSource<bool>> queue = new Queue<TaskCompletionSource<bool>>();
 
-		public void Awake(string addr)
+		public void Awake(string addr)	
 		{
 			this.address = addr;
 		}

+ 8 - 5
Server/Model/Component/Unit/MasterComponent.cs

@@ -19,20 +19,23 @@ namespace Model
 	[EntityEvent(typeof(MasterComponent))]
 	public class MasterComponent : Component
 	{
-		private readonly List<string> slavesAddress = new List<string>();
+		/// 镜像的地址
+		private readonly List<string> ghostsAddress = new List<string>();
 
+		/// 当前获取锁的进程地址
 		private string lockedAddress = "";
 
+		/// 请求锁的队列
 		private readonly Queue<LockInfo> queue = new Queue<LockInfo>();
 
-		public void AddSlave(string address)
+		public void AddGhost(string address)
 		{
-			this.slavesAddress.Add(address);
+			this.ghostsAddress.Add(address);
 		}
 
-		public void RemoveSlave(string address)
+		public void RemoveGhost(string address)
 		{
-			this.slavesAddress.Remove(address);
+			this.ghostsAddress.Remove(address);
 		}
 
 		public Task<bool> Lock(string address)

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

@@ -41,8 +41,8 @@
     <Reference Include="System.Core" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="..\..\Unity\Assets\Scripts\Component\BenchmakComponent.cs">
-      <Link>Component\BenchmakComponent.cs</Link>
+    <Compile Include="..\..\Unity\Assets\Scripts\Component\BenchmarkComponent.cs">
+      <Link>Component\BenchmarkComponent.cs</Link>
     </Compile>
     <Compile Include="..\..\Unity\Assets\Scripts\Component\ConfigComponent.cs">
       <Link>Component\ConfigComponent.cs</Link>

BIN
Unity/Assets/Resources/Code.prefab


BIN
Unity/Assets/Resources/Config.prefab


BIN
Unity/Assets/Scenes/Unity.unity


BIN
Unity/ProjectSettings/AudioManager.asset


BIN
Unity/ProjectSettings/ClusterInputManager.asset


BIN
Unity/ProjectSettings/DynamicsManager.asset


BIN
Unity/ProjectSettings/EditorBuildSettings.asset


BIN
Unity/ProjectSettings/EditorSettings.asset


BIN
Unity/ProjectSettings/GraphicsSettings.asset


BIN
Unity/ProjectSettings/InputManager.asset


BIN
Unity/ProjectSettings/NavMeshAreas.asset


BIN
Unity/ProjectSettings/NetworkManager.asset


BIN
Unity/ProjectSettings/Physics2DSettings.asset


BIN
Unity/ProjectSettings/ProjectSettings.asset


+ 1 - 1
Unity/ProjectSettings/ProjectVersion.txt

@@ -1,2 +1,2 @@
-m_EditorVersion: 5.4.1f1
+m_EditorVersion: 5.4.3f1
 m_StandardAssetsVersion: 0

BIN
Unity/ProjectSettings/QualitySettings.asset


BIN
Unity/ProjectSettings/TagManager.asset


BIN
Unity/ProjectSettings/TimeManager.asset


BIN
Unity/ProjectSettings/UnityAdsSettings.asset


BIN
Unity/ProjectSettings/UnityConnectSettings.asset