Просмотр исходного кода

进一步调整帧同步框架,实现LSUpdateSystem

tanghai 2 лет назад
Родитель
Сommit
7e97d8151e
28 измененных файлов с 364 добавлено и 324 удалено
  1. 1 2
      Unity/Assets/Scripts/Codes/Hotfix/Server/LockStep/Map/RoomComponentSystem.cs
  2. 1 0
      Unity/Assets/Scripts/Codes/Model/Server/LockStep/Map/RoomComponent.cs
  3. 0 17
      Unity/Assets/Scripts/Core/LockStep/FixedUpdate/AFixUpdateHandler.cs
  4. 0 81
      Unity/Assets/Scripts/Core/LockStep/FixedUpdate/FixedUpdater.cs
  5. 47 0
      Unity/Assets/Scripts/Core/LockStep/ILSUpdate.cs
  6. 1 1
      Unity/Assets/Scripts/Core/LockStep/ILSUpdate.cs.meta
  7. 32 50
      Unity/Assets/Scripts/Core/LockStep/LSEntity.cs
  8. 54 68
      Unity/Assets/Scripts/Core/LockStep/LSScene.cs
  9. 23 0
      Unity/Assets/Scripts/Core/LockStep/LSSington.cs
  10. 1 1
      Unity/Assets/Scripts/Core/LockStep/LSSington.cs.meta
  11. 9 0
      Unity/Assets/Scripts/Core/LockStep/LSSystemAttribute.cs
  12. 11 0
      Unity/Assets/Scripts/Core/LockStep/LSSystemAttribute.cs.meta
  13. 70 0
      Unity/Assets/Scripts/Core/LockStep/LSUpdater.cs
  14. 11 0
      Unity/Assets/Scripts/Core/LockStep/LSUpdater.cs.meta
  15. 4 4
      Unity/Assets/Scripts/Core/Module/Entity/Entity.cs
  16. 4 3
      Unity/Assets/Scripts/Core/Module/Entity/EntitySceneFactory.cs
  17. 7 21
      Unity/Assets/Scripts/Core/Module/Entity/Scene.cs
  18. 69 57
      Unity/Assets/Scripts/Core/Module/EventSystem/EventSystem.cs
  19. 1 1
      Unity/Assets/Scripts/Core/Module/EventSystem/IAddComponentSystem.cs
  20. 5 5
      Unity/Assets/Scripts/Core/Module/EventSystem/IAwakeSystem.cs
  21. 1 1
      Unity/Assets/Scripts/Core/Module/EventSystem/IDeserializeSystem.cs
  22. 1 1
      Unity/Assets/Scripts/Core/Module/EventSystem/IDestroySystem.cs
  23. 1 1
      Unity/Assets/Scripts/Core/Module/EventSystem/IGetComponentSystem.cs
  24. 1 1
      Unity/Assets/Scripts/Core/Module/EventSystem/ILateUpdateSystem.cs
  25. 1 1
      Unity/Assets/Scripts/Core/Module/EventSystem/ILoadSystem.cs
  26. 1 1
      Unity/Assets/Scripts/Core/Module/EventSystem/ISystemType.cs
  27. 1 1
      Unity/Assets/Scripts/Core/Module/EventSystem/IUpdateSystem.cs
  28. 6 6
      Unity/Assets/Scripts/Core/Module/EventSystem/InstanceQueueIndex.cs

+ 1 - 2
Unity/Assets/Scripts/Codes/Hotfix/Server/LockStep/Map/RoomComponentSystem.cs

@@ -16,8 +16,7 @@ namespace ET.Server
                 }
                 }
                 
                 
                 // 创建LockStep场景
                 // 创建LockStep场景
-                LSScene lsScene = new LSScene(IdGenerater.Instance.GenerateInstanceId(), self.DomainZone(), SceneType.LockStep, "LockStep", self);
-                self.LsScene = lsScene;
+                self.LsScene = new LSScene(IdGenerater.Instance.GenerateId());
             }
             }
         }
         }
     }
     }

+ 1 - 0
Unity/Assets/Scripts/Codes/Model/Server/LockStep/Map/RoomComponent.cs

@@ -17,6 +17,7 @@ namespace ET.Server
             }
             }
             set
             set
             {
             {
+                value.Parent = this;
                 this.sceneInstanceId = value.InstanceId;
                 this.sceneInstanceId = value.InstanceId;
             }
             }
         }
         }

+ 0 - 17
Unity/Assets/Scripts/Core/LockStep/FixedUpdate/AFixUpdateHandler.cs

@@ -1,17 +0,0 @@
-namespace ET
-{
-    public struct FixUpdateInvokerArgs
-    {
-        public Entity Entity;
-    }
-    
-    public abstract class AFixUpdateHandler<T>: AInvokeHandler<FixUpdateInvokerArgs> where T: Entity
-    {
-        public override void Handle(FixUpdateInvokerArgs args)
-        {
-            this.Run(args.Entity as T);
-        }
-
-        protected abstract void Run(T t);
-    }
-}

+ 0 - 81
Unity/Assets/Scripts/Core/LockStep/FixedUpdate/FixedUpdater.cs

