public static void DoRoomInfo(Room room, ref float curY, Rect windowRect) { Rect rect = new Rect(18f, curY, windowRect.width - 36f, 100f); GUI.color = Color.white; Widgets.Label(rect, GetRoomRoleLabel(room)); curY += 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 rect2 = new Rect(rect.x, curY, 100f, 23f); Widgets.Label(rect2, roomStatDef.LabelCap); Rect rect3 = new Rect(rect2.xMax + 35f, curY, 50f, 23f); string label = roomStatDef.ScoreToString(stat); Widgets.Label(rect3, label); Widgets.Label(new Rect(rect3.xMax + 35f, curY, 160f, 23f), (scoreStage == null) ? "" : scoreStage.label); curY += 25f; } } Text.WordWrap = true; }
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; }
public static void DoRoomInfo(Room room, ref float curY, Rect windowRect) { Rect rect = new Rect(12f, curY, windowRect.width - 24f, 100f); GUI.color = Color.white; Text.Font = GameFont.Medium; Widgets.Label(new Rect(rect.x + 10f, curY, rect.width - 10f, rect.height), GetRoomRoleLabel(room)); curY += 30f; Text.Font = GameFont.Small; Text.WordWrap = false; int num = 0; bool flag = 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); GUI.color = Color.white; Rect rect2 = new Rect(rect.x, curY, rect.width, 23f); if (num % 2 == 1) { Widgets.DrawLightHighlight(rect2); } Rect rect3 = new Rect(rect.x, curY, 10f, 23f); if (room.Role.IsStatRelated(roomStatDef)) { flag = true; Widgets.Label(rect3, "*"); GUI.color = RelatedStatColor; } else { GUI.color = UnrelatedStatColor; } Rect rect4 = new Rect(rect3.xMax, curY, 100f, 23f); Widgets.Label(rect4, roomStatDef.LabelCap); Rect rect5 = new Rect(rect4.xMax + 35f, curY, 50f, 23f); string label = roomStatDef.ScoreToString(stat); Widgets.Label(rect5, label); Widgets.Label(new Rect(rect5.xMax + 35f, curY, 160f, 23f), (scoreStage == null) ? "" : scoreStage.label.CapitalizeFirst()); curY += 25f; num++; } } if (flag) { GUI.color = Color.grey; Text.Font = GameFont.Tiny; Widgets.Label(new Rect(rect.x, curY, rect.width, 23f), "* " + "StatRelatesToCurrentRoom".Translate()); GUI.color = Color.white; Text.Font = GameFont.Small; } Text.WordWrap = true; }
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)); }
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); }