예제 #1
0
        private void DeSpawnWithBases()
        {
            Dialog_FactionSpawningSettlements.OpenDialog(SpawnCallback);

            void SpawnCallback(int amount, int minDistance)
            {
                try
                {
                    var faction = FactionDeSpawningUtility.DeSpawnWithSettlements(this.faction);
                    if (faction == null)
                    {
                        Messages.Message("AdeptusMechanicus.FactionMessageFailedFull".Translate(), MessageTypeDefOf.RejectInput, false);
                    }
                    else
                    {
                        Messages.Message("AdeptusMechanicus.FactionMessageSuccessFull".Translate(new NamedArgument(faction.GetCallLabel(), "FactionName")), MessageTypeDefOf.TaskCompletion);
                        Close();
                    }
                }
                catch (Exception e)
                {
                    Log.Error($"An error occurred when trying to spawn faction {faction?.def.defName}:\n{e.Message}\n{e.StackTrace}");
                    Messages.Message("AdeptusMechanicus.FactionMessageFailedFull".Translate(), MessageTypeDefOf.RejectInput, false);
                }
            }
        }
예제 #2
0
 private void DeSpawnWithoutBases()
 {
     try
     {
         var faction = FactionDeSpawningUtility.DeSpawnWithoutSettlements(this.faction);
         Messages.Message("AdeptusMechanicus.FactionMessageSuccess".Translate(new NamedArgument(faction.GetCallLabel(), "FactionName")), MessageTypeDefOf.TaskCompletion);
         Close();
     }
     catch (Exception e)
     {
         Log.Error($"An error occurred when trying to remove faction {faction?.def.defName}:\n{e.Message}\n{e.StackTrace}");
         Messages.Message("AdeptusMechanicus.FactionMessageFailed".Translate(), MessageTypeDefOf.RejectInput, false);
     }
 }