@@ -1,81 +0,0 @@
-using System.Collections.Generic;
-using MongoDB.Bson.Serialization.Attributes;
-
-namespace ET
-{
-    [FriendOf(typeof(FixedUpdater))]
-    public static class FixedUpdaterSystem
-    {
-        [ObjectSystem]
-        public class AwakeSystem: AwakeSystem<FixedUpdater>
-        {
-            protected override void Awake(FixedUpdater self)
-            {
-                self.GetParent<LSScene>().FixedUpdater = self;
-            }
-        }
-        
-        public static void Update(this FixedUpdater self)
-        {
-            ++self.Frame;
-
-            // 让id保持从小到大update,后加进来的在一帧后面Update
-            while (self.addUpdateIds.Count > 0)
-            {
-                self.updateIds.Add(self.addUpdateIds.Dequeue());
-            }
-
-            foreach (long updateId in self.updateIds)
-            {
-                if (!self.updateEntities.TryGetValue(updateId, out FixedUpdater.UpdateInfo updateInfo))
-                {
-                    self.removeUpdateIds.Enqueue(updateId);
-                    continue;
-                }
-                EventSystem.Instance.Invoke(updateInfo.Type, new FixUpdateInvokerArgs() {Entity = updateInfo.Entity});
-            }
-
-            while (self.removeUpdateIds.Count > 0)
-            {
-                self.updateIds.Remove(self.removeUpdateIds.Dequeue());
-            }
-        }
-        
-        public static long Add(this FixedUpdater self, int type, Entity entity)
-        {
-            long updateId = self.DomainScene().GetId();
-            FixedUpdater.UpdateInfo updateInfo = new() { Entity = entity, Type = type };
-            
-            self.updateEntities.Add(updateId, updateInfo);
-            
-            self.addUpdateIds.Enqueue(updateId);
-            return updateId;
-        }
-        
-        public static void Remove(this FixedUpdater self, long updateId)
-        {
-            self.updateEntities.Remove(updateId);
-        }
-    }
-    
-    [ComponentOf(typeof(LSScene))]
-    public class FixedUpdater: LSEntity, IAwake
-    {
-        public int Frame;
-        
-        public struct UpdateInfo
-        {
-            public int Type;
-            public Entity Entity;
-        }
-
-        [BsonIgnore]
-        public SortedSet<long> updateIds = new SortedSet<long>();
-        [BsonIgnore]
-        public Queue<long> addUpdateIds = new Queue<long>();
-        [BsonIgnore]
-        public Queue<long> removeUpdateIds = new Queue<long>();
-        [BsonIgnore]
-        public Dictionary<long, UpdateInfo> updateEntities = new Dictionary<long, UpdateInfo>();
-    }
-}

+ 47 - 0
Unity/Assets/Scripts/Core/LockStep/ILSUpdate.cs

@@ -0,0 +1,47 @@
+using System;
+
+namespace ET
+{
+    [UniqueId(-1, 1)]
+    public static class LSQueneUpdateIndex
+    {
+        public const int None = -1;
+        public const int LSUpdate = 0;
+        public const int Max = 1;
+    }
+    
+    public interface ILSUpdate
+    {
+    }
+    
+    public interface ILSUpdateSystem: ISystemType
+    {
+        void Run(LSEntity o);
+    }
+    
+    [LSSystem]
+    public abstract class LSUpdateSystem<T> : ILSUpdateSystem where T: LSEntity, ILSUpdate
+    {
+        void ILSUpdateSystem.Run(LSEntity o)
+        {
+            this.LSUpdate((T)o);
+        }
+
+        Type ISystemType.Type()
+        {
+            return typeof(T);
+        }
+
+        Type ISystemType.SystemType()
+        {
+            return typeof(ILSUpdateSystem);
+        }
+
+        int ISystemType.GetInstanceQueueIndex()
+        {
+            return LSQueneUpdateIndex.LSUpdate;
+        }
+
+        protected abstract void LSUpdate(T self);
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Core/LockStep/FixedUpdate/AFixUpdateHandler.cs.meta → Unity/Assets/Scripts/Core/LockStep/ILSUpdate.cs.meta

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

+ 32 - 50
Unity/Assets/Scripts/Core/LockStep/LSEntity.cs

@@ -6,87 +6,69 @@ namespace ET
     {
     {
         public new K AddComponent<K>(bool isFromPool = false) where K : LSEntity, IAwake, new()
         public new K AddComponent<K>(bool isFromPool = false) where K : LSEntity, IAwake, new()
         {
         {
-            return base.AddComponentWithId<K>(this.DomainScene().GetId(), isFromPool);
+            return this.AddComponentWithId<K>(this.GetId(), isFromPool);
         }
         }
 
 
         public new K AddComponent<K, P1>(P1 p1, bool isFromPool = false) where K : LSEntity, IAwake<P1>, new()
         public new K AddComponent<K, P1>(P1 p1, bool isFromPool = false) where K : LSEntity, IAwake<P1>, new()
         {
         {
-            return base.AddComponentWithId<K, P1>(this.DomainScene().GetId(), p1, isFromPool);
+            return this.AddComponentWithId<K, P1>(this.GetId(), p1, isFromPool);
         }
         }
 
 
         public new K AddComponent<K, P1, P2>(P1 p1, P2 p2, bool isFromPool = false) where K : LSEntity, IAwake<P1, P2>, new()
         public new K AddComponent<K, P1, P2>(P1 p1, P2 p2, bool isFromPool = false) where K : LSEntity, IAwake<P1, P2>, new()
         {
         {
-            return base.AddComponentWithId<K, P1, P2>(this.DomainScene().GetId(), p1, p2, isFromPool);
+            return this.AddComponentWithId<K, P1, P2>(this.GetId(), p1, p2, isFromPool);
         }
         }
 
 
         public new K AddComponent<K, P1, P2, P3>(P1 p1, P2 p2, P3 p3, bool isFromPool = false) where K : LSEntity, IAwake<P1, P2, P3>, new()
         public new K AddComponent<K, P1, P2, P3>(P1 p1, P2 p2, P3 p3, bool isFromPool = false) where K : LSEntity, IAwake<P1, P2, P3>, new()
         {
         {
-            return base.AddComponentWithId<K, P1, P2, P3>(this.DomainScene().GetId(), p1, p2, p3, isFromPool);
-        }
-
-        public new K AddComponentWithId<K>(long id, bool isFromPool = false) where K : Entity, IAwake, new()
-        {
-            throw new Exception("dont use this");
-        }
-        
-        public new K AddComponentWithId<K, P1>(long id, P1 p1, bool isFromPool = false) where K : Entity, IAwake<P1>, new()
-        {
-            throw new Exception("dont use this");
-        }
-
-        public new K AddComponentWithId<K, P1, P2>(long id, P1 p1, P2 p2, bool isFromPool = false) where K : Entity, IAwake<P1, P2>, new()
-        {
-            throw new Exception("dont use this");
-        }
-
-        public new K AddComponentWithId<K, P1, P2, P3>(long id, P1 p1, P2 p2, P3 p3, bool isFromPool = false) where K : Entity, IAwake<P1, P2, P3>, new()
-        {
-            throw new Exception("dont use this");
-        }
-        
-        public Entity AddChild(LSEntity entity)
-        {
-            return entity.AddChild(entity);
+            return this.AddComponentWithId<K, P1, P2, P3>(this.GetId(), p1, p2, p3, isFromPool);
         }
         }
 
 
         public new T AddChild<T>(bool isFromPool = false) where T : LSEntity, IAwake
         public new T AddChild<T>(bool isFromPool = false) where T : LSEntity, IAwake
         {
         {
-            return base.AddChildWithId<T>(this.DomainScene().GetId(), isFromPool);
+            return this.AddChildWithId<T>(this.GetId(), isFromPool);
         }
         }
 
 
         public new T AddChild<T, A>(A a, bool isFromPool = false) where T : LSEntity, IAwake<A>
         public new T AddChild<T, A>(A a, bool isFromPool = false) where T : LSEntity, IAwake<A>
         {
         {
-            return base.AddChildWithId<T, A>(this.DomainScene().GetId(), a, isFromPool);
+            return this.AddChildWithId<T, A>(this.GetId(), a, isFromPool);
         }
         }
 
 
         public new T AddChild<T, A, B>(A a, B b, bool isFromPool = false) where T : LSEntity, IAwake<A, B>
         public new T AddChild<T, A, B>(A a, B b, bool isFromPool = false) where T : LSEntity, IAwake<A, B>
         {
         {
-            return base.AddChildWithId<T, A, B>(this.DomainScene().GetId(), a, b, isFromPool);
+            return this.AddChildWithId<T, A, B>(this.GetId(), a, b, isFromPool);
         }
         }
 
 
         public new T AddChild<T, A, B, C>(A a, B b, C c, bool isFromPool = false) where T : LSEntity, IAwake<A, B, C>
         public new T AddChild<T, A, B, C>(A a, B b, C c, bool isFromPool = false) where T : LSEntity, IAwake<A, B, C>
         {
         {
-            return base.AddChildWithId<T, A, B, C>(this.DomainScene().GetId(), a, b, c, isFromPool);
+            return this.AddChildWithId<T, A, B, C>(this.GetId(), a, b, c, isFromPool);
         }
         }
 
 
-        public new T AddChildWithId<T>(long id, bool isFromPool = false) where T : LSEntity, IAwake, new()
-        {
-            throw new Exception("dont use this");
-        }
+        public override Entity Domain
+        {
+            get
+            {
+                return this.domain;
+            }
+            protected set
+            {
+                bool oldIsRegister = this.IsRegister;
+                base.Domain = value;
+                bool newIsRegister = this.IsRegister;
+                if (oldIsRegister == newIsRegister)
+                {
+                    return;
+                }
 
 
-        public new T AddChildWithId<T, A>(long id, A a, bool isFromPool = false) where T : LSEntity, IAwake<A>
-        {
-            throw new Exception("dont use this");
-        }
-
-        public new T AddChildWithId<T, A, B>(long id, A a, B b, bool isFromPool = false) where T : LSEntity, IAwake<A, B>
-        {
-            throw new Exception("dont use this");
-        }
-
-        public new T AddChildWithId<T, A, B, C>(long id, A a, B b, C c, bool isFromPool = false) where T : LSEntity, IAwake<A, B, C>
-        {
-            throw new Exception("dont use this");
+                if (newIsRegister)
+                {
+                    this.DomainScene().RegisterSystem(this);
+                }
+                else
+                {
+                    this.DomainScene().Remove(this.Id);
+                }
+            }
         }
         }
     }
     }
 }
 }

