Пример #1
0
        public bool DisplayAdminMessagesOnQueue(bool criticalOnly)
        {
            bool result = false;
            List <AdminMessageData> list = new List <AdminMessageData>();
            Lang lang = Service.Get <Lang>();

            while (this.queuedMessages.Count > 0)
            {
                AdminMessageData adminMessageData = this.queuedMessages.Dequeue();
                if (!criticalOnly || (criticalOnly && adminMessageData.IsCritical))
                {
                    result = true;
                    string title = "";
                    string text;
                    lang.GetOptional(adminMessageData.Message, out text);
                    AlertScreen.ShowModalWithBI(adminMessageData.IsCritical, title, text, adminMessageData.IsCritical ? (text + " :" + adminMessageData.Uid) : null);
                }
                else
                {
                    list.Add(adminMessageData);
                }
            }
            for (int i = 0; i < list.Count; i++)
            {
                this.queuedMessages.Enqueue(list[i]);
            }
            return(result);
        }
Пример #2
0
 public EatResponse OnEvent(EventId id, object cookie)
 {
     if (id != EventId.WorldInTransitionComplete)
     {
         if (id == EventId.ServerAdminMessage)
         {
             AdminMessage adminMessage = cookie as AdminMessage;
             for (int i = 0; i < adminMessage.Messages.Count; i++)
             {
                 AdminMessageData adminMessageData = adminMessage.Messages[i];
                 if (!this.seenMessages.Contains(adminMessageData.Uid))
                 {
                     this.seenMessages.Add(adminMessageData.Uid);
                     this.queuedMessages.Enqueue(adminMessageData);
                     if (Service.Get <GameStateMachine>().CurrentState is HomeState || Service.Get <GameStateMachine>().CurrentState is EditBaseState)
                     {
                         this.DisplayAdminMessagesOnQueue(false);
                     }
                 }
             }
         }
     }
     else if (Service.Get <GameStateMachine>().CurrentState is HomeState)
     {
         if (!this.haveShownLoginNotification)
         {
             SetPrefsCommand command = new SetPrefsCommand(false);
             Service.Get <ServerAPI>().Enqueue(command);
         }
         this.DisplayAdminMessagesOnQueue(Service.Get <CurrentPlayer>().CampaignProgress.FueInProgress);
     }
     return(EatResponse.NotEaten);
 }