public static void CheckConfirmSettle(int tile, Action settleAction)
 {
     SettlementProximityGoodwillUtility.tmpGoodwillOffsets.Clear();
     SettlementProximityGoodwillUtility.AppendProximityGoodwillOffsets(tile, SettlementProximityGoodwillUtility.tmpGoodwillOffsets, false, true);
     if (SettlementProximityGoodwillUtility.tmpGoodwillOffsets.Any <Pair <Settlement, int> >())
     {
         SettlementProximityGoodwillUtility.SortProximityGoodwillOffsets(SettlementProximityGoodwillUtility.tmpGoodwillOffsets);
         Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmSettleNearFactionBase".Translate(new object[]
         {
             SettlementProximityGoodwillUtility.MaxDist - 1,
             15
         }) + "\n\n" + SettlementProximityGoodwillUtility.ProximityGoodwillOffsetsToString(SettlementProximityGoodwillUtility.tmpGoodwillOffsets), settleAction, false, null));
     }
     else
     {
         settleAction();
     }
 }
Ejemplo n.º 2
0
        public void Save(string name, FindDescription desc, bool overwrite = false)
        {
            if (!overwrite && Has(name))
            {
                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation(
                                         "TD.OverwriteSavedFilter".Translate(),
                                         () => Save(name, desc, true)));
            }
            else
            {
                desc.name = name;                       //Remember for current copy

                FindDescription newDesc = desc.Clone(null);
                newDesc.name       = name;
                savedFilters[name] = newDesc;
            }
            Write();
        }
Ejemplo n.º 3
0
        public override IEnumerable <Gizmo> GetCaravanGizmos(Caravan caravan)
        {
            if (!ActiveRequest)
            {
                yield break;
            }

            var commandAction = new Command_Action
            {
                defaultLabel = "MFI_CommandHelpOutHarvesting".Translate(),
                defaultDesc  = "MFI_CommandHelpOutHarvesting".Translate(),
                icon         = setPlantToGrowTex,
                action       = () =>
                {
                    {
                        if (!ActiveRequest)
                        {
                            Log.Error("Attempted to fulfill an unavailable request");
                            return;
                        }

                        if (BestCaravanPawnUtility.FindPawnWithBestStat(caravan, StatDefOf.PlantHarvestYield) ==
                            null)
                        {
                            Messages.Message("MFI_MessageBumperCropNoGrower".Translate(), caravan,
                                             MessageTypeDefOf.NegativeEvent);
                            return;
                        }

                        Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation(
                                                 "MFI_CommandFulfillBumperCropHarvestConfirm".Translate(caravan.LabelCap),
                                                 () => NotifyCaravanArrived(caravan)));
                    }
                }
            };


            if (BestCaravanPawnUtility.FindPawnWithBestStat(caravan, StatDefOf.PlantHarvestYield) == null)
            {
                commandAction.Disable("MFI_MessageBumperCropNoGrower".Translate());
            }

            yield return(commandAction);
        }
        public override IEnumerable <Gizmo> GetCaravanGizmos(Pawn pawn, Faction faction)
        {
            if (!FillCaravanAidOption(pawn, faction, out var description, out free, out var disableNotEnoughFavor))
            {
                yield break;
            }
            Command_Action command_Action = new Command_Action
            {
                defaultLabel = def.LabelCap + " (" + pawn.LabelShort + ")",
                defaultDesc  = description,
                icon         = CommandTex,
                action       = delegate
                {
                    Caravan caravan = pawn.GetCaravan();
                    float   num     = caravan.MassUsage;
                    List <ThingDefCountClass> itemsToDrop = def.royalAid.itemsToDrop;
                    for (int i = 0; i < itemsToDrop.Count; i++)
                    {
                        num += itemsToDrop[i].thingDef.BaseMass * (float)itemsToDrop[i].count;
                    }
                    if (num > caravan.MassCapacity)
                    {
                        Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("DropResourcesOverweightConfirm".Translate(), delegate
                        {
                            CallResourcesToCaravan(pawn, faction, free);
                        }, destructive: true));
                    }
                    else
                    {
                        CallResourcesToCaravan(pawn, faction, free);
                    }
                }
            };

            if (faction.HostileTo(Faction.OfPlayer))
            {
                command_Action.Disable("CommandCallRoyalAidFactionHostile".Translate(faction.Named("FACTION")));
            }
            if (disableNotEnoughFavor)
            {
                command_Action.Disable("CommandCallRoyalAidNotEnoughFavor".Translate());
            }
            yield return(command_Action);
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedOrNull(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell));

            Toil prepare = Toils_General.Wait(500, TargetIndex.None);

            prepare.FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell);
            prepare.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            yield return(prepare);

            Toil enter = new Toil();

            enter.initAction = delegate()
            {
                Pawn actor = enter.actor;
                Building_CryptosleepCasket pod = (Building_CryptosleepCasket)actor.CurJob.targetA.Thing;
                Action action = delegate()
                {
                    actor.DeSpawn(DestroyMode.Vanish);
                    pod.TryAcceptThing(actor, true);
                };
                if (!pod.def.building.isPlayerEjectable)
                {
                    int freeColonistsSpawnedOrInPlayerEjectablePodsCount = this.Map.mapPawns.FreeColonistsSpawnedOrInPlayerEjectablePodsCount;
                    if (freeColonistsSpawnedOrInPlayerEjectablePodsCount <= 1)
                    {
                        Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("CasketWarning".Translate().AdjustedFor(actor, "PAWN"), action, false, null));
                    }
                    else
                    {
                        action();
                    }
                }
                else
                {
                    action();
                }
            };
            enter.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(enter);

            yield break;
        }
        /// <summary>Makes the new toils.</summary>
        /// <returns></returns>
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedOrNull(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell));

            Toil prepare = Toils_General.Wait(500);

            prepare.FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell);
            prepare.WithProgressBarToilDelay(TargetIndex.A);
            yield return(prepare);

            Toil enter = new Toil();

            enter.initAction = delegate
            {
                Pawn   actor  = enter.actor;
                var    pod    = (MutaChamber)actor.CurJob.targetA.Thing;
                Action action = delegate
                {
                    actor?.Strip();

                    actor.DeSpawn();
                    pod.TryAcceptThing(actor);
                };
                if (!pod.def.building.isPlayerEjectable)
                {
                    int freeColonistsSpawnedOrInPlayerEjectablePodsCount = Map.mapPawns.FreeColonistsSpawnedOrInPlayerEjectablePodsCount;
                    if (freeColonistsSpawnedOrInPlayerEjectablePodsCount <= 1)
                    {
                        Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("CasketWarning".Translate(actor.Named("PAWN")).AdjustedFor(actor), action));
                    }
                    else
                    {
                        action();
                    }
                }
                else
                {
                    action();
                }
            };
            enter.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(enter);
        }