+ 54 - 68
Unity/Assets/Scripts/Core/LockStep/LSScene.cs

@@ -1,88 +1,89 @@
-using System.Diagnostics;
 using MongoDB.Bson.Serialization.Attributes;
 using MongoDB.Bson.Serialization.Attributes;
+using System;
+using System.Collections.Generic;
 
 
 namespace ET
 namespace ET
 {
 {
-    [EnableMethod]
-    [ChildOf]
-    public class LSScene: LSEntity
+    public static class LSSceneSystem
     {
     {
-        public int Zone
+        public class DeserializeSystem: DeserializeSystem<LSScene>
         {
         {
-            get;
+            protected override void Deserialize(LSScene self)
+            {
+                self.Updater.Parent = self;
+            }
         }
         }
 
 
-        public SceneType SceneType
+        public static LSScene DomainScene(this LSEntity entity)
         {
         {
-            get;
+            return entity.Domain as LSScene;
         }
         }
 
 
-        public string Name
+        public static long GetId(this LSEntity entity)
         {
         {
-            get;
+            return entity.DomainScene().GetId();
         }
         }
+    }
 
 
-        public LSScene(long instanceId, int zone, SceneType sceneType, string name, Entity parent)
+    [EnableMethod]
+    [ChildOf]
+    public class LSScene: LSEntity, IDeserialize
+    {
+        public LSScene(long id)
         {
         {
-            this.Id = instanceId;
-            this.InstanceId = instanceId;
-            this.Zone = zone;
-            this.SceneType = sceneType;
-            this.Name = name;
+            this.Id = id;
+            this.InstanceId = IdGenerater.Instance.GenerateInstanceId();
             this.IsCreated = true;
             this.IsCreated = true;
             this.IsNew = true;
             this.IsNew = true;
-            this.Parent = parent;
-            this.Domain = this;
             this.IsRegister = true;
             this.IsRegister = true;
-            Log.Info($"scene create: {this.SceneType} {this.Name} {this.Id} {this.InstanceId} {this.Zone}");
+            Log.Info($"LSScene create: {this.Id} {this.InstanceId}");
         }
         }
-
-        public LSScene(long id, long instanceId, int zone, SceneType sceneType, string name, Entity parent)
+        
+        [BsonIgnore]
+        public new Entity Parent
         {
         {
-            this.Id = id;
-            this.InstanceId = instanceId;
-            this.Zone = zone;
-            this.SceneType = sceneType;
-            this.Name = name;
-            this.IsCreated = true;
-            this.IsNew = true;
-            this.Parent = parent;
-            this.Domain = this;
-            this.IsRegister = true;
-            Log.Info($"scene create: {this.SceneType} {this.Name} {this.Id} {this.InstanceId} {this.Zone}");
+            get
+            {
+                return this.parent;
+            }
+            set
+            {
+                value?.AddChild(this);
+                this.Domain = this;
+            }
         }
         }
 
 
-        public override void Dispose()
+        private readonly Dictionary<long, LSEntity> allLSEntities = new();
+
+        [BsonElement]
+        public LSUpdater Updater = new();
+
+        public LSEntity Get(long id)
         {
         {
-            base.Dispose();
-            
-            Log.Info($"scene dispose: {this.SceneType} {this.Name} {this.Id} {this.InstanceId} {this.Zone}");
+            this.allLSEntities.TryGetValue(id, out LSEntity entity);
+            return entity;
         }
         }
 
 
-        [BsonIgnore]
-        public new Entity Domain
+        public void Remove(long id)
         {
         {
-            get => this.domain;
-            private set => this.domain = value;
+            this.allLSEntities.Remove(id);
         }
         }
 
 
-        [BsonIgnore]
-        public new Entity Parent
+        public void RegisterSystem(LSEntity entity)
         {
         {
-            get
+            this.allLSEntities.Add(entity.Id, entity);
+
+            Type type = entity.GetType();
+
+            TypeSystems.OneTypeSystems oneTypeSystems = LSSington.Instance.TypeSystems.GetOneTypeSystems(type);
+            if (oneTypeSystems == null)
             {
             {
-                return this.parent;
+                return;
             }
             }
-            private set
-            {
-                if (value == null)
-                {
-                    //this.parent = this;
-                    return;
-                }
 
 
-                this.parent = value;
-                this.parent.Children.Add(this.Id, this);
+            if (oneTypeSystems.QueueFlag[LSQueneUpdateIndex.LSUpdate])
+            {
+                this.Updater.Add(entity);
             }
             }
         }
         }
 
 
@@ -93,20 +94,5 @@ namespace ET
         {
         {
             return ++this.idGenerator;
             return ++this.idGenerator;
         }
         }
-
-        public FixedUpdater FixedUpdater { get; set; }
-    }
-
-    public static class LSSceneHelper
-    {
-        public static LSScene DomainScene(this LSEntity entity)
-        {
-            return entity.Domain as LSScene;
-        }
-        
-        public static long GetId(this LSEntity entity)
-        {
-            return entity.DomainScene().GetId();
-        }
     }
     }
 }
 }

