private void SetupConfig() { var api = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu"); if (api is null) { return; } var helper = new GMCMI18nHelper(api, ModManifest, Helper.Translation); api.Register( ModManifest, reset: () => Config = new ModConfig(), save: () => { Helper.WriteConfig(Config); SetupSprinklerBehavior(); } ); helper.AddEnumOption("config.sprinklerBehavior", () => Config.SprinklerBehavior); helper.AddBoolOption("config.compatibilityMode", () => Config.CompatibilityMode); helper.AddSectionTitle("config.cluster.section"); helper.AddBoolOption("config.cluster.splitDisconnected", () => Config.SplitDisconnectedClusters); helper.AddEnumOption("config.cluster.ordering", () => Config.ClusterBehaviorClusterOrdering); helper.AddEnumOption("config.cluster.betweenClusterBalance", () => Config.ClusterBehaviorBetweenClusterBalanceMode); helper.AddEnumOption("config.cluster.inClusterBalance", () => Config.ClusterBehaviorInClusterBalanceMode); helper.AddSectionTitle("config.floodFill.section"); helper.AddEnumOption("config.floodFill.balanceMode", () => Config.TileWaterBalanceMode); helper.AddSectionTitle("config.activation.section"); helper.AddBoolOption("config.activation.beforeSleep", () => Config.ActivateBeforeSleep); helper.AddBoolOption("config.activation.onPlacement", () => Config.ActivateOnPlacement); helper.AddBoolOption("config.activation.onAction", () => Config.ActivateOnAction); helper.AddSectionTitle("config.coverage.section"); helper.AddNumberOption("config.coverage.displayTime", () => Config.CoverageTimeInSeconds, min: 1f); helper.AddNumberOption("config.coverage.animationTime", () => Config.CoverageAnimationInSeconds, min: 0f); helper.AddNumberOption("config.coverage.alpha", () => Config.CoverageAlpha, min: 0f, max: 1f, interval: 0.05f); helper.AddBoolOption("config.coverage.overlayDuplicates", () => Config.CoverageOverlayDuplicates); helper.AddBoolOption("config.coverage.onPlacement", () => Config.ShowCoverageOnPlacement); helper.AddBoolOption("config.coverage.onAction", () => Config.ShowCoverageOnAction); helper.AddSectionTitle("config.sprinklerPower.section"); helper.AddNumberOption("config.sprinklerPower.tier1", () => Config.Tier1Power, min: 0); helper.AddNumberOption("config.sprinklerPower.tier2", () => Config.Tier2Power, min: 0); helper.AddNumberOption("config.sprinklerPower.tier3", () => Config.Tier3Power, min: 0); helper.AddNumberOption("config.sprinklerPower.tier4", () => Config.Tier4Power, min: 0); helper.AddNumberOption("config.sprinklerPower.tier5", () => Config.Tier5Power, min: 0); helper.AddNumberOption("config.sprinklerPower.tier6", () => Config.Tier6Power, min: 0); helper.AddNumberOption("config.sprinklerPower.tier7", () => Config.Tier7Power, min: 0); helper.AddNumberOption("config.sprinklerPower.tier8", () => Config.Tier8Power, min: 0); }
public static void AddMultiPageLinkOption <T>( this GMCMI18nHelper helper, string keyPrefix, Func <T, string> pageID, Func <float, int> columns, T[] pageValues, Func <T, string>?pageName = null, object?tokens = null ) { helper.Api.AddMultiPageLinkOption( mod: helper.Mod, name: () => helper.Translations.Get($"{keyPrefix}.name", tokens), tooltip: helper.GetOptionalTranslatedStringDelegate($"{keyPrefix}.tooltip", tokens), pageID: pageID, pageName: pageName ?? (pageValue => helper.Translations.Get($"{keyPrefix}.value.{pageValue}", tokens)), columns: columns, pageValues: pageValues ); }