static bool Load(UnityModManager.ModEntry modEntry) { try { Harmony instance = new Harmony(modEntry.Info.Id); instance.PatchAll(Assembly.GetExecutingAssembly()); settings = Settings.Load <Settings>(modEntry); // Set the default save location as a human readable path InteractiveConfiguration config = new InteractiveConfiguration(settings); settings.saveLocation = config.CombatLogWriteLocation; mod = modEntry; enabled = modEntry.Enabled; modEntry.OnToggle = OnToggle; modEntry.OnGUI = OnGUI; modEntry.OnSaveGUI = OnSaveGUI; #if DEBUG modEntry.OnUnload = Unload; #endif } catch (Exception ex) { LogError(ex); } return(true); }
void SceneLoaded(KCModHelper __helper) { ChamberOfWarUI chamberOfWarUI = GameUI.inst.chamberOfWarUI; Traverse chamberOfWarUITraverse = Traverse.Create(chamberOfWarUI); chamberOfWarUI_hazardPayToggle_m_IsOn = chamberOfWarUITraverse.Field("hazardPayToggle").Field("m_IsOn"); higherTaxesExists = HigherTaxesModExists(harmony); if (higherTaxesExists) { helper.Log("INFO: Higher Taxes mod found."); } else { helper.Log("INFO: Higher Taxes mod not found."); } if (!proxy) { var config = new InteractiveConfiguration <StateOfEmergencySettings>(); settings = config.Settings; ModSettingsBootstrapper.Register(config.ModConfig, (_proxy, saved) => { config.Install(_proxy, saved); proxy = _proxy; settings.autoHazardPaySettings.Setup(); settings.autoTowersSettings.Setup(); }, (ex) => { helper.Log($"ERROR: Failed to register proxy for {modName} Mod config: {ex.Message}"); helper.Log(ex.StackTrace); }); } }
public static void Setup() { var config = new InteractiveConfiguration <Settings>(); Settings.inst = config.Settings; Settings.inst.Config = config; AddListeners(); ModSettingsBootstrapper.Register(config.ModConfig, (proxy, oldSettings) => { OnModRegistered(proxy, oldSettings); }, (ex) => { OnModRegistrationFailed(ex); }); }
void SceneLoaded(KCModHelper __helper) { if (!proxy) { var config = new InteractiveConfiguration <IntelligentArmySettings>(); settings = config.Settings; ModSettingsBootstrapper.Register(config.ModConfig, (_proxy, saved) => { config.Install(_proxy, saved); proxy = _proxy; settings.Setup(); }, (ex) => { helper.Log($"ERROR: Failed to register proxy for {modName} Mod config: {ex.Message}"); helper.Log(ex.StackTrace); }); } }
public void Start() { helper.Log("START"); Inst = this; var config = new InteractiveConfiguration <KingdomRendererSettings>(); kingdomRendererSettings = config.Settings; LogModSettings(helper); // Set settings up ModSettingsBootstrapper.Register(config.ModConfig, (proxy, saved) => { config.Install(proxy, saved); OnModRegistered(proxy, saved); }, (ex) => { Debugging.Log("KingdomRenderer", $"Failed to register mod: {ex.Message}"); Debugging.Log("KingdomRenderer", ex.StackTrace); }); }
void Start() { modMenuException += ModMenuException; config = new InteractiveConfiguration <ModMenuSettings>(); ModSettingsBootstrapper.Register(config.ModConfig, SettingsRegistered, modMenuException); }