/// <summary> /// 注册晚加载关系 /// </summary> /// <param name="intfType">接口类型或抽象类</param> /// <param name="implType">实现intfType的最终类型,必须有一个默认的无参构造类</param> /// <param name="priority">优先级,总是使用优先级最高的实现类</param> public static void RegisterLazyLoading( Type intfType, Type implType, LoadingPriority priority) { if (intfType == null) { throw new ArgumentNullException("intfType", "RegLazyLoadingAttribute 参数1不能为null。"); } if (implType == null) { throw new ArgumentNullException("implType", "RegLazyLoadingAttribute 参数2不能为null。"); } if (!intfType.IsAssignableFrom(implType)) { throw new ArgumentException(string.Format("类‘{0}’必须实现接口‘{1}'", implType, intfType)); } if (implType.GetConstructor(new Type[0]) == null) { throw new ArgumentException(string.Format("类‘{0}’没有默认构造函数", implType)); } var list = (ImplCollection)LazyLoadings[intfType]; if (list == null) { list = new ImplCollection(); LazyLoadings.Add(intfType, list); } list.Add(implType, priority); }
public static ResourceSpawnHandle SpawnAsync(ulong pathHash, LoadingPriority priority = LoadingPriority.Normal) { ResourceSpawnHandle result = null; if (!Application.isPlaying) { string path = HashToPath(pathHash); result = SpawnAsync(path, priority); } else { result = ResourcePoolManager.Instance.SpawnAsync(pathHash, (int)priority); } return(result); }
public static ResourceLoadHandle LoadAsync <T>(ulong pathHash, LoadingPriority priority = LoadingPriority.Normal) where T : Object { ResourceLoadHandle result = null; if (!Application.isPlaying) { string path = HashToPath(pathHash); result = LoadAsync <T>(path, priority); } else { result = ResourceDataManager.Instance.LoadAsync(pathHash, typeof(T), (int)priority); } return(result); }
public static ResourceSpawnHandle SpawnAsync(string path, LoadingPriority priority = LoadingPriority.Normal) { ResourceSpawnHandle result = null; if (!Application.isPlaying) { result = new ResourceSpawnHandle(); result.progress = 1.0f; result.isDone = true; result.gameObject = Spawn(path); } else { ulong pathHash = PathToHash(path); result = SpawnAsync(pathHash, priority); } return(result); }
public static ResourceLoadHandle LoadAsync <T>(string path, LoadingPriority priority = LoadingPriority.Normal) where T : Object { ResourceLoadHandle result = null; if (!Application.isPlaying) { result = new ResourceLoadHandle(); result.progress = 1.0f; result.isDone = true; result.asset = Resources.Load(path, typeof(T)); } else { ulong pathHash = PathToHash(path); result = LoadAsync <T>(pathHash, priority); } return(result); }
public static IScheduledWork Load(string url, UIImageView view, int retry = 0, LoadingPriority priority = LoadingPriority.Normal, string placeHolder = "", string microUrl = null, CGSize size = new CGSize()) { var width = (int)((size.Width == 0 ? view.Frame.Size.Width : size.Width) * UIScreen.MainScreen.Scale); return(ImageService.Instance.LoadUrl(url.GetImageProxy(width, width), TimeSpan.FromDays(5)) .Retry(retry) .FadeAnimation(false) .LoadingPlaceholder(placeHolder) .ErrorPlaceholder(placeHolder) .WithCache(FFImageLoading.Cache.CacheType.All) .WithPriority(priority) .Error((error) => { ImageService.Instance.LoadUrl(microUrl != null ? microUrl : url, TimeSpan.FromDays(5)) .Retry(retry) .FadeAnimation(false) .WithCache(FFImageLoading.Cache.CacheType.All) .DownSample((int)view.Frame.Size.Width) .WithPriority(priority) .Into(view); }) .Into(view)); }
public Implement(Type implType, LoadingPriority priority) { ImplType = implType; Priority = (byte)priority; metadatas = ImplType.GetCustomAttributes <Attribute>(false).ToArray(); }
public void Add(Type implType, LoadingPriority priority) { _list.Add(new Implement(implType, priority)); _sorted = _list.Count < 2; }
/// <summary> /// Defines the loading priority, the default is LoadingPriority.Normal /// </summary> /// <returns>The TaskParameter instance for chaining the call.</returns> /// <param name="priority">Priority.</param> public TaskParameter WithPriority(LoadingPriority priority) { Priority = (int)priority; return(this); }
/// <summary> /// Defines the loading priority, the default is LoadingPriority.Normal /// </summary> /// <returns>The TaskParameter instance for chaining the call.</returns> /// <param name="priority">Priority.</param> public TaskParameter WithPriority(LoadingPriority priority) { Priority = (int)priority; return this; }
/// <summary> /// Initializes a new instance of the <see cref="RegLazyLoadingAttribute"/> class. /// </summary> /// <param name="intfType">Type of the intf.</param> /// <param name="implType">Type of the impl.</param> /// <param name="priority">The priority.</param> public RegLazyLoadingAttribute(Type intfType, Type implType, LoadingPriority priority) { IntfType = intfType; ImplType = implType; Priority = priority; }
/// <summary> /// Initializes a new instance of the <see cref="RegLazyLoadingAttribute"/> class. /// </summary> /// <param name="intfType">Type of the intf.</param> /// <param name="implType">Type of the impl.</param> public RegLazyLoadingAttribute(Type intfType, Type implType) { IntfType = intfType; ImplType = implType; Priority = LoadingPriority.Normal; }
public ContentAttribute(string resourceName, ContentCategory contentCategory, LoadingPriority loadingPriority = LoadingPriority.Immediate) { this.ContentCategory = contentCategory; this.LoadingPriority = loadingPriority; this.ResourceName = resourceName; }
public Implement(Type implType, LoadingPriority priority) { ImplType = implType; Priority = (byte)priority; }