popup changes

This commit is contained in:
Sebastian Bularca
2026-04-06 10:44:16 +02:00
parent 61ca3701ae
commit cbf9f384d9
39 changed files with 1222 additions and 45 deletions

View File

@@ -17,7 +17,7 @@ Install via the Unity Package Manager by adding the package from its local path
In the Unity Editor, go to **Assets > Create > Jovian > Popup System > Popup Settings**. Place the asset somewhere accessible (e.g. `Assets/Settings/PopupSettings.asset`). You can also configure settings via **Project Settings > Jovian > Popup System**.
### 2. Build a PopupView prefab
### 2. Build a PopupReference prefab
See the [Prefab Setup](#prefab-setup) section below for step-by-step instructions.
@@ -27,7 +27,7 @@ See the [Prefab Setup](#prefab-setup) section below for step-by-step instruction
using Jovian.PopupSystem;
using Jovian.PopupSystem.UI;
// Create the system. viewPrefab is a reference to your PopupView prefab.
// Create the system. viewPrefab is a reference to your PopupReference prefab.
var popup = new PopupSystem(settings, viewPrefab);
// Register categories you intend to use.
@@ -125,7 +125,7 @@ popup.Show(PopupCategory.Skill, builder => {
}, targetRect);
```
All elements are drawn from a grow-only pool inside `PopupView`. No allocations occur once the pool is warmed.
All elements are drawn from a grow-only pool inside `PopupReference`. No allocations occur once the pool is warmed.
## PopupTrigger
@@ -240,7 +240,7 @@ popupSystem.Tick(Time.deltaTime);
popupSystem.Dispose(); // destroys all popup view GameObjects
```
Each category lazily creates its own `PopupView` instance on first `Show` call. On `Dispose`, all views are destroyed. This ensures no leaked GameObjects when transitioning between game states.
Each category lazily creates its own `PopupReference` instance on first `Show` call. On `Dispose`, all views are destroyed. This ensures no leaked GameObjects when transitioning between game states.
## IPopupAnimator
@@ -318,14 +318,14 @@ var popup = new PopupSystem(settings, viewPrefab, () => new ScalePopupAnimator()
## Prefab Setup
Build the `PopupView` prefab with the following hierarchy:
Build the `PopupReference` prefab with the following hierarchy:
### Step 1: Root GameObject
1. Create a new GameObject named `PopupView`.
1. Create a new GameObject named `PopupReference`.
2. Add a `Canvas` component. Set **Render Mode** to **Screen Space - Overlay**. Set **Sort Order** to match `PopupSettings.sortingOrder` (default 100).
3. Add a `CanvasGroup` component.
4. Add a `PopupView` component (from `Jovian.PopupSystem.UI`).
4. Add a `PopupReference` component (from `Jovian.PopupSystem.UI`).
### Step 2: Background
@@ -354,7 +354,7 @@ Create these as child prefabs (or separate prefabs). Each must be a prefab refer
### Step 5: Wire references
On the `PopupView` component, assign:
On the `PopupReference` component, assign:
- **Content** - the Content RectTransform
- **Canvas Group** - the root CanvasGroup
@@ -386,7 +386,7 @@ The popup system is designed for minimal runtime allocation:
| Type | Namespace | Description |
|---|---|---|
| `IPopupSystem` | `Jovian.PopupSystem` | Main interface for showing/hiding popups. |
| `PopupSystem` | `Jovian.PopupSystem` | Concrete implementation. Constructor: `(PopupSettings, PopupView, Func<IPopupAnimator>)`. |
| `PopupSystem` | `Jovian.PopupSystem` | Concrete implementation. Constructor: `(PopupSettings, PopupReference, Func<IPopupAnimator>)`. |
| `PopupSettings` | `Jovian.PopupSystem` | ScriptableObject with all configuration fields. |
| `PopupCategory` | `Jovian.PopupSystem` | Readonly struct identifying a popup channel. |
| `PopupContentBuilder` | `Jovian.PopupSystem` | Fluent struct for building popup content in callbacks. |
@@ -395,7 +395,7 @@ The popup system is designed for minimal runtime allocation:
| Type | Namespace | Description |
|---|---|---|
| `PopupView` | `Jovian.PopupSystem.UI` | MonoBehaviour managing popup layout, pooling, and positioning. |
| `PopupReference` | `Jovian.PopupSystem.UI` | MonoBehaviour managing popup layout, pooling, and positioning. |
| `PopupTrigger` | `Jovian.PopupSystem.UI` | MonoBehaviour for hover-based popup triggers on UI elements. |
### Animation Types