예제 #1
0
            static void Postfix(Dialog_DebugActionsMenu __instance, ref List <Dialog_DebugActionsMenu.DebugActionOption> ___debugActions)
            {
                // *** Force Start Reunion Event ***
                var debugAddAlly = new Dialog_DebugActionsMenu.DebugActionOption();

                debugAddAlly.actionType = DebugActionType.Action;
                debugAddAlly.label      = "Force Start Reunion Event";
                debugAddAlly.category   = CATEGORY;
                debugAddAlly.action     = delegate
                {
                    GameComponent.DecideAndDoEvent();
                };
                ___debugActions.Add(debugAddAlly);                 // add to main list

                // *** Make world pawn "Ally" ***
                debugAddAlly            = new Dialog_DebugActionsMenu.DebugActionOption();
                debugAddAlly.actionType = DebugActionType.Action;
                debugAddAlly.label      = "Make world pawn \"Ally\"...";
                debugAddAlly.category   = CATEGORY;
                debugAddAlly.action     = delegate
                {
                    List <DebugMenuOption> list       = new List <DebugMenuOption>();
                    Action <Pawn>          actionPawn = delegate(Pawn p)
                    {
                        if (p != null && p.story != null)
                        {
                            GameComponent.TryRemoveTrait(p);
                            GameComponent.ListAllyAvailable.Add(p);
                            Find.WorldPawns.RemovePawn(p);
                            Util.Msg(p.Name + " has been removed from the World and added to the Ally list.");
                            if (GameComponent.ListAllyAvailable.Count == 1)
                            {
                                GameComponent.TryScheduleNextEvent(true);
                            }
                        }
                    };

                    foreach (Pawn current in Find.WorldPawns.AllPawnsAlive)
                    {
                        Pawn pLocal = current;
                        if (current != null && current.story != null)                         // don't list those already with the trait
                        {
                            list.Add(new DebugMenuOption(current.LabelShort, DebugMenuOptionMode.Action, delegate
                            {
                                actionPawn(pLocal);
                            }));
                        }
                    }

                    Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
                };
                ___debugActions.Add(debugAddAlly);                 // add to main list

                // *** Print Ally List ***
                var debugPrintAllyList = new Dialog_DebugActionsMenu.DebugActionOption();

                debugPrintAllyList.actionType = DebugActionType.Action;
                debugPrintAllyList.label      = "Print \"Ally\" list";
                debugPrintAllyList.category   = CATEGORY;
                debugPrintAllyList.action     = delegate
                {
                    if (GameComponent.ListAllyAvailable.Count > 0)
                    {
                        Util.PrintAllyList();
                    }
                    else
                    {
                        Util.Msg("There are no allies in the Ally list!");
                    }
                };
                ___debugActions.Add(debugPrintAllyList);                 // add to main list
            }
 public override void PostMapGenerate(Map map)
 {
     base.PostMapGenerate(map);
     GameComponent.FlagNextEventReadyForScheduling();
 }
예제 #3
0
 static void Postfix()
 {
     GameComponent.PreInit();
     GameComponent.InitOnLoad();
     GameComponent.PostInit();
 }