コード例 #1
0
 public void AlertsReadoutUpdate()
 {
     if (Mathf.Max(Find.TickManager.TicksGame, Find.TutorialState.endTick) < 600)
     {
         return;
     }
     if (Find.Storyteller.def.disableAlerts)
     {
         this.activeAlerts.Clear();
         return;
     }
     this.curAlertIndex++;
     if (this.curAlertIndex >= AlertsReadout.AlertCycleLength)
     {
         this.curAlertIndex = 0;
     }
     for (int i = this.curAlertIndex; i < this.AllAlerts.Count; i += AlertsReadout.AlertCycleLength)
     {
         Alert alert = this.AllAlerts[i];
         try
         {
             if (alert.Active)
             {
                 if (!this.activeAlerts.Contains(alert))
                 {
                     this.activeAlerts.Add(alert);
                     alert.Notify_Started();
                 }
             }
             else
             {
                 for (int j = 0; j < this.activeAlerts.Count; j++)
                 {
                     if (this.activeAlerts[j] == alert)
                     {
                         this.activeAlerts.RemoveAt(j);
                         break;
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             Log.ErrorOnce("Exception processing alert " + alert.ToString() + ": " + ex.ToString(), 743575, false);
             if (this.activeAlerts.Contains(alert))
             {
                 this.activeAlerts.Remove(alert);
             }
         }
     }
     for (int k = this.activeAlerts.Count - 1; k >= 0; k--)
     {
         Alert alert2 = this.activeAlerts[k];
         try
         {
             this.activeAlerts[k].AlertActiveUpdate();
         }
         catch (Exception ex2)
         {
             Log.ErrorOnce("Exception updating alert " + alert2.ToString() + ": " + ex2.ToString(), 743575, false);
             this.activeAlerts.RemoveAt(k);
         }
     }
     if (this.mouseoverAlertIndex >= 0 && this.mouseoverAlertIndex < this.activeAlerts.Count)
     {
         IEnumerable <GlobalTargetInfo> culprits = this.activeAlerts[this.mouseoverAlertIndex].GetReport().culprits;
         if (culprits != null)
         {
             foreach (GlobalTargetInfo current in culprits)
             {
                 TargetHighlighter.Highlight(current, true, true, false);
             }
         }
     }
     this.mouseoverAlertIndex = -1;
 }