Пример #1
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            if (this.parent is Pawn gizmoPawn)
            {
                GearUpPolicyComp component = Current.Game.GetComponent <GearUpPolicyComp>();
                yield return(new Command_GearUpAndGo()
                {
                    defaultLabel = "TD.GearAndGo".Translate(),
                    defaultDesc = "TD.GearAndGoDesc".Translate(),
                    icon = component.lastPolicy != "" ? TexGearUpAndGo.guagIconActive : TexGearUpAndGo.guagIcon,
                    action = delegate(IntVec3 target, Event ev)
                    {
                        Log.Message($"GearUpAndGo to {target}");

                        if (!ev.alt)
                        {
                            Current.Game.GetComponent <GearUpPolicyComp>().Set();
                        }

                        foreach (Pawn p in Find.Selector.SelectedObjects
                                 .Where(o => o is Pawn p && p.IsColonistPlayerControlled).Cast <Pawn>())
                        {
                            p.jobs.TryTakeOrderedJob(new Job(GearUpAndGoJobDefOf.GearUpAndGo, target), JobTag.DraftedOrder);
                        }
                    },
                    actionEnd = delegate()
                    {
                        Current.Game.GetComponent <GearUpPolicyComp>().Revert();
                    }
                });
        public override AlertReport GetReport()
        {
            GearUpPolicyComp comp = Current.Game.GetComponent <GearUpPolicyComp>();

            if (comp.lastPolicy == "")
            {
                return(false);
            }

            return(true);
        }
 public override IEnumerable <Gizmo> CompGetGizmosExtra()
 {
     if (this.parent is Pawn gizmoPawn)
     {
         GearUpPolicyComp component = Current.Game.GetComponent <GearUpPolicyComp>();
         yield return(new Command_GearUpAndGo()
         {
             icon = component.lastPolicy != "" ? TexGearUpAndGo.guagIconActive : TexGearUpAndGo.guagIcon
         });
     }
 }