com.wallstop-studios.unity-helpers 2.0.0-rc73.19 → 2.0.0-rc73.2

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 (78) hide show
  1. package/Editor/{Sprites/AnimationCopier.cs → AnimationCopier.cs} +209 -84
  2. package/Editor/{Sprites/AnimationCreator.cs → AnimationCreator.cs} +100 -29
  3. package/Editor/AnimationEventEditor.cs +23 -10
  4. package/Editor/CustomEditors/MatchColliderToSpriteEditor.cs +1 -1
  5. package/Editor/FitTextureSizeWindow.cs +53 -14
  6. package/Editor/PrefabChecker.cs +18 -11
  7. package/Editor/SpriteAtlasGenerator.cs +914 -0
  8. package/Editor/SpriteAtlasGenerator.cs.meta +3 -0
  9. package/Editor/{Sprites/SpriteCropper.cs → SpriteCropper.cs} +143 -172
  10. package/Editor/{Sprites/SpriteSettingsApplier.cs → SpriteSettingsApplier.cs} +77 -12
  11. package/Editor/{Sprites/TextureResizerWizard.cs → TextureResizerWizard.cs} +1 -1
  12. package/Editor/{Sprites/TextureSettingsApplier.cs → TextureSettingsApplier.cs} +1 -1
  13. package/Editor/Utils/DxReadOnlyPropertyDrawer.cs +1 -1
  14. package/Editor/Utils/GUIHorizontalScope.cs +20 -0
  15. package/Editor/Utils/GUIHorizontalScope.cs.meta +3 -0
  16. package/Runtime/Core/DataStructure/Circle.cs +1 -1
  17. package/Runtime/Core/DataStructure/QuadTree.cs +4 -4
  18. package/Runtime/Core/Extension/ColorExtensions.cs +5 -5
  19. package/Runtime/Core/Extension/IEnumerableExtensions.cs +1 -1
  20. package/Runtime/Core/Extension/UnityExtensions.cs +14 -14
  21. package/Runtime/Core/Helper/DirectoryHelper.cs +0 -64
  22. package/Runtime/Core/Helper/Helpers.cs +9 -9
  23. package/Runtime/Core/Helper/Logging/UnityLogTagFormatter.cs +8 -31
  24. package/Runtime/Core/Helper/Partials/ObjectHelpers.cs +4 -5
  25. package/Runtime/Core/Helper/PathHelper.cs +1 -2
  26. package/Runtime/Core/Random/DotNetRandom.cs +1 -1
  27. package/Runtime/Core/Random/SplitMix64.cs +1 -1
  28. package/Runtime/Core/Random/SquirrelRandom.cs +7 -7
  29. package/Runtime/Core/Random/ThreadLocalRandom.cs +1 -1
  30. package/Runtime/Core/Random/WyRandom.cs +1 -1
  31. package/Runtime/Tags/AttributeEffect.cs +0 -1
  32. package/Runtime/Tags/EffectHandler.cs +1 -1
  33. package/Runtime/UI/LayeredImage.cs +161 -309
  34. package/Runtime/Utils/AnimatorEnumStateMachine.cs +1 -1
  35. package/Runtime/Utils/SetTextureImportData.cs +1 -1
  36. package/Runtime/Utils/TextureScale.cs +4 -4
  37. package/Styles/Elements/{Progress/CircularProgressBar.cs → CircularProgressBar.cs} +55 -56
  38. package/Styles/Elements/{Progress/RegularProgressBar.cs → RegularProgressBar.cs} +13 -24
  39. package/Styles/UXML/CircularProgressBar.uxml +11 -0
  40. package/Styles/UXML/CircularProgressBar.uxml.meta +10 -0
  41. package/Styles/UXML/RegularProgressBar.uxml +22 -0
  42. package/Styles/UXML/RegularProgressBar.uxml.meta +10 -0
  43. package/Styles/UXML.meta +3 -0
  44. package/package.json +1 -18
  45. package/Editor/CustomEditors/PersistentDirectoryGUI.cs +0 -796
  46. package/Editor/CustomEditors/PersistentDirectoryGUI.cs.meta +0 -3
  47. package/Editor/CustomEditors/SourceFolderEntryDrawer.cs +0 -275
  48. package/Editor/CustomEditors/SourceFolderEntryDrawer.cs.meta +0 -3
  49. package/Editor/PersistentDirectorySettings.cs +0 -248
  50. package/Editor/PersistentDirectorySettings.cs.meta +0 -3
  51. package/Editor/Sprites/ScriptableSpriteAtlas.cs +0 -95
  52. package/Editor/Sprites/ScriptableSpriteAtlas.cs.meta +0 -3
  53. package/Editor/Sprites/ScriptableSpriteAtlasEditor.cs +0 -930
  54. package/Editor/Sprites/ScriptableSpriteAtlasEditor.cs.meta +0 -3
  55. package/Editor/Sprites.meta +0 -3
  56. package/Styles/Elements/Progress/ArcedProgressBar.cs +0 -345
  57. package/Styles/Elements/Progress/ArcedProgressBar.cs.meta +0 -3
  58. package/Styles/Elements/Progress/GlitchProgressBar.cs +0 -416
  59. package/Styles/Elements/Progress/GlitchProgressBar.cs.meta +0 -3
  60. package/Styles/Elements/Progress/LiquidProgressBar.cs +0 -632
  61. package/Styles/Elements/Progress/LiquidProgressBar.cs.meta +0 -3
  62. package/Styles/Elements/Progress/MarchingAntsProgressBar.cs +0 -722
  63. package/Styles/Elements/Progress/MarchingAntsProgressBar.cs.meta +0 -3
  64. package/Styles/Elements/Progress/WigglyProgressBar.cs +0 -837
  65. package/Styles/Elements/Progress/WigglyProgressBar.cs.meta +0 -3
  66. package/Styles/Elements/Progress.meta +0 -3
  67. package/Styles/USS/ArcedProgressBar.uss +0 -19
  68. package/Styles/USS/ArcedProgressBar.uss.meta +0 -3
  69. package/Styles/USS/WigglyProgressBar.uss +0 -17
  70. package/Styles/USS/WigglyProgressBar.uss.meta +0 -3
  71. /package/Editor/{Sprites/AnimationCopier.cs.meta → AnimationCopier.cs.meta} +0 -0
  72. /package/Editor/{Sprites/AnimationCreator.cs.meta → AnimationCreator.cs.meta} +0 -0
  73. /package/Editor/{Sprites/SpriteCropper.cs.meta → SpriteCropper.cs.meta} +0 -0
  74. /package/Editor/{Sprites/SpriteSettingsApplier.cs.meta → SpriteSettingsApplier.cs.meta} +0 -0
  75. /package/Editor/{Sprites/TextureResizerWizard.cs.meta → TextureResizerWizard.cs.meta} +0 -0
  76. /package/Editor/{Sprites/TextureSettingsApplier.cs.meta → TextureSettingsApplier.cs.meta} +0 -0
  77. /package/Styles/Elements/{Progress/CircularProgressBar.cs.meta → CircularProgressBar.cs.meta} +0 -0
  78. /package/Styles/Elements/{Progress/RegularProgressBar.cs.meta → RegularProgressBar.cs.meta} +0 -0
@@ -54,8 +54,8 @@
54
54
  }
55
55
  else
56
56
  {
57
- ratioX = (float)tex.width / newWidth;
58
- ratioY = (float)tex.height / newHeight;
57
+ ratioX = ((float)tex.width) / newWidth;
58
+ ratioY = ((float)tex.height) / newHeight;
59
59
  }
60
60
 
61
61
  w = tex.width;
@@ -123,7 +123,7 @@
123
123
  int y2 = (yFloor + 1) * w;
124
124
  int yw = y * w2;
125
125
 
126
- for (int x = 0; x < w2; x++)
126
+ for (var x = 0; x < w2; x++)
127
127
  {
128
128
  int xFloor = (int)Mathf.Floor(x * ratioX);
129
129
  float xLerp = x * ratioX - xFloor;
@@ -155,7 +155,7 @@
155
155
  {
156
156
  int thisY = (int)(ratioY * y) * w;
157
157
  int yw = y * w2;
158
- for (int x = 0; x < w2; x++)
158
+ for (var x = 0; x < w2; x++)
159
159
  {
160
160
  newColors[yw + x] = texColors[(int)(thisY + ratioX * x)];
161
161
  }
@@ -1,4 +1,4 @@
1
- namespace WallstopStudios.UnityHelpers.Styles.Elements.Progress
1
+ namespace WallstopStudios.UnityHelpers.Styles.Elements
2
2
  {
3
3
  using System.ComponentModel;
4
4
  using UnityEngine;
@@ -31,10 +31,6 @@
31
31
  get => _progress;
32
32
  set
33
33
  {
34
- if (float.IsNaN(value) || float.IsInfinity(value))
35
- {
36
- return;
37
- }
38
34
  _progress = Mathf.Clamp01(value);
39
35
  MarkDirtyRepaint();
40
36
  }
@@ -46,10 +42,6 @@
46
42
  get => _radius;
47
43
  set
48
44
  {
49
- if (float.IsNaN(value) || float.IsInfinity(value))
50
- {
51
- return;
52
- }
53
45
  _radius = Mathf.Max(1f, value);
54
46
  UpdateSize();
55
47
  MarkDirtyRepaint();
@@ -62,27 +54,19 @@
62
54
  get => _thickness;
63
55
  set
64
56
  {
65
- if (float.IsNaN(value) || float.IsInfinity(value))
66
- {
67
- return;
68
- }
69
57
  _thickness = Mathf.Max(1f, value);
70
58
  UpdateSize();
71
59
  MarkDirtyRepaint();
72
60
  }
73
61
  }
74
62
 
75
- private float _startPoint = GetStartAngleInDegrees(StartPointLocation.Top);
76
- public float StartAt
63
+ private StartPointLocation _startPoint = StartPointLocation.Top;
64
+ public StartPointLocation StartAt
77
65
  {
78
66
  get => _startPoint;
79
67
  set
80
68
  {
81
- if (float.IsNaN(value) || float.IsInfinity(value))
82
- {
83
- return;
84
- }
85
- _startPoint = value % 360f;
69
+ _startPoint = value;
86
70
  MarkDirtyRepaint();
87
71
  }
88
72
  }
@@ -142,11 +126,8 @@
142
126
  defaultValue = 10f,
143
127
  };
144
128
 
145
- private readonly UxmlFloatAttributeDescription _startPointAttribute = new()
146
- {
147
- name = "start-at",
148
- defaultValue = GetStartAngleInDegrees(StartPointLocation.Top),
149
- };
129
+ private readonly UxmlEnumAttributeDescription<StartPointLocation> _startPointAttribute =
130
+ new() { name = "start-at", defaultValue = StartPointLocation.Top };
150
131
 
151
132
  private readonly UxmlEnumAttributeDescription<FillDirection> _fillDirectionAttribute =
152
133
  new() { name = "direction", defaultValue = FillDirection.Clockwise };
@@ -241,33 +222,63 @@
241
222
  float drawRadius = _radius;
242
223
  Vector2 center = rect.center;
243
224
 
244
- painter.strokeColor = _trackColor;
245
- painter.lineWidth = _thickness;
246
- painter.BeginPath();
247
- painter.Arc(center, drawRadius, 0f, 360f);
248
- painter.Stroke();
249
-
250
- if (Mathf.Approximately(_progress, 0))
225
+ if (_progress <= 0.01f)
251
226
  {
227
+ painter.strokeColor = _trackColor;
228
+ painter.lineWidth = _thickness;
229
+ painter.BeginPath();
230
+ painter.Arc(center, drawRadius, 0f, 360f);
231
+ painter.Stroke();
252
232
  return;
253
233
  }
254
234
 
255
- ArcDirection direction;
256
- float sweepAngleDegrees;
257
-
258
235
  switch (_fillDirection)
259
236
  {
260
- case FillDirection.Clockwise:
237
+ case FillDirection.CounterClockwise:
261
238
  {
262
- direction = ArcDirection.Clockwise;
263
- sweepAngleDegrees = _progress * 360f;
264
- break;
239
+ painter.strokeColor = _progressColor;
240
+ painter.lineWidth = _thickness;
241
+ painter.BeginPath();
242
+ painter.Arc(center, drawRadius, 0f, 360f);
243
+ painter.Stroke();
244
+
245
+ float startAngleDegrees = GetStartAngleInDegrees(_startPoint);
246
+ float sweepAngleDegrees = -1 * _progress * 360f;
247
+
248
+ painter.strokeColor = _trackColor;
249
+ painter.lineWidth = _thickness;
250
+ painter.BeginPath();
251
+ painter.Arc(
252
+ center,
253
+ drawRadius,
254
+ startAngleDegrees,
255
+ (startAngleDegrees + sweepAngleDegrees)
256
+ );
257
+ painter.Stroke();
258
+ return;
265
259
  }
266
- case FillDirection.CounterClockwise:
260
+ case FillDirection.Clockwise:
267
261
  {
268
- direction = ArcDirection.CounterClockwise;
269
- sweepAngleDegrees = -1 * _progress * 360f;
270
- break;
262
+ painter.strokeColor = _trackColor;
263
+ painter.lineWidth = _thickness;
264
+ painter.BeginPath();
265
+ painter.Arc(center, drawRadius, 0f, 360f);
266
+ painter.Stroke();
267
+
268
+ float startAngleDegrees = GetStartAngleInDegrees(_startPoint);
269
+ float sweepAngleDegrees = _progress * 360f;
270
+
271
+ painter.strokeColor = _progressColor;
272
+ painter.lineWidth = _thickness;
273
+ painter.BeginPath();
274
+ painter.Arc(
275
+ center,
276
+ drawRadius,
277
+ startAngleDegrees,
278
+ (startAngleDegrees + sweepAngleDegrees)
279
+ );
280
+ painter.Stroke();
281
+ return;
271
282
  }
272
283
  default:
273
284
  {
@@ -278,21 +289,9 @@
278
289
  );
279
290
  }
280
291
  }
281
-
282
- painter.strokeColor = _progressColor;
283
- painter.lineWidth = _thickness;
284
- painter.BeginPath();
285
- painter.Arc(
286
- center,
287
- drawRadius,
288
- _startPoint,
289
- _startPoint + sweepAngleDegrees,
290
- direction
291
- );
292
- painter.Stroke();
293
292
  }
