com.wallstop-studios.dxmessaging 2.0.0 โ†’ 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/.github/workflows/format-on-demand.yml +2 -2
  2. package/.github/workflows/json-format-check.yml +1 -1
  3. package/.github/workflows/markdown-json.yml +1 -1
  4. package/.github/workflows/markdownlint.yml +1 -1
  5. package/.github/workflows/npm-publish.yml +1 -1
  6. package/.github/workflows/prettier-autofix.yml +2 -2
  7. package/.github/workflows/yaml-format-lint.yml +1 -1
  8. package/Docs/Advanced.md +26 -1
  9. package/Docs/Comparisons.md +1229 -146
  10. package/Docs/Compatibility.md +27 -0
  11. package/Docs/DesignAndArchitecture.md +41 -34
  12. package/Docs/EmitShorthands.md +34 -0
  13. package/Docs/Helpers.md +1 -1
  14. package/Docs/Index.md +28 -25
  15. package/Docs/Install.md +29 -6
  16. package/Docs/Integrations/Reflex.md +292 -0
  17. package/Docs/Integrations/Reflex.md.meta +7 -0
  18. package/Docs/Integrations/VContainer.md +324 -0
  19. package/Docs/Integrations/VContainer.md.meta +7 -0
  20. package/Docs/Integrations/Zenject.md +333 -0
  21. package/Docs/Integrations/Zenject.md.meta +7 -0
  22. package/{Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.pdb.meta โ†’ Docs/Integrations.meta} +2 -1
  23. package/Docs/InterceptorsAndOrdering.md +371 -17
  24. package/Docs/ListeningPatterns.md +206 -0
  25. package/Docs/MessageBusProviders.md +496 -0
  26. package/Docs/MessageBusProviders.md.meta +7 -0
  27. package/Docs/MessageTypes.md +27 -0
  28. package/Docs/MigrationGuide.md +45 -0
  29. package/Docs/Patterns.md +286 -0
  30. package/Docs/Performance.md +9 -9
  31. package/Docs/QuickReference.md +31 -0
  32. package/Docs/RuntimeConfiguration.md +407 -0
  33. package/Docs/RuntimeConfiguration.md.meta +7 -0
  34. package/Docs/UnityIntegration.md +3 -1
  35. package/Docs/VisualGuide.md +206 -157
  36. package/Editor/CustomEditors/MessagingComponentEditor.cs +15 -6
  37. package/README.md +148 -26
  38. package/Runtime/AssemblyInfo.cs +4 -0
  39. package/Runtime/Core/Extensions/MessageBusExtensions.cs +253 -0
  40. package/Runtime/Core/Extensions/MessageBusExtensions.cs.meta +12 -0
  41. package/Runtime/Core/Extensions/MessageExtensions.cs +137 -89
  42. package/Runtime/Core/MessageBus/GlobalMessageBusProvider.cs +23 -0
  43. package/Runtime/Core/MessageBus/GlobalMessageBusProvider.cs.meta +11 -0
  44. package/Runtime/Core/MessageBus/IMessageBusProvider.cs +14 -0
  45. package/Runtime/Core/MessageBus/IMessageBusProvider.cs.meta +11 -0
  46. package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs +18 -0
  47. package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs.meta +11 -0
  48. package/Runtime/Core/MessageBus/MessageBusRebindMode.cs +26 -0
  49. package/Runtime/Core/MessageBus/MessageBusRebindMode.cs.meta +11 -0
  50. package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs +383 -0
  51. package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs.meta +11 -0
  52. package/Runtime/Core/MessageHandler.cs +198 -27
  53. package/Runtime/Core/MessageRegistrationToken.cs +67 -25
  54. package/Runtime/Unity/CurrentGlobalMessageBusProvider.cs +31 -0
  55. package/Runtime/Unity/CurrentGlobalMessageBusProvider.cs.meta +12 -0
  56. package/Runtime/Unity/InitialGlobalMessageBusProvider.cs +38 -0
  57. package/Runtime/Unity/InitialGlobalMessageBusProvider.cs.meta +12 -0
  58. package/Runtime/Unity/Integrations/Reflex/AssemblyInfo.cs +11 -0
  59. package/Runtime/Unity/Integrations/Reflex/AssemblyInfo.cs.meta +3 -0
  60. package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs +73 -0
  61. package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs.meta +11 -0
  62. package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef +20 -0
  63. package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef.meta +7 -0
  64. package/Runtime/Unity/Integrations/Reflex.meta +8 -0
  65. package/Runtime/Unity/Integrations/VContainer/AssemblyInfo.cs +11 -0
  66. package/Runtime/Unity/Integrations/VContainer/AssemblyInfo.cs.meta +3 -0
  67. package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs +46 -0
  68. package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs.meta +11 -0
  69. package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef +30 -0
  70. package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef.meta +7 -0
  71. package/Runtime/Unity/Integrations/VContainer.meta +8 -0
  72. package/Runtime/Unity/Integrations/Zenject/AssemblyInfo.cs +11 -0
  73. package/Runtime/Unity/Integrations/Zenject/AssemblyInfo.cs.meta +3 -0
  74. package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef +30 -0
  75. package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef.meta +7 -0
  76. package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs +55 -0
  77. package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs.meta +11 -0
  78. package/Runtime/Unity/Integrations/Zenject.meta +8 -0
  79. package/Runtime/Unity/Integrations.meta +8 -0
  80. package/Runtime/Unity/MessageAwareComponent.cs +102 -0
  81. package/Runtime/Unity/MessageBusProviderHandle.cs +97 -0
  82. package/Runtime/Unity/MessageBusProviderHandle.cs.meta +12 -0
  83. package/Runtime/Unity/MessagingComponent.cs +164 -2
  84. package/Runtime/Unity/MessagingComponentInstaller.cs +120 -0
  85. package/Runtime/Unity/MessagingComponentInstaller.cs.meta +12 -0
  86. package/Runtime/Unity/ScriptableMessageBusProvider.cs +14 -0
  87. package/Runtime/Unity/ScriptableMessageBusProvider.cs.meta +12 -0
  88. package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab +98 -0
  89. package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab.meta +7 -0
  90. package/Samples~/DI/Prefabs.meta +8 -0
  91. package/Samples~/DI/Providers/GlobalMessageBusProvider.asset +14 -0
  92. package/Samples~/DI/Providers/GlobalMessageBusProvider.asset.meta +8 -0
  93. package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset +14 -0
  94. package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset.meta +8 -0
  95. package/Samples~/DI/Providers.meta +8 -0
  96. package/Samples~/DI/README.md +51 -0
  97. package/Samples~/DI/README.md.meta +7 -0
  98. package/Samples~/DI/Reflex/SampleInstaller.cs +75 -0
  99. package/Samples~/DI/Reflex/SampleInstaller.cs.meta +11 -0
  100. package/Samples~/DI/Reflex.meta +8 -0
  101. package/Samples~/DI/VContainer/SampleLifetimeScope.cs +81 -0
  102. package/Samples~/DI/VContainer/SampleLifetimeScope.cs.meta +11 -0
  103. package/Samples~/DI/VContainer.meta +8 -0
  104. package/Samples~/DI/Zenject/SampleInstaller.cs +67 -0
  105. package/Samples~/DI/Zenject/SampleInstaller.cs.meta +11 -0
  106. package/Samples~/DI/Zenject.meta +8 -0
  107. package/Samples~/DI.meta +8 -0
  108. package/Samples~/Mini Combat/README.md +5 -7
  109. package/Samples~/Mini Combat/Walkthrough.md +18 -24
  110. package/Samples~/UI Buttons + Inspector/DiagnosticsEnabler.cs +12 -2
  111. package/Samples~/UI Buttons + Inspector/README.md.meta +7 -0
  112. package/Tests/Runtime/Benchmarks/BenchmarkSession.cs +444 -0
  113. package/Tests/Runtime/Benchmarks/BenchmarkSession.cs.meta +11 -0
  114. package/Tests/Runtime/Benchmarks/BenchmarkTestBase.cs +94 -0
  115. package/Tests/Runtime/Benchmarks/BenchmarkTestBase.cs.meta +11 -0
  116. package/Tests/Runtime/Benchmarks/ComparisonPerformanceTests.cs +395 -0
  117. package/Tests/Runtime/Benchmarks/ComparisonPerformanceTests.cs.meta +11 -0
  118. package/Tests/Runtime/Benchmarks/PerformanceTests.cs +77 -429
  119. package/Tests/Runtime/Benchmarks/ProviderResolutionBenchmarks.cs +142 -0
  120. package/Tests/Runtime/Benchmarks/ProviderResolutionBenchmarks.cs.meta +12 -0
  121. package/Tests/Runtime/Benchmarks/WallstopStudios.DxMessaging.Tests.Runtime.Benchmarks.asmdef +50 -0
  122. package/Tests/Runtime/Benchmarks/WallstopStudios.DxMessaging.Tests.Runtime.Benchmarks.asmdef.meta +7 -0
  123. package/Tests/Runtime/Core/DefaultBusFallbackTests.cs +333 -0
  124. package/Tests/Runtime/Core/DefaultBusFallbackTests.cs.meta +11 -0
  125. package/Tests/Runtime/Core/Extensions/MessageBusExtensionsTests.cs +278 -0
  126. package/Tests/Runtime/Core/Extensions/MessageBusExtensionsTests.cs.meta +11 -0
  127. package/Tests/Runtime/Core/Extensions/MessageExtensionsProviderTests.cs +289 -0
  128. package/Tests/Runtime/Core/Extensions/MessageExtensionsProviderTests.cs.meta +11 -0
  129. package/Tests/Runtime/Core/Extensions.meta +8 -0
  130. package/Tests/Runtime/Core/IntegrationShimSmokeTests.cs +57 -0
  131. package/Tests/Runtime/Core/IntegrationShimSmokeTests.cs.meta +11 -0
  132. package/Tests/Runtime/Core/MessageHandlerGlobalBusTests.cs +219 -0
  133. package/Tests/Runtime/Core/MessageHandlerGlobalBusTests.cs.meta +11 -0
  134. package/Tests/Runtime/Core/MessageRegistrationBuilderTests.cs +204 -0
  135. package/Tests/Runtime/Core/MessageRegistrationBuilderTests.cs.meta +11 -0
  136. package/Tests/Runtime/Core/MessagingTestBase.cs +4 -4
  137. package/Tests/Runtime/Core/NominalTests.cs +2 -2
  138. package/Tests/Runtime/Core/TypedShorthandTests.cs +2 -2
  139. package/Tests/Runtime/Core/UntargetedEquivalenceTests.cs +1 -1
  140. package/Tests/Runtime/Core/UntargetedPrefreezeTests.cs +2 -4
  141. package/Tests/Runtime/Integrations/Reflex/ReflexIntegrationTests.cs +162 -0
  142. package/Tests/Runtime/Integrations/Reflex/ReflexIntegrationTests.cs.meta +11 -0
  143. package/Tests/Runtime/Integrations/Reflex/Resources/ReflexSettings.asset +16 -0
  144. package/Tests/Runtime/Integrations/Reflex/Resources/ReflexSettings.asset.meta +8 -0
  145. package/Tests/Runtime/Integrations/Reflex/Resources.meta +8 -0
  146. package/Tests/Runtime/Integrations/Reflex/WallstopStudios.DxMessaging.Tests.Runtime.Reflex.asmdef +27 -0
  147. package/Tests/Runtime/Integrations/Reflex/WallstopStudios.DxMessaging.Tests.Runtime.Reflex.asmdef.meta +7 -0
  148. package/Tests/Runtime/Integrations/Reflex.meta +8 -0
  149. package/Tests/Runtime/Integrations/VContainer/VContainerIntegrationTests.cs +140 -0
  150. package/Tests/Runtime/Integrations/VContainer/VContainerIntegrationTests.cs.meta +11 -0
  151. package/Tests/Runtime/Integrations/VContainer/WallstopStudios.DxMessaging.Tests.Runtime.VContainer.asmdef +37 -0
  152. package/Tests/Runtime/Integrations/VContainer/WallstopStudios.DxMessaging.Tests.Runtime.VContainer.asmdef.meta +7 -0
  153. package/Tests/Runtime/Integrations/VContainer.meta +8 -0
  154. package/Tests/Runtime/Integrations/Zenject/WallstopStudios.DxMessaging.Tests.Runtime.Zenject.asmdef +37 -0
  155. package/Tests/Runtime/Integrations/Zenject/WallstopStudios.DxMessaging.Tests.Runtime.Zenject.asmdef.meta +7 -0
  156. package/Tests/Runtime/Integrations/Zenject/ZenjectIntegrationTests.cs +140 -0
  157. package/Tests/Runtime/Integrations/Zenject/ZenjectIntegrationTests.cs.meta +11 -0
  158. package/Tests/Runtime/Integrations/Zenject.meta +8 -0
  159. package/Tests/Runtime/Integrations.meta +8 -0
  160. package/Tests/Runtime/Scripts/Components/EmptyMessageAwareComponent.cs +1 -1
  161. package/Tests/Runtime/Scripts/Components/GenericMessageAwareComponent.cs +1 -1
  162. package/Tests/Runtime/Scripts/Components/SimpleMessageAwareComponent.cs +1 -1
  163. package/Tests/Runtime/TestUtilities/UnityFixtureBase.cs +64 -0
  164. package/Tests/Runtime/TestUtilities/UnityFixtureBase.cs.meta +12 -0
  165. package/Tests/Runtime/TestUtilities.meta +9 -0
  166. package/Tests/Runtime/Unity/MessageBusProviderAssetTests.cs +57 -0
  167. package/Tests/Runtime/Unity/MessageBusProviderAssetTests.cs.meta +11 -0
  168. package/Tests/Runtime/Unity/MessageBusProviderHandleTests.cs +107 -0
  169. package/Tests/Runtime/Unity/MessageBusProviderHandleTests.cs.meta +12 -0
  170. package/Tests/Runtime/Unity/MessagingComponentProviderIntegrationTests.cs +210 -0
  171. package/Tests/Runtime/Unity/MessagingComponentProviderIntegrationTests.cs.meta +12 -0
  172. package/Tests/Runtime/Unity.meta +9 -0
  173. package/Tests/Runtime/WallstopStudios.DxMessaging.Tests.Runtime.asmdef +3 -1
  174. package/package.json +1 -1
