Explorar el Código

1.Unity.Model, Unity.Hotfix, Unity.ThirdParty在asmdef中勾选no engine reference
2.ISingleton跟各种System都使用显式接口

tanghai hace 3 años
padre
commit
f126ba0413

+ 1 - 1
Unity/Assets/Scripts/Codes/Editor/Unity.Editor.Codes.asmdef

@@ -1,6 +1,6 @@
 {
     "name": "Unity.Editor.Codes",
-    "rootNamespace": "",
+    "rootNamespace": "ET",
     "references": [
         "Unity.ThirdParty",
         "Unity.Core",

+ 2 - 2
Unity/Assets/Scripts/Codes/Hotfix/Unity.Hotfix.Codes.asmdef

@@ -1,6 +1,6 @@
 {
     "name": "Unity.Hotfix.Codes",
-    "rootNamespace": "",
+    "rootNamespace": "ET",
     "references": [
         "Unity.ThirdParty",
         "Unity.Core",
@@ -20,5 +20,5 @@
         "ENABLE_CODES"
     ],
     "versionDefines": [],
-    "noEngineReferences": false
+    "noEngineReferences": true
 }

+ 1 - 1
Unity/Assets/Scripts/Codes/HotfixView/Unity.HotfixView.Codes.asmdef

@@ -1,6 +1,6 @@
 {
     "name": "Unity.HotfixView.Codes",
-    "rootNamespace": "",
+    "rootNamespace": "ET",
     "references": [
         "Unity.ThirdParty",
         "Unity.Core",

+ 0 - 1
Unity/Assets/Scripts/Codes/Model/Client/Demo/AI/XunLuoPathComponent.cs

@@ -6,7 +6,6 @@ namespace ET.Client
     public class XunLuoPathComponent: Entity, IAwake
     {
         public float3[] path = new float3[] { new float3(0, 0, 0), new float3(20, 0, 0), new float3(20, 0, 20), new float3(0, 0, 20), };
-
         public int Index;
     }
 }

+ 2 - 2
Unity/Assets/Scripts/Codes/Model/Unity.Model.Codes.asmdef

@@ -1,6 +1,6 @@
 {
     "name": "Unity.Model.Codes",
-    "rootNamespace": "",
+    "rootNamespace": "ET",
     "references": [
         "Unity.ThirdParty",
         "Unity.Core",
@@ -18,5 +18,5 @@
         "ENABLE_CODES"
     ],
     "versionDefines": [],
-    "noEngineReferences": false
+    "noEngineReferences": true
 }

+ 1 - 1
Unity/Assets/Scripts/Codes/ModelView/Unity.ModelView.Codes.asmdef

@@ -1,6 +1,6 @@
 {
     "name": "Unity.ModelView.Codes",
-    "rootNamespace": "",
+    "rootNamespace": "ET",
     "references": [
         "Unity.ThirdParty",
         "Unity.Core",

+ 3 - 3
Unity/Assets/Scripts/Core/Module/Config/ConfigSingleton.cs

@@ -15,7 +15,7 @@ namespace ET
             }
         }
 
-        public void Register()
+        void ISingleton.Register()
         {
             if (instance != null)
             {
@@ -24,14 +24,14 @@ namespace ET
             instance = (T)this;
         }
 
-        public void Destroy()
+        void ISingleton.Destroy()
         {
             T t = instance;
             instance = null;
             t.Dispose();
         }
 
-        public bool IsDisposed()
+        bool ISingleton.IsDisposed()
         {
             throw new NotImplementedException();
         }

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

@@ -8,28 +8,28 @@ namespace ET
 	
 	public interface IAddComponentSystem: ISystemType
 	{
-		void Run(object o, Entity component);
+		void Run(Entity o, Entity component);
 	}
 
 	[ObjectSystem]
-	public abstract class AddComponentSystem<T> : IAddComponentSystem where T: IAddComponent
+	public abstract class AddComponentSystem<T> : IAddComponentSystem where T: Entity, IAddComponent
 	{
-		public void Run(object o, Entity component)
+		void IAddComponentSystem.Run(Entity o, Entity component)
 		{
 			this.AddComponent((T)o, component);
 		}
-		
-		public Type SystemType()
+
+		Type ISystemType.SystemType()
 		{
 			return typeof(IAddComponentSystem);
 		}
 
-		public InstanceQueueIndex GetInstanceQueueIndex()
+		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
 		{
 			return InstanceQueueIndex.None;
 		}
 
-		public Type Type()
+		Type ISystemType.Type()
 		{
 			return typeof(T);
 		}

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

@@ -24,48 +24,48 @@ namespace ET
     
     public interface IAwakeSystem: ISystemType
     {
-        void Run(object o);
+        void Run(Entity o);
     }
 	
     public interface IAwakeSystem<A>: ISystemType
     {
-        void Run(object o, A a);
+        void Run(Entity o, A a);
     }
 	
     public interface IAwakeSystem<A, B>: ISystemType
     {
-        void Run(object o, A a, B b);
+        void Run(Entity o, A a, B b);
     }
 	
     public interface IAwakeSystem<A, B, C>: ISystemType
     {
-        void Run(object o, A a, B b, C c);
+        void Run(Entity o, A a, B b, C c);
     }
 	
     public interface IAwakeSystem<A, B, C, D>: ISystemType
     {
-        void Run(object o, A a, B b, C c, D d);
+        void Run(Entity o, A a, B b, C c, D d);
     }
 
     [ObjectSystem]
-    public abstract class AwakeSystem<T> : IAwakeSystem where T: IAwake
+    public abstract class AwakeSystem<T> : IAwakeSystem where T: Entity, IAwake
     {
-        public Type Type()
+        Type ISystemType.Type()
         {
             return typeof(T);
         }
-		
-        public Type SystemType()
+
+        Type ISystemType.SystemType()
         {
             return typeof(IAwakeSystem);
         }
 
-        public InstanceQueueIndex GetInstanceQueueIndex()
+        InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
         {
             return InstanceQueueIndex.None;
         }
 
-        public void Run(object o)
+        void IAwakeSystem.Run(Entity o)
         {
             this.Awake((T)o);
         }
@@ -74,24 +74,24 @@ namespace ET
     }
     
     [ObjectSystem]
-    public abstract class AwakeSystem<T, A> : IAwakeSystem<A> where T: IAwake<A>
+    public abstract class AwakeSystem<T, A> : IAwakeSystem<A> where T: Entity, IAwake<A>
     {
-        public Type Type()
+        Type ISystemType.Type()
         {
             return typeof(T);
         }
-		
-        public Type SystemType()
+
+        Type ISystemType.SystemType()
         {
             return typeof(IAwakeSystem<A>);
         }
 
-        public InstanceQueueIndex GetInstanceQueueIndex()
+        InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
         {
             return InstanceQueueIndex.None;
         }
 
-        public void Run(object o, A a)
+        void IAwakeSystem<A>.Run(Entity o, A a)
         {
             this.Awake((T)o, a);
         }
@@ -100,24 +100,24 @@ namespace ET
     }
 
     [ObjectSystem]
-    public abstract class AwakeSystem<T, A, B> : IAwakeSystem<A, B> where T: IAwake<A, B>
+    public abstract class AwakeSystem<T, A, B> : IAwakeSystem<A, B> where T: Entity, IAwake<A, B>
     {
-        public Type Type()
+        Type ISystemType.Type()
         {
             return typeof(T);
         }
-		
-        public Type SystemType()
+
+        Type ISystemType.SystemType()
         {
             return typeof(IAwakeSystem<A, B>);
         }
 
-        public InstanceQueueIndex GetInstanceQueueIndex()
+        InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
         {
             return InstanceQueueIndex.None;
         }
 
-        public void Run(object o, A a, B b)
+        void IAwakeSystem<A, B>.Run(Entity o, A a, B b)
         {
             this.Awake((T)o, a, b);
         }
@@ -126,24 +126,24 @@ namespace ET
     }
 
     [ObjectSystem]
-    public abstract class AwakeSystem<T, A, B, C> : IAwakeSystem<A, B, C> where T: IAwake<A, B, C>
+    public abstract class AwakeSystem<T, A, B, C> : IAwakeSystem<A, B, C> where T: Entity, IAwake<A, B, C>
     {
-        public Type Type()
+        Type ISystemType.Type()
         {
             return typeof(T);
         }
-		
-        public Type SystemType()
+
+        Type ISystemType.SystemType()
         {
             return typeof(IAwakeSystem<A, B, C>);
         }
 
-        public InstanceQueueIndex GetInstanceQueueIndex()
+        InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
         {
             return InstanceQueueIndex.None;
         }
 
-        public void Run(object o, A a, B b, C c)
+        void IAwakeSystem<A, B, C>.Run(Entity o, A a, B b, C c)
         {
             this.Awake((T)o, a, b, c);
         }
@@ -152,24 +152,24 @@ namespace ET
     }
     
     [ObjectSystem]
-    public abstract class AwakeSystem<T, A, B, C, D> : IAwakeSystem<A, B, C, D> where T: IAwake<A, B, C, D>
+    public abstract class AwakeSystem<T, A, B, C, D> : IAwakeSystem<A, B, C, D> where T: Entity, IAwake<A, B, C, D>
     {
-        public Type Type()
+        Type ISystemType.Type()
         {
             return typeof(T);
         }
-		
-        public Type SystemType()
+
+        Type ISystemType.SystemType()
         {
             return typeof(IAwakeSystem<A, B, C, D>);
         }
 
-        public InstanceQueueIndex GetInstanceQueueIndex()
+        InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
         {
             return InstanceQueueIndex.None;
         }
 
-        public void Run(object o, A a, B b, C c, D d)
+        void IAwakeSystem<A, B, C, D>.Run(Entity o, A a, B b, C c, D d)
         {
             this.Awake((T)o, a, b, c, d);
         }

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

@@ -8,7 +8,7 @@ namespace ET
 	
 	public interface IDeserializeSystem: ISystemType
 	{
-		void Run(object o);
+		void Run(Entity o);
 	}
 
 	/// <summary>
@@ -16,24 +16,24 @@ namespace ET
 	/// </summary>
 	/// <typeparam name="T"></typeparam>
 	[ObjectSystem]
-	public abstract class DeserializeSystem<T> : IDeserializeSystem where T: IDeserialize
+	public abstract class DeserializeSystem<T> : IDeserializeSystem where T: Entity, IDeserialize
 	{
-		public void Run(object o)
+		void IDeserializeSystem.Run(Entity o)
 		{
 			this.Deserialize((T)o);
 		}
-		
-		public Type SystemType()
+
+		Type ISystemType.SystemType()
 		{
 			return typeof(IDeserializeSystem);
 		}
 
-		public InstanceQueueIndex GetInstanceQueueIndex()
+		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
 		{
 			return InstanceQueueIndex.None;
 		}
 
-		public Type Type()
+		Type ISystemType.Type()
 		{
 			return typeof(T);
 		}

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

@@ -4,33 +4,32 @@ namespace ET
 {
 	public interface IDestroy
 	{
-		
 	}
 	
 	public interface IDestroySystem: ISystemType
 	{
-		void Run(object o);
+		void Run(Entity o);
 	}
 
 	[ObjectSystem]
-	public abstract class DestroySystem<T> : IDestroySystem where T: IDestroy
+	public abstract class DestroySystem<T> : IDestroySystem where T: Entity, IDestroy
 	{
-		public void Run(object o)
+		void IDestroySystem.Run(Entity o)
 		{
 			this.Destroy((T)o);
 		}
-		
-		public Type SystemType()
+
+		Type ISystemType.SystemType()
 		{
 			return typeof(IDestroySystem);
 		}
 
-		public InstanceQueueIndex GetInstanceQueueIndex()
+		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
 		{
 			return InstanceQueueIndex.None;
 		}
 
-		public Type Type()
+		Type ISystemType.Type()
 		{
 			return typeof(T);
 		}

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

@@ -12,28 +12,28 @@ namespace ET
 	
 	public interface IGetComponentSystem: ISystemType
 	{
-		void Run(object o, Entity component);
+		void Run(Entity o, Entity component);
 	}
 
 	[ObjectSystem]
-	public abstract class GetComponentSystem<T> : IGetComponentSystem where T: IGetComponent
+	public abstract class GetComponentSystem<T> : IGetComponentSystem where T: Entity, IGetComponent
 	{
-		public void Run(object o, Entity component)
+		void IGetComponentSystem.Run(Entity o, Entity component)
 		{
 			this.GetComponent((T)o, component);
 		}
-		
-		public Type SystemType()
+
+		Type ISystemType.SystemType()
 		{
 			return typeof(IGetComponentSystem);
 		}
 
-		public InstanceQueueIndex GetInstanceQueueIndex()
+		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
 		{
 			return InstanceQueueIndex.None;
 		}
 
-		public Type Type()
+		Type ISystemType.Type()
 		{
 			return typeof(T);
 		}

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

@@ -8,28 +8,28 @@ namespace ET
 	
 	public interface ILateUpdateSystem: ISystemType
 	{
-		void Run(object o);
+		void Run(Entity o);
 	}
 
 	[ObjectSystem]
-	public abstract class LateUpdateSystem<T> : ILateUpdateSystem where T: ILateUpdate
+	public abstract class LateUpdateSystem<T> : ILateUpdateSystem where T: Entity, ILateUpdate
 	{
-		public void Run(object o)
+		void ILateUpdateSystem.Run(Entity o)
 		{
 			this.LateUpdate((T)o);
 		}
 
-		public Type Type()
+		Type ISystemType.Type()
 		{
 			return typeof(T);
 		}
-		
-		public Type SystemType()
+
+		Type ISystemType.SystemType()
 		{
 			return typeof(ILateUpdateSystem);
 		}
 
-		public InstanceQueueIndex GetInstanceQueueIndex()
+		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
 		{
 			return InstanceQueueIndex.LateUpdate;
 		}

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

@@ -8,28 +8,28 @@ namespace ET
 	
 	public interface ILoadSystem: ISystemType
 	{
-		void Run(object o);
+		void Run(Entity o);
 	}
 
 	[ObjectSystem]
-	public abstract class LoadSystem<T> : ILoadSystem where T: ILoad
+	public abstract class LoadSystem<T> : ILoadSystem where T: Entity, ILoad
 	{
-		public void Run(object o)
+		void ILoadSystem.Run(Entity o)
 		{
 			this.Load((T)o);
 		}
-		
-		public Type Type()
+
+		Type ISystemType.Type()
 		{
 			return typeof(T);
 		}
-		
-		public Type SystemType()
+
+		Type ISystemType.SystemType()
 		{
 			return typeof(ILoadSystem);
 		}
 
-		public InstanceQueueIndex GetInstanceQueueIndex()
+		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
 		{
 			return InstanceQueueIndex.Load;
 		}

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

@@ -8,28 +8,28 @@ namespace ET
 	
 	public interface IUpdateSystem: ISystemType
 	{
-		void Run(object o);
+		void Run(Entity o);
 	}
 
 	[ObjectSystem]
-	public abstract class UpdateSystem<T> : IUpdateSystem where T: IUpdate
+	public abstract class UpdateSystem<T> : IUpdateSystem where T: Entity, IUpdate
 	{
-		public void Run(object o)
+		void IUpdateSystem.Run(Entity o)
 		{
 			this.Update((T)o);
 		}
 
-		public Type Type()
+		Type ISystemType.Type()
 		{
 			return typeof(T);
 		}
-		
-		public Type SystemType()
+
+		Type ISystemType.SystemType()
 		{
 			return typeof(IUpdateSystem);
 		}
 
-		public InstanceQueueIndex GetInstanceQueueIndex()
+		InstanceQueueIndex ISystemType.GetInstanceQueueIndex()
 		{
 			return InstanceQueueIndex.Update;
 		}

+ 3 - 3
Unity/Assets/Scripts/Core/Singleton/Singleton.cs

@@ -23,7 +23,7 @@ namespace ET
             }
         }
 
-        public void Register()
+        void ISingleton.Register()
         {
             if (instance != null)
             {
@@ -32,7 +32,7 @@ namespace ET
             instance = (T)this;
         }
 
-        public void Destroy()
+        void ISingleton.Destroy()
         {
             if (this.isDisposed)
             {
@@ -45,7 +45,7 @@ namespace ET
             t.Dispose();
         }
 
-        public bool IsDisposed()
+        bool ISingleton.IsDisposed()
         {
             return this.isDisposed;
         }

+ 1 - 1
Unity/Assets/Scripts/Empty/Hotfix/Unity.Hotfix.asmdef

@@ -18,5 +18,5 @@
     "autoReferenced": true,
     "defineConstraints": [],
     "versionDefines": [],
-    "noEngineReferences": false
+    "noEngineReferences": true
 }

+ 1 - 1
Unity/Assets/Scripts/Empty/Model/Unity.Model.asmdef

@@ -16,5 +16,5 @@
     "autoReferenced": true,
     "defineConstraints": [],
     "versionDefines": [],
-    "noEngineReferences": false
+    "noEngineReferences": true
 }

+ 2 - 2
Unity/Assets/Scripts/ThirdParty/Unity.ThirdParty.asmdef

@@ -1,6 +1,6 @@
 {
     "name": "Unity.ThirdParty",
-    "rootNamespace": "",
+    "rootNamespace": "ET",
     "references": [],
     "includePlatforms": [],
     "excludePlatforms": [],
@@ -10,5 +10,5 @@
     "autoReferenced": true,
     "defineConstraints": [],
     "versionDefines": [],
-    "noEngineReferences": false
+    "noEngineReferences": true
 }