Exemplo n.º 1
0
        public static void BulkLoadAssets(IEnumerable <ResourcePtr> Resources, Action LoadCompleteDelegate, ResourceLoadingProgress resourceLoadingProgressDelegate)
        {
            if (Resources == null)
            {
                LoadCompleteDelegate?.Invoke();
                return;
            }

            //If the engine doesn't exist, just process them now
            if (Engine.Instance == null)
            {
                for (int i = 0; i < Resources.Count(); i++)
                {
                    ResourcePtr Ptr = Resources.ElementAt(i);
                    resourceLoadingProgressDelegate?.Invoke(Ptr, i, Resources.Count());
                    Ptr.Load();
                }
                LoadCompleteDelegate?.Invoke();
            }
            else
            {
                //Create a bulk task for the engine to process
                ResourceLoadingTask Task = new ResourceLoadingTask(Resources);
                Task.LoadingProgressDelegate = resourceLoadingProgressDelegate;
                Task.PostLoadAction          = LoadCompleteDelegate;
                LoadingTasks.Add(Task);

                Engine.Instance.AddTickfunc(Task.TickFunc);
            }
        }
Exemplo n.º 2
0
        internal static void BulkLoadComplete(ResourceLoadingTask Task)
        {
            Task.PostLoadAction?.Invoke();

            Engine.Instance.RemoveTickfunc(Task.TickFunc);
            LoadingTasks.Remove(Task);
        }
Exemplo n.º 3
0
        internal static void BulkLoadComplete(ResourceLoadingTask Task)
        {
            Task.PostLoadAction?.Invoke();

            IEngine.Instance.GameThreadTickManager.RemoveTick(Task.TickFunc);
            LoadingTasks.Remove(Task);
        }