Ejemplo n.º 7
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            foreach (Gizmo gizmo in base.CompGetGizmosExtra())
            {
                Gizmo g = gizmo;
                yield return(g);

                g = (Gizmo)null;
            }
            if (this.LoadingInProgressOrReadyToLaunch)
            {
                Command_Action launch = new Command_Action();
                launch.defaultLabel = "CommandLaunchGroup".Translate();
                launch.defaultDesc  = "CommandLaunchGroupDesc".Translate();
                launch.icon         = CompLaunchableSRTS.LaunchCommandTex;
                launch.alsoClickIfOtherInGroupClicked = false;
                launch.action = (Action)(() =>
                {
                    if (this.AnyInGroupHasAnythingLeftToLoad)
                    {
                        Find.WindowStack.Add((Window)Dialog_MessageBox.CreateConfirmation("ConfirmSendNotCompletelyLoadedPods".Translate(this.FirstThingLeftToLoadInGroup.LabelCapNoCount), new Action(this.StartChoosingDestination), false, (string)null));
                    }
                    else
                    {
                        this.StartChoosingDestination();
                    }
                });
                if (!this.AllInGroupConnectedToFuelingPort)
                {
                    launch.Disable("CommandLaunchGroupFailNotConnectedToFuelingPort".Translate());
                }
                else if (!this.AllFuelingPortSourcesInGroupHaveAnyFuel)
                {
                    launch.Disable("CommandLaunchGroupFailNoFuel".Translate());
                }
                else if (this.AnyInGroupIsUnderRoof)
                {
                    launch.Disable("CommandLaunchGroupFailUnderRoof".Translate());
                }
                yield return((Gizmo)launch);

                launch = (Command_Action)null;
            }
        }
Ejemplo n.º 8
0
        private void DrawFileButtons(SaveFile file, ref float width)
        {
            if (file.HasRwVersion)
            {
                if (file.replay && Multiplayer.ShowDevInfo)
                {
                    if (Widgets.ButtonText(new Rect(width, 0, 120, 40), "MpWatchReplay".Translate()))
                    {
                        CheckGameVersionAndMods(
                            file,
                            () => { Close(false); Replay.LoadReplay(file.file); }
                            );
                    }

                    width += 120 + 10;
                }

                if (Widgets.ButtonText(new Rect(width, 0, 120, 40), "MpHostButton".Translate()))
                {
                    CheckGameVersionAndMods(
                        file,
                        () => { Close(false); Find.WindowStack.Add(new HostWindow(file)
                        {
                            returnToServerBrowser = true
                        }); }
                        );
                }

                width += 120 + 10;
            }

            if (Widgets.ButtonText(new Rect(width, 0, 120, 40), "Delete".Translate()))
            {
                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmDelete".Translate(file.displayName), () =>
                {
                    file.file.Delete();
                    reader.RemoveFile(file.file);
                    selectedFile = null;
                }, true));
            }

            width += 120;
        }
