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;
        }
示例#2
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;
        }
        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;
        }
示例#4
0
文件: Room.cs 项目: potsh/RimWorld
 public float GetStat(RoomStatDef roomStat)
 {
     if (statsAndRoleDirty)
     {
         UpdateRoomStatsAndRole();
     }
     if (stats == null)
     {
         return(roomStat.roomlessScore);
     }
     return(stats[roomStat]);
 }
示例#5
0
 public float GetStat(RoomStatDef roomStat)
 {
     if (this.statsAndRoleDirty)
     {
         this.UpdateRoomStatsAndRole();
     }
     if (this.stats == null)
     {
         return(roomStat.defaultScore);
     }
     return(this.stats[roomStat]);
 }
示例#6
0
 public bool IsStatRelated(RoomStatDef def)
 {
     if (this.relatedStats == null)
     {
         return(false);
     }
     for (int i = 0; i < this.relatedStats.Count; i++)
     {
         if (this.relatedStats[i] == def)
         {
             return(true);
         }
     }
     return(false);
 }
示例#7
0
        public float GetStat(RoomStatDef roomStat)
        {
            if (this.statsAndRoleDirty)
            {
                this.UpdateRoomStatsAndRole();
            }
            float result;

            if (this.stats == null)
            {
                result = roomStat.roomlessScore;
            }
            else
            {
                result = this.stats[roomStat];
            }
            return(result);
        }
        public bool IsStatRelated(RoomStatDef def)
        {
            bool result;

            if (this.relatedStats == null)
            {
                result = false;
            }
            else
            {
                for (int i = 0; i < this.relatedStats.Count; i++)
                {
                    if (this.relatedStats[i] == def)
                    {
                        return(true);
                    }
                }
                result = false;
            }
            return(result);
        }
示例#9
0
文件: Room.cs 项目: potsh/RimWorld
 public RoomStatScoreStage GetStatScoreStage(RoomStatDef stat)
 {
     return(stat.GetScoreStage(GetStat(stat)));
 }
        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);
        }
示例#11
0
 private static float <UpdateRoomStatsAndRole> m__0(RoomStatDef x)
 {
     return(x.updatePriority);
 }