Ejemplo n.º 1
0
        /// <summary>
        /// Called by framework. Do not call directly.
        /// </summary>
        protected override void OnDestroy()
        {
            SceneManager.UnregisterCanvas(this);
            Mouse.OnLeftButtonDown -= OnLeftMouseDown;
            Mouse.OnLeftButtonUp   -= OnLeftMouseUp;
            Mouse.OnWindowLeave    -= OnWindowLeave;
            Mouse.OnMove           -= OnMouseMove;
            Input.OnKey            -= OnKey;

            if (_targetMaterial != null)
            {
                if (TargetEntity != null && TargetEntity.Exists && _originalMaterial != null)
                {
                    TargetEntity.Material = _originalMaterial;
                }

                _targetMaterial.Release();
                _targetMaterial.Dispose();
            }

            if (TargetTexture != null)
            {
                TargetTexture.Destroy();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Set this Canvas up to draw the UI onto another Entity.
        /// </summary>
        /// <returns><c>true</c>, if target entity was setup correctly, <c>false</c> otherwise.</returns>
        /// <param name="target">Target.</param>
        /// <param name="targetTexture">Target texture.</param>
        internal bool SetupTargetEntity(Entity target, Graphic targetTexture)
        {
            if (target == null || targetTexture == null)
            {
                return(false);
            }

            if (TargetTexture != null)
            {
                TargetTexture.Destroy();
            }

            TargetTexture = targetTexture;

            return(SetupRenderMaterial(target));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Called by framework. Do not call directly.
        /// </summary>
        public override void OnDestroy()
        {
            Mouse.OnLeftButtonDown -= OnLeftMouseDown;
            Mouse.OnLeftButtonUp   -= OnLeftMouseUp;
            Mouse.OnWindowLeave    -= OnWindowLeave;
            Mouse.OnMove           -= OnMouseMove;
            Input.OnKey            -= OnKey;

            if (_targetMaterial != null)
            {
                if (TargetEntity != null && TargetEntity.Exists && _originalMaterial != null)
                {
                    TargetEntity.Material = _originalMaterial;
                }

                _targetMaterial.Release();
                _targetMaterial.Dispose();
            }

            if (TargetTexture != null)
            {
                TargetTexture.Destroy();
            }
        }