Class SheetBase<T>
Inherited Members
Namespace: Glitch9.AIDevKit.Sheets
Assembly: Glitch9.AIDevKit.Sheets.dll
Syntax
public abstract class SheetBase<T>
Type Parameters
| Name | Description |
|---|---|
| T |
Constructors
| Edit this page View SourceSheetBase(ITableSource)
Declaration
protected SheetBase(ITableSource source)
Parameters
| Type | Name | Description |
|---|---|---|
| ITableSource | source |
Fields
| Edit this page View Sourcem_Source
Declaration
protected readonly ITableSource m_Source
Field Value
| Type | Description |
|---|---|
| ITableSource |
Properties
| Edit this page View SourceCount
Gets the number of rows currently loaded in the sheet.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
IsLoaded
Gets whether the sheet has been successfully loaded.
Declaration
public bool IsLoaded { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Map
Returns a read-only view of the cached map. Valid only after LoadAsync().
Declaration
public abstract IReadOnlyDictionary<string, T> Map { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, T> |
Methods
| Edit this page View SourceGetRequired(string)
Retrieves the value associated with the specified key. Throws an exception if the key is not found.
Declaration
public T GetRequired(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The unique identifier for the value. |
Returns
| Type | Description |
|---|---|
| T | The value associated with the specified key. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown when the key is null or empty. |
| KeyNotFoundException | Thrown when the key is not found in the sheet. |
LoadAsync(bool, CancellationToken)
Asynchronously loads all rows from the source and builds the sheet. The loadAllObjectReferences option can be ignored if the model is a ScriptableObject, as ScriptableObject holds references directly. Use loadAllObjectReferences when the model is a pure C# class and contains UnityEngine.Object references.
Declaration
public UniTask LoadAsync(bool loadAllObjectReferences, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | loadAllObjectReferences | Whether to load all Unity object references recursively. |
| CancellationToken | ct | Cancellation token to abort the operation. |
Returns
| Type | Description |
|---|---|
| UniTask |
LoadAsync(CancellationToken)
Asynchronously loads all rows from the source and builds the sheet.
Declaration
public UniTask LoadAsync(CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | ct | Cancellation token to abort the operation. |
Returns
| Type | Description |
|---|---|
| UniTask |
LoadAsyncInternal(bool, CancellationToken)
Declaration
protected abstract UniTask LoadAsyncInternal(bool loadAllObjectReferences, CancellationToken ct)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | loadAllObjectReferences | |
| CancellationToken | ct |
Returns
| Type | Description |
|---|---|
| UniTask |
TryGet(string, out T)
Attempts to retrieve the value associated with the specified key.
Declaration
public bool TryGet(string key, out T value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | The unique identifier for the value. |
| T | value | When this method returns, contains the value associated with the key, if found; otherwise, null. |
Returns
| Type | Description |
|---|---|
| bool | True if the key was found; otherwise, false. |