public void queueClip(String eventName, QueuedMessage queuedMessage) { queueClip(eventName, queuedMessage, PearlsOfWisdom.PearlType.NONE, 0); }
public void queueClip(String eventName, QueuedMessage queuedMessage, PearlsOfWisdom.PearlType pearlType, double pearlMessageProbability) { lock (queuedClips) { if (queuedClips.Contains(eventName)) { Console.WriteLine("Clip for event " + eventName + " is already queued, ignoring"); return; } else { Console.WriteLine("Queuing clip for event " + eventName); PearlsOfWisdom.PearlMessagePosition pearlPosition = PearlsOfWisdom.PearlMessagePosition.NONE; if (pearlType != PearlsOfWisdom.PearlType.NONE && checkPearlOfWisdomValid(pearlType)) { pearlPosition = pearlsOfWisdom.getMessagePosition(pearlMessageProbability); } if (pearlPosition == PearlsOfWisdom.PearlMessagePosition.BEFORE) { QueuedMessage pearlQueuedMessage = new QueuedMessage(queuedMessage.abstractEvent); pearlQueuedMessage.dueTime = queuedMessage.dueTime; queuedClips.Add(PearlsOfWisdom.getMessageFolder(pearlType), pearlQueuedMessage); } queuedClips.Add(eventName, queuedMessage); if (pearlPosition == PearlsOfWisdom.PearlMessagePosition.AFTER) { QueuedMessage pearlQueuedMessage = new QueuedMessage(queuedMessage.abstractEvent); pearlQueuedMessage.dueTime = queuedMessage.dueTime; queuedClips.Add(PearlsOfWisdom.getMessageFolder(pearlType), pearlQueuedMessage); } } } }
public void playClipImmediately(String eventName, QueuedMessage queuedMessage) { if (disableImmediateMessages) { return; } lock (immediateClips) { if (immediateClips.Contains(eventName)) { Console.WriteLine("Clip for event " + eventName + " is already queued, ignoring"); return; } else { immediateClips.Add(eventName, queuedMessage); } } }