protected Coroutine StartLoadCoroutine <T>(OnGetItem1 <T> evtKey, IEnumerator iter) where T : UnityEngine.Object { if (evtKey == null || iter == null) { return(null); } Delegate key = evtKey as Delegate; if (key == null) { return(null); } return(StartLoadCoroutine(key, iter)); }
protected IEnumerator LoadAsync <T>(int start, int end, OnGetItem1 <T> onGetItem, Func <T, string, string, bool> onLoad, float delayTime = 0) where T : UnityEngine.Object { if (start < 0 || end < 0 || end < start || onGetItem == null || onLoad == null) { yield break; } bool isDelayMode = delayTime > float.Epsilon; WaitForSeconds seconds = null; if (isDelayMode) { seconds = new WaitForSeconds(delayTime); } Delegate key = onGetItem as Delegate; for (int i = start; i <= end; ++i) { T target; string fileName; string param; if (!onGetItem(i, out target, out fileName, out param)) { StopLoadCoroutine(key); yield break; } if (target != null && !string.IsNullOrEmpty(fileName)) { onLoad(target, fileName, param); } if (seconds != null) { yield return(seconds); } else { yield return(m_EndOfFrame); } } StopLoadCoroutine(key); }
protected IEnumerator LoadAsync <T>(int start, int end, OnGetItem1 <T> onGetItem, Func <T, string, string, bool> onLoad) where T : UnityEngine.Object { if (start < 0 || end < 0 || end > start || onGetItem == null || onLoad == null) { yield break; } for (int i = start; i < end; ++i) { T target; string fileName; string param; if (!onGetItem(i, out target, out fileName, out param)) { yield break; } if (target != null && !string.IsNullOrEmpty(fileName)) { onLoad(target, fileName, param); } yield return(target); } }
public void LoadSpriteAsync(int start, int end, OnGetItem1 <UI2DSprite> onGetItem, float delayTime = 0) { StartLoadCoroutine(onGetItem, LoadAsync <UI2DSprite>(start, end, onGetItem, LoadSprite, delayTime)); }
public void LoadSpriteAsync(int start, int end, OnGetItem1 <SpriteRenderer> onGetItem) { StartCoroutine(LoadAsync <SpriteRenderer>(start, end, onGetItem, LoadSprite)); }
public void LoadSpriteAsync(int start, int end, OnGetItem1 <UI2DSprite> onGetItem) { StartCoroutine(LoadAsync <UI2DSprite>(start, end, onGetItem, LoadSprite)); }
public void LoadTextureAsync(int start, int end, OnGetItem1 <UITexture> onGetItem) { StartCoroutine(LoadAsync <UITexture>(start, end, onGetItem, LoadTexture)); }