Beispiel #1
0
 private void NormalUpdate()
 {
     m_InvalidList.Clear();
     if (null != m_TopNameMap)
     {
         foreach (UTopName var in m_TopNameMap.Values)
         {
             UTopName   utn  = var;
             EntityView view = utn.Entity;
             if (EntityView.isNullOrEmpty(view))
             {
                 m_InvalidList.Enqueue(utn);
                 continue;
             }
             //如果实体未激活则隐藏头顶称号
             if (!view.gameObject.activeSelf || !view.StateMachine.GetVisible())
             {
                 if (utn.GetEnable())
                 {
                     utn.SetEnable(false);
                 }
             }
             else
             {
                 if (!utn.GetEnable())
                 {
                     utn.SetEnable(true);
                 }
                 //需要更新的头顶称号进行正常更新
                 utn.OnUpdate();
             }
         }
     }
     //把无效的头顶称号缓存起来
     while (m_InvalidList.Count > 0)
     {
         UTopName ut = m_InvalidList.Dequeue();
         CacheTopName(ut);
     }
     m_InvalidList.Clear();
 }
Beispiel #2
0
 private void CacheTopName(UTopName ut)
 {
     if (null == ut)
     {
         return;
     }
     if (m_TopNameMap.ContainsKey(ut.ID))
     {
         ut.SetEnable(false);
         ut.Reset();
         ut.ChangeParent(CacheTopNameRoot.transform);
         m_CacheTopName.Enqueue(ut);
         m_TopNameMap.Remove(ut.ID);
     }
 }
Beispiel #3
0
 //预加载
 public void PreWarmTopName()
 {
     if (bPreWarmTopName)
     {
         return;
     }
     bPreWarmTopName = true;
     for (int i = 0; i < TopNameCacheCount; i++)
     {
         TopNameNode canvNode = new TopNameNode();
         if (!AllocTopNamePos(ref canvNode))
         {
             continue;
         }
         UTopName utn = InstanceUTopName(canvNode);
         utn.CreatBillBoard();
         utn.ChangeParent(CacheTopNameRoot.transform);
         utn.Init(null);
         utn.ChangeParent(CacheTopNameRoot.transform);
         utn.SetEnable(false);
         utn.ChangeCanvasNode(canvNode);
         m_CacheTopName.Enqueue(utn);
     }
 }