Dispose() public method

public Dispose ( ) : void
return void
示例#1
0
        override public void Dispose()
        {
            int cnt = _transitions.Count;

            for (int i = 0; i < cnt; ++i)
            {
                Transition trans = _transitions[i];
                trans.Dispose();
            }

            cnt = _controllers.Count;
            for (int i = 0; i < cnt; ++i)
            {
                Controller c = _controllers[i];
                c.Dispose();
            }

            if (scrollPane != null)
            {
                scrollPane.Dispose();
            }

            base.Dispose();             //Dispose native tree first, avoid DisplayObject.RemoveFromParent call

            cnt = _children.Count;
            for (int i = cnt - 1; i >= 0; --i)
            {
                GObject obj = _children[i];
                obj.InternalSetParent(null);                 //Avoid GObject.RemoveParent call
                obj.Dispose();
            }
        }
示例#2
0
 override public void Dispose()
 {
     if (_content.texture != null)
     {
         if (_contentItem == null)
         {
             _content.texture.onSizeChanged -= _reloadDelegate;
             try
             {
                 FreeExternal(_content.texture);
             }
             catch (Exception err)
             {
                 Debug.LogWarning(err);
             }
         }
     }
     if (_errorSign != null)
     {
         _errorSign.Dispose();
     }
     if (_content2 != null)
     {
         _content2.Dispose();
     }
     _content.Dispose();
     base.Dispose();
 }
示例#3
0
        virtual public GObject RemoveChildAt(int index, bool dispose)
        {
            if (index >= 0 && index < numChildren)
            {
                GObject child = _children[index];
                child.parent = null;

                if (child.alwaysOnTop != 0)
                {
                    _AOTChildCount--;
                }

                _children.RemoveAt(index);
                if (child.inContainer)
                {
                    container.RemoveChild(child.displayObject);
                }

                if (dispose)
                {
                    child.Dispose();
                }

                SetBoundsChangedFlag();

                return(child);
            }
            else
            {
                throw new Exception("Invalid child index: " + index + ">" + numChildren);
            }
        }
示例#4
0
        override public void Dispose()
        {
            if (_modalWaitPane != null && _modalWaitPane.parent == null)
            {
                _modalWaitPane.Dispose();
            }


            //正在加载资源的异步过程中发生意外关闭 应该取消正在加载的load
            if (_loading)
            {
                for (int i = 0; i < _uiSources.Count; ++i)
                {
                    _uiSources[i].Cancel();
                }
            }


#if FAIRYGUI_PUERTS
            __onInit          = null;
            __onShown         = null;
            __onHide          = null;
            __doShowAnimation = null;
            __doHideAnimation = null;
#endif

            base.Dispose();
        }
示例#5
0
        override public void Dispose()
        {
            if (_modalWaitPane != null && _modalWaitPane.parent == null)
            {
                _modalWaitPane.Dispose();
            }

            base.Dispose();
        }
示例#6
0
        override public void Dispose()
        {
            base.Dispose();             //Dispose native tree first, avoid DisplayObject.RemoveFromParent call

            int numChildren = _children.Count;

            for (int i = numChildren - 1; i >= 0; --i)
            {
                GObject obj = _children[i];
                obj.parent = null;                 //Avoid GObject.RemoveParent call
                obj.Dispose();
            }
        }
示例#7
0
		override public void Dispose()
		{
			if (_content.texture != null)
			{
				if (_contentItem == null)
					FreeExternal(image.texture);
			}
			if (_errorSign != null)
				_errorSign.Dispose();
			if (_content2 != null)
				_content2.Dispose();
			_content.Dispose();
			base.Dispose();
		}
示例#8
0
        void CreateUI_EditMode()
        {
            if (!EMRenderSupport.packageListReady || UIPackage.GetByName(packageName) == null)
            {
                return;
            }

#if (UNITY_5 || UNITY_5_3_OR_NEWER)
            DisplayOptions.SetEditModeHideFlags();
            GObject obj = UIPackage.CreateObject(packageName, componentName);
            if (obj != null && !(obj is GComponent))
            {
                obj.Dispose();
                Debug.LogWarning("Not a GComponnet: " + packageName + "/" + componentName);
                return;
            }
            _ui = (GComponent)obj;

            if (_ui != null)
            {
                _ui.displayObject.gameObject.hideFlags |= HideFlags.HideInHierarchy;
                _ui.gameObjectName = "UI(AutoGenerated)";

                _ui.position = position;
                if (scale.x != 0 && scale.y != 0)
                {
                    _ui.scale = scale;
                }
                _ui.rotationX = rotation.x;
                _ui.rotationY = rotation.y;
                _ui.rotation  = rotation.z;
                this.container.AddChildAt(_ui.displayObject, 0);

                cachedUISize  = _ui.size;
                uiBounds.size = cachedUISize;
                HandleScreenSizeChanged();
            }
#else
            PackageItem pi = UIPackage.GetByName(packageName).GetItemByName(componentName);
            if (pi != null)
            {
                cachedUISize  = new Vector2(pi.width, pi.height);
                uiBounds.size = cachedUISize;
                HandleScreenSizeChanged();
            }
#endif
        }
