public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
 {
     if (pawn.training != null)
     {
         bool             visible;
         AcceptanceReport canTrain = pawn.training.CanAssignToTrain(def.trainable, out visible);
         if (visible && canTrain.Accepted)
         {
             int num  = (int)((rect.width - 24f) / 2f);
             int num2 = Mathf.Max(3, 0);
             TrainingCardUtility.DoTrainableCheckbox(new Rect(rect.x + (float)num, rect.y + (float)num2, 24f, 24f), pawn, def.trainable, canTrain, drawLabel: false, doTooltip: true);
         }
     }
 }
示例#2
0
        private static bool TryDrawTrainableRow(Rect rect, Pawn pawn, TrainableDef td)
        {
            bool             flag     = pawn.training.IsCompleted(td);
            bool             flag2    = default(bool);
            AcceptanceReport canTrain = pawn.training.CanAssignToTrain(td, out flag2);

            if (!flag2)
            {
                return(false);
            }
            Widgets.DrawHighlightIfMouseover(rect);
            Rect rect2 = rect;

            rect2.width -= 50f;
            rect2.xMin  += (float)((float)td.indent * 10.0);
            Rect rect3 = rect;

            rect3.xMin = (float)(rect3.xMax - 50.0 + 17.0);
            if (!flag)
            {
                TrainingCardUtility.DoTrainableCheckbox(rect2, pawn, td, canTrain, true, false);
            }
            else
            {
                Text.Anchor = TextAnchor.MiddleLeft;
                Widgets.Label(rect2, td.LabelCap);
                Text.Anchor = TextAnchor.UpperLeft;
            }
            if (flag)
            {
                GUI.color = Color.green;
            }
            Text.Anchor = TextAnchor.MiddleLeft;
            Widgets.Label(rect3, pawn.training.GetSteps(td) + " / " + td.steps);
            Text.Anchor = TextAnchor.UpperLeft;
            if (DebugSettings.godMode && !pawn.training.IsCompleted(td))
            {
                Rect rect4 = rect3;
                rect4.yMin = (float)(rect4.yMax - 10.0);
                rect4.xMin = (float)(rect4.xMax - 10.0);
                if (Widgets.ButtonText(rect4, "+", true, false, true))
                {
                    pawn.training.Train(td, pawn.Map.mapPawns.FreeColonistsSpawned.RandomElement());
                }
            }
            TrainingCardUtility.DoTrainableTooltip(rect, pawn, td, canTrain);
            GUI.color = Color.white;
            return(true);
        }
 public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
 {
     if (pawn.training != null)
     {
         bool             flag     = default(bool);
         AcceptanceReport canTrain = pawn.training.CanAssignToTrain(base.def.trainable, out flag);
         if (flag && canTrain.Accepted)
         {
             int  num   = (int)((rect.width - 24.0) / 2.0);
             int  num2  = Mathf.Max(3, 0);
             Rect rect2 = new Rect(rect.x + (float)num, rect.y + (float)num2, 24f, 24f);
             TrainingCardUtility.DoTrainableCheckbox(rect2, pawn, base.def.trainable, canTrain, false, true);
         }
     }
 }
示例#4
0
        public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
        {
            if (pawn.training == null)
            {
                return;
            }
            bool             flag;
            AcceptanceReport canTrain = pawn.training.CanAssignToTrain(this.def.trainable, out flag);

            if (!flag || !canTrain.Accepted)
            {
                return;
            }
            int  num   = (int)((rect.width - 24f) / 2f);
            int  num2  = Mathf.Max(3, 0);
            Rect rect2 = new Rect(rect.x + (float)num, rect.y + (float)num2, 24f, 24f);

            TrainingCardUtility.DoTrainableCheckbox(rect2, pawn, this.def.trainable, canTrain, false, true);
        }