Ejemplo n.º 9
0
 public static void DrawAbandonButtons(ref Rect rect, ThingDef thingDef, int count, List <Thing> things)
 {
     // Method mostly copied from RimWorld.ITab_ContentsBase.DoThingRow
     if (count != 1 && Widgets.ButtonImage(new Rect(rect.x + rect.width - 24f, rect.y + (rect.height - 24f) / 2f, 24f, 24f), CaravanThingsTabUtility.AbandonSpecificCountButtonTex))
     {
         Find.WindowStack.Add(new Dialog_Slider("RemoveSliderText".Translate(thingDef.label), 1, count, (int x) => OnDropThing(thingDef, x, count)));
     }
     rect.width -= 24f;
     if (Widgets.ButtonImage(new Rect(rect.x + rect.width - 24f, rect.y + (rect.height - 24f) / 2f, 24f, 24f), CaravanThingsTabUtility.AbandonButtonTex))
     {
         string value = thingDef.label;
         if (things.Count == 1 && things[0] is Pawn)
         {
             value = ((Pawn)things[0]).LabelShortCap;
         }
         Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmRemoveItemDialog".Translate(value), () => OnDropThing(thingDef, count, count)));
     }
     rect.width -= 24f;
 }
Ejemplo n.º 10
0
 public override IEnumerable <Gizmo> CompGetGizmosExtra()
 {
     foreach (Gizmo g in this.< CompGetGizmosExtra > __BaseCallProxy0())
     {
         yield return(g);
     }
     if (this.LoadingInProgressOrReadyToLaunch)
     {
         Command_Action launch = new Command_Action();
         launch.defaultLabel = "CommandLaunchGroup".Translate();
         launch.defaultDesc  = "CommandLaunchGroupDesc".Translate();
         launch.icon         = CompLaunchable.LaunchCommandTex;
         launch.alsoClickIfOtherInGroupClicked = false;
         launch.action = delegate()
         {
             if (this.AnyInGroupHasAnythingLeftToLoad)
             {
                 Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmSendNotCompletelyLoadedPods".Translate(new object[]
                 {
                     this.FirstThingLeftToLoadInGroup.LabelCapNoCount
                 }), new Action(this.StartChoosingDestination), false, null));
             }
             else
             {
                 this.StartChoosingDestination();
             }
         };
         if (!this.AllInGroupConnectedToFuelingPort)
         {
             launch.Disable("CommandLaunchGroupFailNotConnectedToFuelingPort".Translate());
         }
         else if (!this.AllFuelingPortSourcesInGroupHaveAnyFuel)
         {
             launch.Disable("CommandLaunchGroupFailNoFuel".Translate());
         }
         else if (this.AnyInGroupIsUnderRoof)
         {
             launch.Disable("CommandLaunchGroupFailUnderRoof".Translate());
         }
         yield return(launch);
     }
     yield break;
 }
Ejemplo n.º 11
0
        public static void TryAbandonViaInterface(MapParent settlement)
        {
            Map map = settlement.Map;

            if (map == null)
            {
                Abandon(settlement);
                SoundDefOf.Tick_High.PlayOneShotOnCamera();
            }
            else
            {
                StringBuilder      stringBuilder = new StringBuilder();
                IEnumerable <Pawn> source        = map.mapPawns.PawnsInFaction(Faction.OfPlayer);
                if (source.Count() != 0)
                {
                    StringBuilder stringBuilder2 = new StringBuilder();
                    foreach (Pawn item in from x in source
                             orderby x.IsColonist descending
                             select x)
                    {
                        if (stringBuilder2.Length > 0)
                        {
                            stringBuilder2.AppendLine();
                        }
                        stringBuilder2.Append("    " + item.LabelCap);
                    }
                    stringBuilder.Append("ConfirmAbandonHomeWithColonyPawns".Translate(stringBuilder2));
                }
                PawnDiedOrDownedThoughtsUtility.BuildMoodThoughtsListString(map.mapPawns.AllPawns, PawnDiedOrDownedThoughtsKind.Banished, stringBuilder, null, "\n\n" + "ConfirmAbandonHomeNegativeThoughts_Everyone".Translate(), "ConfirmAbandonHomeNegativeThoughts");
                if (stringBuilder.Length == 0)
                {
                    Abandon(settlement);
                    SoundDefOf.Tick_High.PlayOneShotOnCamera();
                }
                else
                {
                    Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation(stringBuilder.ToString(), delegate
                    {
                        Abandon(settlement);
                    }));
                }
            }
        }
