Barotrauma Client Doc
|
Public Member Functions | |
PrefabCollection () | |
Default constructor. More... | |
PrefabCollection (Action< T, bool >? onAdd, Action< T >? onRemove, Action? onSort, Action< ContentFile >? onAddOverrideFile, Action< ContentFile >? onRemoveOverrideFile) | |
Constructor with OnAdd and OnRemove callbacks provided. More... | |
PrefabCollection (Action? onSort) | |
Constructor with only the OnSort callback provided. More... | |
bool | TryGet (Identifier identifier, [NotNullWhen(true)] out T? result) |
Returns true if a prefab with the identifier exists, false otherwise. More... | |
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. More... | |
bool | ContainsKey (Identifier identifier) |
Returns true if a prefab with the given identifier exists, false otherwise. More... | |
bool | ContainsKey (string k) |
bool | IsOverride (T prefab) |
Determines whether a prefab is implemented as an override or not. More... | |
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. More... | |
void | Remove (T prefab) |
Removes a prefab from the collection. More... | |
void | RemoveByFile (ContentFile file) |
Removes all prefabs that were loaded from a certain file. More... | |
void | AddOverrideFile (ContentFile file) |
Adds an override file to the collection. More... | |
void | RemoveOverrideFile (ContentFile file) |
Removes an override file from the collection. More... | |
void | SortAll () |
Sorts all prefabs in the collection based on the content package load order. More... | |
IEnumerator< T > | GetEnumerator () |
GetEnumerator implementation to enable foreach More... | |
Properties | |
IEnumerable< KeyValuePair< Identifier, PrefabSelector< T > > > | AllPrefabs [get] |
AllPrefabs exposes all prefabs instead of just the active ones. More... | |
T | this[Identifier identifier] [get] |
Returns the active prefab with the given identifier. More... | |
T | this[string identifier] [get] |
IEnumerable< Identifier > | Keys [get] |
T | : | notnull | |
T | : | Prefab |
Definition at line 13 of file PrefabCollection.cs.
Default constructor.
Definition at line 18 of file PrefabCollection.cs.
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.
Definition at line 27 of file PrefabCollection.cs.
Barotrauma.PrefabCollection< T >.PrefabCollection | ( | Action? | onSort | ) |
Constructor with only the OnSort callback provided.
Definition at line 44 of file PrefabCollection.cs.
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 |
Definition at line 366 of file PrefabCollection.cs.
void Barotrauma.PrefabCollection< T >.AddOverrideFile | ( | ContentFile | file | ) |
Adds an override file to the collection.
Definition at line 457 of file PrefabCollection.cs.
bool Barotrauma.PrefabCollection< T >.ContainsKey | ( | Identifier | identifier | ) |
Returns true if a prefab with the given identifier exists, false otherwise.
identifier | Prefab identifier |
Definition at line 334 of file PrefabCollection.cs.
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. |
Definition at line 316 of file PrefabCollection.cs.
IEnumerator<T> Barotrauma.PrefabCollection< T >.GetEnumerator | ( | ) |
GetEnumerator implementation to enable foreach
Definition at line 512 of file PrefabCollection.cs.
bool Barotrauma.PrefabCollection< T >.IsOverride | ( | T | prefab | ) |
Determines whether a prefab is implemented as an override or not.
prefab | Prefab in this collection |
Definition at line 347 of file PrefabCollection.cs.
void Barotrauma.PrefabCollection< T >.Remove | ( | T | prefab | ) |
Removes a prefab from the collection.
prefab | Prefab |
Definition at line 419 of file PrefabCollection.cs.
void Barotrauma.PrefabCollection< T >.RemoveByFile | ( | ContentFile | file | ) |
Removes all prefabs that were loaded from a certain file.
Definition at line 437 of file PrefabCollection.cs.
void Barotrauma.PrefabCollection< T >.RemoveOverrideFile | ( | ContentFile | file | ) |
Removes an override file from the collection.
Definition at line 470 of file PrefabCollection.cs.
void Barotrauma.PrefabCollection< T >.SortAll | ( | ) |
Sorts all prefabs in the collection based on the content package load order.
Definition at line 483 of file PrefabCollection.cs.
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) |
Definition at line 285 of file PrefabCollection.cs.
bool Barotrauma.PrefabCollection< T >.TryGet | ( | string | identifier, |
out T? | result | ||
) |
|
get |
AllPrefabs exposes all prefabs instead of just the active ones.
Definition at line 234 of file PrefabCollection.cs.
|
get |
Definition at line 308 of file PrefabCollection.cs.
|
get |
Returns the active prefab with the given identifier.
identifier | Prefab identifier |
Definition at line 252 of file PrefabCollection.cs.
|
get |
Definition at line 267 of file PrefabCollection.cs.