feat: add error window for bad configs
This commit is contained in:
parent
74e1b7c9c4
commit
6d25b9db69
@ -1,4 +1,5 @@
|
|||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace HudSwap {
|
namespace HudSwap {
|
||||||
public class HudSwapPlugin : IDalamudPlugin {
|
public class HudSwapPlugin : IDalamudPlugin {
|
||||||
@ -11,8 +12,12 @@ namespace HudSwap {
|
|||||||
|
|
||||||
public void Initialize(DalamudPluginInterface pluginInterface) {
|
public void Initialize(DalamudPluginInterface pluginInterface) {
|
||||||
this.pi = pluginInterface;
|
this.pi = pluginInterface;
|
||||||
|
try {
|
||||||
this.config = this.pi.GetPluginConfig() as Configuration ?? new Configuration();
|
this.config = this.pi.GetPluginConfig() as Configuration ?? new Configuration();
|
||||||
|
} catch (Exception) {
|
||||||
|
this.pi.UiBuilder.OnBuildUi += PluginUI.ConfigError;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.config.Initialize(this.pi);
|
this.config.Initialize(this.pi);
|
||||||
|
|
||||||
this.ui = new PluginUI(this, this.pi);
|
this.ui = new PluginUI(this, this.pi);
|
||||||
|
@ -32,6 +32,17 @@ namespace HudSwap {
|
|||||||
private string importName = "";
|
private string importName = "";
|
||||||
private Guid selectedLayout = Guid.Empty;
|
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() {
|
public void DrawSettings() {
|
||||||
if (!this.SettingsVisible) {
|
if (!this.SettingsVisible) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user