@@ -6,45 +6,67 @@ If you're brand new to messaging systems, this visual guide will help you unders
6
6
 
7
7
  ### The Old Way (Spaghetti Code)
8
8
 
9
- ````text
10
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
11
- โ”‚ Player โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
12
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
13
- โ”œโ”€โ”€โ†’ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
14
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ โ”‚ UI โ”‚
15
- โ”‚ Enemy โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
16
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
17
- โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
18
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ””โ”€โ”€โ”€โ†’โ”‚ Audio โ”‚
19
- โ”‚ Inventory โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
20
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
21
-
22
- Problems:
23
- โŒ Everyone needs to know everyone else
24
- โŒ Hard to add/remove systems
25
- โŒ Memory leaks from forgotten unsubscribes
26
- ```text
9
+ ```mermaid
10
+ graph LR
11
+ Player[Player]
12
+ Enemy[Enemy]
13
+ Inventory[Inventory]
14
+ UI[UI]
15
+ Audio[Audio]
16
+
17
+ Player -->|direct ref| UI
18
+ Player -->|direct ref| Audio
19
+ Enemy -->|direct ref| UI
20
+ Enemy -->|direct ref| Audio
21
+ Inventory -->|direct ref| Audio
22
+
23
+ style Player fill:#ffa39e,stroke:#cf1322,stroke-width:2px,color:#000
24
+ style Enemy fill:#ffa39e,stroke:#cf1322,stroke-width:2px,color:#000
25
+ style Inventory fill:#ffa39e,stroke:#cf1322,stroke-width:2px,color:#000
26
+ style UI fill:#b7eb8f,stroke:#389e0d,stroke-width:2px,color:#000
27
+ style Audio fill:#b7eb8f,stroke:#389e0d,stroke-width:2px,color:#000
28
+ ```
29
+
30
+ #### Problems
31
+
32
+ - โŒ Everyone needs to know everyone else
33
+ - โŒ Hard to add/remove systems
34
+ - โŒ Memory leaks from forgotten unsubscribes
27
35
 
28
36
  ### The DxMessaging Way (Clean Separation)
29
37
 
30
- ```text
31
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
32
- โ”‚ Player โ”‚โ”€โ”€โ†’ Message โ”€โ”€โ†’ โ”‚ UI โ”‚
33
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ†“ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
34
- โ”‚
35
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ†“ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
36
- โ”‚ Enemy โ”‚โ”€โ”€โ†’ BUS โ”€โ”€โ†’ โ”‚ Audio โ”‚
37
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ†“ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
38
- โ”‚
39
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ†“ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
40
- โ”‚Inventory โ”‚โ”€โ”€โ†’ Message โ”€โ”€โ†’ โ”‚Analytics โ”‚
41
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
42
-
43
- Benefits:
44
- โœ… Nobody knows about anyone else
45
- โœ… Easy to add/remove systems
46
- โœ… Zero memory leaks (automatic cleanup)
47
- ```text
38
+ ```mermaid
39
+ graph TB
40
+ Player[Player]
41
+ Enemy[Enemy]
42
+ Inventory[Inventory]
43
+ Bus((Message<br/>Bus))
44
+ UI[UI]
45
+ Audio[Audio]
46
+ Analytics[Analytics]
47
+
48
+ Player -->|message| Bus
49
+ Enemy -->|message| Bus
50
+ Inventory -->|message| Bus
51
+
52
+ Bus -->|notify| UI
53
+ Bus -->|notify| Audio
54
+ Bus -->|notify| Analytics
55
+
56
+ style Player fill:#91d5ff,stroke:#096dd9,stroke-width:2px,color:#000
57
+ style Enemy fill:#91d5ff,stroke:#096dd9,stroke-width:2px,color:#000
58
+ style Inventory fill:#91d5ff,stroke:#096dd9,stroke-width:2px,color:#000
59
+ style Bus fill:#ffd591,stroke:#d46b08,stroke-width:3px,color:#000
60
+ style UI fill:#95de64,stroke:#237804,stroke-width:2px,color:#000
61
+ style Audio fill:#95de64,stroke:#237804,stroke-width:2px,color:#000
62
+ style Analytics fill:#95de64,stroke:#237804,stroke-width:2px,color:#000
63
+ ```
64
+
65
+ #### Benefits
66
+
67
+ - โœ… Nobody knows about anyone else
68
+ - โœ… Easy to add/remove systems
69
+ - โœ… Zero memory leaks (automatic cleanup)
48
70
 
49
71
  ## ๐Ÿ“จ The Three Message Types (Simple!)
50
72
 
@@ -66,9 +88,9 @@ msg.Emit();
66
88
 
67
89
  // Anyone can listen
68
90
  _ = token.RegisterUntargeted<GamePaused>(OnPause);
69
- ```text
91
+ ```
70
92
 
71
- #### Real-world uses:
93
+ #### Real-world uses
72
94
 
73
95
  - "Game paused!"
74
96
  - "Settings changed!"
@@ -90,9 +112,9 @@ heal.EmitGameObjectTargeted(playerObject);
90
112
 
91
113
  // Only the player listens
92
114
  _ = token.RegisterComponentTargeted<Heal>(this, OnHeal);
93
- ```text
115
+ ```
94
116
 
95
- #### Real-world uses:
117
+ #### Real-world uses
96
118
 
97
119
  - "Player, heal yourself!"
98
120
  - "Enemy #3, take damage!"
@@ -117,9 +139,9 @@ _ = token.RegisterGameObjectBroadcast<TookDamage>(enemyObject, OnThisEnemy);
117
139
 
118
140
  // OR achievement system can listen to ALL enemies
119
141
  _ = token.RegisterBroadcastWithoutSource<TookDamage>(OnAnyEnemy);
120
- ```text
142
+ ```
121
143
 
122
- #### Real-world uses:
144
+ #### Real-world uses
123
145
 
124
146
  - "I (player) took damage!"
125
147
  - "I (enemy) died!"
@@ -129,33 +151,49 @@ _ = token.RegisterBroadcastWithoutSource<TookDamage>(OnAnyEnemy);
129
151
 
130
152
  When you send a message, here's what happens:
131
153
 
132
- ```text
133
- 1. You create a message
134
- var heal = new Heal(10);
135
-
136
- 2. You emit it
137
- heal.EmitGameObjectTargeted(player);
138
-
139
- 3. [OPTIONAL] Interceptors check it
140
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
141
- โ”‚ Is damage valid? (>0) โ”‚
142
- โ”‚ Should we clamp it? (<999) โ”‚
143
- โ”‚ Cancel bad messages? โŒ โ”‚
144
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
145
-
146
- 4. Handlers receive it (your main logic)
147
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
148
- โ”‚ priority: 0 โ†’ SaveSystem โ”‚
149
- โ”‚ priority: 5 โ†’ AudioSystem โ”‚
150
- โ”‚ priority: 10 โ†’ UISystem โ”‚
151
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
152
-
153
- 5. [OPTIONAL] Post-processors log it
154
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
155
- โ”‚ Analytics.Track(...) โ”‚
156
- โ”‚ Debug.Log(...) โ”‚
157
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
158
- ```text
154
+ ```mermaid
155
+ sequenceDiagram
156
+ participant You as Your Code
157
+ participant Msg as Message
158
+ participant Int as Interceptors<br/>(Optional)
159
+ participant H0 as Handler<br/>priority: 0
160
+ participant H5 as Handler<br/>priority: 5
161
+ participant H10 as Handler<br/>priority: 10
162
+ participant PP as Post-Processors<br/>(Optional)
163
+
164
+ Note over You: 1. Create message
165
+ You->>Msg: var heal = new Heal(10);
166
+
167
+ Note over You,Msg: 2. Emit message
168
+ You->>Msg: heal.EmitGameObjectTargeted(player);
169
+
170
+ Note over Int: 3. Validate & Normalize
171
+ Msg->>Int: Check message
172
+ Int->>Int: Is valid? (>0)<br/>Clamp if needed (<999)
173
+ alt Invalid message
174
+ Int--xMsg: โŒ Cancel
175
+ else Valid message
176
+ Int->>H0: โœ… Continue
177
+ end
178
+
179
+ Note over H0,H10: 4. Execute handlers (by priority)
180
+ H0->>H0: SaveSystem runs first
181
+ H0->>H5: Next priority
182
+ H5->>H5: AudioSystem runs
183
+ H5->>H10: Next priority
184
+ H10->>H10: UISystem runs last
185
+
186
+ Note over PP: 5. Analytics & Logging
187
+ H10->>PP: All handlers complete
188
+ PP->>PP: Analytics.Track(...)<br/>Debug.Log(...)
189
+ ```
190
+
191
+ ### Key points
192
+
193
+ - **Step 1-2:** You create and emit the message
194
+ - **Step 3 (Optional):** Interceptors can validate, modify, or cancel
195
+ - **Step 4:** Handlers run in priority order (lower number = earlier)
196
+ - **Step 5 (Optional):** Post-processors run after everything (perfect for analytics)
159
197
 
160
198
  ## ๐ŸŽฎ Your First Message (3 Easy Steps)
161
199
 
@@ -169,7 +207,7 @@ using DxMessaging.Core.Attributes;
169
207
  public readonly partial struct Heal {
170
208
  public readonly int amount;
171
209
  }
172
- ````
210
+ ```
173
211
 
