feat: add initial People Playground mod development kit
This commit is contained in:
41
extracted_wiki_content/internalReference/pool_t.txt
Normal file
41
extracted_wiki_content/internalReference/pool_t.txt
Normal file
@@ -0,0 +1,41 @@
|
||||
URL: https://wiki.studiominus.nl/internalReference/Pool.html
|
||||
Title: People Playground Modding - Pool<T>
|
||||
==================================================
|
||||
|
||||
public abstract class Pool
|
||||
Abstract class for object poolingThe type to pool
|
||||
Fields
|
||||
public readonly int MaximumCapacity
|
||||
The maximum amount of objects, active or inactive
|
||||
|
||||
Properties
|
||||
public int CreatedAmount { get; private set; }
|
||||
How many objects have been created
|
||||
|
||||
public int AmountInUse
|
||||
No description provided
|
||||
|
||||
Methods
|
||||
public (constructor) Pool(int maxCapacity = 1000)
|
||||
Create a pool with the given capacity
|
||||
|
||||
public virtual T RequestObject()
|
||||
Get an object from the pool. This will be ready for use or null, if the pool is at full capacity.
|
||||
|
||||
public virtual void ReturnToPool(T obj)
|
||||
Return an object to the pool when it's done, to allow it to be requested again
|
||||
|
||||
public virtual void Prefill()
|
||||
Create a new available object and add it to the pool, waiting to be used
|
||||
|
||||
protected virtual T GetExistingFromPool()
|
||||
Get an existing object from the pool guaranteeing never to create a new one. Can return null.
|
||||
|
||||
protected abstract T CreateFresh()
|
||||
Return a completely new instance of the poolable object
|
||||
|
||||
protected abstract void ResetObjectForNextUse(T obj)
|
||||
Reset the given object for its next use
|
||||
|
||||
protected abstract T GetOverCapacityFallback()
|
||||
What to return instead of null when the pool is at full capacity
|
||||
Reference in New Issue
Block a user