Browse Source

Merge branch 'F/0719_ImmersalOptimize' of ssh://gogs.ghz-tech.com:30979/GHzGlass/GHZMRNavigatorProXR into F/0719_ImmersalOptimize

DGJ 1 năm trước cách đây
mục cha
commit
eed453eefb
100 tập tin đã thay đổi với 1760 bổ sung2669 xóa
  1. 29 0
      Assets/CheckIsUse.cs
  2. 1 1
      Assets/CheckIsUse.cs.meta
  3. 1 1
      Assets/ImmersalSDK/Core/Scripts/AR/ARMap.cs
  4. 6 2
      Assets/ImmersalSDK/Core/Scripts/AR/ARSpace.cs
  5. 513 378
      Assets/MRNavigatorPro.unity
  6. BIN
      Assets/Resources/GONGYE3.jpg
  7. 135 0
      Assets/Resources/GONGYE3.jpg.meta
  8. 10 11
      Assets/Resources/VuforiaConfiguration.asset
  9. 1064 0
      Assets/Scripts/Blue/0.FrameworkDesign/BlueVersion3.cs
  10. 1 1
      Assets/Scripts/Blue/0.FrameworkDesign/BlueVersion3.cs.meta
  11. 0 7
      Assets/Scripts/Blue/0.FrameworkDesign/Command/ICommand.cs
  12. 0 8
      Assets/Scripts/Blue/0.FrameworkDesign/Core.meta
  13. 0 202
      Assets/Scripts/Blue/0.FrameworkDesign/Core/AbstractArchitecture.cs
  14. 0 133
      Assets/Scripts/Blue/0.FrameworkDesign/Core/ControllerAr.cs
  15. 0 29
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IArchitecture.cs
  16. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IArchitecture.cs.meta
  17. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IArchitectureModule.cs
  18. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IArchitectureModule.cs.meta
  19. 0 36
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IArchitectureModuleExtension.cs
  20. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IArchitectureModuleExtension.cs.meta
  21. 0 6
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IAuto.cs
  22. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IAuto.cs.meta
  23. 0 9
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IController.cs
  24. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IController.cs.meta
  25. 0 10
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IModel.cs
  26. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IModel.cs.meta
  27. 0 10
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IService.cs
  28. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IService.cs.meta
  29. 0 9
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IUtility.cs
  30. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Core/IUtility.cs.meta
  31. 0 54
      Assets/Scripts/Blue/0.FrameworkDesign/Core/ModuleInitiator.cs
  32. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Core/ModuleInitiator.cs.meta
  33. BIN
      Assets/Scripts/Blue/0.FrameworkDesign/Design.eddx
  34. 0 8
      Assets/Scripts/Blue/0.FrameworkDesign/Event.meta
  35. 0 22
      Assets/Scripts/Blue/0.FrameworkDesign/Event/BindablePropertyUnSubscribe.cs
  36. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/BindablePropertyUnSubscribe.cs.meta
  37. 0 41
      Assets/Scripts/Blue/0.FrameworkDesign/Event/ChainEventSubscription.cs
  38. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/ChainEventSubscription.cs.meta
  39. 0 27
      Assets/Scripts/Blue/0.FrameworkDesign/Event/DefaultChainEventUnSubcribe.cs
  40. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/DefaultChainEventUnSubcribe.cs.meta
  41. 0 160
      Assets/Scripts/Blue/0.FrameworkDesign/Event/DefaultTypeEventSystem.cs
  42. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/DefaultTypeEventSystem.cs.meta
  43. 0 49
      Assets/Scripts/Blue/0.FrameworkDesign/Event/EventToActionAdapter.cs
  44. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/EventToActionAdapter.cs.meta
  45. 0 8
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEvent.cs
  46. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEvent.cs.meta
  47. 0 18
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEventSubscription.cs
  48. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEventSubscription.cs.meta
  49. 0 31
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEventUnSubcribeExtension.cs
  50. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEventUnSubcribeExtension.cs.meta
  51. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEventUnSubscribe.cs
  52. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEventUnSubscribe.cs.meta
  53. 0 6
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IEvent.cs
  54. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IEvent.cs.meta
  55. 0 13
      Assets/Scripts/Blue/0.FrameworkDesign/Event/ISubscription.cs
  56. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/ISubscription.cs.meta
  57. 0 28
      Assets/Scripts/Blue/0.FrameworkDesign/Event/ITypeEventSystem.cs
  58. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/ITypeEventSystem.cs.meta
  59. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IUnSubscribe.cs
  60. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IUnSubscribe.cs.meta
  61. 0 26
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IUnSubscribeExtension.cs
  62. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/IUnSubscribeExtension.cs.meta
  63. 0 49
      Assets/Scripts/Blue/0.FrameworkDesign/Event/TypeEventSubscription.cs
  64. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/TypeEventSubscription.cs.meta
  65. 0 19
      Assets/Scripts/Blue/0.FrameworkDesign/Event/TypeEventSystemUnSubscribe.cs
  66. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/TypeEventSystemUnSubscribe.cs.meta
  67. 0 22
      Assets/Scripts/Blue/0.FrameworkDesign/Event/UnSubscribeChainEventOnDestroyTrigger.cs
  68. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/UnSubscribeChainEventOnDestroyTrigger.cs.meta
  69. 0 22
      Assets/Scripts/Blue/0.FrameworkDesign/Event/UnSubscribeOnDestroyTrigger.cs
  70. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/UnSubscribeOnDestroyTrigger.cs.meta
  71. 0 22
      Assets/Scripts/Blue/0.FrameworkDesign/Event/UnSubscribeOnDisableTrigger.cs
  72. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Event/UnSubscribeOnDisableTrigger.cs.meta
  73. 0 8
      Assets/Scripts/Blue/0.FrameworkDesign/Hand.meta
  74. 0 8
      Assets/Scripts/Blue/0.FrameworkDesign/Hand/IQueryCommandHandler.cs
  75. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Hand/IQueryCommandHandler.cs.meta
  76. 0 15
      Assets/Scripts/Blue/0.FrameworkDesign/Hand/QueryDefault_Hand.cs
  77. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/Hand/QueryDefault_Hand.cs.meta
  78. 0 8
      Assets/Scripts/Blue/0.FrameworkDesign/IOC.meta
  79. 0 236
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/AbstractArchitectureComponentInjector.cs
  80. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/AbstractArchitectureComponentInjector.cs.meta
  81. 0 132
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/ArchitectureInjecter.cs
  82. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/ArchitectureInjecter.cs.meta
  83. 0 36
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/AutoAttribute.cs
  84. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/AutoAttribute.cs.meta
  85. 0 54
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/ControllerInjector.cs
  86. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/ControllerInjector.cs.meta
  87. 0 19
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/IArchitectureComponentInjector.cs
  88. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/IArchitectureComponentInjector.cs.meta
  89. 0 19
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/IInjector.cs
  90. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/IInjector.cs.meta
  91. 0 65
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/IOCContainer.cs
  92. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/IOCContainer.cs.meta
  93. 0 13
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/InjectInfo.cs
  94. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/InjectInfo.cs.meta
  95. 0 40
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/InjectRuleAttribute.cs
  96. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/InjectRuleAttribute.cs.meta
  97. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/InjectScope.cs
  98. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/InjectScope.cs.meta
  99. 0 43
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/ModelInjector.cs
  100. 0 11
      Assets/Scripts/Blue/0.FrameworkDesign/IOC/ModelInjector.cs.meta

+ 29 - 0
Assets/CheckIsUse.cs

@@ -0,0 +1,29 @@
+using Immersal.AR;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class CheckIsUse : MonoBehaviour
+{
+    public Toggle t;
+    // Start is called before the first frame update
+    void Start()
+    {
+        
+    }
+
+    // Update is called once per frame
+    void Update()
+    {
+        if (ARSpace.isFind)
+        {
+            t.interactable = true;
+        }
+        else
+        {
+            t.interactable = false;
+
+        }
+    }
+}

+ 1 - 1
Assets/Scripts/Blue/0.FrameworkDesign/Core/ControllerAr.cs.meta → Assets/CheckIsUse.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 1ab12634675f7e9449ae7461b5e0b8f6
+guid: 9863930a937216a47aaebc6d15af1772
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 1 - 1
Assets/ImmersalSDK/Core/Scripts/AR/ARMap.cs

@@ -331,7 +331,7 @@ namespace Immersal.AR
             ParseMapIdAndName();
             InitializeMesh();
 
