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)); } }
public bool IsPlaying(IImageComponent component) { var image = component.GetRawImageSource(); if (image == null) { return(false); } return(this.IsPlaying(component.GetResource(), image.mainTexture)); }
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); } } } }
public bool IsPlaying(IImageComponent component) { var image = component.GetRawImageSource(); if (image == null) return false; return this.IsPlaying(component.GetResource(), image.mainTexture); }
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); } //} } }
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)); } }