ソースを参照

简化下获取SceneType的调用

tanghai 2 年 前
コミット
597866cb53

+ 2 - 2
Unity/Assets/Scripts/Codes/Hotfix/Client/Module/Message/NetClientComponentSystem.cs

@@ -58,7 +58,7 @@ namespace ET.Client
             long channelId = NetServices.Instance.CreateConnectChannelId();
             Session session = self.AddChildWithId<Session, int>(channelId, self.ServiceId);
             session.RemoteAddress = realIPEndPoint;
-            if (self.DomainScene().SceneType != SceneType.Benchmark)
+            if (self.Domain.SceneType != SceneType.Benchmark)
             {
                 session.AddComponent<SessionIdleCheckerComponent>();
             }
@@ -72,7 +72,7 @@ namespace ET.Client
             long channelId = localConn;
             Session session = self.AddChildWithId<Session, int>(channelId, self.ServiceId);
             session.RemoteAddress = realIPEndPoint;
-            if (self.DomainScene().SceneType != SceneType.Benchmark)
+            if (self.Domain.SceneType != SceneType.Benchmark)
             {
                 session.AddComponent<SessionIdleCheckerComponent>();
             }

+ 1 - 1
Unity/Assets/Scripts/Codes/Hotfix/Server/Module/Actor/ActorMessageDispatcherComponentSystem.cs

@@ -101,7 +101,7 @@ namespace ET.Server
                 throw new Exception($"not found message handler: {message} {entity.GetType().Name}");
             }
 
-            SceneType sceneType = entity.DomainScene().SceneType;
+            SceneType sceneType = entity.Domain.SceneType;
             foreach (ActorMessageDispatcherInfo actorMessageDispatcherInfo in list)
             {
                 if (!actorMessageDispatcherInfo.SceneType.HasSameFlag(sceneType))

+ 1 - 1
Unity/Assets/Scripts/Codes/Hotfix/Server/Module/Http/HttpComponentSystem.cs

@@ -62,7 +62,7 @@ namespace ET.Server
 
             HashSet<Type> types = EventSystem.Instance.GetTypes(typeof (HttpHandlerAttribute));
 
-            SceneType sceneType = self.GetParent<Scene>().SceneType;
+            SceneType sceneType = (self.Parent as IScene).SceneType;
 
             foreach (Type type in types)
             {

+ 1 - 1
Unity/Assets/Scripts/Codes/Hotfix/Server/Module/Message/NetServerComponentSystem.cs

@@ -44,7 +44,7 @@ namespace ET.Server
             Session session = self.AddChildWithId<Session, int>(channelId, self.ServiceId);
             session.RemoteAddress = ipEndPoint;
 
-            if (self.DomainScene().SceneType != SceneType.BenchmarkServer)
+            if (self.Domain.SceneType != SceneType.BenchmarkServer)
             {
                 // 挂上这个组件,5秒就会删除session,所以客户端验证完成要删除这个组件。该组件的作用就是防止外挂一直连接不发消息也不进行权限验证
                 session.AddComponent<SessionAcceptTimeoutComponent>();

+ 1 - 1
Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Message/MessageDispatcherComponentSystem.cs

@@ -94,7 +94,7 @@ namespace ET
                 return;
             }
 
-            SceneType sceneType = session.DomainScene().SceneType;
+            SceneType sceneType = session.Domain.SceneType;
             foreach (MessageDispatcherInfo ev in actions)
             {
                 if (!ev.SceneType.HasSameFlag(sceneType))

+ 1 - 1
Unity/Assets/Scripts/Codes/Model/Share/Module/Numeric/NumericWatcherComponent.cs

@@ -56,7 +56,7 @@ namespace ET
                 return;
             }
 
-            SceneType unitDomainSceneType = unit.DomainScene().SceneType;
+            SceneType unitDomainSceneType = unit.Domain.SceneType;
             foreach (NumericWatcherInfo numericWatcher in list)
             {
                 if (!numericWatcher.SceneType.HasSameFlag(unitDomainSceneType))