Ejemplo n.º 12
0
        private static void DoTutorialPopup()
        {
            var enableAction = new Action(() =>
            {
                Prefs.AdaptiveTrainingEnabled = true;
                settings.ShowTutorialPopup    = false;
                settings.Write();
            });
            var disableAction = new Action(() =>
            {
                settings.ShowTutorialPopup = false;
                settings.Write();
            });

            var dialog = new Dialog_MessageBox("CE_EnableTutorText".Translate(), "CE_EnableTutorDisable".Translate(), disableAction, "CE_EnableTutorEnable".Translate(),
                                               enableAction, null, true);

            Find.WindowStack.Add(dialog);
        }
Ejemplo n.º 13
0
        public static bool ConfigureStartingPawnsDoNextPrefix(Page_ConfigureStartingPawns __instance, Pawn ___curPawn)
        {
            MethodInfo runMe = AccessTools.Method(typeof(Page_ConfigureStartingPawns), "DoNext");

            List <Pawn> tmpList = new List <Pawn>(Find.GameInitData.startingPawnCount);

            tmpList.AddRange(Find.GameInitData.startingAndOptionalPawns.Take(Find.GameInitData.startingPawnCount));
            if (!tmpList.Contains(___curPawn))
            {
                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation($"Currently viewed colonist is not selected for landing. Are you sure you wish to embark without {___curPawn.LabelCap}?",
                                                                          () => { returnvalue = true; runMe.Invoke(__instance, new object[] { }); }));
            }
            else
            {
                returnvalue = true;
            }
            tmpList.Clear();
            return(returnvalue);
        }
Ejemplo n.º 14
0
        public static void ShowDeleteWorldDialog(string worldDir, Action <string> onDelete,
                                                 Action <string> onConvert = null)
        {
            var worldDirInfo = new DirectoryInfo(worldDir);

            var dialogBox = new Dialog_MessageBox(
                "FilUnderscore.PersistentRimWorlds.Delete.World.Desc".Translate(worldDirInfo.Name),
                "Delete".Translate(),
                () => onDelete(worldDirInfo.FullName), "FilUnderscore.PersistentRimWorlds.Cancel".Translate(),
                null, "FilUnderscore.PersistentRimWorlds.Delete.World".Translate(), true);

            if (onConvert != null)
            {
                dialogBox.buttonCText = "FilUnderscore.PersistentRimWorlds.Delete.World.Convert".Translate();

                dialogBox.buttonCAction = () => onConvert(worldDirInfo.FullName);
            }

            Find.WindowStack.Add(dialogBox);
        }
Ejemplo n.º 15
0
 public IEnumerable <Gizmo> GetGizmosExtra()
 {
     yield return(new Command_Action()
     {
         defaultLabel = "AndroidGizmoDetonateBlackBoxLabel".Translate(),
         defaultDesc = "AndroidGizmoDetonateBlackBoxDescription".Translate(),
         icon = ContentFinder <Texture2D> .Get("Icons/Upgrades/BlackBoxIcon", true),
         order = -97,
         action = delegate()
         {
             Dialog_MessageBox dialog =
                 Dialog_MessageBox.CreateConfirmation(
                     "AndroidSelfDetonationConfirmationDialogText".Translate(pawn.Name.ToStringFull),
                     () => pawn.Kill(null),
                     true,
                     "AndroidGizmoSelfDetonationLabel".Translate());
             Find.WindowStack.Add(dialog);
         }
     });
 }
Ejemplo n.º 16
0
        internal static void DeleteLocal(ModMetaData mod)
        {
            Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation(
                                     I18n.ConfirmRemoveLocal(mod.Name), delegate
            {
                if (TryRemoveLocalCopy(mod))
                {
                    Messages.Message(I18n.RemoveLocalSucceeded(mod.Name),
                                     MessageTypeDefOf.NeutralEvent, false);
                }
                else
                {
                    Messages.Message(I18n.RemoveLocalFailed(mod.Name),
                                     MessageTypeDefOf.RejectInput, false);
                }

                // remove this version either way, as it's likely to be borked.
                ModButton_Installed.For(mod).Notify_VersionRemoved(mod);
            }, true));
        }
