public IImageComponent SetMovieTexture(AutoResourceItem resource, System.Action onDataLoaded, System.Action onComplete = null)
        {
            this.Stop();
            this.SetImage(resource, onDataLoaded, onComplete);

            return(this);
        }
Beispiel #2
0
        public IImageComponent SetMovieTexture(AutoResourceItem resource, System.Action onDataLoaded, System.Action onComplete = null, System.Action onFailed = null)
        {
            this.flipVerticalInternal = MovieSystem.IsVerticalFlipped();

            this.Stop();
            this.SetImage(resource,
                          onDataLoaded: () => {
                if (onDataLoaded != null)
                {
                    onDataLoaded.Invoke();
                }
            },
                          onComplete: () => {
                //Debug.Log("SetMovieTexture: " + this.name);
                MovieSystem.UnregisterOnUpdateTexture(this.ValidateTexture);
                MovieSystem.RegisterOnUpdateTexture(this.ValidateTexture);
                if (onComplete != null)
                {
                    onComplete.Invoke();
                }
            },
                          onFailed: onFailed);

            return(this);
        }
Beispiel #3
0
        public IImageComponent SetImage(AutoResourceItem resource, System.Action onDataLoaded = null, System.Action onComplete = null, System.Action onFailed = null)
        {
            var oldResource = this.imageResource;

            this.imageResource = resource;

            //Debug.Log("Loading resource: " + this.imageResource.GetId());
            WindowSystemResources.Load(this,
                                       onDataLoaded: onDataLoaded,
                                       onComplete: () => {
                //Debug.Log("Resource loaded: " + newResource.GetId() + " :: " + this.name, this);
                if (this.imageResource.GetId() != oldResource.GetId())
                {
                    //Debug.Log("Unloading: " + this.imageResource.GetId() + " != " + oldResource.GetId() + " :: " + this.name, this);
                    WindowSystemResources.Unload(this, oldResource, resetController: false);
                }

                if (onComplete != null)
                {
                    onComplete.Invoke();
                }
            },
                                       onFailed: () => {
                //Debug.Log("Resource loading failed: " + newResource.GetId() + " :: " + this.name, this);
                if (this.imageResource.GetId() != oldResource.GetId())
                {
                    //Debug.Log("Failed, Unloading: " + this.imageResource.GetId() + " != " + oldResource.GetId() + " :: " + this.name, this);
                    WindowSystemResources.Unload(this, oldResource, resetController: false);
                }

                if (onFailed != null)
                {
                    onFailed.Invoke();
                }
            }
                                       );

            return(this);
        }