public Overhead AddOverhead(MessageType msgType, string text, int fontID, int hue) { Overhead overhead; for (int i = 0; i < m_Overheads.Count; i++) { overhead = m_Overheads[i]; // is this overhead an already active label? if ((msgType == MessageType.Label) && (overhead.Text == text) && (overhead.MessageType == msgType) && !(overhead.IsDisposed)) { // reset the timer for the object so it lasts longer. overhead.ResetTimer(); // update hue? overhead.Hue = hue; // insert it at the bottom of the queue so it displays closest to the player. m_Overheads.RemoveAt(i); InternalInsertOverhead(overhead); return(overhead); } } overhead = new Overhead(this, msgType, text); overhead.Hue = hue; InternalInsertOverhead(overhead); return(overhead); }
private void InternalInsertOverhead(Overhead overhead) { if (m_Overheads.Count == 0 || (m_Overheads[0].MessageType != MessageType.Label)) { m_Overheads.Insert(0, overhead); } else { m_Overheads.Insert(1, overhead); } }