174
212
  #### What are those `[DxSomething]` tags?
175
213
 
@@ -228,20 +266,29 @@ healMsg.EmitComponentTargeted(playerComponent);
228
266
 
229
267
  ### Pattern: Scene Transition
230
268
 
231
- ```text
232
- SceneManager AudioSystem
233
- โ”‚ โ”‚
234
- โ”‚ [SceneChanged] โ”‚
235
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’ โ”‚ FadeOutMusic()
236
- โ”‚ โ”‚
237
- โ”‚ SaveSystem
238
- โ”‚ โ”‚
239
- โ”‚ [SceneChanged] โ”‚
240
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’ โ”‚ SaveGame()
241
-
242
- All independent! No coupling!
269
+ ```mermaid
270
+ sequenceDiagram
271
+ participant SM as SceneManager
272
+ participant Bus as Message Bus
273
+ participant Audio as AudioSystem
274
+ participant Save as SaveSystem
275
+
276
+ Note over SM: Scene is changing
277
+ SM->>Bus: SceneChanged(sceneIndex: 2)
278
+
279
+ Note over Bus: Message broadcast to all listeners
280
+
281
+ Bus->>Audio: SceneChanged received
282
+ Audio->>Audio: FadeOutMusic()
283
+
284
+ Bus->>Save: SceneChanged received
285
+ Save->>Save: SaveGame()
286
+
287
+ Note over Audio,Save: โœ… All independent!<br/>No coupling!
243
288
  ```
244
289
 
290
+ **Why this works:** AudioSystem and SaveSystem don't know about SceneManager or each other. They just listen for `SceneChanged` messages and react independently.
291
+
245
292
  Code:
246
293
 
247
294
  ```csharp
