public static void TryAbandonViaInterface(MapParent settlement)
        {
            Map map = settlement.Map;

            if (map == null)
            {
                SettlementAbandonUtility.Abandon(settlement);
                SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
            }
            else
            {
                StringBuilder      stringBuilder = new StringBuilder();
                IEnumerable <Pawn> source        = map.mapPawns.PawnsInFaction(Faction.OfPlayer);
                if (source.Count <Pawn>() != 0)
                {
                    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(new object[]
                    {
                        stringBuilder2
                    }));
                }
                PawnDiedOrDownedThoughtsUtility.BuildMoodThoughtsListString(map.mapPawns.AllPawns, PawnDiedOrDownedThoughtsKind.Banished, stringBuilder, null, "\n\n" + "ConfirmAbandonHomeNegativeThoughts_Everyone".Translate(), "ConfirmAbandonHomeNegativeThoughts");
                if (stringBuilder.Length == 0)
                {
                    SettlementAbandonUtility.Abandon(settlement);
                    SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                }
                else
                {
                    Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation(stringBuilder.ToString(), delegate
                    {
                        SettlementAbandonUtility.Abandon(settlement);
                    }, false, null));
                }
            }
        }
示例#2
0
        public static void TryAbandonViaInterface(MapParent settlement)
        {
            Map map = settlement.Map;

            if (map == null)
            {
                Abandon(settlement);
                SoundDefOf.Tick_High.PlayOneShotOnCamera();
                return;
            }
            StringBuilder stringBuilder = new StringBuilder();
            List <Pawn>   source        = map.mapPawns.PawnsInFaction(Faction.OfPlayer);

            if (source.Count() != 0)
            {
                StringBuilder stringBuilder2 = new StringBuilder();
                foreach (Pawn item in source.OrderByDescending((Pawn x) => x.IsColonist))
                {
                    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);
                }));
            }
        }
示例#3
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);
        }