Example #1
0
        private static void FillWindow(Rect windowRect)
        {
            PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.InspectRoomStats, KnowledgeAmount.FrameDisplayed);
            Text.Font = GameFont.Small;
            float num  = 18f;
            bool  flag = ShouldShowBeauty();

            if (flag)
            {
                float beauty = BeautyUtility.AverageBeautyPerceptible(UI.MouseCell(), Find.CurrentMap);
                Rect  rect   = new Rect(18f, num, windowRect.width - 36f, 100f);
                GUI.color = BeautyDrawer.BeautyColor(beauty, 40f);
                Widgets.Label(rect, "BeautyHere".Translate() + ": " + beauty.ToString("F1"));
                num += 25f;
            }
            if (ShouldShowRoomStats())
            {
                if (flag)
                {
                    num      += 5f;
                    GUI.color = new Color(1f, 1f, 1f, 0.4f);
                    Widgets.DrawLineHorizontal(18f, num, windowRect.width - 36f);
                    GUI.color = Color.white;
                    num      += 8f;
                }
                Room room  = UI.MouseCell().GetRoom(Find.CurrentMap, RegionType.Set_All);
                Rect rect2 = new Rect(18f, num, windowRect.width - 36f, 100f);
                GUI.color = Color.white;
                Widgets.Label(rect2, GetRoomRoleLabel(room));
                num          += 25f;
                Text.WordWrap = false;
                for (int i = 0; i < DefDatabase <RoomStatDef> .AllDefsListForReading.Count; i++)
                {
                    RoomStatDef roomStatDef = DefDatabase <RoomStatDef> .AllDefsListForReading[i];
                    if (!roomStatDef.isHidden || DebugViewSettings.showAllRoomStats)
                    {
                        float stat = room.GetStat(roomStatDef);
                        RoomStatScoreStage scoreStage = roomStatDef.GetScoreStage(stat);
                        if (room.Role.IsStatRelated(roomStatDef))
                        {
                            GUI.color = RelatedStatColor;
                        }
                        else
                        {
                            GUI.color = Color.gray;
                        }
                        Rect rect3 = new Rect(rect2.x, num, 100f, 23f);
                        Widgets.Label(rect3, roomStatDef.LabelCap);
                        Rect   rect4 = new Rect(rect3.xMax + 35f, num, 50f, 23f);
                        string label = roomStatDef.ScoreToString(stat);
                        Widgets.Label(rect4, label);
                        Rect rect5 = new Rect(rect4.xMax + 35f, num, 160f, 23f);
                        Widgets.Label(rect5, (scoreStage != null) ? scoreStage.label : string.Empty);
                        num += 25f;
                    }
                }
                Text.WordWrap = true;
            }
            GUI.color = Color.white;
        }
        private static void FillWindow(Rect windowRect)
        {
            PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.InspectRoomStats, KnowledgeAmount.FrameDisplayed);
            Text.Font = GameFont.Small;
            float curY = 12f;
            int   dividingLinesSeen = 0;

            if (ShouldShowBeauty())
            {
                DrawDividingLineIfNecessary();
                float beauty = BeautyUtility.AverageBeautyPerceptible(UI.MouseCell(), Find.CurrentMap);
                Rect  rect   = new Rect(22f, curY, windowRect.width - 24f - 10f, 100f);
                GUI.color = BeautyDrawer.BeautyColor(beauty, 40f);
                Widgets.Label(rect, "BeautyHere".Translate() + ": " + beauty.ToString("F1"));
                curY += 25f;
            }
            if (ShouldShowRoomStats())
            {
                DrawDividingLineIfNecessary();
                DoRoomInfo(UI.MouseCell().GetRoom(Find.CurrentMap, RegionType.Set_All), ref curY, windowRect);
            }
            GUI.color = Color.white;
            void DrawDividingLineIfNecessary()
            {
                dividingLinesSeen++;
                if (dividingLinesSeen > 1)
                {
                    curY     += 5f;
                    GUI.color = new Color(1f, 1f, 1f, 0.4f);
                    Widgets.DrawLineHorizontal(12f, curY, windowRect.width - 24f);
                    GUI.color = Color.white;
                    curY     += 8f;
                }
            }
        }
