com.wallstop-studios.dxmessaging 2.1.0 → 2.1.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/Docs/Comparisons.md +4 -4
- package/Docs/EmitShorthands.md +2 -2
- package/Docs/Helpers.md +90 -75
- package/Docs/Patterns.md +1 -1
- package/Docs/Performance.md +9 -9
- package/Docs/QuickStart.md +1 -2
- package/Runtime/Core/Attributes/DxAutoConstructorAttribute.cs +1 -1
- package/Runtime/Core/Attributes/DxBroadcastMessageAttribute.cs +1 -1
- package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs +1 -1
- package/Runtime/Core/Attributes/DxTargetedMessageAttribute.cs +1 -1
- package/Runtime/Core/Attributes/DxUntargetedMessageAttribute.cs +1 -1
- package/Runtime/Core/Messages/IBroadcastMessage.cs +1 -1
- package/Runtime/Core/Messages/ITargetedMessage.cs +1 -1
- package/Runtime/Core/Messages/IUntargetedMessage.cs +1 -1
- package/Runtime/Unity/MessagingComponent.cs +11 -7
- package/Samples~/DI/Reflex/SampleInstaller.cs +6 -6
- package/Samples~/DI/VContainer/SampleLifetimeScope.cs +7 -9
- package/Samples~/DI/Zenject/SampleInstaller.cs +6 -8
- package/package.json +1 -1
- package/package-lock.json.meta +0 -7
package/Docs/Comparisons.md
CHANGED
|
@@ -34,10 +34,10 @@ These sections are auto-updated by the PlayMode comparison benchmarks in `Tests/
|
|
|
34
34
|
|
|
35
35
|
| Message Tech | Operations / Second | Allocations? |
|
|
36
36
|
| ---------------------------------- | ------------------- | ------------ |
|
|
37
|
-
| DxMessaging (Untargeted) - No-Copy | 14,
|
|
38
|
-
| UniRx MessageBroker |
|
|
39
|
-
| MessagePipe (Global) | 96,
|
|
40
|
-
| Zenject SignalBus | 2,
|
|
37
|
+
| DxMessaging (Untargeted) - No-Copy | 14,740,000 | No |
|
|
38
|
+
| UniRx MessageBroker | 17,858,000 | No |
|
|
39
|
+
| MessagePipe (Global) | 96,052,000 | No |
|
|
40
|
+
| Zenject SignalBus | 2,632,000 | Yes |
|
|
41
41
|
|
|
42
42
|
### Comparisons (macOS)
|
|
43
43
|
|
package/Docs/EmitShorthands.md
CHANGED
|
@@ -70,10 +70,10 @@ public sealed class ScoreReporter
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
[DxUntargetedMessage]
|
|
73
|
-
|
|
73
|
+
[DxAutoConstructor]
|
|
74
|
+
public readonly partial struct ScoreChanged
|
|
74
75
|
{
|
|
75
76
|
public readonly int Value;
|
|
76
|
-
public ScoreChanged(int value) => Value = value;
|
|
77
77
|
}
|
|
78
78
|
```
|
|
79
79
|
|
package/Docs/Helpers.md
CHANGED
|
@@ -186,34 +186,32 @@ public readonly partial struct ComplexMessage
|
|
|
186
186
|
|
|
187
187
|
## Why Use Attributes Instead of Manual Implementation
|
|
188
188
|
|
|
189
|
-
###
|
|
189
|
+
### ✅ Attribute Definition (Clean, Automatic)
|
|
190
190
|
|
|
191
191
|
```csharp
|
|
192
|
-
|
|
192
|
+
[DxTargetedMessage]
|
|
193
|
+
[DxAutoConstructor]
|
|
194
|
+
public readonly partial struct Heal
|
|
193
195
|
{
|
|
194
196
|
public readonly int amount;
|
|
195
|
-
|
|
196
|
-
// You write this yourself (boring!)
|
|
197
|
-
public Heal(int amount)
|
|
198
|
-
{
|
|
199
|
-
this.amount = amount;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// Required plumbing (easy to mess up!)
|
|
203
|
-
public Type MessageType => typeof(Heal);
|
|
204
197
|
}
|
|
205
198
|
```
|
|
206
199
|
|
|
207
|
-
###
|
|
200
|
+
### What the generator emits (for reference)
|
|
208
201
|
|
|
209
202
|
```csharp
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
public readonly partial struct Heal
|
|
203
|
+
// Auto-generated by DxMessaging (no need to hand-write this)
|
|
204
|
+
public readonly partial struct Heal : ITargetedMessage<Heal>
|
|
213
205
|
{
|
|
214
206
|
public readonly int amount;
|
|
207
|
+
|
|
208
|
+
public Heal(int amount)
|
|
209
|
+
{
|
|
210
|
+
this.amount = amount;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
public Type MessageType => typeof(Heal);
|
|
215
214
|
}
|
|
216
|
-
// Constructor and plumbing generated automatically!
|
|
217
215
|
```
|
|
218
216
|
|
|
219
217
|
#### Benefits
|
|
@@ -223,14 +221,28 @@ public readonly partial struct Heal
|
|
|
223
221
|
- ✅ **Cleaner** - Focus on data, not boilerplate
|
|
224
222
|
- ✅ **Refactor-safe** - Add field? Constructor updates automatically!
|
|
225
223
|
|
|
226
|
-
## Complete Example:
|
|
224
|
+
## Complete Example: Attribute Definition vs Generated Output
|
|
227
225
|
|
|
228
|
-
###
|
|
226
|
+
### Attribute Definition (8 lines)
|
|
229
227
|
|
|
230
228
|
```csharp
|
|
231
|
-
using DxMessaging.Core.
|
|
229
|
+
using DxMessaging.Core.Attributes;
|
|
232
230
|
|
|
233
|
-
|
|
231
|
+
[DxBroadcastMessage]
|
|
232
|
+
[DxAutoConstructor]
|
|
233
|
+
public readonly partial struct PlayerDamaged
|
|
234
|
+
{
|
|
235
|
+
public readonly int amount;
|
|
236
|
+
public readonly string damageType;
|
|
237
|
+
public readonly GameObject source;
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Generated Output (20 lines you never write)
|
|
242
|
+
|
|
243
|
+
```csharp
|
|
244
|
+
// Auto-generated by DxMessaging (for reference only)
|
|
245
|
+
public readonly partial struct PlayerDamaged : IBroadcastMessage<PlayerDamaged>
|
|
234
246
|
{
|
|
235
247
|
public readonly int amount;
|
|
236
248
|
public readonly string damageType;
|
|
@@ -247,65 +259,76 @@ public readonly struct PlayerDamaged : IBroadcastMessage<PlayerDamaged>
|
|
|
247
259
|
}
|
|
248
260
|
```
|
|
249
261
|
|
|
250
|
-
###
|
|
262
|
+
### Result
|
|
251
263
|
|
|
252
|
-
|
|
253
|
-
|
|
264
|
+
- ✅ Same functionality
|
|
265
|
+
- ✅ Less code to maintain
|
|
266
|
+
- ✅ Automatically updates when you add/remove fields
|
|
267
|
+
- ✅ Works for class messages too
|
|
268
|
+
- ✅ Zero effort once you mark the struct partial
|
|
254
269
|
|
|
255
|
-
|
|
270
|
+
## Advanced: Manual Implementation (When Attributes Aren't Enough)
|
|
271
|
+
|
|
272
|
+
Attributes cover almost every scenario. If you intentionally drop `[DxTargetedMessage]`, `[DxUntargetedMessage]`, or `[DxBroadcastMessage]`, you'll need to hand-write the interface implementations and constructors shown in the “generated output” examples. Keep the attributes unless you have a very specific data-backed reason not to.
|
|
273
|
+
|
|
274
|
+
### Generic Message Interfaces (Zero-Boxing for Structs)
|
|
275
|
+
|
|
276
|
+
`readonly struct` messages marked with the attributes already implement the generic interfaces, so emissions stay allocation-free. You get the same performance characteristics as the manual approach without writing any plumbing.
|
|
277
|
+
|
|
278
|
+
```csharp
|
|
279
|
+
[DxTargetedMessage]
|
|
256
280
|
[DxAutoConstructor]
|
|
257
|
-
public readonly partial struct
|
|
281
|
+
public readonly partial struct Heal
|
|
258
282
|
{
|
|
259
283
|
public readonly int amount;
|
|
260
|
-
public readonly string damageType;
|
|
261
|
-
public readonly GameObject source;
|
|
262
284
|
}
|
|
263
285
|
```
|
|
264
286
|
|
|
265
|
-
|
|
287
|
+
### "Do I HAVE to use attributes?"
|
|
266
288
|
|
|
267
|
-
|
|
289
|
+
Technically no—but without them you must write the constructor, interface implementation, and `MessageType` property yourself (for speed, you can optionally leave this off, but it might box on certain call paths). Leaving the attributes on keeps everything consistent for the whole team.
|
|
268
290
|
|
|
269
|
-
|
|
291
|
+
```csharp
|
|
292
|
+
[DxUntargetedMessage]
|
|
293
|
+
[DxAutoConstructor]
|
|
294
|
+
public readonly partial struct MyMsg { }
|
|
295
|
+
```
|
|
270
296
|
|
|
271
|
-
###
|
|
297
|
+
### "What if I want custom constructor logic?"
|
|
272
298
|
|
|
273
|
-
|
|
299
|
+
Keep the attributes and add a factory/helper so you still benefit from the generated constructor:
|
|
274
300
|
|
|
275
301
|
```csharp
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
public readonly struct
|
|
302
|
+
[DxUntargetedMessage]
|
|
303
|
+
[DxAutoConstructor]
|
|
304
|
+
public readonly partial struct ComplexMessage
|
|
279
305
|
{
|
|
280
|
-
public readonly int
|
|
306
|
+
public readonly int value;
|
|
281
307
|
|
|
282
|
-
public
|
|
308
|
+
public static ComplexMessage FromRaw(int rawValue)
|
|
283
309
|
{
|
|
284
|
-
|
|
310
|
+
int clamped = Math.Clamp(rawValue, 0, 100);
|
|
311
|
+
return new ComplexMessage(clamped);
|
|
285
312
|
}
|
|
286
|
-
|
|
287
|
-
// Required for IMessage
|
|
288
|
-
public Type MessageType => typeof(Heal);
|
|
289
313
|
}
|
|
290
314
|
```
|
|
291
315
|
|
|
292
|
-
|
|
316
|
+
If you truly must write a custom constructor, drop `[DxAutoConstructor]` for that type but keep the `[DxUntargetedMessage]`/`[DxTargetedMessage]` attribute so the interface plumbing stays consistent.
|
|
293
317
|
|
|
294
|
-
|
|
295
|
-
- Provides stable `MessageType` without `GetType()` calls
|
|
296
|
-
- Same performance as attribute-based approach
|
|
318
|
+
### "Can I mix attribute-based and manual messages?"
|
|
297
319
|
|
|
298
|
-
|
|
320
|
+
Yes. Attribute-driven messages happily coexist with string messages and any manual implementations you already have. You can migrate gradually by converting one message at a time:
|
|
299
321
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
322
|
+
```csharp
|
|
323
|
+
[DxUntargetedMessage]
|
|
324
|
+
[DxAutoConstructor]
|
|
325
|
+
public readonly partial struct MessageA
|
|
326
|
+
{
|
|
327
|
+
public readonly int value;
|
|
328
|
+
}
|
|
305
329
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
- Easier to maintain
|
|
330
|
+
// Existing manual message types keep working alongside attribute-driven ones.
|
|
331
|
+
```
|
|
309
332
|
|
|
310
333
|
## Extension Methods (Emit Helpers)
|
|
311
334
|
|
|
@@ -549,50 +572,42 @@ public readonly partial struct MyMessage : IUntargetedMessage<MyMessage>
|
|
|
549
572
|
|
|
550
573
|
### "What if I want custom constructor logic?"
|
|
551
574
|
|
|
552
|
-
|
|
575
|
+
Keep the attributes and wrap the generated constructor with a helper so you can inject custom logic without losing the source-generated plumbing:
|
|
553
576
|
|
|
554
577
|
```csharp
|
|
555
|
-
|
|
578
|
+
[DxUntargetedMessage]
|
|
579
|
+
[DxAutoConstructor]
|
|
580
|
+
public readonly partial struct ComplexMessage
|
|
556
581
|
{
|
|
557
582
|
public readonly int value;
|
|
558
583
|
|
|
559
|
-
public ComplexMessage(int rawValue)
|
|
584
|
+
public static ComplexMessage FromRaw(int rawValue)
|
|
560
585
|
{
|
|
561
|
-
|
|
562
|
-
|
|
586
|
+
int clamped = Math.Clamp(rawValue, 0, 100);
|
|
587
|
+
return new ComplexMessage(clamped);
|
|
563
588
|
}
|
|
564
|
-
|
|
565
|
-
public Type MessageType => typeof(ComplexMessage);
|
|
566
589
|
}
|
|
567
590
|
```
|
|
568
591
|
|
|
592
|
+
If you truly need to hand-craft the constructor, drop `[DxAutoConstructor]` for that specific type but keep the `[DxUntargetedMessage]`/`[DxTargetedMessage]` attribute so the interface implementation is still generated.
|
|
593
|
+
|
|
569
594
|
### "Do attributes affect runtime performance?"
|
|
570
595
|
|
|
571
596
|
**No!** Source generation happens at **compile time**. Generated code is identical to hand-written code. Zero runtime overhead.
|
|
572
597
|
|
|
573
598
|
### "Can I mix attributes and manual implementation?"
|
|
574
599
|
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
- Some messages using attributes
|
|
578
|
-
- Other messages using manual implementation
|
|
579
|
-
- Mix and match across your codebase
|
|
600
|
+
Yes. Attribute-driven messages happily coexist with any legacy manual messages or string messages you already emit. Convert types gradually—one message at a time:
|
|
580
601
|
|
|
581
602
|
```csharp
|
|
582
|
-
// Message A: Attributes
|
|
583
603
|
[DxUntargetedMessage]
|
|
584
604
|
[DxAutoConstructor]
|
|
585
|
-
public readonly partial struct MessageA
|
|
586
|
-
|
|
587
|
-
// Message B: Manual
|
|
588
|
-
public readonly struct MessageB : IUntargetedMessage<MessageB>
|
|
605
|
+
public readonly partial struct MessageA
|
|
589
606
|
{
|
|
590
607
|
public readonly int value;
|
|
591
|
-
public MessageB(int value) { this.value = value; }
|
|
592
|
-
public Type MessageType => typeof(MessageB);
|
|
593
608
|
}
|
|
594
609
|
|
|
595
|
-
//
|
|
610
|
+
// Existing manual messages keep working alongside attribute-driven ones.
|
|
596
611
|
```
|
|
597
612
|
|
|
598
613
|
## Troubleshooting Source Generators
|
|
@@ -609,7 +624,7 @@ public readonly struct MessageB : IUntargetedMessage<MessageB>
|
|
|
609
624
|
##### Fix
|
|
610
625
|
|
|
611
626
|
```csharp
|
|
612
|
-
// ❌ Missing partial
|
|
627
|
+
// ❌ Missing partial, will not compile
|
|
613
628
|
[DxAutoConstructor]
|
|
614
629
|
public readonly struct MyMsg { }
|
|
615
630
|
|
package/Docs/Patterns.md
CHANGED
|
@@ -874,7 +874,7 @@ public class GameEvent : ScriptableObject
|
|
|
874
874
|
|
|
875
875
|
// DxMessaging message (modern, type-safe)
|
|
876
876
|
[DxUntargetedMessage]
|
|
877
|
-
public readonly struct SceneTransitionRequested { }
|
|
877
|
+
public readonly partial struct SceneTransitionRequested { }
|
|
878
878
|
|
|
879
879
|
// Bridge: SOA Event → DxMessaging
|
|
880
880
|
public class SOAEventBridge : MonoBehaviour
|
package/Docs/Performance.md
CHANGED
|
@@ -14,15 +14,15 @@ See also: `Docs/DesignAndArchitecture.md#performance-optimizations` for design d
|
|
|
14
14
|
|
|
15
15
|
| Message Tech | Operations / Second | Allocations? |
|
|
16
16
|
| ---------------------------------- | ------------------- | ------------ |
|
|
17
|
-
| Unity | 2,
|
|
18
|
-
| DxMessaging (GameObject) - Normal | 8,
|
|
19
|
-
| DxMessaging (Component) - Normal | 8,
|
|
20
|
-
| DxMessaging (GameObject) - No-Copy | 9,
|
|
21
|
-
| DxMessaging (Component) - No-Copy | 9,
|
|
22
|
-
| DxMessaging (Untargeted) - No-Copy | 14,
|
|
23
|
-
| Reflexive (One Argument) | 2,
|
|
24
|
-
| Reflexive (Two Arguments) | 2,
|
|
25
|
-
| Reflexive (Three Arguments) | 2,
|
|
17
|
+
| Unity | 2,628,000 | Yes |
|
|
18
|
+
| DxMessaging (GameObject) - Normal | 8,208,000 | No |
|
|
19
|
+
| DxMessaging (Component) - Normal | 8,210,000 | No |
|
|
20
|
+
| DxMessaging (GameObject) - No-Copy | 9,412,000 | No |
|
|
21
|
+
| DxMessaging (Component) - No-Copy | 9,354,000 | No |
|
|
22
|
+
| DxMessaging (Untargeted) - No-Copy | 14,812,000 | No |
|
|
23
|
+
| Reflexive (One Argument) | 2,856,000 | No |
|
|
24
|
+
| Reflexive (Two Arguments) | 2,372,000 | No |
|
|
25
|
+
| Reflexive (Three Arguments) | 2,382,000 | No |
|
|
26
26
|
|
|
27
27
|
## macOS
|
|
28
28
|
|
package/Docs/QuickStart.md
CHANGED
|
@@ -60,8 +60,7 @@ public readonly partial struct TookDamage
|
|
|
60
60
|
public readonly int amount;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
// Performance option:
|
|
64
|
-
// public readonly struct Heal : ITargetedMessage<Heal> { public readonly int amount; public Heal(int amount) { this.amount = amount; } }
|
|
63
|
+
// Performance option: keep [DxTargetedMessage] on a readonly struct to stay zero-boxing friendly, and drop [DxAutoConstructor] only if you need custom constructor logic.
|
|
65
64
|
|
|
66
65
|
// Optional parameters with custom defaults
|
|
67
66
|
[DxTargetedMessage]
|
|
@@ -14,7 +14,7 @@ namespace DxMessaging.Core.Attributes
|
|
|
14
14
|
/// <code>
|
|
15
15
|
/// [DxMessaging.Core.Attributes.DxUntargetedMessage]
|
|
16
16
|
/// [DxMessaging.Core.Attributes.DxAutoConstructor]
|
|
17
|
-
/// public readonly struct VideoSettingsChanged
|
|
17
|
+
/// public readonly partial struct VideoSettingsChanged
|
|
18
18
|
/// {
|
|
19
19
|
/// public readonly int width;
|
|
20
20
|
/// public readonly int height;
|
|
@@ -13,7 +13,7 @@ namespace DxMessaging.Core.Attributes
|
|
|
13
13
|
/// <example>
|
|
14
14
|
/// <code>
|
|
15
15
|
/// [DxMessaging.Core.Attributes.DxBroadcastMessage]
|
|
16
|
-
/// public readonly struct TookDamage
|
|
16
|
+
/// public readonly partial struct TookDamage
|
|
17
17
|
/// {
|
|
18
18
|
/// public readonly int amount;
|
|
19
19
|
/// public TookDamage(int amount) { this.amount = amount; }
|
|
@@ -12,7 +12,7 @@ namespace DxMessaging.Core.Attributes
|
|
|
12
12
|
/// <example>
|
|
13
13
|
/// <code>
|
|
14
14
|
/// [DxAutoConstructor]
|
|
15
|
-
/// public readonly struct Example
|
|
15
|
+
/// public readonly partial struct Example
|
|
16
16
|
/// {
|
|
17
17
|
/// public readonly int required;
|
|
18
18
|
/// [DxOptionalParameter] public readonly int optional; // defaults to 0
|
|
@@ -14,7 +14,7 @@ namespace DxMessaging.Core.Attributes
|
|
|
14
14
|
/// <example>
|
|
15
15
|
/// <code>
|
|
16
16
|
/// [DxMessaging.Core.Attributes.DxTargetedMessage]
|
|
17
|
-
/// public readonly struct HealRequest
|
|
17
|
+
/// public readonly partial struct HealRequest
|
|
18
18
|
/// {
|
|
19
19
|
/// public readonly int amount;
|
|
20
20
|
/// public HealRequest(int amount) { this.amount = amount; }
|
|
@@ -14,7 +14,7 @@ namespace DxMessaging.Core.Attributes
|
|
|
14
14
|
/// <example>
|
|
15
15
|
/// <code>
|
|
16
16
|
/// [DxMessaging.Core.Attributes.DxUntargetedMessage]
|
|
17
|
-
/// public readonly struct WorldRegenerated
|
|
17
|
+
/// public readonly partial struct WorldRegenerated
|
|
18
18
|
/// {
|
|
19
19
|
/// public readonly int seed;
|
|
20
20
|
/// public WorldRegenerated(int seed) { this.seed = seed; }
|
|
@@ -25,7 +25,7 @@ namespace DxMessaging.Core.Messages
|
|
|
25
25
|
/// // Attribute + auto constructor
|
|
26
26
|
/// [DxMessaging.Core.Attributes.DxBroadcastMessage]
|
|
27
27
|
/// [DxMessaging.Core.Attributes.DxAutoConstructor]
|
|
28
|
-
/// public readonly struct PickedUpItem { public readonly int itemId; }
|
|
28
|
+
/// public readonly partial struct PickedUpItem { public readonly int itemId; }
|
|
29
29
|
/// </code>
|
|
30
30
|
/// </example>
|
|
31
31
|
public interface IBroadcastMessage : IMessage { }
|
|
@@ -26,7 +26,7 @@ namespace DxMessaging.Core.Messages
|
|
|
26
26
|
/// // Attribute form with auto constructor
|
|
27
27
|
/// [DxMessaging.Core.Attributes.DxTargetedMessage]
|
|
28
28
|
/// [DxMessaging.Core.Attributes.DxAutoConstructor]
|
|
29
|
-
/// public readonly struct EquipWeapon { public readonly int weaponId; }
|
|
29
|
+
/// public readonly partial struct EquipWeapon { public readonly int weaponId; }
|
|
30
30
|
/// </code>
|
|
31
31
|
/// </example>
|
|
32
32
|
public interface ITargetedMessage : IMessage { }
|
|
@@ -26,7 +26,7 @@ namespace DxMessaging.Core.Messages
|
|
|
26
26
|
/// // Or with attribute + DxAutoConstructor
|
|
27
27
|
/// [DxMessaging.Core.Attributes.DxUntargetedMessage]
|
|
28
28
|
/// [DxMessaging.Core.Attributes.DxAutoConstructor]
|
|
29
|
-
/// public readonly struct WorldRegenerated { public readonly int seed; }
|
|
29
|
+
/// public readonly partial struct WorldRegenerated { public readonly int seed; }
|
|
30
30
|
/// </code>
|
|
31
31
|
/// </example>
|
|
32
32
|
public interface IUntargetedMessage : IMessage { }
|
|
@@ -72,10 +72,10 @@ namespace DxMessaging.Unity
|
|
|
72
72
|
throw new ArgumentNullException(nameof(listener));
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
if (gameObject
|
|
75
|
+
if (gameObject != listener.gameObject)
|
|
76
76
|
{
|
|
77
77
|
throw new ArgumentException(
|
|
78
|
-
$"Cannot create a RegistrationToken without
|
|
78
|
+
$"Cannot create a RegistrationToken without a mismatched owner. {listener.gameObject} != existing {gameObject}."
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -86,11 +86,15 @@ namespace DxMessaging.Unity
|
|
|
86
86
|
)
|
|
87
87
|
)
|
|
88
88
|
{
|
|
89
|
-
MessagingDebug.
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
if (MessagingDebug.enabled)
|
|
90
|
+
{
|
|
91
|
+
MessagingDebug.Log(
|
|
92
|
+
LogLevel.Warn,
|
|
93
|
+
"Ignoring double RegistrationToken request for {0}.",
|
|
94
|
+
listener
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
94
98
|
return createdToken;
|
|
95
99
|
}
|
|
96
100
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
namespace DxMessaging.Samples.DI.Reflex
|
|
3
3
|
{
|
|
4
4
|
using DxMessaging.Core;
|
|
5
|
+
using DxMessaging.Core.Attributes;
|
|
5
6
|
using DxMessaging.Core.MessageBus;
|
|
6
7
|
using DxMessaging.Core.Messages;
|
|
7
8
|
using DxMessaging.Unity.Integrations.Reflex;
|
|
@@ -61,14 +62,13 @@ namespace DxMessaging.Samples.DI.Reflex
|
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
[DxBroadcastMessage]
|
|
66
|
+
[DxAutoConstructor]
|
|
67
|
+
private readonly partial struct PlayerAlert
|
|
65
68
|
{
|
|
66
|
-
public
|
|
67
|
-
{
|
|
68
|
-
Source = source;
|
|
69
|
-
}
|
|
69
|
+
public readonly InstanceId source;
|
|
70
70
|
|
|
71
|
-
public InstanceId Source
|
|
71
|
+
public InstanceId Source => source;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
namespace DxMessaging.Samples.DI.VContainer
|
|
3
3
|
{
|
|
4
4
|
using System;
|
|
5
|
-
using Core.Attributes;
|
|
6
|
-
using Core.Extensions;
|
|
7
|
-
using Core.MessageBus;
|
|
5
|
+
using DxMessaging.Core.Attributes;
|
|
6
|
+
using DxMessaging.Core.Extensions;
|
|
7
|
+
using DxMessaging.Core.MessageBus;
|
|
8
8
|
using DxMessaging.Unity.Integrations.VContainer;
|
|
9
9
|
using UnityEngine;
|
|
10
10
|
using VContainer;
|
|
@@ -25,14 +25,12 @@ namespace DxMessaging.Samples.DI.VContainer
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
[DxUntargetedMessage]
|
|
28
|
-
|
|
28
|
+
[DxAutoConstructor]
|
|
29
|
+
private readonly partial struct ScoreUpdated
|
|
29
30
|
{
|
|
30
|
-
public readonly int
|
|
31
|
+
public readonly int value;
|
|
31
32
|
|
|
32
|
-
public
|
|
33
|
-
{
|
|
34
|
-
Value = value;
|
|
35
|
-
}
|
|
33
|
+
public int Value => value;
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
private sealed class ScoreboardService : IStartable, ITickable, IDisposable
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
namespace DxMessaging.Samples.DI.Zenject
|
|
3
3
|
{
|
|
4
4
|
using System;
|
|
5
|
-
using Core.Attributes;
|
|
6
|
-
using Core.MessageBus;
|
|
5
|
+
using DxMessaging.Core.Attributes;
|
|
6
|
+
using DxMessaging.Core.MessageBus;
|
|
7
7
|
using UnityEngine;
|
|
8
8
|
using Zenject;
|
|
9
9
|
|
|
@@ -20,14 +20,12 @@ namespace DxMessaging.Samples.DI.Zenject
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
[DxUntargetedMessage]
|
|
23
|
-
|
|
23
|
+
[DxAutoConstructor]
|
|
24
|
+
private readonly partial struct PlayerSpawned
|
|
24
25
|
{
|
|
25
|
-
public readonly string
|
|
26
|
+
public readonly string playerName;
|
|
26
27
|
|
|
27
|
-
public
|
|
28
|
-
{
|
|
29
|
-
PlayerName = playerName;
|
|
30
|
-
}
|
|
28
|
+
public string PlayerName => playerName;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
private sealed class PlayerSpawnTracker : IInitializable, IDisposable
|
package/package.json
CHANGED