コード例 #1
0
        /// <summary>
        /// 销毁实例
        /// </summary>
        /// <param name="instance"></param>
        private void DestroyTopName(UTopName instance)
        {
            if (null == instance)
            {
                return;
            }

            int id = instance.ID;

            if (instance.CanvasNode.isValid)
            {
                m_UnUseCanvasNodeList.Enqueue(instance.CanvasNode);
            }

            var temp = instance.gameObject;

            instance.resNode.DestroyInstanceRes(ref temp);
            instance.Clear(true);

            if (m_TopNameMap.ContainsKey(id))
            {
                m_TopNameMap[id] = null;
                m_TopNameMap.Remove(id);
            }
        }
コード例 #2
0
        /// <summary>
        /// 销毁所有头顶信息实例
        /// </summary>
        public void DestroyALL()
        {
            ClearCache();
            if (null != m_TopNameMap)
            {
                foreach (KeyValuePair <int, UTopName> var in m_TopNameMap)
                {
                    UTopName utn = var.Value;
                    if (utn != null)
                    {
                        var temp = utn.gameObject;
                        utn.resNode.DestroyInstanceRes(ref temp);
                        utn.Clear(true);
                    }
                }
                currentColIndex = 0;
                currentRowIndex = 0;

                m_UnUseCanvasNodeList.Clear();
                m_TopNameMap.Clear();
            }
        }