+ 23 - 0
Unity/Assets/Scripts/Core/LockStep/LSSington.cs

@@ -0,0 +1,23 @@
+using System;
+
+namespace ET
+{
+    public class LSSington: Singleton<LSSington>, ISingletonAwake
+    {
+        public TypeSystems TypeSystems = new TypeSystems(LSQueneUpdateIndex.Max);
+        
+        public void Awake()
+        {
+            foreach (Type type in EventSystem.Instance.GetTypes(typeof (LSSystemAttribute)))
+            {
+                object obj = Activator.CreateInstance(type);
+
+                if (obj is ISystemType iSystemType)
+                {
+                    TypeSystems.OneTypeSystems oneTypeSystems = this.TypeSystems.GetOrCreateOneTypeSystems(iSystemType.Type());
+                    oneTypeSystems.Map.Add(iSystemType.SystemType(), obj);
+                }
+            }
+        }
+    }
+}

+ 1 - 1
Unity/Assets/Scripts/Core/LockStep/FixedUpdate/FixedUpdater.cs.meta → Unity/Assets/Scripts/Core/LockStep/LSSington.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
 fileFormatVersion: 2
-guid: 358352bdd30d7482194eb760bb329759
+guid: d53219a0618194d7ca9743bc7bc4e78c
 MonoImporter:
 MonoImporter:
   externalObjects: {}
   externalObjects: {}
   serializedVersion: 2
   serializedVersion: 2

+ 9 - 0
Unity/Assets/Scripts/Core/LockStep/LSSystemAttribute.cs

