public static void EnvironmentInspectOnGUI() { if (Event.current.type == EventType.Repaint && EnvironmentInspectDrawer.ShouldShow()) { BeautyDrawer.DrawBeautyAroundMouse(); EnvironmentInspectDrawer.DrawInfoWindow(); } }
public static void DrawRoomOverlays() { if (EnvironmentInspectDrawer.ShouldShow()) { GenUI.RenderMouseoverBracket(); Room room = UI.MouseCell().GetRoom(Find.VisibleMap, RegionType.Set_All); if (room != null && room.Role != RoomRoleDefOf.None) { room.DrawFieldEdges(); } } }
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); }