protected override void FillTab()
        {
            ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.PrisonerTab, KnowledgeAmount.GuiFrame);
            Text.Font = GameFont.Small;
            Rect position           = new Rect(0f, 0f, this.size.x, this.size.y).ContractedBy(20f);
            bool isPrisonerOfColony = base.SelPawn.IsPrisonerOfColony;

            try
            {
                GUI.BeginGroup(position);
                float num  = 10f;
                Rect  rect = new Rect(10f, num, position.width - 20f, 32f);
                MedicalCareUtility.MedicalCareSetter(rect, ref base.SelPawn.playerSettings.medCare);
                num += 32f;
                num += 18f;
                Rect rect2    = new Rect(10f, num, position.width - 28f, position.height - num);
                bool getsFood = base.SelPawn.guest.GetsFood;
                num += WidgetDrawer.DrawLabeledCheckbox(rect2, "GetsFood".Translate(), ref getsFood);
                base.SelPawn.guest.GetsFood = getsFood;
                if (isPrisonerOfColony)
                {
                    num += 6f;
                    int   length = Enum.GetValues(typeof(PrisonerInteractionMode)).Length;
                    float height = (float)(length * 28 + 20);
                    Rect  rect3  = new Rect(0f, num, position.width, height);
                    TabDrawer.DrawBox(rect3);
                    Rect rect4 = rect3.ContractedBy(10f);
                    rect4.height = 28f;
                    IEnumerator enumerator = Enum.GetValues(typeof(PrisonerInteractionMode)).GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        PrisonerInteractionMode prisonerInteractionMode = (PrisonerInteractionMode)((byte)enumerator.Current);
                        if (WidgetDrawer.DrawLabeledRadioButton(rect4, prisonerInteractionMode.GetLabel(), base.SelPawn.guest.interactionMode == prisonerInteractionMode, true))
                        {
                            base.SelPawn.guest.interactionMode = prisonerInteractionMode;
                        }
                        rect4.y += 28f;
                    }
                    Rect rect5 = new Rect(rect3.x, rect3.y + rect3.height + 5f, rect3.width - 4f, 28f);
                    Text.Anchor = TextAnchor.UpperRight;
                    Widgets.Label(rect5, "RecruitmentDifficulty".Translate() + ": " + base.SelPawn.guest.RecruitDifficulty.ToString("##0"));
                    Text.Anchor = TextAnchor.UpperLeft;
                }
            }
            finally
            {
                GUI.EndGroup();
                GUI.color   = Color.white;
                Text.Anchor = TextAnchor.UpperLeft;
            }
            if (this.PreferenceTabBrowseButtons != null && this.PreferenceTabBrowseButtons.Value)
            {
                Pawn selPawn = base.SelPawn;
                if (selPawn != null)
                {
                    BrowseButtonDrawer.DrawBrowseButtons(this.size, selPawn);
                }
            }
        }
コード例 #2
0
 public static void DrawTrainingCard(Rect rect, Pawn pawn)
 {
     try
     {
         GUI.BeginGroup(rect);
         Rect    rect2  = new Rect(0f, 0f, rect.width, 25f);
         string  text   = "Master".Translate() + ": ";
         Vector2 vector = Text.CalcSize(text);
         Widgets.Label(rect2, text);
         Rect rect3 = new Rect(rect2.x + vector.x + 6f, rect2.y, 200f, rect2.height);
         if (pawn.training.IsCompleted(TrainableDefOf.Obedience))
         {
             rect3.y -= 1f;
             string label = TrainableUtility.MasterString(pawn);
             if (Widgets.TextButton(rect3, label, true, false))
             {
                 TrainableUtility.OpenMasterSelectMenu(pawn);
             }
         }
         else
         {
             GUI.color = new Color(0.7f, 0.7f, 0.7f);
             Widgets.Label(rect3, "None".Translate());
             GUI.color = Color.white;
         }
         List <TrainableDef> trainableDefsInListOrder = TrainableUtility.TrainableDefsInListOrder;
         int   count  = trainableDefsInListOrder.Count;
         float height = (float)(count * 28 + 20);
         Rect  rect4  = new Rect(0f, rect2.y + 35f, rect.width, height);
         TabDrawer.DrawBox(rect4);
         Rect rect5 = rect4.ContractedBy(10f);
         rect5.height = 28f;
         for (int i = 0; i < trainableDefsInListOrder.Count; i++)
         {
             if (TrainingCardUtility.TryDrawTrainableRow(rect5, pawn, trainableDefsInListOrder[i]))
             {
                 rect5.y += 28f;
             }
         }
         Text.Anchor = TextAnchor.UpperRight;
         string label2 = "TrainableIntelligence".Translate() + ": " + pawn.RaceProps.trainableIntelligence.GetLabel();
         Widgets.Label(new Rect(0f, rect4.y + rect4.height + 5f, rect4.width - 2f, 25f), label2);
         Text.Anchor = TextAnchor.UpperLeft;
     }
     finally
     {
         GUI.EndGroup();
     }
 }