@@ -261,16 +308,23 @@ _ = saveToken.RegisterUntargeted<SceneChanged>(OnScene);
261
308
 
262
309
  ### Pattern: Player Input โ†’ Action
263
310
 
264
- ```text
265
- InputSystem Player
266
- โ”‚ โ”‚
267
- โ”‚ [Jump] โ”‚
268
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’ โ”‚ ApplyForce()
269
- โ”‚ โ”‚
311
+ ```mermaid
312
+ sequenceDiagram
313
+ participant Input as InputSystem
314
+ participant Bus as Message Bus
315
+ participant Player as Player
316
+
317
+ Note over Input: User presses Space
318
+ Input->>Bus: Jump(force: 10f)<br/>[Targeted to Player]
319
+
320
+ Bus->>Player: Jump message received
321
+ Player->>Player: ApplyForce()<br/>rb.AddForce(...)
270
322
 
271
- Decoupled! Input doesn't need reference to Player.
323
+ Note over Input,Player: โœ… Decoupled!<br/>Input doesn't reference Player
272
324
  ```
273
325
 
326
+ **Why this works:** InputSystem doesn't need a reference to Player. It just sends a `Jump` message targeted at the player, and the player responds.
327
+
274
328
  Code:
275
329
 
276
330
  ```csharp
