//隐藏实体完成的回调
 private void OnHideEntityComplete(object sender, GameFramework.Entity.HideEntityCompleteEventArgs e)
 {
     if (m_EnableHideEntityCompleteEvent)
     {
         m_EventComponent.Fire(this, ReferencePool.Acquire <HideEntityCompleteEventArgs>().Fill(e));
     }
 }
Esempio n. 2
0
 private void OnHideEntityComplete(object sender, GameFramework.Entity.HideEntityCompleteEventArgs e)
 {
     if (m_EnableHideEntityCompleteEvent)
     {
         m_EventComponent.Fire(this, new HideEntityCompleteEventArgs(e));
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 初始化隐藏实体完成事件的新实例。
 /// </summary>
 /// <param name="e">内部事件。</param>
 public HideEntityCompleteEventArgs(GameFramework.Entity.HideEntityCompleteEventArgs e)
 {
     EntityId        = e.EntityId;
     EntityAssetName = e.EntityAssetName;
     EntityGroup     = e.EntityGroup;
     UserData        = e.UserData;
 }
Esempio n. 4
0
        /// <summary>
        /// 创建隐藏实体完成事件。
        /// </summary>
        /// <param name="e">内部事件。</param>
        /// <returns>创建的隐藏实体完成事件。</returns>
        public static HideEntityCompleteEventArgs Create(GameFramework.Entity.HideEntityCompleteEventArgs e)
        {
            HideEntityCompleteEventArgs hideEntityCompleteEventArgs = ReferencePool.Acquire <HideEntityCompleteEventArgs>();

            hideEntityCompleteEventArgs.EntityId        = e.EntityId;
            hideEntityCompleteEventArgs.EntityAssetName = e.EntityAssetName;
            hideEntityCompleteEventArgs.EntityGroup     = e.EntityGroup;
            hideEntityCompleteEventArgs.UserData        = e.UserData;
            return(hideEntityCompleteEventArgs);
        }
        /// <summary>
        /// 创建隐藏实体完成事件。
        /// </summary>
        /// <param name="entityId">实体编号。</param>
        /// <param name="entityAssetName">实体资源名称。</param>
        /// <param name="entityGroup">实体所属的实体组。</param>
        /// <param name="userData">用户自定义数据。</param>
        /// <returns>创建的隐藏实体完成事件。</returns>
        public static HideEntityCompleteEventArgs Create(int entityId, string entityAssetName, IEntityGroup entityGroup, object userData)
        {
            HideEntityCompleteEventArgs hideEntityCompleteEventArgs = ReferencePool.Acquire <HideEntityCompleteEventArgs>();

            hideEntityCompleteEventArgs.EntityId        = entityId;
            hideEntityCompleteEventArgs.EntityAssetName = entityAssetName;
            hideEntityCompleteEventArgs.EntityGroup     = entityGroup;
            hideEntityCompleteEventArgs.UserData        = userData;
            return(hideEntityCompleteEventArgs);
        }
Esempio n. 6
0
        private void InternalHideEntity(EntityInfo entityInfo, object userData)
        {
            IEntity entity = entityInfo.Entity;

            IEntity[] childEntities = entityInfo.GetChildEntities();
            foreach (IEntity childEntity in childEntities)
            {
                HideEntity(childEntity.Id, userData);
            }

            if (entityInfo.Status == EntityStatus.Hidden)
            {
                return;
            }

            DetachEntity(entity.Id, userData);
            entityInfo.Status = EntityStatus.WillHide;
            entity.OnHide(m_IsShutdown, userData);
            entityInfo.Status = EntityStatus.Hidden;

            EntityGroup entityGroup = (EntityGroup)entity.EntityGroup;

            if (entityGroup == null)
            {
                throw new GameFrameworkException("Entity group is invalid.");
            }

            entityGroup.RemoveEntity(entity);
            if (!m_EntityInfos.Remove(entity.Id))
            {
                throw new GameFrameworkException("Entity info is unmanaged.");
            }

            if (m_HideEntityCompleteEventHandler != null)
            {
                HideEntityCompleteEventArgs hideEntityCompleteEventArgs = HideEntityCompleteEventArgs.Create(entity.Id, entity.EntityAssetName, entityGroup, userData);
                m_HideEntityCompleteEventHandler(this, hideEntityCompleteEventArgs);
                ReferencePool.Release(hideEntityCompleteEventArgs);
            }

            m_RecycleQueue.Enqueue(entityInfo);
        }
Esempio n. 7
0
 private void OnHideEntityComplete(object sender, GameFramework.Entity.HideEntityCompleteEventArgs e)
 {
     m_EventComponent.Fire(this, HideEntityCompleteEventArgs.Create(e));
 }