@@ -0,0 +1,9 @@
+using System;
+
+namespace ET
+{
+    [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
+    public class LSSystemAttribute: BaseAttribute
+    {
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Core/LockStep/LSSystemAttribute.cs.meta

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

+ 70 - 0
Unity/Assets/Scripts/Core/LockStep/LSUpdater.cs

@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using MongoDB.Bson.Serialization.Attributes;
+
+namespace ET
+{
+    public class LSUpdater
+    {
+        [BsonIgnore]
+        public LSScene Parent { get; set; }
+        
+        public int Frame { get; private set; }
+        
+        private SortedSet<long> updateIds = new();
+
+        private Queue<long> addUpdateIds = new();
+
+        private Queue<long> removeUpdateIds = new();
+
+        public void Update()
+        {
+            ++this.Frame;
+
+            // 让id保持从小到大update,后加进来的在一帧后面Update
+            while (this.addUpdateIds.Count > 0)
+            {
+                this.updateIds.Add(this.addUpdateIds.Dequeue());
+            }
+
+            TypeSystems typeSystems = LSSington.Instance.TypeSystems;
+            foreach (long id in this.updateIds)
+            {
+                LSEntity entity = this.Parent.Get(id);
+                if (entity == null)
+                {
+                    this.removeUpdateIds.Enqueue(id);
+                    continue;
+                }
+                
+                List<object> iLSUpdateSystems = typeSystems.GetSystems(entity.GetType(), typeof (ILSUpdateSystem));
+                if (iLSUpdateSystems == null)
+                {
+                    continue;
+                }
+
+                foreach (ILSUpdateSystem iLSUpdateSystem in iLSUpdateSystems)
+                {
+                    try
+                    {
+                        iLSUpdateSystem.Run(entity);
+                    }
+                    catch (Exception e)
+                    {
+                        Log.Error(e);
+                    }
+                }
+            }
+
+            while (this.removeUpdateIds.Count > 0)
+            {
+                this.updateIds.Remove(this.removeUpdateIds.Dequeue());
+            }
+        }
+        
+        public void Add(LSEntity entity)
+        {
+            this.addUpdateIds.Enqueue(entity.Id);
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Scripts/Core/LockStep/LSUpdater.cs.meta

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

+ 4 - 4
Unity/Assets/Scripts/Core/Module/Entity/Entity.cs

@@ -161,10 +161,10 @@ namespace ET
 
 
         // 可以改变parent,但是不能设置为null
         // 可以改变parent,但是不能设置为null
         [BsonIgnore]
         [BsonIgnore]
-        public Entity Parent
+        public virtual Entity Parent
         {
         {
             get => this.parent;
             get => this.parent;
-            private set
+            protected set
             {
             {
                 if (value == null)
                 if (value == null)
                 {
                 {
@@ -271,13 +271,13 @@ namespace ET
         protected Entity domain;
         protected Entity domain;
 
 
         [BsonIgnore]
         [BsonIgnore]
-        public Entity Domain
+        public virtual Entity Domain
         {
         {
             get
             get
             {
             {
                 return this.domain;
                 return this.domain;
             }
             }
-            private set
+            protected set
             {
             {
                 if (value == null)
                 if (value == null)
                 {
                 {

+ 4 - 3
Unity/Assets/Scripts/Core/Module/Entity/EntitySceneFactory.cs

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

+ 7 - 21
Unity/Assets/Scripts/Core/Module/Entity/Scene.cs

@@ -1,4 +1,5 @@
 using System.Diagnostics;
 using System.Diagnostics;
+using MongoDB.Bson.Serialization.Attributes;
 
 
 namespace ET
 namespace ET
 {
 {
@@ -22,7 +23,7 @@ namespace ET
             get;
             get;
         }
         }
 
 
-        public Scene(long instanceId, int zone, SceneType sceneType, string name, Entity parent)
+        public Scene(long instanceId, int zone, SceneType sceneType, string name)
         {
         {
             this.Id = instanceId;
             this.Id = instanceId;
             this.InstanceId = instanceId;
             this.InstanceId = instanceId;
@@ -31,13 +32,11 @@ namespace ET
             this.Name = name;
             this.Name = name;
             this.IsCreated = true;
             this.IsCreated = true;
             this.IsNew = true;
             this.IsNew = true;
-            this.Parent = parent;
-            this.Domain = this;
             this.IsRegister = true;
             this.IsRegister = true;
             Log.Info($"scene create: {this.SceneType} {this.Name} {this.Id} {this.InstanceId} {this.Zone}");
             Log.Info($"scene create: {this.SceneType} {this.Name} {this.Id} {this.InstanceId} {this.Zone}");
         }
         }
 
 
-        public Scene(long id, long instanceId, int zone, SceneType sceneType, string name, Entity parent)
+        public Scene(long id, long instanceId, int zone, SceneType sceneType, string name)
         {
         {
             this.Id = id;
             this.Id = id;
             this.InstanceId = instanceId;
             this.InstanceId = instanceId;
@@ -46,8 +45,6 @@ namespace ET
             this.Name = name;
             this.Name = name;
             this.IsCreated = true;
             this.IsCreated = true;
             this.IsNew = true;
             this.IsNew = true;
-            this.Parent = parent;
-            this.Domain = this;
             this.IsRegister = true;
             this.IsRegister = true;
             Log.Info($"scene create: {this.SceneType} {this.Name} {this.Id} {this.InstanceId} {this.Zone}");
             Log.Info($"scene create: {this.SceneType} {this.Name} {this.Id} {this.InstanceId} {this.Zone}");
         }
         }
@@ -59,28 +56,17 @@ namespace ET
             Log.Info($"scene dispose: {this.SceneType} {this.Name} {this.Id} {this.InstanceId} {this.Zone}");
             Log.Info($"scene dispose: {this.SceneType} {this.Name} {this.Id} {this.InstanceId} {this.Zone}");
         }
         }
 
 
-        public new Entity Domain
-        {
-            get => this.domain;
-            private set => this.domain = value;
-        }
-
+        [BsonIgnore]
         public new Entity Parent
         public new Entity Parent
         {
         {
             get
             get
             {
             {
                 return this.parent;
                 return this.parent;
             }
             }
-            private set
+            set
             {
             {
-                if (value == null)
-                {
-                    //this.parent = this;
-                    return;
-                }
-
-                this.parent = value;
-                this.parent.Children.Add(this.Id, this);
+                value?.AddChild(this);
+                this.Domain = this;
             }
             }
         }
         }
         
         

+ 69 - 57
Unity/Assets/Scripts/Core/Module/EventSystem/EventSystem.cs

@@ -5,57 +5,69 @@ using System.Text;
 
 
 namespace ET
 namespace ET
 {
 {
-    public class EventSystem: Singleton<EventSystem>, ISingletonUpdate, ISingletonLateUpdate
+    public class TypeSystems
     {
     {
-        private class OneTypeSystems
+        public class OneTypeSystems
         {
         {
+            public OneTypeSystems(int count)
+            {
+                this.QueueFlag = new bool[count];
+            }
+            
             public readonly UnOrderMultiMap<Type, object> Map = new();
             public readonly UnOrderMultiMap<Type, object> Map = new();
             // 这里不用hash,数量比较少,直接for循环速度更快
             // 这里不用hash,数量比较少,直接for循环速度更快
-            public readonly bool[] QueueFlag = new bool[(int)InstanceQueueIndex.Max];
+            public readonly bool[] QueueFlag;
         }
         }
-        
-        private class TypeSystems
+
+        private readonly int count;
+
+        public TypeSystems(int count)
         {
         {
-            private readonly Dictionary<Type, OneTypeSystems> typeSystemsMap = new();
+            this.count = count;
+        }
+        
+        private readonly Dictionary<Type, OneTypeSystems> typeSystemsMap = new();
 
 
-            public OneTypeSystems GetOrCreateOneTypeSystems(Type type)
+        public OneTypeSystems GetOrCreateOneTypeSystems(Type type)
+        {
+            OneTypeSystems systems = null;
+            this.typeSystemsMap.TryGetValue(type, out systems);
+            if (systems != null)
             {
             {
-                OneTypeSystems systems = null;
-                this.typeSystemsMap.TryGetValue(type, out systems);
-                if (systems != null)
-                {
-                    return systems;
-                }
-
-                systems = new OneTypeSystems();
-                this.typeSystemsMap.Add(type, systems);
                 return systems;
                 return systems;
             }
             }
 
 
-            public OneTypeSystems GetOneTypeSystems(Type type)
+            systems = new OneTypeSystems(this.count);
+            this.typeSystemsMap.Add(type, systems);
+            return systems;
+        }
+
+        public OneTypeSystems GetOneTypeSystems(Type type)
+        {
+            OneTypeSystems systems = null;
+            this.typeSystemsMap.TryGetValue(type, out systems);
+            return systems;
+        }
+
+        public List<object> GetSystems(Type type, Type systemType)
+        {
+            OneTypeSystems oneTypeSystems = null;
+            if (!this.typeSystemsMap.TryGetValue(type, out oneTypeSystems))
             {
             {
-                OneTypeSystems systems = null;
-                this.typeSystemsMap.TryGetValue(type, out systems);
-                return systems;
+                return null;
             }
             }
 
 
-            public List<object> GetSystems(Type type, Type systemType)
+            if (!oneTypeSystems.Map.TryGetValue(systemType, out List<object> systems))
             {
             {
-                OneTypeSystems oneTypeSystems = null;
-                if (!this.typeSystemsMap.TryGetValue(type, out oneTypeSystems))
-                {
-                    return null;
-                }
-
-                if (!oneTypeSystems.Map.TryGetValue(systemType, out List<object> systems))
-                {
-                    return null;
-                }
-
-                return systems;
+                return null;
             }
             }
-        }
 
 
+            return systems;
+        }
+    }
+    
+    public class EventSystem: Singleton<EventSystem>, ISingletonUpdate, ISingletonLateUpdate
+    {
         private class EventInfo
         private class EventInfo
         {
         {
             public IEvent IEvent { get; }
             public IEvent IEvent { get; }
@@ -77,9 +89,9 @@ namespace ET
         
         
         private Dictionary<Type, Dictionary<int, object>> allInvokes = new(); 
         private Dictionary<Type, Dictionary<int, object>> allInvokes = new(); 
 
 
-        private TypeSystems typeSystems;
+        public TypeSystems TypeSystems;
 
 
-        private readonly Queue<long>[] queues = new Queue<long>[(int)InstanceQueueIndex.Max];
+        private readonly Queue<long>[] queues = new Queue<long>[InstanceQueueIndex.Max];
 
 
         public EventSystem()
         public EventSystem()
         {
         {
@@ -112,7 +124,7 @@ namespace ET
                 }
                 }
             }
             }
 
 
-            this.typeSystems = new TypeSystems();
+            this.TypeSystems = new TypeSystems(InstanceQueueIndex.Max);
 
 
             foreach (Type type in this.GetTypes(typeof (ObjectSystemAttribute)))
             foreach (Type type in this.GetTypes(typeof (ObjectSystemAttribute)))
             {
             {
@@ -120,12 +132,12 @@ namespace ET
 
 
                 if (obj is ISystemType iSystemType)
                 if (obj is ISystemType iSystemType)
                 {
                 {
-                    OneTypeSystems oneTypeSystems = this.typeSystems.GetOrCreateOneTypeSystems(iSystemType.Type());
+                    TypeSystems.OneTypeSystems oneTypeSystems = this.TypeSystems.GetOrCreateOneTypeSystems(iSystemType.Type());
                     oneTypeSystems.Map.Add(iSystemType.SystemType(), obj);
                     oneTypeSystems.Map.Add(iSystemType.SystemType(), obj);
-                    InstanceQueueIndex index = iSystemType.GetInstanceQueueIndex();
+                    int index = iSystemType.GetInstanceQueueIndex();
                     if (index > InstanceQueueIndex.None && index < InstanceQueueIndex.Max)
                     if (index > InstanceQueueIndex.None && index < InstanceQueueIndex.Max)
                     {
                     {
-                        oneTypeSystems.QueueFlag[(int)index] = true;
+                        oneTypeSystems.QueueFlag[index] = true;
                     }
                     }
                 }
                 }
             }
             }
@@ -210,11 +222,11 @@ namespace ET
             return this.allTypes[typeName];
             return this.allTypes[typeName];
         }
         }
 
 
-        public void RegisterSystem(Entity component)
+        public virtual void RegisterSystem(Entity component)
         {
         {
             Type type = component.GetType();
             Type type = component.GetType();
 
 
-            OneTypeSystems oneTypeSystems = this.typeSystems.GetOneTypeSystems(type);
+            TypeSystems.OneTypeSystems oneTypeSystems = this.TypeSystems.GetOneTypeSystems(type);
             if (oneTypeSystems == null)
             if (oneTypeSystems == null)
             {
             {
                 return;
                 return;
@@ -231,7 +243,7 @@ namespace ET
 
 
         public void Deserialize(Entity component)
         public void Deserialize(Entity component)
         {
         {
-            List<object> iDeserializeSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IDeserializeSystem));
+            List<object> iDeserializeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IDeserializeSystem));
             if (iDeserializeSystems == null)
             if (iDeserializeSystems == null)
             {
             {
                 return;
                 return;
@@ -258,7 +270,7 @@ namespace ET
         // GetComponentSystem
         // GetComponentSystem
         public void GetComponent(Entity entity, Entity component)
         public void GetComponent(Entity entity, Entity component)
         {
         {
-            List<object> iGetSystem = this.typeSystems.GetSystems(entity.GetType(), typeof (IGetComponentSystem));
+            List<object> iGetSystem = this.TypeSystems.GetSystems(entity.GetType(), typeof (IGetComponentSystem));
             if (iGetSystem == null)
             if (iGetSystem == null)
             {
             {
                 return;
                 return;
@@ -285,7 +297,7 @@ namespace ET
         // AddComponentSystem
         // AddComponentSystem
         public void AddComponent(Entity entity, Entity component)
         public void AddComponent(Entity entity, Entity component)
         {
         {
-            List<object> iAddSystem = this.typeSystems.GetSystems(entity.GetType(), typeof (IAddComponentSystem));
+            List<object> iAddSystem = this.TypeSystems.GetSystems(entity.GetType(), typeof (IAddComponentSystem));
             if (iAddSystem == null)
             if (iAddSystem == null)
             {
             {
                 return;
                 return;
@@ -311,7 +323,7 @@ namespace ET
 
 
         public void Awake(Entity component)
         public void Awake(Entity component)
         {
         {
-            List<object> iAwakeSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem));
+            List<object> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem));
             if (iAwakeSystems == null)
             if (iAwakeSystems == null)
             {
             {
                 return;
                 return;
@@ -337,7 +349,7 @@ namespace ET
 
 
         public void Awake<P1>(Entity component, P1 p1)
         public void Awake<P1>(Entity component, P1 p1)
         {
         {
-            List<object> iAwakeSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1>));
+            List<object> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1>));
             if (iAwakeSystems == null)
             if (iAwakeSystems == null)
             {
             {
                 return;
                 return;
@@ -363,7 +375,7 @@ namespace ET
 
 
         public void Awake<P1, P2>(Entity component, P1 p1, P2 p2)
         public void Awake<P1, P2>(Entity component, P1 p1, P2 p2)
         {
         {
-            List<object> iAwakeSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2>));
+            List<object> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2>));
             if (iAwakeSystems == null)
             if (iAwakeSystems == null)
             {
             {
                 return;
                 return;
@@ -389,7 +401,7 @@ namespace ET
 
 
         public void Awake<P1, P2, P3>(Entity component, P1 p1, P2 p2, P3 p3)
         public void Awake<P1, P2, P3>(Entity component, P1 p1, P2 p2, P3 p3)
         {
         {
-            List<object> iAwakeSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2, P3>));
+            List<object> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2, P3>));
             if (iAwakeSystems == null)
             if (iAwakeSystems == null)
             {
             {
                 return;
                 return;
@@ -415,7 +427,7 @@ namespace ET
 
 
         public void Awake<P1, P2, P3, P4>(Entity component, P1 p1, P2 p2, P3 p3, P4 p4)
         public void Awake<P1, P2, P3, P4>(Entity component, P1 p1, P2 p2, P3 p3, P4 p4)
         {
         {
-            List<object> iAwakeSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2, P3, P4>));
+            List<object> iAwakeSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IAwakeSystem<P1, P2, P3, P4>));
             if (iAwakeSystems == null)
             if (iAwakeSystems == null)
             {
             {
                 return;
                 return;
@@ -441,7 +453,7 @@ namespace ET
 
 
         public void Load()
         public void Load()
         {
         {
-            Queue<long> queue = this.queues[(int)InstanceQueueIndex.Load];
+            Queue<long> queue = this.queues[InstanceQueueIndex.Load];
             int count = queue.Count;
             int count = queue.Count;
             while (count-- > 0)
             while (count-- > 0)
             {
             {
@@ -457,7 +469,7 @@ namespace ET
                     continue;
                     continue;
                 }
                 }
 
 
-                List<object> iLoadSystems = this.typeSystems.GetSystems(component.GetType(), typeof (ILoadSystem));
+                List<object> iLoadSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (ILoadSystem));
                 if (iLoadSystems == null)
                 if (iLoadSystems == null)
                 {
                 {
                     continue;
                     continue;
@@ -481,7 +493,7 @@ namespace ET
 
 
         public void Destroy(Entity component)
         public void Destroy(Entity component)
         {
         {
-            List<object> iDestroySystems = this.typeSystems.GetSystems(component.GetType(), typeof (IDestroySystem));
+            List<object> iDestroySystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IDestroySystem));
             if (iDestroySystems == null)
             if (iDestroySystems == null)
             {
             {
                 return;
                 return;
@@ -507,7 +519,7 @@ namespace ET
 
 
         public void Update()
         public void Update()
         {
         {
-            Queue<long> queue = this.queues[(int)InstanceQueueIndex.Update];
+            Queue<long> queue = this.queues[InstanceQueueIndex.Update];
             int count = queue.Count;
             int count = queue.Count;
             while (count-- > 0)
             while (count-- > 0)
             {
             {
@@ -523,7 +535,7 @@ namespace ET
                     continue;
                     continue;
                 }
                 }
 
 
-                List<object> iUpdateSystems = this.typeSystems.GetSystems(component.GetType(), typeof (IUpdateSystem));
+                List<object> iUpdateSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (IUpdateSystem));
                 if (iUpdateSystems == null)
                 if (iUpdateSystems == null)
                 {
                 {
                     continue;
                     continue;
@@ -547,7 +559,7 @@ namespace ET
 
 
         public void LateUpdate()
         public void LateUpdate()
         {
         {
-            Queue<long> queue = this.queues[(int)InstanceQueueIndex.LateUpdate];
+            Queue<long> queue = this.queues[InstanceQueueIndex.LateUpdate];
             int count = queue.Count;
             int count = queue.Count;
             while (count-- > 0)
             while (count-- > 0)
             {
             {
@@ -563,7 +575,7 @@ namespace ET
                     continue;
                     continue;
                 }
                 }
 
 
-                List<object> iLateUpdateSystems = this.typeSystems.GetSystems(component.GetType(), typeof (ILateUpdateSystem));
+                List<object> iLateUpdateSystems = this.TypeSystems.GetSystems(component.GetType(), typeof (ILateUpdateSystem));
                 if (iLateUpdateSystems == null)
                 if (iLateUpdateSystems == null)
                 {
                 {
                     continue;
                     continue;

+ 1 - 1
Unity/Assets/Scripts/Core/Module/EventSystem/IAddComponentSystem.cs

@@ -24,7 +24,7 @@ namespace ET
 			return typeof(IAddComponentSystem);
 			return typeof(IAddComponentSystem);
 		}
 		}
 
 
-		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
+		int ISystemType.GetInstanceQueueIndex()
 		{
 		{
 			return InstanceQueueIndex.None;
 			return InstanceQueueIndex.None;
 		}
 		}

+ 5 - 5
Unity/Assets/Scripts/Core/Module/EventSystem/IAwakeSystem.cs

@@ -60,7 +60,7 @@ namespace ET
             return typeof(IAwakeSystem);
             return typeof(IAwakeSystem);
         }
         }
 
 
-        InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
+        int ISystemType.GetInstanceQueueIndex()
         {
         {
             return InstanceQueueIndex.None;
             return InstanceQueueIndex.None;
         }
         }
@@ -86,7 +86,7 @@ namespace ET
             return typeof(IAwakeSystem<A>);
             return typeof(IAwakeSystem<A>);
         }
         }
 
 
-        InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
+        int ISystemType.GetInstanceQueueIndex()
         {
         {
             return InstanceQueueIndex.None;
             return InstanceQueueIndex.None;
         }
         }
@@ -112,7 +112,7 @@ namespace ET
             return typeof(IAwakeSystem<A, B>);
             return typeof(IAwakeSystem<A, B>);
         }
         }
 
 
-        InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
+        int ISystemType.GetInstanceQueueIndex()
         {
         {
             return InstanceQueueIndex.None;
             return InstanceQueueIndex.None;
         }
         }
@@ -138,7 +138,7 @@ namespace ET
             return typeof(IAwakeSystem<A, B, C>);
             return typeof(IAwakeSystem<A, B, C>);
         }
         }
 
 
-        InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
+        int ISystemType.GetInstanceQueueIndex()
         {
         {
             return InstanceQueueIndex.None;
             return InstanceQueueIndex.None;
         }
         }
@@ -164,7 +164,7 @@ namespace ET
             return typeof(IAwakeSystem<A, B, C, D>);
             return typeof(IAwakeSystem<A, B, C, D>);
         }
         }
 
 
-        InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
+        int ISystemType.GetInstanceQueueIndex()
         {
         {
             return InstanceQueueIndex.None;
             return InstanceQueueIndex.None;
         }
         }

+ 1 - 1
Unity/Assets/Scripts/Core/Module/EventSystem/IDeserializeSystem.cs

@@ -28,7 +28,7 @@ namespace ET
 			return typeof(IDeserializeSystem);
 			return typeof(IDeserializeSystem);
 		}
 		}
 
 
-		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
+		int ISystemType.GetInstanceQueueIndex()
 		{
 		{
 			return InstanceQueueIndex.None;
 			return InstanceQueueIndex.None;
 		}
 		}

+ 1 - 1
Unity/Assets/Scripts/Core/Module/EventSystem/IDestroySystem.cs

@@ -24,7 +24,7 @@ namespace ET
 			return typeof(IDestroySystem);
 			return typeof(IDestroySystem);
 		}
 		}
 
 
-		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
+		int ISystemType.GetInstanceQueueIndex()
 		{
 		{
 			return InstanceQueueIndex.None;
 			return InstanceQueueIndex.None;
 		}
 		}

+ 1 - 1
Unity/Assets/Scripts/Core/Module/EventSystem/IGetComponentSystem.cs

@@ -28,7 +28,7 @@ namespace ET
 			return typeof(IGetComponentSystem);
 			return typeof(IGetComponentSystem);
 		}
 		}
 
 
-		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
+		int ISystemType.GetInstanceQueueIndex()
 		{
 		{
 			return InstanceQueueIndex.None;
 			return InstanceQueueIndex.None;
 		}
 		}

+ 1 - 1
Unity/Assets/Scripts/Core/Module/EventSystem/ILateUpdateSystem.cs

@@ -29,7 +29,7 @@ namespace ET
 			return typeof(ILateUpdateSystem);
 			return typeof(ILateUpdateSystem);
 		}
 		}
 
 
-		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
+		int ISystemType.GetInstanceQueueIndex()
 		{
 		{
 			return InstanceQueueIndex.LateUpdate;
 			return InstanceQueueIndex.LateUpdate;
 		}
 		}

+ 1 - 1
Unity/Assets/Scripts/Core/Module/EventSystem/ILoadSystem.cs

@@ -29,7 +29,7 @@ namespace ET
 			return typeof(ILoadSystem);
 			return typeof(ILoadSystem);
 		}
 		}
 
 
-		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
+		int ISystemType.GetInstanceQueueIndex()
 		{
 		{
 			return InstanceQueueIndex.Load;
 			return InstanceQueueIndex.Load;
 		}
 		}

+ 1 - 1
Unity/Assets/Scripts/Core/Module/EventSystem/ISystemType.cs

@@ -6,6 +6,6 @@ namespace ET
     {
     {
         Type Type();
         Type Type();
         Type SystemType();
         Type SystemType();
-        InstanceQueueIndex GetInstanceQueueIndex();
+        int GetInstanceQueueIndex();
     }
     }
 }
 }

+ 1 - 1
Unity/Assets/Scripts/Core/Module/EventSystem/IUpdateSystem.cs

@@ -29,7 +29,7 @@ namespace ET
 			return typeof(IUpdateSystem);
 			return typeof(IUpdateSystem);
 		}
 		}
 
 
-		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
+		int ISystemType.GetInstanceQueueIndex()
 		{
 		{
 			return InstanceQueueIndex.Update;
 			return InstanceQueueIndex.Update;
 		}
 		}

+ 6 - 6
Unity/Assets/Scripts/Core/Module/EventSystem/InstanceQueueIndex.cs

@@ -1,11 +1,11 @@
 namespace ET
 namespace ET
 {
 {
-    public enum InstanceQueueIndex
+    public static class InstanceQueueIndex
     {
     {
-        None = -1,
-        Update,
-        LateUpdate,
-        Load,
-        Max,
+        public const int None = -1;
+        public const int Update = 0;
+        public const int LateUpdate = 1;
+        public const int Load = 2;
+        public const int Max = 3;
     }
     }
 }
 }