FairyGUI.DisplayObject.Dispose C# (CSharp) Method

Dispose() public method

public Dispose ( ) : void
return void
        public virtual void Dispose()
        {
            if (_disposed)
                return;

            _disposed = true;
            RemoveFromParent();
            RemoveEventListeners();
            if (graphics != null)
                graphics.Dispose();
            if (_filter != null)
                _filter.Dispose();
            if (paintingGraphics != null)
            {
                if (paintingGraphics.texture != null)
                    paintingGraphics.texture.Dispose(true);

                paintingGraphics.Dispose();
                if (paintingGraphics.gameObject != this.gameObject)
                {
                    if (Application.isPlaying)
                        GameObject.Destroy(paintingGraphics.gameObject);
                    else
                        GameObject.DestroyImmediate(paintingGraphics.gameObject);
                }
            }
            DestroyGameObject();
        }

Usage Example

示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="index"></param>
        /// <param name="dispose"></param>
        /// <returns></returns>
        public DisplayObject RemoveChildAt(int index, bool dispose)
        {
            if (index >= 0 && index < _children.Count)
            {
                DisplayObject child = _children[index];

                if (stage != null && !child._disposed)
                {
                    if (child is Container)
                    {
                        child.BroadcastEvent("onRemovedFromStage", null);
                    }
                    else
                    {
                        child.DispatchEvent("onRemovedFromStage", null);
                    }
                }
                _children.Remove(child);
                InvalidateBatchingState(true);
                if (!dispose)
                {
                    child.InternalSetParent(null);
                }
                else
                {
                    child.Dispose();
                }

                return(child);
            }
            else
            {
                throw new Exception("Invalid child index");
            }
        }
All Usage Examples Of FairyGUI.DisplayObject::Dispose