protected override System.Collections.IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, MovieItem movieItem, ResourceBase resource)
        {
            var  resourceId = resource.GetId();
            Item item;

            if (this.itemsByResourceId.TryGetValue(resourceId, out item) == false)
            {
                asyncOperation.SetValues(isDone: false, progress: 0.0f, asset: null);

                var resourcePath = resource.GetStreamPath(withFile: true);
                item = new Item(resourcePath);
                this.itemsByResourceId[resourceId] = item;
            }

            while (item.IsReady() == false)
            {
                if (item.IsError() == true)
                {
                    asyncOperation.SetValues(isDone: true, progress: 1f, asset: null);
                    yield break;
                }

                yield return(0);
            }

            asyncOperation.SetValues(isDone: true, progress: 1f, asset: item.GetMaterial());
        }
Exemplo n.º 2
0
        protected override IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, MovieItem movieItem, ResourceBase resource)
        {
            var streamPath = resource.GetStreamPath(withFile: false);

            var item = this.FindInstance(resource);

            if (item != null)
            {
                Debug.LogError("[MediaMovieModule] Already playing " + streamPath);
            }
            else
            {
                item = this.CreatePlayerInstance(movieItem);
                this.playingInstances.Add(streamPath, item);
                this.counter = this.playingInstances.Count;
            }

            yield return(false);

            if (item.Load(streamPath) == false)
            {
                asyncOperation.SetValues(isDone: true, progress: 1f, asset: null);
            }
            else
            {
                while (item.IsReady() == false)
                {
                    yield return(false);
                }

                asyncOperation.SetValues(isDone: true, progress: 1f, asset: item.GetTexture());
            }
        }
		protected override IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, ResourceBase resource) {

			var filePath = resource.GetStreamPath();

			var task = new WWW(filePath);
			while (task.isDone == false) {

				asyncOperation.SetValues(isDone: false, progress: task.progress, asset: null);
				yield return false;

			}

			var movie = task.movie;

			asyncOperation.SetValues(isDone: false, progress: 1f, asset: movie);

			task.Dispose();
			task = null;
			System.GC.Collect();

			//Debug.LogWarning("GetTexture_YIELD: " + filePath + " :: " + movie.isReadyToPlay);

			while (movie.isReadyToPlay == false) {

				yield return false;

			}

			asyncOperation.SetValues(isDone: true, progress: 1f, asset: movie);

		}
Exemplo n.º 4
0
        protected override System.Collections.IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, MovieItem movieItem, ResourceBase resource)
        {
            var filePath = resource.GetStreamPath();

            var task = new WWW(filePath);

            while (task.isDone == false)
            {
                asyncOperation.SetValues(isDone: false, progress: task.progress, asset: null);
                yield return(0);
            }

                        #if UNITY_5_6_OR_NEWER
            var movie = task.GetMovieTexture();
                        #else
            var movie = task.movie;
                        #endif

            asyncOperation.SetValues(isDone: false, progress: 1f, asset: movie);

            task.Dispose();
            task = null;
            System.GC.Collect();

            //Debug.LogWarning("GetTexture_YIELD: " + filePath + " :: " + movie.isReadyToPlay);

            while (movie.isReadyToPlay == false)
            {
                yield return(0);
            }

            asyncOperation.SetValues(isDone: true, progress: 1f, asset: movie);
        }
Exemplo n.º 5
0
        protected override IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, ResourceBase resource)
        {
            var filePath = resource.GetStreamPath();

            if (filePath.Contains("://") == false)
            {
                filePath = "file:///" + filePath;
            }

            var task = new WWW(filePath);

            while (task.isDone == false)
            {
                asyncOperation.SetValues(isDone: false, progress: task.progress, asset: null);
                yield return(false);
            }

            var movie = task.movie;

            asyncOperation.SetValues(isDone: false, progress: 1f, asset: movie);

            task.Dispose();
            task = null;
            System.GC.Collect();

            //Debug.LogWarning("GetTexture_YIELD: " + filePath + " :: " + movie.isReadyToPlay);

            while (movie.isReadyToPlay == false)
            {
                yield return(false);
            }

            asyncOperation.SetValues(isDone: true, progress: 1f, asset: movie);
        }
Exemplo n.º 6
0
        public ResourceAsyncOperation LoadTexture(IImageComponent component)
        {
            var request = new ResourceAsyncOperation();

            this.StartCoroutine(this.LoadTexture_YIELD(request, component, component.GetResource()));

            return(request);
        }
Exemplo n.º 7
0
 internal ResourceRequest(string fileName, ResourceType resourceType, ResourcesManager.HandleFinishLoadLevel handle, ResourceRequestType requestType, ResourceAsyncOperation operation)
 {
     mFileName               = fileName;
     mResourceType           = resourceType;
     mHandleLevel            = handle;
     mRequestType            = requestType;
     mResourceAsyncOperation = operation;
 }
