Beispiel #1
0
 public static void EnvironmentStatsOnGUI()
 {
     if (Event.current.type == EventType.Repaint && EnvironmentStatsDrawer.ShouldShowWindowNow())
     {
         EnvironmentStatsDrawer.DrawInfoWindow();
     }
 }
Beispiel #2
0
 public static void EnvironmentStatsOnGUI()
 {
     if (Event.current.type != EventType.Repaint || !EnvironmentStatsDrawer.ShouldShowWindowNow())
     {
         return;
     }
     EnvironmentStatsDrawer.DrawInfoWindow();
 }
        public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth)
        {
            Room room = Room;

            if (room == null)
            {
                return(new GizmoResult(GizmoState.Clear));
            }
            Rect rect = new Rect(topLeft.x, topLeft.y, GetWidth(maxWidth), 75f);

            Widgets.DrawWindowBackground(rect);
            Text.WordWrap = false;
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero().ContractedBy(10f);

            Text.Font = GameFont.Small;
            Rect  rect3 = new Rect(rect2.x, rect2.y - 2f, rect2.width, 100f);
            float stat  = room.GetStat(RoomStatDefOf.Impressiveness);
            RoomStatScoreStage scoreStage = RoomStatDefOf.Impressiveness.GetScoreStage(stat);
            TaggedString       str        = room.Role.LabelCap + ", " + scoreStage.label + " (" + RoomStatDefOf.Impressiveness.ScoreToString(stat) + ")";

            Widgets.Label(rect3, str.Truncate(rect3.width));
            float num = rect2.y + Text.LineHeight + Text.SpaceBetweenLines + 7f;

            GUI.color = RoomStatsColor;
            Text.Font = GameFont.Tiny;
            List <RoomStatDef> allDefsListForReading = DefDatabase <RoomStatDef> .AllDefsListForReading;
            int num2 = 0;

            for (int i = 0; i < allDefsListForReading.Count; i++)
            {
                if (!allDefsListForReading[i].isHidden && allDefsListForReading[i] != RoomStatDefOf.Impressiveness)
                {
                    float stat2 = room.GetStat(allDefsListForReading[i]);
                    RoomStatScoreStage scoreStage2 = allDefsListForReading[i].GetScoreStage(stat2);
                    Rect   rect4 = ((num2 % 2 == 0) ? new Rect(rect2.x, num, rect2.width / 2f, 100f) : new Rect(rect2.x + rect2.width / 2f, num, rect2.width / 2f, 100f));
                    string str2  = scoreStage2.label.CapitalizeFirst() + " (" + allDefsListForReading[i].ScoreToString(stat2) + ")";
                    Widgets.Label(rect4, str2.Truncate(rect4.width));
                    if (num2 % 2 == 1)
                    {
                        num += Text.LineHeight + Text.SpaceBetweenLines;
                    }
                    num2++;
                }
            }
            GUI.color = Color.white;
            Text.Font = GameFont.Small;
            GUI.EndGroup();
            Text.WordWrap = true;
            GenUI.AbsorbClicksInRect(rect);
            if (Mouse.IsOver(rect))
            {
                Rect windowRect = EnvironmentStatsDrawer.GetWindowRect(shouldShowBeauty: false, shouldShowRoomStats: true);
                Find.WindowStack.ImmediateWindow(74975, windowRect, WindowLayer.Super, delegate
                {
                    float curY = 12f;
                    EnvironmentStatsDrawer.DoRoomInfo(room, ref curY, windowRect);
                });
                return(new GizmoResult(GizmoState.Mouseover));
            }
            return(new GizmoResult(GizmoState.Clear));
        }
Beispiel #4
0
 private static bool ShouldShowWindowNow()
 {
     return((EnvironmentStatsDrawer.ShouldShowRoomStats() || EnvironmentStatsDrawer.ShouldShowBeauty()) && !Mouse.IsInputBlockedNow);
 }