Эх сурвалжийг харах

修复代码类调用的循环依赖

tanghai 3 жил өмнө
parent
commit
155d9019ee

+ 14 - 0
Codes/Hotfix/Server/Demo/Helper/MessageHelper.cs

@@ -6,6 +6,20 @@ namespace ET.Server
 {
     public static class MessageHelper
     {
+        public static void NoticeUnitAdd(Unit unit, Unit sendUnit)
+        {
+            M2C_CreateUnits createUnits = new M2C_CreateUnits();
+            createUnits.Units.Add(UnitHelper.CreateUnitInfo(sendUnit));
+            MessageHelper.SendToClient(unit, createUnits);
+        }
+        
+        public static void NoticeUnitRemove(Unit unit, Unit sendUnit)
+        {
+            M2C_RemoveUnits removeUnits = new M2C_RemoveUnits();
+            removeUnits.Units.Add(sendUnit.Id);
+            MessageHelper.SendToClient(unit, removeUnits);
+        }
+        
         public static void Broadcast(Unit unit, IActorMessage message)
         {
             Dictionary<long, AOIEntity> dict = unit.GetBeSeePlayers();

+ 1 - 1
Codes/Hotfix/Server/Demo/Map/Unit/UnitEnterSightRange_NotifyClient.cs

@@ -21,7 +21,7 @@
 
             Unit ub = b.GetParent<Unit>();
 
-            UnitHelper.NoticeUnitAdd(ua, ub);
+            MessageHelper.NoticeUnitAdd(ua, ub);
         }
     }
 }

+ 0 - 14
Codes/Hotfix/Server/Demo/Map/Unit/UnitHelper.cs

@@ -53,19 +53,5 @@ namespace ET.Server
         {
             return self.GetComponent<AOIEntity>().GetBeSeePlayers();
         }
-        
-        public static void NoticeUnitAdd(Unit unit, Unit sendUnit)
-        {
-            M2C_CreateUnits createUnits = new M2C_CreateUnits();
-            createUnits.Units.Add(CreateUnitInfo(sendUnit));
-            MessageHelper.SendToClient(unit, createUnits);
-        }
-        
-        public static void NoticeUnitRemove(Unit unit, Unit sendUnit)
-        {
-            M2C_RemoveUnits removeUnits = new M2C_RemoveUnits();
-            removeUnits.Units.Add(sendUnit.Id);
-            MessageHelper.SendToClient(unit, removeUnits);
-        }
     }
 }

+ 1 - 1
Codes/Hotfix/Server/Demo/Map/Unit/UnitLeaveSightRange_NotifyClient.cs

@@ -13,7 +13,7 @@
                 return;
             }
 
-            UnitHelper.NoticeUnitRemove(a.GetParent<Unit>(), b.GetParent<Unit>());
+            MessageHelper.NoticeUnitRemove(a.GetParent<Unit>(), b.GetParent<Unit>());
         }
     }
 }