Class ColorAssetCollection
- Namespace
- Fallencake.UI
- Assembly
- Fallencake.UI.dll
Adapter around an IColorAssetProvider that exposes a collection-like API for selecting and animating colors across a set of UI assets.
public class ColorAssetCollection : IColorAssetCollection<Color>, IAssetCollection<Color>
- Inheritance
-
objectColorAssetCollection
- Implements
-
IColorAssetCollection<Color>IAssetCollection<Color>
Constructors
ColorAssetCollection(IColorAssetProvider)
public ColorAssetCollection(IColorAssetProvider colorAssetProvider)
Parameters
colorAssetProviderIColorAssetProvider
Properties
AssetsNumber
Gets number of available color assets provided by ColorCollectionData.
public int AssetsNumber { get; }
Property Value
- int
SelectedAssetIndex
Gets or sets the selected asset index, forwarding to the provider.
public int SelectedAssetIndex { get; set; }
Property Value
- int
Methods
SelectAsset(int)
Selects a color by index instantly.
public void SelectAsset(int index)
Parameters
indexintIndex in the collection.
SelectAsset(int, bool, float)
Selects a color by index with optional animation.
public void SelectAsset(int index, bool isInstantly = false, float duration = 1)
Parameters
indexintIndex in the collection.
isInstantlyboolIf true, applies immediately.
durationfloatLerp duration in seconds when not instant.
SetColor(int, bool, float)
Selects a color by index and applies it to assets, instantly or over time.
public void SetColor(int index, bool isInstantly = false, float duration = 1)
Parameters
indexintIndex in the collection.
isInstantlyboolIf true, applies without animation.
durationfloatLerp duration if animated.
SetColor(Color, bool, float)
Applies a specific color directly or via interpolation to all colorable assets.
public void SetColor(Color color, bool isInstantly = false, float duration = 1)
Parameters
colorColorTarget color.
isInstantlyboolIf true, applies without animation.
durationfloatLerp duration if animated.
SetSelectedColor()
Applies the provider's currently selected color to all assets respecting tint settings.
public void SetSelectedColor()
Events
OnAssetSelected
Raised when a color asset is selected and applied.
public event Action<Color> OnAssetSelected
Event Type
- Action<Color>