Exemplo n.º 8
0
		public ResourceAsyncOperation LoadTexture(IImageComponent component) {

			var request = new ResourceAsyncOperation();
			this.StartCoroutine(this.LoadTexture_YIELD(request, component, component.GetResource()));

			return request;

		}
Exemplo n.º 9
0
    //public void LoadSceneAsset(string name)
    //{
    //    ResourceManager.Instance.loadProcess.Start();
    //    BlGame.Resource.ResourceManager.Instance.loadProcess.AddLogicFile("Scene/Prefab/" + name + "_Scene.assetbundle", BlGame.Resource.LogicResouce.ELogicResType.ERes_Scene);
    //    BlGame.Resource.ResourceManager.Instance.loadProcess.SceneRes = "Scene/Prefab/" + name + "_Scene.assetbundle";
    //}
    public void LoadAsignedSene(string name)
    {
        //加载场景之前需要进行清除操作
        BlGame.Effect.EffectManager.Instance.DestroyAllEffect();
        //清除GameObjectPool数据
        GameObjectPool.Instance.Clear();

        async = ResourcesManager.Instance.loadLevel(name, null);
    }
Exemplo n.º 10
0
        // 加载场景
        public void LoadScene()
        {
            // 加载场景之前需要进行清除操作

            string name = GetLoadMapName();

            // ObjectPool.instanc.clear
            mAsync = ResourceManager.Instance.LoadLevel("Scenes/" + name, null);
        }
Exemplo n.º 11
0
    //public void LoadSceneAsset(string name)
    //{
    //    ResourceManager.Instance.loadProcess.Start();
    //    BlGame.Resource.ResourceManager.Instance.loadProcess.AddLogicFile("Scene/Prefab/" + name + "_Scene.assetbundle", BlGame.Resource.LogicResouce.ELogicResType.ERes_Scene);
    //    BlGame.Resource.ResourceManager.Instance.loadProcess.SceneRes = "Scene/Prefab/" + name + "_Scene.assetbundle";
    //}
    public void LoadAsignedSene(string name)
    {
        //���س���֮ǰ��Ҫ�����������
        BlGame.Effect.EffectManager.Instance.DestroyAllEffect();
        //���GameObjectPool����
        GameObjectPool.Instance.Clear();

        async = ResourcesManager.Instance.loadLevel(name, null);
    }
        public ResourceAsyncOperation LoadTexture(IImageComponent component)
        {
            /*if (this.IsMaterialLoadingType() == true) {
             *
             * } else {
             *
             *      MovieSystem.UnregisterOnUpdateTexture(this.ValidateTexture);
             *      MovieSystem.RegisterOnUpdateTexture(this.ValidateTexture);
             *
             * }*/

            var request   = new ResourceAsyncOperation();
            var resource  = component.GetResource();
            var movieItem = this.GetMovieItem(component, resource);

            this.StartCoroutine(this.LoadTexture_YIELD(request, component, movieItem, resource));

            return(request);
        }
Exemplo n.º 13
0
        protected override IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, ResourceBase resource)
        {
            var filePath = resource.GetStreamPath();

            var instance = this.FindInstance(resource);

            if (instance != null)
            {
                instance.Load(asyncOperation, filePath);
            }
            else
            {
                var item = new VideoPlayerInterface(this.system);
                this.playingInstances.Add(filePath, item);
                item.Load(asyncOperation, filePath);
            }

            yield return(false);
        }
Exemplo n.º 14
0
        protected override System.Collections.IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, MovieItem movieItem, ResourceBase resource)
        {
            var streamPath = resource.GetStreamPath(withFile: false);

            var instance = this.FindInstance(resource);

            if (instance != null)
            {
                if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
                {
                    UnityEngine.Debug.LogError("[MediaMovieModule] Already playing " + streamPath);
                }
            }
            else
            {
                instance = new Item(streamPath);
                this.playingInstances.Add(streamPath, instance);
                this.counter = this.playingInstances.Count;
            }

            yield return(0);

            while (true)
            {
                if (instance.IsFailed() == true)
                {
                    asyncOperation.SetValues(isDone: true, progress: 1f, asset: null);
                    break;
                }
                else if (instance.IsReady() == true)
                {
                    asyncOperation.SetValues(isDone: true, progress: 1f, asset: instance.GetTexture());
                    break;
                }
                else
                {
                    yield return(0);
                }
            }
        }
    public void Load(ResourceAsyncOperation asyncOperation, string filepath)
    {
        if (this.videoReady == true)
        {
            asyncOperation.SetValues(isDone: true, progress: 1f, asset: this.videoTexture);
            //callback.Invoke();
            return;
        }

        Debug.Log("LOAD VideoPlayerInterface: " + this.filepath);
        this.filepath        = filepath;
        this.waitingForLoad += () => {
            asyncOperation.SetValues(isDone: true, progress: 1f, asset: this.videoTexture);
            //if (callback != null) callback.Invoke();
        };

        if (VideoPlayer_Load(this.filepath) == true)
        {
            asyncOperation.SetValues(isDone: true, progress: 1f, asset: null);
            Debug.Log("Failed to load: " + this.filepath);
        }
    }
