private void Retain(EventKey eventKey, Delegate d, AutoReleaseBase autoRelease) { if (autoRelease != null) { autoRelease.EventRetain(eventKey, d); } }
private void RetainAssets(string fullPath, AutoReleaseBase autoRelease) { if (autoRelease != null) { autoRelease.AssetRetain(fullPath); } }
public void AddLateUpdate(Action action, AutoReleaseBase autoRelease) { if (autoRelease != null) { autoRelease.ScriptUpdateRetain(action); } lateUpdatePreList.Add(action); }
private void AddDict(EventKey eventKey, Delegate d, AutoReleaseBase autoRelease) { if (!eventDict.ContainsKey(eventKey)) { eventDict.Add(eventKey, null); } else { //排查一下重复的,防止重复加 Delegate[] delegates = eventDict[eventKey].GetInvocationList(); foreach (var item in delegates) { if (item == d) { UnityEngine.Debug.LogWarning("重复==" + d); return; } } } eventDict[eventKey] = Delegate.Combine(eventDict[eventKey], d); Retain(eventKey, d, autoRelease); }
public static void SetSprite(Image image, string spriteName, string atlasName, AutoReleaseBase autoRelease) { SpriteAtlas atlas = AssetManager.AssetLoad.LoadAsset <SpriteAtlas>(GetAtlasPath(atlasName), autoRelease); image.sprite = atlas.GetSprite(spriteName); }
public static Image SetSprite(GameObject obj, string spriteName, string atlasName, AutoReleaseBase autoRelease) { Image image = obj.GetComponent <Image>(); SetSprite(image, spriteName, atlasName, autoRelease); return(image); }
public static Image SetSprite(Transform tf, string spriteName, string atlasName, AutoReleaseBase autoRelease) { return(SetSprite(tf.gameObject, spriteName, atlasName, autoRelease)); }
public void AddListener <T0, T1, T2, T3>(EventKey eventKey, Action <T0, T1, T2, T3> action, AutoReleaseBase autoRelease) { AddDict(eventKey, action, autoRelease); }
public void AddListener(EventKey eventKey, Action action, AutoReleaseBase autoRelease) { AddDict(eventKey, action, autoRelease); }
public void LoadAssetAsync <T>(List <string> pathList, Action <List <AssetLoadInfo> > action, AutoReleaseBase autoRelease, object arg = null) where T : Object { foreach (var item in pathList) { RetainAssets(item, autoRelease); } LoadAssetAsync <T>(pathList, action, arg); }
/// <summary> /// 异步加载 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="fullPath">完整资源路径</param> /// <param name="action">加载完成回调</param> /// <param name="arg">携带参数</param> /// <param name="autoRelease">自动卸载基类</param> public void LoadAssetAsync <T>(string fullPath, Action <AssetLoadInfo> action, AutoReleaseBase autoRelease, object arg = null) where T : Object { RetainAssets(fullPath, autoRelease); LoadAssetAsync <T>(fullPath, action, arg); }
/// <summary> /// 同步加载 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="fullPath">完整资源路径</param> /// <param name="autoRelease">自动卸载基类</param> /// <returns></returns> public T LoadAsset <T>(string fullPath, AutoReleaseBase autoRelease) where T : Object { RetainAssets(fullPath, autoRelease); return(LoadAsset <T>(fullPath)); }