예제 #1
0
        public static Gizmo PurposeGizmoFor(Pawn gizmoPawn)
        {
            if (!ShouldDrawGizmoFor(gizmoPawn))
            {
                return(null);
            }

            Command_CenterOnTarget gizmo = new Command_CenterOnTarget(gizmoPawn);

            if (PurposeInfo.Make(gizmoPawn) is PurposeInfo info)
            {
                gizmo.selectedInfo = info;
            }
            if (gizmoPawn.CurJob != null)
            {
                gizmo.defaultLabel = gizmoPawn.jobs.curDriver.GetReport().Split(' ').FirstOrDefault();
                gizmo.defaultLabel.TrimEnd('.');
                PurposeInfo.AddTargetToGizmo(gizmo, gizmoPawn.CurJob.GetTarget(TargetIndex.A), TargetIndex.A);
                PurposeInfo.AddTargetToGizmo(gizmo, gizmoPawn.CurJob.GetTarget(TargetIndex.B), TargetIndex.B);
                PurposeInfo.AddTargetToGizmo(gizmo, gizmoPawn.CurJob.GetTarget(TargetIndex.C), TargetIndex.C);
            }
            else
            {
                gizmo.defaultLabel = "ActivityIconIdle".Translate();
            }

            return(gizmo);
        }
예제 #2
0
        public static Gizmo ReservedGizmoFor(Thing thing)
        {
            Pawn sampleColonist = thing.Map?.mapPawns?.FreeColonists?.FirstOrDefault();

            if (sampleColonist == null)
            {
                return(null);
            }

            Pawn reserver = thing.Map?.reservationManager?.FirstRespectedReserver(thing, sampleColonist);

            if (reserver == null)
            {
                return(null);
            }

            Command_CenterOnTarget gizmo = new Command_CenterOnTarget()
            {
                defaultLabel = "TD.Reserved".Translate()
                               //defaultLabel = reserver.NameStringShort
            };

            if (PurposeInfo.Make(thing) is PurposeInfo info)
            {
                gizmo.selectedInfo = info;
            }
            PurposeInfo.AddTargetToGizmo(gizmo, reserver);

            return(gizmo);              //first is leftmost
        }
예제 #3
0
	public static void AddTargetToGizmo(Command_CenterOnTarget gizmo, LocalTargetInfo targetInfo, TargetIndex ind = TargetIndex.A)
	{
	  PurposeInfo purposeInfo = Make(targetInfo);
	  if (purposeInfo == null) return;
	  if (targetInfo.HasThing && purposeInfo.pos == null)
		purposeInfo.pos = gizmo.selectedInfo.pos;
	  if (purposeInfo.IsUsed())
	  {
		gizmo.SetTarget(ind, purposeInfo);
	  }
	}