/// <summary> /// 实体管理器轮询。 /// </summary> /// <param name="elapseSeconds">逻辑流逝时间,以秒为单位。</param> /// <param name="realElapseSeconds">真实流逝时间,以秒为单位。</param> internal override void Update(float elapseSeconds, float realElapseSeconds) { while (m_RecycleQueue.Count > 0) { RecycleNode recycleNode = m_RecycleQueue.First.Value; recycleNode.TickCount++; if (recycleNode.TickCount <= 1) { break; } m_RecycleQueue.RemoveFirst(); EntityInfo entityInfo = recycleNode.EntityInfo; IEntity entity = entityInfo.Entity; EntityGroup entityGroup = (EntityGroup)entity.EntityGroup; if (entityGroup == null) { throw new GameFrameworkException("Entity group is invalid."); } entityInfo.Status = EntityStatus.WillRecycle; entity.OnRecycle(); entityInfo.Status = EntityStatus.Recycled; entityGroup.UnspawnEntity(entity); } foreach (KeyValuePair <string, EntityGroup> entityGroup in (Dictionary <string, EntityGroup>)m_EntityGroups) { entityGroup.Value.Update(elapseSeconds, realElapseSeconds); } }
/// <summary> /// 界面管理器轮询。 /// </summary> /// <param name="elapseSeconds">逻辑流逝时间,以秒为单位。</param> /// <param name="realElapseSeconds">真实流逝时间,以秒为单位。</param> internal override void Update(float elapseSeconds, float realElapseSeconds) { while (m_RecycleQueue.Count > 0) { RecycleNode recycleNode = m_RecycleQueue.First.Value; recycleNode.TickCount++; if (recycleNode.TickCount <= 1) { break; } m_RecycleQueue.RemoveFirst(); IUIForm uiForm = recycleNode.UIForm; uiForm.OnRecycle(); m_InstancePool.Unspawn(uiForm.Handle); } foreach (UIGroup uiGroup in m_UIGroups.Values) { uiGroup.Update(elapseSeconds, realElapseSeconds); } }