Closed ReveredRedHood closed 6 months ago
Let me know if you would prefer custom exceptions instead of how I approached it.
Example code:
Lib.PluginDetection.OnAllPluginsFinishedLoading += DetectPlugins; // ... private void DetectPlugins(object sender, EventArgs e) { var guid = Lib.PluginDetection.GetPluginGuidFromPartialGuid("Dialog"); Log.LogInfo(Lib.PluginDetection.IsPluginLoaded(guid)); Log.LogInfo(Lib.PluginDetection.AllPluginsFinishedLoading); BepInPlugin metadata = Lib.PluginDetection.GetPluginInfo(guid).Metadata; Log.LogInfo(metadata.GUID); Log.LogInfo(metadata.Name); Log.LogInfo(metadata.Version); var value = Lib.PluginDetection.GetPluginConfigEntryValue<bool>(guid, "Talk to Partner", "Can asking for the partner fail?"); Log.LogInfo(value); // To respond to in-game changes in plugin config Lib.PluginDetection.AddPluginConfigEntryChangedListener(guid, DialogAdditionsConfigSettingChanged); } private void DialogAdditionsConfigSettingChanged(SettingChangedEventArgs args) { Log.LogInfo(args.ChangedSetting.Definition.Section); Log.LogInfo(args.ChangedSetting.Definition.Key); Log.LogInfo(args.ChangedSetting.Description.Description); if (args.ChangedSetting.Definition.Key == "Example") { var value = (float)args.ChangedSetting.BoxedValue; // ... } }
Let me know if you would prefer custom exceptions instead of how I approached it.
Example code: