Class AchievementsStudioSelection
Which achievement the Studio has selected, tracked by asset GUID and moved with the arrow keys.
Inherited Members
Namespace: Serenity.Achievements.Infrastructure.Editor.Studio
Assembly: Serenity.UnityAchievements.Infrastructure.Editor.dll
Syntax
public static class AchievementsStudioSelection
Remarks
Selection is a GUID rather than an index because everything the Studio does invalidates indices: a search narrows the list, a filter reorders what survives, creating or deleting an achievement rebuilds it, and a domain reload throws the whole list away and re-reads it. An index survives none of those and a GUID survives all of them — the row the author was looking at is still the row they are looking at.
Every method answers with the GUID that should be selected next rather than mutating anything, so the window keeps ownership of its own field and the rules can be asserted without one.
Fields
NoSelection
The answer meaning nothing is selected, because there is nothing to select.
Declaration
public const string NoSelection = ""
Field Value
| Type | Description |
|---|---|
| string |
NotInList
The answer meaning no row in the list carries the GUID asked about.
Declaration
public const int NotInList = -1
Field Value
| Type | Description |
|---|---|
| int |
Methods
AfterRemoving(IReadOnlyList<AchievementsStudioRowModel>, string)
The selection to hold after the achievement at a position was removed, given the list as it looked before the removal.
Declaration
public static string AfterRemoving(IReadOnlyList<AchievementsStudioRowModel> rows, string removedGuid)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementsStudioRowModel> | rows | The rows as they were before the removal. May be null. |
| string | removedGuid | The GUID of the achievement that was removed. |
Returns
| Type | Description |
|---|---|
| string | The GUID to select, or NoSelection. |
Remarks
The row that takes the deleted one's place, so deleting several achievements in a row is a repeated press of the same button rather than a click-then-delete cycle. The last row deleted leaves the new last row selected, and an emptied list leaves nothing selected.
IndexOf(IReadOnlyList<AchievementsStudioRowModel>, string)
Where in the list the achievement with a GUID sits.
Declaration
public static int IndexOf(IReadOnlyList<AchievementsStudioRowModel> rows, string assetGuid)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementsStudioRowModel> | rows | The rows currently listed. May be null. |
| string | assetGuid | The GUID to look for. |
Returns
| Type | Description |
|---|---|
| int | Its position, or NotInList. |
MoveDown(IReadOnlyList<AchievementsStudioRowModel>, string)
The selection one row further down the list.
Declaration
public static string MoveDown(IReadOnlyList<AchievementsStudioRowModel> rows, string assetGuid)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementsStudioRowModel> | rows | The rows currently listed. |
| string | assetGuid | The GUID selected now. |
Returns
| Type | Description |
|---|---|
| string | The GUID to select, unchanged when it is already the last row. |
MoveUp(IReadOnlyList<AchievementsStudioRowModel>, string)
The selection one row further up the list.
Declaration
public static string MoveUp(IReadOnlyList<AchievementsStudioRowModel> rows, string assetGuid)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementsStudioRowModel> | rows | The rows currently listed. |
| string | assetGuid | The GUID selected now. |
Returns
| Type | Description |
|---|---|
| string | The GUID to select, unchanged when it is already the first row. |
Resolve(IReadOnlyList<AchievementsStudioRowModel>, string)
The selection to hold after the list was rebuilt: the same achievement when it is still listed, and the first row otherwise.
Declaration
public static string Resolve(IReadOnlyList<AchievementsStudioRowModel> rows, string assetGuid)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyList<AchievementsStudioRowModel> | rows | The rows now listed. May be null. |
| string | assetGuid | The GUID that was selected before. May be blank. |
Returns
| Type | Description |
|---|---|
| string | The GUID to select, or NoSelection when the list is empty. |
Remarks
Falling back to the first row rather than to nothing is what makes the filter popup usable — a filter that excluded the selected achievement would otherwise blank the detail pane and leave the author looking at an empty half of the window.