Table of Contents

Interface IThemeManager

Namespace
BSGameLib.UI
Assembly
BSGameLib.UI.dll

Holds which theme variant is active, and names the file a view's <References Source="Theme.template.xml"/> should load under it.

public interface IThemeManager

Remarks

A view refers to its palette by one fixed name and never learns there is more than one of them: the variant is applied while the reference is being resolved, so shipping a second palette means adding one file, not editing every view that uses it.

Changing the variant does not re-skin what is already on screen - a view resolves every {Resource id} once, while it is being built, and there is no per-frame style pass to re-run. Pair SetVariant(string) with ReloadActiveView() to rebuild what is currently shown.

Properties

ActiveVariant

The active variant's name, or null when references resolve exactly as the view wrote them. Null is the default, so a game that ships one palette never sees this at all.

string ActiveVariant { get; }

Property Value

string

TemplateSearchPaths

Folders a view's template reference is looked for in, first to last, before the folder the view itself is in. Empty by default, which leaves a reference resolving beside its view.

IList<string> TemplateSearchPaths { get; }

Property Value

IList<string>

Remarks

For views and templates kept in more than one place - a player's own copies over the ones the game installed. Listing both folders, the player's first, lets a replaced template reach an installed view, and a replaced view still find an installed template. The active variant is tried in each folder before the template as named.

Methods

GetVariantSource(string)

The variant-specific file templateSource refers to under the active variant, or null when no variant is active (or there is nothing to rename). The name is built by inserting the variant after the base name, so Theme.template.xml under variant Light becomes Theme.Light.template.xml, in the same directory.

string GetVariantSource(string templateSource)

Parameters

templateSource string

Returns

string

Remarks

Purely a naming rule - it does not check whether the file exists. The caller resolves it the same way it resolves any other reference and falls back to templateSource if it isn't there, so a variant only has to supply the templates it actually re-skins.

SetVariant(string)

Sets the active variant. Null or whitespace clears it, going back to the template the view names directly - which is how the default palette is spelled: it needs no variant file of its own.

void SetVariant(string variant)

Parameters

variant string