@@ -291,15 +345,29 @@ void OnJump(ref Jump msg) {
291
345
 
292
346
  ### Pattern: Achievement Tracking
293
347
 
294
- ````text
295
- Any System Achievement System
296
- โ”‚ โ”‚
297
- โ”‚ [Any Message] โ”‚
298
- โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’ โ”‚ CheckProgress()
299
- โ”‚ โ”‚ UnlockIfReady()
348
+ ```mermaid
349
+ sequenceDiagram
350
+ participant E as Enemy
351
+ participant P as Player
352
+ participant C as Chest
353
+ participant Bus as Message Bus
354
+ participant Ach as Achievement System
355
+
356
+ Note over Ach: Listens to ALL messages
300
357
 
301
- Achievements see EVERYTHING without coupling!
302
- ```text
358
+ E->>Bus: EnemyKilled
359
+ Bus->>Ach: CheckProgress()<br/>UnlockIfReady()
360
+
361
+ P->>Bus: LevelCompleted
362
+ Bus->>Ach: CheckProgress()<br/>UnlockIfReady()
363
+
364
+ C->>Bus: ChestOpened
365
+ Bus->>Ach: CheckProgress()<br/>UnlockIfReady()
366
+
367
+ Note over Ach: โœ… Sees EVERYTHING<br/>without coupling!
368
+ ```
369
+
370
+ **Why this works:** Achievement System uses `RegisterGlobalAcceptAll()` to observe every message type, tracking progress across the entire game without any system knowing about it.
303
371
 
304
372
  Code:
305
373
 
@@ -315,7 +383,7 @@ public class AchievementSystem : MessageAwareComponent {
315
383
  );
316
384
  }
317
385
  }
318
- ````
386
+ ```
319
387
 
320
388
  ## ๐Ÿšฆ When to Use Which Message Type
321
389
 
@@ -344,64 +412,51 @@ Think of DxMessaging like a restaurant:
344
412
 
345
413
  ### Untargeted = Restaurant Announcement
346
414
 
347
- ````text
348
- "Attention all customers: We're closing in 10 minutes!"
349
- โ†’ Everyone hears it
350
- ```text
415
+ > "Attention all customers: We're closing in 10 minutes!"
416
+ >
417
+ > โ†’ Everyone hears it
351
418
 
352
419
  ### Targeted = Waiter Delivering Food
353
420
 
354
- ```text
355
- "Order for table 5: Here's your burger"
356
- โ†’ Only table 5 gets it
357
- ````
421
+ > "Order for table 5: Here's your burger"
422
+ >
423
+ > โ†’ Only table 5 gets it
358
424
 
359
425
  ### Broadcast = Customer Calling Waiter
360
426
 
361
- ````text
362
- "Excuse me, I need a refill!" (from table 3)
363
- โ†’ Comes from table 3
364
- โ†’ Any available waiter can respond
365
- โ†’ Manager might track it for statistics
366
- ```text
427
+ > "Excuse me, I need a refill!" (from table 3)
428
+ >
429
+ > โ†’ Comes from table 3
430
+ >
431
+ > โ†’ Any available waiter can respond
432
+ >
433
+ > โ†’ Manager might track it for statistics
367
434
 
368
435
  ## ๐Ÿ” Debugging Visualized
369
436
 
370
437
  DxMessaging has built-in Inspector support!
371
438
 
372
- ```text
373
- MessagingComponent Inspector:
374
- โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
375
- โ”‚ Message History (last 10) โ”‚
376
- โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
377
- โ”‚ โ”‚ 12:34:05 - Heal โ†’ Player (50) โ”‚ โ”‚
378
- โ”‚ โ”‚ 12:34:03 - Jump โ†’ Player โ”‚ โ”‚
379
- โ”‚ โ”‚ 12:34:01 - GamePaused (global) โ”‚ โ”‚
380
- โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
381
- โ”‚ โ”‚
382
- โ”‚ Registrations: โ”‚
383
- โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
384
- โ”‚ โ”‚ โœ“ Heal (priority: 0, 5 calls) โ”‚ โ”‚
385
- โ”‚ โ”‚ โœ“ Jump (priority: 0, 2 calls) โ”‚ โ”‚
386
- โ”‚ โ”‚ โœ“ TookDamage (priority: 10) โ”‚ โ”‚
387
- โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
388
- โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
389
- ````
439
+ ### MessagingComponent Inspector
390
440
 
391
- ## โšก Performance at a Glance
441
+ #### Message History (last 10)
392
442
 
393
- ```text
394
- Traditional C# Event: โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ (baseline)
395
- DxMessaging: โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘ (~10ns slower, negligible)
443
+ - `12:34:05 - Heal โ†’ Player (50)`
444
+ - `12:34:03 - Jump โ†’ Player`
445
+ - `12:34:01 - GamePaused (global)`
396
446
 
397
- Memory:
398
- Traditional Events: โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘ (can leak!)
399
- DxMessaging: โ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ (zero leaks, struct messages)
447
+ ##### Registrations
400
448
 
401
- Coupling:
402
- Traditional Events: โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ (tight!)
403
- DxMessaging: โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ (zero!)
404
- ```
449
+ - โœ“ Heal (priority: 0, 5 calls)
450
+ - โœ“ Jump (priority: 0, 2 calls)
451
+ - โœ“ TookDamage (priority: 10)
452
+
453
+ ## โšก Performance at a Glance
454
+
455
+ | Metric | Traditional C# Events | DxMessaging |
456
+ | ------------ | --------------------- | ----------------------------------- |
457
+ | **Speed** | โšกโšกโšกโšก (baseline) | โšกโšกโšกโšก (~10ns slower, negligible) |
458
+ | **Memory** | โš ๏ธ Can leak! | โœ… Zero leaks (struct messages) |
459
+ | **Coupling** | โŒ Tight coupling | โœ… Zero coupling |
405
460
 
406
461
  **Bottom line:** Slightly slower than raw events, but:
407
462
 
@@ -412,22 +467,16 @@ DxMessaging: โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ (zero!)
412
467
 
413
468
  ## ๐ŸŽ“ Learning Path
414
469
 
415
- ```text
416
- START HERE
417
- โ”‚
418
- โ”œโ”€โ†’ 1. Read this Visual Guide (5 min) โœ“
419
- โ”‚
420
- โ”œโ”€โ†’ 2. Try Quick Start example (5 min)
421
- โ”‚ [Define โ†’ Listen โ†’ Send]
422
- โ”‚
423
- โ”œโ”€โ†’ 3. Import Mini Combat sample (10 min)
424
- โ”‚ [See it in action!]
425
- โ”‚
426
- โ”œโ”€โ†’ 4. Read Common Patterns (15 min)
427
- โ”‚ [Real-world solutions]
428
- โ”‚
429
- โ””โ”€โ†’ 5. Build your first feature! (30 min)
430
- [You're ready!]
470
+ ```mermaid
471
+ graph TD
472
+ Start[START HERE<br/>Read this Visual Guide<br/>5 min โœ“]
473
+ Start --> Step2[Try Quick Start example<br/>5 min<br/>Define โ†’ Listen โ†’ Send]
474
+ Step2 --> Step3[Import Mini Combat sample<br/>10 min<br/>See it in action!]
475
+ Step3 --> Step4[Read Common Patterns<br/>15 min<br/>Real-world solutions]
476
+ Step4 --> Step5[Build your first feature!<br/>30 min<br/>You're ready!]
477
+
478
+ style Start fill:#91d5ff,stroke:#096dd9,stroke-width:3px,color:#000
479
+ style Step5 fill:#95de64,stroke:#237804,stroke-width:2px,color:#000
431
480
  ```
432
481
 
433
482
  ## ๐Ÿ†˜ Common Beginner Questions
@@ -5,6 +5,7 @@ namespace DxMessaging.Editor.CustomEditors
5
5
  using System.Linq;
6
6
  using Core;
7
7
  using Core.Diagnostics;
8
+ using Core.MessageBus;
8
9
  using Core.Messages;
9
10
  using Unity;
10
11
  using UnityEditor;
@@ -107,18 +108,26 @@ namespace DxMessaging.Editor.CustomEditors
107
108
  }
108
109
  }
109
110
 
110
- if (!MessageHandler.MessageBus.DiagnosticsMode)
111
+ IMessageBus globalBus = MessageHandler.MessageBus;
112
+ if (globalBus is not MessageBus concreteBus)
113
+ {
114
+ EditorGUILayout.HelpBox(
115
+ "Global diagnostics controls are unavailable because the active global bus is not the default DxMessaging MessageBus implementation.",
116
+ MessageType.Info
117
+ );
118
+ }
119
+ else if (!concreteBus.DiagnosticsMode)
111
120
  {
112
121
  if (GUILayout.Button("Enable Global Diagnostics"))
113
122
  {
114
- MessageHandler.MessageBus.DiagnosticsMode = true;
123
+ concreteBus.DiagnosticsMode = true;
115
124
  }
116
125
  }
117
126
  else
118
127
  {
119
128
  if (GUILayout.Button("Disable Global Diagnostics"))
120
129
  {
121
- MessageHandler.MessageBus.DiagnosticsMode = false;
130
+ concreteBus.DiagnosticsMode = false;
122
131
  }
123
132
  else
124
133
  {
@@ -130,7 +139,7 @@ namespace DxMessaging.Editor.CustomEditors
130
139
  "Global Messages",
131
140
  true
132
141
  );
133
- int totalGlobalMessages = MessageHandler.MessageBus._emissionBuffer.Count;
142
+ int totalGlobalMessages = concreteBus._emissionBuffer.Count;
134
143
  if (_globalBufferExpanded && totalGlobalMessages > 0)
135
144
  {
136
145
  int page = _globalBufferPaging;
@@ -163,8 +172,8 @@ namespace DxMessaging.Editor.CustomEditors
163
172
  }
164
173
  }
165
174
 
166
- MessageEmissionData[] pagedGlobalMessages = MessageHandler
167
- .MessageBus._emissionBuffer.Reverse()
175
+ MessageEmissionData[] pagedGlobalMessages = concreteBus
176
+ ._emissionBuffer.Reverse()
168
177
  .Skip(page * PageSize)
169
178
  .Take(PageSize)
170
179
  .ToArray();