Пример #1
0
        private static void BaseGen()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (string item in DefDatabase <RuleDef> .AllDefs.Select((RuleDef x) => x.symbol).Distinct())
            {
                string localSymbol = item;
                list.Add(new DebugMenuOption(item, DebugMenuOptionMode.Action, delegate
                {
                    DebugTool tool      = null;
                    IntVec3 firstCorner = default(IntVec3);
                    tool = new DebugTool("first corner...", delegate
                    {
                        firstCorner        = UI.MouseCell();
                        DebugTools.curTool = new DebugTool("second corner...", delegate
                        {
                            IntVec3 second = UI.MouseCell();
                            CellRect rect  = CellRect.FromLimits(firstCorner, second).ClipInsideMap(Find.CurrentMap);
                            RimWorld.BaseGen.BaseGen.globalSettings.map = Find.CurrentMap;
                            RimWorld.BaseGen.BaseGen.symbolStack.Push(localSymbol, rect);
                            RimWorld.BaseGen.BaseGen.Generate();
                            DebugTools.curTool = tool;
                        }, firstCorner);
                    });
                    DebugTools.curTool = tool;
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
Пример #2
0
        private static void CheckReachability()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            TraverseMode[] array = (TraverseMode[])Enum.GetValues(typeof(TraverseMode));
            for (int i = 0; i < array.Length; i++)
            {
                TraverseMode traverseMode2 = array[i];
                TraverseMode traverseMode  = traverseMode2;
                list.Add(new DebugMenuOption(traverseMode2.ToString(), DebugMenuOptionMode.Action, delegate
                {
                    DebugTool tool = null;
                    IntVec3 from   = default(IntVec3);
                    Pawn fromPawn  = default(Pawn);
                    tool           = new DebugTool("from...", delegate
                    {
                        from        = UI.MouseCell();
                        fromPawn    = from.GetFirstPawn(Find.CurrentMap);
                        string text = "to...";
                        if (fromPawn != null)
                        {
                            text = text + " (pawn=" + fromPawn.LabelShort + ")";
                        }
                        DebugTools.curTool = new DebugTool(text, delegate
                        {
                            DebugTools.curTool = tool;
                        }, delegate
                        {
                            IntVec3 c = UI.MouseCell();
                            bool flag;
                            IntVec3 intVec;
                            if (fromPawn != null)
                            {
                                flag   = fromPawn.CanReach(c, PathEndMode.OnCell, Danger.Deadly, canBash: false, traverseMode);
                                intVec = fromPawn.Position;
                            }
                            else
                            {
                                flag   = Find.CurrentMap.reachability.CanReach(from, c, PathEndMode.OnCell, traverseMode, Danger.Deadly);
                                intVec = from;
                            }
                            Color color = flag ? Color.green : Color.red;
                            Widgets.DrawLine(intVec.ToUIPosition(), c.ToUIPosition(), color, 2f);
                        });
                    });
                    DebugTools.curTool = tool;
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
Пример #3
0
        private static void FlashSpectatorsCells()
        {
            Action <bool> act = delegate(bool bestSideOnly)
            {
                DebugTool tool        = null;
                IntVec3   firstCorner = default(IntVec3);
                tool = new DebugTool("first watch rect corner...", delegate
                {
                    firstCorner        = UI.MouseCell();
                    DebugTools.curTool = new DebugTool("second watch rect corner...", delegate
                    {
                        IntVec3 second                = UI.MouseCell();
                        CellRect spectateRect         = CellRect.FromLimits(firstCorner, second).ClipInsideMap(Find.CurrentMap);
                        SpectateRectSide allowedSides = SpectateRectSide.All;
                        if (bestSideOnly)
                        {
                            allowedSides = SpectatorCellFinder.FindSingleBestSide(spectateRect, Find.CurrentMap);
                        }
                        SpectatorCellFinder.DebugFlashPotentialSpectatorCells(spectateRect, Find.CurrentMap, allowedSides);
                        DebugTools.curTool = tool;
                    }, firstCorner);
                });
                DebugTools.curTool = tool;
            };
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            list.Add(new DebugMenuOption("All sides", DebugMenuOptionMode.Action, delegate
            {
                act(obj: false);
            }));
            list.Add(new DebugMenuOption("Best side only", DebugMenuOptionMode.Action, delegate
            {
                act(obj: true);
            }));
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }