public override IEnumerable <Rule> GetRules() { yield return(new Rule_String("BIOME", Find.WorldGrid[tile].biome.label)); if (roomRole != null && roomRole != RoomRoleDefOf.None) { yield return(new Rule_String("ROOM_role", roomRole.label)); yield return(new Rule_String("ROOM_roleDefinite", Find.ActiveLanguageWorker.WithDefiniteArticle(roomRole.label))); yield return(new Rule_String("ROOM_roleIndefinite", Find.ActiveLanguageWorker.WithIndefiniteArticle(roomRole.label))); RoomStatScoreStage impressiveness = RoomStatDefOf.Impressiveness.GetScoreStage(roomImpressiveness); RoomStatScoreStage beauty = RoomStatDefOf.Beauty.GetScoreStage(roomBeauty); RoomStatScoreStage cleanliness = RoomStatDefOf.Cleanliness.GetScoreStage(roomCleanliness); yield return(new Rule_String("ROOM_impressiveness", impressiveness.label)); yield return(new Rule_String("ROOM_impressivenessIndefinite", Find.ActiveLanguageWorker.WithIndefiniteArticle(impressiveness.label))); yield return(new Rule_String("ROOM_beauty", beauty.label)); yield return(new Rule_String("ROOM_beautyIndefinite", Find.ActiveLanguageWorker.WithIndefiniteArticle(beauty.label))); yield return(new Rule_String("ROOM_cleanliness", cleanliness.label)); yield return(new Rule_String("ROOM_cleanlinessIndefinite", Find.ActiveLanguageWorker.WithIndefiniteArticle(cleanliness.label))); } }
internal void Iterate() { ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.InspectRoomStats, KnowledgeAmount.GuiFrame); Text.Font = GameFont.Small; float num = 19f; Rect rect = new Rect(19f, num, this.windowRect.width - 38f, 100f); GUI.color = Color.white; Widgets.Label(rect, RoomStatsDrawer.GetRoomRoleLabel(this.room)); num += 25f; for (int i = 0; i < DefDatabase <RoomStatDef> .AllDefsListForReading.Count; i++) { RoomStatDef roomStatDef = DefDatabase <RoomStatDef> .AllDefsListForReading[i]; if (!roomStatDef.isHidden) { float stat = this.room.GetStat(roomStatDef); RoomStatScoreStage scoreStage = roomStatDef.GetScoreStage(stat); if (this.room.Role.IsStatRelated(roomStatDef)) { GUI.color = RoomStatsDrawer.RelatedStatColor; } else { GUI.color = Color.gray; } Rect rect2 = new Rect(rect.x, num, RoomStatsDrawer.statLabelColumnWidth, 23f); Widgets.Label(rect2, roomStatDef.LabelCap); Rect rect3 = new Rect(rect2.xMax + 35f, num, RoomStatsDrawer.scoreColumnWidth, 23f); string label; if (roomStatDef.displayRounded) { label = Mathf.RoundToInt(stat).ToString(); } else { label = stat.ToString("0.##"); } Widgets.Label(rect3, label); Rect rect4 = new Rect(rect3.xMax + 35f, num, RoomStatsDrawer.scoreStageLabelColumnWidth, 23f); Widgets.Label(rect4, scoreStage.label); num += 25f; } } GUI.color = Color.white; }
private List <RoomStat> GetRoomStats(Room room) { var stats = new List <RoomStat>(); foreach (var statDef in DefDatabase <RoomStatDef> .AllDefsListForReading) { if (!IsStatValidForRoom(statDef, room)) { continue; } var stat = room.GetStat(statDef); RoomStatScoreStage scoreStage = statDef.GetScoreStage(stat); var roomStat = new RoomStat() { StatDef = statDef, CurrentLevel = statDef.GetScoreStageIndex(stat), MaxLevel = statDef.scoreStages.Count, RawCurrentLevel = statDef.ScoreToString(stat), ValueLabel = scoreStage != null ? scoreStage.label : string.Empty }; if (roomStat.MaxLevel > MaxStatSize) { MaxStatSize = roomStat.MaxLevel; } stats.Add(roomStat); } if (stats.Count > MaxStatCount) { MaxStatCount = stats.Count; } return(stats); }
public static void RoomStatsOnGUI() { RoomStatsDrawer.Anonymous temp = new RoomStatsDrawer.Anonymous(); if (!RoomStatsDrawer.ShouldShowRoomStats) { return; } temp.room = Gen.MouseCell().GetRoom(); Text.Font = GameFont.Small; RoomStatsDrawer.CalculateColumnsSizes(temp.room); temp.windowRect = new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 108f + RoomStatsDrawer.statLabelColumnWidth + RoomStatsDrawer.scoreColumnWidth + RoomStatsDrawer.scoreStageLabelColumnWidth, (float)(65 + RoomStatsDrawer.DisplayedRoomStatsCount * 25)); RoomStatsDrawer.Anonymous temp5 = temp; temp5.windowRect.x = temp5.windowRect.x + 5f; RoomStatsDrawer.Anonymous temp2 = temp; temp2.windowRect.y = temp2.windowRect.y + 5f; if (temp.windowRect.xMax > (float)Screen.width) { RoomStatsDrawer.Anonymous temp3 = temp; temp3.windowRect.x = temp3.windowRect.x - (temp.windowRect.width + 10f); } if (temp.windowRect.yMax > (float)Screen.height) { RoomStatsDrawer.Anonymous temp4 = temp; temp4.windowRect.y = temp4.windowRect.y - (temp.windowRect.height + 10f); } Find.WindowStack.ImmediateWindow(74975, temp.windowRect, WindowLayer.Super, delegate { ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.InspectRoomStats, KnowledgeAmount.GuiFrame); Text.Font = GameFont.Small; float num = 19f; Rect rect = new Rect(19f, num, temp.windowRect.width - 38f, 100f); GUI.color = Color.white; Widgets.Label(rect, RoomStatsDrawer.GetRoomRoleLabel(temp.room)); num += 25f; for (int i = 0; i < DefDatabase <RoomStatDef> .AllDefsListForReading.Count; i++) { RoomStatDef roomStatDef = DefDatabase <RoomStatDef> .AllDefsListForReading[i]; if (!roomStatDef.isHidden) { float stat = temp.room.GetStat(roomStatDef); RoomStatScoreStage scoreStage = roomStatDef.GetScoreStage(stat); if (temp.room.Role.IsStatRelated(roomStatDef)) { GUI.color = RoomStatsDrawer.RelatedStatColor; } else { GUI.color = Color.gray; } Rect rect2 = new Rect(rect.x, num, RoomStatsDrawer.statLabelColumnWidth, 23f); Widgets.Label(rect2, roomStatDef.LabelCap); Rect rect3 = new Rect(rect2.xMax + 35f, num, RoomStatsDrawer.scoreColumnWidth, 23f); string label; if (roomStatDef.displayRounded) { label = Mathf.RoundToInt(stat).ToString(); } else { label = stat.ToString("0.##"); } Widgets.Label(rect3, label); Rect rect4 = new Rect(rect3.xMax + 35f, num, RoomStatsDrawer.scoreStageLabelColumnWidth, 23f); Widgets.Label(rect4, scoreStage.label); num += 25f; } } GUI.color = Color.white; }, true, false, 1f); }