ソースを参照

修复一系列起服错误,修复导表错误

tanghai 2 年 前
コミット
d83260c1e0
64 ファイル変更270 行追加160 行削除
  1. BIN
      Config/Excel/cs/StartConfig/Localhost/StartSceneConfigCategory.bytes
  2. BIN
      Config/Excel/s/StartConfig/Localhost/StartSceneConfigCategory.bytes
  3. 0 1
      Config/Json/cs/StartConfig/Localhost/StartSceneConfig.txt
  4. 0 1
      Config/Json/s/StartConfig/Localhost/StartSceneConfig.txt
  5. 2 0
      Share/Tool/ExcelExporter/ExcelExporter.cs
  6. 7 3
      Share/Tool/Init.cs
  7. BIN
      Unity/Assets/Config/Excel/StartConfig/Localhost/StartSceneConfig@s.xlsx
  8. 1 9
      Unity/Assets/Scripts/Core/Entity/EntitySceneFactory.cs
  9. 3 2
      Unity/Assets/Scripts/Core/Entity/Scene.cs
  10. 1 1
      Unity/Assets/Scripts/Core/Fiber/EntitySystem.cs
  11. 2 21
      Unity/Assets/Scripts/Core/Fiber/Fiber.cs
  12. 2 2
      Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorMessageSender.cs
  13. 1 1
      Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLockQueue.cs
  14. 2 2
      Unity/Assets/Scripts/Core/Fiber/Module/Timer/TimerComponent.cs
  15. 0 45
      Unity/Assets/Scripts/Core/Fiber/TimeHelper.cs
  16. 1 1
      Unity/Assets/Scripts/Core/HashSetComponent.cs
  17. 2 2
      Unity/Assets/Scripts/Core/Helper/ETCancelationTokenHelper.cs
  18. 1 1
      Unity/Assets/Scripts/Core/ListComponent.cs
  19. 4 3
      Unity/Assets/Scripts/Core/Network/KService.cs
  20. 6 1
      Unity/Assets/Scripts/Core/Network/NetServices.cs
  21. 19 11
      Unity/Assets/Scripts/Core/World/Module/Fiber/FiberManager.cs
  22. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_Attack.cs
  23. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_XunLuo.cs
  24. 2 2
      Unity/Assets/Scripts/Hotfix/Client/Demo/Ping/PingComponentSystem.cs
  25. 2 2
      Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterCheckComponentSystem.cs
  26. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterHelper.cs
  27. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientHelper.cs
  28. 2 2
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs
  29. 3 2
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSReplayUpdaterSystem.cs
  30. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSSceneChangeHelper.cs
  31. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Module/Message/NetClientComponentSystem.cs
  32. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Benchmark/C2G_BenchmarkHandler.cs
  33. 2 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/EntryEvent2_InitServer.cs
  34. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/C2G_PingHandler.cs
  35. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/FiberInit_Realm.cs
  36. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs
  37. 17 0
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FiberInit_Map.cs
  38. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FiberInit_Map.cs.meta
  39. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs
  40. 15 0
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Match/FiberInit_Match.cs
  41. 11 0
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Match/FiberInit_Match.cs.meta
  42. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs
  43. 6 6
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs
  44. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderSystem.cs
  45. 15 0
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/FiberInit_Location.cs
  46. 11 0
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/FiberInit_Location.cs.meta
  47. 4 4
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs
  48. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/NetInnerComponentSystem.cs
  49. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/Message/NetServerComponentSystem.cs
  50. 8 0
      Unity/Assets/Scripts/Hotfix/Server/Module/NetInner.meta
  51. 17 0
      Unity/Assets/Scripts/Hotfix/Server/Module/NetInner/FiberInit_NetInner.cs
  52. 11 0
      Unity/Assets/Scripts/Hotfix/Server/Module/NetInner/FiberInit_NetInner.cs.meta
  53. 16 0
      Unity/Assets/Scripts/Hotfix/Server/Module/Router/FiberInit_Router.cs
  54. 11 0
      Unity/Assets/Scripts/Hotfix/Server/Module/Router/FiberInit_Router.cs.meta
  55. 16 0
      Unity/Assets/Scripts/Hotfix/Server/Module/Router/FiberInit_RouterManager.cs
  56. 11 0
      Unity/Assets/Scripts/Hotfix/Server/Module/Router/FiberInit_RouterManager.cs.meta
  57. 2 2
      Unity/Assets/Scripts/Hotfix/Server/Module/Router/RouterComponentSystem.cs
  58. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Module/Router/RouterNodeSystem.cs
  59. 6 5
      Unity/Assets/Scripts/Hotfix/Share/Module/Actor/ActorSenderComponentSystem.cs
  60. 1 1
      Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionAcceptTimeoutComponentSystem.cs
  61. 1 1
      Unity/Assets/Scripts/Hotfix/Share/Module/Message/SessionIdleCheckerComponentSystem.cs
  62. 2 2
      Unity/Assets/Scripts/Hotfix/Share/Module/Move/MoveComponentSystem.cs
  63. 4 3
      Unity/Assets/Scripts/Model/Share/Entry.cs
  64. 3 3
      Unity/Assets/Scripts/Model/Share/Module/Message/Session.cs

BIN
Config/Excel/cs/StartConfig/Localhost/StartSceneConfigCategory.bytes


BIN
Config/Excel/s/StartConfig/Localhost/StartSceneConfigCategory.bytes


+ 0 - 1
Config/Json/cs/StartConfig/Localhost/StartSceneConfig.txt

