Ejemplo n.º 1
0
        public override void DoSettingsWindowContents(Rect rect)
        {
            if (embeddedPage == null)
            {
                embeddedPage = new Page_RealRuins();
            }

            embeddedPage.DoWindowContents(rect, standalone: false);
        }
Ejemplo n.º 2
0
        public override void DoSettingsWindowContents(Rect rect)
        {
            Rect innerRect = new Rect(0, 0, rect.width - 20, 800);

            Widgets.BeginScrollView(rect, ref scrollPosition, innerRect);
            Rect             rect2 = innerRect.LeftPart(0.45f).Rounded();
            Rect             rect3 = innerRect.RightPart(0.45f).Rounded();
            Listing_Standard left  = new Listing_Standard();
            Listing_Standard right = new Listing_Standard();

            left.Begin(rect2);
            //networking settings
            left.CheckboxLabeled(Text_Option_OfflineMode.Translate(), ref RealRuins_ModSettings.offlineMode, Text_Option_OfflineModeTooltip.Translate());
            left.Label(Text_Option_CurrentCacheSize.Translate() + " " + SnapshotStoreManager.Instance.TotalSize() / (1024 * 1024) + " MB");
            left.Label(Text_Option_CurrentCacheCount.Translate() + " " + SnapshotStoreManager.Instance.StoredSnapshotsCount());
            left.Label(Text_Option_CacheSize.Translate() + "  " + ((int)(RealRuins_ModSettings.diskCacheLimit)).ToString() + " MB", -1f, Text_Option_CacheSizeTooltip.Translate());
            if (left.ButtonText(Text_Option_DownloadMore.Translate() + " (50)", null))  //one five-threaded loader to load single subset on 50 blueprints
            {
                SnapshotManager.Instance.LoadSomeSnapshots(5);
            }
            if (left.ButtonText(Text_Option_DownloadMore.Translate() + "(500)", null))
            {
                for (int i = 0; i < 10; i++)  //ten single-threaded loaders to load ten subsets of 50 blueprints
                {
                    SnapshotManager.Instance.LoadSomeSnapshots();
                }
            }
            left.Gap(25f);

            //generation settings
            int    sizeMin = RealRuins_ModSettings.defaultScatterOptions.minRadius;
            int    sizeMax = RealRuins_ModSettings.defaultScatterOptions.maxRadius;
            string costStr = "∞"; if (RealRuins_ModSettings.defaultScatterOptions.itemCostLimit < 1000)

            {
                costStr = RealRuins_ModSettings.defaultScatterOptions.itemCostLimit.ToString();
            }

            left.Label(Text_Option_Density.Translate() + ": x" + RealRuins_ModSettings.defaultScatterOptions.densityMultiplier.ToString("F"), -1, Text_Option_DensityTT.Translate());
            left.Label(Text_Option_Size_Min.Translate() + ": " + RealRuins_ModSettings.defaultScatterOptions.minRadius, -1, Text_Option_SizeTT.Translate());
            left.Label(Text_Option_Size_Max.Translate() + ": " + RealRuins_ModSettings.defaultScatterOptions.maxRadius, -1, Text_Option_SizeTT.Translate());
            left.Gap(15);
            left.Label(Text_Option_Deterioration.Translate() + ": " + RealRuins_ModSettings.defaultScatterOptions.deteriorationMultiplier.ToString("F"), -1, Text_Option_DeteriorationTT.Translate());
            left.Label(Text_Option_Scavengers.Translate() + ": " + RealRuins_ModSettings.defaultScatterOptions.scavengingMultiplier.ToString("F"), -1, Text_Option_ScavengersTT.Translate());
            left.Label(Text_Option_CostLimit.Translate() + ": " + costStr, -1, Text_Option_CostLimitTT.Translate());
            left.Gap(15);
            left.Label(Text_Option_DisableDecoration.Translate(), -1, Text_Option_DisableDecorationTT.Translate());
            left.Label(Text_Option_DisableTraps.Translate(), -1, Text_Option_DisableTrapsTT.Translate());
            left.Label(Text_Option_DisableHostiles.Translate(), -1, Text_Option_DisableHostilesTT.Translate());
            left.Gap(15);
            left.Label("RealRuins.ForceMultiplier".Translate() + ": x" + RealRuins_ModSettings.forceMultiplier.ToString("F"), -1, "RealRuins.ForceMultiplierTT".Translate());
            left.Label("RealRuins.AbsoluteWealthCap".Translate() + ": " + ((int)RealRuins_ModSettings.ruinsCostCap).ToString("C"), -1, "RealRuins.AbsoluteWealthCapTT".Translate());

            left.Gap(15);

            left.CheckboxLabeled(Text_Option_DisableHaulables.Translate(), ref RealRuins_ModSettings.defaultScatterOptions.disableSpawnItems, Text_Option_DisableHaulablesTT.Translate());
            left.CheckboxLabeled(Text_Option_WallsAndDoorsOnly.Translate(), ref RealRuins_ModSettings.defaultScatterOptions.wallsDoorsOnly, Text_Option_WallsAndDoorsOnlyTT.Translate());
            left.CheckboxLabeled(Text_Option_Proximity.Translate(), ref RealRuins_ModSettings.defaultScatterOptions.enableProximity, Text_Option_ProximityTT.Translate());
            left.CheckboxLabeled(Text_Option_StartWithourRuins.Translate(), ref RealRuins_ModSettings.startWithoutRuins, Text_Option_StartWithourRuinsTT.Translate());
            left.CheckboxLabeled("RealRuins.LeaveVanillaRuins".Translate(), ref RealRuins_ModSettings.preserveStandardRuins, "RealRuins.LeaveVanillaRuinsTT".Translate());

            Rect ttrect = left.GetRect(30f);

            Widgets.Label(ttrect.LeftHalf(), "RealRuins.CaravanReformType".Translate());
            bool result = Widgets.ButtonText(ttrect.RightHalf(), CaravanReformOptions[Math.Min(2, RealRuins_ModSettings.caravanReformType)].Translate());

            left.Gap(30f);

            if (result)
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();

                for (int i = 0; i < 3; i++)
                {
                    string          text  = CaravanReformOptions[i].Translate();
                    int             value = i;
                    FloatMenuOption item  = new FloatMenuOption(text, delegate
                    {
                        RealRuins_ModSettings.caravanReformType = value;
                    });
                    list.Add(item);
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
            TooltipHandler.TipRegion(ttrect, "RealRuins.CaravanReformTooltip".Translate());
            left.Gap(15);

            if (left.ButtonText(Text_Option_ResetToDefaults.Translate(), null))
            {
                ResetSettings();
            }
            left.End();

            right.Begin(rect3);
            right.CheckboxLabeled(Text_Option_AllowDownloads.Translate(), ref RealRuins_ModSettings.allowDownloads, Text_Option_AllowDownloadsTooltip.Translate());
            right.CheckboxLabeled(Text_Option_AllowUploads.Translate(), ref RealRuins_ModSettings.allowUploads, Text_Option_AllowUploadsTooltip.Translate());
            right.Gap(25f);
            RealRuins_ModSettings.diskCacheLimit = right.Slider(RealRuins_ModSettings.diskCacheLimit, 20.0f, 2048.0f);
            if (right.ButtonText(Text_Option_RemoveAll.Translate(), null))
            {
                SnapshotStoreManager.Instance.ClearCache();
            }
            right.Gap(64);

            if (RealRuins_ModSettings.defaultScatterOptions.minRadius > RealRuins_ModSettings.defaultScatterOptions.maxRadius)
            {
                RealRuins_ModSettings.defaultScatterOptions.minRadius = RealRuins_ModSettings.defaultScatterOptions.maxRadius;
            }

            //generation settings
            RealRuins_ModSettings.defaultScatterOptions.densityMultiplier = right.Slider(RealRuins_ModSettings.defaultScatterOptions.densityMultiplier, 0.0f, 20.0f);
            RealRuins_ModSettings.defaultScatterOptions.minRadius         = (int)right.Slider(RealRuins_ModSettings.defaultScatterOptions.minRadius, 4.0f, 64.0f);
            RealRuins_ModSettings.defaultScatterOptions.maxRadius         = (int)right.Slider(RealRuins_ModSettings.defaultScatterOptions.maxRadius, 4.0f, 64.0f);
            right.Gap(15);
            RealRuins_ModSettings.defaultScatterOptions.deteriorationMultiplier = right.Slider(RealRuins_ModSettings.defaultScatterOptions.deteriorationMultiplier, 0.0f, 1.0f);
            RealRuins_ModSettings.defaultScatterOptions.scavengingMultiplier    = right.Slider(RealRuins_ModSettings.defaultScatterOptions.scavengingMultiplier, 0.0f, 5.0f);
            RealRuins_ModSettings.defaultScatterOptions.itemCostLimit           = (int)right.Slider(RealRuins_ModSettings.defaultScatterOptions.itemCostLimit, 0.0f, 1000.0f);
            right.Gap(15);
            RealRuins_ModSettings.defaultScatterOptions.decorationChance = right.Slider(RealRuins_ModSettings.defaultScatterOptions.decorationChance, 0.0f, 0.01f);
            RealRuins_ModSettings.defaultScatterOptions.trapChance       = right.Slider(RealRuins_ModSettings.defaultScatterOptions.trapChance, 0.0f, 0.01f);
            RealRuins_ModSettings.defaultScatterOptions.hostileChance    = right.Slider(RealRuins_ModSettings.defaultScatterOptions.hostileChance, 0.0f, 1.0f);

            right.Gap(15);
            RealRuins_ModSettings.forceMultiplier = right.Slider(RealRuins_ModSettings.forceMultiplier, 0.0f, 2.0f);
            RealRuins_ModSettings.ruinsCostCap    = (float)Math.Exp(right.Slider((float)Math.Log(RealRuins_ModSettings.ruinsCostCap), 6.908f, 20.0f));

            if (right.ButtonText(Text_Option_ResetToDefaults.Translate(), null))
            {
                ResetSettings();
            }

            Rect ggrect = right.GetRect(30f);

            Widgets.Label(ggrect.LeftHalf(), "RealRuins.LogLevel".Translate());
            bool eresult = Widgets.ButtonText(ggrect.RightHalf(), LogLevelOptions[Math.Min(2, RealRuins_ModSettings.logLevel)].Translate());

            right.Gap(30f);
            if (eresult)
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();

                for (int i = 0; i < 3; i++)
                {
                    string          text  = LogLevelOptions[i].Translate();
                    int             value = i;
                    FloatMenuOption item  = new FloatMenuOption(text, delegate {
                        RealRuins_ModSettings.logLevel = value;
                    });
                    list.Add(item);
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
            right.Gap(15);



            if (right.ButtonText("RealRuins.MapsModuleButton".Translate(), null))
            {
                Page_RealRuins page = new Page_RealRuins();
                //Find.WindowStack.TryRemove(typeof(Dialog_VanillaModSettings));
                Find.WindowStack.TryRemove(typeof(HugsLib.Settings.Dialog_ModSettings));

                Find.WindowStack.Add(page);
            }

            right.End();
            Widgets.EndScrollView();
        }
Ejemplo n.º 3
0
 public RealRuinsPlanetary_Mod(ModContentPack content)
     : base(content)
 {
     embeddedPage = new Page_RealRuins();
 }