com.wallstop-studios.dxmessaging 3.1.0 → 3.2.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.
Files changed (139) hide show
  1. package/CHANGELOG.md +326 -0
  2. package/Editor/Analyzers/BaseCallLogMessageParser.cs.meta +3 -3
  3. package/Editor/Analyzers/BaseCallReportAggregator.cs.meta +3 -3
  4. package/Editor/Analyzers/DxMessagingConsoleHarvester.cs +8 -8
  5. package/Editor/Analyzers/DxMessagingConsoleHarvester.cs.meta +3 -3
  6. package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs +171 -13
  7. package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs.meta +3 -3
  8. package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs +391 -96
  9. package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs.meta +3 -3
  10. package/Editor/CustomEditors/MessageAwareComponentInspectorView.cs +279 -0
  11. package/Editor/CustomEditors/MessageAwareComponentInspectorView.cs.meta +11 -0
  12. package/Editor/DxMessagingEditorPalette.cs +66 -0
  13. package/Editor/DxMessagingEditorPalette.cs.meta +11 -0
  14. package/Editor/DxMessagingEditorTheme.cs +200 -0
  15. package/Editor/DxMessagingEditorTheme.cs.meta +11 -0
  16. package/Editor/DxMessagingMenu.cs.meta +3 -3
  17. package/Editor/DxMessagingSceneBuildProcessor.cs.meta +3 -3
  18. package/Editor/Icons/dxmessaging-icon-256.png +0 -0
  19. package/Editor/Icons/dxmessaging-icon-256.png.meta +156 -0
  20. package/Editor/Icons/dxmessaging-icon-32.png +0 -0
  21. package/Editor/Icons/dxmessaging-icon-32.png.meta +156 -0
  22. package/Editor/Icons/dxmessaging-icon-48.png +0 -0
  23. package/Editor/Icons/dxmessaging-icon-48.png.meta +156 -0
  24. package/Editor/Icons.meta +8 -0
  25. package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs +2 -3
  26. package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs.meta +3 -3
  27. package/Editor/Settings/DxMessagingSettingsProvider.cs +368 -33
  28. package/Editor/SetupCscRsp.cs +232 -163
  29. package/Editor/Testing/MessagingComponentEditorHarness.cs +11 -4
  30. package/Editor/Theme/DxMessagingTheme.uss +255 -0
  31. package/Editor/Theme/DxMessagingTheme.uss.meta +11 -0
  32. package/Editor/Theme/DxTokens.uss +90 -0
  33. package/Editor/Theme/DxTokens.uss.meta +11 -0
  34. package/Editor/Theme.meta +8 -0
  35. package/Editor/Windows/DxMessagingFlowGraphWindow.cs +5513 -0
  36. package/Editor/Windows/DxMessagingFlowGraphWindow.cs.meta +11 -0
  37. package/Editor/Windows/DxMessagingMessageMonitorWindow.cs +2288 -0
  38. package/Editor/Windows/DxMessagingMessageMonitorWindow.cs.meta +11 -0
  39. package/Editor/Windows.meta +8 -0
  40. package/README.md +84 -35
  41. package/Runtime/Analyzers.meta +8 -0
  42. package/Runtime/AssemblyInfo.cs +1 -0
  43. package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs.meta +3 -3
  44. package/Runtime/Core/Diagnostics/MessageEmissionData.cs +29 -1
  45. package/Runtime/Core/DxMessagingStaticState.cs.meta +3 -3
  46. package/Runtime/Core/Extensions/MessageBusExtensions.cs.meta +3 -3
  47. package/Runtime/Core/Extensions/MessageExtensions.cs +4 -5
  48. package/Runtime/Core/Extensions/MessageExtensions.cs.meta +3 -3
  49. package/Runtime/Core/Helper/MessageCache.cs +56 -23
  50. package/Runtime/Core/IMessage.cs.meta +3 -3
  51. package/Runtime/Core/InstanceId.cs.meta +3 -3
  52. package/Runtime/Core/Internal/FlatDispatch.cs +32 -0
  53. package/Runtime/Core/Internal/TypedSlots.cs +45 -7
  54. package/Runtime/Core/MessageBus/DiagnosticsTarget.cs.meta +3 -3
  55. package/Runtime/Core/MessageBus/GlobalMessageBusProvider.cs.meta +3 -3
  56. package/Runtime/Core/MessageBus/IMessageBus.cs +63 -28
  57. package/Runtime/Core/MessageBus/IMessageBus.cs.meta +3 -3
  58. package/Runtime/Core/MessageBus/IMessageBusProvider.cs.meta +3 -3
  59. package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs.meta +3 -3
  60. package/Runtime/Core/MessageBus/MessageBus.cs +1135 -626
  61. package/Runtime/Core/MessageBus/MessageBus.cs.meta +3 -3
  62. package/Runtime/Core/MessageBus/MessageBusRebindMode.cs.meta +3 -3
  63. package/Runtime/Core/MessageBus/MessageBusRegistration.cs +207 -0
  64. package/Runtime/Core/MessageBus/MessageBusRegistration.cs.meta +11 -0
  65. package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs.meta +3 -3
  66. package/Runtime/Core/MessageBus/MessagingRegistration.cs.meta +3 -3
  67. package/Runtime/Core/MessageBus/RegistrationLog.cs +25 -12
  68. package/Runtime/Core/MessageBus/RegistrationLog.cs.meta +3 -3
  69. package/Runtime/Core/MessageHandler.cs +1886 -1082
  70. package/Runtime/Core/MessageHandler.cs.meta +3 -3
  71. package/Runtime/Core/MessageRegistrationHandle.cs +19 -5
  72. package/Runtime/Core/MessageRegistrationHandle.cs.meta +3 -3
  73. package/Runtime/Core/MessageRegistrationToken.cs +1932 -895
  74. package/Runtime/Core/MessageRegistrationToken.cs.meta +3 -3
  75. package/Runtime/Core/Messages/IBroadcastMessage.cs.meta +3 -3
  76. package/Runtime/Core/Messages/ITargetedMessage.cs.meta +3 -3
  77. package/Runtime/Core/Messages/IUntargetedMessage.cs.meta +3 -3
  78. package/Runtime/Core/Messages/SourcedStringMessage.cs.meta +3 -3
  79. package/Runtime/Core/MessagingDebug.cs.meta +3 -3
  80. package/Runtime/Unity/CurrentGlobalMessageBusProvider.cs.meta +3 -3
  81. package/Runtime/Unity/DxMessagingRuntimeInitializer.cs.meta +3 -3
  82. package/Runtime/Unity/InitialGlobalMessageBusProvider.cs.meta +3 -3
  83. package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs.meta +3 -3
  84. package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs.meta +3 -3
  85. package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs.meta +3 -3
  86. package/Runtime/Unity/MessageAwareComponent.cs.meta +3 -3
  87. package/Runtime/Unity/MessageBusProviderHandle.cs.meta +3 -3
  88. package/Runtime/Unity/MessagingComponent.cs.meta +3 -3
  89. package/Runtime/Unity/MessagingComponentInstaller.cs.meta +3 -3
  90. package/Runtime/Unity/ScriptableMessageBusProvider.cs.meta +3 -3
  91. package/Samples~/DI/Reflex/SampleInstaller.cs.meta +3 -3
  92. package/Samples~/DI/VContainer/SampleLifetimeScope.cs.meta +3 -3
  93. package/Samples~/DI/Zenject/SampleInstaller.cs.meta +3 -3
  94. package/Samples~/Diagnostics Tooling Exerciser/DiagnosticsToolingExerciser.cs +173 -0
  95. package/Samples~/Diagnostics Tooling Exerciser/DiagnosticsToolingExerciser.cs.meta +11 -0
  96. package/Samples~/Diagnostics Tooling Exerciser/DiagnosticsToolingExerciser.unity +424 -0
  97. package/Samples~/Diagnostics Tooling Exerciser/DiagnosticsToolingExerciser.unity.meta +7 -0
  98. package/Samples~/Diagnostics Tooling Exerciser/DiagnosticsToolingReceiver.cs +185 -0
  99. package/Samples~/Diagnostics Tooling Exerciser/DiagnosticsToolingReceiver.cs.meta +11 -0
  100. package/Samples~/Diagnostics Tooling Exerciser/Messages.cs +46 -0
  101. package/Samples~/Diagnostics Tooling Exerciser/Messages.cs.meta +11 -0
  102. package/Samples~/Diagnostics Tooling Exerciser/README.md +53 -0
  103. package/Samples~/Diagnostics Tooling Exerciser/README.md.meta +7 -0
  104. package/Samples~/Diagnostics Tooling Exerciser/WallstopStudios.DxMessaging.DiagnosticsToolingExerciser.Sample.asmdef +13 -0
  105. package/Samples~/Diagnostics Tooling Exerciser/WallstopStudios.DxMessaging.DiagnosticsToolingExerciser.Sample.asmdef.meta +7 -0
  106. package/Samples~/Diagnostics Tooling Exerciser.meta +8 -0
  107. package/Samples~/Mini Combat/Boot.cs.meta +3 -3
  108. package/Samples~/Mini Combat/Enemy.cs.meta +3 -3
  109. package/Samples~/Mini Combat/Messages.cs.meta +3 -3
  110. package/Samples~/Mini Combat/Player.cs.meta +3 -3
  111. package/Samples~/Mini Combat/README.md +1 -1
  112. package/Samples~/Mini Combat/UIOverlay.cs.meta +3 -3
  113. package/Samples~/Mini Combat/Walkthrough.md +3 -3
  114. package/Samples~/UI Buttons + Inspector/DiagnosticsEnabler.cs.meta +3 -3
  115. package/Samples~/UI Buttons + Inspector/Messages.cs.meta +3 -3
  116. package/Samples~/UI Buttons + Inspector/MessagingObserver.cs.meta +3 -3
  117. package/Samples~/UI Buttons + Inspector/UIButtonEmitter.cs.meta +3 -3
  118. package/SourceGenerators/Directory.Build.props +5 -5
  119. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs.meta +3 -3
  120. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj +12 -11
  121. package/docs/images/DxMessaging-banner.svg +79 -0
  122. package/docs/images/DxMessaging-banner.svg.meta +53 -0
  123. package/docs/images.meta +8 -0
  124. package/docs.meta +8 -0
  125. package/package.json +17 -5
  126. /package/{Editor → Runtime}/Analyzers/Microsoft.CodeAnalysis.CSharp.dll +0 -0
  127. /package/{Editor → Runtime}/Analyzers/Microsoft.CodeAnalysis.CSharp.dll.meta +0 -0
  128. /package/{Editor → Runtime}/Analyzers/Microsoft.CodeAnalysis.dll +0 -0
  129. /package/{Editor → Runtime}/Analyzers/Microsoft.CodeAnalysis.dll.meta +0 -0
  130. /package/{Editor → Runtime}/Analyzers/System.Collections.Immutable.dll +0 -0
  131. /package/{Editor → Runtime}/Analyzers/System.Collections.Immutable.dll.meta +0 -0
  132. /package/{Editor → Runtime}/Analyzers/System.Reflection.Metadata.dll +0 -0
  133. /package/{Editor → Runtime}/Analyzers/System.Reflection.Metadata.dll.meta +0 -0
  134. /package/{Editor → Runtime}/Analyzers/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  135. /package/{Editor → Runtime}/Analyzers/System.Runtime.CompilerServices.Unsafe.dll.meta +0 -0
  136. /package/{Editor → Runtime}/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll +0 -0
  137. /package/{Editor → Runtime}/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll.meta +0 -0
  138. /package/{Editor → Runtime}/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll +0 -0
  139. /package/{Editor → Runtime}/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll.meta +0 -0
