Пример #1
0
        protected virtual void DrawPawnRow(Rect r, Droid p)
        {
            float num = 175f;

            Text.Font = GameFont.Medium;
            for (int i = 0; i < OTab_Droid_Work.VisibleWorkTypeDefsInPriorityOrder.Count; i++)
            {
                WorkTypeDef workTypeDef = OTab_Droid_Work.VisibleWorkTypeDefsInPriorityOrder[i];
                Vector2     topLeft     = new Vector2(num, r.y + 2.5f);
                if (p.story != null && p.work.Contains(workTypeDef))
                {
                    WidgetsWork.DrawWorkBoxFor(topLeft, p, workTypeDef);
                }
                Rect rect2 = new Rect(topLeft.x, topLeft.y, 25f, 25f);
                TooltipHandler.TipRegion(rect2, WidgetsWork.TipForPawnWorker(p, workTypeDef));
                num += this.workColumnSpacing;
            }
        }
Пример #2
0
        private void DrawPawnOverviewRow(Pawn pawn, Rect rect)
        {
            // column width
            float colWidth = rect.width / 4 - Margin;

            // cell rects
            var nameRect     = new Rect(colWidth * 0, rect.yMin, colWidth, RowHeightPawnOverview);
            var activityRect = new Rect(colWidth * 1, rect.yMin, colWidth * 2.5f, RowHeightPawnOverview);
            var priorityRect = new Rect(colWidth * 3.5f, rect.yMin, colWidth * .5f, RowHeightPawnOverview);

            // name
            Widgets.DrawHighlightIfMouseover(nameRect);

            // on click select and jump to location
            if (Widgets.ButtonInvisible(nameRect))
            {
                Find.MainTabsRoot.EscapeCurrentTab();
                Find.CameraDriver.JumpTo(pawn.PositionHeld);
                Find.Selector.ClearSelection();
                if (pawn.Spawned)
                {
                    Find.Selector.Select(pawn);
                }
            }
            Utilities.Label(nameRect, pawn.NameStringShort, "FM.ClickToJumpTo".Translate(pawn.LabelCap),
                            TextAnchor.MiddleLeft, Margin);

            // current activity (if curDriver != null)
            string activityString = pawn.jobs.curDriver?.GetReport() ?? "FM.NoCurJob".Translate();

            Utilities.Label(activityRect, activityString, pawn.jobs.curDriver?.GetReport(), TextAnchor.MiddleCenter,
                            Margin, font: GameFont.Tiny);

            // priority button
            Rect priorityPosition = new Rect(0f, 0f, 24f, 24f).CenteredOnXIn(priorityRect)
                                    .CenteredOnYIn(priorityRect);

            Text.Font = GameFont.Medium;
            WidgetsWork.DrawWorkBoxFor(priorityPosition.xMin, priorityPosition.yMin, pawn, WorkTypeDef, false);
            Text.Font = GameFont.Small;
        }
 public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
 {
     if (pawn is Droid)
     {
         Droid droid = pawn as Droid;
         if (!pawn.Dead && pawn.workSettings != null && pawn.workSettings.EverWork)
         {
             Text.Font = GameFont.Medium;
             float x         = rect.x + (rect.width - 25f) / 2f;
             float y         = rect.y + 2.5f;
             bool  incapable = false;// IsIncapableOfWholeWorkType(pawn, def.workType);
             if (droid.aiPackages.CapableOfWorkType(def.workType))
             {
                 WidgetsWork.DrawWorkBoxFor(x, y, pawn, def.workType, incapable);
             }
             Rect rect2 = new Rect(x, y, 25f, 25f);
             TooltipHandler.TipRegion(rect2, () => WidgetsWork.TipForPawnWorker(pawn, def.workType, incapable), pawn.thingIDNumber ^ def.workType.GetHashCode());
             Text.Font = GameFont.Small;
         }
     }
 }