Exemplo n.º 16
0
        protected override System.Collections.IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, MovieItem movieItem, ResourceBase resource)
        {
            var resourceId = resource.GetId();
            //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log("LoadTexture_YIELD: " + resourceId);
            Item item;

            if (this.itemsByResourceId.TryGetValue(resourceId, out item) == false)
            {
                asyncOperation.SetValues(isDone: false, progress: 0.0f, asset: null);

                bool withFile = true;
#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_LINUX
                withFile = false;
#endif
                var resourcePath = resource.GetStreamPath(withFile);
                //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log("NEW LoadTexture_YIELD PATH: " + resourcePath);
                item = new Item(this.videoPlayerProto, resourcePath);
                this.itemsByResourceId[resourceId] = item;
            }

            while (item.IsReady() == false)
            {
                if (item.IsError() == true)
                {
                    //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log("NEW LoadTexture_YIELD ERROR: " + item.GetTexture());
                    asyncOperation.SetValues(isDone: true, progress: 1f, asset: null);
                    yield break;
                }

                yield return(0);
            }

            yield return(0);

            //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log("NEW LoadTexture_YIELD LOAD: " + item.IsError() + " :: " + item.GetTexture());
            asyncOperation.SetValues(isDone: true, progress: 1f, asset: item.GetTexture());
        }
Exemplo n.º 17
0
        protected override IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, ResourceBase resource)
        {
            var filePath = resource.GetStreamPath();

            //Debug.Log("LOADING: " + filePath);

            Item item     = null;
            var  instance = this.FindInstance(resource);

            if (instance != null)
            {
                item = instance;
            }
            else
            {
                item = this.CreatePlayerInstance();
                this.playingInstances.Add(filePath, item);
            }

            //Debug.Log ("DONE: " + item.material);
            asyncOperation.SetValues(isDone: true, progress: 1f, asset: item.material);

            yield return(false);
        }
Exemplo n.º 18
0
        protected override System.Collections.Generic.IEnumerator <byte> LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, ResourceBase resource)
        {
            var filePath = resource.GetStreamPath();

            //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log("LOADING: " + filePath);

            Item item     = null;
            var  instance = this.FindInstance(resource);

            if (instance != null)
            {
                item = instance;
            }
            else
            {
                item = this.CreatePlayerInstance();
                this.playingInstances.Add(filePath, item);
            }

            //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log ("DONE: " + item.material);
            asyncOperation.SetValues(isDone: true, progress: 1f, asset: item.material);

            yield return(0);
        }
        /*private void ValidateTexture(IImageComponent component, Texture texture) {
         *
         *      var comp = component as WindowComponent;
         *      foreach (var item in this.current) {
         *
         *              if (item.components.Contains(comp) == true) {
         *
         *                      item.loadedObject = texture;
         *                      item.loadedObjectId = texture.GetInstanceID();
         *
         *              }
         *
         *      }
         *
         * }*/

        protected virtual System.Collections.IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, MovieItem movieItem, ResourceBase resource)
        {
            yield return(0);
        }
Exemplo n.º 20
0
 public void LoadAsignedSene(string name)
 {
     Thanos.Effect.EffectManager.Instance.DestroyAllEffect();
     ObjectPool.Instance.Clear();
     async = ResourcesManager.Instance.loadLevel(name, null);
 }
	public void Load(ResourceAsyncOperation asyncOperation, string filepath) {
		
		if (this.videoReady == true) {

			asyncOperation.SetValues(isDone: true, progress: 1f, asset: this.videoTexture);
			//callback.Invoke();
			return;

		}

		this.filepath = filepath;

		Debug.Log("LOAD VideoPlayerInterface: " + this.filepath);
		this.waitingForLoad += () => {

			Debug.Log("VideoPlayerInterface: waitingForLoad" + this.filepath);
			asyncOperation.SetValues(isDone: true, progress: 1f, asset: this.videoTexture);
			//if (callback != null) callback.Invoke();

		};

		if (VideoPlayer_Load(this.filepath) == false) {

			asyncOperation.SetValues(isDone: true, progress: 1f, asset: null);
			Debug.Log("Failed to load: " + this.filepath);

		}

	}
Exemplo n.º 22
0
 protected virtual IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, ResourceBase resource)
 {
     yield return(false);
 }
Exemplo n.º 23
0
		protected virtual IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, ResourceBase resource) {

			yield return false;

		}
Exemplo n.º 24
0
		protected override IEnumerator LoadTexture_YIELD(ResourceAsyncOperation asyncOperation, IImageComponent component, ResourceBase resource) {
			
			var filePath = resource.GetStreamPath();
			
			var instance = this.FindInstance(resource);
			if (instance != null) {

				instance.Load(asyncOperation, filePath);

			} else {

				var item = new VideoPlayerInterface(this.system);
				this.playingInstances.Add(filePath, item);
				item.Load(asyncOperation, filePath);

			}

			yield return false;

		}