public void Awake()
        {
            WindowSystemResources.instance = this;

            this.resourcesMap.Reset();
        }
示例#2
0
 public System.Collections.Generic.IEnumerator <byte> Load <T>(IResourceReference component, string customResourcePath, System.Action <T> callback, bool async)      /*where T : Object*/
 {
     return(WindowSystemResources.LoadResource <T>(this, component, customResourcePath, callback, async));
 }
        private void Unload_INTERNAL(ILoadableResource resourceController, ResourceBase resource, bool resetController = true)
        {
            /*
             * if (resource.loaded == false) {
             *
             *
             *      return;
             *
             * }*/

            //Debug.LogWarning("Unload: " + resource.GetId() + " :: " + resource.GetStreamPath(), resourceController as MonoBehaviour);

            var item = this.loaded.FirstOrDefault(x => x.id == resource.GetId());

            if (WindowSystemResources.Remove(item, resourceController as WindowComponent, forced: true) == true)
            {
                //Debug.LogWarning("Unload movie: " + resource.GetId(), resourceController as MonoBehaviour);

                MovieSystem.Unload(resourceController as IImageComponent, resource);
            }

            /*if (item != null) {
             *
             *      if (item.references.Remove(resourceController as WindowComponent) == true) {
             *
             *              this.loaded.RemoveAll(x => {
             *
             *                      if (x.id == resource.GetId() && x.references.Count == 0) {
             *
             *                              if (x.loadedObjectId < 0) Object.Destroy(x.loadedObject);
             *                              return true;
             *
             *                      }
             *
             *                      return false;
             *
             *              });
             *
             *      }
             *
             * }*/

            if (resetController == true)
            {
                var image  = resourceController as IImageComponent;
                var source = image.GetImageSource();
                if (source != null)
                {
                    image.ResetImage();
                    resource.Unload(source.sprite);
                }
                else
                {
                    var sourceRaw = image.GetRawImageSource();
                    if (sourceRaw != null)
                    {
                        image.ResetImage();
                        resource.Unload(sourceRaw.texture);
                    }
                }
            }
        }