Beispiel #1
0
 private void CheckAddOrRemoveAlert(Alert alert, bool forceRemove = false)
 {
     try
     {
         alert.Recalculate();
         if (!forceRemove && alert.Active)
         {
             if (!activeAlerts.Contains(alert))
             {
                 activeAlerts.Add(alert);
                 alert.Notify_Started();
             }
         }
         else
         {
             activeAlerts.Remove(alert);
         }
     }
     catch (Exception ex)
     {
         Log.ErrorOnce("Exception processing alert " + alert.ToString() + ": " + ex.ToString(), 743575);
         activeAlerts.Remove(alert);
     }
 }
Beispiel #2
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);
             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);
             this.activeAlerts.RemoveAt(k);
         }
     }
     if (this.mouseoverAlertIndex >= 0 && this.mouseoverAlertIndex < this.activeAlerts.Count)
     {
         GlobalTargetInfo culprit = this.activeAlerts[this.mouseoverAlertIndex].GetReport().culprit;
         if (culprit.IsValid && culprit.IsMapTarget && Find.VisibleMap != null && culprit.Map == Find.VisibleMap)
         {
             GenDraw.DrawArrowPointingAt(((TargetInfo)culprit).CenterVector3, false);
         }
     }
     this.mouseoverAlertIndex = -1;
 }
Beispiel #3
0
 public void AlertsReadoutUpdate()
 {
     if (Mathf.Max(Find.TickManager.TicksGame, Find.TutorialState.endTick) >= 600)
     {
         if (Find.Storyteller.def.disableAlerts)
         {
             activeAlerts.Clear();
         }
         else
         {
             curAlertIndex++;
             if (curAlertIndex >= AlertCycleLength)
             {
                 curAlertIndex = 0;
             }
             for (int i = curAlertIndex; i < AllAlerts.Count; i += AlertCycleLength)
             {
                 Alert alert = AllAlerts[i];
                 try
                 {
                     if (alert.Active)
                     {
                         if (!activeAlerts.Contains(alert))
                         {
                             activeAlerts.Add(alert);
                             alert.Notify_Started();
                         }
                     }
                     else
                     {
                         for (int j = 0; j < activeAlerts.Count; j++)
                         {
                             if (activeAlerts[j] == alert)
                             {
                                 activeAlerts.RemoveAt(j);
                                 break;
                             }
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                     Log.ErrorOnce("Exception processing alert " + alert.ToString() + ": " + ex.ToString(), 743575);
                     if (activeAlerts.Contains(alert))
                     {
                         activeAlerts.Remove(alert);
                     }
                 }
             }
             for (int num = activeAlerts.Count - 1; num >= 0; num--)
             {
                 Alert alert2 = activeAlerts[num];
                 try
                 {
                     activeAlerts[num].AlertActiveUpdate();
                 }
                 catch (Exception ex2)
                 {
                     Log.ErrorOnce("Exception updating alert " + alert2.ToString() + ": " + ex2.ToString(), 743575);
                     activeAlerts.RemoveAt(num);
                 }
             }
             if (mouseoverAlertIndex >= 0 && mouseoverAlertIndex < activeAlerts.Count)
             {
                 AlertReport report = activeAlerts[mouseoverAlertIndex].GetReport();
                 IEnumerable <GlobalTargetInfo> culprits = report.culprits;
                 if (culprits != null)
                 {
                     foreach (GlobalTargetInfo item in culprits)
                     {
                         TargetHighlighter.Highlight(item);
                     }
                 }
             }
             mouseoverAlertIndex = -1;
         }
     }
 }
 public void AlertsReadoutUpdate()
 {
     if (Mathf.Max(Find.TickManager.TicksGame, Find.TutorialState.endTick) >= 600)
     {
         if (Find.Storyteller.def.disableAlerts)
         {
             this.activeAlerts.Clear();
         }
         else
         {
             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 target in culprits)
                     {
                         TargetHighlighter.Highlight(target, true, true, false);
                     }
                 }
             }
             this.mouseoverAlertIndex = -1;
         }
     }
 }