Example #3
0
 public static void DrawBeautyAroundMouse()
 {
     BeautyUtility.FillBeautyRelevantCells(UI.MouseCell(), Find.VisibleMap);
     for (int i = 0; i < BeautyUtility.beautyRelevantCells.Count; i++)
     {
         IntVec3 intVec = BeautyUtility.beautyRelevantCells[i];
         float   num    = BeautyUtility.CellBeauty(intVec, Find.VisibleMap, BeautyDrawer.beautyCountedThings);
         if (num != 0f)
         {
             Vector3 v = GenMapUI.LabelDrawPosFor(intVec);
             GenMapUI.DrawThingLabel(v, Mathf.RoundToInt(num).ToStringCached(), BeautyDrawer.BeautyColor(num, 8f));
         }
     }
     BeautyDrawer.beautyCountedThings.Clear();
 }
        private static void DrawInfoWindow()
        {
            Room room      = UI.MouseCell().GetRoom(Find.VisibleMap, RegionType.Set_All);
            bool roomValid = room != null && room.Role != RoomRoleDefOf.None;

            Text.Font = GameFont.Small;
            Vector2 mousePosition  = Event.current.mousePosition;
            float   x              = mousePosition.x;
            Vector2 mousePosition2 = Event.current.mousePosition;
            Rect    windowRect     = new Rect(x, mousePosition2.y, 416f, 36f);

            windowRect.height += 25f;
            if (roomValid)
            {
                windowRect.height += 13f;
                windowRect.height += 23f;
                windowRect.height += (float)((float)EnvironmentInspectDrawer.DisplayedRoomStatsCount * 25.0);
            }
            windowRect.x += 26f;
            windowRect.y += 26f;
            if (windowRect.xMax > (float)UI.screenWidth)
            {
                windowRect.x -= (float)(windowRect.width + 52.0);
            }
            if (windowRect.yMax > (float)UI.screenHeight)
            {
                windowRect.y -= (float)(windowRect.height + 52.0);
            }
            Find.WindowStack.ImmediateWindow(74975, windowRect, WindowLayer.Super, delegate
            {
                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.InspectRoomStats, KnowledgeAmount.FrameDisplayed);
                Text.Font    = GameFont.Small;
                float num    = 18f;
                float beauty = BeautyUtility.AverageBeautyPerceptible(UI.MouseCell(), Find.VisibleMap);
                Rect rect    = new Rect(18f, num, (float)(windowRect.width - 36.0), 100f);
                GUI.color    = BeautyDrawer.BeautyColor(beauty, 40f);
                Widgets.Label(rect, "BeautyHere".Translate() + ": " + beauty.ToString("F1"));
                num = (float)(num + 25.0);
                if (roomValid)
                {
                    num       = (float)(num + 5.0);
                    GUI.color = new Color(1f, 1f, 1f, 0.4f);
                    Widgets.DrawLineHorizontal(18f, num, (float)(windowRect.width - 36.0));
                    GUI.color  = Color.white;
                    num        = (float)(num + 8.0);
                    Rect rect2 = new Rect(18f, num, (float)(windowRect.width - 36.0), 100f);
                    GUI.color  = Color.white;
                    Widgets.Label(rect2, EnvironmentInspectDrawer.GetRoomRoleLabel(room));
                    num           = (float)(num + 25.0);
                    Text.WordWrap = false;
                    for (int i = 0; i < DefDatabase <RoomStatDef> .AllDefsListForReading.Count; i++)
                    {
                        RoomStatDef roomStatDef = DefDatabase <RoomStatDef> .AllDefsListForReading[i];
                        if (!roomStatDef.isHidden || DebugViewSettings.showAllRoomStats)
                        {
                            float stat = room.GetStat(roomStatDef);
                            RoomStatScoreStage scoreStage = roomStatDef.GetScoreStage(stat);
                            if (room.Role.IsStatRelated(roomStatDef))
                            {
                                GUI.color = EnvironmentInspectDrawer.RelatedStatColor;
                            }
                            else
                            {
                                GUI.color = Color.gray;
                            }
                            Rect rect3 = new Rect(rect2.x, num, 100f, 23f);
                            Widgets.Label(rect3, roomStatDef.LabelCap);
                            Rect rect4   = new Rect((float)(rect3.xMax + 35.0), num, 50f, 23f);
                            string label = roomStatDef.ScoreToString(stat);
                            Widgets.Label(rect4, label);
                            Rect rect5 = new Rect((float)(rect4.xMax + 35.0), num, 160f, 23f);
                            Widgets.Label(rect5, (scoreStage != null) ? scoreStage.label : string.Empty);
                            num = (float)(num + 25.0);
                        }
                    }
                    Text.WordWrap = true;
                }
                GUI.color = Color.white;
            }, true, false, 1f);
        }