Compare commits
2 Commits
05f60bc499
...
a52a48fe32
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a52a48fe32 | ||
|
|
10be8fe01f |
27
Readme.md
27
Readme.md
@@ -381,7 +381,7 @@ namespace Darkmatter.Core.Contracts.Features.Drawing;
|
|||||||
public interface IDrawingTemplate {
|
public interface IDrawingTemplate {
|
||||||
string Id { get; }
|
string Id { get; }
|
||||||
string DisplayName { get; }
|
string DisplayName { get; }
|
||||||
Sprite Thumbnail { get; }
|
Sprite DefaultThumbnail { get; } // authored fallback (used when user has no captures for this template)
|
||||||
Sprite PaperBackground { get; }
|
Sprite PaperBackground { get; }
|
||||||
IReadOnlyList<ShapePieceDTO> Pieces { get; }
|
IReadOnlyList<ShapePieceDTO> Pieces { get; }
|
||||||
IReadOnlyList<ColorRegionDTO> Regions { get; }
|
IReadOnlyList<ColorRegionDTO> Regions { get; }
|
||||||
@@ -490,7 +490,12 @@ public interface IGalleryService {
|
|||||||
UniTask<SavedArtworkDTO> SaveAsync(byte[] png, string templateId);
|
UniTask<SavedArtworkDTO> SaveAsync(byte[] png, string templateId);
|
||||||
UniTask<IReadOnlyList<SavedArtworkDTO>> ListAsync();
|
UniTask<IReadOnlyList<SavedArtworkDTO>> ListAsync();
|
||||||
UniTask<Texture2D> LoadFullAsync(string artworkId);
|
UniTask<Texture2D> LoadFullAsync(string artworkId);
|
||||||
|
UniTask<Texture2D> LoadThumbnailAsync(string artworkId);
|
||||||
UniTask DeleteAsync(string artworkId);
|
UniTask DeleteAsync(string artworkId);
|
||||||
|
|
||||||
|
// Newest captured thumbnail for the given template, or null if none exist.
|
||||||
|
// Catalog cells fall back to IDrawingTemplate.DefaultThumbnail when this returns null.
|
||||||
|
UniTask<Texture2D> GetLatestThumbnailAsync(string templateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Darkmatter.Core.Contracts.Services.Capture;
|
namespace Darkmatter.Core.Contracts.Services.Capture;
|
||||||
@@ -539,8 +544,10 @@ public readonly struct ArtworkSavedSignal {
|
|||||||
|
|
||||||
### `DrawingCatalog`
|
### `DrawingCatalog`
|
||||||
|
|
||||||
- Loads the catalog manifest (list of available template IDs + thumbnail addresses).
|
- Loads the catalog manifest (list of available template IDs).
|
||||||
- Presents a scrollable grid of thumbnails (Canvas).
|
- Presents a scrollable grid of thumbnails (Canvas).
|
||||||
|
- **Each cell shows the latest captured thumbnail** for that template via `IGalleryService.GetLatestThumbnailAsync(templateId)`. If the user has no captures yet for that template, falls back to `IDrawingTemplate.DefaultThumbnail` (the authored sprite).
|
||||||
|
- Subscribes to `ArtworkSavedSignal` — re-fetches the cell's thumbnail for the affected `TemplateId` so the grid reflects user progress without a reopen.
|
||||||
- On select → fires `DrawingSelectedSignal(templateId)` and unloads the catalog UI.
|
- On select → fires `DrawingSelectedSignal(templateId)` and unloads the catalog UI.
|
||||||
|
|
||||||
### `Paper`
|
### `Paper`
|
||||||
@@ -1305,14 +1312,16 @@ Immutable view of a single drawing's authored data.
|
|||||||
public interface IDrawingTemplate {
|
public interface IDrawingTemplate {
|
||||||
string Id { get; } // e.g. "animals/elephant"
|
string Id { get; } // e.g. "animals/elephant"
|
||||||
string DisplayName { get; } // user-facing
|
string DisplayName { get; } // user-facing
|
||||||
Sprite Thumbnail { get; } // 256×256 for catalog grid
|
Sprite DefaultThumbnail { get; } // 256×256 authored fallback for the catalog grid
|
||||||
Sprite PaperBackground { get; } // composited under artwork
|
Sprite PaperBackground { get; } // image under all paper content
|
||||||
IReadOnlyList<ShapePieceDTO> Pieces { get; } // for ShapeBuilder
|
IReadOnlyList<ShapePieceDTO> Pieces { get; } // for ShapeBuilder
|
||||||
IReadOnlyList<ColorRegionDTO> Regions { get; } // for Coloring
|
IReadOnlyList<ColorRegionDTO> Regions { get; } // for Coloring
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
Implemented by `DrawingTemplateSO` (ScriptableObject) loaded via Addressables.
|
Implemented by `DrawingTemplateSO` (ScriptableObject) loaded via Addressables.
|
||||||
|
|
||||||
|
> The catalog grid shows the latest user-captured thumbnail (via `IGalleryService.GetLatestThumbnailAsync`) when available, falling back to `DefaultThumbnail` when the user hasn't completed this template yet. The template itself stays immutable.
|
||||||
|
|
||||||
#### `IDrawingTemplateCatalog` *(Core/Contracts/Features/Drawing — planned)*
|
#### `IDrawingTemplateCatalog` *(Core/Contracts/Features/Drawing — planned)*
|
||||||
Authority on which drawings exist, completion state, and "next" selection.
|
Authority on which drawings exist, completion state, and "next" selection.
|
||||||
```csharp
|
```csharp
|
||||||
@@ -1343,12 +1352,18 @@ Persistent store of saved artwork PNGs.
|
|||||||
```csharp
|
```csharp
|
||||||
public interface IGalleryService {
|
public interface IGalleryService {
|
||||||
UniTask<SavedArtworkDTO> SaveAsync(byte[] png, string templateId);
|
UniTask<SavedArtworkDTO> SaveAsync(byte[] png, string templateId);
|
||||||
UniTask<IReadOnlyList<SavedArtworkDTO>> ListAsync(); // sorted newest first
|
UniTask<IReadOnlyList<SavedArtworkDTO>> ListAsync(); // sorted newest first
|
||||||
UniTask<Texture2D> LoadFullAsync(string artworkId); // for fullscreen view
|
UniTask<Texture2D> LoadFullAsync(string artworkId); // fullscreen view
|
||||||
UniTask<Texture2D> LoadThumbnailAsync(string artworkId);
|
UniTask<Texture2D> LoadThumbnailAsync(string artworkId);
|
||||||
UniTask DeleteAsync(string artworkId);
|
UniTask DeleteAsync(string artworkId);
|
||||||
|
|
||||||
|
// Newest captured thumbnail for the given template, or null if the user has
|
||||||
|
// no captures for it. Used by the catalog grid; null → caller falls back to
|
||||||
|
// IDrawingTemplate.DefaultThumbnail.
|
||||||
|
UniTask<Texture2D> GetLatestThumbnailAsync(string templateId);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
For v1 the latest-thumbnail lookup can list-and-filter (tens of templates max). Add an in-memory `Dictionary<templateId, latestArtworkId>` cache later if perf becomes a concern.
|
||||||
|
|
||||||
#### `ICaptureService` *(Core/Contracts/Services/Capture — planned)*
|
#### `ICaptureService` *(Core/Contracts/Services/Capture — planned)*
|
||||||
Snapshots the paper RT to a PNG blob. No arguments — dimensions and content come from `IPaperRig.Surface`.
|
Snapshots the paper RT to a PNG blob. No arguments — dimensions and content come from `IPaperRig.Surface`.
|
||||||
|
|||||||
Reference in New Issue
Block a user