-            this.SubscribeEvent<LoadMapFileEvent>(async e=>
+            this.RegisterEvent<LoadMapFileEvent>(async e=>
             {
                 //FileStream stream = new FileStream(Application.persistentDataPath + "/Map Data/81060-0515GHz.bytes", FileMode.Open);
                 //StreamReader reader = new StreamReader(stream);

+ 6 - 2
Assets/ImmersalSDK/Core/Scripts/AR/ARSpace.cs

@@ -240,10 +240,14 @@ namespace Immersal.AR
                     mapIdToMap.Remove(mapId);
 			}
 		}
-
+        public static bool isFind;
 		public static void UpdateSpace(SpaceContainer space, Vector3 pos, Quaternion rot)
         {
-	        if (space == null)
+            if(pos!=Vector3.zero)
+            {
+                isFind = true;
+            }
+            if (space == null)
 		        return;
 	        
             if (spaceToTransform.ContainsKey(space))

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 513 - 378
Assets/MRNavigatorPro.unity


BIN
Assets/Resources/GONGYE3.jpg


+ 135 - 0
Assets/Resources/GONGYE3.jpg.meta

@@ -0,0 +1,135 @@
+fileFormatVersion: 2
+guid: b86ed4df3284fa945bac5ca676674152
+TextureImporter:
+  internalIDToNameTable: []
+  externalObjects: {}
+  serializedVersion: 12
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 1
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapsPreserveCoverage: 0
+    alphaTestReferenceValue: 0.5
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  streamingMipmaps: 0
+  streamingMipmapsPriority: 0
+  vTOnly: 0
+  ignoreMasterTextureLimit: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    serializedVersion: 2
+    filterMode: 1
+    aniso: 1
+    mipBias: 0
+    wrapU: 0
+    wrapV: 0
+    wrapW: 0
+  nPOTScale: 0
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 8
+  textureShape: 1
+  singleChannelComponent: 0
+  flipbookRows: 1
+  flipbookColumns: 1
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  ignorePngGamma: 0
+  applyGammaDecoding: 0
+  cookieLightType: 0
+  platformSettings:
+  - serializedVersion: 3
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Standalone
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Server
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 3
+    buildTarget: Android
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    physicsShape: []
+    bones: []
+    spriteID: 
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+    nameFileIdTable: {}
+  spritePackingTag: 
+  pSDRemoveMatte: 0
+  pSDShowRemoveMatteOption: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 10 - 11
Assets/Resources/VuforiaConfiguration.asset

@@ -9,12 +9,12 @@ MonoBehaviour:
   m_GameObject: {fileID: 0}
   m_Enabled: 1
   m_EditorHideFlags: 0
-  m_Script: {fileID: -2067402452, guid: bab6fa851cf5a1a4bba3cec5f191cb8e, type: 3}
+  m_Script: {fileID: 0}
   m_Name: VuforiaConfiguration
-  m_EditorClassIdentifier: 
+  m_EditorClassIdentifier: Vuforia.Unity.Engine:Vuforia:VuforiaConfiguration
   vuforia:
     vuforiaLicenseKey: 
-    ufoLicenseKey: QWRBL0Z3bi8vLy8vQUFBQUtEQlpWcEFHaFVpOGhDQ1hrM1BmSXpWay9SbjdoMGs4RVNWc1RQTUpPdFFXekdWc1FNUVZlZkl2QURWa3N6MG9RdFdacXU2K2pjSDF6NjNVVnh1bUowdU1ZLzU5ZGxkdng1QStHKzVCL1c4dHFqdEJhQXl6OG14Ym1URDBUaSs4OWxkQU4yZndKeUdPVDdSSExHU2Z2TDRRTFBYV0VhSHprbEhlMWdmNGh5eTRFRDZ4YytYSmxwcXBQekVwanliUEN5WExoRldJVlI3TEhxQXp2NURqOEcyY3Q0L3pObVVGUUp5dFJISVF4cHRnRzFodENpb1ZySTNBeDF3bWR4S3hvT2xUMU5JNzBVckQydGd2c1lSR0cwbWVpVXl2eUNZTU1kdnRaeFRpNnpWa1J0WlJ1Ym5VUCttR0NaRXkxSW8wQUdyMzdVZEs0WkZOdHhSbzFSd1IrYXRodmw2SDU4VFM2QmtjMTRZcEFpTzk=
+    ufoLicenseKey: QVhiM0Y1Ly8vLy8vQUFBQUtPbnFIeHJFSGs1N3VrMlg4U050eVBzK2pkOFZxMDhrazlwYjBsYS9aZUIxQlV1ckZWcWt0ZllSQWpnT2tIRlY2VzdOMDRTRjNYRUhmbTF5L1BnYlB4eWdHWEF6RUNheXowc3dyNVNYa2ozdERuRjhka1FpOHRscHdkMDcrcEJEY1FjTjNJcUM1bEgwOTYzQkdZdjRsQStRb0hSQU9nRGthelp5TlY0WHVwWU9EaE05NWw5bXAzbnBDMjM5MWZBWXBFdEdiL2loTDNab3N4b25ZblhjK1JtSS9wLzRoTDIwVGhmTXR6WFJNYkpUTXZLZzJoQ0N0TEJXNEptZ0pSOUtSdStzQWM3QjVNOWFFMGVHQ1dUT1VRSUUweEpiZC9ZL2cvS29iNDhBRXdQOGFwbWR5NmRWU0FHU2psVzRZY2FEU2Zud3J1ZHhucVNmSUZiajNTUnIzM0lKVlFIaW1rL0oyOGNFeDdyekcySXg=
     delayedInitialization: 0
     cameraFocusModeSetting: 2
     cameraDeviceModeSetting: -1
@@ -23,19 +23,18 @@ MonoBehaviour:
     modelTargetRecoWhileExtendedTracked: 1
     shareRecordingsInITunes: 0
     logLevel: 0
-    version: 10.13.3
-    eulaAcceptedVersions: '{"Values":["","0.0","10.11","10.12","10.13"]}'
+    version: 1.0.0
+    eulaAcceptedVersions: 
   database:
     disableModelExtraction: 0
   shaders:
-    depthMaskShader: {fileID: 4800000, guid: 1ce7eb78425fb1540838bc9d5d95857a, type: 3}
-    outlineShader: {fileID: 4800000, guid: c1ded68d068051d4f92650fcddaae5c7, type: 3}
+    depthMaskShader: {fileID: 0}
+    outlineShader: {fileID: 0}
     unlitTransparentShader: {fileID: 10750, guid: 0000000000000000f000000000000000,
       type: 0}
   videoBackground:
     numDivisions: 2
-    videoBackgroundShader: {fileID: 4800000, guid: f40623b353e2f1943b1b3ba42975db7a,
-      type: 3}
+    videoBackgroundShader: {fileID: 0}
     unlitShader: {fileID: 10752, guid: 0000000000000000f000000000000000, type: 0}
     videoBackgroundEnabled: 1
   deviceTracker:
@@ -44,9 +43,9 @@ MonoBehaviour:
     autoImportArcore: 1
     thirdPartyARCoreClientDetected: 0
   playmode:
-    mSequencePath: 
+    mRecordingPath: 
     playModeType: 0
   webcam:
     renderTextureLayer: 30
   packageInformation:
-    ARFoundationVersion: 4.2.7
+    ARFoundationVersion: 

+ 1064 - 0
Assets/Scripts/Blue/0.FrameworkDesign/BlueVersion3.cs

@@ -0,0 +1,1064 @@
+using System.Threading.Tasks;
+using System.Collections.Generic;
+using System;
+using UnityEngine;
+using System.Reflection;
+
+/*
+修改第三版
+将事件从IArchitecture中剥离
+*/
+namespace Blue
+{
+
+    #region  Architecture
+
+    /// <summary>
+    /// 所有功能在 IArchitecture 接口中定义
+    /// 1. 注册/获取Service、Model、Utility;
+    /// 2. 发送命令、事件、查询
+    /// 3. 注册、取消注册事件
+    /// </summary>
+    public interface IArchitecture
+    {
+        void SetArchitecture(IArchitecture instance);
+        void InitArchitecture();
+
+        void RegisterService<T>(T service) where T : IService;
+        void RegisterModel<T>(T Model) where T : IModel;
+        void RegisterUtility<T>(T utility) where T : IUtility;
+
+        T GetService<T>() where T : class, IService;
+        T GetModel<T>() where T : class, IModel;
+        T GetUtility<T>() where T : class, IUtility;
+    }
+
+    public abstract class AbstractArchitecture<T> : IArchitecture where T : AbstractArchitecture<T>, new()
+    {
+        private IOCContainer mContainer = new IOCContainer(); // 将类型、对象存储进IOC容器
+        private ICommandHandler commandHandler = new DefaultCommandHandler();
+        private IQueryHandler queryHandler = new DefaultQueryHandler();
+        private ITypeEventSystem mTypeEventSystem = new TypeEventSystem();
+        private HashSet<IService> mService;
+        private HashSet<IModel> mModels;
+
+        protected abstract void Init();
+
+        private static IArchitecture mArchitectureInstance;
+        void IArchitecture.SetArchitecture(IArchitecture instance)
+        {
+            mArchitectureInstance = instance;
+            CanGetModelExtension.SetArchitecture(mArchitectureInstance);
+            CanGetServiceExtension.SetArchitecture(mArchitectureInstance);
+            CanGetUtilityExtension.SetArchitecture(mArchitectureInstance);
+
+            CanSendCommandExtension.SetCommandHandler(commandHandler);
+            CanSendQueryExtension.SetQueryHandler(queryHandler);
+
+            CanRegisterEventExtension.SetTypeEventSystem(mTypeEventSystem);
+            CanSendEventExtension.SetTypeEventSystem(mTypeEventSystem);
+        }
+        void IArchitecture.InitArchitecture()
+        {
+            StartInit();
+            FinishInit();
+        }
+        private void StartInit()
+        {
+            mService = new HashSet<IService>();
+            mModels = new HashSet<IModel>();
+            Init();
+
+            foreach (var architectureModel in mModels)
+            {
+                architectureModel.OnInit();
+            }
+            foreach (var service in mService)
+            {
+                service.OnInit();
+            }
+        }
+        private void FinishInit()
+        {
+            mService.Clear();
+            mModels.Clear();
+            mService = null;
+            mModels = null;
+        }
+
+        public void RegisterService<TService>(TService service) where TService : IService
+        {
+            mContainer.Register<TService>(service);
+
+            mService.Add(service);
+        }
+        public void RegisterModel<TModel>(TModel model) where TModel : IModel
+        {
+            mContainer.Register<TModel>(model);
+
+            mModels.Add(model);
+        }
+        public void RegisterUtility<TUtility>(TUtility utility) where TUtility : IUtility
+        {
+            mContainer.Register<TUtility>(utility);
+        }
+
+        public TService GetService<TService>() where TService : class, IService
+        {
+            return mContainer.Get<TService>();
+        }
+        public TModel GetModel<TModel>() where TModel : class, IModel
+        {
+            return mContainer.Get<TModel>();
+        }
+        public TUtility GetUtility<TUtility>() where TUtility : class, IUtility
+        {
+            return mContainer.Get<TUtility>();
+        }
+    }
+
+    /// <summary>
+    /// 启动 Architecture
+    /// </summary>
+    internal sealed class ArchitectureInitiator
+    {
+        private ArchitectureInitiator() { }
+        private static ArchitectureInitiator mInstance;
+
+        private IArchitecture architectureInstance = null; // Architecture 实例
+        private Type architectureType = typeof(IArchitecture);
+        private bool architectureInited; // Architecture 是否初始化完成
+
+        [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
+        private static void Initiate()
+        {
+            mInstance = new ArchitectureInitiator();
+
+            Type[] typeArr = Assembly.GetExecutingAssembly().GetTypes(); // 获取正在执行的程序集类型数组
+            for (int i = 0; i < typeArr.Length; i++)
+            {
+                Type tmpType = typeArr[i];
+                if (!tmpType.IsInterface)
+                {
+                    if (mInstance.IsArchitecture(tmpType))
+                    {
+                        mInstance.CreateArchitectureInstance(tmpType);
+                    }
+                }
+            }
+            mInstance.RegisterArchitecture();
+            mInstance.InitArchitecture();
+        }
+        private void RegisterArchitecture()
+        {
+            if (architectureInstance != null)
+            {
+                architectureInstance.SetArchitecture(architectureInstance);
+            }
+        }
+
+        private void InitArchitecture()
+        {
+            if (architectureInstance != null)
+            {
+                architectureInstance.InitArchitecture();
+            }
+        }
+
+
+        private bool IsArchitecture(Type tmpType)
+        {
+            if (architectureInited)
+            {
+                return false;
+            }
+            if (tmpType.IsAbstract)
+            {
+                return false;
+            }
+            return architectureType.IsAssignableFrom(tmpType); // 确定指定类型 c 的实例是否能分配给当前类型的变量
+        }
+
+        private void CreateArchitectureInstance(Type archiType)
+        {
+            if (architectureInstance == null)
+            {
+                architectureInstance = (IArchitecture)Activator.CreateInstance(archiType);
+                architectureInited = true;
+            }
+            else
+            {
+                throw new Exception("More than one Architecture sub-class in the application,it should be only one!");
+            }
+        }
+    }
+
+    public interface IOnEvent<T>
+    {
+        void OnEvent(T e);
+    }
+
+    public static class OnGlobalEventExtension
+    {
+        public static IUnRegister RegisterEvent<T>(this IOnEvent<T> self) where T :struct,IEvent
+        {
+            return TypeEventSystem.Global.Register<T>(self.OnEvent);
+        }
+
+        public static void UnRegisterEvent<T>(this IOnEvent<T> self) where T : struct,IEvent
+        {
+            TypeEventSystem.Global.UnRegister<T>(self.OnEvent);
+        }
+    }
+
+    #endregion
+
+    #region Controller
+
+    public interface IController : ICanGetUtility, ICanGetService, ICanGetModel,
+                                   ICanRegisterEvent, ICanSendQuery, ICanSendCommand
+    {
+
+    }
+
+    #endregion
+
+    #region  Service
+
+    public interface IService : ICanGetService, ICanGetModel, ICanGetUtility,
+                                ICanRegisterEvent, ICanSendEvent
+    {
+        void OnInit();
+    }
+
+    #endregion
+
+    #region  Model
+
+    public interface IModel : ICanGetUtility, ICanSendEvent
+    {
+        void OnInit();
+    }
+
+    #endregion
+
+    #region  Utility
+
+    public interface IUtility
+    {
+
+    }
+
+    #endregion
+
+    #region  Command
+
+    public interface ICommand : ICanGetService, ICanGetModel, ICanGetUtility,
+                                ICanSendEvent, ICanSendCommand, ICanSendQuery
+    {
+        void OnExcute();
+    }
+    public interface ICommand<T> : ICanGetService, ICanGetModel, ICanGetUtility,
+                                   ICanSendEvent, ICanSendCommand, ICanSendQuery
+    {
+        T OnExcute();
+    }
+
+    public interface ICommandHandler
+    {
+        void ExcuteCommand(ICommand command);
+        void ExcuteCommand<T>() where T : ICommand, new();
+        T ExcuteCommand<T>(ICommand<T> command);
+    }
+
+    public class DefaultCommandHandler : ICommandHandler
+    {
+        public void ExcuteCommand(ICommand command)
+        {
+            command.OnExcute();
+        }
+
+        public void ExcuteCommand<T>() where T : ICommand, new()
+        {
+            ExcuteCommand(new T());
+        }
+
+        public T ExcuteCommand<T>(ICommand<T> command)
+        {
+            return command.OnExcute();
+        }
+    }
+
+    #endregion
+
+    #region  Query
+
+    public interface IQuery<T> : ICanGetModel, ICanGetService, ICanSendQuery
+    {
+        T DoQuery();
+    }
+    public interface IQueryAsync : ICanGetModel, ICanGetService, ICanSendQuery
+    {
+        void DoQueryAsync<T>(Action<T> onQueryCompleted);
+    }
+    public interface IQueryResult<T>
+    {
+        void OnQuerySucceed(Action<T> onQuerySucceed);
+        void OnQueryFailed(Action onQueryFailed);
+    }
+    public interface IQueryHandler
+    {
+        T DoQuery<T>(IQuery<T> query);
+        K DoQuery<T, K>() where T : IQuery<K>, new();
+
+        IQueryResult<T> DoQueryAsync<T>(IQuery<T> query);
+        IQueryResult<K> DoQueryAsync<T, K>() where T : IQuery<K>, new();
+    }
+
+    public class DefaultQueryHandler : IQueryHandler
+    {
+        public T DoQuery<T>(IQuery<T> query)
+        {
+            return query.DoQuery();
+        }
+
+        public K DoQuery<T, K>() where T : IQuery<K>, new()
+        {
+            return DoQuery(new T());
+        }
+
+        public IQueryResult<T> DoQueryAsync<T>(IQuery<T> query)
+        {
+            DefaultQueryResult<T> queryResult = new DefaultQueryResult<T>();
+            var queryTask = Task.Run(() =>
+            {
+                return query.DoQuery();
+            });
+            var awaiter = queryTask.GetAwaiter();
+            awaiter.OnCompleted(() =>
+            {
+                if (queryTask.IsFaulted | queryTask.IsCanceled)
+                {
+                    queryResult.TriggerFailed();
+                }
+                else
+                {
+                    queryResult.TriggerSuccess(awaiter.GetResult());
+                }
+            });
+            return queryResult;
+        }
+
+        public IQueryResult<K> DoQueryAsync<T, K>() where T : IQuery<K>, new()
+        {
+            return DoQueryAsync(new T());
+        }
+    }
+
+    public class DefaultQueryResult<T> : IQueryResult<T>
+    {
+        private Action<T> mOnQuerySucceed;
+        private Action mOnQueryFailed;
+
+        public void OnQuerySucceed(Action<T> onQuerySucceed)
+        {
+            mOnQuerySucceed += onQuerySucceed;
+        }
+        public void OnQueryFailed(Action onQueryFailed)
+        {
+            mOnQueryFailed += onQueryFailed;
+        }
+        public void TriggerSuccess(T result)
+        {
+            mOnQuerySucceed?.Invoke(result);
+        }
+        public void TriggerFailed()
+        {
+            mOnQueryFailed?.Invoke();
+        }
+    }
+    #endregion
+
+    #region Rule
+
+    /// <summary>
+    /// 能够 GetModel 的接口
+    /// </summary>
+    public interface ICanGetModel
+    {
+    }
+
+    /// <summary>
+    /// ICanGetModel 的静态扩展 GetModel
+    /// </summary>
+    public static class CanGetModelExtension
+    {
+        public static T GetModel<T>(this ICanGetModel self) where T : class, IModel
+        {
+            return _architecture.GetModel<T>();
+        }
+
+        private static IArchitecture _architecture;
+        public static void SetArchitecture(IArchitecture architecture)
+        {
+            _architecture = architecture;
+        }
+    }
+    /// <summary>
+    /// 能够 GetService 的接口
+    /// </summary>
+    public interface ICanGetService
+    {
+    }
+
+    /// <summary>
+    /// ICanGetService 的静态扩展 GetService
+    /// </summary>
+    public static class CanGetServiceExtension
+    {
+        public static T GetService<T>(this ICanGetService self) where T : class, IService
+        {
+            return _architecture.GetService<T>();
+        }
+
+        private static IArchitecture _architecture;
+        public static void SetArchitecture(IArchitecture architecture)
+        {
+            _architecture = architecture;
+        }
+    }
+
+    /// <summary>
+    /// 能够 GetUtility 的接口
+    /// </summary>
+    public interface ICanGetUtility
+    {
+    }
+
+    /// <summary>
+    /// ICanGetUtility 的静态扩展 GetUtility
+    /// </summary>
+    public static class CanGetUtilityExtension
+    {
+        public static T GetUtility<T>(this ICanGetUtility self) where T : class, IUtility
+        {
+            return _architecture.GetUtility<T>();
+        }
+
+        private static IArchitecture _architecture;
+        public static void SetArchitecture(IArchitecture architecture)
+        {
+            _architecture = architecture;
+        }
+    }
+
+    /// <summary>
+    /// 能够 RegisterEvent 的接口
+    /// </summary>
+    public interface ICanRegisterEvent
+    {
+    }
+
+    /// <summary>
+    /// ICanRegisterEvent 的静态扩展 RegisterEvent
+    /// </summary>
+    public static class CanRegisterEventExtension
+    {
+        public static IUnRegister RegisterEvent<T>(this ICanRegisterEvent self, Action<T> onEvent) where T : IEvent
+        {
+            return typeEventSystem.Register<T>(onEvent);
+        }
+
+        public static void UnRegisterEvent<T>(this ICanRegisterEvent self, Action<T> onEvent) where T : IEvent
+        {
+            typeEventSystem.UnRegister<T>(onEvent);
+        }
+
+        private static ITypeEventSystem typeEventSystem;
+        public static void SetTypeEventSystem(ITypeEventSystem mTypeEventSystem)
+        {
+            typeEventSystem = mTypeEventSystem;
+        }
+    }
+
+    /// <summary>
+    /// 能够 SendCommand 的接口
+    /// </summary>
+    public interface ICanSendCommand
+    {
+    }
+
+    /// <summary>
+    /// ICanSendCommand 的静态扩展 SendCommand
+    /// </summary>
+    public static class CanSendCommandExtension
+    {
+        public static void SendCommand<T>(this ICanSendCommand self) where T : ICommand, new()
+        {
+            mCommandHandler.ExcuteCommand<T>();
+        }
+
+        public static void SendCommand<T>(this ICanSendCommand self, T command) where T : ICommand
+        {
+            mCommandHandler.ExcuteCommand(command);
+        }
+
+        public static T SendCommand<T>(this ICanSendCommand self, ICommand<T> command)
+        {
+            return mCommandHandler.ExcuteCommand(command);
+        }
+
+        private static ICommandHandler mCommandHandler;
+        public static void SetCommandHandler(ICommandHandler commandHandler)
+        {
+            mCommandHandler = commandHandler;
+        }
+    }
+
+    /// <summary>
+    /// 能够 SendEvent 的接口
+    /// </summary>
+    public interface ICanSendEvent
+    {
+    }
+
+    /// <summary>
+    /// ICanSendEvent 的静态扩展 SendEvent
+    /// </summary>
+    public static class CanSendEventExtension
+    {
+        public static void SendEvent<T>(this ICanSendEvent self) where T : IEvent, new()
+        {
+            typeEventSystem.Send<T>();
+        }
+
+        public static void SendEvent<T>(this ICanSendEvent self, T e) where T : IEvent
+        {
+            typeEventSystem.Send<T>(e);
+        }
+
+        private static ITypeEventSystem typeEventSystem;
+        public static void SetTypeEventSystem(ITypeEventSystem mTypeEventSystem)
+        {
+            typeEventSystem = mTypeEventSystem;
+        }
+    }
+
+    /// <summary>
+    /// 能够 SendQuery 的接口
+    /// </summary>
+    public interface ICanSendQuery
+    {
+    }
+
+    /// <summary>
+    /// ICanSendQuery 的静态扩展 SendQuery
+    /// </summary>
+    public static class CanSendQueryExtension
+    {
+        public static T SendQuery<T>(this ICanSendQuery self, IQuery<T> queryInstance)
+        {
+            return _queryHandler.DoQuery<T>(queryInstance);
+        }
+        public static K SendQuery<T, K>(this ICanSendQuery self) where T : IQuery<K>, new()
+        {
+            return _queryHandler.DoQuery<T, K>();
+        }
+        public static IQueryResult<T> SendQueryAsync<T>(this ICanSendQuery self, IQuery<T> queryInstance)
+        {
+            return _queryHandler.DoQueryAsync<T>(queryInstance);
+        }
+        public static IQueryResult<K> SendQueryAsync<T, K>(this ICanSendQuery self) where T : IQuery<K>, new()
+        {
+            return _queryHandler.DoQueryAsync<T, K>();
+        }
+        private static IQueryHandler _queryHandler;
+        public static void SetQueryHandler(IQueryHandler queryHandler)
+        {
+            _queryHandler = queryHandler;
+        }
+    }
+
+    #endregion
+
+    #region  TypeEventSystem
+
+    /// <summary>
+    /// 取消监听接口
+    /// </summary>
+    public interface IUnRegister
+    {
+        void UnRegister();
+    }
+
+    /// <summary>
+    /// 取消监听列表接口
+    /// </summary>
+    public interface IUnRegisterList
+    {
+        List<IUnRegister> UnRegistersList { get; }
+    }
+
+    /// <summary>
+    /// 取消监听列表接口的静态扩展
+    /// 【IUnRegister 添加进 IUnRegisterList】
+    /// 【IUnRegisterList全部取消监听】
+    /// </summary>
+    public static class IUnRegisterListExtension
+    {
+        public static void AddToUnRegisterList(this IUnRegister self, IUnRegisterList unRegisterList)
+        {
+            unRegisterList.UnRegistersList.Add(self);
+        }
+
+        public static void UnRegisterAll(this IUnRegisterList self)
+        {
+            foreach (IUnRegister unRegister in self.UnRegistersList)
+            {
+                unRegister.UnRegister();
+            }
+            self.UnRegistersList.Clear();
+        }
+    }
+
+    /// <summary>
+    /// 取消监听的类
+    /// </summary>
+    public struct CustomUnRegister : IUnRegister
+    {
+        private Action mOnUnregister { get; set; }
+
+        public CustomUnRegister(Action onUnRegsiter)
+        {
+            mOnUnregister = onUnRegsiter;
+        }
+
+        public void UnRegister()
+        {
+            mOnUnregister?.Invoke();
+            mOnUnregister = null;
+        }
+    }
+
+    /// <summary>
+    /// 物体销毁时触发取消监听
+    /// </summary>
+    public class UnRegisterOnDestroyTrigger : MonoBehaviour
+    {
+        private readonly HashSet<IUnRegister> mUnRegisters = new HashSet<IUnRegister>();
+
+        public void AddUnRegister(IUnRegister unRegister)
+        {
+            mUnRegisters.Add(unRegister);
+        }
+
+        public void RemoveUnRegister(IUnRegister unRegister)
+        {
+            mUnRegisters.Remove(unRegister);
+        }
+
+        private void OnDestroy()
+        {
+            foreach (IUnRegister unRegister in mUnRegisters)
+            {
+                unRegister.UnRegister();
+            }
+            mUnRegisters.Clear();
+        }
+    }
+
+    /// <summary>
+    /// 取消监听的静态扩展
+    /// 【物体销毁时触发取消监听】
+    /// 【组件所属物体销毁时触发取消监听】
+    /// </summary>
+    public static class UnRegisterExtension
+    {
+        /// <summary>
+        /// 物体:物体销毁时触发取消监听
+        /// </summary>
+        /// <param name="unRegister">取消监听的接口</param>
+        /// <param name="component">物体对象</param>
+        /// <returns>取消监听的接口</returns>
+        public static IUnRegister UnRegisterWhenGameObjectDestroyed(this IUnRegister unRegister, GameObject go)
+        {
+            UnRegisterOnDestroyTrigger trigger = go.GetComponent<UnRegisterOnDestroyTrigger>();
+
+            if (!trigger)
+            {
+                trigger = go.AddComponent<UnRegisterOnDestroyTrigger>();
+            }
+
+            trigger.AddUnRegister(unRegister);
+
+            return unRegister;
+        }
+
+        /// <summary>
+        /// 组件:物体销毁时触发取消监听
+        /// </summary>
+        /// <param name="unRegister">取消监听的接口</param>
+        /// <param name="component">组件对象</param>
+        /// <returns>取消监听的接口</returns>
+        public static IUnRegister UnRegisterWhenGameObjectDestroyed<T>(this IUnRegister unRegister, T component) where T : Component
+        {
+            return unRegister.UnRegisterWhenGameObjectDestroyed(component.gameObject);
+        }
+    }
+
+    public interface ITypeEventSystem
+    {
+        IUnRegister Register<T>(Action<T> onEvent) where T: IEvent;
+        void UnRegister<T>(Action<T> onEvent) where T: IEvent;
+        void Send<T>() where T: IEvent, new();
+        void Send<T>(T e) where T: IEvent;
+    }
+    public class TypeEventSystem:ITypeEventSystem
+    {
+        private readonly EasyEvents mEvents = new EasyEvents();
+        public static readonly TypeEventSystem Global = new TypeEventSystem();
+
+        public void Send<T>() where T : IEvent,new()
+        {
+            mEvents.GetEvent<EasyEvent<T>>()?.Trigger(new T());
+        }
+
+        public void Send<T>(T e) where T: IEvent
+        {
+            mEvents.GetEvent<EasyEvent<T>>()?.Trigger(e);
+        }
+
+        public IUnRegister Register<T>(Action<T> onEvent)where T: IEvent
+        {
+            var e = mEvents.GetOrAddEvent<EasyEvent<T>>();
+            return e.Register(onEvent);
+        }
+
+        public void UnRegister<T>(Action<T> onEvent)where T: IEvent
+        {
+            var e = mEvents.GetEvent<EasyEvent<T>>();
+            if (e != null)
+            {
+                e.UnRegister(onEvent);
+            }
+        }
+    }
+
+    #endregion
+
+    #region  IOC
+
+    /// <summary>
+    /// IOC 容器 ,将类型对应的对象存储进字典
+    /// 【注册 + 获取】
+    /// </summary>
+    public class IOCContainer
+    {
+        private Dictionary<Type, object> mInstances = new Dictionary<Type, object>();
+
+        /// <summary>
+        /// IOC 容器注册方法
+        /// </summary>
+        /// <param name="instance">实例</param>
+        /// <typeparam name="T">指定类型</typeparam>
+        public void Register<T>(T instance)
+        {
+            Type key = typeof(T);
+
+            if (mInstances.ContainsKey(key))
+            {
+                mInstances[key] = instance;
+            }
+            else
+            {
+                mInstances.Add(key, instance);
+            }
+        }
+
+        /// <summary>
+        /// IOC 容器获取方法
+        /// </summary>
+        /// <typeparam name="T">指定类型</typeparam>
+        public T Get<T>() where T : class
+        {
+            Type key = typeof(T);
+
+            if (mInstances.TryGetValue(key, out object retInstance))
+            {
+                return retInstance as T;
+            }
+
+            return null;
+        }
+    }
+
+    #endregion
+
+    #region BindableProperty
+
+    public interface IReadonlyBindableProperty<T>
+    {
+        T Value { get; }
+
+        IUnRegister Register(Action<T> onValueChanged);
+        void UnRegister(Action<T> onValueChanged);
+        IUnRegister RegisterWithInitValue(Action<T> action);
+    }
+
+    public interface IBindableProperty<T> : IReadonlyBindableProperty<T>
+    {
+        new T Value { get; set; }
+        void SetValueWithoutEvent(T newValue);
+    }
+
+
+    public class BindableProperty<T> : IBindableProperty<T>
+    {
+        private Action<T> mOnValueChanged = (v) => { };
+
+        public BindableProperty(T defaultValue = default)
+        {
+            mValue = defaultValue;
+        }
+
+        protected T mValue;
+
+        public T Value
+        {
+            get => GetValue();
+            set
+            {
+                if (value == null && mValue == null) return;
+                if (value != null && value.Equals(mValue)) return;
+
+                SetValue(value);
+                mOnValueChanged?.Invoke(value);
+            }
+        }
+
+        protected virtual void SetValue(T newValue)
+        {
+            mValue = newValue;
+        }
+
+        protected virtual T GetValue()
+        {
+            return mValue;
+        }
+
+        public void SetValueWithoutEvent(T newValue)
+        {
+            mValue = newValue;
+        }
+
+
+        public IUnRegister Register(Action<T> onValueChanged)
+        {
+            mOnValueChanged += onValueChanged;
+            return new BindablePropertyUnRegister<T>()
+            {
+                BindableProperty = this,
+                OnValueChanged = onValueChanged
+            };
+        }
+
+        public IUnRegister RegisterWithInitValue(Action<T> onValueChanged)
+        {
+            onValueChanged(mValue);
+            return Register(onValueChanged);
+        }
+
+        public static implicit operator T(BindableProperty<T> property)
+        {
+            return property.Value;
+        }
+
+        public override string ToString()
+        {
+            return Value.ToString();
+        }
+
+        public void UnRegister(Action<T> onValueChanged)
+        {
+            mOnValueChanged -= onValueChanged;
+        }
+    }
+
+    public class BindablePropertyUnRegister<T> : IUnRegister
+    {
+        public BindableProperty<T> BindableProperty { get; set; }
+
+        public Action<T> OnValueChanged { get; set; }
+
+        public void UnRegister()
+        {
+            BindableProperty.UnRegister(OnValueChanged);
+
+            BindableProperty = null;
+            OnValueChanged = null;
+        }
+    }
+
+    #endregion
+
+    #region EasyEvent
+
+    public interface IEasyEvent
+    {
+
+    }
+
+    public class EasyEvent : IEasyEvent
+    {
+        private Action mOnEvent = () => { };
+
+        public IUnRegister Register(Action onEvent)
+        {
+            mOnEvent += onEvent;
+
+            return new CustomUnRegister(() =>
+            {
+                UnRegister(onEvent);
+            });
+        }
+
+        public void UnRegister(Action onEvent)
+        {
+            mOnEvent -= onEvent;
+        }
+
+        public void Trigger()
+        {
+            mOnEvent?.Invoke();
+        }
+    }
+
+    public class EasyEvent<T> : IEasyEvent
+    {
+        private Action<T> mOnEvent = e => { };
+
+        public IUnRegister Register(Action<T> onEvent)
+        {
+            mOnEvent += onEvent;
+
+            return new CustomUnRegister(() =>
+            {
+                UnRegister(onEvent);
+            });
+        }
+
+        public void UnRegister(Action<T> onEvent)
+        {
+            mOnEvent -= onEvent;
+        }
+
+        public void Trigger(T t)
+        {
+            mOnEvent?.Invoke(t);
+        }
+    }
+
+    public class EasyEvent<T, K> : IEasyEvent
+    {
+        private Action<T, K> mOnEvent = (t, k) => { };
+
+        public IUnRegister Register(Action<T, K> onEvent)
+        {
+            mOnEvent += onEvent;
+
+            return new CustomUnRegister(() =>
+            {
+                UnRegister(onEvent);
+            });
+        }
+
+        public void UnRegister(Action<T, K> onEvent)
+        {
+            mOnEvent -= onEvent;
+        }
+
+        public void Trigger(T t, K k)
+        {
+            mOnEvent?.Invoke(t, k);
+        }
+    }
+
+    public class EasyEvent<T, K, S> : IEasyEvent
+    {
+        private Action<T, K, S> mOnEvent = (t, k, s) => { };
+
+        public IUnRegister Register(Action<T, K, S> onEvent)
+        {
+            mOnEvent += onEvent;
+
+            return new CustomUnRegister(() =>
+            {
+                UnRegister(onEvent);
+            });
+        }
+
+        public void UnRegister(Action<T, K, S> onEvent)
+        {
+            mOnEvent -= onEvent;
+        }
+
+        public void Trigger(T t, K k, S s)
+        {
+            mOnEvent?.Invoke(t, k, s);
+        }
+    }
+
+    public class EasyEvents
+    {
+        private static EasyEvents mGlobalEvents = new EasyEvents();
+
+        public static T Get<T>() where T : IEasyEvent
+        {
+            return mGlobalEvents.GetEvent<T>();
+        }
+
+        public static void Register<T>() where T : IEasyEvent, new()
+        {
+            mGlobalEvents.AddEvent<T>();
+        }
+
+        private Dictionary<Type, IEasyEvent> mTypeEvents = new Dictionary<Type, IEasyEvent>();
+
+        public void AddEvent<T>() where T : IEasyEvent, new()
+        {
+            mTypeEvents.Add(typeof(T), new T());
+        }
+
+        public T GetEvent<T>() where T : IEasyEvent
+        {
+            if (mTypeEvents.TryGetValue(typeof(T), out IEasyEvent e))
+            {
+                return (T)e;
+            }
+
+            return default;
+        }
+
+        public T GetOrAddEvent<T>() where T : IEasyEvent, new()
+        {
+            var eType = typeof(T);
+            if (mTypeEvents.TryGetValue(eType, out var e))
+            {
+                return (T)e;
+            }
+
+            var t = new T();
+            mTypeEvents.Add(eType, t);
+            return t;
+        }
+    }
+    #endregion
+
+    #region Event
+
+    public interface IEvent
+    {
+
+    }
+    #endregion
+}

+ 1 - 1
Assets/Scripts/Blue/0.FrameworkDesign/Core/AbstractArchitecture.cs.meta → Assets/Scripts/Blue/0.FrameworkDesign/BlueVersion3.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 32afae3298447024aa4cfeb2e4c7f555
+guid: 5f2066e0b6b6ccb48aa96f0db5fb6205
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 0 - 7
Assets/Scripts/Blue/0.FrameworkDesign/Command/ICommand.cs

@@ -1,7 +0,0 @@
-namespace Blue
-{
-    public interface ICommand:ICanGetService,ICanGetModel,ICanGetUtility,ICanTriggerEvent,ICanSendCommand
-    {
-        void OnExcute();
-    }
-}

+ 0 - 8
Assets/Scripts/Blue/0.FrameworkDesign/Core.meta

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

+ 0 - 202
Assets/Scripts/Blue/0.FrameworkDesign/Core/AbstractArchitecture.cs

@@ -1,202 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Blue
-{
-    /// <summary>
-    /// Architecture抽象类,继承自IArchitecture
-    /// </summary>
-    public abstract class AbstractArchitecture<T>:IArchitecture where T:AbstractArchitecture<T>,new()
-    {
-        private static IArchitecture architectureInstance;
-        private List<IModel> modelList;
-        private List<IService> serviceList;
-        private IOCContainer modelContainer = new IOCContainer();
-        private IOCContainer serviceContainer=new IOCContainer();
-        private IOCContainer utilityContainer = new IOCContainer();
-        private ITypeEventSystem eventSystem=new DefaultTypeEventSystem();
-        private IQueryCommandHandler commandHandle=new QueryDefault_Hand();
-        private IQueryHandler queryHandler = new DefaultQueryHandler();
-
-        /// <summary>
-        /// 设置Architecture_Instance
-        /// </summary>
-        void IArchitecture.SetArchitectureInstance(IArchitecture instance)
-        {
-            architectureInstance = instance;
-            ICanGetModelExtension.SetArchitecture(architectureInstance);
-            ICanGetServiceExtension.SetArchitecture(architectureInstance);
-            ICanGetUtilityExtension.SetArchitecture(architectureInstance);
-            IArchitectureModuleExtension.SetArchitecture(architectureInstance);
-            ICanSendCommandExtension.SetCommandHandler(commandHandle);
-            ICanTriggerEventExtension.SetEventSystem(eventSystem);
-            ICanSubscribeEventExtension.SetEventSystem(eventSystem);
-            IChainEventUnSubcribeExtension.SetEventSystem(eventSystem);
-            ICanSendQueryExtension.SetQueryHandler(queryHandler);
-        }
-
-        /// <summary>
-        /// 注册
-        /// </summary>
-        void IArchitecture.Register()
-        {
-            modelList = new List<IModel>();
-            serviceList = new List<IService>();
-            OnInit();
-        }
-
-        /// <summary>
-        /// 初始化Architecture
-        /// </summary>
-        void IArchitecture.InitArchitecture()
-        {
-            InitModels();
-            InitServices();
-        }
-
-        /// <summary>
-        /// 完成初始化Architecture
-        /// </summary>
-        void IArchitecture.FinishInit()
-        {
-            modelList.Clear();
-            serviceList.Clear();
-            modelList = null;
-            serviceList = null;
-        }
-
-        /// <summary>
-        /// 初始化 Model 层
-        /// </summary>
-        private void InitModels()
-        {
-            foreach (var model in modelList)
-            {
-                model.OnInit();
-            }
-            /*modelList.Clear();
-            modelList = null;*/
-        }
-
-        /// <summary>
-        /// 初始化 Services 层
-        /// </summary>
-        private void InitServices()
-        {
-            foreach (var service in serviceList)
-            {
-                service.OnInit();
-            }
-            /*serviceList.Clear();
-            serviceList = null;*/
-        }
-
-        protected abstract void OnInit();
-
-        /// <summary>
-        /// 设置事件系统
-        /// </summary>
-        protected virtual void SetTypeEventSystem(ITypeEventSystem typeEventSystem)
-        {
-            eventSystem = typeEventSystem;
-        }
-
-        /// <summary>
-        /// 获取 Model
-        /// </summary>
-        public K GetModel<K>() where K:IModel
-        {
-            return modelContainer.Get<K>();
-        }
-
-        /// <summary>
-        /// 获取 Service
-        /// </summary>
-        public K GetService<K>() where K : IService
-        {
-            return serviceContainer.Get<K>();
-        }
-
-        /// <summary>
-        /// 获取 Utility
-        /// </summary>
-        public K GetUtility<K>() where K : IUtility
-        {
-            return utilityContainer.Get<K>();
-        }
-
-        /// <summary>
-        /// 获取 Model
-        /// </summary>
-        public object GetModel(Type type)
-        {
-            return modelContainer.Get(type);
-        }
-
-        /// <summary>
-        /// 获取 Service
-        /// </summary>
-        public object GetService(Type type)
-        {
-            return serviceContainer.Get(type);
-        }
-
-        /// <summary>
-        /// 获取 Utility
-        /// </summary>
-        public object GetUtility(Type type)
-        {
-            return utilityContainer.Get(type);
-        }
-
-        /// <summary>
-        /// 注册 Model
-        /// </summary>
-        public void RegisterModel<K>() where K :  IModel, new()
-        {
-            RegisterModel(new K());
-        }
-
-        /// <summary>
-        /// 注册 Service
-        /// </summary>
-        public void RegisterService<K>() where K : IService, new()
-        {
-            RegisterService(new K());
-        }
-
-        /// <summary>
-        /// 注册 Utility
-        /// </summary>
-        public void RegisterUtility<K>() where K : IUtility, new()
-        {
-            RegisterUtility(new K());
-        }
-
-        /// <summary>
-        /// 注册 Model
-        /// </summary>
-        public void RegisterModel<K>(K modelInstance) where K : IModel
-        {
-            modelContainer.Register(modelInstance);
-            modelList.Add(modelInstance);
-        }
-
-        /// <summary>
-        /// 注册 Service
-        /// </summary>
-        public void RegisterService<K>(K serviceInstance) where K : IService
-        {
-            serviceContainer.Register(serviceInstance);
-            serviceList.Add(serviceInstance);
-        }
-
-        /// <summary>
-        /// 注册 Utility
-        /// </summary>
-        public void RegisterUtility<K>(K utilityInstance) where K : IUtility
-        {
-            utilityContainer.Register(utilityInstance);
-        }
-    }
-}

+ 0 - 133
Assets/Scripts/Blue/0.FrameworkDesign/Core/ControllerAr.cs

@@ -1,133 +0,0 @@
-using System;
-using System.Reflection;
-using UnityEngine;
-using UnityEngine.Scripting;
-
-namespace Blue
-{
-    /// <summary>
-    /// 控制的Archi
-    /// </summary>
-    [Preserve]
-    internal sealed class ControllerAr
-    {
-        private ControllerAr() { }
-
-        private Type architectureType = typeof(IArchitecture);
-        private IArchitecture architectureInstance = null;
-        private IInjector mInjector;
-        private bool architectureInited = false;
-        //private bool
-        private static ControllerAr mInstance;
-        private ModuleInitiator moduleInitiator;
-
-        [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
-        private static void Initiate()
-        {
-            mInstance = new ControllerAr();
-            mInstance.CreateInjector();
-            mInstance.CreateModuleInitiator();
-            Type[] typeArr = Assembly.GetExecutingAssembly().GetTypes();
-            int typeLength = typeArr.Length;
-            for (int i = 0; i < typeLength; i++)
-            {
-                Type tmpType = typeArr[i];
-                if (!tmpType.IsInterface) 
-                {
-                    if (mInstance.IsArchitecture(tmpType))
-                    {
-                        mInstance.CreateArchitectureInstance(tmpType);
-                    }
-                    mInstance.PrepairModuleData(tmpType);
-                    mInstance.PrepairInjectionData(tmpType);
-                }
-            }
-            mInstance.RegisterArchitecture();
-            StartInject();
-            mInstance.InitArchitecture();
-            mInstance.FinishInit();
-        }
-        //[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
-        private static void StartInject() 
-        {
-            //Debug.Log("StartInject");
-            mInstance.Inject();
-            //mInstance.Clear();
-        }
-        private void Clear() 
-        {
-            mInjector.Dispose();
-            moduleInitiator.Dispose();
-            mInjector = null;
-            moduleInitiator = null;
-            mInstance = null;
-        }
-        private void Inject() 
-        {
-            mInjector.Inject(architectureInstance);
-        }
-        private void FinishInit()
-        {
-            architectureInstance.FinishInit();
-            mInstance.Clear();
-        }
-        private void RegisterArchitecture()
-        {
-            if (architectureInstance != null)
-            {
-                architectureInstance.SetArchitectureInstance(architectureInstance);
-                architectureInstance.Register();
-                InitModule();
-            }
-        }
-        private void InitArchitecture()
-        {
-            architectureInstance.InitArchitecture();
-        }
-        private void InitModule() 
-        {
-            moduleInitiator.InitModule();
-        }
-        private bool IsArchitecture(Type tmpType)
-        {
-            if (architectureInited) 
-            {
-                return false;
-            }
-            if (tmpType.IsAbstract)
-            {
-                return false;
-            }
-            return architectureType.IsAssignableFrom(tmpType);
-        }
-        private void PrepairModuleData(Type type) 
-        {
-            moduleInitiator.PrepairModuleData(type);
-        }
-
-        private void CreateArchitectureInstance(Type archiType)
-        {
-            if (architectureInstance == null)
-            {
-                architectureInstance = (IArchitecture)Activator.CreateInstance(archiType);
-                architectureInited = true;
-            }
-            else
-            {
-                throw new Exception("More than one Architecture sub-class in the application,it should be only one!");
-            }
-        }
-        private void PrepairInjectionData(Type type) 
-        {
-            mInjector.PrepairInjectionData(type);
-        }
-        private void CreateModuleInitiator() 
-        {
-            moduleInitiator=new ModuleInitiator();
-        }
-        private void CreateInjector() 
-        {
-            mInjector = new ArchitectureInjecter();
-        }
-    }
-}

+ 0 - 29
Assets/Scripts/Blue/0.FrameworkDesign/Core/IArchitecture.cs

@@ -1,29 +0,0 @@
-using System;
-using UnityEngine.Scripting;
-namespace Blue
-{
-    /// <summary>
-    /// Architecture 接口
-    /// </summary>
-    [RequireImplementors]
-    public interface IArchitecture
-    {
-        void SetArchitectureInstance(IArchitecture instance);
-        void Register();
-        void InitArchitecture();
-        void FinishInit();
-        T GetService<T>() where T : IService;
-        T GetModel<T>() where T : IModel;
-        T GetUtility<T>() where T : IUtility;
-        object GetService(Type type);
-        object GetModel(Type type);
-        object GetUtility(Type type);
-        void RegisterService<T>() where T : IService,new();
-        void RegisterModel<T>() where T : IModel,new();
-        void RegisterUtility<T>() where T : IUtility,new();
-
-        void RegisterModel<T>(T modelInstance) where T : IModel;
-        void RegisterService<T>(T serviceInstance) where T : IService;
-        void RegisterUtility<T>(T utilityInstance) where T : IUtility;
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Core/IArchitecture.cs.meta

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

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Core/IArchitectureModule.cs

@@ -1,11 +0,0 @@
-namespace Blue
-{
-    /// <summary>
-    /// 模块的基本接口
-    /// 所有模块都需要继承此接口并实现
-    /// </summary>
-    public interface IArchitectureModule
-    {
-        void OnInit();
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Core/IArchitectureModule.cs.meta

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

+ 0 - 36
Assets/Scripts/Blue/0.FrameworkDesign/Core/IArchitectureModuleExtension.cs

@@ -1,36 +0,0 @@
-namespace Blue
-{
-    public static class IArchitectureModuleExtension
-    {
-        private static IArchitecture _architecture;
-        public static void SetArchitecture(IArchitecture architecture)
-        {
-            _architecture = architecture;
-        }
-        public static void RegisterModel<T>(this IArchitectureModule self) where T : IModel, new()
-        {
-            _architecture.RegisterModel<T>();
-        }
-        public static void RegisterModel<T>(this IArchitectureModule self,T modelInstance) where T : IModel
-        {
-            _architecture.RegisterModel<T>(modelInstance);
-        }
-
-        public static void RegisterService<T>(this IArchitectureModule self) where T:IService,new()
-        {
-            _architecture.RegisterService<T>();
-        }
-        public static void RegisterService<T>(this IArchitectureModule self,T serviceInstance) where T : IService
-        {
-            _architecture.RegisterService<T>(serviceInstance);
-        }
-        public static void RegisterUtility<T>(this IArchitectureModule self) where T : IUtility, new()
-        {
-            _architecture.RegisterUtility<T>();
-        }
-        public static void RegisterUtility<T>(this IArchitectureModule self, T utilityInstance) where T : IUtility
-        {
-            _architecture.RegisterUtility<T>(utilityInstance);
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Core/IArchitectureModuleExtension.cs.meta

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

+ 0 - 6
Assets/Scripts/Blue/0.FrameworkDesign/Core/IAuto.cs

@@ -1,6 +0,0 @@
-namespace Blue
-{
-    public interface IAuto
-    {
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Core/IAuto.cs.meta

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

+ 0 - 9
Assets/Scripts/Blue/0.FrameworkDesign/Core/IController.cs

@@ -1,9 +0,0 @@
-namespace Blue
-{
-    /// <summary>
-    /// Controller 层接口
-    /// </summary>
-    public interface IController :IAuto,ICanGetService,ICanGetModel,ICanGetUtility,ICanSendCommand,ICanSubscribeEvent,ICanSendQuery
-    {
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Core/IController.cs.meta

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

+ 0 - 10
Assets/Scripts/Blue/0.FrameworkDesign/Core/IModel.cs

@@ -1,10 +0,0 @@
-namespace Blue
-{
-    /// <summary>
-    /// Model 层接口
-    /// </summary>
-    public interface IModel:IAuto,ICanGetUtility,ICanTriggerEvent
-    {
-        void OnInit();
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Core/IModel.cs.meta

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

+ 0 - 10
Assets/Scripts/Blue/0.FrameworkDesign/Core/IService.cs

@@ -1,10 +0,0 @@
-namespace Blue
-{
-    /// <summary>
-    /// Service 层接口
-    /// </summary>
-    public interface IService : IAuto,ICanGetService, ICanSendCommand,ICanGetModel, ICanGetUtility,ICanSubscribeEvent,ICanTriggerEvent,ICanSendQuery
-    {
-        void OnInit();
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Core/IService.cs.meta

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

+ 0 - 9
Assets/Scripts/Blue/0.FrameworkDesign/Core/IUtility.cs

@@ -1,9 +0,0 @@
-namespace Blue
-{
-    /// <summary>
-    /// Utility 层接口
-    /// </summary>
-    public interface IUtility:IAuto,ICanGetUtility
-    {
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Core/IUtility.cs.meta

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

+ 0 - 54
Assets/Scripts/Blue/0.FrameworkDesign/Core/ModuleInitiator.cs

@@ -1,54 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Blue
-{
-    public class ModuleInitiator:IDisposable
-    {
-        private Type moduleInterfaceType;
-        private List<Type> moduleList;
-        public ModuleInitiator() 
-        {
-            moduleInterfaceType = typeof(IArchitectureModule);
-            moduleList = new List<Type>();
-        }
-        public void PrepairModuleData(Type type) 
-        {
-            if (IsModule(type)) 
-            {
-                moduleList.Add(type);
-            }
-        }
-        public void InitModule() 
-        {
-            int moduleCount = moduleList.Count;
-            if (moduleCount == 0) 
-            {
-                return;
-            }
-            for (int i = 0; i < moduleCount; i++)
-            {
-                IArchitectureModule module =(IArchitectureModule)Activator.CreateInstance(moduleList[i]);
-                module.OnInit();
-            }
-        }
-
-        public void Dispose() 
-        {
-            moduleInterfaceType = null;
-            moduleList = null;
-        }
-        private bool IsModule(Type type)
-        {
-            if (type.IsInterface)
-            {
-                return false;
-            }
-            if (type.IsAbstract)
-            {
-                return false;
-            }
-            return moduleInterfaceType.IsAssignableFrom(type);
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Core/ModuleInitiator.cs.meta

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

BIN
Assets/Scripts/Blue/0.FrameworkDesign/Design.eddx


+ 0 - 8
Assets/Scripts/Blue/0.FrameworkDesign/Event.meta

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

+ 0 - 22
Assets/Scripts/Blue/0.FrameworkDesign/Event/BindablePropertyUnSubscribe.cs

@@ -1,22 +0,0 @@
-using System;
-namespace Blue
-{
-    public struct BindablePropertyUnSubscribe<T> : IUnSubscribe
-    {
-        private Action<T> _onPropertyChanged;
-        private BindableProperty<T> _property;
-
-        public BindablePropertyUnSubscribe(BindableProperty<T> property,Action<T> onPropertyChanged) 
-        {
-            _property = property;
-            _onPropertyChanged = onPropertyChanged;
-        }
-
-        public void UnSubscribe()
-        {
-            _property.UnSubscribe(_onPropertyChanged);
-            _property = null;
-            _onPropertyChanged = null;
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/BindablePropertyUnSubscribe.cs.meta

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

+ 0 - 41
Assets/Scripts/Blue/0.FrameworkDesign/Event/ChainEventSubscription.cs

@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-
-namespace Blue {
-    public class ChainEventSubscription : IChainEventSubscription
-    {
-        private Dictionary<Type, int> actionHashPool;
-        private Type mChainEventType;
-        public ChainEventSubscription(Type chainEventType)
-        {
-            mChainEventType = chainEventType;
-        }
-        public int SubscribeCount => actionHashPool.Count;
-
-        public IChainEventUnSubscribe Subscribe(Type eventType,int actionHashCode,Action onOnSubscribe)
-        {
-            actionHashPool.TryAdd(eventType, actionHashCode);
-            return new DefaultChainEventUnSubcribe(mChainEventType, () => { onOnSubscribe?.Invoke(); UnSubscribe(eventType); });
-        }
-        public bool IsSubscribed(Type eventType)
-        {
-            return actionHashPool.ContainsKey(eventType);
-        }
-        public int GetActionHashCode(Type eventType)
-        {
-            return actionHashPool[eventType];
-        }
-        public List<Type> GetEventTypeList()
-        {
-            List<Type> valueList = new List<Type>(actionHashPool.Count);
-            valueList.AddRange(actionHashPool.Keys);
-            return valueList;
-        }
-
-        public bool UnSubscribe(Type eventType)
-        {
-            return actionHashPool.Remove(eventType);
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/ChainEventSubscription.cs.meta

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

+ 0 - 27
Assets/Scripts/Blue/0.FrameworkDesign/Event/DefaultChainEventUnSubcribe.cs

@@ -1,27 +0,0 @@
-using System;
-namespace Blue
-{
-
-    public class DefaultChainEventUnSubcribe : IChainEventUnSubscribe
-    {
-        private Action mOnUnSub;
-        private Type mChainEventType;
-        public DefaultChainEventUnSubcribe(Type chainEventType,Action onUnSub)
-        {
-            mChainEventType = chainEventType;
-            mOnUnSub = onUnSub;
-        }
-
-        public Type GetChainEventType()
-        {
-            return mChainEventType;
-        }
-
-        public void UnSubscribe()
-        {
-            mOnUnSub?.Invoke();
-            mOnUnSub = null;
-            mChainEventType = null;
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/DefaultChainEventUnSubcribe.cs.meta

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

+ 0 - 160
Assets/Scripts/Blue/0.FrameworkDesign/Event/DefaultTypeEventSystem.cs

@@ -1,160 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Blue
-{
-    /// <summary>
-    /// 默认事件系统类,实现ITypeEventSystem
-    /// </summary>
-    public class DefaultTypeEventSystem : ITypeEventSystem
-    {
-        private Dictionary<Type, ISubscription> eventSubscriptionPool = new Dictionary<Type, ISubscription>(128);
-        private Dictionary<Type, IChainEventSubscription> chainEventPool = new Dictionary<Type, IChainEventSubscription>(8);
-        public IUnSubscribe SubscribeEvent<T>(Action<T> onEvent) where T : IEvent
-        {
-            Type t = typeof(T);
-            ISubscription subscription;
-            var adapter = new EventToActionAdapter(onEvent.GetHashCode(),(ievent) => { onEvent?.Invoke((T)ievent); });
-            if (!eventSubscriptionPool.TryGetValue(t, out subscription))
-            {
-                subscription = new TypeEventSubscription(t);
-                eventSubscriptionPool.Add(t, subscription);
-            }
-            return subscription.Subscribe(adapter);
-        }
-
-        public IChainEventUnSubscribe SubscribeChainEvent<T,K>(Action<K> onEvent) where T : IChainEvent where K:IEvent
-        {
-            Type chainEventType = typeof(T);
-            return SubscribeChainEvent(chainEventType,onEvent);
-        }
-        public IChainEventUnSubscribe SubscribeChainEvent<K>(Type chainEventType, Action<K> onEvent) where K : IEvent 
-        {
-            Type eventType = typeof(K);
-            IChainEventSubscription chainSubscription;
-            if (!chainEventPool.TryGetValue(chainEventType, out chainSubscription))
-            {
-                chainSubscription = new ChainEventSubscription(chainEventType);
-                chainEventPool.Add(chainEventType, chainSubscription);
-            }
-            if (chainSubscription.IsSubscribed(eventType))
-            {
-                UnSubscribeEvent(eventType, chainSubscription.GetActionHashCode(eventType));
-                chainSubscription.UnSubscribe(eventType);
-            }
-            ISubscription eventSubscription;
-            var adapter = new EventToActionAdapter(onEvent.GetHashCode(), (ievent) => { onEvent?.Invoke((K)ievent); });
-            if (!eventSubscriptionPool.TryGetValue(eventType, out eventSubscription))
-            {
-                eventSubscription = new TypeEventSubscription(eventType);
-                eventSubscriptionPool.Add(eventType, eventSubscription);
-            }
-            eventSubscription.Subscribe(adapter);
-            return chainSubscription.Subscribe(eventType, onEvent.GetHashCode(),()=> { eventSubscription.UnSubscribe(onEvent.GetHashCode()); });
-        }
-        public void TriggerEvent<T>() where T : IEvent, new()
-        {
-            TriggerEvent(new T());
-        }
-
-        public void TriggerEvent<T>(T e) where T : IEvent
-        {
-            if (eventSubscriptionPool.TryGetValue(e.GetType(), out ISubscription subscription))
-            {
-                subscription.TriggerEvent(e);
-            }
-        }
-
-        public void TriggerChainEvent<T>(params IEvent[] events) where T:IChainEvent
-        {
-            IChainEventSubscription chainSubscription;
-            Type chainEventType = typeof(T);
-            if (chainEventPool.TryGetValue(chainEventType, out chainSubscription))
-            {
-                Dictionary<Type, IEvent> eventInstanceMap = new Dictionary<Type, IEvent>(events.Length);
-                foreach (var mEvent in events)
-                {
-                    eventInstanceMap.TryAdd(mEvent.GetType(),mEvent);
-                }
-                List<Type> chainEventTypeList=chainSubscription.GetEventTypeList();
-                foreach (var eventType in chainEventTypeList)
-                {
-                    IEvent eventInstance;
-                    if (!eventInstanceMap.TryGetValue(eventType, out eventInstance))
-                    {
-                        eventInstance = (IEvent)Activator.CreateInstance(eventType);
-                    }
-                    TriggerEvent(eventInstance);
-                }
-            }
-        }
-        public void TriggerChainEvent<T>() where T : IChainEvent
-        {
-            IChainEventSubscription chainSubscription;
-            Type chainEventType = typeof(T);
-            if (chainEventPool.TryGetValue(chainEventType, out chainSubscription))
-            {
-                List<Type> chainEventTypeList = chainSubscription.GetEventTypeList();
-                foreach (var eventType in chainEventTypeList)
-                {
-                    TriggerEvent((IEvent)Activator.CreateInstance(eventType));
-                }
-            }
-        }
-
-        public void UnSubscribeEvent<T>(Action<T> onEvent) where T : IEvent
-        {
-            Type t = typeof(T);
-            UnSubscribeEvent(t, onEvent.GetHashCode());
-        }
-        public void UnSubscribeChainEvent<T>() where T:IChainEvent
-        {
-            Type chainEventType = typeof(T);
-            UnSubscribeChainEvent(chainEventType);
-        }
-        public void UnSubscribeChainEvent(Type chainEventType)
-        {
-            IChainEventSubscription chainSubscription;
-            if (chainEventPool.TryGetValue(chainEventType, out chainSubscription))
-            {
-                List<Type> chainEventTypeList= chainSubscription.GetEventTypeList();
-                foreach (var eventType in chainEventTypeList)
-                {
-                    UnSubscribeEvent(eventType,chainSubscription.GetActionHashCode(eventType));
-                    chainSubscription.UnSubscribe(eventType);
-                }
-                chainEventPool.Remove(chainEventType);
-            }
-        }
-        public void UnSubscribeEventFromChainEvent<T, K>() where T : IChainEvent where K : IEvent
-        {
-            IChainEventSubscription chainSubscription;
-            Type chainEventType = typeof(T);
-            if (chainEventPool.TryGetValue(chainEventType, out chainSubscription))
-            {
-                Type eventType = typeof(K);
-                if (chainSubscription.UnSubscribe(eventType))
-                {
-                    UnSubscribeEvent(eventType,chainSubscription.GetActionHashCode(eventType));
-                }
-                if (chainSubscription.SubscribeCount == 0)
-                {
-                    chainEventPool.Remove(chainEventType);
-                }
-            }
-        }
-        private bool UnSubscribeEvent(Type eventType, int hash)
-        {
-            bool result = false;
-            if (eventSubscriptionPool.TryGetValue(eventType, out ISubscription subscription))
-            {
-                result=subscription.UnSubscribe(hash);
-                if (subscription.SubscribeCount <= 0)
-                {
-                    eventSubscriptionPool.Remove(eventType);
-                }
-            }
-            return result;
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/DefaultTypeEventSystem.cs.meta

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

+ 0 - 49
Assets/Scripts/Blue/0.FrameworkDesign/Event/EventToActionAdapter.cs

@@ -1,49 +0,0 @@
-using System;
-namespace Blue
-{
-    /// <summary>
-    /// Event Action 适配
-    /// </summary>
-    public struct EventToActionAdapter
-    {
-        private Action<IEvent> mAdapterAction;
-        private int mHashCode;
-
-        /// <summary>
-        /// 初始化 hashCode ,Action
-        /// </summary>
-        /// <param name="hashCode"></param>
-        /// <param name="adapterAction"></param>
-        public EventToActionAdapter(int hashCode,Action<IEvent> adapterAction)
-        {
-            mHashCode = hashCode;
-            mAdapterAction = adapterAction;
-        }
-
-        /// <summary>
-        /// 获取适配的 Action
-        /// </summary>
-        /// <returns></returns>
-        public Action<IEvent> GetAdapterAction()
-        {
-            return mAdapterAction;
-        }
-
-        /// <summary>
-        /// 获取 Action 的 HashCode
-        /// </summary>
-        /// <returns></returns>
-        public int GetActionHashCode()
-        {
-            return mHashCode;
-        }
-
-        /// <summary>
-        /// 清除 Action
-        /// </summary>
-        public void Clear()
-        {
-            mAdapterAction = null;
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/EventToActionAdapter.cs.meta

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

+ 0 - 8
Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEvent.cs

@@ -1,8 +0,0 @@
-using System;
-namespace Blue
-{
-    public interface IChainEvent : IEvent
-    {
-        //IChainEvent NextEvent<T>(Action<T> onEvent) where T : IEvent;
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEvent.cs.meta

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

+ 0 - 18
Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEventSubscription.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Blue
-{
-	/// <summary>
-	/// 订阅链事件的接口
-	/// </summary>
-	public interface IChainEventSubscription
-	{
-		int SubscribeCount { get; }
-		IChainEventUnSubscribe Subscribe(Type eventType, int actionHashCode, Action onOnSubscribe);
-		List<Type> GetEventTypeList();
-		bool IsSubscribed(Type eventType);
-		int GetActionHashCode(Type eventType);
-		bool UnSubscribe(Type eventType);
-	}
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEventSubscription.cs.meta

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

+ 0 - 31
Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEventUnSubcribeExtension.cs

@@ -1,31 +0,0 @@
-using System;
-using UnityEngine;
-namespace Blue
-{
-    public static class IChainEventUnSubcribeExtension
-    {
-        private static ITypeEventSystem _typeEventSystem;
-        public static void SetEventSystem(ITypeEventSystem typeEventSystem) 
-        {
-            _typeEventSystem = typeEventSystem;
-        }
-        public static void UnSubscribeAllEventOnGameobjectDestroyed(this IChainEventUnSubscribe unSubscribe, GameObject gameObject)
-        {
-            var trigger = gameObject.GetComponent<UnSubscribeChainEventOnDestroyTrigger>();
-            if (!trigger)
-            {
-                trigger = gameObject.AddComponent<UnSubscribeChainEventOnDestroyTrigger>();
-            }
-            trigger.AddUnSubscribe(unSubscribe);
-        }
-        public static IChainEventUnSubscribe NextEvent<T>(this IChainEventUnSubscribe self,Action<T> onEvent) where T:IEvent
-        {
-            return _typeEventSystem.SubscribeChainEvent(self.GetChainEventType(),onEvent);
-        }
-
-        public static void UnSubscribeAllEventsOnChain(this IChainEventUnSubscribe self) 
-        {
-            _typeEventSystem.UnSubscribeChainEvent(self.GetChainEventType());
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEventUnSubcribeExtension.cs.meta

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

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEventUnSubscribe.cs

@@ -1,11 +0,0 @@
-using System;
-namespace Blue
-{
-    /// <summary>
-    /// 链事件取消订阅事件的接口
-    /// </summary>
-    public interface IChainEventUnSubscribe:IUnSubscribe
-    {
-        Type GetChainEventType();
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/IChainEventUnSubscribe.cs.meta

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

+ 0 - 6
Assets/Scripts/Blue/0.FrameworkDesign/Event/IEvent.cs

@@ -1,6 +0,0 @@
-namespace Blue
-{
-    public interface IEvent
-    {
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/IEvent.cs.meta

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

+ 0 - 13
Assets/Scripts/Blue/0.FrameworkDesign/Event/ISubscription.cs

@@ -1,13 +0,0 @@
-namespace Blue
-{
-    /// <summary>
-    /// 订阅事件的接口
-    /// </summary>
-    public interface ISubscription
-    {
-        int SubscribeCount { get; }
-        IUnSubscribe Subscribe(EventToActionAdapter adapter);
-        bool UnSubscribe(int hashCode);
-        void TriggerEvent(IEvent e);
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/ISubscription.cs.meta

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

+ 0 - 28
Assets/Scripts/Blue/0.FrameworkDesign/Event/ITypeEventSystem.cs

@@ -1,28 +0,0 @@
-using System;
-namespace Blue
-{
-    /// <summary>
-    /// 事件系统接口
-    /// ① 注册事件、注册链事件
-    /// ② 订阅事件、订阅链事件
-    /// ③ 取消订阅事件、取消订阅链事件
-    /// ④ 取消订阅链事件中的事件
-    /// </summary>
-    public interface ITypeEventSystem
-    {
-        void TriggerEvent<T>() where T : IEvent, new();
-        void TriggerEvent<T>(T e) where T : IEvent;
-        void TriggerChainEvent<T>(params IEvent[] events) where T : IChainEvent;
-        void TriggerChainEvent<T>() where T : IChainEvent;
-
-        IUnSubscribe SubscribeEvent<T>(Action<T> onEvent) where T : IEvent;
-        IChainEventUnSubscribe SubscribeChainEvent<T, K>(Action<K> onEvent) where T : IChainEvent where K : IEvent;
-        IChainEventUnSubscribe SubscribeChainEvent<K>(Type chainEventType,Action<K> onEvent) where K : IEvent;
-
-        void UnSubscribeEvent<T>(Action<T> onEvent) where T : IEvent;
-        void UnSubscribeChainEvent<T>() where T : IChainEvent;
-        void UnSubscribeChainEvent(Type chainEventType);
-
-        void UnSubscribeEventFromChainEvent<T, K>() where T : IChainEvent where K : IEvent;
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/ITypeEventSystem.cs.meta

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

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/IUnSubscribe.cs

@@ -1,11 +0,0 @@
-using System;
-namespace Blue
-{
-    /// <summary>
-    /// 取消订阅事件的接口
-    /// </summary>
-    public interface IUnSubscribe
-    {
-        void UnSubscribe();
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/IUnSubscribe.cs.meta

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

+ 0 - 26
Assets/Scripts/Blue/0.FrameworkDesign/Event/IUnSubscribeExtension.cs

@@ -1,26 +0,0 @@
-using UnityEngine;
-namespace Blue
-{
-    public static class IUnSubscribeExtension
-    {
-        public static void UnSubScribeWhenGameObjectDestroyed(this  IUnSubscribe unSubscribe,GameObject gameObject) 
-        {
-            var trigger= gameObject.GetComponent<UnSubscribeOnDestroyTrigger>();
-            if (!trigger) 
-            {
-                trigger = gameObject.AddComponent<UnSubscribeOnDestroyTrigger>();
-            }
-            trigger.AddUnSubscribe(unSubscribe);
-        }
-        public static void UnSubScribeWhenGameObjectDisabled(this IUnSubscribe unSubscribe, GameObject gameObject)
-        {
-            var trigger = gameObject.GetComponent<UnSubscribeOnDisableTrigger>();
-            if (!trigger)
-            {
-                trigger = gameObject.AddComponent<UnSubscribeOnDisableTrigger>();
-            }
-            trigger.AddUnSubscribe(unSubscribe);
-        }
-
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/IUnSubscribeExtension.cs.meta

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

+ 0 - 49
Assets/Scripts/Blue/0.FrameworkDesign/Event/TypeEventSubscription.cs

@@ -1,49 +0,0 @@
-using System;
-using System.Collections.Generic;
-namespace Blue
-{
-    public class TypeEventSubscription : ISubscription
-    {
-        private Action<IEvent> mOnEvent;
-        private int subscribeCount;
-        private Type mEventType;
-        private Dictionary<int, EventToActionAdapter> adapterPool = new Dictionary<int, EventToActionAdapter>();
-        public TypeEventSubscription(Type eventType) 
-        {
-            mEventType = eventType;
-        }
-        public int SubscribeCount { get => subscribeCount;}
-        public IUnSubscribe Subscribe(EventToActionAdapter adapter)
-        {
-            try
-            {
-                adapterPool.Add(adapter.GetActionHashCode(), adapter);
-                mOnEvent += adapter.GetAdapterAction();
-                subscribeCount++;
-                return new TypeEventSystemUnSubscribe(() => { UnSubscribe(adapter.GetActionHashCode()); });
-            }
-            catch (ArgumentException)
-            {
-                //LogUtil.LogError("Event subscription duplicated on "+mEventType+",please make sure you have unsubscribe it before re-subscribe!");
-                throw;
-            }
-        }
-        public void TriggerEvent(IEvent e)
-        {
-            mOnEvent?.Invoke(e);
-        }
-
-        public bool UnSubscribe(int hashCode)
-        {
-            if (adapterPool.TryGetValue(hashCode, out var adapter)) 
-            {
-                mOnEvent -= adapter.GetAdapterAction();
-                subscribeCount--;
-                adapter.Clear();
-                adapterPool.Remove(hashCode);
-                return true;
-            }
-            return false;
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/TypeEventSubscription.cs.meta

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

+ 0 - 19
Assets/Scripts/Blue/0.FrameworkDesign/Event/TypeEventSystemUnSubscribe.cs

@@ -1,19 +0,0 @@
-using System;
-
-namespace Blue
-{
-
-    public struct TypeEventSystemUnSubscribe : IUnSubscribe
-    {
-        private Action mOnUnSubscribe;
-        public TypeEventSystemUnSubscribe(Action onUnSubscribe) 
-        {
-            mOnUnSubscribe = onUnSubscribe;
-        }
-        public void UnSubscribe() 
-        {
-            mOnUnSubscribe?.Invoke();
-            mOnUnSubscribe = null;
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/TypeEventSystemUnSubscribe.cs.meta

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

+ 0 - 22
Assets/Scripts/Blue/0.FrameworkDesign/Event/UnSubscribeChainEventOnDestroyTrigger.cs

@@ -1,22 +0,0 @@
-using System.Collections.Generic;
-using UnityEngine;
-namespace Blue
-{
-    public class UnSubscribeChainEventOnDestroyTrigger : MonoBehaviour
-    {
-        private HashSet<IChainEventUnSubscribe> unSubscribes = new HashSet<IChainEventUnSubscribe>();
-
-        public void AddUnSubscribe(IChainEventUnSubscribe unSubscribe)
-        {
-            unSubscribes.Add(unSubscribe);
-        }
-        private void OnDestroy()
-        {
-            foreach (var item in unSubscribes)
-            {
-                item.UnSubscribeAllEventsOnChain();
-            }
-            unSubscribes.Clear();
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/UnSubscribeChainEventOnDestroyTrigger.cs.meta

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

+ 0 - 22
Assets/Scripts/Blue/0.FrameworkDesign/Event/UnSubscribeOnDestroyTrigger.cs

@@ -1,22 +0,0 @@
-using System.Collections.Generic;
-using UnityEngine;
-namespace Blue
-{
-    public class UnSubscribeOnDestroyTrigger : MonoBehaviour
-    {
-        private HashSet<IUnSubscribe> unSubscribes = new HashSet<IUnSubscribe>();
-
-        public void AddUnSubscribe(IUnSubscribe unSubscribe) 
-        {
-            unSubscribes.Add(unSubscribe);
-        }
-        private void OnDestroy()
-        {
-            foreach (var item in unSubscribes)
-            {
-                item.UnSubscribe();
-            }
-            unSubscribes.Clear();
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/UnSubscribeOnDestroyTrigger.cs.meta

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

+ 0 - 22
Assets/Scripts/Blue/0.FrameworkDesign/Event/UnSubscribeOnDisableTrigger.cs

@@ -1,22 +0,0 @@
-using System.Collections.Generic;
-using UnityEngine;
-namespace Blue
-{
-    public class UnSubscribeOnDisableTrigger : MonoBehaviour
-    {
-        private HashSet<IUnSubscribe> unSubscribes = new HashSet<IUnSubscribe>();
-
-        public void AddUnSubscribe(IUnSubscribe unSubscribe) 
-        {
-            unSubscribes.Add(unSubscribe);
-        }
-        private void OnDisable()
-        {
-            foreach (var item in unSubscribes)
-            {
-                item.UnSubscribe();
-            }
-            unSubscribes.Clear();
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Event/UnSubscribeOnDisableTrigger.cs.meta

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

+ 0 - 8
Assets/Scripts/Blue/0.FrameworkDesign/Hand.meta

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

+ 0 - 8
Assets/Scripts/Blue/0.FrameworkDesign/Hand/IQueryCommandHandler.cs

@@ -1,8 +0,0 @@
-namespace Blue
-{
-    public interface IQueryCommandHandler
-    {
-        void ExcuteQueryCommand(ICommand command);
-        void ExcuteQueryCommand<T>() where T:ICommand,new();
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Hand/IQueryCommandHandler.cs.meta

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

+ 0 - 15
Assets/Scripts/Blue/0.FrameworkDesign/Hand/QueryDefault_Hand.cs

@@ -1,15 +0,0 @@
-namespace Blue
-{
-    public class QueryDefault_Hand : IQueryCommandHandler
-    {
-        public void ExcuteQueryCommand(ICommand command)
-        {
-            command.OnExcute();
-        }
-
-        public void ExcuteQueryCommand<T>() where T : ICommand, new()
-        {
-            ExcuteQueryCommand(new T());
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/Hand/QueryDefault_Hand.cs.meta

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

+ 0 - 8
Assets/Scripts/Blue/0.FrameworkDesign/IOC.meta

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

+ 0 - 236
Assets/Scripts/Blue/0.FrameworkDesign/IOC/AbstractArchitectureComponentInjector.cs

@@ -1,236 +0,0 @@
-using System;
-using System.Reflection;
-using System.Collections.Generic;
-
-namespace Blue
-{
-    public abstract class AbstractArchitectureComponentInjector : IArchitectureComponentInjector
-    {
-        private Type mComponentType;
-        private bool canInjectTypeListNotInitiated=true;
-        private List<Type> canInjectTypeList;
-        private Dictionary<Type, List<InjectInfo>> injectionMap;
-        protected IArchitecture architectureInstance;
-
-        public AbstractArchitectureComponentInjector(Type componentType)
-        {
-            SetComponentType(componentType);
-        }
-        public void SetArchitecture(IArchitecture architecture)
-        {
-            if (architectureInstance == null)
-            {
-                architectureInstance = architecture;
-            }
-        }
-        private void SetComponentType(Type componentType)
-        {
-            mComponentType = componentType;
-        }
-
-        public virtual void PrepairInjectionData(Type baseType)
-        {
-            if (canInjectTypeListNotInitiated)
-            {
-                canInjectTypeListNotInitiated = false;
-                injectionMap = new Dictionary<Type, List<InjectInfo>>();
-                canInjectTypeList = GetCanInjectTypeList(mComponentType);
-            }
-            FilterInjectInfoList(GetInjectInfo(baseType), mComponentType);
-        }
-        public virtual void Inject(IArchitecture architecture)
-        {
-            if (injectionMap == null)
-            {
-                return;
-            }
-            SetArchitecture(architecture);
-            int injectionCount = injectionMap.Count;
-            List<Type> types = new List<Type>(injectionCount);
-            types.AddRange(injectionMap.Keys);
-            if (injectionCount > 0)
-            {
-                for (int i = 0; i < injectionCount; i++)
-                {
-                    Type baseType = types[i];
-                    object injectObject = GetInjectObject(baseType);
-                    if (injectObject == null)
-                    {
-                        continue;
-                        //throw new Exception("Can not find instance of "+baseType.FullName+" ,please make sure you have registed it.");
-                    }
-                    if (!injectObject.GetType().Equals(baseType))
-                    {
-                        continue;//Not the registed Type
-                    }
-                    List<InjectInfo> typeInjectInfoList = injectionMap[baseType];
-                    foreach (InjectInfo injectInfo in typeInjectInfoList)
-                    {
-                        if (injectInfo.InjectScope == InjectScope.Prototype)
-                        {
-                            InjectPrototype(injectObject, injectInfo.InjectField, injectInfo.InjectType);
-                        }
-                        else
-                        {
-                            object injectInstance = GetInjectInstance(injectInfo.InjectType);
-                            InjectSingleton(injectObject, injectInfo.InjectField, injectInstance);
-                        }
-                    }
-                }
-            }
-        }
-        public void Dispose()
-        {
-            if (canInjectTypeList != null)
-            {
-                canInjectTypeList.Clear();
-                canInjectTypeList = null;
-            }
-            if (injectionMap != null)
-            {
-                injectionMap.Clear();
-                injectionMap = null;
-            }
-            mComponentType = null;
-            architectureInstance = null;
-        }
-        protected virtual object GetInjectObject(Type baseType)
-        {
-            return null;
-        }
-        protected virtual object GetInjectInstance(Type injectType)
-        {
-            if (TypeChecker.Instance.IsService(injectType))
-            {
-                return architectureInstance.GetService(injectType);
-            }
-            if (TypeChecker.Instance.IsModel(injectType))
-            {
-                return architectureInstance.GetModel(injectType);
-            }
-            if (TypeChecker.Instance.IsUtility(injectType))
-            {
-                return architectureInstance.GetUtility(injectType);
-            }
-            throw new Exception(injectType.FullName+" is not a can inject type!");
-        }
-        protected Dictionary<Type, List<InjectInfo>> GetInjectionMap()
-        {
-            return injectionMap;
-        }
-        protected void InjectSingleton(object injectObject, FieldInfo fieldInfo, object injectInstance)
-        {
-            fieldInfo.SetValue(injectObject, injectInstance);
-        }
-        protected void InjectPrototype(object injectObject, FieldInfo fieldInfo, Type injectType)
-        {
-            fieldInfo.SetValue(injectObject, Activator.CreateInstance(injectType));
-        }
-
-        private List<Type> GetCanInjectTypeList(Type baseType)
-        {
-            List<Type> canInjectTypeList = new List<Type>();
-            Type[] interfaceArr = baseType.GetInterfaces();
-            for (int i = 0; i < interfaceArr.Length; i++)
-            {
-                Type interfaceType = interfaceArr[i];
-                InjectRuleAttribute attribute = null;
-                if ((attribute = interfaceType.GetCustomAttribute<InjectRuleAttribute>()) != null)
-                {
-                    canInjectTypeList.AddRange(attribute.GetCanInjectList());
-                }
-            }
-            return canInjectTypeList;
-        }
-        private List<InjectInfo> GetInjectInfo(Type tmpType)
-        {
-            List<InjectInfo> injectInfoList = new List<InjectInfo>();
-            FieldInfo[] tmpFieldArr = tmpType.GetFields(BindingFlags.Instance | BindingFlags.NonPublic);
-            int length = 0;
-            if (tmpFieldArr != null)
-            {
-                length = tmpFieldArr.Length;
-            }
-            for (int i = 0; i < length; i++)
-            {
-                FieldInfo tmpField = tmpFieldArr[i];
-                AutoAttribute autoInjectAttribute = tmpField.GetCustomAttribute<AutoAttribute>();
-                if (autoInjectAttribute != null)
-                {
-                    InjectInfo injectInfo = new InjectInfo()
-                    {
-                        BaseType = tmpType,
-                        InjectField = tmpField,
-                        InjectScope = autoInjectAttribute.GetInjectScope()
-                    };
-                    if (autoInjectAttribute.GetInjectType() != null)
-                    {
-                        if (CheckType(tmpField.FieldType, autoInjectAttribute.GetInjectType()))
-                        {
-                            injectInfo.InjectType = autoInjectAttribute.GetInjectType();
-                        }
-                        else
-                        {
-                            throw new Exception("Can not finish the injection of:" + tmpType.FullName + ": property: " + tmpField.Name + ", please check the injectType!");
-                        }
-                    }
-                    else
-                    {
-                        injectInfo.InjectType = tmpField.FieldType;
-                    }
-                    injectInfoList.Add(injectInfo);
-                }
-            }
-            return injectInfoList;
-        }
-        //if the injectinfo not match the inject rule,than remove it from the injectInfoList
-        //for example,you can not  inject a IService instance in a IMolde implementation class 
-        private void FilterInjectInfoList(List<InjectInfo> injectInfoList, Type type)
-        {
-            int count = injectInfoList.Count;
-            for (int i = 0; i < count; i++)
-            {
-                InjectInfo injectInfo = injectInfoList[i];
-                if (CheckIfCanInject(canInjectTypeList, injectInfo.InjectType))
-                {
-                    if (injectionMap.ContainsKey(injectInfo.BaseType))
-                    {
-                        injectionMap[injectInfo.BaseType].Add(injectInfo);
-                    }
-                    else
-                    {
-                        List<InjectInfo> typeInjectInfoList = new List<InjectInfo>();
-                        typeInjectInfoList.Add(injectInfo);
-                        injectionMap.Add(injectInfo.BaseType, typeInjectInfoList);
-                    }
-                }
-            }
-        }
-        //check if the fieldType and injectType is mismatch;
-        private bool CheckType(Type fieldType, Type injectType)
-        {
-            if (injectType.Equals(fieldType))
-            {
-                return true;
-            }
-            if (fieldType.IsInterface)
-            {
-                return fieldType.IsAssignableFrom(injectType);
-            }
-            return injectType.IsSubclassOf(fieldType);
-        }
-        private bool CheckIfCanInject(List<Type> canInjectTypeList, Type injectType)
-        {
-            bool result = false;
-            foreach (var canInjectType in canInjectTypeList)
-            {
-                if (canInjectType.IsAssignableFrom(injectType))
-                {
-                    result = true;
-                    break;
-                }
-            }
-            return result;
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/IOC/AbstractArchitectureComponentInjector.cs.meta

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

+ 0 - 132
Assets/Scripts/Blue/0.FrameworkDesign/IOC/ArchitectureInjecter.cs

@@ -1,132 +0,0 @@
-using System.Diagnostics;
-using System.Linq.Expressions;
-using System;
-
-namespace Blue
-{
-    /// <summary>
-    /// Architecture注入类
-    /// 主要负责四层 Controller、Model、Service、Utility的分别注入
-    /// </summary>
-    public class ArchitectureInjecter:IInjector
-    {
-        private IArchitectureComponentInjector controllerInjector;
-        private IArchitectureComponentInjector serviceInjector;
-        private IArchitectureComponentInjector modelInjector;
-        private IArchitectureComponentInjector utilityInjector;
-
-        /// <summary>
-        /// ArchitectureInjecter初始化
-        /// 主要初始化四层 Controller、Model、Service、Utility的注入
-        /// </summary>
-        public ArchitectureInjecter()
-        {
-            controllerInjector = new ControllerInjector();
-            serviceInjector = new ServiceInjector();
-            modelInjector = new ModelInjector();
-            utilityInjector = new UtilityInjector();
-        }
-
-        public void PrepairInjectionData(Type processtype)
-        {
-            PrepairInjectionDataImpl(processtype);
-        }
-
-        /// <summary>
-        /// 根据传入的类型注入到指定的层注入
-        /// </summary>
-        /// <param name="baseType">传入的类型</param>
-        private void PrepairInjectionDataImpl(Type baseType)
-        {
-            if (!TypeChecker.Instance.IsCanInject(baseType))
-            {
-                return;
-            }
-
-            if (TypeChecker.Instance.IsController(baseType))
-            {
-                PrepairControllerInjectionData(baseType);
-            }
-            if (TypeChecker.Instance.IsService(baseType))
-            {
-                PrepairServiceInjectionData(baseType);
-            }
-            if (TypeChecker.Instance.IsModel(baseType))
-            {
-                PrepairModelInjectionData(baseType);
-            }
-            if (TypeChecker.Instance.IsUtility(baseType))
-            {
-                PrepairUtilityInjectionData(baseType);
-            }
-        }
-
-        /// <summary>
-        /// 设置 Architecture
-        /// Controller、Model、Service、Utility注入分别设置architecture
-        /// </summary>
-        public void Inject(IArchitecture architecture)
-        {
-            InjectImpl(architecture);
-        }
-
-        /// <summary>
-        /// 执行与释放或重置非托管资源相关的应用程序定义的任务
-        /// </summary>
-        public void Dispose()
-        {
-            controllerInjector.Dispose();
-            serviceInjector.Dispose();
-            modelInjector.Dispose();
-            utilityInjector.Dispose();
-            controllerInjector = null;
-            serviceInjector = null;
-            modelInjector = null;
-            utilityInjector = null;
-        }
-
-        /// <summary>
-        /// Controller、Model、Service、Utility注入设置architecture
-        /// </summary>
-        /// <param name="architecture"></param>
-        private void InjectImpl(IArchitecture architecture)
-        {
-            controllerInjector.Inject(architecture);
-            serviceInjector.Inject(architecture);
-            modelInjector.Inject(architecture);
-            utilityInjector.Inject(architecture);
-        }
-
-        /// <summary>
-        /// 预注入Controller数据
-        /// </summary>
-        private void PrepairControllerInjectionData(Type baseType)
-        {
-            controllerInjector.PrepairInjectionData(baseType);
-        }
-
-        /// <summary>
-        /// 预注入Model数据
-        /// </summary>
-        private void PrepairModelInjectionData(Type baseType)
-        {
-            modelInjector.PrepairInjectionData(baseType);
-        }
-
-        /// <summary>
-        /// 预注入Service数据
-        /// </summary>
-        private void PrepairServiceInjectionData(Type baseType)
-        {
-            serviceInjector.PrepairInjectionData(baseType);
-        }
-
-        /// <summary>
-        /// 预注入Utility数据
-        /// </summary>
-        private void PrepairUtilityInjectionData(Type baseType)
-        {
-            utilityInjector.PrepairInjectionData(baseType);
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/IOC/ArchitectureInjecter.cs.meta

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

+ 0 - 36
Assets/Scripts/Blue/0.FrameworkDesign/IOC/AutoAttribute.cs

@@ -1,36 +0,0 @@
-using System;
-
-namespace Blue
-{
-    /// <summary>
-    /// 自动化
-    /// </summary>
-    [AttributeUsage(AttributeTargets.Field)]
-    public class AutoAttribute : Attribute
-    {
-        private Type type;
-        private InjectScope scope;
-        public AutoAttribute()
-        {
-            scope = InjectScope.Singleton;
-        }
-        public AutoAttribute(Type injectType):base()
-        {
-            type = injectType;
-        }
-        public AutoAttribute(Type injectType, InjectScope injectScope)
-        {
-            type = injectType;
-            scope = injectScope;
-        }
-        public Type GetInjectType()
-        {
-            return type;
-        }
-        public InjectScope GetInjectScope()
-        {
-            return scope;
-        }
-
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/IOC/AutoAttribute.cs.meta

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

+ 0 - 54
Assets/Scripts/Blue/0.FrameworkDesign/IOC/ControllerInjector.cs

@@ -1,54 +0,0 @@
-using System;
-using System.Collections.Generic;
-using UnityEngine;
-namespace Blue
-{
-
-    public class ControllerInjector : AbstractArchitectureComponentInjector
-    {
-        public ControllerInjector():base(typeof(IController))
-        {
-        }
-        private  object[] GetInjectObjects(Type baseType)
-        {
-            return GameObject.FindObjectsOfType(baseType, true);
-        }
-        public override void Inject(IArchitecture architecture)
-        {
-            SetArchitecture(architecture);
-            Dictionary<Type, List<InjectInfo>> injectionMap = GetInjectionMap();
-            if (injectionMap == null)
-            {
-                return;
-            }
-            int injectionCount = injectionMap.Count;
-            var types = injectionMap.Keys;
-            if (injectionCount > 0)
-            {
-                foreach (Type baseType in types)
-                {
-                    object[] injectObjects = GetInjectObjects(baseType);
-                    List<InjectInfo> typeInjectInfoList = injectionMap[baseType];
-                    foreach (InjectInfo injectInfo in typeInjectInfoList)
-                    {
-                        if (injectInfo.InjectScope == InjectScope.Prototype)
-                        {
-                            for (int i = 0; i < injectObjects.Length; i++)
-                            {
-                                InjectPrototype(injectObjects[i], injectInfo.InjectField, injectInfo.InjectType);
-                            }
-                        }
-                        else
-                        {
-                            object injectInstance = GetInjectInstance(injectInfo.InjectType);
-                            for (int i = 0; i < injectObjects.Length; i++)
-                            {
-                                InjectSingleton(injectObjects[i], injectInfo.InjectField, injectInstance);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/IOC/ControllerInjector.cs.meta

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

+ 0 - 19
Assets/Scripts/Blue/0.FrameworkDesign/IOC/IArchitectureComponentInjector.cs

@@ -1,19 +0,0 @@
-using System;
-namespace Blue
-{
-    /// <summary>
-    /// 实现Architecture组件注入的接口
-    /// </summary>
-    public interface IArchitectureComponentInjector:IDisposable
-    {
-        /// <summary>
-        /// 根据类型预注入数据
-        /// </summary>
-        void PrepairInjectionData(Type baseType);
-
-        /// <summary>
-        /// architecture注入
-        /// </summary>
-        void Inject(IArchitecture architecture);
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/IOC/IArchitectureComponentInjector.cs.meta

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

+ 0 - 19
Assets/Scripts/Blue/0.FrameworkDesign/IOC/IInjector.cs

@@ -1,19 +0,0 @@
-using System;
-namespace Blue
-{
-    /// <summary>
-    /// 实现注入功能的接口
-    /// </summary>
-    public interface IInjector:IDisposable
-    {
-        /// <summary>
-        /// 根据类型预注入数据
-        /// </summary>
-        void PrepairInjectionData(Type processType);
-
-        /// <summary>
-        /// architectureInstance注入
-        /// </summary>
-        void Inject(IArchitecture architectureInstance);
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/IOC/IInjector.cs.meta

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

+ 0 - 65
Assets/Scripts/Blue/0.FrameworkDesign/IOC/IOCContainer.cs

@@ -1,65 +0,0 @@
-using System.Collections.Generic;
-using System;
-
-namespace Blue
-{
-    /// <summary>
-    /// IOC容器---根据类型存储Object
-    /// </summary>
-    public class IOCContainer
-    {
-        private Dictionary<Type, object> container = new Dictionary<Type, object>();
-
-        /// <summary>
-        /// 将实例注入IOC容器
-        /// </summary>
-        public void Register<T>() where T:new()
-        {
-            Register(new T());
-        }
-
-        /// <summary>
-        /// 将实例注入IOC容器
-        /// </summary>
-        public void Register<T>(T instance)
-        {
-            Type t = typeof(T);
-            if (container.ContainsKey(t))
-            {
-                container[t] = instance;
-            }
-            else
-            {
-                container.Add(t,instance);
-            }
-        }
-
-        /// <summary>
-        /// 根据类型从IOC容器获取对象
-        /// </summary>
-        public object Get(Type type)
-        {
-            if (container.TryGetValue(type,out object instance))
-            {
-                return instance;
-            }
-            return default;
-        }
-
-        /// <summary>
-        /// 从IOC容器获取指定的实例
-        /// </summary>
-        public T Get<T>()
-        {
-            Type t = typeof(T);
-            if (container.TryGetValue(t, out object instance))
-            {
-                return (T)instance;
-            }
-            else
-            {
-                throw new Exception("Can Not Find Instance of type "+t.FullName+",Please Call Register At First!");
-            }
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/IOC/IOCContainer.cs.meta

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

+ 0 - 13
Assets/Scripts/Blue/0.FrameworkDesign/IOC/InjectInfo.cs

@@ -1,13 +0,0 @@
-using System;
-using System.Reflection;
-
-namespace Blue
-{
-    public class InjectInfo
-    {
-        public Type BaseType { get; set; }
-        public FieldInfo InjectField { get; set; }
-        public Type InjectType { get; set; }
-        public InjectScope InjectScope { get; set; }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/IOC/InjectInfo.cs.meta

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

+ 0 - 40
Assets/Scripts/Blue/0.FrameworkDesign/IOC/InjectRuleAttribute.cs

@@ -1,40 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Blue
-{
-    /// <summary>
-    /// 注入规则属性---可以对接口应用属性
-    /// </summary>
-    [AttributeUsage(AttributeTargets.Interface)]
-    public class InjectRuleAttribute : Attribute
-    {
-        private List<Type> canInjectList;
-        private Type baseInjectType;
-        public InjectRuleAttribute(params Type[] canInject)
-        {
-            baseInjectType = typeof(IAuto);
-            canInjectList = new List<Type>(canInject.Length);
-            foreach (var item in canInject)
-            {
-                if (item.GetInterfaces().Contains(baseInjectType))
-                {
-                    canInjectList.Add(item);
-                }
-            }
-        }
-        public List<Type> GetCanInjectList()
-        {
-            return canInjectList;
-        }
-        public bool IfCanInject(Type canInject)
-        {
-            if (canInjectList.Contains(canInject))
-            {
-                return true;
-            }
-            return false;
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/IOC/InjectRuleAttribute.cs.meta

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

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/IOC/InjectScope.cs

@@ -1,11 +0,0 @@
-namespace Blue
-{
-    /// <summary>
-    /// 注入范围
-    /// </summary>
-    public enum InjectScope
-    {
-        Singleton,
-        Prototype
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/IOC/InjectScope.cs.meta

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

+ 0 - 43
Assets/Scripts/Blue/0.FrameworkDesign/IOC/ModelInjector.cs

@@ -1,43 +0,0 @@
-using System;
-
-namespace Blue
-{
-    /// <summary>
-    /// Model 层注入
-    /// </summary>
-    public class ModelInjector : AbstractArchitectureComponentInjector
-    {
-        private Type modelType;
-
-        /// <summary>
-        /// 获取 IModel 的类型
-        /// </summary>
-        public ModelInjector() : base(typeof(IModel)) {
-            modelType = typeof(IModel);
-        }
-
-        /// <summary>
-        /// 根据类型获取注入的Object
-        /// </summary>
-        protected override object GetInjectObject(Type baseType)
-        {
-            object instance = architectureInstance.GetModel(baseType);
-            if (instance == null)
-            {
-                var interfaces = baseType.GetInterfaces(); // 当在派生类中重写时,获取由当前 Type 实现或继承的所有接口
-                foreach (var type in interfaces)
-                {
-                    if (modelType.IsAssignableFrom(type)&&!modelType.Equals(type)) // 确定指定类型 type 的实例是否能分配给当前类型的变量
-                    {
-                        instance = architectureInstance.GetModel(type);
-                        if (instance != null)
-                        {
-                            break;
-                        }
-                    }
-                }
-            }
-            return instance;
-        }
-    }
-}

+ 0 - 11
Assets/Scripts/Blue/0.FrameworkDesign/IOC/ModelInjector.cs.meta

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

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác