Exemplo n.º 1
0
        public void AlertsReadoutOnGUI()
        {
            if (Event.current.type == EventType.Layout)
            {
                return;
            }
            if (this.activeAlerts.Count == 0)
            {
                return;
            }
            Alert         alert         = null;
            AlertPriority alertPriority = AlertPriority.Critical;
            bool          flag          = false;
            float         num           = Find.LetterStack.LastTopY - (float)this.activeAlerts.Count * 28f;
            Rect          rect          = new Rect((float)UI.screenWidth - 154f, num, 154f, this.lastFinalY - num);
            float         num2          = GenUI.BackgroundDarkAlphaForText();

            if (num2 > 0.001f)
            {
                GUI.color = new Color(1f, 1f, 1f, num2);
                Widgets.DrawShadowAround(rect);
                GUI.color = Color.white;
            }
            float num3 = num;

            if (num3 < 0f)
            {
                num3 = 0f;
            }
            for (int i = 0; i < this.PriosInDrawOrder.Count; i++)
            {
                AlertPriority alertPriority2 = this.PriosInDrawOrder[i];
                for (int j = 0; j < this.activeAlerts.Count; j++)
                {
                    Alert alert2 = this.activeAlerts[j];
                    if (alert2.Priority == alertPriority2)
                    {
                        if (!flag)
                        {
                            alertPriority = alertPriority2;
                            flag          = true;
                        }
                        Rect rect2 = alert2.DrawAt(num3, alertPriority2 != alertPriority);
                        if (Mouse.IsOver(rect2))
                        {
                            alert = alert2;
                            this.mouseoverAlertIndex = j;
                        }
                        num3 += rect2.height;
                    }
                }
            }
            this.lastFinalY = num3;
            UIHighlighter.HighlightOpportunity(rect, "Alerts");
            if (alert != null)
            {
                alert.DrawInfoPane();
                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Alerts, KnowledgeAmount.FrameDisplayed);
            }
        }
Exemplo n.º 2
0
        public static bool AlertsReadoutOnGUI(AlertsReadout __instance)
        {
            if (Analyzer.Settings.DisableAlerts)
            {
                return(false);
            }

            if (!Analyzer.Settings.OverrideAlerts && (!AnalyzerState.CurrentlyRunning || !Active))
            {
                return(true);
            }

            if (!Active)
            {
                return(true);
            }

            if (Event.current.type == EventType.Layout || Event.current.type == EventType.MouseDrag)
            {
                return(false);
            }

            if (__instance.activeAlerts.Count == 0)
            {
                return(false);
            }

            Alert alert         = null;
            var   alertPriority = AlertPriority.Critical;
            var   flag          = false;
            var   num           = Find.LetterStack.LastTopY - __instance.activeAlerts.Count * 28f;
            var   rect          = new Rect(UI.screenWidth - 154f, num, 154f, __instance.lastFinalY - num);
            var   num2          = GenUI.BackgroundDarkAlphaForText();

            if (num2 > 0.001f)
            {
                GUI.color = new Color(1f, 1f, 1f, num2);
                Widgets.DrawShadowAround(rect);
                GUI.color = Color.white;
            }

            var num3 = num;

            if (num3 < 0f)
            {
                num3 = 0f;
            }

            for (var i = 0; i < __instance.PriosInDrawOrder.Count; i++)
            {
                var alertPriority2 = __instance.PriosInDrawOrder[i];
                for (var j = 0; j < __instance.activeAlerts.Count; j++)
                {
                    var alert2 = __instance.activeAlerts[j];
                    if (alert2.Priority == alertPriority2)
                    {
                        if (!flag)
                        {
                            alertPriority = alertPriority2;
                            flag          = true;
                        }

                        var key   = alert2.GetType();
                        var prof  = Analyzer.Start(key.Name, () => key.FullName, key);
                        var rect2 = alert2.DrawAt(num3, alertPriority2 != alertPriority);
                        prof.Stop();

                        if (Mouse.IsOver(rect2))
                        {
                            alert = alert2;
                            __instance.mouseoverAlertIndex = j;
                        }

                        num3 += rect2.height;
                    }
                }
            }

            __instance.lastFinalY = num3;
            UIHighlighter.HighlightOpportunity(rect, "Alerts");
            if (alert != null)
            {
                alert.DrawInfoPane();
                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Alerts, KnowledgeAmount.FrameDisplayed);
                __instance.CheckAddOrRemoveAlert(alert, false);
            }

            return(false);
        }
Exemplo n.º 3
0
        public void AlertsReadoutOnGUI()
        {
            if (Event.current.type == EventType.Layout || Event.current.type == EventType.MouseDrag || activeAlerts.Count == 0)
            {
                return;
            }
            Alert         alert         = null;
            AlertPriority alertPriority = AlertPriority.Critical;
            bool          flag          = false;
            float         num           = 0f;

            for (int i = 0; i < activeAlerts.Count; i++)
            {
                num += activeAlerts[i].Height;
            }
            float num2 = Find.LetterStack.LastTopY - num;
            Rect  rect = new Rect((float)UI.screenWidth - 154f, num2, 154f, lastFinalY - num2);
            float num3 = GenUI.BackgroundDarkAlphaForText();

            if (num3 > 0.001f)
            {
                GUI.color = new Color(1f, 1f, 1f, num3);
                Widgets.DrawShadowAround(rect);
                GUI.color = Color.white;
            }
            float num4 = num2;

            if (num4 < 0f)
            {
                num4 = 0f;
            }
            for (int j = 0; j < PriosInDrawOrder.Count; j++)
            {
                AlertPriority alertPriority2 = PriosInDrawOrder[j];
                for (int k = 0; k < activeAlerts.Count; k++)
                {
                    Alert alert2 = activeAlerts[k];
                    if (alert2.Priority == alertPriority2)
                    {
                        if (!flag)
                        {
                            alertPriority = alertPriority2;
                            flag          = true;
                        }
                        Rect rect2 = alert2.DrawAt(num4, alertPriority2 != alertPriority);
                        if (Mouse.IsOver(rect2))
                        {
                            alert = alert2;
                            mouseoverAlertIndex = k;
                        }
                        num4 += rect2.height;
                    }
                }
            }
            lastFinalY = num4;
            UIHighlighter.HighlightOpportunity(rect, "Alerts");
            if (alert != null)
            {
                alert.DrawInfoPane();
                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Alerts, KnowledgeAmount.FrameDisplayed);
                CheckAddOrRemoveAlert(alert);
            }
        }