private void ProcessResource(ContentPreload resource)
        {
            try
            {
                var id   = resource.ID;
                var item = resource.Item;

                switch (resource.Type)
                {
                case ContentPreloadType.UITexture:
                    /** Apply alpha channel masking & load into GD **/
                    UIElement.StoreTexture(id, item, true, true);
                    break;

                case ContentPreloadType.UITexture_NoMask:
                    UIElement.StoreTexture(id, item, false, false);
                    break;

                case ContentPreloadType.Other:
                    ContentManager.TryToStoreResource(id, item);
                    break;
                }
            }
            catch
            {
            }
        }
        private static void ProcessResource(ContentPreload resource, ContentResource item)
        {
            var id = resource.ID;

            try
            {
                switch (resource.Type)
                {
                case ContentPreloadType.UITexture:
                    /** Apply alpha channel masking & load into GD **/
                    UIElement.StoreTexture(id, item, true, true);
                    break;

                case ContentPreloadType.UITexture_NoMask:
                    UIElement.StoreTexture(id, item, false, true);
                    break;

                case ContentPreloadType.Other:
                    ContentManager.TryToStoreResource(id, item);
                    break;
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Failed to load file: " + id + ", " + e.Message);
            }
        }
Пример #3
0
        private void Preload(ContentPreload workItem)
        {
            var id = workItem.ID;

            try
            {
                var item = ContentManager.GetResourceInfo(id);

                switch (workItem.Type)
                {
                    case ContentPreloadType.UITexture:
                        /** Apply alpha channel masking & load into GD **/
                        UIElement.StoreTexture(id, item);
                        break;

                    case ContentPreloadType.UITexture_NoMask:
                        UIElement.StoreTexture(id, item, false, true);
                        break;

                    case ContentPreloadType.Other:
                        ContentManager.TryToStoreResource(id, item);
                        break;
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Failed to load file: " + id + ", " + e.Message);
            }
        }
Пример #4
0
        public void Run()
        {
            while (true)
            {
                ContentPreload workItem = null;

                lock (Work)
                {
                    if (Work.Count == 0)
                    {
                        break;
                    }
                    else
                    {
                        workItem = Work[0];
                        Work.RemoveAt(0);
                    }
                }


                if (workItem != null)
                {
                    Preload(workItem);
                }
            }


            /** All done **/
            ActiveWorkers.Remove(this);
        }
        public void Process(ContentPreload resource, ContentResource item)
        {
            m_Lock.WaitOne();

            lock (m_Work)
            {
                resource.Item = item;
                m_Work.Add(resource);
            }
        }
 private void DoProcess()
 {
     while (!m_Done)
     {
         ContentPreload nextWork = null;
         lock (m_Work)
         {
             if (m_Work.Count > 0)
             {
                 nextWork = m_Work[0];
                 m_Work.RemoveAt(0);
             }
         }
         if (nextWork != null)
         {
             ProcessResource(nextWork);
             m_Lock.Release();
         }
     }
 }
Пример #7
0
        private void ProcessResource(ContentPreload resource)
        {
            try
            {
                var id = resource.ID;
                var item = resource.Item;

                switch (resource.Type)
                {
                    case ContentPreloadType.UITexture:
                        /** Apply alpha channel masking & load into GD **/
                        UIElement.StoreTexture(id, item, true, true);
                        break;

                    case ContentPreloadType.UITexture_NoMask:
                        UIElement.StoreTexture(id, item, false, false);
                        break;

                    case ContentPreloadType.Other:
                        ContentManager.TryToStoreResource(id, item);
                        break;
                }
            }
            catch
            {
            }
        }
Пример #8
0
        public void Process(ContentPreload resource, ContentResource item)
        {
            m_Lock.WaitOne();

            lock (m_Work)
            {
                resource.Item = item;
                m_Work.Add(resource);
            }
        }