Ejemplo n.º 17
0
        public override void DoWindowContents(Rect inRect)
        {
            bool flag = false;

            if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)
            {
                flag = true;
                Event.current.Use();
            }
            Text.Font = GameFont.Small;
            Widgets.Label(new Rect(15f, 15f, 500f, 30f), "ColonistHistory.Dialog_DeleteLogDesc".Translate());
            Widgets.Label(new Rect(15f, 60f, 500f, 30f), "ColonistHistory.Dialog_DeleteLogTargetPawn".Translate());
            if (Widgets.RadioButtonLabeled(new Rect(45f, 90f, 300f, 30f), this.parent.CurPawn.Name.ToStringShort, this.targetPawn == TargetPawn.Single))
            {
                this.targetPawn = TargetPawn.Single;
            }
            if (Widgets.RadioButtonLabeled(new Rect(45f, 120f, 300f, 30f), "ColonistHistory.Dialog_DeleteLogTargetPawnAll".Translate(), this.targetPawn == TargetPawn.All))
            {
                this.targetPawn = TargetPawn.All;
            }
            Widgets.Label(new Rect(15f, 165f, 500f, 30f), "ColonistHistory.Dialog_DeleteLogTargetDatetime".Translate());
            if (Widgets.RadioButtonLabeled(new Rect(45f, 195f, 300f, 30f), "ColonistHistory.Dialog_DeleteLogTargetDatetimeOnly".Translate(), this.targetDatetime == TargetDatetime.Only))
            {
                this.targetDatetime = TargetDatetime.Only;
            }
            if (Widgets.RadioButtonLabeled(new Rect(45f, 225f, 300f, 30f), "ColonistHistory.Dialog_DeleteLogTargetDatetimeBefore".Translate(), this.targetDatetime == TargetDatetime.Before))
            {
                this.targetDatetime = TargetDatetime.Before;
            }
            if (Widgets.RadioButtonLabeled(new Rect(45f, 255f, 300f, 30f), "ColonistHistory.Dialog_DeleteLogTargetDatetimeAfter".Translate(), this.targetDatetime == TargetDatetime.After))
            {
                this.targetDatetime = TargetDatetime.After;
            }
            if (Widgets.ButtonText(new Rect(inRect.width / 2f + 20f, inRect.height - 35f, inRect.width / 2f - 20f, 35f), "OK", true, true, true) || flag)
            {
                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ColonistHistory.ConfirmDeleteLog".Translate(), delegate {
                    DeleteLog(this.targetPawn, this.targetDatetime);
                }, true, null));
                Find.WindowStack.TryRemove(this, true);
            }
        }
        private Command FulfillRequestCommand(Caravan caravan)
        {
            Command_Action command_Action = new Command_Action();

            command_Action.defaultLabel = "CommandFulfillTradeOffer".Translate();
            command_Action.defaultDesc  = "CommandFulfillTradeOfferDesc".Translate();
            command_Action.icon         = TradeRequestComp.TradeCommandTex;
            command_Action.action       = delegate()
            {
                if (!this.ActiveRequest)
                {
                    Log.Error("Attempted to fulfill an unavailable request", false);
                }
                else if (!CaravanInventoryUtility.HasThings(caravan, this.requestThingDef, this.requestCount, new Func <Thing, bool>(this.PlayerCanGive)))
                {
                    Messages.Message("CommandFulfillTradeOfferFailInsufficient".Translate(new object[]
                    {
                        TradeRequestUtility.RequestedThingLabel(this.requestThingDef, this.requestCount)
                    }), MessageTypeDefOf.RejectInput, false);
                }
                else
                {
                    Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("CommandFulfillTradeOfferConfirm".Translate(new object[]
                    {
                        GenLabel.ThingLabel(this.requestThingDef, null, this.requestCount),
                        GenThing.ThingsToCommaList(this.rewards, true, true, -1)
                    }), delegate
                    {
                        this.Fulfill(caravan);
                    }, false, null));
                }
            };
            if (!CaravanInventoryUtility.HasThings(caravan, this.requestThingDef, this.requestCount, new Func <Thing, bool>(this.PlayerCanGive)))
            {
                command_Action.Disable("CommandFulfillTradeOfferFailInsufficient".Translate(new object[]
                {
                    TradeRequestUtility.RequestedThingLabel(this.requestThingDef, this.requestCount)
                }));
            }
            return(command_Action);
        }
Ejemplo n.º 19
0
        public void ShowReport()
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (!ShipUtility.LaunchFailReasons((Building)this.parent).Any <string>())
            {
                stringBuilder.AppendLine("ShipReportCanLaunch".Translate());
            }
            else
            {
                stringBuilder.AppendLine("ShipReportCannotLaunch".Translate());
                foreach (string current in ShipUtility.LaunchFailReasons((Building)this.parent))
                {
                    stringBuilder.AppendLine();
                    stringBuilder.AppendLine(current);
                }
            }
            Dialog_MessageBox window = new Dialog_MessageBox(stringBuilder.ToString(), null, null, null, null, null, false);

            Find.WindowStack.Add(window);
        }
