com.wallstop-studios.dxmessaging 2.1.9 → 3.0.1
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.
- package/CHANGELOG.md +106 -65
- package/CHANGELOG.md.meta +7 -7
- package/Editor/Analyzers/BaseCallIlInspector.cs +277 -0
- package/Editor/Analyzers/BaseCallIlInspector.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallLogMessageParser.cs +295 -0
- package/Editor/Analyzers/BaseCallLogMessageParser.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallReportAggregator.cs +308 -0
- package/Editor/Analyzers/BaseCallReportAggregator.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallTypeScanner.cs +110 -0
- package/Editor/Analyzers/BaseCallTypeScanner.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallTypeScannerCore.cs +562 -0
- package/Editor/Analyzers/BaseCallTypeScannerCore.cs.meta +11 -0
- package/Editor/Analyzers/DxMessagingConsoleHarvester.cs +1122 -0
- package/Editor/Analyzers/DxMessagingConsoleHarvester.cs.meta +11 -0
- package/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.dll.meta +44 -44
- package/Editor/Analyzers/Microsoft.CodeAnalysis.dll.meta +44 -44
- package/Editor/Analyzers/System.Collections.Immutable.dll.meta +44 -44
- package/Editor/Analyzers/System.Reflection.Metadata.dll.meta +44 -44
- package/Editor/Analyzers/System.Runtime.CompilerServices.Unsafe.dll.meta +44 -44
- package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll +0 -0
- package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll.meta +33 -0
- package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll +0 -0
- package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll.meta +72 -72
- package/Editor/Analyzers.meta +8 -8
- package/Editor/AssemblyInfo.cs.meta +3 -3
- package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs +81 -0
- package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs.meta +11 -0
- package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs +420 -0
- package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs.meta +11 -0
- package/Editor/CustomEditors/MessagingComponentEditor.cs +1 -1
- package/Editor/CustomEditors/MessagingComponentEditor.cs.meta +2 -2
- package/Editor/CustomEditors.meta +2 -2
- package/Editor/DxMessagingEditorInitializer.cs +1 -1
- package/Editor/DxMessagingEditorInitializer.cs.meta +2 -2
- package/Editor/DxMessagingMenu.cs.meta +11 -11
- package/Editor/DxMessagingSceneBuildProcessor.cs.meta +11 -11
- package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs +190 -0
- package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs.meta +11 -0
- package/Editor/Settings/DxMessagingSettings.cs +189 -0
- package/Editor/Settings/DxMessagingSettings.cs.meta +2 -2
- package/Editor/Settings/DxMessagingSettingsProvider.cs +50 -33
- package/Editor/Settings/DxMessagingSettingsProvider.cs.meta +2 -2
- package/Editor/Settings.meta +2 -2
- package/Editor/SetupCscRsp.cs +209 -8
- package/Editor/SetupCscRsp.cs.meta +2 -2
- package/Editor/Testing/MessagingComponentEditorHarness.cs +1 -1
- package/Editor/Testing/MessagingComponentEditorHarness.cs.meta +3 -3
- package/Editor/Testing.meta +3 -3
- package/Editor/WallstopStudios.DxMessaging.Editor.asmdef +14 -14
- package/Editor/WallstopStudios.DxMessaging.Editor.asmdef.meta +7 -7
- package/Editor.meta +8 -8
- package/LICENSE.md +9 -9
- package/LICENSE.md.meta +7 -7
- package/README.md +941 -900
- package/README.md.meta +7 -7
- package/Runtime/AssemblyInfo.cs +4 -0
- package/Runtime/AssemblyInfo.cs.meta +2 -2
- package/Runtime/Core/Attributes/DxAutoConstructorAttribute.cs.meta +2 -2
- package/Runtime/Core/Attributes/DxBroadcastMessageAttribute.cs.meta +2 -2
- package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs +26 -0
- package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs.meta +11 -0
- package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs.meta +2 -2
- package/Runtime/Core/Attributes/DxTargetedMessageAttribute.cs.meta +2 -2
- package/Runtime/Core/Attributes/DxUntargetedMessageAttribute.cs.meta +2 -2
- package/Runtime/Core/Attributes.meta +2 -2
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs +195 -0
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs.meta +11 -0
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs +179 -0
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs.meta +11 -0
- package/Runtime/Core/Configuration.meta +9 -0
- package/Runtime/Core/DataStructure/CyclicBuffer.cs +2 -2
- package/Runtime/Core/DataStructure/CyclicBuffer.cs.meta +2 -2
- package/Runtime/Core/DataStructure.meta +2 -2
- package/Runtime/Core/Diagnostics/MessageEmissionData.cs.meta +2 -2
- package/Runtime/Core/Diagnostics/MessageRegistrationData.cs.meta +2 -2
- package/Runtime/Core/Diagnostics/MessageRegistrationType.cs.meta +2 -2
- package/Runtime/Core/Diagnostics.meta +2 -2
- package/Runtime/Core/DxMessagingStaticState.cs +19 -0
- package/Runtime/Core/DxMessagingStaticState.cs.meta +11 -11
- package/Runtime/Core/Extensions/EnumExtensions.cs.meta +2 -2
- package/Runtime/Core/Extensions/IListExtensions.cs.meta +2 -2
- package/Runtime/Core/Extensions/MessageBusExtensions.cs.meta +12 -12
- package/Runtime/Core/Extensions/MessageExtensions.cs.meta +11 -11
- package/Runtime/Core/Extensions.meta +8 -8
- package/Runtime/Core/Helper/MessageCache.cs +32 -0
- package/Runtime/Core/Helper/MessageCache.cs.meta +2 -2
- package/Runtime/Core/Helper/MessageHelperIndexer.cs.meta +2 -2
- package/Runtime/Core/Helper.meta +2 -2
- package/Runtime/Core/IMessage.cs +3 -3
- package/Runtime/Core/IMessage.cs.meta +11 -11
- package/Runtime/Core/InstanceId.cs.meta +11 -11
- package/Runtime/Core/Internal/TypedDispatchLinkIndex.cs +51 -0
- package/Runtime/Core/Internal/TypedDispatchLinkIndex.cs.meta +11 -0
- package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs +38 -0
- package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs.meta +11 -0
- package/Runtime/Core/Internal/TypedSlotIndex.cs +81 -0
- package/Runtime/Core/Internal/TypedSlotIndex.cs.meta +11 -0
- package/Runtime/Core/Internal/TypedSlots.cs +613 -0
- package/Runtime/Core/Internal/TypedSlots.cs.meta +11 -0
- package/Runtime/Core/Internal.meta +9 -0
- package/Runtime/Core/MessageBus/DiagnosticsTarget.cs.meta +11 -11
- package/Runtime/Core/MessageBus/GlobalMessageBusProvider.cs.meta +11 -11
- package/Runtime/Core/MessageBus/IMessageBus.cs +177 -3
- package/Runtime/Core/MessageBus/IMessageBus.cs.meta +11 -11
- package/Runtime/Core/MessageBus/IMessageBusProvider.cs.meta +11 -11
- package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs.meta +11 -11
- package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs +16 -0
- package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs +40 -0
- package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/BusSlots.cs +718 -0
- package/Runtime/Core/MessageBus/Internal/BusSlots.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/DispatchKind.cs +38 -0
- package/Runtime/Core/MessageBus/Internal/DispatchKind.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs +20 -0
- package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs +28 -0
- package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs +48 -0
- package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/ISweepable.cs +15 -0
- package/Runtime/Core/MessageBus/Internal/ISweepable.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs +222 -0
- package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/SlotKey.cs +192 -0
- package/Runtime/Core/MessageBus/Internal/SlotKey.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal.meta +9 -0
- package/Runtime/Core/MessageBus/MessageBus.cs +2651 -500
- package/Runtime/Core/MessageBus/MessageBus.cs.meta +11 -11
- package/Runtime/Core/MessageBus/MessageBusRebindMode.cs.meta +11 -11
- package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs.meta +11 -11
- package/Runtime/Core/MessageBus/MessagingRegistration.cs.meta +11 -11
- package/Runtime/Core/MessageBus/RegistrationLog.cs.meta +11 -11
- package/Runtime/Core/MessageBus.meta +8 -8
- package/Runtime/Core/MessageHandler.cs +2019 -542
- package/Runtime/Core/MessageHandler.cs.meta +11 -11
- package/Runtime/Core/MessageRegistrationHandle.cs.meta +11 -11
- package/Runtime/Core/MessageRegistrationToken.cs +7 -0
- package/Runtime/Core/MessageRegistrationToken.cs.meta +11 -11
- package/Runtime/Core/Messages/GlobalStringMessage.cs.meta +2 -2
- package/Runtime/Core/Messages/IBroadcastMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/ITargetedMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/IUntargetedMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/ReflexiveMessage.cs.meta +2 -2
- package/Runtime/Core/Messages/SourcedStringMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/StringMessage.cs.meta +2 -2
- package/Runtime/Core/Messages.meta +8 -8
- package/Runtime/Core/MessagingDebug.cs.meta +11 -11
- package/Runtime/Core/Pooling/CollectionPool.cs +266 -0
- package/Runtime/Core/Pooling/CollectionPool.cs.meta +11 -0
- package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs +30 -0
- package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs.meta +11 -0
- package/Runtime/Core/Pooling/DxPools.cs +157 -0
- package/Runtime/Core/Pooling/DxPools.cs.meta +11 -0
- package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs +106 -0
- package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs.meta +11 -0
- package/Runtime/Core/Pooling/IDxMessagingClock.cs +18 -0
- package/Runtime/Core/Pooling/IDxMessagingClock.cs.meta +11 -0
- package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs +55 -0
- package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs.meta +11 -0
- package/Runtime/Core/Pooling/StopwatchClock.cs +27 -0
- package/Runtime/Core/Pooling/StopwatchClock.cs.meta +11 -0
- package/Runtime/Core/Pooling/UnityRealtimeClock.cs +31 -0
- package/Runtime/Core/Pooling/UnityRealtimeClock.cs.meta +11 -0
- package/Runtime/Core/Pooling.meta +9 -0
- package/Runtime/Core.meta +8 -8
- package/Runtime/Unity/CurrentGlobalMessageBusProvider.cs.meta +12 -12
- package/Runtime/Unity/DxMessagingRuntimeInitializer.cs.meta +11 -11
- package/Runtime/Unity/InitialGlobalMessageBusProvider.cs.meta +12 -12
- package/Runtime/Unity/Integrations/Reflex/AssemblyInfo.cs.meta +2 -2
- package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs +73 -0
- package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs.meta +11 -11
- package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef +20 -20
- package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef.meta +7 -7
- package/Runtime/Unity/Integrations/Reflex.meta +8 -8
- package/Runtime/Unity/Integrations/VContainer/AssemblyInfo.cs.meta +2 -2
- package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs +109 -1
- package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs.meta +11 -11
- package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef +30 -30
- package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef.meta +7 -7
- package/Runtime/Unity/Integrations/VContainer.meta +8 -8
- package/Runtime/Unity/Integrations/Zenject/AssemblyInfo.cs.meta +2 -2
- package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef +30 -30
- package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef.meta +7 -7
- package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs +79 -1
- package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs.meta +11 -11
- package/Runtime/Unity/Integrations/Zenject.meta +8 -8
- package/Runtime/Unity/Integrations.meta +8 -8
- package/Runtime/Unity/MessageAwareComponent.cs +29 -0
- package/Runtime/Unity/MessageAwareComponent.cs.meta +11 -11
- package/Runtime/Unity/MessageBusProviderHandle.cs.meta +12 -12
- package/Runtime/Unity/MessagingComponent.cs.meta +11 -11
- package/Runtime/Unity/MessagingComponentInstaller.cs.meta +12 -12
- package/Runtime/Unity/ScriptableMessageBusProvider.cs.meta +12 -12
- package/Runtime/Unity.meta +8 -8
- package/Runtime/WallstopStudios.DxMessaging.asmdef +14 -14
- package/Runtime/WallstopStudios.DxMessaging.asmdef.meta +7 -7
- package/Runtime.meta +8 -8
- package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab +98 -98
- package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab.meta +7 -7
- package/Samples~/DI/Prefabs.meta +8 -8
- package/Samples~/DI/Providers/GlobalMessageBusProvider.asset +14 -14
- package/Samples~/DI/Providers/GlobalMessageBusProvider.asset.meta +8 -8
- package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset +14 -14
- package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset.meta +8 -8
- package/Samples~/DI/Providers.meta +8 -8
- package/Samples~/DI/README.md +51 -51
- package/Samples~/DI/README.md.meta +7 -7
- package/Samples~/DI/Reflex/SampleInstaller.cs +7 -0
- package/Samples~/DI/Reflex/SampleInstaller.cs.meta +11 -11
- package/Samples~/DI/Reflex.meta +8 -8
- package/Samples~/DI/VContainer/SampleLifetimeScope.cs +6 -1
- package/Samples~/DI/VContainer/SampleLifetimeScope.cs.meta +11 -11
- package/Samples~/DI/VContainer.meta +8 -8
- package/Samples~/DI/Zenject/SampleInstaller.cs +8 -0
- package/Samples~/DI/Zenject/SampleInstaller.cs.meta +11 -11
- package/Samples~/DI/Zenject.meta +8 -8
- package/Samples~/DI.meta +8 -8
- package/Samples~/Mini Combat/Boot.cs.meta +11 -11
- package/Samples~/Mini Combat/Enemy.cs.meta +11 -11
- package/Samples~/Mini Combat/Messages.cs.meta +11 -11
- package/Samples~/Mini Combat/Player.cs.meta +11 -11
- package/Samples~/Mini Combat/README.md +324 -323
- package/Samples~/Mini Combat/README.md.meta +7 -7
- package/Samples~/Mini Combat/UIOverlay.cs.meta +11 -11
- package/Samples~/Mini Combat/Walkthrough.md +430 -430
- package/Samples~/Mini Combat/Walkthrough.md.meta +7 -7
- package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef +13 -13
- package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef.meta +7 -7
- package/Samples~/Mini Combat.meta +8 -8
- package/Samples~/UI Buttons + Inspector/DiagnosticsEnabler.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/Messages.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/MessagingObserver.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/README.md +210 -209
- package/Samples~/UI Buttons + Inspector/README.md.meta +7 -7
- package/Samples~/UI Buttons + Inspector/UIButtonEmitter.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef +13 -13
- package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef.meta +7 -7
- package/Samples~/UI Buttons + Inspector.meta +8 -8
- package/SourceGenerators/Directory.Build.props.meta +7 -7
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs.meta +11 -11
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs.meta +2 -2
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj.meta +7 -7
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.meta +8 -8
- package/SourceGenerators.meta +8 -8
- package/Third Party Notices.md +3 -3
- package/Third Party Notices.md.meta +7 -7
- package/package.json +115 -92
- package/package.json.meta +7 -7
|
@@ -1,323 +1,324 @@
|
|
|
1
|
-
# Mini Combat Sample
|
|
2
|
-
|
|
3
|
-
> **Ideal for:** First-time users who want to see messaging in action with a working combat example
|
|
4
|
-
|
|
5
|
-
## What You'll Learn in 10 Minutes
|
|
6
|
-
|
|
7
|
-
**This sample demonstrates messaging concepts through a functional example.** It shows:
|
|
8
|
-
|
|
9
|
-
1. How Player heals without UI knowing about Player (**zero coupling**)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
**No prior messaging experience needed** - this sample walks you through everything.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Why This Sample Matters
|
|
18
|
-
|
|
19
|
-
### Before DxMessaging:
|
|
20
|
-
|
|
21
|
-
```csharp
|
|
22
|
-
public class Player {
|
|
23
|
-
[SerializeField] private UI ui; // Coupling!
|
|
24
|
-
[SerializeField] private AudioManager audio; // More coupling!
|
|
25
|
-
|
|
26
|
-
void Heal(int amount) {
|
|
27
|
-
health += amount;
|
|
28
|
-
ui.UpdateHealth(health); // Manual call
|
|
29
|
-
audio.PlayHealSound(); // Manual call
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
#### Every new system = another SerializeField + another manual call.
|
|
35
|
-
|
|
36
|
-
##### With DxMessaging:
|
|
37
|
-
|
|
38
|
-
```csharp
|
|
39
|
-
public class Player : MessageAwareComponent {
|
|
40
|
-
void Heal(int amount) {
|
|
41
|
-
health += amount;
|
|
42
|
-
new PlayerHealed(amount)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
| **[
|
|
88
|
-
| **[
|
|
89
|
-
| **[
|
|
90
|
-
| **[
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
- Create a GameObject named "
|
|
118
|
-
- Create a GameObject named "
|
|
119
|
-
- Create a GameObject named "
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
- **
|
|
131
|
-
- **
|
|
132
|
-
- **
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
1. Send a
|
|
140
|
-
1.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
- The
|
|
185
|
-
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
- If you move them to
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
-
|
|
198
|
-
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
- `base.
|
|
216
|
-
- `base.
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
-
|
|
226
|
-
- **
|
|
227
|
-
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
-
|
|
235
|
-
-
|
|
236
|
-
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
- **
|
|
252
|
-
- **
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
**
|
|
322
|
-
**
|
|
323
|
-
**
|
|
1
|
+
# Mini Combat Sample
|
|
2
|
+
|
|
3
|
+
> **Ideal for:** First-time users who want to see messaging in action with a working combat example
|
|
4
|
+
|
|
5
|
+
## What You'll Learn in 10 Minutes
|
|
6
|
+
|
|
7
|
+
**This sample demonstrates messaging concepts through a functional example.** It shows:
|
|
8
|
+
|
|
9
|
+
1. How Player heals without UI knowing about Player (**zero coupling**)
|
|
10
|
+
1. How Enemy broadcasts damage without knowing who cares (**observer pattern**)
|
|
11
|
+
1. How settings changes update everything automatically (**global events**)
|
|
12
|
+
|
|
13
|
+
**No prior messaging experience needed** - this sample walks you through everything.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Why This Sample Matters
|
|
18
|
+
|
|
19
|
+
### Before DxMessaging:
|
|
20
|
+
|
|
21
|
+
```csharp
|
|
22
|
+
public class Player {
|
|
23
|
+
[SerializeField] private UI ui; // Coupling!
|
|
24
|
+
[SerializeField] private AudioManager audio; // More coupling!
|
|
25
|
+
|
|
26
|
+
void Heal(int amount) {
|
|
27
|
+
health += amount;
|
|
28
|
+
ui.UpdateHealth(health); // Manual call
|
|
29
|
+
audio.PlayHealSound(); // Manual call
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
#### Every new system = another SerializeField + another manual call.
|
|
35
|
+
|
|
36
|
+
##### With DxMessaging:
|
|
37
|
+
|
|
38
|
+
```csharp
|
|
39
|
+
public class Player : MessageAwareComponent {
|
|
40
|
+
void Heal(int amount) {
|
|
41
|
+
health += amount;
|
|
42
|
+
var healed = new PlayerHealed(amount);
|
|
43
|
+
healed.EmitBroadcast(this);
|
|
44
|
+
// Done! UI, audio, analytics all react automatically.
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
###### This decouples systems and removes manual wiring.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Key Concepts (3 Message Types)
|
|
54
|
+
|
|
55
|
+
### 1. Untargeted - "Everyone, listen up!"
|
|
56
|
+
|
|
57
|
+
**Example:** Game settings changed
|
|
58
|
+
|
|
59
|
+
- Like a stadium announcement - everyone hears it
|
|
60
|
+
- No specific target
|
|
61
|
+
- Perfect for: settings, pause, scene transitions
|
|
62
|
+
|
|
63
|
+
### 2. Targeted - "Hey YOU, do this!"
|
|
64
|
+
|
|
65
|
+
**Example:** Heal this specific player
|
|
66
|
+
|
|
67
|
+
- Like mailing a letter to one address
|
|
68
|
+
- Only the target receives it
|
|
69
|
+
- Perfect for: commands, direct actions
|
|
70
|
+
|
|
71
|
+
### 3. Broadcast - "I did something!"
|
|
72
|
+
|
|
73
|
+
**Example:** Enemy took damage
|
|
74
|
+
|
|
75
|
+
- Like ringing a bell - anyone nearby can hear
|
|
76
|
+
- Source announces, observers react
|
|
77
|
+
- Perfect for: events, notifications, analytics
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Sample Files
|
|
82
|
+
|
|
83
|
+
Here's what each script does:
|
|
84
|
+
|
|
85
|
+
| File | Purpose | Message Type |
|
|
86
|
+
|------|---------|--------------|
|
|
87
|
+
| **[Messages.cs](./Messages.cs)** | Defines all message types | Contains `VideoSettingsChanged`, `Heal`, and `TookDamage` |
|
|
88
|
+
| **[Player.cs](./Player.cs)** | Handles receiving healing | Listens for `Heal` (Targeted) |
|
|
89
|
+
| **[Enemy.cs](./Enemy.cs)** | Announces when damaged | Emits `TookDamage` (Broadcast) |
|
|
90
|
+
| **[UIOverlay.cs](./UIOverlay.cs)** | Updates UI based on events | Listens to settings and `TookDamage` (Broadcast) |
|
|
91
|
+
| **[Boot.cs](./Boot.cs)** | Starts the demo | Simulates message flow |
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Quick Start Guide (2 Minutes to Working Demo)
|
|
96
|
+
|
|
97
|
+
### Import & Run (Fastest Way)
|
|
98
|
+
|
|
99
|
+
#### Want to see it work immediately?
|
|
100
|
+
|
|
101
|
+
1. **Open Package Manager**: Window -> Package Manager
|
|
102
|
+
1. **Find DxMessaging** in the package list
|
|
103
|
+
1. **Scroll to Samples** section -> Find "Mini Combat" -> Click **Import**
|
|
104
|
+
1. **Navigate to** Assets/Samples/DxMessaging/.../Mini Combat/
|
|
105
|
+
1. **Open the scene**
|
|
106
|
+
1. **Press Play**
|
|
107
|
+
|
|
108
|
+
Watch the Console logs as messages flow.
|
|
109
|
+
|
|
110
|
+
**Pro tip:** Enable diagnostics in the Inspector (MessagingComponent -> Enable Diagnostics) to see message traffic in real-time.
|
|
111
|
+
|
|
112
|
+
### Method 2: Manual Setup in Your Scene
|
|
113
|
+
|
|
114
|
+
#### Step 1: Set Up Your Scene
|
|
115
|
+
|
|
116
|
+
1. **Create GameObjects** in your Unity scene:
|
|
117
|
+
- Create a GameObject named "Player"
|
|
118
|
+
- Create a GameObject named "Enemy"
|
|
119
|
+
- Create a GameObject named "UIOverlay"
|
|
120
|
+
- Create a GameObject named "Boot"
|
|
121
|
+
|
|
122
|
+
#### Step 2: Add Components
|
|
123
|
+
|
|
124
|
+
For **each GameObject**, you need TWO components:
|
|
125
|
+
|
|
126
|
+
1. **Add MessagingComponent** (DxMessaging's Unity component)
|
|
127
|
+
- Click GameObject -> Add Component -> "MessagingComponent"
|
|
128
|
+
|
|
129
|
+
1. **Add the sample script**:
|
|
130
|
+
- **Player** GameObject -> Add [Player.cs](./Player.cs) script
|
|
131
|
+
- **Enemy** GameObject -> Add [Enemy.cs](./Enemy.cs) script
|
|
132
|
+
- **UIOverlay** GameObject -> Add [UIOverlay.cs](./UIOverlay.cs) script
|
|
133
|
+
- **Boot** GameObject -> Add [Boot.cs](./Boot.cs) script
|
|
134
|
+
|
|
135
|
+
#### Step 3: Run and Observe
|
|
136
|
+
|
|
137
|
+
Press Play! The Boot script will automatically:
|
|
138
|
+
|
|
139
|
+
1. Send a settings change message -> UI updates
|
|
140
|
+
1. Send a heal message to the Player -> Player's HP increases
|
|
141
|
+
1. Trigger Enemy damage -> UI displays the damage event
|
|
142
|
+
|
|
143
|
+
**Pro Tip**: Enable **Diagnostics** on each MessagingComponent in the Inspector to see messages being sent and received in real-time!
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## How It Works
|
|
148
|
+
|
|
149
|
+
### The Message Flow
|
|
150
|
+
|
|
151
|
+
#### [Boot.cs](./Boot.cs) sends messages:
|
|
152
|
+
|
|
153
|
+
1. `VideoSettingsChanged` (Untargeted) -> [UIOverlay.cs](./UIOverlay.cs) receives
|
|
154
|
+
1. `Heal` (Targeted to Player) -> [Player.cs](./Player.cs) receives
|
|
155
|
+
1. `TookDamage` (Broadcast from Enemy) -> [UIOverlay.cs](./UIOverlay.cs) receives
|
|
156
|
+
|
|
157
|
+
### Understanding Message Types
|
|
158
|
+
|
|
159
|
+
1. **Untargeted Messages** (`VideoSettingsChanged`)
|
|
160
|
+
- Like a public announcement everyone can hear
|
|
161
|
+
- No specific recipient
|
|
162
|
+
- Anyone interested can listen
|
|
163
|
+
|
|
164
|
+
1. **Targeted Messages** (`Heal`)
|
|
165
|
+
- Sent directly to a specific component
|
|
166
|
+
- Only that component receives it
|
|
167
|
+
- Like sending a letter to a specific person
|
|
168
|
+
|
|
169
|
+
1. **Broadcast Messages** (`TookDamage`)
|
|
170
|
+
- Announced from a GameObject to all listeners
|
|
171
|
+
- Anyone listening for this message type will receive it
|
|
172
|
+
- Like shouting in a room -- everyone hears it
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Important Notes
|
|
177
|
+
|
|
178
|
+
### Assembly Definitions
|
|
179
|
+
|
|
180
|
+
This sample includes an `.asmdef` (Assembly Definition) file that references `WallstopStudios.DxMessaging`.
|
|
181
|
+
|
|
182
|
+
#### What this means:
|
|
183
|
+
|
|
184
|
+
- The sample scripts are in their own assembly for clean separation
|
|
185
|
+
- The assembly definition already references DxMessaging for you
|
|
186
|
+
- `using DxMessaging.*` statements work automatically
|
|
187
|
+
|
|
188
|
+
##### If you move these scripts:
|
|
189
|
+
|
|
190
|
+
- If you move them to your main Assets folder, they'll use your project's default assembly
|
|
191
|
+
- If you move them to a different assembly, make sure that assembly references `WallstopStudios.DxMessaging`
|
|
192
|
+
|
|
193
|
+
### Message Registration
|
|
194
|
+
|
|
195
|
+
Each script uses `MessagingComponent.Create(this)` to get a `MessageRegistrationToken`:
|
|
196
|
+
|
|
197
|
+
- This token manages all message subscriptions for that component
|
|
198
|
+
- It automatically cleans up when the component is destroyed
|
|
199
|
+
- Think of it as your "ticket" to use the messaging system
|
|
200
|
+
|
|
201
|
+
### CRITICAL: Inheriting from MessageAwareComponent
|
|
202
|
+
|
|
203
|
+
#### If you extend these sample scripts or create your own derived classes:
|
|
204
|
+
|
|
205
|
+
1. **ALWAYS call `base.RegisterMessageHandlers()` FIRST** in your override:
|
|
206
|
+
|
|
207
|
+
```csharp
|
|
208
|
+
protected override void RegisterMessageHandlers() {
|
|
209
|
+
base.RegisterMessageHandlers(); // <- MUST call this first!
|
|
210
|
+
_ = Token.RegisterUntargeted<YourMessage>(OnYourMessage);
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
1. **If you override Unity lifecycle methods, call the base version:**
|
|
215
|
+
- `base.Awake()` - Skipping this means your token won't be created (handlers will never fire!)
|
|
216
|
+
- `base.OnEnable()` / `base.OnDisable()` - Skipping these means handlers won't activate
|
|
217
|
+
- `base.OnDestroy()` - Skipping this can cause memory leaks
|
|
218
|
+
|
|
219
|
+
1. **Never use `new` to hide methods** - Always use `override` and call `base.*`
|
|
220
|
+
|
|
221
|
+
**Why this matters:** Forgetting `base.RegisterMessageHandlers()` or `base.Awake()` is the #1 cause of "my handlers aren't firing" issues. The base class does essential setup that your code depends on.
|
|
222
|
+
|
|
223
|
+
### Registration Timing: Use Awake, Not Start
|
|
224
|
+
|
|
225
|
+
- All sample scripts register in `Awake()` (via `RegisterMessageHandlers()`)
|
|
226
|
+
- This is **the recommended pattern** - handlers are ready before any `Start()` methods run
|
|
227
|
+
- **Avoid registering in `Start()`** unless you have a specific order-of-execution reason
|
|
228
|
+
- Early registration ensures you don't miss messages emitted by other components
|
|
229
|
+
|
|
230
|
+
### Learning vs Production
|
|
231
|
+
|
|
232
|
+
This sample is designed for **learning** and **experimentation**:
|
|
233
|
+
|
|
234
|
+
- It's intentionally simple and focused
|
|
235
|
+
- Great starting point for your own messaging systems
|
|
236
|
+
- Feel free to modify and extend it!
|
|
237
|
+
- Use it as a foundation for your game's communication patterns
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Next Steps
|
|
242
|
+
|
|
243
|
+
### Deep Dive Walkthrough
|
|
244
|
+
|
|
245
|
+
Ready to understand the implementation details?
|
|
246
|
+
|
|
247
|
+
**[Read the Complete Walkthrough](Walkthrough.md)** - Step-by-step explanation of how everything works
|
|
248
|
+
|
|
249
|
+
### Need Help
|
|
250
|
+
|
|
251
|
+
- **New to messaging patterns?** Check the main [Getting Started Guide](../../docs/getting-started/getting-started.md)
|
|
252
|
+
- **Want more examples?** See [Patterns Documentation](../../docs/guides/patterns.md)
|
|
253
|
+
- **Having issues?** Visit [Troubleshooting Guide](../../docs/reference/troubleshooting.md)
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Common Pitfalls (Avoid These!)
|
|
258
|
+
|
|
259
|
+
### Pitfall #1: Forgetting base.RegisterMessageHandlers()
|
|
260
|
+
|
|
261
|
+
```csharp
|
|
262
|
+
// WRONG - Missing base call
|
|
263
|
+
protected override void RegisterMessageHandlers() {
|
|
264
|
+
_ = Token.RegisterUntargeted<MyMessage>(OnMessage);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// CORRECT - Always call base first
|
|
268
|
+
protected override void RegisterMessageHandlers() {
|
|
269
|
+
base.RegisterMessageHandlers(); // Essential!
|
|
270
|
+
_ = Token.RegisterUntargeted<MyMessage>(OnMessage);
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Pitfall #2: Overriding Awake() without calling base
|
|
275
|
+
|
|
276
|
+
```csharp
|
|
277
|
+
// WRONG - Token never created, handlers never fire
|
|
278
|
+
protected override void Awake() {
|
|
279
|
+
myCustomSetup();
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// CORRECT - Call base.Awake()
|
|
283
|
+
protected override void Awake() {
|
|
284
|
+
base.Awake(); // Creates the token!
|
|
285
|
+
myCustomSetup();
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Pitfall #3: Registering in Start() instead of Awake()
|
|
290
|
+
|
|
291
|
+
```csharp
|
|
292
|
+
// WRONG - Might miss messages from other components
|
|
293
|
+
void Start() {
|
|
294
|
+
_ = Token.RegisterUntargeted<MyMessage>(OnMessage);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// CORRECT - Use Awake via RegisterMessageHandlers
|
|
298
|
+
protected override void RegisterMessageHandlers() {
|
|
299
|
+
base.RegisterMessageHandlers();
|
|
300
|
+
_ = Token.RegisterUntargeted<MyMessage>(OnMessage);
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Pitfall #4: Using 'new' instead of 'override'
|
|
305
|
+
|
|
306
|
+
```csharp
|
|
307
|
+
// WRONG - Hides the base method, breaks functionality
|
|
308
|
+
new void OnEnable() {
|
|
309
|
+
// This doesn't override, it hides!
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// CORRECT - Always use override
|
|
313
|
+
protected override void OnEnable() {
|
|
314
|
+
base.OnEnable();
|
|
315
|
+
// Your code here
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Quick Reference
|
|
320
|
+
|
|
321
|
+
**Enable Diagnostics**: Select MessagingComponent in Inspector -> Enable Diagnostics
|
|
322
|
+
**Message Types**: See [Messages.cs](./Messages.cs) for all available messages
|
|
323
|
+
**Modify Behavior**: Edit handler methods in [Player.cs](./Player.cs), [Enemy.cs](./Enemy.cs), or [UIOverlay.cs](./UIOverlay.cs)
|
|
324
|
+
**Extend Scripts**: Always call `base.RegisterMessageHandlers()` and other `base.*` methods
|