예제 #1
0
 public override IEnumerable <FloatMenuOption> GetShuttleFloatMenuOptions(IEnumerable <IThingHolder> pods, Action <int, TransportPodsArrivalAction> launchAction)
 {
     foreach (FloatMenuOption shuttleFloatMenuOption in base.GetShuttleFloatMenuOptions(pods, launchAction))
     {
         yield return(shuttleFloatMenuOption);
     }
     if ((bool)TransportPodsArrivalAction_GiveGift.CanGiveGiftTo(pods, this))
     {
         yield return(new FloatMenuOption("GiveGiftViaTransportPods".Translate(base.Faction.Name, FactionGiftUtility.GetGoodwillChange(pods, this).ToStringWithSign()), delegate
         {
             TradeRequestComp tradeReqComp = GetComponent <TradeRequestComp>();
             if (tradeReqComp.ActiveRequest && pods.Any((IThingHolder p) => p.GetDirectlyHeldThings().Contains(tradeReqComp.requestThingDef)))
             {
                 Find.WindowStack.Add(new Dialog_MessageBox("GiveGiftViaTransportPodsTradeRequestWarning".Translate(), "Yes".Translate(), delegate
                 {
                     launchAction(base.Tile, new TransportPodsArrivalAction_GiveGift(this));
                 }, "No".Translate()));
             }
             else
             {
                 launchAction(base.Tile, new TransportPodsArrivalAction_GiveGift(this));
             }
         }));
     }
     if (base.HasMap)
     {
         yield break;
     }
     foreach (FloatMenuOption floatMenuOption in TransportPodsArrivalActionUtility.GetFloatMenuOptions(() => TransportPodsArrivalAction_AttackSettlement.CanAttack(pods, this), () => new TransportPodsArrivalAction_Shuttle(this), "AttackShuttle".Translate(Label), launchAction, base.Tile))
     {
         yield return(floatMenuOption);
     }
 }
 public static IEnumerable <FloatMenuOption> GetFloatMenuOptions(CompLaunchable representative, IEnumerable <IThingHolder> pods, Settlement settlement)
 {
     if (settlement.Faction == Faction.OfPlayer)
     {
         return(Enumerable.Empty <FloatMenuOption>());
     }
     return(TransportPodsArrivalActionUtility.GetFloatMenuOptions(() => CanGiveGiftTo(pods, settlement), () => new TransportPodsArrivalAction_GiveGift(settlement), "GiveGiftViaTransportPods".Translate(settlement.Faction.Name, FactionGiftUtility.GetGoodwillChange(pods, settlement).ToStringWithSign()), representative, settlement.Tile, delegate(Action action)
     {
         TradeRequestComp tradeReqComp = settlement.GetComponent <TradeRequestComp>();
         if (tradeReqComp.ActiveRequest && pods.Any((IThingHolder p) => p.GetDirectlyHeldThings().Contains(tradeReqComp.requestThingDef)))
         {
             Find.WindowStack.Add(new Dialog_MessageBox("GiveGiftViaTransportPodsTradeRequestWarning".Translate(), "Yes".Translate(), delegate
             {
                 action();
             }, "No".Translate()));
         }
         else
         {
             action();
         }
     }));
 }