Ejemplo n.º 20
0
        /*Delete Construction Site    */
        public static void DeleteConstructionSite(int tile)
        {
            RoadConstructionSite ConstructionSite = (RoadConstructionSite)Find.WorldObjects.WorldObjectOfDefAt(DefDatabase <WorldObjectDef> .GetNamed("RoadConstructionSite", true), tile);

            if (ConstructionSite != null)
            {
                // Confirm construction site deletion if resources were already consumed
                string s = ConstructionSite.ResourcesAlreadyConsumed();
                if (!s.NullOrEmpty())
                {
                    Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("RoadsOfTheRim_ConfirmDestroyResourcesAlreadyConsumed".Translate(s), delegate
                    {
                        DeleteConstructionSiteConfirmed(ConstructionSite);
                    }, false, null));
                }
                else
                {
                    DeleteConstructionSiteConfirmed(ConstructionSite);
                }
            }
        }
Ejemplo n.º 21
0
        public static void ResetAllSettings()
        {
            Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("VehicleResetAllConfirmation".Translate(), delegate()
            {
                SoundDefOf.Click.PlayOneShotOnCamera(null);
                cachedFields.Clear();
                PopulateCachedFields();
                settings.main.ResetSettings();
                settings.vehicles.ResetSettings();
                settings.upgrades.ResetSettings();
                settings.debug.ResetSettings();

                if (Current.ProgramState == ProgramState.Playing)
                {
                    foreach (Map map in Find.Maps)
                    {
                        map.GetCachedMapComponent <VehicleReservationManager>().ReleaseAllClaims();
                    }
                }
            }, false, null));
        }
Ejemplo n.º 22
0
        public static void getPotentialModConflicts_2()
        {
            bool   WrongLoadOrder      = false;
            bool   Conflictingmods     = false;
            string ModConflictsMessage = "";

            //Add/Remove mods here.
            string[] IncompatibleMods = { "biomesteam.biomesislands", "mlie.bestmix", "rwmt.Multiplayer", "pyrce.terrain.movement.modkit", "sarg.smartspeed", "Dingo.NoForcedSlowdown", "balistafreak.StandaloneHotSpring", "tickspersecond.sparr.rw" };
            //
            string NewLine   = "_______________________" + "\n" + "\n";
            var    LoadOrder = LoadedModManager.RunningModsListForReading;
            int    RTpos     = LoadOrder.FindIndex(i => i.PackageId == "majorhoff.rimthreaded");

            if (RTpos != (LoadOrder.Count - 1))
            {
                WrongLoadOrder      = true;
                ModConflictsMessage = NewLine + "Critical incompatibility:" + "\n" + NewLine + "RimThreaded is NOT last in your mod load order, fix immediately." + "\n";
            }
            ModConflictsMessage += NewLine + "Highly incompatible:" + "\n" + NewLine;
            for (int i = 0; i < LoadOrder.Count; i++)
            {
                if (IncompatibleMods.Contains(LoadOrder[i].PackageId))
                {
                    ModConflictsMessage += LoadOrder[i].Name + "\n";
                    Conflictingmods      = true;
                }
            }
            if (!Conflictingmods)
            {
                ModConflictsMessage += "No Conflicts detected :D" + "\n";
            }

            ModConflictsMessage += NewLine + "Other (potential) incompatibilities:" + "\n" + NewLine + "Check out the wiki on github for more information" + "\n" + "_______________________";
            Dialog_MessageBox window2 = new Dialog_MessageBox(ModConflictsMessage, "Ill take my chances", null, "Disable this alert in settings", null, "RimThreaded Mod Conflicts detected:", true);

            if (WrongLoadOrder || Conflictingmods)
            {
                Find.WindowStack.Add(window2);
            }
        }
Ejemplo n.º 23
0
 public override IEnumerable <Gizmo> CompGetGizmosExtra()
 {
     foreach (Gizmo item in base.CompGetGizmosExtra())
     {
         yield return(item);
     }
     if (LoadingInProgressOrReadyToLaunch)
     {
         Command_Action command_Action = new Command_Action();
         command_Action.defaultLabel = "CommandLaunchGroup".Translate();
         command_Action.defaultDesc  = "CommandLaunchGroupDesc".Translate();
         command_Action.icon         = LaunchCommandTex;
         command_Action.alsoClickIfOtherInGroupClicked = false;
         command_Action.action = delegate
         {
             if (AnyInGroupHasAnythingLeftToLoad)
             {
                 Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmSendNotCompletelyLoadedPods".Translate(FirstThingLeftToLoadInGroup.LabelCapNoCount, FirstThingLeftToLoadInGroup), StartChoosingDestination));
             }
             else
             {
                 StartChoosingDestination();
             }
         };
         if (!AllInGroupConnectedToFuelingPort)
         {
             command_Action.Disable("CommandLaunchGroupFailNotConnectedToFuelingPort".Translate());
         }
         else if (!AllFuelingPortSourcesInGroupHaveAnyFuel)
         {
             command_Action.Disable("CommandLaunchGroupFailNoFuel".Translate());
         }
         else if (AnyInGroupIsUnderRoof)
         {
             command_Action.Disable("CommandLaunchGroupFailUnderRoof".Translate());
         }
         yield return(command_Action);
     }
 }
