FairyGUI.Utils.HtmlPageContext.FreeObject C# (CSharp) Method

FreeObject() public method

public FreeObject ( IHtmlObject obj ) : void
obj IHtmlObject
return void
        public virtual void FreeObject(IHtmlObject obj)
        {
            obj.Release();
            if (!Application.isPlaying)
            {
                obj.Dispose();
                return;
            }

            //可能已经被GameObject tree deleted了,不再回收
            if (obj.displayObject != null && obj.displayObject.isDisposed)
                return;

            if (obj is HtmlImage)
                _imagePool.Push(obj);
            else if (obj is HtmlInput)
                _inputPool.Push(obj);
            else if (obj is HtmlButton)
                _buttonPool.Push(obj);
            else if (obj is HtmlLink)
                _linkPool.Push(obj);

            if (obj.displayObject != null)
            {
                if (_poolManager == null)
                    _poolManager = Stage.inst.CreatePoolManager("HtmlObjectPool");

                ToolSet.SetParent(obj.displayObject.cachedTransform, _poolManager);
            }
        }

Usage Example

示例#1
0
 static public int FreeObject(IntPtr l)
 {
     try {
         FairyGUI.Utils.HtmlPageContext self = (FairyGUI.Utils.HtmlPageContext)checkSelf(l);
         FairyGUI.Utils.IHtmlObject     a1;
         checkType(l, 2, out a1);
         self.FreeObject(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }