public void Play(IImageComponent component, bool loop, bool pause, System.Action onComplete) { var resource = component.GetResource(); if (resource.loaded == false) { if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) { UnityEngine.Debug.LogWarning("Resource was not loaded yet. Play interrupted.", component as MonoBehaviour); } return; } var item = this.GetMovieItem(component, resource); var movie = resource.loadedObject as Texture; if (item.state != MovieItem.State.Playing) { item.state = MovieItem.State.Playing; this.OnPlay(resource, movie, loop, onComplete); } if (pause == true || MovieSystem.CanPlayByQuality(movie) == false) { this.StartCoroutine(this.PauseWithDelay_YIELD(component, this.delayToPause)); } }
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 void PlayPauseAll() { this.StopAllCoroutines(); foreach (var task in this.current) { var texture = task.texture; if (MovieSystem.CanPlayByQuality(texture) == true) { foreach (var component in task.components) { this.OnPlay((component as ILoadableResource).GetResource(), texture, null); } } else { foreach (var component in task.components) { this.StartCoroutine(this.PauseWithDelay_YIELD(component as IImageComponent, texture, this.delayToPause, this.OnPause)); } } } }