/// <summary> /// 创建一个任务堆 /// </summary> /// <param name=""></param> public static CMissionHeap Create(CMission Mission) { CMissionHeap CMH = new CMissionHeap(); CMH.Missions = new List <CMission>(); CMH.Missions.Add(Mission); return(CMH); }
/// <summary> /// 执行任务 /// </summary> private bool ExecuteNextMission() { //任务队列为空,当前任务为空,则代表无法进行下一步 if (m_MissionQueue.Count == 0 && m_NowExeMission == null) { return(false); } m_NowExeMission = m_MissionQueue.Dequeue(); m_NowExeMission.Start(); return(true); }
/// <summary> /// 添加一个同步任务到队列 /// </summary> /// <param name="Mission"></param> public void Join(CMission Mission) { CMission CM = m_MissionQueue.Last(); if (CM is CMissionHeap) { CM.Join(Mission); } else { CLOG.E("the last mission is not mission heap,so can not join mission to it"); } }
/// <summary> /// 增加一个任务到队列 /// </summary> /// <param name=""></param> public void Append(CMission Mission) { CMissionHeap missionHeap = CMissionHeap.Create(Mission); m_MissionQueue.Enqueue(missionHeap); }
/// <summary> /// 添加一个同步任务到队列 /// </summary> /// <param name="Mission"></param> public override void Join(CMission Mission) { Missions.Add(Mission); }
/// <summary> /// 加入同步任务方法 /// </summary> public virtual void Join(CMission Mission) { }