コード例 #1
0
 //通知一个view消失了
 public static void NotifyOneViewDisappear(int viewId, bool isSendingEvent)
 {
     if (isSendingEvent)
     {
         if (_wairForDestoryList.Count == 0)
         {
             levelPrefix = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
         }
         _wairForDestoryList.Add(viewId);
     }
     FduSyncBaseIDManager.RetrieveId(viewId);
     _FduClusterViews.Remove(viewId);
 }
コード例 #2
0
        //场景切换时 有的已注册view从来没有被激活过 所以不会执行OnDestroy函数 需要在这里手动清除已变为空的view
        public static void ClearUnusedViews()
        {
            List <int> removeList = new List <int>();

            foreach (KeyValuePair <int, FduClusterView> kvp in _FduClusterViews)
            {
                if (kvp.Value == null)
                {
                    removeList.Add(kvp.Key);
                    FduSyncBaseIDManager.RetrieveId(kvp.Key);
                }
            }
            foreach (int id in removeList)
            {
                _FduClusterViews.Remove(id);
            }
        }