Ejemplo n.º 24
0
        public static void Postfix()
        {
            if (!Finder.ERROR)
            {
                CecilPatcher.ApplyAll();
            }

            if (!Finder.READY || Finder.ERROR)
            {
                Dialog_MessageBox window = new Dialog_MessageBox(
                    Finder.ERROR ? "An Error during patching forced mod loading to stop!" :
                    "A patch has been apply. Please restart your game now. (If you don't restart mods won't work correctly)", "Quit & Apply Patches", delegate
                {
                    Application.Quit();
                }, "Ignore".Translate());

                Find.WindowStack.Add(window);
            }
#if DEBUG
            Log.Message("Cecil: Harmony Ok");
#endif
        }
Ejemplo n.º 25
0
        public override IEnumerable <Gizmo> GetCaravanGizmos(Caravan caravan)
        {
            if (ActiveRequest)
            {
                Command_Action commandAction = new Command_Action
                {
                    defaultLabel = "MFI_CommandHelpOutHarvesting".Translate(),
                    defaultDesc  = "MFI_CommandHelpOutHarvesting".Translate(),
                    icon         = setPlantToGrowTex,
                    action       = delegate
                    {
                        {
                            if (!ActiveRequest)
                            {
                                Log.Error(text: "Attempted to fulfill an unavailable request");
                                return;
                            }
                            if (BestCaravanPawnUtility.FindPawnWithBestStat(caravan: caravan, stat: StatDefOf.PlantHarvestYield) == null)
                            {
                                Messages.Message(text: "MFI_MessageBumperCropNoGrower".Translate(), lookTargets: caravan, def: MessageTypeDefOf.NegativeEvent);
                                return;
                            }
                            Find.WindowStack.Add(window: Dialog_MessageBox.CreateConfirmation(text: "MFI_CommandFulfillBumperCropHarvestConfirm".Translate(caravan.LabelCap),
                                                                                              confirmedAct: delegate
                            {
                                NotifyCaravanArrived(caravan: caravan);
                            }));
                        }
                    }
                };


                if (BestCaravanPawnUtility.FindPawnWithBestStat(caravan: caravan, stat: StatDefOf.PlantHarvestYield) == null)
                {
                    commandAction.Disable(reason: "MFI_MessageBumperCropNoGrower".Translate());
                }
                yield return(commandAction);
            }
        }
        public void LaunchLightPod(int destinationTile, IntVec3 destinationCell, TransportPodsArrivalAction arrivalAction)
        {
            Map map = this.CasterPawn.Map;

            CreatePodGroup();
            podTList[0].TryRemoveLord(map);
            int groupID = podTList[0].groupID;

            for (int i = 0; i < podTList.Count; i++)
            {
                ThingOwner    directlyHeldThings = podTList[i].GetDirectlyHeldThings();
                ActiveDropPod activeDropPod      = (ActiveDropPod)ThingMaker.MakeThing(ThingDefOf.ActiveDropPod);
                activeDropPod.Contents = new ActiveDropPodInfo();
                activeDropPod.Contents.innerContainer.TryAddRangeOrTransfer(directlyHeldThings, canMergeWithExistingStacks: true, destroyLeftover: true);
                WorldTransport.TM_DropPodLeaving obj = (WorldTransport.TM_DropPodLeaving)SkyfallerMaker.MakeSkyfaller(TorannMagicDefOf.TM_LightPodLeaving, activeDropPod);
                obj.groupID         = groupID;
                obj.destinationTile = destinationTile;
                obj.arrivalAction   = arrivalAction;
                obj.arrivalCell     = destinationCell;
                obj.draftFlag       = this.draftFlag;
                podTList[i].CleanUpLoadingVars(map);
                podTList[i].parent.Destroy();
                GenSpawn.Spawn(obj, podTList[i].parent.Position, map);
            }
            CameraJumper.TryHideWorld();
            if (!map.mapPawns.AnyColonistSpawned && !map.IsPlayerHome)
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("TM_AbandoningMap".Translate(map.Parent.LabelCap));
                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation(stringBuilder.ToString(), delegate
                {
                    Settlement sm = map.Parent as Settlement;
                    WorldTransport.TM_DelayedDestroyMap ddm = new WorldTransport.TM_DelayedDestroyMap();
                    ddm.parent     = sm;
                    ddm.delayTicks = 120;
                    sm.AllComps.Add(ddm);
                }));
            }
        }
        public static void TryAbandonOrBanishViaInterface(Thing t, Caravan caravan)
        {
            Pawn p = t as Pawn;

            if (p != null)
            {
                if (!caravan.PawnsListForReading.Any((Pawn x) => x != p && caravan.IsOwner(x)))
                {
                    Messages.Message("MessageCantBanishLastColonist".Translate(), caravan, MessageTypeDefOf.RejectInput, false);
                }
                else
                {
                    PawnBanishUtility.ShowBanishPawnConfirmationDialog(p);
                }
            }
            else
            {
                Dialog_MessageBox window = Dialog_MessageBox.CreateConfirmation("ConfirmAbandonItemDialog".Translate(new object[]
                {
                    t.Label
                }), delegate
                {
                    Pawn ownerOf = CaravanInventoryUtility.GetOwnerOf(caravan, t);
                    if (ownerOf == null)
                    {
                        Log.Error("Could not find owner of " + t, false);
                    }
                    else
                    {
                        ownerOf.inventory.innerContainer.Remove(t);
                        t.Destroy(DestroyMode.Vanish);
                        caravan.RecacheImmobilizedNow();
                        caravan.RecacheDaysWorthOfFood();
                    }
                }, true, null);
                Find.WindowStack.Add(window);
            }
        }
