예제 #1
0
    void OnReceiveJPEG()
    {
        if (!ImageConversion.LoadImage(texture, m_Message.ToArray(), false))
        {
            if (debug)
            {
                Debug.LogError("Failed to load JPEG from message");
            }
        }

        if (null != TextureChanged)
        {
            TextureChanged.Invoke();
        }
    }
예제 #2
0
        /// <summary>
        /// Changes the texture for a stationary <see cref="GrhData"/>.
        /// </summary>
        /// <param name="newTexture">Name of the new texture to use.</param>
        /// <param name="source">A <see cref="Rectangle"/> describing the source area of the texture to
        /// use for this <see cref="GrhData"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="newTexture" /> is <c>null</c>.</exception>
        public void ChangeTexture(TextureAssetName newTexture, Rectangle source)
        {
            if (newTexture == null)
            {
                throw new ArgumentNullException("newTexture");
            }

            // Check that the values have changed
            if (source == SourceRect && TextureName == newTexture)
            {
                return;
            }

            SetSourceRect(source);

            // Check that it is actually a different texture
            TextureAssetName oldTextureName = null;

            if (TextureName != newTexture)
            {
                oldTextureName = _textureName;
            }

            // Apply the new texture
            _texture      = null;
            _isUsingAtlas = false;
            _textureName  = newTexture;

            ValidateTexture();

            if (oldTextureName != null)
            {
                if (TextureChanged != null)
                {
                    TextureChanged.Raise(this, EventArgsHelper.Create <ContentAssetName>(oldTextureName));
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Implementation of the <see cref="IDisposable"/> interface.
 /// </summary>
 public void Dispose()
 {
     TextureChanged?.Invoke(this, new TextureEventArgs(this, TextureChangedEnum.Disposed));
 }
예제 #4
0
 /// <summary>
 /// Raises TextureChanged event notifying Noesis that it should reload the specified texture.
 /// </summary>
 public void RaiseTextureChanged(Uri uri)
 {
     TextureChanged?.Invoke(uri);
     Noesis_RaiseTextureChanged(swigCPtr, uri.OriginalString);
 }
예제 #5
0
 /// <summary>
 /// Raises TextureChanged event notifying Noesis that it should reload the specified texture
 /// </summary>
 public void RaiseTextureChanged(string uri)
 {
     TextureChanged?.Invoke(uri);
     Noesis_RaiseTextureChanged(swigCPtr, uri);
 }