@@ -6,7 +6,6 @@
 [5, {"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Match","Name":"Match","OuterPort":0}],
 [6, {"_t":"StartSceneConfig","_id":6,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map1","OuterPort":0}],
 [7, {"_t":"StartSceneConfig","_id":7,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map2","OuterPort":0}],
-[200, {"_t":"StartSceneConfig","_id":200,"Process":1,"Zone":2,"SceneType":"Robot","Name":"Robot01","OuterPort":0}],
 [300, {"_t":"StartSceneConfig","_id":300,"Process":1,"Zone":3,"SceneType":"RouterManager","Name":"RouterManager","OuterPort":30300}],
 [301, {"_t":"StartSceneConfig","_id":301,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router01","OuterPort":30301}],
 [302, {"_t":"StartSceneConfig","_id":302,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router02","OuterPort":30302}],

+ 0 - 1
Config/Json/s/StartConfig/Localhost/StartSceneConfig.txt

@@ -6,7 +6,6 @@
 [5, {"_t":"StartSceneConfig","_id":5,"Process":1,"Zone":1,"SceneType":"Match","Name":"Match","OuterPort":0}],
 [6, {"_t":"StartSceneConfig","_id":6,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map1","OuterPort":0}],
 [7, {"_t":"StartSceneConfig","_id":7,"Process":1,"Zone":1,"SceneType":"Map","Name":"Map2","OuterPort":0}],
-[200, {"_t":"StartSceneConfig","_id":200,"Process":1,"Zone":2,"SceneType":"Robot","Name":"Robot01","OuterPort":0}],
 [300, {"_t":"StartSceneConfig","_id":300,"Process":1,"Zone":3,"SceneType":"RouterManager","Name":"RouterManager","OuterPort":30300}],
 [301, {"_t":"StartSceneConfig","_id":301,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router01","OuterPort":30301}],
 [302, {"_t":"StartSceneConfig","_id":302,"Process":1,"Zone":3,"SceneType":"Router","Name":"Router02","OuterPort":30302}],

+ 2 - 0
Share/Tool/ExcelExporter/ExcelExporter.cs

@@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.CSharp;
 using Microsoft.CodeAnalysis.Emit;
 using MongoDB.Bson;
 using MongoDB.Bson.Serialization;
+using MongoDB.Bson.Serialization.Attributes;
 using OfficeOpenXml;
 using LicenseContext = OfficeOpenXml.LicenseContext;
 
@@ -24,6 +25,7 @@ namespace ET
 
     class HeadInfo
     {
+        [BsonElement]
         public string FieldCS;
         public string FieldDesc;
         public string FieldName;

+ 7 - 3
Share/Tool/Init.cs

@@ -29,11 +29,15 @@ namespace ET.Server
                 //process.AddSingleton<ObjectPool>();
                 //process.AddSingleton<IdGenerater>();
                 
+                
+                Dictionary<string, Type> types = AssemblyHelper.GetAssemblyTypes(typeof (Init).Assembly);
+                World.Instance.AddSingleton<EventSystem, Dictionary<string, Type>>(types);
+                
+                MongoHelper.Register();
+                
                 ETTask.ExceptionHandler += Log.Error;
                 
-                //process.AddSingleton<EventSystem>();
-                //Dictionary<string, Type> types = AssemblyHelper.GetAssemblyTypes(typeof (Process).Assembly);
-                //EventSystem.Instance.Add(types);
+
 //
                 //process.AddSingleton<EntitySystemSingleton>();
                 //

BIN
Unity/Assets/Config/Excel/StartConfig/Localhost/StartSceneConfig@s.xlsx


+ 1 - 9
Unity/Assets/Scripts/Core/Entity/EntitySceneFactory.cs

@@ -4,15 +4,7 @@
     {
         public static Scene CreateScene(long id, long instanceId, int zone, SceneType sceneType, string name, Entity parent)
         {
-            Scene scene = new(id, instanceId, zone, sceneType, name);
-            parent?.AddChild(scene);
-            return scene;
-        }
-
-        public static Scene CreateScene(int zone, SceneType sceneType, string name, Entity parent = null)
-        {
-            long instanceId = parent.Fiber().IdGenerater.GenerateInstanceId();
-            Scene scene = new(zone, instanceId, zone, sceneType, name);
+            Scene scene = new(parent.Fiber(), id, instanceId, zone, sceneType, name);
             parent?.AddChild(scene);
             return scene;
         }

+ 3 - 2
Unity/Assets/Scripts/Core/Entity/Scene.cs

@@ -30,7 +30,7 @@ namespace ET
         {
         }
 
-        public Scene(long id, long instanceId, int zone, SceneType sceneType, string name)
+        public Scene(Fiber fiber, long id, long instanceId, int zone, SceneType sceneType, string name)
         {
             this.Id = id;
             this.InstanceId = instanceId;
@@ -39,8 +39,9 @@ namespace ET
             this.Name = name;
             this.IsCreated = true;
             this.IsNew = true;
-            this.IsRegister = true;
+            this.Fiber = fiber;
             this.IScene = this;
+            this.IsRegister = true;
             Log.Info($"scene create: {this.SceneType} {this.Name} {this.Id} {this.InstanceId} {this.Zone}");
         }
 

+ 1 - 1
Unity/Assets/Scripts/Core/Fiber/EntitySystem.cs

@@ -7,7 +7,7 @@ namespace ET
     {
         private readonly Queue<EntityRef<Entity>>[] queues = new Queue<EntityRef<Entity>>[InstanceQueueIndex.Max];
         
-        public void Awake()
+        public EntitySystem()
         {
             for (int i = 0; i < this.queues.Length; i++)
             {

+ 2 - 21
Unity/Assets/Scripts/Core/Fiber/Fiber.cs

@@ -14,18 +14,6 @@ namespace ET
     
     public class Fiber: IDisposable
     {
-        [ThreadStatic]
-        [StaticField]
-        private static Fiber instance;
-
-        public static Fiber Instance
-        {
-            get
-            {
-                return instance;
-            }
-        }
-
         public int Id;
 
         public Scene Root { get; }
@@ -38,7 +26,7 @@ namespace ET
             }
         }
         
-        public int Process { get; private set; }
+        public int Process { get; }
         
         public EntitySystem EntitySystem { get; }
         public TimeInfo TimeInfo { get; }
@@ -55,14 +43,11 @@ namespace ET
             this.TimeInfo = new TimeInfo();
             this.IdGenerater = new IdGenerater(process, this.TimeInfo);
             this.Mailboxes = new Mailboxes();
-
-            this.Root = new Scene(id, 1, 0, sceneType, "");
+            this.Root = new Scene(this, id, 1, 0, sceneType, "");
         }
 
         public void Update()
         {
-            instance = this;
-            
             this.TimeInfo.Update();
             
             this.EntitySystem.Update();
@@ -70,8 +55,6 @@ namespace ET
         
         public void LateUpdate()
         {
-            instance = this;
-            
             this.EntitySystem.LateUpdate();
 
             FrameFinishUpdate();
@@ -89,8 +72,6 @@ namespace ET
         public void Dispose()
         {
             this.IsRuning = false;
-
-            instance = null;
         }
     }
 }

+ 2 - 2
Unity/Assets/Scripts/Core/Fiber/Module/Actor/ActorMessageSender.cs

@@ -16,11 +16,11 @@ namespace ET
 
         public ETTask<IActorResponse> Tcs { get; }
 
-        public ActorMessageSender(ActorId actorId, IActorRequest iActorRequest, ETTask<IActorResponse> tcs, bool needException)
+        public ActorMessageSender(ActorId actorId, IActorRequest iActorRequest, ETTask<IActorResponse> tcs, bool needException, long createTime)
         {
             this.ActorId = actorId;
             this.Request = iActorRequest;
-            this.CreateTime = TimeHelper.ServerNow();
+            this.CreateTime = createTime;
             this.Tcs = tcs;
             this.NeedException = needException;
         }

+ 1 - 1
Unity/Assets/Scripts/Core/Fiber/Module/CoroutineLock/CoroutineLockQueue.cs

@@ -31,7 +31,7 @@ namespace ET
             self.queue.Enqueue(waitCoroutineLock);
             if (time > 0)
             {
-                long tillTime = TimeHelper.ClientFrameTime() + time;
+                long tillTime = self.Fiber().TimeInfo.ClientFrameTime() + time;
                 self.Root().GetComponent<TimerComponent>().NewOnceTimer(tillTime, TimerCoreInvokeType.CoroutineTimeout, waitCoroutineLock);
             }
             self.CurrentCoroutineLock = await waitCoroutineLock.Wait();

+ 2 - 2
Unity/Assets/Scripts/Core/Fiber/Module/Timer/TimerComponent.cs

@@ -77,9 +77,9 @@ namespace ET
             return ++this.idGenerator;
         }
 
-        private static long GetNow()
+        private long GetNow()
         {
-            return TimeHelper.ClientFrameTime();
+            return this.Fiber().TimeInfo.ClientFrameTime();
         }
 
         public void Update()

+ 0 - 45
Unity/Assets/Scripts/Core/Fiber/TimeHelper.cs

@@ -1,45 +0,0 @@
-using System;
-
-namespace ET
-{
-    public static class TimeHelper
-    {
-        public const long OneDay = 86400000;
-        public const long Hour = 3600000;
-        public const long Minute = 60000;
-        
-        /// <summary>
-        /// 客户端时间
-        /// </summary>
-        /// <returns></returns>
-        public static long ClientNow()
-        {
-            return Fiber.Instance.TimeInfo.ClientNow();
-        }
-
-        public static long ClientNowSeconds()
-        {
-            return ClientNow() / 1000;
-        }
-
-        public static DateTime DateTimeNow()
-        {
-            return DateTime.Now;
-        }
-
-        public static long ServerNow()
-        {
-            return Fiber.Instance.TimeInfo.ServerNow();
-        }
-
-        public static long ClientFrameTime()
-        {
-            return Fiber.Instance.TimeInfo.ClientFrameTime();
-        }
-        
-        public static long ServerFrameTime()
-        {
-            return Fiber.Instance.TimeInfo.ServerFrameTime();
-        }
-    }
-}

+ 1 - 1
Unity/Assets/Scripts/Core/HashSetComponent.cs

@@ -5,7 +5,7 @@ namespace ET
 {
     public class HashSetComponent<T>: HashSet<T>, IDisposable
     {
-        private HashSetComponent()
+        public HashSetComponent()
         {
         }
         

+ 2 - 2
Unity/Assets/Scripts/Core/Helper/ETCancelationTokenHelper.cs

@@ -2,14 +2,14 @@ namespace ET
 {
     public static class ETCancelationTokenHelper
     {
-        public static async ETTask CancelAfter(this ETCancellationToken self, long afterTimeCancel)
+        public static async ETTask CancelAfter(this ETCancellationToken self, Fiber fiber, long afterTimeCancel)
         {
             if (self.IsCancel())
             {
                 return;
             }
 
-            await Fiber.Instance.Root.GetComponent<TimerComponent>().WaitAsync(afterTimeCancel);
+            await fiber.Root.GetComponent<TimerComponent>().WaitAsync(afterTimeCancel);
             
             if (self.IsCancel())
             {

+ 1 - 1
Unity/Assets/Scripts/Core/ListComponent.cs

@@ -5,7 +5,7 @@ namespace ET
 {
     public class ListComponent<T>: List<T>, IDisposable
     {
-        private ListComponent()
+        public ListComponent()
         {
         }
         

+ 4 - 3
Unity/Assets/Scripts/Core/Network/KService.cs

@@ -32,6 +32,7 @@ namespace ET
 
         public readonly Dictionary<long, KChannel> KcpPtrChannels = new();
         
+        private DateTime dt1970;
         // KService创建的时间
         private readonly long startTime;
 
@@ -40,7 +41,7 @@ namespace ET
         {
             get
             {
-                return (uint) (TimeHelper.ClientNow() - this.startTime);
+                return (uint)((DateTime.UtcNow.Ticks - this.startTime) / 10000);
             }
         }
 
@@ -90,7 +91,7 @@ namespace ET
         public KService(IPEndPoint ipEndPoint, ServiceType serviceType)
         {
             this.ServiceType = serviceType;
-            this.startTime = TimeHelper.ClientNow();
+            this.startTime = DateTime.UtcNow.Ticks;
             this.Socket = new Socket(ipEndPoint.AddressFamily, SocketType.Dgram, ProtocolType.Udp);
             if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
             {
@@ -113,7 +114,7 @@ namespace ET
         public KService(AddressFamily addressFamily, ServiceType serviceType)
         {
             this.ServiceType = serviceType;
-            this.startTime = TimeHelper.ClientNow();
+            this.startTime = DateTime.UtcNow.Ticks;
             this.Socket = new Socket(addressFamily, SocketType.Dgram, ProtocolType.Udp);
 
             NetworkHelper.SetSioUdpConnReset(this.Socket);

+ 6 - 1
Unity/Assets/Scripts/Core/Network/NetServices.cs

@@ -11,11 +11,15 @@ namespace ET
         Websocket,
     }
 
-    public class NetServices: Singleton<NetServices>
+    public class NetServices: Singleton<NetServices>, ISingletonAwake
     {
         private readonly ConcurrentDictionary<long, AService> services = new();
         
         private long idGenerator;
+        
+        public void Awake()
+        {
+        }
 
         public override void Destroy()
         {
@@ -56,5 +60,6 @@ namespace ET
         {
             return --this.acceptIdGenerator;
         }
+        
     }
 }

+ 19 - 11
Unity/Assets/Scripts/Core/World/Module/Fiber/FiberManager.cs

@@ -1,4 +1,5 @@
-using System.Collections.Concurrent;
+using System;
+using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Threading;
 
@@ -15,19 +16,26 @@ namespace ET
         
         public int Create(int fiberId, SceneType sceneType)
         {
-            Fiber fiber = new(fiberId, Options.Instance.Process, sceneType);
+            try
+            {
+                Fiber fiber = new(fiberId, Options.Instance.Process, sceneType);
             
-            fiber.Root.AddComponent<TimerComponent>();
-            fiber.Root.AddComponent<CoroutineLockComponent>();
-            fiber.Root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
-            fiber.Root.AddComponent<ActorSenderComponent>();
-            fiber.Root.AddComponent<ActorRecverComponent>();
+                fiber.Root.AddComponent<TimerComponent>();
+                fiber.Root.AddComponent<CoroutineLockComponent>();
+                fiber.Root.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.UnOrderedMessage);
+                fiber.Root.AddComponent<ActorSenderComponent>();
+                fiber.Root.AddComponent<ActorRecverComponent>();
             
-            // 根据Fiber的SceneType分发Init
-            EventSystem.Instance.Invoke((long)sceneType, new FiberInit() {Fiber = fiber});
+                // 根据Fiber的SceneType分发Init
+                EventSystem.Instance.Invoke((long)sceneType, new FiberInit() {Fiber = fiber});
                 
-            this.fibers[(int)fiber.Id] = fiber;
-            return fiberId;
+                this.fibers[fiber.Id] = fiber;
+                return fiberId;
+            }
+            catch (Exception e)
+            {
+                throw new Exception($"create fiber error: {fiberId} {sceneType}", e);
+            }
         }
         
         public int Create(SceneType sceneType)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_Attack.cs

@@ -4,7 +4,7 @@ namespace ET.Client
     {
         public override int Check(AIComponent aiComponent, AIConfig aiConfig)
         {
-            long sec = TimeHelper.ClientNow() / 1000 % 15;
+            long sec = aiComponent.Fiber().TimeInfo.ClientNow() / 1000 % 15;
             if (sec >= 10)
             {
                 return 0;

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_XunLuo.cs

@@ -6,7 +6,7 @@ namespace ET.Client
     {
         public override int Check(AIComponent aiComponent, AIConfig aiConfig)
         {
-            long sec = TimeHelper.ClientNow() / 1000 % 15;
+            long sec = aiComponent.Fiber().TimeInfo.ClientNow() / 1000 % 15;
             if (sec < 10)
             {
                 return 0;

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Client/Demo/Ping/PingComponentSystem.cs

@@ -29,7 +29,7 @@ namespace ET.Client
                     return;
                 }
 
-                long time1 = TimeHelper.ClientNow();
+                long time1 = self.Fiber().TimeInfo.ClientNow();
                 try
                 {
                     C2G_Ping c2GPing = C2G_Ping.Create(true);
@@ -40,7 +40,7 @@ namespace ET.Client
                         return;
                     }
 
-                    long time2 = TimeHelper.ClientNow();
+                    long time2 = self.Fiber().TimeInfo.ClientNow();
                     self.Ping = time2 - time1;
                     
                     fiber.TimeInfo.ServerMinusClientTime = response.Time + (time2 - time1) / 2 - time2;

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterCheckComponentSystem.cs

@@ -30,7 +30,7 @@ namespace ET.Client
                     return;
                 }
 
-                long time = TimeHelper.ClientFrameTime();
+                long time = self.Fiber().TimeInfo.ClientFrameTime();
 
                 if (time - session.LastRecvTime < 7 * 1000)
                 {
@@ -55,7 +55,7 @@ namespace ET.Client
                     
                     Log.Info($"get recvLocalConn ok: {root.Id} {routerAddress} {realAddress} {recvLocalConn} {localConn} {remoteConn}");
                     
-                    session.LastRecvTime = TimeHelper.ClientNow();
+                    session.LastRecvTime = self.Fiber().TimeInfo.ClientNow();
                     
                     session.AService.ChangeAddress(sessionId, routerAddress);
                 }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Router/RouterHelper.cs

@@ -65,7 +65,7 @@ namespace ET.Client
 
             while (true)
             {
-                long timeNow = TimeHelper.ClientFrameTime();
+                long timeNow = root.Fiber().TimeInfo.ClientFrameTime();
                 if (timeNow - lastSendTimer > 300)
                 {
                     if (--count < 0)

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientHelper.cs

@@ -119,7 +119,7 @@ namespace ET
                 RunLSRollbackSystem(room);
             }
             
-            room.FixedTimeCounter.Reset(TimeHelper.ServerFrameTime() - frame * LSConstValue.UpdateInterval, 0);
+            room.FixedTimeCounter.Reset(room.Fiber.TimeInfo.ServerFrameTime() - frame * LSConstValue.UpdateInterval, 0);
 
             Log.Debug($"jump replay finish {frame}");
         }

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSClientUpdaterSystem.cs

@@ -17,7 +17,7 @@ namespace ET.Client
         private static void Update(this LSClientUpdater self)
         {
             Room room = self.GetParent<Room>();
-            long timeNow = TimeHelper.ServerNow();
+            long timeNow = self.Fiber().TimeInfo.ServerNow();
             Scene root = room.Root();
 
             int i = 0;
@@ -47,7 +47,7 @@ namespace ET.Client
                 frameMessage.Input = self.Input;
                 root.GetComponent<SessionComponent>().Session.Send(frameMessage);
                 
-                long timeNow2 = TimeHelper.ServerNow();
+                long timeNow2 = self.Fiber().TimeInfo.ServerNow();
                 if (timeNow2 - timeNow > 5)
                 {
                     break;

+ 3 - 2
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSReplayUpdaterSystem.cs

@@ -9,7 +9,8 @@ namespace ET.Client
         private static void Update(this LSReplayUpdater self)
         {
             Room room = self.GetParent<Room>();
-            long timeNow = TimeHelper.ServerNow();
+            Fiber fiber = self.Fiber();
+            long timeNow = fiber.TimeInfo.ServerNow();
 
             int i = 0;
             while (true)
@@ -31,7 +32,7 @@ namespace ET.Client
                 room.Update(oneFrameInputs);
                 room.SpeedMultiply = ++i;
                 
-                long timeNow2 = TimeHelper.ServerNow();
+                long timeNow2 = fiber.TimeInfo.ServerNow();
                 if (timeNow2 - timeNow > 5)
                 {
                     break;

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSSceneChangeHelper.cs

@@ -38,7 +38,7 @@ namespace ET.Client
             room.IsReplay = true;
             room.Replay = replay;
             room.LSWorld = new LSWorld(SceneType.LockStepClient);
-            room.Init(replay.UnitInfos, TimeHelper.ServerFrameTime());
+            room.Init(replay.UnitInfos, root.Fiber().TimeInfo.ServerFrameTime());
             
             // 等待表现层订阅的事件完成
             await EventSystem.Instance.PublishAsync(root, new EventType.LSSceneChangeStart() {Room = room});

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

@@ -29,7 +29,7 @@ namespace ET.Client
                 return;
             }
 
-            session.LastRecvTime = TimeHelper.ClientNow();
+            session.LastRecvTime = self.Fiber().TimeInfo.ClientNow();
             
             Log.Debug(message.ToJson());
             

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Benchmark/C2G_BenchmarkHandler.cs

@@ -11,7 +11,7 @@ namespace ET.Server
             BenchmarkServerComponent benchmarkServerComponent = session.Scene().GetComponent<BenchmarkServerComponent>();
             if (benchmarkServerComponent.Count++ % 1000000 == 0)
             {
-                Log.Debug($"benchmark count: {benchmarkServerComponent.Count} {TimeHelper.ClientNow()}");
+                Log.Debug($"benchmark count: {benchmarkServerComponent.Count} {session.Fiber().TimeInfo.ClientNow()}");
             }
             await ETTask.CompletedTask;
         }

+ 2 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/EntryEvent2_InitServer.cs

@@ -1,3 +1,4 @@
+using System;
 using System.Net;
 
 namespace ET.Server
@@ -34,7 +35,7 @@ namespace ET.Server
                     {
                         fiberId = FiberManager.Instance.Create(startConfig.Id, startConfig.Type);
                         threadPoolScheduler.Add(fiberId);
-                        
+
                         //await SceneFactory.CreateServerScene(serverSceneManagerComponent, startConfig.Id, startConfig.ActorId.InstanceId, startConfig.Zone, startConfig.Name,
                         //    startConfig.Type, startConfig);
                     }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/C2G_PingHandler.cs

@@ -8,7 +8,7 @@ namespace ET.Server
 	{
 		protected override async ETTask Run(Session session, C2G_Ping request, G2C_Ping response)
 		{
-			response.Time = TimeHelper.ServerNow();
+			response.Time = session.Fiber().TimeInfo.ServerNow();
 			await ETTask.CompletedTask;
 		}
 	}

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/FiberInit_Realm.cs

@@ -9,7 +9,7 @@ namespace ET.Server
         {
             Fiber fiber = fiberInit.Fiber;
             
-            StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get((int)fiber.Id);
+            StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get(fiber.Id);
             fiber.Root.AddComponent<NetServerComponent, IPEndPoint>(startSceneConfig.InnerIPOutPort);
         }
     }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs

@@ -20,7 +20,7 @@ namespace ET.Server
             
             await room.Root().GetComponent<TimerComponent>().WaitAsync(1000);
 
-            Room2C_Start room2CStart = new() { StartTime = TimeHelper.ServerFrameTime() };
+            Room2C_Start room2CStart = new() { StartTime = room.Fiber().TimeInfo.ServerFrameTime() };
             foreach (RoomPlayer rp in roomServerComponent.Children.Values)
             {
                 room2CStart.UnitInfo.Add(new LockStepUnitInfo()

+ 17 - 0
Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FiberInit_Map.cs

@@ -0,0 +1,17 @@
+using System.Net;
+
+namespace ET.Server
+{
+    [Invoke((long)SceneType.Map)]
+    public class FiberInit_Map: AInvokeHandler<FiberInit>
+    {
+        public override void Handle(FiberInit fiberInit)
+        {
+            Scene root = fiberInit.Fiber.Root;
+
+            root.AddComponent<UnitComponent>();
+            root.AddComponent<AOIManagerComponent>();
+            root.AddComponent<RoomManagerComponent>();
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Core/Fiber/TimeHelper.cs.meta → Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FiberInit_Map.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 6df99ebccd598844d81aba056a5aa48b
+guid: 5d37c22fa00c59f48a444cc04a1621e4
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs

@@ -13,7 +13,7 @@ namespace ET.Server
             if (message.Frame % (1000 / LSConstValue.UpdateInterval) == 0)
             {
                 long nowFrameTime = room.FixedTimeCounter.FrameTime(message.Frame);
-                int diffTime = (int)(nowFrameTime - TimeHelper.ServerFrameTime());
+                int diffTime = (int)(nowFrameTime - room.Fiber().TimeInfo.ServerFrameTime());
 
                 room.Root().GetComponent<ActorLocationSenderComponent>().Get(LocationType.GateSession).Send(message.PlayerId, new Room2C_AdjustUpdateTime() {DiffTime = diffTime});
             }

+ 15 - 0
Unity/Assets/Scripts/Hotfix/Server/LockStep/Match/FiberInit_Match.cs

@@ -0,0 +1,15 @@
+using System.Net;
+
+namespace ET.Server
+{
+    [Invoke((long)SceneType.Match)]
+    public class FiberInit_Match: AInvokeHandler<FiberInit>
+    {
+        public override void Handle(FiberInit fiberInit)
+        {
+            Scene root = fiberInit.Fiber.Root;
+
+            root.AddComponent<MatchComponent>();
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Hotfix/Server/LockStep/Match/FiberInit_Match.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a6a6101f02189c643accabb36f52c150
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs

@@ -10,7 +10,7 @@ namespace ET.Server
         private static void Update(this LSServerUpdater self)
         {
             Room room = self.GetParent<Room>();
-            long timeNow = TimeHelper.ServerFrameTime();
+            long timeNow = room.Fiber().TimeInfo.ServerFrameTime();
             
             
             int frame = room.AuthorityFrame + 1;

+ 6 - 6
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderComponentSystem.cs

@@ -48,7 +48,7 @@ namespace ET.Server
         {
             using (ListComponent<long> list = ListComponent<long>.Create())
             {
-                long timeNow = TimeHelper.ServerNow();
+                long timeNow = self.Fiber().TimeInfo.ServerNow();
                 foreach ((long key, Entity value) in self.Children)
                 {
                     ActorLocationSender actorLocationMessageSender = (ActorLocationSender) value;
@@ -109,7 +109,7 @@ namespace ET.Server
             
             if (actorLocationSender.ActorId != default)
             {
-                actorLocationSender.LastSendOrRecvTime = TimeHelper.ServerNow();
+                actorLocationSender.LastSendOrRecvTime = self.Fiber().TimeInfo.ServerNow();
                 root.GetComponent<ActorSenderComponent>().Send(actorLocationSender.ActorId, message);
                 return;
             }
@@ -133,7 +133,7 @@ namespace ET.Server
                     }
                 }
                 
-                actorLocationSender.LastSendOrRecvTime = TimeHelper.ServerNow();
+                actorLocationSender.LastSendOrRecvTime = self.Fiber().TimeInfo.ServerNow();
                 root.GetComponent<ActorSenderComponent>().Send(actorLocationSender.ActorId, message);
             }
         }
@@ -148,7 +148,7 @@ namespace ET.Server
             
             if (actorLocationSender.ActorId != default)
             {
-                actorLocationSender.LastSendOrRecvTime = TimeHelper.ServerNow();
+                actorLocationSender.LastSendOrRecvTime = self.Fiber().TimeInfo.ServerNow();
                 return await root.GetComponent<ActorSenderComponent>().Call(actorLocationSender.ActorId, request);
             }
             
@@ -172,7 +172,7 @@ namespace ET.Server
                 }
             }
 
-            actorLocationSender.LastSendOrRecvTime = TimeHelper.ServerNow();
+            actorLocationSender.LastSendOrRecvTime = self.Fiber().TimeInfo.ServerNow();
             return await root.GetComponent<ActorSenderComponent>().Call(actorLocationSender.ActorId, request);
         }
 
@@ -227,7 +227,7 @@ namespace ET.Server
         {
             int failTimes = 0;
             long instanceId = actorLocationSender.InstanceId;
-            actorLocationSender.LastSendOrRecvTime = TimeHelper.ServerNow();
+            actorLocationSender.LastSendOrRecvTime = self.Fiber().TimeInfo.ServerNow();
             
             Scene root = self.Root();
             

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/ActorLocationSenderSystem.cs

@@ -8,7 +8,7 @@ namespace ET.Server
         [EntitySystem]
         private static void Awake(this ActorLocationSender self)
         {
-            self.LastSendOrRecvTime = TimeHelper.ServerNow();
+            self.LastSendOrRecvTime = self.Fiber().TimeInfo.ServerNow();
             self.ActorId = default;
             self.Error = 0;
         }

+ 15 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/FiberInit_Location.cs

@@ -0,0 +1,15 @@
+using System.Net;
+
+namespace ET.Server
+{
+    [Invoke((long)SceneType.Location)]
+    public class FiberInit_Location: AInvokeHandler<FiberInit>
+    {
+        public override void Handle(FiberInit fiberInit)
+        {
+            Scene root = fiberInit.Fiber.Root;
+
+            root.AddComponent<LocationManagerComoponent>();
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/FiberInit_Location.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: dfa61d7b9671c944c8edbcfffc94b189
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 4 - 4
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs

@@ -11,28 +11,28 @@ namespace ET.Server
 
         public static async ETTask Add(this LocationProxyComponent self, int type, long key, ActorId actorId)
         {
-            Log.Info($"location proxy add {key}, {actorId} {TimeHelper.ServerNow()}");
+            Log.Info($"location proxy add {key}, {actorId} {self.Fiber().TimeInfo.ServerNow()}");
             await self.Root().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
                 new ObjectAddRequest() { Type = type, Key = key, ActorId = actorId });
         }
 
         public static async ETTask Lock(this LocationProxyComponent self, int type, long key, ActorId actorId, int time = 60000)
         {
-            Log.Info($"location proxy lock {key}, {actorId} {TimeHelper.ServerNow()}");
+            Log.Info($"location proxy lock {key}, {actorId} {self.Fiber().TimeInfo.ServerNow()}");
             await self.Root().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
                 new ObjectLockRequest() { Type = type, Key = key, ActorId = actorId, Time = time });
         }
 
         public static async ETTask UnLock(this LocationProxyComponent self, int type, long key, ActorId oldActorId, ActorId newActorId)
         {
-            Log.Info($"location proxy unlock {key}, {newActorId} {TimeHelper.ServerNow()}");
+            Log.Info($"location proxy unlock {key}, {newActorId} {self.Fiber().TimeInfo.ServerNow()}");
             await self.Root().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
                 new ObjectUnLockRequest() { Type = type, Key = key, OldActorId = oldActorId, NewActorId = newActorId });
         }
 
         public static async ETTask Remove(this LocationProxyComponent self, int type, long key)
         {
-            Log.Info($"location proxy add {key}, {TimeHelper.ServerNow()}");
+            Log.Info($"location proxy add {key}, {self.Fiber().TimeInfo.ServerNow()}");
             await self.Root().GetComponent<ActorSenderComponent>().Call(GetLocationSceneId(key),
                 new ObjectRemoveRequest() { Type = type, Key = key });
         }

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

@@ -63,7 +63,7 @@ namespace ET.Server
                 return;
             }
             
-            session.LastRecvTime = TimeHelper.ClientFrameTime();
+            session.LastRecvTime = self.Fiber().TimeInfo.ClientFrameTime();
 
             self.HandleMessage(actorId, message);
         }

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

@@ -55,7 +55,7 @@ namespace ET.Server
             {
                 return;
             }
-            session.LastRecvTime = TimeHelper.ClientNow();
+            session.LastRecvTime = self.Fiber().TimeInfo.ClientNow();
             
             Log.Debug(message.ToJson());
 			

+ 8 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/NetInner.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 7b4dd22515474c148af1637fe0a85045
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 17 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/NetInner/FiberInit_NetInner.cs

@@ -0,0 +1,17 @@
+using System.Net;
+
+namespace ET.Server
+{
+    [Invoke((long)SceneType.NetInner)]
+    public class FiberInit_NetInner: AInvokeHandler<FiberInit>
+    {
+        public override void Handle(FiberInit fiberInit)
+        {
+            Scene root = fiberInit.Fiber.Root;
+
+            StartMachineConfig startMachineConfig = StartMachineConfigCategory.Instance.Get(fiberInit.Fiber.Process);
+            IPEndPoint ipEndPoint = NetworkHelper.ToIPEndPoint($"{startMachineConfig.InnerIP}:{startMachineConfig.WatcherPort}");
+            root.AddComponent<NetInnerComponent, IPEndPoint>(ipEndPoint);
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/NetInner/FiberInit_NetInner.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a9fcced502e107648b31b80088f9d294
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 16 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/Router/FiberInit_Router.cs

@@ -0,0 +1,16 @@
+using System.Net;
+
+namespace ET.Server
+{
+    [Invoke((long)SceneType.Router)]
+    public class FiberInit_Router: AInvokeHandler<FiberInit>
+    {
+        public override void Handle(FiberInit fiberInit)
+        {
+            Scene root = fiberInit.Fiber.Root;
+
+            StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get((int)root.Id);
+            root.AddComponent<RouterComponent, IPEndPoint, string>(startSceneConfig.OuterIPPort, startSceneConfig.StartProcessConfig.InnerIP);
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/Router/FiberInit_Router.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4c074f6c8ded9714399f7c1a900c657f
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 16 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/Router/FiberInit_RouterManager.cs

@@ -0,0 +1,16 @@
+using System.Net;
+
+namespace ET.Server
+{
+    [Invoke((long)SceneType.RouterManager)]
+    public class FiberInit_RouterManager: AInvokeHandler<FiberInit>
+    {
+        public override void Handle(FiberInit fiberInit)
+        {
+            Scene root = fiberInit.Fiber.Root;
+
+            StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Get((int)root.Id);
+            root.AddComponent<HttpComponent, string>($"http://*:{startSceneConfig.OuterPort}/");
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Hotfix/Server/Module/Router/FiberInit_RouterManager.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ce88e327d4106944f82129077d984047
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Module/Router/RouterComponentSystem.cs

@@ -45,7 +45,7 @@ namespace ET.Server
         [EntitySystem]
         private static void Update(this RouterComponent self)
         {
-            long timeNow = TimeHelper.ClientNow();
+            long timeNow = self.Fiber().TimeInfo.ClientNow();
             self.RecvOuter(timeNow);
             self.RecvInner(timeNow);
 
@@ -595,7 +595,7 @@ namespace ET.Server
             routerNode.InnerIpEndPoint = NetworkHelper.ToIPEndPoint(innerAddress);
             routerNode.SyncIpEndPoint = syncEndPoint;
             routerNode.InnerAddress = innerAddress;
-            routerNode.LastRecvInnerTime = TimeHelper.ClientNow();
+            routerNode.LastRecvInnerTime = self.Fiber().TimeInfo.ClientNow();
 
             self.ConnectIdNodes.Add(connectId, routerNode);
 

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Module/Router/RouterNodeSystem.cs

@@ -6,7 +6,7 @@
         [EntitySystem]
         private static void Awake(this RouterNode self)
         {
-            long timeNow = TimeHelper.ServerNow();
+            long timeNow = self.Fiber().TimeInfo.ServerNow();
             self.LastRecvInnerTime = timeNow;
             self.LastRecvOuterTime = timeNow;
             self.OuterIpEndPoint = null;

+ 6 - 5
Unity/Assets/Scripts/Hotfix/Share/Module/Actor/ActorSenderComponentSystem.cs

@@ -60,7 +60,7 @@ namespace ET
 
         private static void Check(this ActorSenderComponent self)
         {
-            long timeNow = TimeHelper.ServerNow();
+            long timeNow = self.Fiber().TimeInfo.ServerNow();
             foreach ((int key, ActorMessageSender value) in self.requestCallback)
             {
                 // 因为是顺序发送的,所以,检测到第一个不超时的就退出
@@ -162,14 +162,15 @@ namespace ET
             }
 
             var tcs = ETTask<IActorResponse>.Create(true);
-            
-            self.requestCallback.Add(rpcId, new ActorMessageSender(actorId, iActorRequest, tcs, needException));
+
+            Fiber fiber = self.Fiber();
+            self.requestCallback.Add(rpcId, new ActorMessageSender(actorId, iActorRequest, tcs, needException, fiber.TimeInfo.ServerFrameTime()));
             
             self.SendInner(actorId, iActorRequest as MessageObject);
 
-            long beginTime = TimeHelper.ServerFrameTime();
+            long beginTime = fiber.TimeInfo.ServerFrameTime();
             IActorResponse response = await tcs;
-            long endTime = TimeHelper.ServerFrameTime();
+            long endTime = fiber.TimeInfo.ServerFrameTime();
 
             long costTime = endTime - beginTime;
             if (costTime > 200)

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

@@ -24,7 +24,7 @@ namespace ET
         [EntitySystem]
         private static void Awake(this SessionAcceptTimeoutComponent self)
         {
-            self.Timer = self.Root().GetComponent<TimerComponent>().NewOnceTimer(TimeHelper.ServerNow() + 5000, TimerInvokeType.SessionAcceptTimeout, self);
+            self.Timer = self.Root().GetComponent<TimerComponent>().NewOnceTimer(self.Fiber().TimeInfo.ServerNow() + 5000, TimerInvokeType.SessionAcceptTimeout, self);
         }
         
         [EntitySystem]

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

@@ -42,7 +42,7 @@ namespace ET
         private static void Check(this SessionIdleCheckerComponent self)
         {
             Session session = self.GetParent<Session>();
-            long timeNow = TimeHelper.ClientNow();
+            long timeNow = self.Fiber().TimeInfo.ClientNow();
 
             if (timeNow - session.LastRecvTime < ConstValue.SessionTimeoutTime && timeNow - session.LastSendTime < ConstValue.SessionTimeoutTime)
             {

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Share/Module/Move/MoveComponentSystem.cs

@@ -109,7 +109,7 @@ namespace ET
         {
             Unit unit = self.GetParent<Unit>();
             
-            long timeNow = TimeHelper.ClientNow();
+            long timeNow = self.Fiber().TimeInfo.ClientNow();
             long moveTime = timeNow - self.StartTime;
 
             while (true)
@@ -177,7 +177,7 @@ namespace ET
 
         private static void StartMove(this MoveComponent self)
         {
-            self.BeginTime = TimeHelper.ClientNow();
+            self.BeginTime = self.Fiber().TimeInfo.ClientNow();
             self.StartTime = self.BeginTime;
             self.SetNextTarget();
 

+ 4 - 3
Unity/Assets/Scripts/Model/Share/Entry.cs

@@ -48,12 +48,13 @@ namespace ET
             World.Instance.AddSingleton<AIDispatcherComponent>();
             World.Instance.AddSingleton<ActorMessageDispatcherComponent>();
             World.Instance.AddSingleton<FiberManager>();
+            World.Instance.AddSingleton<NetServices>();
             FiberManager.MainThreadScheduler mainThreadScheduler = World.Instance.AddSingleton<FiberManager.MainThreadScheduler>();
-
+            
+            await World.Instance.AddSingleton<ConfigComponent>().LoadAsync();
+            
             int fiberId = FiberManager.Instance.Create(ConstFiberId.Main, SceneType.Main);
             mainThreadScheduler.Add(fiberId);
-
-            await World.Instance.AddSingleton<ConfigComponent>().LoadAsync();
         }
     }
 }

+ 3 - 3
Unity/Assets/Scripts/Model/Share/Module/Message/Session.cs

@@ -24,7 +24,7 @@ namespace ET
         private static void Awake(this Session self, AService aService)
         {
             self.AService = aService;
-            long timeNow = TimeHelper.ClientNow();
+            long timeNow = self.Fiber().TimeInfo.ClientNow();
             self.LastRecvTime = timeNow;
             self.LastSendTime = timeNow;
 
@@ -43,7 +43,7 @@ namespace ET
                 responseCallback.Tcs.SetException(new RpcException(self.Error, $"session dispose: {self.Id} {self.RemoteAddress}"));
             }
 
-            Log.Info($"session dispose: {self.RemoteAddress} id: {self.Id} ErrorCode: {self.Error}, please see ErrorCode.cs! {TimeHelper.ClientNow()}");
+            Log.Info($"session dispose: {self.RemoteAddress} id: {self.Id} ErrorCode: {self.Error}, please see ErrorCode.cs! {self.Fiber().TimeInfo.ClientNow()}");
             
             self.requestCallbacks.Clear();
         }
@@ -117,7 +117,7 @@ namespace ET
         
         public static void Send(this Session self, ActorId actorId, IMessage message)
         {
-            self.LastSendTime = TimeHelper.ClientNow();
+            self.LastSendTime = self.Fiber().TimeInfo.ClientNow();
             Log.Debug(message.ToString());
             self.AService.Send(self.Id, actorId, message as MessageObject);
         }