SelectionSystemclass

An ordered collection of unique objects with add/remove callbacks. Maintains insertion order and provides change notifications.

objectSelectionSystem
Namespace
Sandbox
Assembly
Sandbox.System
Declaration
public class Sandbox.SelectionSystem

Constructors1

Showing 1 constructors

Methods7

Showing 7 methods

public virtual bool Add(object obj)PUBLICVIRTUAL

Adds an object to the selection.

ParameterTypeDescription
objobjectThe object to add
Returns:boolTrue if the object was added, false if it was already selected

public virtual bool Any()PUBLICVIRTUAL

Checks if the selection contains any objects.

Returns:boolTrue if there are any selected objects

public virtual void Clear()PUBLICVIRTUAL

Removes all objects from the selection, invoking OnItemRemoved for each.

Returns:void

public virtual bool Contains(object obj)PUBLICVIRTUAL

Checks if an object is in the selection.

ParameterTypeDescription
objobjectThe object to check
Returns:boolTrue if the object is selected

public virtual sealed System.Collections.Generic.IEnumerator`1<object> GetEnumerator()PUBLICVIRTUAL

Returns an enumerator that iterates through the selected objects in order.

Returns:IEnumerator<object>

public virtual bool Remove(object obj)PUBLICVIRTUAL

Removes an object from the selection.

ParameterTypeDescription
objobjectThe object to remove
Returns:boolTrue if the object was removed, false if it wasn't selected

public virtual bool Set(object obj)PUBLICVIRTUAL

Clears the selection and sets it to a single object.

ParameterTypeDescription
objobjectThe object to select
Returns:boolTrue if the selection changed, false if it was already the only selected object

Properties3

Showing 3 properties

public int Sandbox.SelectionSystem.Count { get; set; }PUBLICGETSET

Gets the number of selected objects.

Returns:int

public System.Action`1<object> Sandbox.SelectionSystem.OnItemAdded { get; set; }PUBLICGETSET

Invoked when an item is added to the selection.

Returns:Action<object>

public System.Action`1<object> Sandbox.SelectionSystem.OnItemRemoved { get; set; }PUBLICGETSET

Invoked when an item is removed from the selection.

Returns:Action<object>

On this page