示例#1
0
        public IImageComponent SetImage(UnityEngine.UI.Windows.Plugins.Localization.LocalizationKey key, params object[] parameters)
        {
            if (this.imageCrossFadeModule.IsValid() == true)
            {
                this.imageCrossFadeModule.Prepare(this);
            }

            this.lastImageLocalization           = true;
            this.lastImageLocalizationKey        = key;
            this.lastImageLocalizationParameters = parameters;

            this.SetImage(ResourceAuto.CreateResourceRequest(UnityEngine.UI.Windows.Plugins.Localization.LocalizationSystem.GetSpritePath(key, 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);
        }
        public static ResourceAuto GetResource(string groupName, string filename, string resourcesPathMask = "{0}", string webPathMask = null, string webPath = null, bool readable = true)
        {
            //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log("Load: " + groupName + " :: " + filename + " :: " + resourcesPathMask + " :: " + webPathMask);

            ResourceAuto resource = null;

            // Look up built-in storage
            if (resource == null)
            {
                var path = string.Format("{0}/{1}", groupName, string.Format(resourcesPathMask, filename));
                //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log("RES: " + path);
                if (UnityEngine.Resources.Load(path) != null)
                {
                    resource = ResourceAuto.CreateResourceRequest(path);
                }
            }

#if !UNITY_SWITCH
            // Look up cache storage
            if (resource == null)
            {
                var path = Utilities.GetCachePath(groupName, filename);
                if (File.Exists(path) == true)
                {
                    //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log("CCH: " + path);
                    resource = ResourceAuto.CreateWebRequest(path, readable: readable);
                }
            }
#endif

            // Create web request
            if (resource == null)
            {
                var path = (string.IsNullOrEmpty(webPath) == false ? webPath : string.Format(webPathMask, filename));
                //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log("WEB: " + path);
                resource = ResourceAuto.CreateWebRequest(path, readable: readable);
            }

            return(resource);
        }