|
Window Framework for UI Toolkit v2.0.x
|
Optional raster-asset capability for compiled purchaser theme extensions. More...


Public Member Functions | |
| IDisposable | ApplyWithAssets (VisualElement scope, string sectionJson, IReadOnlyDictionary< string, Texture2D > images) |
| Applies validated data and borrowed imported images within the purchaser scope. | |
| IReadOnlyDictionary< string, string > | DeclareImages (string sectionJson) |
| Declares this section's logical image keys and relative raster filenames without acquiring resources. | |
| string | SnapshotWithAssets (VisualElement scope, Func< string, Texture2D, string > writeImage) |
| Exports complete effective section data and independent effective raster images. | |
| Public Member Functions inherited from GWG.WindowFramework.Theming.IPlayerThemeExtension | |
| IDisposable | Apply (VisualElement scope, string sectionJson) |
| Applies already validated settings within an explicit scope. | |
| string | Snapshot (VisualElement scope) |
| Exports current effective purchaser settings, including its authoritative defaults. | |
| bool | Validate (string sectionJson, out string error) |
| Validates every supported key and explicit value without mutating UI or files. | |
Additional Inherited Members | |
| Properties inherited from GWG.WindowFramework.Theming.IPlayerThemeExtension | |
| string | Namespace [get] |
| Gets a stable dotted namespace, such as mygame.inventory. | |
Optional raster-asset capability for compiled purchaser theme extensions.
WHY: use this rather than opening player paths or implementing a second image exporter. The framework validates declared images with its common path, header, count and decoded-memory limits, owns imported textures, and copies assets independently. Existing data-only IPlayerThemeExtension implementations remain unchanged. HOW: implement alongside your existing handler, register before discovery, declare stable logical image keys, consume borrowed textures in ApplyWithAssets, and export effective textures with the supplied writer. Player JSON never creates handlers. The original Validate/Apply/Snapshot methods remain the data-only API; implementations should explain/refuse asset-bearing use without a resource context, not open paths themselves.
| IDisposable GWG.WindowFramework.Theming.IPlayerThemeAssetExtension.ApplyWithAssets | ( | VisualElement | scope, |
| string | sectionJson, | ||
| IReadOnlyDictionary< string, Texture2D > | images ) |
Applies validated data and borrowed imported images within the purchaser scope.
| scope | Explicit application subtree. |
| sectionJson | Recovered valid section; original source is never rewritten. |
| images | Declared logical keys mapped to textures or null for safe missing/corrupt files. |
Use application defaults for null resources. Never destroy borrowed textures. Undo partial mutations before throwing; Dispose must remove owned image references and preserve newer purchaser overrides.
| ArgumentException | Data or required application defaults are invalid. |
| IReadOnlyDictionary< string, string > GWG.WindowFramework.Theming.IPlayerThemeAssetExtension.DeclareImages | ( | string | sectionJson | ) |
Declares this section's logical image keys and relative raster filenames without acquiring resources.
| sectionJson | Recovered, structurally validated section JSON. |
Validate known keys/types first. Paths remain untrusted until the framework validates them. PNG/JPG only; no URLs, SVG/fonts, bundles or arbitrary filesystem access. Declarations must be deterministic.
| ArgumentException | Section cannot be interpreted safely. |
| string GWG.WindowFramework.Theming.IPlayerThemeAssetExtension.SnapshotWithAssets | ( | VisualElement | scope, |
| Func< string, Texture2D, string > | writeImage ) |
Exports complete effective section data and independent effective raster images.
| scope | Application subtree supplying effective values/defaults. |
| writeImage | Writes a borrowed texture to staging and returns its safe relative filename. Supply one stable logical key per image. Null returns null without a file. |
The delegate is valid only during this call; never retain it. Do not return original-folder paths. Framework re-import validates declarations before commit. Copy failures leave sources unchanged.
| InvalidOperationException | A complete safe snapshot is unavailable. |