Browse Source

增加随机分配一个Game逻辑

johnclot69 1 year ago
parent
commit
7b75e1f753

+ 1 - 0
DotNet/Hotfix/Scenes/Realm/Handler/C2R_LoginHandler.cs

@@ -22,6 +22,7 @@ namespace ET.Server
 			if (session.GetComponent<SessionLockComponent>() != null)
 			{
 				response.Error = ErrorCode.ERR_RequestRepeatedly;
+				reply();
 				return;
 			}
 			

+ 12 - 3
DotNet/Hotfix/Scenes/Realm/RealmGameAddressHelper.cs

@@ -7,11 +7,20 @@ namespace ET.Server
 	{
 		public static StartSceneConfig GetGame(int zone)
 		{
-			List<StartSceneConfig> zoneGates = StartSceneConfigCategory.Instance.Games[zone];
+			List<StartSceneConfig> zoneGames = StartSceneConfigCategory.Instance.Games[zone];
 			
-			int n = RandomGenerator.RandomNumber(0, zoneGates.Count);
+			int n = RandomGenerator.RandomNumber(0, zoneGames.Count);
 
-			return zoneGates[n];
+			return zoneGames[n];
+		}
+		
+		public static StartSceneConfig GetGame(int zone, long accountId)
+		{
+			List<StartSceneConfig> zoneGames = StartSceneConfigCategory.Instance.Games[zone];
+			
+			int n = accountId.GetHashCode() % zoneGames.Count;
+
+			return zoneGames[n];
 		}
 	}
 }