SelectionSlotCollection¶
Namespace:
SideXP.Selection
Fixed-size list of numbered slots, each one containing a saved selection or being unassigned.
Constructors¶
SelectionSlotCollection()¶
Creates a collection with DefaultCount unassigned slots.
SelectionSlotCollection(int)¶
Creates a collection with the given number of unassigned slots.
Parameters
count: The number of slots.
Fields¶
DefaultCount¶
The default number of slots, matching the number keys of a keyboard.
Properties¶
Count¶
The number of slots.
Methods¶
IsAssigned(int)¶
Checks if a selection is saved in the given slot.
Parameters
index: The index of the slot.
Returns
Returns true if the slot is assigned.
Exceptions
ArgumentOutOfRangeException: Thrown if the index is out of range.
Get(int)¶
Gets the selection saved in the given slot.
Parameters
index: The index of the slot.
Returns
Returns the saved selection, or null if the slot is not assigned.
Exceptions
ArgumentOutOfRangeException: Thrown if the index is out of range.
Set(int, SelectionSnapshot)¶
Saves a selection in the given slot, replacing the previous one if any.
Parameters
index: The index of the slot.snapshot: The selection to save. If null or empty, the slot is unassigned.
Returns
Returns true if the slot is assigned.
Exceptions
ArgumentOutOfRangeException: Thrown if the index is out of range.
Clear(int)¶
Unassigns the given slot.
Parameters
index: The index of the slot.
Returns
Returns true if the slot was assigned.
Exceptions
ArgumentOutOfRangeException: Thrown if the index is out of range.
ClearAll()¶
Unassigns all the slots.
Resize(int)¶
Changes the number of slots. New slots are unassigned, and the last slots are discarded if the collection is shrunk.
Parameters
count: The new number of slots. Negative values are considered as 0.
Clean()¶
Removes the objects that don't exist anymore from the saved selections. A slot that becomes empty is unassigned.
Returns
Returns true if at least one object has been removed.
Remarks
The objects that don't have a stable id but are still resolved are refreshed, so they get one if possible (for example, an object selected in play mode that also exists in edit mode).
Refresh()¶
Captures again the identifiers of the objects that are still alive in all the slots.
Returns
Returns true if the identifiers have been captured again.
Remarks
Does nothing in play mode, so the stable ids captured in edit mode are not lost.