private static IEnumerator _CoLoadInnerPrefabPool(InnerPrefabPool innerPool, Action <PrefabPool> handler) { var web = innerPool.GetWebPrefab(); while (!web.isDone) { yield return(null); } var pool = new PrefabPool(innerPool); CallbackTools.Handle(ref handler, pool, "[PrefabPool._CoLoadInnerPrefabPool()]"); }
public static IWebNode CreatePool(WebArgument argument, Action <PrefabPool> handler) { InnerPrefabPool innerPool; var key = argument.localPath; if (!_innerPools.TryGetValue(key, out innerPool)) { innerPool = new InnerPrefabPool(argument); _innerPools.Add(key, innerPool); } CoroutineManager.StartCoroutine(_CoLoadInnerPrefabPool(innerPool, handler)); var web = innerPool.GetWebPrefab(); return(web); }
public static PrefabPool CreatePool(string resourceKey, GameObject mainAsset) { if (null == mainAsset) { throw new ArgumentNullException("mainAsset should not be null."); } resourceKey = resourceKey ?? string.Empty; InnerPrefabPool innerPool; if (!_innerPools.TryGetValue(resourceKey, out innerPool)) { innerPool = new InnerPrefabPool(resourceKey, mainAsset); _innerPools.Add(resourceKey, innerPool); } var pool = new PrefabPool(innerPool); return(pool); }
internal PrefabPool(InnerPrefabPool innerPool) { _inner = innerPool; _inner.AddReference(); }