feat: add error window for bad configs
This commit is contained in:
parent
1f51eb9ce4
commit
356c9854a3
|
@ -1,4 +1,5 @@
|
|||
using Dalamud.Plugin;
|
||||
using System;
|
||||
|
||||
namespace HudSwap {
|
||||
public class HudSwapPlugin : IDalamudPlugin {
|
||||
|
@ -11,8 +12,12 @@ namespace HudSwap {
|
|||
|
||||
public void Initialize(DalamudPluginInterface pluginInterface) {
|
||||
this.pi = pluginInterface;
|
||||
|
||||
this.config = this.pi.GetPluginConfig() as Configuration ?? new Configuration();
|
||||
try {
|
||||
this.config = this.pi.GetPluginConfig() as Configuration ?? new Configuration();
|
||||
} catch (Exception) {
|
||||
this.pi.UiBuilder.OnBuildUi += PluginUI.ConfigError;
|
||||
return;
|
||||
}
|
||||
this.config.Initialize(this.pi);
|
||||
|
||||
this.ui = new PluginUI(this, this.pi);
|
||||
|
|
|
@ -32,6 +32,17 @@ namespace HudSwap {
|
|||
private string importName = "";
|
||||
private Guid selectedLayout = Guid.Empty;
|
||||
|
||||
private static bool configErrorOpen = true;
|
||||
public static void ConfigError() {
|
||||
if (ImGui.Begin("HudSwap error", ref configErrorOpen)) {
|
||||
ImGui.Text("Could not load HudSwap configuration.");
|
||||
ImGui.Spacing();
|
||||
ImGui.Text("If you are updating from a previous version, please\ndelete your configuration file and restart the game.");
|
||||
|
||||
ImGui.End();
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawSettings() {
|
||||
if (!this.SettingsVisible) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue