/// <summary> /// 添加实体头顶标识 /// </summary> /// <param name="entity"></param> private UIRoleStateBar AddRoleBar(IEntity entity) { if (null == entity || m_dicActiveRoleStateBar.ContainsKey(entity.GetUID())) { return(null); } UIRoleStateBar rolebar = GetEmptyRoleStateBar(); if (null != rolebar) { if (Application.isEditor) { if (entity.GetEntityType() == EntityType.EntityType_Player) { rolebar.Tran.name = entity.GetName() + entity.GetID().ToString(); } else { rolebar.Tran.name = entity.GetName() + "_" + entity.GetID().ToString(); } } rolebar.SetVisible(true); rolebar.SetData(entity.GetUID()); m_dicActiveRoleStateBar.Add(entity.GetUID(), rolebar); //LateUpdate刷新位置 LateUpdateChangePos(entity.GetUID()); } return(rolebar); }
/// <summary> /// 释放状态栏 /// </summary> /// <param name="uid"></param> private void Release(long uid) { UIRoleStateBar roleStateBar = null; if (m_dicActiveRoleStateBar.ContainsKey(uid)) { roleStateBar = m_dicActiveRoleStateBar[uid]; m_dicActiveRoleStateBar.Remove(uid); } if (null != roleStateBar && !m_lstCacheStateBar.Contains(roleStateBar)) { roleStateBar.SetVisible(false); roleStateBar.Tran.name = "cache"; m_lstCacheStateBar.Add(roleStateBar); } }