예제 #1
0
        public void Play(IImageComponent component, bool loop, bool pause)
        {
            var image = component.GetRawImageSource();

            if (image == null)
            {
                return;
            }

            var resource = component.GetResource();

            if (resource.loaded == false)
            {
                Debug.LogWarning("Resource was not loaded yet. Play interrupted.", component as MonoBehaviour);
                return;
            }

            var movie = resource.loadedObject as Texture;

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

            if (item != null)
            {
                var c = component as WindowComponent;
                if (item.components.Contains(c) == false)
                {
                    item.components.Add(c);
                }
            }
            else
            {
                item = new Item()
                {
                    id         = resource.GetId(),
                    components = new List <WindowComponent>()
                    {
                        component as WindowComponent
                    },
                    loadedObject   = resource.loadedObject,
                    loadedObjectId = resource.loadedObjectId,
                };

                this.current.Add(item);
            }

            if (item.state != Item.State.Playing)
            {
                item.state = Item.State.Playing;
                this.OnPlay(resource, movie, loop);
            }

            if (pause == true || MovieSystem.CanPlayByQuality(movie) == false)
            {
                this.StartCoroutine(this.PauseWithDelay_YIELD(component, this.delayToPause));
            }
        }
예제 #2
0
        public bool IsPlaying(IImageComponent component)
        {
            var image = component.GetRawImageSource();

            if (image == null)
            {
                return(false);
            }

            return(this.IsPlaying(component.GetResource(), image.mainTexture));
        }
예제 #3
0
        public void Stop(IImageComponent component)
        {
            var image = component.GetRawImageSource();

            if (image == null)
            {
                return;
            }

            var resource = component.GetResource();

            if (resource.loaded == false)
            {
                //Debug.LogWarning("Resource was not loaded yet. Stop interrupted.", component as MonoBehaviour);
                return;
            }

            var movie = resource.loadedObject as Texture;

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

            if (item != null)
            {
                item.components.Remove(component as WindowComponent);

                if (item.components.Count == 0)
                {
                    if (item.state != Item.State.Stopped)
                    {
                        item.state = Item.State.Stopped;
                        this.OnStop(resource, movie);

                        this.current.RemoveAll(x => x.id == item.id);
                    }
                }
            }
        }
예제 #4
0
		public bool IsPlaying(IImageComponent component) {
			
			var image = component.GetRawImageSource();
			if (image == null) return false;
			
			return this.IsPlaying(component.GetResource(), image.mainTexture);
			
		}
예제 #5
0
		public void Pause(IImageComponent component) {
			
			var image = component.GetRawImageSource();
			if (image == null) return;
			
			var resource = component.GetResource();
			if (resource.loaded == false) {
				
				Debug.LogWarning("Resource was not loaded yet. Pause interrupted.", component as MonoBehaviour);
				return;
				
			}
			
			var movie = resource.loadedObject as Texture;

			var item = this.current.FirstOrDefault(x => x.id == resource.GetId());
			if (item != null) {
				
				//item.components.Remove(component as WindowComponent);

				//if (item.components.Count == 0) {

					if (item.state != Item.State.Paused) {
						
						item.state = Item.State.Paused;
						this.OnPause(resource, movie);
						
					}
					
				//}

			}

		}
예제 #6
0
		public void Play(IImageComponent component, bool loop, bool pause) {
			
			var image = component.GetRawImageSource();
			if (image == null) return;

			var resource = component.GetResource();
			if (resource.loaded == false) {

				Debug.LogWarning("Resource was not loaded yet. Play interrupted.", component as MonoBehaviour);
				return;

			}

			var movie = resource.loadedObject as Texture;

			var item = this.current.FirstOrDefault(x => x.id == resource.GetId());
			if (item != null) {
				
				var c = component as WindowComponent;
				if (item.components.Contains(c) == false) {

					item.components.Add(c);

				}

			} else {

				item = new Item() {

					id = resource.GetId(),
					components = new List<WindowComponent>() { component as WindowComponent },
					loadedObject = resource.loadedObject,
					loadedObjectId = resource.loadedObjectId,

				};

				this.current.Add(item);
				
			}

			if (item.state != Item.State.Playing) {

				item.state = Item.State.Playing;
				this.OnPlay(resource, movie, loop);

			}
			
			if (pause == true || MovieSystem.CanPlayByQuality(movie) == false) {
				
				this.StartCoroutine(this.PauseWithDelay_YIELD(component, this.delayToPause));
				
			}

		}