public Overhead AddOverhead(MessageTypes msgType, string text, int fontID, int hue, bool asUnicode) { Overhead overhead; text = string.Format("<outline style='font-family: {2}{0};'>{1}", fontID, text, asUnicode ? "uni" : "ascii"); for (int i = 0; i < m_Overheads.Count; i++) { overhead = m_Overheads[i]; // is this overhead an already active label? if ((msgType == MessageTypes.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); }
void InternalInsertOverhead(Overhead overhead) { if (m_Overheads.Count == 0 || (m_Overheads[0].MessageType != MessageTypes.Label)) { m_Overheads.Insert(0, overhead); } else { m_Overheads.Insert(1, overhead); } }