@@ -1,10 +1,14 @@
1
1
  namespace DxMessaging.Editor.Settings
2
2
  {
3
3
  #if UNITY_EDITOR
4
+ using System;
4
5
  using System.Collections.Generic;
5
6
  using Core.MessageBus;
7
+ using DxMessaging.Editor;
6
8
  using UnityEditor;
9
+ using UnityEditor.UIElements;
7
10
  using UnityEngine;
11
+ using UnityEngine.UIElements;
8
12
 
9
13
  /// <summary>
10
14
  /// Project Settings provider for DxMessaging configuration.
@@ -14,7 +18,43 @@ namespace DxMessaging.Editor.Settings
14
18
  /// </remarks>
15
19
  public sealed class DxMessagingSettingsProvider : SettingsProvider
16
20
  {
21
+ internal const string RootClassName = "dxmessaging-settings";
22
+ internal const string SectionClassName = "dxmessaging-settings-section";
23
+ internal const string FieldClassName = "dxmessaging-settings-field";
24
+
25
+ private const string DiagnosticsSectionTitle = "Diagnostics";
26
+ private const string DiagnosticsSectionDescription =
27
+ "Controls how much message history the editor keeps when diagnostics are enabled.";
28
+ private const string DiagnosticsTargetsLabel = "Diagnostics Targets";
29
+ private const string DiagnosticsTargetsTooltip =
30
+ "Select where global diagnostics should be enabled by default.";
31
+ private const string MessageBufferSizeLabel = "Message Buffer Size";
32
+ private const string MessageBufferSizeTooltip =
33
+ "Number of emissions kept per bus/token when diagnostics mode is active.";
34
+ private const string EditorSafetySectionTitle = "Editor Safety";
35
+ private const string EditorSafetySectionDescription =
36
+ "Keeps Unity editor warnings intentional while preserving DxMessaging reset behavior.";
37
+ private const string SuppressDomainReloadWarningLabel = "Suppress Domain Reload Warning";
38
+ private const string SuppressDomainReloadWarningTooltip =
39
+ "Disable the warning shown when Enter Play Mode Options skips domain reload.";
40
+ private const string InspectorChecksSectionTitle = "Inspector Checks";
41
+ private const string InspectorChecksSectionDescription =
42
+ "Controls Inspector warnings and the optional console bridge for base-call diagnostics.";
43
+ private const string BaseCallCheckEnabledLabel = "Base-Call Check Enabled";
44
+ private const string BaseCallCheckEnabledTooltip =
45
+ "Show Inspector warnings when MessageAwareComponent overrides omit base.RegisterMessageHandlers().";
46
+ private const string UseConsoleBridgeLabel = "Use Console Bridge";
47
+ private const string UseConsoleBridgeTooltip =
48
+ "Also harvest compiler/analyzer warnings from Unity's console in addition to the IL scanner.";
49
+ private const string BaseCallIgnoredTypesLabel = "Ignored Base-Call Types";
50
+ private const string BaseCallIgnoredTypesTooltip =
51
+ "Fully-qualified MessageAwareComponent type names excluded from the Inspector overlay and base-call analyzer.";
52
+
53
+ private static readonly Color AccentColor = DxMessagingEditorPalette.Amber;
54
+ private static readonly Color SectionBorderColor = DxMessagingEditorPalette.BorderPanel;
55
+
17
56
  private SerializedObject _messagingSettings;
57
+ private bool _uiToolkitActivated;
18
58
 
19
59
  private DxMessagingSettingsProvider(
20
60
  string path,
@@ -27,12 +67,11 @@ namespace DxMessaging.Editor.Settings
27
67
  /// </summary>
28
68
  /// <param name="searchContext">Search text provided by the Project Settings window.</param>
29
69
  /// <param name="rootElement">Root visual element for UI Toolkit-based providers.</param>
30
- public override void OnActivate(
31
- string searchContext,
32
- UnityEngine.UIElements.VisualElement rootElement
33
- )
70
+ public override void OnActivate(string searchContext, VisualElement rootElement)
34
71
  {
35
72
  _messagingSettings = DxMessagingSettings.GetSerializedSettings();
73
+ BuildSettingsUi(rootElement, _messagingSettings);
74
+ _uiToolkitActivated = true;
36
75
  }
37
76
 
38
77
  /// <summary>
@@ -41,41 +80,54 @@ namespace DxMessaging.Editor.Settings
41
80
  /// <param name="searchContext">Search text provided by the Project Settings window.</param>
42
81
  public override void OnGUI(string searchContext)
43
82
  {
83
+ if (_uiToolkitActivated)
84
+ {
85
+ return;
86
+ }
87
+
88
+ _messagingSettings ??= DxMessagingSettings.GetSerializedSettings();
89
+
44
90
  float previousLabelWidth = EditorGUIUtility.labelWidth;
45
91
  EditorGUIUtility.labelWidth = 240f;
46
92
  try
47
93
  {
48
- SerializedProperty targetsProp = _messagingSettings.FindProperty(
49
- nameof(DxMessagingSettings._diagnosticsTargets)
94
+ DrawSectionHeader(DiagnosticsSectionTitle, DiagnosticsSectionDescription);
95
+ DrawDiagnosticsTargetsField(_messagingSettings);
96
+ DrawPropertyField(
97
+ _messagingSettings,
98
+ nameof(DxMessagingSettings._messageBufferSize),
99
+ MessageBufferSizeLabel,
100
+ MessageBufferSizeTooltip
50
101
  );
51
- DiagnosticsTarget currentTargets = (DiagnosticsTarget)targetsProp.enumValueFlag;
52
- DiagnosticsTarget updatedTargets = (DiagnosticsTarget)
53
- EditorGUILayout.EnumFlagsField(
54
- new GUIContent(
55
- "Diagnostics Targets",
56
- "Select where global diagnostics should be enabled by default. Combine flags for multiple targets."
57
- ),
58
- currentTargets
59
- );
60
- if (updatedTargets != currentTargets)
61
- {
62
- targetsProp.enumValueFlag = (int)updatedTargets;
63
- }
64
- EditorGUILayout.PropertyField(
65
- _messagingSettings.FindProperty(nameof(DxMessagingSettings._messageBufferSize)),
66
- new GUIContent(
67
- "Message Buffer Size",
68
- "Number of emissions kept per bus/token when diagnostics mode is active."
69
- )
102
+
103
+ DrawSectionHeader(EditorSafetySectionTitle, EditorSafetySectionDescription);
104
+ DrawPropertyField(
105
+ _messagingSettings,
106
+ nameof(DxMessagingSettings._suppressDomainReloadWarning),
107
+ SuppressDomainReloadWarningLabel,
108
+ SuppressDomainReloadWarningTooltip
70
109
  );
71
- EditorGUILayout.PropertyField(
72
- _messagingSettings.FindProperty(
73
- nameof(DxMessagingSettings._suppressDomainReloadWarning)
74
- ),
75
- new GUIContent(
76
- "Suppress Domain Reload Warning",
77
- "Disable the warning shown when Enter Play Mode Options skips domain reload; DxMessaging still resets its statics."
78
- )
110
+
111
+ DrawSectionHeader(InspectorChecksSectionTitle, InspectorChecksSectionDescription);
112
+ DrawSettingsToggle(
113
+ _messagingSettings,
114
+ nameof(DxMessagingSettings._baseCallCheckEnabled),
115
+ BaseCallCheckEnabledLabel,
116
+ BaseCallCheckEnabledTooltip,
117
+ settings => settings.BaseCallCheckEnabled
118
+ );
119
+ DrawSettingsToggle(
120
+ _messagingSettings,
121
+ nameof(DxMessagingSettings._useConsoleBridge),
122
+ UseConsoleBridgeLabel,
123
+ UseConsoleBridgeTooltip,
124
+ settings => settings.UseConsoleBridge
125
+ );
126
+ DrawPropertyField(
127
+ _messagingSettings,
128
+ nameof(DxMessagingSettings._baseCallIgnoredTypes),
129
+ BaseCallIgnoredTypesLabel,
130
+ BaseCallIgnoredTypesTooltip
79
131
  );
80
132
 
81
133
  _messagingSettings.ApplyModifiedProperties();
@@ -86,6 +138,281 @@ namespace DxMessaging.Editor.Settings
86
138
  }
87
139
  }
88
140
 
141
+ internal static void BuildSettingsUi(
142
+ VisualElement rootElement,
143
+ SerializedObject serializedSettings
144
+ )
145
+ {
146
+ if (rootElement == null)
147
+ {
148
+ throw new ArgumentNullException(nameof(rootElement));
149
+ }
150
+ if (serializedSettings == null)
151
+ {
152
+ throw new ArgumentNullException(nameof(serializedSettings));
153
+ }
154
+
155
+ rootElement.Clear();
156
+ DxMessagingEditorTheme.Apply(rootElement);
157
+ rootElement.RemoveFromClassList(DxMessagingEditorTheme.WindowClassName);
158
+ rootElement.AddToClassList(RootClassName);
159
+ rootElement.style.maxWidth = 720;
160
+ rootElement.style.paddingTop = 10;
161
+ rootElement.style.paddingRight = 14;
162
+ rootElement.style.paddingBottom = 10;
163
+ rootElement.style.paddingLeft = 14;
164
+
165
+ Label title = new("DxMessaging");
166
+ title.style.fontSize = 19;
167
+ title.style.marginBottom = 3;
168
+ rootElement.Add(title);
169
+
170
+ Label subtitle = new(
171
+ "Project-wide defaults for diagnostics capture and editor safety checks."
172
+ );
173
+ subtitle.style.marginBottom = 12;
174
+ rootElement.Add(subtitle);
175
+
176
+ rootElement.Add(
177
+ CreateSection(
178
+ DiagnosticsSectionTitle,
179
+ DiagnosticsSectionDescription,
180
+ CreatePropertyField(
181
+ serializedSettings,
182
+ nameof(DxMessagingSettings._diagnosticsTargets),
183
+ DiagnosticsTargetsLabel,
184
+ DiagnosticsTargetsTooltip
185
+ ),
186
+ CreatePropertyField(
187
+ serializedSettings,
188
+ nameof(DxMessagingSettings._messageBufferSize),
189
+ MessageBufferSizeLabel,
190
+ MessageBufferSizeTooltip
191
+ )
192
+ )
193
+ );
194
+
195
+ rootElement.Add(
196
+ CreateSection(
197
+ EditorSafetySectionTitle,
198
+ EditorSafetySectionDescription,
199
+ CreatePropertyField(
200
+ serializedSettings,
201
+ nameof(DxMessagingSettings._suppressDomainReloadWarning),
202
+ SuppressDomainReloadWarningLabel,
203
+ SuppressDomainReloadWarningTooltip
204
+ )
205
+ )
206
+ );
207
+
208
+ rootElement.Add(
209
+ CreateSection(
210
+ InspectorChecksSectionTitle,
211
+ InspectorChecksSectionDescription,
212
+ CreateSettingsToggle(
213
+ serializedSettings,
214
+ nameof(DxMessagingSettings._baseCallCheckEnabled),
215
+ BaseCallCheckEnabledLabel,
216
+ BaseCallCheckEnabledTooltip,
217
+ settings => settings.BaseCallCheckEnabled
218
+ ),
219
+ CreateSettingsToggle(
220
+ serializedSettings,
221
+ nameof(DxMessagingSettings._useConsoleBridge),
222
+ UseConsoleBridgeLabel,
223
+ UseConsoleBridgeTooltip,
224
+ settings => settings.UseConsoleBridge
225
+ ),
226
+ CreatePropertyField(
227
+ serializedSettings,
228
+ nameof(DxMessagingSettings._baseCallIgnoredTypes),
229
+ BaseCallIgnoredTypesLabel,
230
+ BaseCallIgnoredTypesTooltip
231
+ )
232
+ )
233
+ );
234
+
235
+ rootElement.Bind(serializedSettings);
236
+ }
237
+
238
+ private static VisualElement CreateSection(
239
+ string title,
240
+ string description,
241
+ params VisualElement[] fields
242
+ )
243
+ {
244
+ VisualElement section = new();
245
+ section.AddToClassList(SectionClassName);
246
+ section.AddToClassList(DxMessagingEditorTheme.CardClassName);
247
+ DxMessagingEditorTheme.ApplyCompleteBorder(section, SectionBorderColor);
248
+ section.style.marginBottom = 10;
249
+ section.style.paddingTop = 10;
250
+ section.style.paddingRight = 10;
251
+ section.style.paddingBottom = 10;
252
+ section.style.paddingLeft = 12;
253
+
254
+ Label heading = new(title);
255
+ heading.AddToClassList(DxMessagingEditorTheme.CardLabelClassName);
256
+ heading.style.fontSize = 13;
257
+ heading.style.marginBottom = 2;
258
+ section.Add(heading);
259
+
260
+ Label body = new(description);
261
+ body.style.marginBottom = 8;
262
+ section.Add(body);
263
+
264
+ foreach (VisualElement field in fields)
265
+ {
266
+ section.Add(field);
267
+ }
268
+ return section;
269
+ }
270
+
271
+ private static PropertyField CreatePropertyField(
272
+ SerializedObject serializedSettings,
273
+ string propertyName,
274
+ string label,
275
+ string tooltip
276
+ )
277
+ {
278
+ SerializedProperty property = serializedSettings.FindProperty(propertyName);
279
+ if (property == null)
280
+ {
281
+ throw new MissingFieldException(typeof(DxMessagingSettings).FullName, propertyName);
282
+ }
283
+
284
+ PropertyField field = new(property, label)
285
+ {
286
+ name = propertyName,
287
+ bindingPath = property.propertyPath,
288
+ tooltip = tooltip,
289
+ };
290
+ field.AddToClassList(FieldClassName);
291
+ field.style.marginTop = 4;
292
+ return field;
293
+ }
294
+
295
+ private static Toggle CreateSettingsToggle(
296
+ SerializedObject serializedSettings,
297
+ string fieldName,
298
+ string label,
299
+ string tooltip,
300
+ Func<DxMessagingSettings, bool> getValue
301
+ )
302
+ {
303
+ if (serializedSettings.targetObject is not DxMessagingSettings settings)
304
+ {
305
+ throw new ArgumentException(
306
+ $"Expected {nameof(DxMessagingSettings)} target.",
307
+ nameof(serializedSettings)
308
+ );
309
+ }
310
+
311
+ Toggle toggle = new(label) { name = fieldName, tooltip = tooltip };
312
+ toggle.AddToClassList(FieldClassName);
313
+ toggle.style.marginTop = 4;
314
+ toggle.SetValueWithoutNotify(getValue(settings));
315
+ toggle.RegisterValueChangedCallback(evt =>
316
+ ApplySettingsToggleValue(serializedSettings, fieldName, evt.newValue)
317
+ );
318
+ return toggle;
319
+ }
320
+
321
+ private static void DrawSectionHeader(string title, string description)
322
+ {
323
+ EditorGUILayout.Space(8f);
324
+ EditorGUILayout.LabelField(title, EditorStyles.boldLabel);
325
+ EditorGUILayout.LabelField(description, EditorStyles.wordWrappedMiniLabel);
326
+ }
327
+
328
+ private static void DrawDiagnosticsTargetsField(SerializedObject serializedSettings)
329
+ {
330
+ SerializedProperty targetsProp = serializedSettings.FindProperty(
331
+ nameof(DxMessagingSettings._diagnosticsTargets)
332
+ );
333
+ DiagnosticsTarget currentTargets = (DiagnosticsTarget)targetsProp.enumValueFlag;
334
+ DiagnosticsTarget updatedTargets = (DiagnosticsTarget)
335
+ EditorGUILayout.EnumFlagsField(
336
+ new GUIContent(DiagnosticsTargetsLabel, DiagnosticsTargetsTooltip),
337
+ currentTargets
338
+ );
339
+ if (updatedTargets != currentTargets)
340
+ {
341
+ targetsProp.enumValueFlag = (int)updatedTargets;
342
+ }
343
+ }
344
+
345
+ private static void DrawPropertyField(
346
+ SerializedObject serializedSettings,
347
+ string propertyName,
348
+ string label,
349
+ string tooltip
350
+ )
351
+ {
352
+ EditorGUILayout.PropertyField(
353
+ serializedSettings.FindProperty(propertyName),
354
+ new GUIContent(label, tooltip)
355
+ );
356
+ }
357
+
358
+ private static void DrawSettingsToggle(
359
+ SerializedObject serializedSettings,
360
+ string fieldName,
361
+ string label,
362
+ string tooltip,
363
+ Func<DxMessagingSettings, bool> getValue
364
+ )
365
+ {
366
+ if (serializedSettings.targetObject is not DxMessagingSettings settings)
367
+ {
368
+ throw new ArgumentException(
369
+ $"Expected {nameof(DxMessagingSettings)} target.",
370
+ nameof(serializedSettings)
371
+ );
372
+ }
373
+
374
+ bool currentValue = getValue(settings);
375
+ bool updatedValue = EditorGUILayout.Toggle(
376
+ new GUIContent(label, tooltip),
377
+ currentValue
378
+ );
379
+ if (updatedValue != currentValue)
380
+ {
381
+ serializedSettings.ApplyModifiedProperties();
382
+ ApplySettingsToggleValue(serializedSettings, fieldName, updatedValue);
383
+ }
384
+ }
385
+
386
+ internal static void ApplySettingsToggleValue(
387
+ SerializedObject serializedSettings,
388
+ string fieldName,
389
+ bool value
390
+ )
391
+ {
392
+ if (serializedSettings.targetObject is not DxMessagingSettings settings)
393
+ {
394
+ throw new ArgumentException(
395
+ $"Expected {nameof(DxMessagingSettings)} target.",
396
+ nameof(serializedSettings)
397
+ );
398
+ }
399
+
400
+ switch (fieldName)
401
+ {
402
+ case nameof(DxMessagingSettings._baseCallCheckEnabled):
403
+ settings.BaseCallCheckEnabled = value;
404
+ break;
405
+ case nameof(DxMessagingSettings._useConsoleBridge):
406
+ settings.UseConsoleBridge = value;
407
+ break;
408
+ default:
409
+ throw new ArgumentOutOfRangeException(nameof(fieldName), fieldName, null);
410
+ }
411
+
412
+ EditorUtility.SetDirty(settings);
413
+ serializedSettings.Update();
414
+ }
415
+
89
416
  /// <summary>
90
417
  /// Factory used by Unity to register the DxMessaging project settings page.
91
418
  /// </summary>
@@ -102,6 +429,14 @@ namespace DxMessaging.Editor.Settings
102
429
  "Diagnostics",
103
430
  "MessageBus",
104
431
  "Targets",
432
+ DiagnosticsTargetsLabel,
433
+ MessageBufferSizeLabel,
434
+ EditorSafetySectionTitle,
435
+ SuppressDomainReloadWarningLabel,
436
+ InspectorChecksSectionTitle,
437
+ BaseCallCheckEnabledLabel,
438
+ UseConsoleBridgeLabel,
439
+ BaseCallIgnoredTypesLabel,
105
440
  "Wallstop",
106
441
  "Wallstop Studios",
107
442
  }