Barotrauma Server
|
Public Member Functions | |
PrefabCollection () | |
Default constructor. | |
PrefabCollection (Action< T, bool >? onAdd, Action< T >? onRemove, Action? onSort, Action< ContentFile >? onAddOverrideFile, Action< ContentFile >? onRemoveOverrideFile) | |
Constructor with OnAdd and OnRemove callbacks provided. | |
PrefabCollection (Action? onSort) | |
Constructor with only the OnSort callback provided. | |
bool | TryGet (Identifier identifier, [NotNullWhen(true)] out T? result) |
Returns true if a prefab with the identifier exists, false otherwise. | |
bool | TryGet (string identifier, out T? result) |
T? | Find (Predicate< T > predicate) |
Finds the first active prefab that returns true given the predicate, or null if no such prefab is found. | |
bool | ContainsKey (Identifier identifier) |
Returns true if a prefab with the given identifier exists, false otherwise. | |
bool | ContainsKey (string k) |
bool | IsOverride (T prefab) |
Determines whether a prefab is implemented as an override or not. | |
void | Add (T prefab, bool isOverride) |
Add a prefab to the collection. If not marked as an override, fail if a prefab with the same identifier already exists. Otherwise, add to the corresponding list, without making any changes to the base prefab. | |
void | Remove (T prefab) |
Removes a prefab from the collection. | |
void | RemoveByFile (ContentFile file) |
Removes all prefabs that were loaded from a certain file. | |
void | AddOverrideFile (ContentFile file) |
Adds an override file to the collection. | |
void | RemoveOverrideFile (ContentFile file) |
Removes an override file from the collection. | |
void | SortAll () |
Sorts all prefabs in the collection based on the content package load order. | |
IEnumerator< T > | GetEnumerator () |
GetEnumerator implementation to enable foreach. | |
Properties | |
IEnumerable< KeyValuePair< Identifier, PrefabSelector< T > > > | AllPrefabs [get] |
AllPrefabs exposes all prefabs instead of just the active ones. | |
T | this[Identifier identifier] [get] |
Returns the active prefab with the given identifier. | |
T | this[string identifier] [get] |
IEnumerable< Identifier > | Keys [get] |
Default constructor.
Barotrauma.PrefabCollection< T >.PrefabCollection | ( | Action< T, bool >? | onAdd, |
Action< T >? | onRemove, | ||
Action? | onSort, | ||
Action< ContentFile >? | onAddOverrideFile, | ||
Action< ContentFile >? | onRemoveOverrideFile ) |
Constructor with OnAdd and OnRemove callbacks provided.
Barotrauma.PrefabCollection< T >.PrefabCollection | ( | Action? | onSort | ) |
Constructor with only the OnSort callback provided.
void Barotrauma.PrefabCollection< T >.Add | ( | T | prefab, |
bool | isOverride ) |
Add a prefab to the collection. If not marked as an override, fail if a prefab with the same identifier already exists. Otherwise, add to the corresponding list, without making any changes to the base prefab.
prefab | Prefab |
isOverride | Is marked as override |
void Barotrauma.PrefabCollection< T >.AddOverrideFile | ( | ContentFile | file | ) |
Adds an override file to the collection.
bool Barotrauma.PrefabCollection< T >.ContainsKey | ( | Identifier | identifier | ) |
Returns true if a prefab with the given identifier exists, false otherwise.
identifier | Prefab identifier |
bool Barotrauma.PrefabCollection< T >.ContainsKey | ( | string | k | ) |
T? Barotrauma.PrefabCollection< T >.Find | ( | Predicate< T > | predicate | ) |
Finds the first active prefab that returns true given the predicate, or null if no such prefab is found.
predicate | Predicate to perform the search with. |
IEnumerator< T > Barotrauma.PrefabCollection< T >.GetEnumerator | ( | ) |
GetEnumerator implementation to enable foreach.
bool Barotrauma.PrefabCollection< T >.IsOverride | ( | T | prefab | ) |
Determines whether a prefab is implemented as an override or not.
prefab | Prefab in this collection |
void Barotrauma.PrefabCollection< T >.Remove | ( | T | prefab | ) |
Removes a prefab from the collection.
prefab | Prefab |
void Barotrauma.PrefabCollection< T >.RemoveByFile | ( | ContentFile | file | ) |
Removes all prefabs that were loaded from a certain file.
void Barotrauma.PrefabCollection< T >.RemoveOverrideFile | ( | ContentFile | file | ) |
Removes an override file from the collection.
void Barotrauma.PrefabCollection< T >.SortAll | ( | ) |
Sorts all prefabs in the collection based on the content package load order.
bool Barotrauma.PrefabCollection< T >.TryGet | ( | Identifier | identifier, |
[NotNullWhen(true)] out T? | result ) |
Returns true if a prefab with the identifier exists, false otherwise.
identifier | Prefab identifier |
result | The matching prefab (if one is found) |
bool Barotrauma.PrefabCollection< T >.TryGet | ( | string | identifier, |
out T? | result ) |
|
get |
AllPrefabs exposes all prefabs instead of just the active ones.
|
get |
|
get |
Returns the active prefab with the given identifier.
identifier | Prefab identifier |
|
get |