コード例 #1
0
 public override void FinalizeInit()
 {
     base.FinalizeInit();
     if (VehicleMod.settings.debug.debugGenerateWorldPathCostTexts)
     {
         LongEventHandler.QueueLongEvent(delegate()
         {
             WorldPathTextMeshGenerator.GenerateTextMeshObjects();
         }, "VehiclesTextMeshBiomeGeneration", false, (Exception ex) => Log.Error($"{VehicleHarmony.LogLabel} Exception thrown while trying to generate TextMesh GameObjects for world map debugging. Please report to mod page."));
     }
 }
コード例 #2
0
ファイル: Section_Debug.cs プロジェクト: SmashPhil/Vehicles
        public override void DrawSection(Rect rect)
        {
            float width   = rect.width / 1.5f;
            Rect  devMode = new Rect((rect.width - width) / 2, rect.y + 20, width, rect.height);
            var   color   = GUI.color;

            if (!Prefs.DevMode)
            {
                GUI.enabled = false;
                GUI.color   = UIElements.InactiveColor;
            }
            listingStandard = new Listing_Standard();
            listingStandard.Begin(devMode);
            listingStandard.Header("DevModeVehicles".Translate(), ListingExtension.BannerColor, GameFont.Medium, TextAnchor.MiddleCenter);

            listingStandard.GapLine(16);
            listingStandard.CheckboxLabeled("DebugLogging".Translate(), ref debugLogging, "DebugLoggingTooltip".Translate());
            if (listingStandard.CheckboxLabeledReturned("DebugGenerateWorldPathCostTexts".Translate(), ref debugGenerateWorldPathCostTexts, "DebugGenerateWorldPathCostTextsTooltip".Translate()))
            {
                if (Find.World != null)
                {
                    LongEventHandler.QueueLongEvent(delegate()
                    {
                        if (debugGenerateWorldPathCostTexts)
                        {
                            WorldPathTextMeshGenerator.GenerateTextMeshObjects();
                        }
                        else
                        {
                            WorldPathTextMeshGenerator.DestroyTextMeshObjects();
                        }
                    }, "VehiclesTextMeshBiomeGeneration", false, (Exception ex) => Log.Error($"{VehicleHarmony.LogLabel} Exception thrown while trying to generate TextMesh GameObjects for world map debugging. Please report to mod page."));
                }
            }
            listingStandard.CheckboxLabeled("DebugDraftAnyVehicle".Translate(), ref debugDraftAnyShip, "DebugDraftAnyVehicleTooltip".Translate());
            listingStandard.CheckboxLabeled("DebugDisablePathing".Translate(), ref debugDisableWaterPathing, "DebugDisablePathingTooltip".Translate());

            listingStandard.GapLine(16);

            listingStandard.CheckboxLabeled("DebugSpawnVehiclesGodMode".Translate(), ref debugSpawnVehicleBuildingGodMode, "DebugSpawnVehiclesGodModeTooltip".Translate());

            listingStandard.GapLine(16);

            listingStandard.CheckboxLabeled("DebugCannonDrawer".Translate(), ref debugDrawCannonGrid, "DebugCannonDrawerTooltip".Translate());
            listingStandard.CheckboxLabeled("DebugDrawNodeGrid".Translate(), ref debugDrawNodeGrid, "DebugDrawNodeGridTooltip".Translate());
            listingStandard.CheckboxLabeled("DebugDrawHitbox".Translate(), ref debugDrawHitbox, "DebugDrawHitboxTooltip".Translate());
            listingStandard.CheckboxLabeled("DebugDrawVehicleTracks".Translate(), ref debugDrawVehicleTracks, "DebugDrawVehicleTracksTooltip".Translate());
            listingStandard.CheckboxLabeled("DebugWriteVehiclePathingCosts".Translate(), ref debugDrawVehiclePathCosts, "DebugWriteVehiclePathingCostsTooltip".Translate());
            listingStandard.CheckboxLabeled("DebugDrawBumpers".Translate(), ref debugDrawBumpers, "DebugDrawBumpersTooltip".Translate());

            listingStandard.GapLine(16);

            listingStandard.CheckboxLabeled("DebugDrawRegions".Translate(), ref debugDrawRegions, "DebugDrawRegionsTooltip".Translate());
            listingStandard.CheckboxLabeled("DebugDrawRegionLinks".Translate(), ref debugDrawRegionLinks, "DebugDrawRegionLinksTooltip".Translate());
            listingStandard.CheckboxLabeled("DebugDrawRegionThings".Translate(), ref debugDrawRegionThings, "DebugDrawRegionThingsTooltip".Translate());

            listingStandard.GapLine(16);

            if (listingStandard.ButtonText("ShowRecentNews".Translate()))
            {
                string versionChecking = "Null";
                try
                {
                    List <DebugMenuOption> versions = new List <DebugMenuOption>();
                    foreach (string version in updateLogs.Keys)
                    {
                        versionChecking = version;
                        versions.Add(new DebugMenuOption(version, DebugMenuOptionMode.Action, delegate()
                        {
                            string loadFolder  = FileReader.ModFoldersForVersion(ConditionalPatchApplier.VehicleMCP).LastOrDefault();
                            string description = updateLogs[version];
                            Find.WindowStack.Add(new Dialog_NewUpdate(new HashSet <UpdateLog.UpdateLog>()
                            {
                                new UpdateLog.UpdateLog(ConditionalPatchApplier.VehicleMCP, loadFolder, description)
                            }));
                        }));
                    }
                    Find.WindowStack.Add(new Dialog_DebugOptionListLister(versions));
                }
                catch (Exception ex)
                {
                    Log.Error($"{VehicleHarmony.LogLabel} Unable to show update for {versionChecking} Exception = {ex.Message}");
                }
            }
            listingStandard.End();
        }