Пример #1
0
        public void StartDownload()
        {
            URL _URL;

            // Check type of url
            if (m_URLString.StartsWith("http"))
            {
                _URL = URL.URLWithString(m_URLString);
            }
            else
            {
                _URL = URL.FileURLWithPath(m_URLString);
            }

            // Download image from given path
            DownloadTexture _newDownload = new DownloadTexture(_URL, true, true);

            _newDownload.OnCompletion = (Texture2D _texture, string _error) => {
                Debug.Log(string.Format("[DownloadTextureDemo] Texture download completed. Error= {0}.", _error.GetPrintableString()));

                if (_texture != null)
                {
                    m_renderer.sharedMaterial.mainTexture = _texture;
                }
            };

            // Start download
            _newDownload.StartRequest();
        }
Пример #2
0
        public void StartDownload()
        {
            URL _URL;

            // Check type of url
            if (m_URLString.StartsWith("http"))
            {
                _URL = URL.URLWithString(m_URLString);
            }
            else
            {
                _URL = URL.FileURLWithPath(m_URLString);
            }

            // Download image from given path
            DownloadTexture _newDownload = new DownloadTexture(_URL, true, true);

            _newDownload.OnCompletion = (Texture2D _texture, string _error) => {
                if (string.IsNullOrEmpty(_error))
                {
                    m_renderer.sharedMaterial.mainTexture = _texture;
                }
                else
                {
                    Debug.LogError("[DownloadTextureDemo] Error=" + _error);
                }
            };

            // Start download
            _newDownload.StartRequest();
        }
Пример #3
0
		public override void GetImageAsync (DownloadTexture.Completion _onCompletion)
		{
			if (_onCompletion != null)
			{
				if (m_userProfileData.image == null)
					_onCompletion(null, "Texture not found.");
				else
					_onCompletion(m_userProfileData.image, null);
			}
		}
        public void StartDownload()
        {
            URL _URL;

            // Check type of url
            if (m_URLString.StartsWith("http"))
                _URL = URL.URLWithString(m_URLString);
            else
                _URL = URL.FileURLWithPath(m_URLString);

            // Download image from given path
            DownloadTexture _newDownload	= new DownloadTexture(_URL, true, true);
            _newDownload.OnCompletion		= (Texture2D _texture, string _error)=>{

                if (string.IsNullOrEmpty(_error))
                m_renderer.sharedMaterial.mainTexture	= _texture;
                else
                    Debug.LogError("[DownloadTextureDemo] Error=" + _error);
            };

            // Start download
            _newDownload.StartRequest();
        }
		public void StartDownload ()
		{
			URL _URL;

			// Check type of url
			if (m_URLString.StartsWith("http"))
				_URL = URL.URLWithString(m_URLString);
			else
				_URL = URL.FileURLWithPath(m_URLString);

			// Download image from given path
			DownloadTexture _newDownload	= new DownloadTexture(_URL, true, true);
			_newDownload.OnCompletion		= (Texture2D _texture, string _error)=>{

				Debug.Log(string.Format("[DownloadTextureDemo] Texture download completed. Error= {0}.", _error.GetPrintableString()));

				if (_texture != null)
					m_renderer.sharedMaterial.mainTexture	= _texture;
			};
			
			// Start download
			_newDownload.StartRequest();
		}
		public override void GetImageAsync (DownloadTexture.Completion _onCompletion)
		{
			if (_onCompletion != null)
			{
				if (m_achievementDescriptionData.image == null)
					_onCompletion(null, "Texture not found.");
				else
					_onCompletion(m_achievementDescriptionData.image, null);
			}
		}
		/// <summary>
		/// Asynchronously loads the image.
		/// </summary>
		/// <param name="_onCompletion">Callback to be triggered after loading the image.</param>
		public abstract void GetImageAsync (DownloadTexture.Completion _onCompletion);