示例#9
0
        override public void Dispose()
        {
            if (_modalWaitPane != null && _modalWaitPane.parent == null)
            {
                _modalWaitPane.Dispose();
            }

#if FAIRYGUI_PUERTS
            __onInit          = null;
            __onShown         = null;
            __onHide          = null;
            __doShowAnimation = null;
            __doHideAnimation = null;
#endif

            base.Dispose();
        }
示例#10
0
        override public void Dispose()
        {
            int transCnt = _transitions.Count;

            for (int i = 0; i < transCnt; ++i)
            {
                Transition trans = _transitions[i];
                trans.Dispose();
            }

            base.Dispose();             //Dispose native tree first, avoid DisplayObject.RemoveFromParent call

            int numChildren = _children.Count;

            for (int i = numChildren - 1; i >= 0; --i)
            {
                GObject obj = _children[i];
                obj.parent = null;                 //Avoid GObject.RemoveParent call
                obj.Dispose();
            }
        }
示例#11
0
 override public void Dispose()
 {
     if (_content.texture != null)
     {
         if (_contentItem == null)
         {
             image.texture.onSizeChanged -= _reloadDelegate;
             FreeExternal(image.texture);
         }
     }
     if (_errorSign != null)
     {
         _errorSign.Dispose();
     }
     if (_content2 != null)
     {
         _content2.Dispose();
     }
     _content.Dispose();
     base.Dispose();
 }
示例#12
0
        void CreateUI_EditMode()
        {
            if (!EMRenderSupport.packageListReady || UIPackage.GetByName(packageName) == null)
            {
                return;
            }


            DisplayObject.hideFlags = HideFlags.DontSaveInEditor;
            GObject obj = UIPackage.CreateObject(packageName, componentName);

            if (obj != null && !(obj is GComponent))
            {
                obj.Dispose();
                Debug.LogWarning("Not a GComponnet: " + packageName + "/" + componentName);
                return;
            }
            _ui = (GComponent)obj;

            if (_ui != null)
            {
                _ui.displayObject.gameObject.hideFlags |= HideFlags.HideInHierarchy;
                _ui.gameObjectName = "UI(AutoGenerated)";

                _ui.position = position;
                if (scale.x != 0 && scale.y != 0)
                {
                    _ui.scale = scale;
                }
                _ui.rotationX = rotation.x;
                _ui.rotationY = rotation.y;
                _ui.rotation  = rotation.z;
                this.container.AddChildAt(_ui.displayObject, 0);

                cachedUISize  = _ui.size;
                uiBounds.size = cachedUISize;
                HandleScreenSizeChanged();
            }
        }
示例#13
0
        /// <summary>
        /// Removes a child at a certain index. Children above the child will move down.
        /// </summary>
        /// <param name="index">Index</param>
        /// <param name="dispose">If true, the child will be disposed right away.</param>
        /// <returns>GObject</returns>
        virtual public GObject RemoveChildAt(int index, bool dispose)
        {
            if (index >= 0 && index < numChildren)
            {
                GObject child = _children[index];

                child.parent = null;

                if (child.sortingOrder != 0)
                {
                    _sortingChildCount--;
                }

                _children.RemoveAt(index);
                if (child.inContainer)
                {
                    container.RemoveChild(child.displayObject);
                    if (_childrenRenderOrder == ChildrenRenderOrder.Arch)
                    {
                        UpdateContext.OnBegin -= _buildDelegate;
                        UpdateContext.OnBegin += _buildDelegate;
                    }
                }

                if (dispose)
                {
                    child.Dispose();
                }

                SetBoundsChangedFlag();

                return(child);
            }
            else
            {
                throw new Exception("Invalid child index: " + index + ">" + numChildren);
            }
        }