Ejemplo n.º 28
0
        static bool Prefix(MapParent settlement)
        {
            Settlement factionBase = settlement as Settlement;

            if (WorldObjectRemnantColony.CanCreateRemnantColony(factionBase))
            {
                //custom text for remnant colony
                Map                map           = settlement.Map;
                StringBuilder      stringBuilder = new StringBuilder();
                IEnumerable <Pawn> source        = map.mapPawns.PawnsInFaction(Faction.OfPlayer);
                if (source.Any())
                {
                    StringBuilder stringBuilder2 = new StringBuilder();
                    foreach (Pawn current in from x in source
                             orderby x.IsColonist descending
                             select x)
                    {
                        if (stringBuilder2.Length > 0)
                        {
                            stringBuilder2.AppendLine();
                        }
                        stringBuilder2.Append("    " + current.LabelCap);
                    }
                    stringBuilder.Append("ConfirmAbandonHomeWithColonyPawns".Translate(stringBuilder2.ToString()));
                }

                //any pawns we wont use in the remnant colony will be banished(e.g. animals and prisoner)
                PawnDiedOrDownedThoughtsUtility.BuildMoodThoughtsListString(
                    map.mapPawns.AllPawns.Except(WorldObjectRemnantColony.GetPawnsFromSettlementForRemnantColony(factionBase)),
                    PawnDiedOrDownedThoughtsKind.Banished, stringBuilder, null, "\n\n" + "ConfirmAbandonHomeNegativeThoughts_Everyone".Translate(), "ConfirmAbandonHomeNegativeThoughts");

                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation(stringBuilder.ToString(), delegate {
                    typeof(SettlementAbandonUtility).GetMethod("Abandon", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, new Object[] { settlement });
                }, false, null));
                return(false);
            }
            return(true);
        }
        private void CheckWarnRequiredWorkTypesDisabledForEveryone(Action nextAction)
        {
            IEnumerable <WorkTypeDef> enumerable = StartingPawnUtility.RequiredWorkTypesDisabledForEveryone();

            if (enumerable.Any())
            {
                StringBuilder stringBuilder = new StringBuilder();
                foreach (WorkTypeDef item in enumerable)
                {
                    if (stringBuilder.Length > 0)
                    {
                        stringBuilder.AppendLine();
                    }
                    stringBuilder.Append("  - " + item.gerundLabel.CapitalizeFirst());
                }
                TaggedString text = "ConfirmRequiredWorkTypeDisabledForEveryone".Translate(stringBuilder.ToString());
                Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation(text, nextAction));
            }
            else
            {
                nextAction();
            }
        }
Ejemplo n.º 30
0
 static FloatMenuManager()
 {
     rawItems             = new Dictionary <string, Action <Pawn> >();
     usesDefaultJobDriver = new Dictionary <string, bool>();
     currentAction        = null;
     shiftKeyItems        = new Dictionary <string, Action>();
     Add("FloatMenuCaptionExchange".Translate(), delegate(Pawn p)
     {
         ExtUtil.PrepareVirtualTrade(p, new Trader_BankNoteExchange());
     }, usesDefaultJobDriver: true);
     AddShiftKeyItem("FloatMenuCaptionRemoveAll".Translate(), delegate
     {
         Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("DlgRemoveModContents".Translate(), delegate
         {
             int num = 0;
             num    += ModContentRemover.RemoveAllModContentsFromWorldObjects();
             num    += ModContentRemover.RemoveAllModContentsFromPassingShips();
             num    += ModContentRemover.RemoveAllModContentsFromMaps();
             num    += ModContentRemover.RemoveAllModContentsFromAllPawns();
             Messages.Message("MsgModContentsRemoved".Translate(num), MessageTypeDefOf.PositiveEvent);
         }, destructive: true, title: "DlgTitleRemoveModContents".Translate()));
     });
 }