Skip to content

Commit f8f32ba

Browse files
authored
Merge pull request #8 from PurrNet/dev
Release
2 parents bf8d6c9 + 12a3041 commit f8f32ba

14 files changed

Lines changed: 433 additions & 396 deletions

Assets/PurrUI/CHANGELOG.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,66 @@
1+
# [1.3.0-beta.8](https://github.com/PurrNet/PurrUI/compare/v1.3.0-beta.7...v1.3.0-beta.8) (2026-03-12)
2+
3+
4+
### Bug Fixes
5+
6+
* add component and create menu item ([dab3c79](https://github.com/PurrNet/PurrUI/commit/dab3c79121a2e75e0a8907cd2e525be7ab5b3ec1))
7+
8+
# [1.3.0-beta.7](https://github.com/PurrNet/PurrUI/compare/v1.3.0-beta.6...v1.3.0-beta.7) (2026-03-11)
9+
10+
11+
### Bug Fixes
12+
13+
* ensure additional canvas channels are initialized in SignedDistanceFieldGraphic ([205e5b6](https://github.com/PurrNet/PurrUI/commit/205e5b6a20ebbd2f1c320515706c879179f09111))
14+
15+
# [1.3.0-beta.6](https://github.com/PurrNet/PurrUI/compare/v1.3.0-beta.5...v1.3.0-beta.6) (2026-03-10)
16+
17+
18+
### Bug Fixes
19+
20+
* correct order of roundness fields in Glow and Rectangle graphic editors ([ca20640](https://github.com/PurrNet/PurrUI/commit/ca206408f11015eea6b80733ab223c37cbd8e8e3))
21+
22+
# [1.3.0-beta.5](https://github.com/PurrNet/PurrUI/compare/v1.3.0-beta.4...v1.3.0-beta.5) (2026-03-09)
23+
24+
25+
### Features
26+
27+
* refactor view stack management with Replace and AddToStack methods ([fd06b8f](https://github.com/PurrNet/PurrUI/commit/fd06b8ff6541682ae08f2dbd729264927a6a522c))
28+
29+
# [1.3.0-beta.4](https://github.com/PurrNet/PurrUI/compare/v1.3.0-beta.3...v1.3.0-beta.4) (2026-03-09)
30+
31+
32+
### Features
33+
34+
* add OnPushed and OnPopped methods with transition handling for MonoView ([f7f1012](https://github.com/PurrNet/PurrUI/commit/f7f1012ce3ed107ed652f3fdf5beaef6d9d20f36))
35+
36+
# [1.3.0-beta.3](https://github.com/PurrNet/PurrUI/compare/v1.3.0-beta.2...v1.3.0-beta.3) (2026-03-09)
37+
38+
39+
### Features
40+
41+
* add OnPushed and OnPopped methods for view stack management ([6181569](https://github.com/PurrNet/PurrUI/commit/6181569f622ce8cb3537399e8dcc6e1f588f8280))
42+
43+
# [1.3.0-beta.2](https://github.com/PurrNet/PurrUI/compare/v1.3.0-beta.1...v1.3.0-beta.2) (2026-03-09)
44+
45+
46+
### Bug Fixes
47+
48+
* clear selected GameObject when moving MonoView to background ([b154b3c](https://github.com/PurrNet/PurrUI/commit/b154b3cf6cce3552a4f8a4ad9fff5ecb7ae4011d))
49+
* update MoveToBackground and MoveToForeground methods for improved interaction handling ([1644bd1](https://github.com/PurrNet/PurrUI/commit/1644bd160bdd831d35fdb86caa28f9bfe774e619))
50+
* ViewTransitions, just assume midle of screen ([e83da40](https://github.com/PurrNet/PurrUI/commit/e83da40cc9db22bdc1019f49d0d78a0425111271))
51+
52+
53+
### Features
54+
55+
* add culling and unculling transitions for MonoView management ([604b51d](https://github.com/PurrNet/PurrUI/commit/604b51df071c6f6e7db68682a6a5f697e251ca25))
56+
57+
# [1.3.0-beta.1](https://github.com/PurrNet/PurrUI/compare/v1.2.0...v1.3.0-beta.1) (2026-03-08)
58+
59+
60+
### Features
61+
62+
* add isTopMost property and top method to MonoView and ViewStack for improved stack management ([add8d8f](https://github.com/PurrNet/PurrUI/commit/add8d8f99cbe85c0bac188f70df9290ef86b18dd))
63+
164
# [1.2.0](https://github.com/PurrNet/PurrUI/compare/v1.1.0...v1.2.0) (2026-03-08)
265

366

Assets/PurrUI/Editor/GlowGraphicEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ public override void OnInspectorGUI()
129129
else
130130
{
131131
var v = _roundnessInPixels.vector4Value;
132-
v.x = EditorGUILayout.FloatField("Top Left", v.x);
133-
v.y = EditorGUILayout.FloatField("Top Right", v.y);
134-
v.z = EditorGUILayout.FloatField("Bottom Right", v.z);
132+
v.z = EditorGUILayout.FloatField("Top Left", v.z);
133+
v.x = EditorGUILayout.FloatField("Top Right", v.x);
134+
v.y = EditorGUILayout.FloatField("Bottom Right", v.y);
135135
v.w = EditorGUILayout.FloatField("Bottom Left", v.w);
136136
_roundnessInPixels.vector4Value = v;
137137
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
using PurrNet.UI;
2+
using UnityEditor;
3+
using UnityEngine;
4+
using UnityEngine.EventSystems;
5+
using UnityEngine.UI;
6+
7+
namespace PurrNet.Editor.UI
8+
{
9+
static class PurrUIMenuItems
10+
{
11+
#if UNITY_6000_0_OR_NEWER
12+
const string UI_CREATE_PATH = "GameObject/UI (Canvas)/";
13+
#else
14+
const string UI_CREATE_PATH = "GameObject/UI/";
15+
#endif
16+
17+
[MenuItem(UI_CREATE_PATH + "PurrUI Rectangle", false, 2100)]
18+
static void CreateRectangle(MenuCommand menuCommand)
19+
{
20+
CreateUIElement<RectangleGraphic>("Rectangle", menuCommand);
21+
}
22+
23+
[MenuItem(UI_CREATE_PATH + "PurrUI Glow", false, 2101)]
24+
static void CreateGlow(MenuCommand menuCommand)
25+
{
26+
CreateUIElement<GlowGraphic>("Glow", menuCommand);
27+
}
28+
29+
static void CreateUIElement<T>(string name, MenuCommand menuCommand) where T : Graphic
30+
{
31+
var parent = menuCommand.context as GameObject;
32+
33+
if (parent == null || parent.GetComponentInParent<Canvas>() == null)
34+
{
35+
#if UNITY_2022_1_OR_NEWER
36+
var canvas = Object.FindAnyObjectByType<Canvas>();
37+
#else
38+
var canvas = Object.FindObjectOfType<Canvas>();
39+
#endif
40+
if (canvas != null && canvas.gameObject.activeInHierarchy)
41+
parent = canvas.gameObject;
42+
else
43+
parent = CreateCanvas();
44+
}
45+
46+
var go = new GameObject(name, typeof(RectTransform), typeof(T));
47+
GameObjectUtility.SetParentAndAlign(go, parent);
48+
49+
var rt = go.GetComponent<RectTransform>();
50+
rt.sizeDelta = new Vector2(100f, 100f);
51+
52+
Undo.RegisterCreatedObjectUndo(go, "Create " + name);
53+
Selection.activeGameObject = go;
54+
}
55+
56+
static GameObject CreateCanvas()
57+
{
58+
var canvasGo = new GameObject("Canvas",
59+
typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster));
60+
61+
Undo.RegisterCreatedObjectUndo(canvasGo, "Create Canvas");
62+
63+
var canvas = canvasGo.GetComponent<Canvas>();
64+
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
65+
66+
EnsureEventSystem();
67+
68+
return canvasGo;
69+
}
70+
71+
static void EnsureEventSystem()
72+
{
73+
#if UNITY_2022_1_OR_NEWER
74+
if (Object.FindAnyObjectByType<EventSystem>() != null)
75+
return;
76+
#else
77+
if (Object.FindObjectOfType<EventSystem>() != null)
78+
return;
79+
#endif
80+
81+
var esGo = new GameObject("EventSystem",
82+
typeof(EventSystem), typeof(StandaloneInputModule));
83+
84+
Undo.RegisterCreatedObjectUndo(esGo, "Create EventSystem");
85+
}
86+
}
87+
}

Assets/PurrUI/Editor/PurrUIMenuItems.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/PurrUI/Editor/RectangleGraphicEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ public override void OnInspectorGUI()
140140
else
141141
{
142142
var v = _roundnessInPixels.vector4Value;
143-
v.x = EditorGUILayout.FloatField("Top Left", v.x);
144-
v.y = EditorGUILayout.FloatField("Top Right", v.y);
145-
v.z = EditorGUILayout.FloatField("Bottom Right", v.z);
143+
v.z = EditorGUILayout.FloatField("Top Left", v.z);
144+
v.x = EditorGUILayout.FloatField("Top Right", v.x);
145+
v.y = EditorGUILayout.FloatField("Bottom Right", v.y);
146146
v.w = EditorGUILayout.FloatField("Bottom Left", v.w);
147147
_roundnessInPixels.vector4Value = v;
148148
}

Assets/PurrUI/Runtime/MonoView.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,20 @@ public class MonoView : MonoBehaviour
1616

1717
public bool cullWindowsBehind => _cullWindowsBehind;
1818

19+
public bool isTopMost => parentStack && parentStack.top == this;
20+
1921
public Canvas canvas { get; private set; }
2022

23+
/// <summary>
24+
/// Called when this view is pushed onto a ViewStack, before any enter transition plays.
25+
/// </summary>
26+
public virtual void OnPushed() { }
27+
28+
/// <summary>
29+
/// Called when this view is popped from a ViewStack, before any exit transition plays.
30+
/// </summary>
31+
public virtual void OnPopped() { }
32+
2133
public void Initialize(ViewStack parentStack)
2234
{
2335
this.parentStack = parentStack;
@@ -32,29 +44,73 @@ public void UpdateOrder(int order)
3244

3345
public void MoveToBackground()
3446
{
47+
canvasGroup.interactable = false;
3548
canvasGroup.blocksRaycasts = false;
49+
OnBecomeBackground();
3650
}
3751

3852
public void MoveToForeground()
3953
{
54+
canvasGroup.interactable = true;
4055
canvasGroup.blocksRaycasts = true;
4156
OnBecomeForeground();
4257
}
4358

59+
/// <summary>
60+
/// Called when this view becomes the top-most interactive view in the stack.
61+
/// </summary>
4462
protected virtual void OnBecomeForeground() { }
4563

64+
/// <summary>
65+
/// Called when this view is no longer the top-most view due to another view being pushed on top.
66+
/// </summary>
67+
protected virtual void OnBecomeBackground() { }
68+
4669
public IEnumerator EnterTransition() => OnEnterTransition();
4770

4871
public IEnumerator ExitTransition() => OnExitTransition();
4972

73+
/// <summary>
74+
/// Override to provide a transition animation when this view is pushed onto the stack.
75+
/// </summary>
5076
protected virtual IEnumerator OnEnterTransition() => null;
77+
78+
/// <summary>
79+
/// Override to provide a transition animation when this view is popped from the stack.
80+
/// </summary>
5181
protected virtual IEnumerator OnExitTransition() => null;
5282

83+
public IEnumerator CulledTransition() => OnCulledTransition();
84+
85+
public IEnumerator UnculledTransition() => OnUnculledTransition();
86+
87+
/// <summary>
88+
/// Override to provide a transition animation when this view is culled by a view above it.
89+
/// </summary>
90+
protected virtual IEnumerator OnCulledTransition() => null;
91+
92+
/// <summary>
93+
/// Override to provide a transition animation when this view is restored after being culled.
94+
/// </summary>
95+
protected virtual IEnumerator OnUnculledTransition() => null;
96+
5397
internal void DestroyMe()
5498
{
5599
Destroy(gameObject);
56100
}
57101

102+
/// <summary>
103+
/// Pops this view from its parent stack. Can be used as a UnityEvent callback.
104+
/// </summary>
105+
[UsedImplicitly]
106+
public void PopMe()
107+
{
108+
parentStack.Pop(this);
109+
}
110+
111+
/// <summary>
112+
/// Pops this view from its parent stack. Can be used as a UnityEvent callback.
113+
/// </summary>
58114
[UsedImplicitly]
59115
public void CloseMe()
60116
{

Assets/PurrUI/Runtime/ProceduralUI/GlowGraphic.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
namespace PurrNet.UI
55
{
6+
#if UNITY_6000_0_OR_NEWER
7+
[AddComponentMenu("UI (Canvas)/PurrUI/Glow Graphic")]
8+
#else
9+
[AddComponentMenu("UI/PurrUI/Glow Graphic")]
10+
#endif
611
public class GlowGraphic : SignedDistanceFieldGraphic
712
{
813
const string GLOW_SHADER_NAME = "Hidden/PurrUI/GlowRenderer";

Assets/PurrUI/Runtime/ProceduralUI/GlowModifier.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
namespace PurrNet.UI
44
{
55
[ExecuteAlways]
6+
#if UNITY_6000_0_OR_NEWER
7+
[AddComponentMenu("UI (Canvas)/PurrUI/Glow Modifier")]
8+
#else
9+
[AddComponentMenu("UI/PurrUI/Glow Modifier")]
10+
#endif
611
public class GlowModifier : MonoBehaviour
712
{
813
[SerializeField, HideInInspector] GlowGraphic _glowGraphic;

Assets/PurrUI/Runtime/ProceduralUI/RectangleGraphic.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace PurrNet.UI
44
{
5+
#if UNITY_6000_0_OR_NEWER
6+
[AddComponentMenu("UI (Canvas)/PurrUI/Rectangle Graphic")]
7+
#else
8+
[AddComponentMenu("UI/PurrUI/Rectangle Graphic")]
9+
#endif
510
public class RectangleGraphic : SignedDistanceFieldGraphic
611
{
712
[SerializeField] bool _useMaxRoundness;

Assets/PurrUI/Runtime/ProceduralUI/SignedDistanceFieldGraphic.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ protected override void OnValidate()
245245
{
246246
if (!_shader)
247247
_shader = Shader.Find(SHADER_NAME);
248+
EnsureAdditionalCanvasChannels();
248249
base.OnValidate();
249250
}
250251
#endif

0 commit comments

Comments
 (0)