コード例 #1
0
 public QueuedMessage(String messageName, DelayedMessageEvent delayedMessageEvent, int secondsDelay, AbstractEvent abstractEvent)
 {
     this.messageName            = compoundMessageIdentifier + messageName;
     this.delayedMessageEvent    = delayedMessageEvent;
     this.delayMessageResolution = true;
     this.dueTime = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) + (secondsDelay * 1000) + updateInterval;
     this.delayMessageResolution = true;
     this.abstractEvent          = abstractEvent;
 }
コード例 #2
0
ファイル: QueuedMessage.cs プロジェクト: kcr55/CrewChiefV4
        public QueuedMessage(String messageName, int expiresAfter, List <MessageFragment> messageFragments = null,
                             List <MessageFragment> alternateMessageFragments = null, DelayedMessageEvent delayedMessageEvent = null,
                             int secondsDelay = 0, AbstractEvent abstractEvent                 = null, Dictionary <String, Object> validationData = null,
                             int priority     = SoundMetadata.DEFAULT_PRIORITY, SoundType type = SoundType.AUTO)
        {
            this.messageId              = getMessageId();
            this.validationData         = validationData;
            this.creationTime           = GameStateData.CurrentTime.Ticks / TimeSpan.TicksPerMillisecond;
            this.dueTime                = secondsDelay == 0 ? 0 : this.creationTime + (secondsDelay * 1000) + updateInterval;
            this.expiryTime             = expiresAfter == 0 ? 0 : this.creationTime + (expiresAfter * 1000);
            this.secondsDelay           = secondsDelay;
            this.abstractEvent          = abstractEvent;
            this.metadata               = new SoundMetadata(type, priority);
            this.delayedMessageEvent    = delayedMessageEvent;
            this.delayMessageResolution = delayedMessageEvent != null;

            // for delayed message events, we collect up the message folder when the message when the message is about to be played, not here
            if (delayedMessageEvent != null)
            {
                this.messageName = delayedMessageIdentifier + messageName;
            }
            else if (messageFragments == null)
            {
                this.messageName = messageName;
                List <MessageFragment> singleMessageFragement = new List <MessageFragment>();
                singleMessageFragement.Add(MessageFragment.Text(messageName));
                this.messageFolders = getMessageFolders(singleMessageFragement, false);
            }
            else
            {
                this.messageName = compoundMessageIdentifier + messageName;
                Boolean hasAlternative = alternateMessageFragments != null;
                this.messageFolders = getMessageFolders(messageFragments, hasAlternative);
                if (!canBePlayed && hasAlternative)
                {
                    Console.WriteLine("Using secondary messages for event " + messageName);
                    canBePlayed         = true;
                    this.messageFolders = getMessageFolders(alternateMessageFragments, false);
                    if (!canBePlayed)
                    {
                        Console.WriteLine("Primary and secondary messages for event " +
                                          messageName + " can't be played");
                    }
                }
            }
        }