Esempio n. 1
0
        /// <summary>
        /// 销毁垃圾桶里的子对象
        /// </summary>
        /// <param name="child_"></param>
        /// <returns></returns>
        public bool Delete(GameObject child_)
        {
            if (!Contains(child_))
            {
                return(false);
            }

            m_objArr.Remove(child_);
            GameObjUtil.Delete(child_);
            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// 替换子对象
        /// </summary>
        /// <param name="name_"></param>
        /// <param name="replace_"></param>
        public void ReplaceChildByName(string name_, GameObject replace_)
        {
            GameObject child = GetChildByName(name_, true);

            if (child == null)
            {
                return;
            }

            GameObject parent = GameObjUtil.GetParent(child);

            GameObjUtil.RecordLocalMatrix(child.transform);
            GameObjUtil.ApplyLocalMatrix(replace_.transform);

            GameObjUtil.Delete(child);  //删除原来的子对象
            GameObjUtil.ChangeParent(replace_, parent);
        }
Esempio n. 3
0
        /// <summary>
        /// 清空所有子对象
        /// 仅清除对象列表
        /// </summary>
        public void Clear()
        {
            if (m_objArr.Count == 0)
            {
                return;
            }

            GameObject go;
            var        enumerator = m_objArr.GetEnumerator();

            while (enumerator.MoveNext())
            {
                go = enumerator.Current;
                GameObjUtil.Delete(go); //直接销毁,会不会导致其他引用者产生空对象?
            }
            enumerator.Dispose();

            m_objArr.Clear();
        }
Esempio n. 4
0
        protected override void __Dispose(bool disposing_)
        {
            Clear();

            if (disposing_)
            {
                if (m_gameObject != null)
                {
                    GameObjUtil.Delete(m_gameObject);
                    m_gameObject = null;
                }
            }
            else
            {
                if (m_gameObject != null)
                {
                    Log.Fatal("gameObject销毁失败", this.GetType());
                }
            }
        }
Esempio n. 5
0
        protected void ClearGameObject()
        {
            if (m_gameObject == null)
            {
                return;
            }

            __ClearGameObject();

            if (m_goIsExternal)
            {
                //如果是外部go, 只是移除引用
                m_gameObject = null;
            }
            else
            {
                //是自己托管的go, 则删除对象
                GameObjUtil.Delete(m_gameObject);
                //GameObjUtil.DestroyNow(m_gameObject);
                m_gameObject = null;
            }
        }
Esempio n. 6
0
        static void __Clear()
        {
            m_keyboard.Clear();

            m_subject.DetachAll();

            m_autoRelease.Excute();

            m_resMgr.Clear();
            m_soundMgr.Clear();

            //对象池清除
            m_classPools.Clear();
            m_classPools = null;

            //单例清除
            TimerMgr.inst.Clear();
            ActionMgr.inst.Clear();

            UserPrefs.Clear();
            Refer.ClearNotify();


            GameObject.Destroy(m_appBhv);
            m_appBhv = null;

            m_gRoot = null;

            m_onLateUpdate = null;
            m_onUpdate     = null;
            m_onGui        = null;

            if (m_trash)
            {
                m_trash = GameObjUtil.Delete(m_trash);
            }
        }