Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
PoolManager Class Reference
Inheritance diagram for PoolManager:

Classes

class  PoolGroup
 

Public Member Functions

PoolGroup CreateGroup (string id, Transform original)
 
PoolGroup CreateGroup (string id, string path)
 

Static Public Member Functions

static T Spawn< T > (T original, Component parent=null)
 
static T Spawn< T > (string id, string path, Transform parent=null)
 
static Transform Spawn (string id, string path, Transform parent)
 
static PoolGroup GetGroup (string id)
 
static void Despawn (Component c)
 
static bool TryDespawn (Component c)
 
static void DespawnOrDestroy (Component c)
 

Public Attributes

Dictionary< string, PoolGroupgroups
 
Dictionary< int, PoolGroupspawnedList
 

Static Public Attributes

static PoolManager current
 
static Transform _trans
 
static bool ignorePool
 

Private Member Functions

void Awake ()
 
Transform _Spawn (string id, string path, Transform parent)
 
Transform _Spawn (string id, Transform original, Transform parent)
 

Detailed Description

Definition at line 4 of file PoolManager.cs.

Member Function Documentation

◆ _Spawn() [1/2]

Transform PoolManager._Spawn ( string  id,
string  path,
Transform  parent 
)
inlineprivate

Definition at line 96 of file PoolManager.cs.

97 {
98 PoolGroup poolGroup = groups.TryGetValue(id);
99 if (poolGroup == null)
100 {
101 poolGroup = CreateGroup(id, path);
102 }
103 return poolGroup.Spawn(parent);
104 }
Dictionary< string, PoolGroup > groups
Definition: PoolManager.cs:63
PoolGroup CreateGroup(string id, Transform original)
Definition: PoolManager.cs:116

References CreateGroup(), groups, and PoolManager.PoolGroup.Spawn().

Referenced by Spawn(), and Spawn< T >().

◆ _Spawn() [2/2]

Transform PoolManager._Spawn ( string  id,
Transform  original,
Transform  parent 
)
inlineprivate

Definition at line 106 of file PoolManager.cs.

107 {
108 PoolGroup poolGroup = groups.TryGetValue(id);
109 if (poolGroup == null)
110 {
111 poolGroup = CreateGroup(id, original);
112 }
113 return poolGroup.Spawn(parent);
114 }

References CreateGroup(), groups, and PoolManager.PoolGroup.Spawn().

◆ Awake()

void PoolManager.Awake ( )
inlineprivate

Definition at line 67 of file PoolManager.cs.

68 {
69 current = this;
70 _trans = base.transform;
71 spawnedList = new Dictionary<int, PoolGroup>();
72 groups = new Dictionary<string, PoolGroup>();
73 base.gameObject.SetActive(value: false);
74 }
static PoolManager current
Definition: PoolManager.cs:57
static Transform _trans
Definition: PoolManager.cs:59
Dictionary< int, PoolGroup > spawnedList
Definition: PoolManager.cs:65

References _trans, current, groups, and spawnedList.

◆ CreateGroup() [1/2]

PoolGroup PoolManager.CreateGroup ( string  id,
string  path 
)
inline

Definition at line 123 of file PoolManager.cs.

124 {
125 return CreateGroup(id, Resources.Load<Transform>(path));
126 }

References CreateGroup().

◆ CreateGroup() [2/2]

PoolGroup PoolManager.CreateGroup ( string  id,
Transform  original 
)
inline

Definition at line 116 of file PoolManager.cs.

117 {
118 PoolGroup poolGroup = new PoolGroup(original, this, id);
119 groups.Add(id, poolGroup);
120 return poolGroup;
121 }

References groups.

Referenced by _Spawn(), and CreateGroup().

◆ Despawn()

static void PoolManager.Despawn ( Component  c)
inlinestatic

Definition at line 128 of file PoolManager.cs.

129 {
130 if (Application.isPlaying)
131 {
132 if (ignorePool)
133 {
134 Object.Destroy(c.gameObject);
135 }
136 else
137 {
138 current.spawnedList[c.transform.GetHashCode()].Despawn(c.transform);
139 }
140 }
141 }
static bool ignorePool
Definition: PoolManager.cs:61

References current, ignorePool, and spawnedList.

Referenced by MsgBox.AddLog(), MsgBox.Clear(), ActionMode.ClearSimpleTexts(), TaskDesignation.DespawnOrbit(), CardRenderer.DespawnSimpleText(), ButtonGrid.Dettach(), CardActor.Kill(), TC.Kill(), PopperManager.Kill(), CardRenderer.OnLeaveScreen(), and ButtonGrid.Reset().

◆ DespawnOrDestroy()

static void PoolManager.DespawnOrDestroy ( Component  c)
inlinestatic

Definition at line 158 of file PoolManager.cs.

159 {
160 if (ignorePool || !TryDespawn(c))
161 {
162 Object.Destroy(c.gameObject);
163 }
164 }
static bool TryDespawn(Component c)
Definition: PoolManager.cs:143

References ignorePool, and TryDespawn().

Referenced by Effect.Kill(), MsgBlock.Reset(), and MsgLine.Reset().

◆ GetGroup()

static PoolGroup PoolManager.GetGroup ( string  id)
inlinestatic

Definition at line 91 of file PoolManager.cs.

92 {
93 return current.groups[id];
94 }

References current, and groups.

◆ Spawn()

◆ Spawn< T >() [1/2]

static T PoolManager.Spawn< T > ( string  id,
string  path,
Transform  parent = null 
)
inlinestatic

Definition at line 81 of file PoolManager.cs.

82 {
83 return current._Spawn(id, path, parent).GetComponent<T>();
84 }

References _Spawn(), and current.

◆ Spawn< T >() [2/2]

static T PoolManager.Spawn< T > ( original,
Component  parent = null 
)
inlinestatic
Type Constraints
T :Component 

Definition at line 76 of file PoolManager.cs.

76 : Component
77 {
78 return current._Spawn(original.name, original.transform, parent?.transform).GetComponent<T>();
79 }

References _Spawn(), and current.

◆ TryDespawn()

static bool PoolManager.TryDespawn ( Component  c)
inlinestatic

Definition at line 143 of file PoolManager.cs.

144 {
145 if (ignorePool)
146 {
147 return false;
148 }
149 PoolGroup poolGroup = current.spawnedList.TryGetValue(c.transform.GetHashCode());
150 if (poolGroup == null)
151 {
152 return false;
153 }
154 poolGroup.Despawn(c.transform);
155 return true;
156 }

References current, PoolManager.PoolGroup.Despawn(), ignorePool, and spawnedList.

Referenced by UIList.ClearChildren(), and DespawnOrDestroy().

Member Data Documentation

◆ _trans

Transform PoolManager._trans
static

Definition at line 59 of file PoolManager.cs.

Referenced by Awake().

◆ current

PoolManager PoolManager.current
static

◆ groups

Dictionary<string, PoolGroup> PoolManager.groups

Definition at line 63 of file PoolManager.cs.

Referenced by _Spawn(), Awake(), CreateGroup(), and GetGroup().

◆ ignorePool

bool PoolManager.ignorePool
static

Definition at line 61 of file PoolManager.cs.

Referenced by Despawn(), DespawnOrDestroy(), PoolManager.PoolGroup.Spawn(), and TryDespawn().

◆ spawnedList

Dictionary<int, PoolGroup> PoolManager.spawnedList

Definition at line 65 of file PoolManager.cs.

Referenced by Awake(), Despawn(), PoolManager.PoolGroup.Spawn(), and TryDespawn().


The documentation for this class was generated from the following file: