com.wallstop-studios.dxmessaging 2.0.0-rc27.3.1 → 2.0.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.
- package/Docs/Comparisons.md +194 -66
- package/Docs/GettingStarted.md +84 -17
- package/Docs/Overview.md +114 -20
- package/Docs/Patterns.md +41 -2
- package/Docs/Performance.md +9 -9
- package/Docs/VisualGuide.md +75 -10
- package/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.dll +0 -0
- package/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.dll.meta +3 -3
- package/Editor/Analyzers/Microsoft.CodeAnalysis.dll +0 -0
- package/Editor/Analyzers/Microsoft.CodeAnalysis.dll.meta +2 -2
- package/Editor/Analyzers/System.Collections.Immutable.dll +0 -0
- package/Editor/Analyzers/System.Reflection.Metadata.dll +0 -0
- package/Editor/Analyzers/System.Runtime.CompilerServices.Unsafe.dll +0 -0
- package/README.md +262 -63
- package/Samples~/Mini Combat/README.md +81 -21
- package/Samples~/Mini Combat/Walkthrough.md +23 -1
- package/Samples~/UI Buttons + Inspector/README.md +55 -12
- package/Tests/Runtime/Core/SourceGeneratorNestedTests.cs +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,79 @@
|
|
|
1
1
|
# Mini Combat Sample
|
|
2
2
|
|
|
3
|
-
> **
|
|
3
|
+
> **Perfect for:** First-time users who want to see messaging in action with a working combat example
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What You'll Learn in 10 Minutes
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Stop reading documentation and start seeing it work!** This sample shows:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
1. How Player heals without UI knowing about Player (**zero coupling**)
|
|
10
|
+
2. How Enemy broadcasts damage without knowing who cares (**observer pattern**)
|
|
11
|
+
3. How settings changes update everything automatically (**global events**)
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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).EmitBroadcast(this);
|
|
43
|
+
// Done! UI, audio, analytics all react automatically.
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
###### Zero coupling. Zero manual wiring. That's the power of messaging.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Key Concepts (3 Message Types)
|
|
53
|
+
|
|
54
|
+
### 1. Untargeted - "Everyone, listen up!"
|
|
55
|
+
|
|
56
|
+
**Example:** Game settings changed
|
|
57
|
+
|
|
58
|
+
- Like a stadium announcement - everyone hears it
|
|
59
|
+
- No specific target
|
|
60
|
+
- Perfect for: settings, pause, scene transitions
|
|
61
|
+
|
|
62
|
+
### 2. Targeted - "Hey YOU, do this!"
|
|
63
|
+
|
|
64
|
+
**Example:** Heal this specific player
|
|
65
|
+
|
|
66
|
+
- Like mailing a letter to one address
|
|
67
|
+
- Only the target receives it
|
|
68
|
+
- Perfect for: commands, direct actions
|
|
69
|
+
|
|
70
|
+
### 3. Broadcast - "I did something!"
|
|
71
|
+
|
|
72
|
+
**Example:** Enemy took damage
|
|
73
|
+
|
|
74
|
+
- Like ringing a bell - anyone nearby can hear
|
|
75
|
+
- Source announces, observers react
|
|
76
|
+
- Perfect for: events, notifications, analytics
|
|
14
77
|
|
|
15
78
|
---
|
|
16
79
|
|
|
@@ -28,25 +91,22 @@ Here's what each script does:
|
|
|
28
91
|
|
|
29
92
|
---
|
|
30
93
|
|
|
31
|
-
## Quick Start Guide
|
|
94
|
+
## Quick Start Guide (2 Minutes to Working Demo)
|
|
32
95
|
|
|
33
|
-
###
|
|
96
|
+
### Import & Run (Fastest Way)
|
|
34
97
|
|
|
35
|
-
|
|
36
|
-
- Window → Package Manager
|
|
98
|
+
#### Want to see it work immediately?
|
|
37
99
|
|
|
38
|
-
1. **
|
|
39
|
-
|
|
40
|
-
|
|
100
|
+
1. **Open Package Manager**: Window → Package Manager
|
|
101
|
+
2. **Find DxMessaging** in the package list
|
|
102
|
+
3. **Scroll to Samples** section → Find "Mini Combat" → Click **Import**
|
|
103
|
+
4. **Navigate to** Assets/Samples/DxMessaging/.../Mini Combat/
|
|
104
|
+
5. **Open the scene**
|
|
105
|
+
6. **Press Play** 🎮
|
|
41
106
|
|
|
42
|
-
|
|
43
|
-
- In the Package Manager details view, scroll down to find the "Samples" section
|
|
44
|
-
- Find "Mini Combat" and click **Import**
|
|
45
|
-
- The sample files will be imported into your Assets/Samples folder
|
|
107
|
+
**That's it!** Watch the Console logs as messages flow.
|
|
46
108
|
|
|
47
|
-
|
|
48
|
-
- Navigate to Assets/Samples/DxMessaging/.../Mini Combat/
|
|
49
|
-
- Open the sample scene or create a new scene and follow Step 1 below
|
|
109
|
+
**Pro tip:** Enable diagnostics in the Inspector (MessagingComponent → Enable Diagnostics) to see message traffic in real-time.
|
|
50
110
|
|
|
51
111
|
### Method 2: Manual Setup in Your Scene
|
|
52
112
|
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
# Mini Combat Walkthrough
|
|
2
2
|
|
|
3
|
-
> **Deep Dive**:
|
|
3
|
+
> **Deep Dive**: Ready to understand HOW it works? This walkthrough explains every line of code and shows the complete message flow.
|
|
4
|
+
|
|
5
|
+
## Who This Is For
|
|
6
|
+
|
|
7
|
+
- ✅ **You've imported and run the sample** - now you want to understand it
|
|
8
|
+
- ✅ **You want to build your own** - need to see the patterns in action
|
|
9
|
+
- ✅ **You're debugging something** - need to understand the flow
|
|
10
|
+
|
|
11
|
+
**Haven't run the sample yet?** Go back to [the sample README](README.md) and press Play first. Come back when you've seen it work.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## What You'll Understand By The End
|
|
16
|
+
|
|
17
|
+
After reading this walkthrough, you'll know:
|
|
18
|
+
|
|
19
|
+
1. **Why each message type was chosen** - the reasoning behind Untargeted vs Targeted vs Broadcast
|
|
20
|
+
2. **How the code flows** - step-by-step from Boot.cs through every script
|
|
21
|
+
3. **Common patterns** - Observer, Broadcaster, Orchestrator, and more
|
|
22
|
+
4. **Debugging strategies** - how to find and fix issues
|
|
23
|
+
5. **How to extend it** - add your own messages and handlers
|
|
24
|
+
|
|
25
|
+
**Estimated time:** 20-30 minutes for thorough understanding
|
|
4
26
|
|
|
5
27
|
---
|
|
6
28
|
|
|
@@ -1,21 +1,64 @@
|
|
|
1
|
-
# UI Buttons + Inspector
|
|
1
|
+
# UI Buttons + Inspector Sample
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Perfect for:** Seeing DxMessaging work with Unity UI in 60 seconds
|
|
4
4
|
|
|
5
|
-
## What You
|
|
5
|
+
## What You'll Learn (No Code Required!)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- How to observe messages in the Console with a tiny listener component.
|
|
9
|
-
- How to turn on diagnostics to see message traffic while you click.
|
|
7
|
+
**Stop writing button click handlers!** This sample shows you how to:
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
1. **Wire UI Buttons to messages** - directly from the Inspector (drag & drop)
|
|
10
|
+
2. **See messages flow in real-time** - watch the Console as you click
|
|
11
|
+
3. **Enable diagnostics** - see every message with timestamps and payloads
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
1. Select `com.wallstop-studios.dxmessaging`.
|
|
15
|
-
1. In Samples, import “UI Buttons + Inspector”.
|
|
16
|
-
1. Open the sample scene (created under your project’s `Assets/Samples/...`).
|
|
13
|
+
**Why this matters:** You can add new systems (analytics, audio, achievements) that react to button clicks WITHOUT touching existing code.
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## The Power Move
|
|
18
|
+
|
|
19
|
+
### Before DxMessaging:
|
|
20
|
+
|
|
21
|
+
```csharp
|
|
22
|
+
public class PlayButton : MonoBehaviour {
|
|
23
|
+
[SerializeField] private GameManager gameManager; // Coupling
|
|
24
|
+
[SerializeField] private AudioManager audio; // Coupling
|
|
25
|
+
[SerializeField] private Analytics analytics; // Coupling
|
|
26
|
+
|
|
27
|
+
public void OnClick() {
|
|
28
|
+
gameManager.StartGame(); // Manual call
|
|
29
|
+
audio.PlayClickSound(); // Manual call
|
|
30
|
+
analytics.LogButtonClick(); // Manual call
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
#### Every new system = update PlayButton script. Exhausting.
|
|
36
|
+
|
|
37
|
+
##### With DxMessaging:
|
|
38
|
+
|
|
39
|
+
```csharp
|
|
40
|
+
public class PlayButton : MonoBehaviour {
|
|
41
|
+
public void OnClick() {
|
|
42
|
+
new ButtonClicked("Play").Emit();
|
|
43
|
+
// Done! Everything reacts automatically.
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
###### GameManager, Audio, and Analytics listen independently. Zero coupling.
|
|
49
|
+
|
|
50
|
+
## Import & Run (30 Seconds)
|
|
51
|
+
|
|
52
|
+
### Want to see it immediately?
|
|
53
|
+
|
|
54
|
+
1. **Window → Package Manager**
|
|
55
|
+
2. **Find DxMessaging** → Scroll to **Samples**
|
|
56
|
+
3. **"UI Buttons + Inspector"** → Click **Import**
|
|
57
|
+
4. **Navigate to** Assets/Samples/.../UI Buttons + Inspector/
|
|
58
|
+
5. **Open the scene** → **Press Play** 🎮
|
|
59
|
+
6. **Click the buttons** → Watch Console logs
|
|
60
|
+
|
|
61
|
+
**Done!** You're seeing DxMessaging in action.
|
|
19
62
|
|
|
20
63
|
## Click-To-Message: The Quick Path
|
|
21
64
|
|