/// <summary>Sets up the in-game mod config menu.</summary> private void TryLoadingGMCM() { //See if we can find GMCM, quit if not. var api = Helper.ModRegistry.GetApi <GenericModConfigMenu.GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu"); if (api == null) { Monitor.Log("Unable to load GMCM API.", LogLevel.Info); return; } api.RegisterModConfig(ModManifest, () => myConfig = new EconConfig(), () => Helper.WriteConfig(myConfig)); api.RegisterSimpleOption(ModManifest, "Supply and Demand", "Whether to monitor and adapt to the player's impact on supply and demand via sales and purchases.", () => myConfig.DoSupplyAndDemand, (bool val) => myConfig.DoSupplyAndDemand = val); api.RegisterSimpleOption(ModManifest, "Verbose Mode", "This turns on finely detailed debug messages. Don't set if you don't need it (you probably do not need it).", () => myConfig.VerboseMode, (bool val) => myConfig.VerboseMode = val); }
// *** EVENT HANDLING METHODS *** /// <summary>Initial configuration and etc.</summary> private void StartupTasks(object sender, GameLaunchedEventArgs e) { myConfig = myHelper.ReadConfig <EconConfig>(); TryLoadingGMCM(); List <MarketModel> loadedMarketsData = myHelper.Data.ReadJsonFile <List <MarketModel> >("markets.json"); if (loadedMarketsData != null) { Monitor.Log("Got list of market data."); foreach (MarketModel mm in loadedMarketsData) { Monitor.Log($"Found {mm.Context} market '{mm.DisplayName}'"); } } else { Monitor.Log($"Unable to load market data.", LogLevel.Error); } }