示例#1
0
            /// <summary>
            /// 从界面组移除界面。
            /// </summary>
            /// <param name="uiForm">要移除的界面。</param>
            public void RemoveUIForm(IUIForm uiForm)
            {
                UIFormInfo uiFormInfo = GetUIFormInfo(uiForm);

                if (uiFormInfo == null)
                {
                    throw new GameFrameworkException(Utility.Text.Format("Can not find UI form info for serial id '{0}', UI form asset name is '{1}'.", uiForm.SerialId.ToString(), uiForm.UIFormAssetName));
                }

                if (!uiFormInfo.Covered)
                {
                    uiFormInfo.Covered = true;
                    uiForm.OnCover();
                }

                if (!uiFormInfo.Paused)
                {
                    uiFormInfo.Paused = true;
                    uiForm.OnPause();
                }

                if (m_CachedNode != null && m_CachedNode.Value.UIForm == uiForm)
                {
                    m_CachedNode = m_CachedNode.Next;
                }

                if (!m_UIFormInfos.Remove(uiFormInfo))
                {
                    throw new GameFrameworkException(Utility.Text.Format("UI group '{0}' not exists specified UI form '[{1}]{2}'.", m_Name, uiForm.SerialId.ToString(), uiForm.UIFormAssetName));
                }

                ReferencePool.Release(uiFormInfo);
            }
示例#2
0
        /// <summary>
        /// 任务管理器轮询。
        /// </summary>
        /// <param name="elapseSeconds">逻辑流逝时间,以秒为单位。</param>
        /// <param name="realElapseSeconds">真实流逝时间,以秒为单位。</param>
        internal override void Update(float elapseSeconds, float realElapseSeconds)
        {
            LinkedListNode <TaskBase> current = m_Tasks.First;

            while (current != null)
            {
                TaskBase task = current.Value;
                if (task.Status == TaskStatus.Free)
                {
                    throw new GameFrameworkException("Task status is invalid.");
                }

                if (task.Status == TaskStatus.Waiting)
                {
                    task.OnStart();
                }

                if (task.Status == TaskStatus.Running)
                {
                    task.OnUpdate(elapseSeconds, realElapseSeconds);
                    current = current.Next;
                }
                else
                {
                    LinkedListNode <TaskBase> next = current.Next;
                    m_Tasks.Remove(current);
                    ReferencePool.Release(task);
                    current = next;
                }
            }
        }
            /// <summary>
            /// 从实体组移除实体。
            /// </summary>
            /// <param name="entity">要移除的实体。</param>
            public void RemoveEntity(IEntity entity)
            {
                if (m_CachedNode != null && m_CachedNode.Value == entity)
                {
                    m_CachedNode = m_CachedNode.Next;
                }

                if (!m_Entities.Remove(entity))
                {
                    throw new GameFrameworkException(Utility.Text.Format("Entity group '{0}' not exists specified entity '[{1}]{2}'.", m_Name, entity.Id, entity.EntityAssetName));
                }
            }
            /// <summary>
            /// 从实体组移除实体。
            /// </summary>
            /// <param name="Item">要移除的实体。</param>
            public void RemoveItem(IItem Item)
            {
                if (m_CachedNode != null && m_CachedNode.Value == Item)
                {
                    m_CachedNode = m_CachedNode.Next;
                }

                if (!m_Items.Remove(Item))
                {
                    throw new GameFrameworkException(Utility.Text.Format("Item group '{0}' not exists specified Item '[{1}]{2}'.", m_Name, Item.Id.ToString(), Item.ItemAssetName));
                }
            }
示例#5
0
            /// <summary>
            /// 从界面组移除界面。
            /// </summary>
            /// <param name="uiForm">要移除的界面。</param>
            public void RemoveUIForm(IUIForm uiForm)
            {
                UIFormInfo uiFormInfo = GetUIFormInfo(uiForm);

                if (uiFormInfo == null)
                {
                    throw new GameFrameworkException(Utility.Text.Format("Can not find UI form info for serial id '{0}', UI form asset name is '{1}'.", uiForm.SerialId.ToString(), uiForm.UIFormAssetName));
                }

                if (!uiFormInfo.Covered)
                {
                    uiFormInfo.Covered = true;
                    uiForm.OnCover();
                }

                if (!uiFormInfo.Paused)
                {
                    uiFormInfo.Paused = true;
                    uiForm.OnPause();
                }

                m_UIFormInfos.Remove(uiFormInfo);
            }
示例#6
0
 /// <summary>
 /// 从实体组移除实体。
 /// </summary>
 /// <param name="entity">要移除的实体。</param>
 public void RemoveEntity(IEntity entity)
 {
     m_Entities.Remove(entity);
 }