294
293
 
295
- public static float GetStartAngleInDegrees(StartPointLocation location)
294
+ private static float GetStartAngleInDegrees(StartPointLocation location)
296
295
  {
297
296
  return location switch
298
297
  {
@@ -1,4 +1,4 @@
1
- namespace WallstopStudios.UnityHelpers.Styles.Elements.Progress
1
+ namespace WallstopStudios.UnityHelpers.Styles.Elements
2
2
  {
3
3
  using System.ComponentModel;
4
4
  using UnityEngine;
@@ -18,7 +18,7 @@
18
18
  private readonly VisualElement _trackElement;
19
19
  private readonly VisualElement _fillElement;
20
20
 
21
- public enum OrientationType
21
+ public enum BarOrientation
22
22
  {
23
23
  Horizontal = 0,
24
24
  Vertical = 1,
@@ -36,10 +36,6 @@
36
36
  get => _progress;
37
37
  set
38
38
  {
39
- if (float.IsNaN(value) || float.IsInfinity(value))
40
- {
41
- return;
42
- }
43
39
  _progress = Mathf.Clamp01(value);
44
40
  UpdateFillVisuals();
45
41
  }
@@ -73,8 +69,8 @@
73
69
  }
74
70
  }
75
71
 
76
- private OrientationType _orientation = OrientationType.Horizontal;
77
- public OrientationType Orientation
72
+ private BarOrientation _orientation = BarOrientation.Horizontal;
73
+ public BarOrientation Orientation
78
74
  {
79
75
  get => _orientation;
80
76
  set
@@ -104,10 +100,6 @@
104
100
  get => _borderRadius;
105
101
  set
106
102
  {
107
- if (float.IsNaN(value) || float.IsInfinity(value))
108
- {
109
- return;
110
- }
111
103
  _borderRadius = Mathf.Max(0, value);
112
104
  ApplyBorderRadius();
113
105
  }
@@ -119,10 +111,6 @@
119
111
  get => _thickness;
120
112
  set
121
113
  {
122
- if (float.IsNaN(value) || float.IsInfinity(value))
123
- {
124
- return;
125
- }
126
114
  _thickness = Mathf.Max(1, value);
127
115
  UpdateThicknessVisuals();
128
116
  }
@@ -150,8 +138,8 @@
150
138
  defaultValue = new Color(0.2f, 0.7f, 0.2f, 1f),
151
139
  };
152
140
 
153
- private readonly UxmlEnumAttributeDescription<OrientationType> _orientationAttribute =
154
- new() { name = "orientation", defaultValue = OrientationType.Horizontal };
141
+ private readonly UxmlEnumAttributeDescription<BarOrientation> _orientationAttribute =
142
+ new() { name = "orientation", defaultValue = BarOrientation.Horizontal };
155
143
 
156
144
  private readonly UxmlEnumAttributeDescription<FillDirection> _fillAttribute = new()
157
145
  {
@@ -179,6 +167,7 @@
179
167
  Debug.LogError(
180
168
  $"Initialization failed, expected {nameof(RegularProgressBar)}, found {ve?.GetType()}.)"
181
169
  );
170
+
182
171
  return;
183
172
  }
184
173
 
@@ -271,7 +260,7 @@
271
260
 
272
261
  switch (_orientation)
273
262
  {
274
- case OrientationType.Horizontal:
263
+ case BarOrientation.Horizontal:
275
264
  {
276
265
  switch (_fillDirection)
277
266
  {
@@ -305,7 +294,7 @@
305
294
 
306
295
  break;
307
296
  }
308
- case OrientationType.Vertical:
297
+ case BarOrientation.Vertical:
309
298
  {
310
299
  switch (_fillDirection)
311
300
  {
@@ -344,7 +333,7 @@
344
333
  throw new InvalidEnumArgumentException(
345
334
  nameof(_orientation),
346
335
  (int)_orientation,
347
- typeof(OrientationType)
336
+ typeof(BarOrientation)
348
337
  );
349
338
  }
350
339
  }
@@ -379,13 +368,13 @@
379
368
 
380
369
  switch (_orientation)
381
370
  {
382
- case OrientationType.Horizontal:
371
+ case BarOrientation.Horizontal:
383
372
  {
384
373
  _fillElement.style.width = Length.Percent(clampedProgress * 100f);
385
374
  _fillElement.style.height = Length.Percent(100);
386
375
  break;
387
376
  }
388
- case OrientationType.Vertical:
377
+ case BarOrientation.Vertical:
389
378
  {
390
379
  _fillElement.style.height = Length.Percent(clampedProgress * 100f);
391
380
  _fillElement.style.width = Length.Percent(100);
@@ -396,7 +385,7 @@
396
385
  throw new InvalidEnumArgumentException(
397
386
  nameof(_orientation),
398
387
  (int)_orientation,
399
- typeof(OrientationType)
388
+ typeof(BarOrientation)
400
389
  );
401
390
  }
402
391
  }
@@ -0,0 +1,11 @@
1
+ <ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:custom="WallstopStudios.UnityHelpers.Styles.Elements">
2
+ <ui:VisualElement style="flex-grow: 1; align-items: center; justify-content: space-around;">
3
+ <custom:CircularProgressBar radius="60" thickness="12" progress="0.75"
4
+ start-at="Top" direction="Clockwise"
5
+ progress-color-attr="blue" track-color-attr="lightgrey" />
6
+ <custom:CircularProgressBar progress="0.3" radius="40" />
7
+ <custom:CircularProgressBar class="warning" progress="0.9" radius="50" start-at="Bottom"
8
+ direction="CounterClockwise" />
9
+ <custom:CircularProgressBar class="slim" progress="0.5" radius="70" start-at="Left" direction="Clockwise" />
10
+ </ui:VisualElement>
11
+ </ui:UXML>
@@ -0,0 +1,10 @@
1
+ fileFormatVersion: 2
2
+ guid: 30396d1b727a20a469166139b7d733d0
3
+ ScriptedImporter:
4
+ internalIDToNameTable: []
5
+ externalObjects: {}
6
+ serializedVersion: 2
7
+ userData:
8
+ assetBundleName:
9
+ assetBundleVariant:
10
+ script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
@@ -0,0 +1,22 @@
1
+ <ui:UXML xmlns:ui="UnityEngine.UIElements"
2
+ xmlns:custom="WallstopStudios.UnityHelpers.Styles.Elements">
3
+ <ui:VisualElement style="flex-direction: column; align-items: stretch; padding: 20px; width: 300px;">
4
+ <ui:Label text="Horizontal Progress Bars" />
5
+ <custom:RegularProgressBar progress="0.65" orientation="Horizontal"
6
+ thickness="20" border-radius="5"
7
+ progress-color-attr="#FFC107" track-color-attr="#424242" />
8
+ <custom:RegularProgressBar progress="0.3" orientation="Horizontal" />
9
+ <custom:RegularProgressBar class="slim-style" progress="0.8" orientation="Horizontal" />
10
+ <ui:Label text="Vertical Progress Bars" style="margin-top: 20px;" />
11
+ <ui:VisualElement
12
+ style="flex-direction: row; height: 150px; justify-content: space-around; align-items: stretch;">
13
+ <custom:RegularProgressBar progress="0.75" orientation="Vertical"
14
+ thickness="25" border-radius="8"
15
+ style="height: 120px;" />
16
+ <custom:RegularProgressBar class="warning-state" progress="0.5"
17
+ orientation="Vertical"
18
+ thickness="18"
19
+ style="height: 100px;" />
20
+ </ui:VisualElement>
21
+ </ui:VisualElement>
22
+ </ui:UXML>
@@ -0,0 +1,10 @@
1
+ fileFormatVersion: 2
2
+ guid: b087d78ca899c3f4aa3acff6f2761a5b
3
+ ScriptedImporter:
4
+ internalIDToNameTable: []
5
+ externalObjects: {}
6
+ serializedVersion: 2
7
+ userData:
8
+ assetBundleName:
9
+ assetBundleVariant:
10
+ script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 176a185ae21b4235b9add846132baa56
3
+ timeCreated: 1746656378
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.0.0-rc73.19",
3
+ "version": "2.0.0-rc73.2",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},
@@ -38,20 +38,3 @@
38
38
  }
39
39
 
40
40
 
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-