示例#14
0
        /// <summary>
        /// Removes a child at a certain index. Children above the child will move down.
        /// </summary>
        /// <param name="index">Index</param>
        /// <param name="dispose">If true, the child will be disposed right away.</param>
        /// <returns>GObject</returns>
        virtual public GObject RemoveChildAt(int index, bool dispose)
        {
            if (index >= 0 && index < numChildren)
            {
                GObject child = _children[index];

                child.InternalSetParent(null);

                if (child.sortingOrder != 0)
                {
                    _sortingChildCount--;
                }

                _children.RemoveAt(index);
                child.group = null;
                if (child.inContainer)
                {
                    container.RemoveChild(child.displayObject);
                    if (_childrenRenderOrder == ChildrenRenderOrder.Arch)
                    {
                        Stage.beforeVisit -= _buildDelegate;
                        Stage.beforeVisit += _buildDelegate;
                    }
                }

                if (dispose)
                {
                    child.Dispose();
                }

                SetBoundsChangedFlag();
                return(child);
            }
            else
            {
                throw new Exception("Invalid child index: " + index + ">" + numChildren);
            }
        }
示例#15
0
        protected void LoadFromPackage(string itemURL)
        {
            _contentItem = UIPackage.GetItemByURL(itemURL);

            if (_contentItem != null)
            {
                _contentItem = _contentItem.getBranch();
                sourceWidth  = _contentItem.width;
                sourceHeight = _contentItem.height;
                _contentItem = _contentItem.getHighResolution();
                _contentItem.Load();

                if (_contentItem.type == PackageItemType.Image)
                {
                    _content.texture        = _contentItem.texture;
                    _content.textureScale   = new Vector2(_contentItem.width / (float)sourceWidth, _contentItem.height / (float)sourceHeight);
                    _content.scale9Grid     = _contentItem.scale9Grid;
                    _content.scaleByTile    = _contentItem.scaleByTile;
                    _content.tileGridIndice = _contentItem.tileGridIndice;

                    UpdateLayout();
                }
                else if (_contentItem.type == PackageItemType.MovieClip)
                {
                    _content.interval    = _contentItem.interval;
                    _content.swing       = _contentItem.swing;
                    _content.repeatDelay = _contentItem.repeatDelay;
                    _content.frames      = _contentItem.frames;

                    UpdateLayout();
                }
                else if (_contentItem.type == PackageItemType.Component)
                {
                    GObject obj = UIPackage.CreateObjectFromURL(itemURL);
                    if (obj == null)
                    {
                        SetErrorState();
                    }
                    else if (!(obj is GComponent))
                    {
                        obj.Dispose();
                        SetErrorState();
                    }
                    else
                    {
                        _content2 = (GComponent)obj;
                        ((Container)displayObject).AddChild(_content2.displayObject);
                        UpdateLayout();
                    }
                }
                else
                {
                    if (_autoSize)
                    {
                        this.SetSize(_contentItem.width, _contentItem.height);
                    }

                    SetErrorState();

                    Debug.LogWarning("Unsupported type of GLoader: " + _contentItem.type);
                }
            }
            else
            {
                SetErrorState();
            }
        }
示例#16
0
        protected void LoadFromPackage(string itemURL)
        {
            _contentItem = UIPackage.GetItemByURL(itemURL);

            if (_contentItem != null)
            {
                _contentItem.Load();

                if (_contentItem.type == PackageItemType.Image)
                {
                    _content.texture        = _contentItem.texture;
                    _content.scale9Grid     = _contentItem.scale9Grid;
                    _content.scaleByTile    = _contentItem.scaleByTile;
                    _content.tileGridIndice = _contentItem.tileGridIndice;

                    _contentSourceWidth  = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;
                    UpdateLayout();
                }
                else if (_contentItem.type == PackageItemType.MovieClip)
                {
                    _contentSourceWidth  = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;

                    _content.interval    = _contentItem.interval;
                    _content.swing       = _contentItem.swing;
                    _content.repeatDelay = _contentItem.repeatDelay;
                    _content.SetData(_contentItem.texture, _contentItem.frames, new Rect(0, 0, _contentSourceWidth, _contentSourceHeight));

                    UpdateLayout();
                }
                else if (_contentItem.type == PackageItemType.Component)
                {
                    _contentSourceWidth  = _contentItem.width;
                    _contentSourceHeight = _contentItem.height;

                    GObject obj = UIPackage.CreateObjectFromURL(itemURL);
                    if (obj == null)
                    {
                        SetErrorState();
                    }
                    else if (!(obj is GComponent))
                    {
                        obj.Dispose();
                        SetErrorState();
                    }
                    else
                    {
                        _content2 = (GComponent)obj;
                        ((Container)displayObject).AddChild(_content2.displayObject);
                        UpdateLayout();
                    }
                }
                else
                {
                    if (_autoSize)
                    {
                        this.SetSize(_contentItem.width, _contentItem.height);
                    }

                    SetErrorState();
                }
            }
            else
            {
                SetErrorState();
            }
        }