public IImageComponent SetImage(UnityEngine.UI.Windows.Plugins.Localization.LocalizationKey key, params object[] parameters)
        {
            this.lastImageLocalization           = true;
            this.lastImageLocalizationKey        = key;
            this.lastImageLocalizationParameters = parameters;

            //this.SetImage(UnityEngine.UI.Windows.Plugins.Localization.LocalizationSystem.GetSprite(key, parameters));
            WindowSystemResources.Unload(this, this.GetResource());
            WindowSystemResources.Load(this, onDataLoaded: null, onComplete: null, customResourcePath: UnityEngine.UI.Windows.Plugins.Localization.LocalizationSystem.GetSpritePath(key, parameters));

            return(this);
        }
Exemple #2
0
        private System.Collections.Generic.IEnumerator <byte> SetImage_INTERNAL(ResourceAuto resource, System.Action onDataLoaded = null, System.Action onComplete = null, System.Action onFailed = null)
        {
            yield return(0);

            if (this.imageCrossFadeModule.IsValid() == true)
            {
                this.imageCrossFadeModule.Prepare(this);
            }

            var oldResource = this.imageResource;
            var newResource = resource;

            this.imageResource = resource;

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


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

                if (onFailed != null)
                {
                    onFailed.Invoke();
                }
            }
                                       );
        }
Exemple #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);
        }